user=> (defn foo [a] "") #'user/foo user=> (defn foo->foo2 [a b] "") #'user/foo->foo2 user=> (foo (foo->foo2 "a")) java.lang.IllegalArgumentException: Wrong number of args (1) passed to: user$foo (NO_SOURCE_FILE:0)
This example illustrates the problem. The exception indicates that the foo function has the wrong number of arguments. But it has one argument which is correct. It is actually the foo->foo2 function which should have two arguments but has one. I am using clojure 1.2. Thanks, cc On 12 September 2011 14:00, Chouser <chou...@gmail.com> wrote: > On Fri, Sep 9, 2011 at 4:47 AM, Christina Conway > <ccon...@annadaletech.com> wrote: > > A function name contains the characters -> > > e.g. foo->fn > > The function causes an exception. > > However the exception is not reported on the function but on another > > function called before it. > > java.lang.IllegalArgumentException: Wrong number of args (1) passed > > to: datetime$other-fn > > > > If the > character is removed from the function name > > e.g. foo-fn > > then the same exception is thrown but on the function itself: > > java.lang.IllegalArgumentException: Wrong number of args (1) passed > > to: datetime$foo-fn > > > > If the - character is removed from the function name > > e.g. foo>fn > > then the exception is thrown on the function as follows: > > java.lang.IllegalArgumentException: Wrong number of args (1) passed > > to: datetime$foo-GT-fn > > > > The foo->fn function is compiled to a .class file as: > > foo__GT_fn.class > > The foo>fn function is compiled to a .class file as: > > foo_GT_fn.class > > The foo-fn function is compiled to a .class file as: > > foo_fn.class > > > > Has anybody else encountered this with function names containing ->. > > Is this a bug? > > I was unable to reproduce the problem: > > user=> (defn foo->fn [] (throw (Exception. "bad thing"))) > #'user/foo->fn > user=> (defn other-fn [] (foo->fn)) > #'user/other-fn > user=> (other-fn) > Exception bad thing user/foo->fn (NO_SOURCE_FILE:1) > > Perhaps you can post a minimal example that demonstrates the problem. > Also, what version of Clojure are you using? > > --Chouser > > -- > 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 > -- 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