Loading [MathJax]/extensions/tex2jax.js

2010年7月15日木曜日

Find the last box of a list

;; P01 (*) Find the last box of a list.
;; Example:
;; * (my-last '(a b c d))
;; (D)
(define (my-last lst)
(if (null? lst)
'()
(let ((tail (cdr lst)))
(if (null? tail)
lst
(my-last tail)))))
view raw p01.ss hosted with ❤ by GitHub

0 件のコメント:

コメントを投稿