Re: What would you use a #[] data literal for?

2013-01-04 Thread Jim - FooBar();
ok...It turns out I can answer my own question!a blog post by Brian Carper [1] cleared it out for me...I am looking for a *custom literal* - not a tagged literal and for that one has to patch the reader which I'm sure is *not* a good idea! anyway it seems I 've misunderstood certain things

Re: What would you use a #[] data literal for?

2013-01-04 Thread Jim - FooBar();
Greetings and all best wishes for 2013 to everyone!!! :-) First of all, forgive me for hijacking this thread but I what I started to do originated from this thread and so I feel it is related. So, for the fun (and the learning) of it, I thought to create a queue literal myself as suggested in

Re: What would you use a #[] data literal for?

2013-01-04 Thread Jozef Wagner
Hi, I've reworked my tuple type into an ArrayVector type. Instead of using #[] reader macro, ArrayVector replaces PersistentVector for small vectors and falls back to PersistentVector as it grows. Fast destructuring is achieved with ^ArrayVector hint. See http://dev.clojure.org/jira/browse/CLJ

Re: What would you use a #[] data literal for?

2013-01-04 Thread kovas boguta
One idea is to reserve #[] for a concept that supersedes macros. For instance, we have yet to apply the concept of protocols to macros. Another direction is recursive subexpansion, a la mathematica. If you consider transformations between code and data, there are 4 possibilities: data->data (thi

Re: What would you use a #[] data literal for?

2013-01-01 Thread Jozef Wagner
Yes I have patched destructuring, http://goo.gl/Xc23p , and I use #[] for both tuple creation and destructuring, see example in my earlier message. Type hinting could be a nicer solution, I've never thought of it. Will try. JW On Tuesday, January 1, 2013 1:40:50 AM UTC+1, Brandon Bloom wrote: >

Re: What would you use a #[] data literal for?

2012-12-31 Thread Brandon Bloom
> Significant performance gain is achieved when destructuring by skipping nth and directly calling type fields instead. Have you also patched the destructuring mechanism? > Concrete vector implementation is not known when destructuring, so I'm left with a custom reader literal. How does the re

Re: What would you use a #[] data literal for?

2012-12-31 Thread Jozef Wagner
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 Mond

Re: What would you use a #[] data literal for?

2012-12-31 Thread Jozef Wagner
This is great! I will use it for my #[] reader literal. Thank you, JW On Monday, December 31, 2012 1:20:11 AM UTC+1, dgrnbrg wrote: > > 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/dgrnbr

Re: What would you use a #[] data literal for?

2012-12-30 Thread dgrnbrg
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: > > Joze

Re: What would you use a #[] data literal for?

2012-12-30 Thread Brandon Bloom
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 tupl

Re: What would you use a #[] data literal for?

2012-12-30 Thread Jozef Wagner
By patching LispReader in Clojure, http://goo.gl/tWnkq and ClojureScript compiler http://goo.gl/nyKc5 . Used in closed source project, so I can use my own flavor of Clojure there. JW On Sunday, December 30, 2012 2:38:44 PM UTC+1, Ambrose Bonnaire-Sergeant wrote: > > Jozef, > > How do you achie

Re: What would you use a #[] data literal for?

2012-12-30 Thread Ambrose Bonnaire-Sergeant
Jozef, How do you achieve that? Thanks, Ambrose On Sun, Dec 30, 2012 at 7:45 PM, 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 mul

Re: What would you use a #[] data literal for?

2012-12-30 Thread Jozef Wagner
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 destruct

What would you use a #[] data literal for?

2012-12-28 Thread vemv
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