2010/12/8 Michael Gardner <gardne...@gmail.com>

> 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.
>
>
Well, to the contrary, I think it would be a different abstraction from seq.
seq abstraction is for providing a "view" over things which are seqable, but
not necessarily data structures: can be streams, etc. And some
datastructures know how to present a seq "view" of them without placing an
importance on the sequential aspect of this (the ordering of the elements of
the seq).

So this "new" abstraction would concern less input than seq. Only the input
for which ordering is an information (Strings, vectors, etc.).

Meikel showed the way, though it's different enough in semantics to deserve
its own protocol and not override (in fact replace, in his example) existing
concepts.

Now I don't (really, I don't) know if there's interest in providing this, at
this level of genericity.


> 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<clojure%2bunsubscr...@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 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

Reply via email to