this is because the #() checks for arguments used inside its body to infer
its arity. in #(alert "..") you don't use any arg so it creates a function
with no argument, such as doing (fn [] ..)
 Il giorno 17/ago/2012 11.50, "Jim - FooBar();" <jimpil1...@gmail.com> ha
scritto:

> Hi everyone,
>
> I was surprised to discover that anonymous functions will not work in
> seesaw...For example the following throws an exception (wrong number of
> args):
>
> (button :text "Undo"  :listen [:action #(alert "Not implemented!")])
>
> but if i replace the anonymous fn with (fn [e] (alert "Not implemented!"))
> it works just fine!!!the same is true for when defining an action like so:
>
> (action :handler (fn [e] (alert "Not implemented!"))
>                         :name "Save"
>                         :tip "Save a game to disk."
>                         :key "menu S")
>
> If it was an anonymous fn it would throw an exception...This is very weird
> for me cos I know that anonymous fns take variable number of args so i
> don't see what the problem is...any explanations/suggestions?
>
> Most of the ssesaw docs show examples using (fn [e] (... ...)) but I'm
> sure I've seen snippets that use #(... ...). What is going on?
>
> Jim
>
> --
> 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+unsubscribe@**googlegroups.com<clojure%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/**group/clojure?hl=en<http://groups.google.com/group/clojure?hl=en>
>

-- 
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