Play audio slide show -- Keyboard shortcut: 'x'  Back to slide -- Keyboard shortcut: 'u'        next -- Keyboard shortcut: 'n'  Annotated program -- Keyboard shortcut: 't'      hilbert-clean.laml - The function hilbert programmed in Scheme as a functional program.Lecture 3 - slide 31 : 42
Program 1

(define (hilbert n turn)
 (cond ((= n 0) (empty-hilbert-curve))
       ((> n 0)
         (cond 
             ((eq? turn 'up) 
               (concat-path
                 (hilbert (- n 1) 'right)  
                 (up-line)
                 (hilbert (- n 1) 'up)  
                 (right-line)
                 (hilbert (- n 1) 'up)  
                 (down-line)
                 (hilbert (- n 1) 'left) ))

             ((eq? turn 'left) 
               (concat-path
                 (hilbert (- n 1) 'down)  
                 (left-line)
                 (hilbert (- n 1) 'left)  
                 (down-line)
                 (hilbert (- n 1) 'left)  
                 (right-line)
                 (hilbert (- n 1) 'up)))

             ((eq? turn 'right)
               (concat-path
                 (hilbert (- n 1) 'up)  
                 (right-line)
                 (hilbert (- n 1) 'right)  
                 (up-line)
                 (hilbert (- n 1) 'right)  
                 (left-line)
                 (hilbert (- n 1) 'down)))

             ((eq? turn 'down)
               (concat-path
                 (hilbert (- n 1) 'left)  
                 (down-line)
                 (hilbert (- n 1) 'down)  
                 (left-line)
                 (hilbert (- n 1) 'down)  
                 (up-line)
                 (hilbert (- n 1) 'right)))
           ))))