Sina K. Heshmati wrote:
> Meikel Brandmeyer wrote:
>> Am 30.05.2010 um 16:39 schrieb Sina K. Heshmati:
>>
> I'll later try to see if I can export datatypes from within a closure.
The atomic 'state' doesn't seem to be visible to the datatype methods. The
question is why?
(defprotocol prot-a
(op-a [self x y]))
(let [state (atom 10)]
(deftype t-a [member]
prot-a
(op-a [self x y]
(+ (.member self) x y @state))))
(def t-a-instance (t-a. 5))
This example is in:
http://github.com/sindoc/algorithms/blob/master/src/test/clojure/whiteboard/y2010/hide-adt-state/datatype-in-closure-01.clj
Thank you in advance,
SinDoc
--
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