2014-10-06から1日間の記事一覧

手続きlast-pairの実装

与えられた(空でない)リストの最後の要素だけからなるリストを返す手続きを定義する定義例 (define (last-pair items) (if (= (length items) 2) (cdr items) (last-pair (cdr items)) )) 実行例 > (define a (list 23 72 139 32 88)) a> (display a) (23 7…