Changes between Version 11 and Version 12 of Tutorial5


Ignore:
Timestamp:
Feb 18, 2013, 10:13:24 AM (9 years ago)
Author:
schiptsov
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Tutorial5

    v11 v12  
    2828        (f (+ 1 x) (cdr l)))))  ; a tail call
    2929}}}
    30 reverse - naive
     30reverse
    3131{{{
    32 (define (reverse l)
     32(define (reverse l)                      ; naive
    3333   (if (null? l)
    3434       '()
     
    4949      '()
    5050      (cons lo (range (+ 1 lo) hi))))
     51}}}
     52append
     53{{{
     54(define (append l1 l2)              ; naive yet beautiful
     55  (if (null? l1)
     56      l2
     57      (cons (car l1)
     58            (append (cdr l1) l2))))
    5159}}}
    5260map