Thanks for the links, I understand a little better now what it is about ...
... and I find Lutz's example (in NewLISP) clearer and more readable (and more "Lispic") than those in CloJure.
CloJure
Code: Select all
(def flat "flat")
(def tree '(("one" ("two")) "three" ((("four")))))
;; Simple binding (like Common Lisp's LET*).
(let [var1 flat
var2 tree]
(list var1 var2))
-> ("flat" (("one" ("two")) "three" ((("four")))))
;; Full destructuring.
(let [var1 flat
[[a [b]] c [[[d]]]] tree]
(list var1 a b c d))
-> ("flat" "one" "two" "three" "four")
NewLISP
Code: Select all
(set 'flatten "flat")
(set 'tree '(("one" ("two")) "three" ((("four")))))
;; Simple binding (like Common Lisp's LET*)
(let (var1 flatten
var2 tree)
(list var1 var2))
;-> ("flat" ("one" ("two")) "three" ((("four"))))
;; Full destructuring.
(let (var1 flatten)
(bind (unify '((A (B)) C (((D)))) tree))
(list var1 A B C D))
;-> ("flat" "one" "two" "three" "four")
N.B.:
(flat (list flatten tree)) seems simpler for full destructuring ;-)
That gave rise to play with
unify and above all to understand it.
(And I did not finish understanding yet)
;-)