Re: Rationale for `keys` not supporting vectors?

2016-07-11 Thread Alex Miller
As background re the collection 
model: http://insideclojure.org/2016/03/16/collections/

Keys and vals are both defined as functions that take a seqable of map 
entries. Given that definition, it is not easily possible to widen it to 
also take a collection with the associative trait, because a collection 
like vector will not produce a seq of entries, but rather a seq of vector 
values. The ability to seq to map entries is something only provided by 
maps. 

Yes, it would be possible to make a function that worked on either, but I 
think doing so would break the existing contract of these functions, not 
extend it.

To the design question of whether it should have been done this way or not 
in the first place, that's harder for me to say. 


On Friday, July 8, 2016 at 11:50:22 PM UTC-5, Michael Gardner wrote:
>
> I've looked around, but couldn't find any discussion on the topic. Is it 
> purely an implementation thing, or a design choice? 
>
> (Yes, I realize you can just do (range (count v)).)

-- 
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/d/optout.


Re: Rationale for `keys` not supporting vectors?

2016-07-11 Thread Sam Estep
I asked a question about this on Stack Overflow; you may be interested in 
the discussion there: http://stackoverflow.com/q/35341969/5044950

On Saturday, July 9, 2016 at 12:50:22 AM UTC-4, Michael Gardner wrote:
>
> I've looked around, but couldn't find any discussion on the topic. Is it 
> purely an implementation thing, or a design choice? 
>
> (Yes, I realize you can just do (range (count v)).)

-- 
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/d/optout.


Re: Rationale for `keys` not supporting vectors?

2016-07-10 Thread Daniel Compton
keys is implemented here

against
the abstract class APersistentMap. That it doesn’t work against vectors is
an implementation detail, but I could imagine that the reason it was done
this way was a design choice.

On Sat, Jul 9, 2016 at 4:50 PM Michael Gardner  wrote:

> I've looked around, but couldn't find any discussion on the topic. Is it
> purely an implementation thing, or a design choice?
>
> (Yes, I realize you can just do (range (count v)).)
>
> --
> 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/d/optout.
>
-- 
—
Daniel

-- 
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/d/optout.


Rationale for `keys` not supporting vectors?

2016-07-08 Thread Michael Gardner
I've looked around, but couldn't find any discussion on the topic. Is it purely 
an implementation thing, or a design choice?

(Yes, I realize you can just do (range (count v)).)

-- 
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/d/optout.