racket 學習筆記

length:spa

(define (my-length lst)
  (if (empty? lst) 0
      (+ (my-length (rest lst)) 1)))

map:rest

(define (my-map f lst)
  (if (empty? lst) empty
     (cons (f (first lst)) (my-map f (rest lst))) ))
相關文章
相關標籤/搜索