Come to think of it, why not redefine #(...) in the following way:

If (count [...]) is 0 or > 1 , then the old semantics stays 
If (count [...]) is 1, then the new semantics kicks in (i.e., without 
enclosing brackets).

This would allow (#({:a %}) :b) to behave in a sane way

In case f is actually a function of no arguments, for #(f) you would get 

(fn [] f)

which is also more likely what you actually want compared to the old meaning

(fn [] (f))

which is equivalent to f (and therefore there is no need to write #(f) in 
the first place).


On Monday, June 4, 2012 2:53:09 AM UTC+1, Steven Obua wrote:
>
> The expression
>
> (#({:a %}) :b)
>
> should evaluate to {:a :b}, but raises an exception instead:
>
> Wrong number of args (0) passed to: PersistentArrayMap
>
> This is a pretty irritating bug and makes the #% form essentially unusable 
> for me, because I cannot rely on it but have to always second guess if its 
> use is safe in the current context or not.
>

-- 
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 new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to