Fork me on GitHub
#clojure-dev
<
2019-01-16
>
Vincent Cantin19:01:56

… while this is working:

`{1 ~@[2 3] 4 ~@[5 6]}
=> {1 2, 3 4, 5 6}

hiredman20:01:24

user=> '`{1 ~@[2 3] 4}
Syntax error reading source at (REPL:1:16).
Map literal must contain an even number of forms
user=> '`{1 ~@[2 3] 4 ~@[5 6]}
(clojure.core/apply clojure.core/hash-map (clojure.core/seq (clojure.core/concat (clojure.core/list 1) [2 3] (clojure.core/list 4) [5 6])))
user=>

taylor20:01:24

the first has an odd # of items in the map literal; the second has an even #. it fails in the reader

Vincent Cantin20:01:36

The problem prevents legitimate macro expansion via the unquote-splicing within maps, like this one:

{:a :b, ~@my-pair}

hiredman20:01:12

what makes you think that is legitimate?

Vincent Cantin20:01:23

I should say that it prevents convenience for normal usage - my first example shown uneven placement of the pairs.