last xs | zs++[e] =:= xs = e where zs,e free
last xs | zs++[e] =:= xs
= e
where zs,e free
うーん、とっても不思議なコードだー。
Schemeだったら
(define (last xs) (if (null? (cdr xs)) (car xs) (last (cdr xs))))
(define (last xs)
(if (null? (cdr xs))
(car xs)
(last (cdr xs))))
みたいに関数呼び出しがあるコードになるのにー。
Permalink | 記事への反応(0) | 21:58
ツイートシェア