We're updating the issue view to help you get more done. 

Implement reader literal and print support for PersistentQueue data structure

Description

Clojure's PersistentQueue structure has been in the language for quite some time now and has found its way into a fair share of codebases. However, the creation of queues is a two step operation often of the form:

1 2 3 (conj clojure.lang.PersistentQueue/EMPTY :a :b :c) ;=> #<PersistentQueue clojure.lang.PersistentQueue@78d5f6bc>

A better experience might be the following:

1 2 3 4 5 6 7 #queue [:a :b :c] ;=> #queue [:a :b :c] (pop #queue [:a :b :c]) ;=> #queue [:b :c]

This syntax is proposed and discussed in the Clojure-dev group at https://groups.google.com/forum/?fromgroups#!topic/clojure-dev/GQqus5Wycno

Open question: Should the queue literal's arguments eval? The implications of this are illustrated below:

1 2 3 4 5 6 7 8 9 10 ;; non-eval case #queue [1 2 (+ 1 2)] ;=> #queue [1 2 (+ 1 2)] ;; eval case #queue [1 2 (+ 1 2)] ;=> #queue [1 2 3]

The answer to this open question will determine the implementation.

Environment

None

Status

Assignee

Fogus

Reporter

Fogus

Approval

None

Patch

Code and Test

Affects versions

Release 1.5

Priority

Minor