I've been playing with some code recently. I was wondering how hard
would it be to implement, for example ISeq in clojure. The plan was to
use deftype and a few bits of other code.
The ISeq interface looks like this:
public interface ISeq extends IPersistentCollection {
Object first();
ISeq next();
ISeq more();
ISeq cons(Object o);
}
And here is the problem -- it looks exactly like this! There is no
documentation. While first and cons are guessable, I am still not sure
of the difference between next and more. Likewise, IPersistentCollection
has "equiv" and "empty" -- guessable again.
The other question: is it possible to have two mutually refering deftype
definitions.
So
(deftype Alice ()
(other [] (Brian.)))
(deftype Brian ()
(other [] (Alice.)))
The closest I have got it:
(declare create-alice)
(declare create-brian)
(deftype Alice ()
(other [] (create-brian)))
(deftype Brian ()
(other [] (create-alice)))
The last could be
(deftype Brian ()
(other [] (Alice.)))
but the symmetry seemed good.
--
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
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.