You can also patch the LispReader in jvm Clojure without dropping to Java. 
Here's an example of that to add a #b reader 
literal: 
https://github.com/dgrnbrg/piplin/blob/master/src/piplin/types/bits.clj#L216

On Sunday, December 30, 2012 7:38:44 AM UTC-6, Ambrose Bonnaire-Sergeant 
wrote:
>
> Jozef,
>
> How do you achieve that?
>
> Thanks,
> Ambrose
>
> On Sun, Dec 30, 2012 at 7:45 PM, Jozef Wagner 
> <jozef....@gmail.com<javascript:>
> > 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 clo...@googlegroups.com<javascript:>
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com <javascript:>
>> 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