This is exactly where "reify" is used for. There is a succinct piece of
description in "The Joy of Clojure" on Page 198, from where I quote the
following code example: (FIXO is a protocol like your symbolicExpr)
(defn fixed-fixo
([limit] (fixed-fixo limit []))
([limit vector]
(reify FIXO
(fixo-push [this value]
(if (< (count vector) limit)
(fixed-fixo limit (conj vector value))
this))
(fixo-peek [_]
(peek vector))
(fixo-pop [_]
(pop vector)))))
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en