William James
5/26/2015 7:54:00 AM
> How to write the following using loop or iterate:
>
> ? (match '(0 ((2 (0 1)) ((3 2) 1)))
> ((:or (:and (:type atom) (:adjoin test 'eq into ?x)) (:self :self)) x))
> (0 2 1 3)
Gauche Scheme:
(delete-duplicates (let go ((x '(0 ((2 (0 1)) ((3 2) 1)))))
(append-map (^x (if (list? x) (go x) (list x))) x)))
===>
(0 2 1 3)
Racket:
(require srfi/1)
(delete-duplicates (flatten '(0 ((2 (0 1)) ((3 2) 1)))))
MatzLisp:
[0, [[2, [0, 1]], [[3, 2], 1]]].flatten.uniq
==>[0, 2, 1, 3]
--
He has nothing but kind sentiments for those who would destroy his home and
family.... He is universally tolerant. He is totally unprejudiced. If he has
any principles, he keeps them well concealed.... He is, to the extent of his
abilities, exactly like the next citizen, who, he trusts, is trying to be
exactly like him: a faceless, characterless putty-man.
--- Father Feeney; "Should Hate Be Outlawed?"