You need a mutable variable, such as an atom:
user> (defn prop [x]
(let [a (atom x)]
(fn
([] @a)
([x] (reset! a x)))))
#'user/prop
user> (def p (prop 5))
#'user/p
user> (p)
5
user> (p 6)
6
user> (p)
6
user>
--
Note that posts from new members are moderated - please be patient with your
first post.
---
You received this message because you are subscribed to the Google Groups
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/clojurescript.