On Dec 8, 2010, at 4:05 PM, Surgo wrote: > That's a fair criticism. I suppose that I'm not necessarily looking > for specifically String manipulation abstractions (I can just do a > (.substr "abc" 1) to get "bc" as a String after all), but rather > looking for an abstraction that takes something that's addressable as > a sequence and returns it in the same format or type instead of a seq.
So something like an inverse to (seq)? You could write such a thing, though it would have to know about each type (seq) knows about. More importantly, it would have to somehow know what type the thing originally was, since there's no difference between e.g. (seq "abc") and (seq [\a \b \c]). You'd either have to store the type when calling (seq) and manually pass it when calling the inverse function, or else I suppose you could write a wrapper for (seq) that adds metadata about what type the thing originally was. Incidentally, while testing this last idea, I was surprised to find that :type metadata is treated specially: => (with-meta '() {:type (type [])}) [] I assume this means :type is used internally by Clojure somehow. I notice clojure.org says that metadata "is used to convey information to the compiler about types", but ought there be a list of "reserved" metadata? -- 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