Welcome! Please see the About page for a little more info on how this works.

+9 votes
in Syntax and reader by

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:

`
(conj clojure.lang.PersistentQueue/EMPTY :a :b :c)

;=> #
`

A better experience might be the following:

`

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:

`
;; 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.

20 Answers

0 votes
by

Comment made by: jafingerhut

clj-976-queue-literal-eval-and-synquote-patch-v3.txt dated oct 16 2012 is identical to Fogus's patch CLJ-976-queue-literal-eval-and-synquote.diff dated Jul 20 2012. It simply removes one line addition to clojure.iml that Rich has since added in a different commit, so that this patch now applies cleanly to latest master.

0 votes
by

Comment made by: jafingerhut

Fogus, with the recent commit of a patch for CLJ-1070, my touched-up patch clj-976-queue-literal-eval-and-synquote-patch-v3.txt dated Oct 16 2012 doesn't apply cleanly. In this case it isn't simply a few lines of context that have changed, it is the interfaces that PersistentQueue implements have been changed. It might be best if you take a look at the latest code and the patch and consider how it should be updated.

0 votes
by

Comment made by: steveminer@gmail.com

Related to CLJ-1078.

0 votes
by

Comment made by: alexmiller

Moving back to Triaged as Rich has not vetted.

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJ-976 (reported by fogus)
...