Comment detail
アレイのuniq (Nested Flatten)
こちらこそ。foldを使うなんて思い付きませんorz
リストの処理で、foldを使うのならこういうのも。最後にreverseするのが残念な感じですが。!無しで。
1 2 3 4 5 6 | (define (uniq a)
(reverse
(fold (lambda (e knil)
(if (member e knil)
knil
(cons e knil))) () a)))
|
毎回 (null? l) する無駄や (append l (list e)) あたりの汚さが 消えてすっきりキレイに! なるほど納得。ありがとうございます。






es
#465()
[
Scheme
]
Rating0/0=0.00
Rating0/0=0.00-0+
2 replies [ reply ]