2010/11/5 ka <[email protected]>:
> static public ISeq seq(Object coll){
> if(coll instanceof ASeq)
> return (ASeq) coll;
> else if(coll instanceof LazySeq)
> return ((LazySeq) coll).seq();
> else
> return seqFrom(coll);
> }
>
> @Laurent,
>> * first, when I see calls to (instance?) (satisifies?), it rings a bell in
>> my head. "design problem".
> Do you see the above seq method as a design problem? - or if you don't
> care about Java, consider clojure.walk.
Yes. And protocols were created to avoid that.
>
> If I understand you correctly (probability of which is less) you don't
> really see protocols as defining abstractions - but just as a
> convenient tool for polymorphism. Like:
As was said by David, polymorphism is already a kind of abstraction ?
>
> (extend ReallyCool clojure.contrib.json/Write-JSON
> {:write-json ...})
>
> But all of this discussion is kind of bypassing my original question,
Sorry for having hijacked the thread with my thoughts :-/
--
Laurent
--
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