On 02/07/13 12:42, Islon Scherer wrote:
Well, maybe most of the time, but there's cases where the concrete
type semantics matters a lot, specially with sets but sometimes with
vectors too, right now i'm using into or just calling vec|set or
reducers library but maybe I'll try to implement this generics library
I just talk about as it's really easy to do that in clojure =)
Yes I actually agree...there are times where you don't want to mess with
the types. In my work, this often comes up in clojure-java interop. I
recently implemented a 'DataSet' protocol and extended it to all
collection types (both persistent and non-persistent). Yes sure there is
some code duplication, but now I can 'normalise' any collection (or
gather basic statistics from it) using the most efficient way (depending
on the type) and without messing with the actual concrete types. you can
see the approach here:
https://github.com/jimpil/hotel-nlp/blob/master/src/hotel_nlp/tools/normalito/core.clj
Jim
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.