Reader literal for clojure.lang.PersistentQueue?

Showing 1-8 of 8 messages
Reader literal for clojure.lang.PersistentQueue? Sean Corfield 4/16/12 11:23 AM
Now that we have reader literals, would it be useful to have a
built-in reader literal for this type?

#queue [] ;; create an empty clojure.lang.PersistentQueue
#queue [1 2 3 4]
--
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

Re: Reader literal for clojure.lang.PersistentQueue? Phil Hagelberg 4/16/12 11:41 AM
On Mon, Apr 16, 2012 at 11:23 AM, Sean Corfield <seanco...@gmail.com> wrote:
> Now that we have reader literals, would it be useful to have a
> built-in reader literal for this type?
>
> #queue [] ;; create an empty clojure.lang.PersistentQueue
> #queue [1 2 3 4]

Personally I much prefer the queue-fish representation:

user=> (conj (conj clojure.lang.PersistentQueue/EMPTY 12) 9)
<-(12 9)-<

-Phil

Re: Reader literal for clojure.lang.PersistentQueue? puzzler 4/16/12 12:07 PM
On Mon, Apr 16, 2012 at 11:23 AM, Sean Corfield <seanco...@gmail.com> wrote:
Now that we have reader literals, would it be useful to have a
built-in reader literal for this type?

#queue [] ;; create an empty clojure.lang.PersistentQueue
#queue [1 2 3 4]

+1 
Re: Reader literal for clojure.lang.PersistentQueue? Stuart Sierra 4/16/12 12:49 PM
Nice. You can, of course, add your own data reader symbol (namespaced) that creates PersistentQueue.

The <-(1 2 3)-< syntax would require more changes to the reader. Don't hold your breath.
-S
Re: Reader literal for clojure.lang.PersistentQueue? Sean Corfield 4/16/12 7:13 PM
On Mon, Apr 16, 2012 at 12:49 PM, Stuart Sierra
<the.stua...@gmail.com> wrote:
> Nice. You can, of course, add your own data reader symbol (namespaced) that
> creates PersistentQueue.

Indeed. And I may well do so for my code. But it seems that
PersistentQueue is common enough that a standard, built-in literal
syntax might be warranted?


--
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

Re: Reader literal for clojure.lang.PersistentQueue? Brian Taylor 4/17/12 4:56 AM
Are there reader literals in the Clojurescript reader yet?

--
You received this message because you are subscribed to the Google Groups "Clojure Dev" group.
To post to this group, send email to cloju...@googlegroups.com.
To unsubscribe from this group, send email to clojure-dev...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/clojure-dev?hl=en.


Re: Reader literal for clojure.lang.PersistentQueue? Stuart Sierra 4/18/12 10:12 AM
On Tuesday, April 17, 2012 7:56:23 AM UTC-4, Brian Taylor wrote:
Are there reader literals in the Clojurescript reader yet?

No. Needs a patch.
Re: Reader literal for clojure.lang.PersistentQueue? Fogus 4/27/12 7:32 AM
I've created a case for this at http://dev.clojure.org/jira/browse/CLJ-976

There is an open question stating:

Should the queue literal evaluate its arguments? The implications of this are illustrated below:

;; non-eval case
#queue [1 2 (+ 1 2)]

;=> #queue [1 2 (+ 1 2)]


;; eval case
#queue [1 2 (+ 1 2)]

;=> #queue [1 2 3]

I would appreciate feedback on the ticket itself.  Thank you.