Significant performance gain is achieved when destructuring by skipping nth 
and directly calling type fields instead. Concrete vector implementation is 
not known when destructuring, so I'm left with a custom reader literal.

I seldom use queues but they seem like a good fit for a #[]

JW

On Monday, December 31, 2012 1:03:39 AM UTC+1, Brandon Bloom wrote:
>
> 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 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