Even if this gets fixed, I don't think it's a good idea to give
parameters the same name as a widely used function. It's bound to
confuse someone.

On Thu, Jan 15, 2009 at 1:12 PM, Hugh Winkler <hwink...@gmail.com> wrote:
>
> I just encountered a surprise attempting to return a function from a
> function. In the below case, if the function parameter is named "fn",
> then calling the function throws an exception. If the function
> parameter is named "f", no problem. (Using svn as of yesterday)
>
> (defn no-problem[f]
>  (fn [] (apply f [])))
> (no-problem #(prn 99))  ;; returns a function as expected
>
> (defn problem[fn]
>  (fn [] (apply fn [])))    ;; same code as above but renamed
> function parameter to "fn"
>
> (problem #(prn 99)) ;; prints out "99" and throws an exception :
>
>
> java.lang.IllegalArgumentException: Wrong number of args passed to:
> dispatch$eval--3402$fn (NO_SOURCE_FILE:0)
>  [Thrown class clojure.lang.Compiler$CompilerException]
>
> Restarts:
>  0: [ABORT] Return to SLIME's top level.
>  1: [CAUSE] Throw cause of this exception
>
> Backtrace:
>  0: clojure.lang.Compiler.eval(Compiler.java:4179)
>  1: clojure.core$eval__3733.invoke(core.clj:1582)
>  --more--
>
> Regards,
>
> Hugh
>
> >
>



-- 
R. Mark Volkmann
Object Computing, Inc.

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