Wouldn't it be better to implement this as an automatic optimization, just
like PersistentArrayMap vs PersistentHashMap ?
fwiw, I'm cautiously in favor of #[] being used for queues.
On Sunday, December 30, 2012 3:45:24 AM UTC-8, Jozef Wagner wrote:
>
> I use it in Clojurescript for a custom tuple type.
>
> For small number of items, deftypes are way faster to create and access
> than PersistentVectors. I use tuple type e.g. for returning multiple values
> from a function. Implementing #[] allowed me to have a compact syntax for
> creating and destructuring such tuples.
>
> (defn foo [a b]
> #[(+ a b) (- a b) (* a b)])
>
> (defn foo []
> (let [#[plus minus times] (foo 1 2)]
> (str "bla bla" plus "blaah" minus)))
>
> JW
>
> On Friday, December 28, 2012 11:15:52 PM UTC+1, vemv wrote:
>>
>> I was just wondering - given that we have the #() and #{} literals, why
>> not a #[] as well? Queues look like a good fit.
>>
>
--
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