On Nov 23, 7:36 am, samppi <rbysam...@gmail.com> wrote:
> The following code contains an error, and I cannot figure out what it
> is at all. When I run StateMeta's test once, the statement marked with
> a comment above fails. When I run it again, it succeeds. This has been
> causing very weird bugs in my code. I've replicated the behavior in
> both a script and the REPL. Here's the bugged code:
>
[snip]

I recommend that you try and find a minimal version of a program that
exhibits the bug. This makes it so much easier to fix quickly. In your
case, it looks like the combination of varargs and protocol functions:

krukow:~/emacs/clojure/clojure$ rlwrap java -cp
clojure-1.1.0-75cd05080f7260c54007d7728fb280ae53b56f63.jar
clojure.main
Clojure 1.1.0-alpha-SNAPSHOT
user=> (defprotocol P (foo [x & args]))
P
user=> (deftype T [x])
#'user/T
user=> (extend ::T P {:foo (fn [x & args] args)})
nil
user=> (foo (T 42) 1 2 3)
java.lang.IllegalArgumentException: Wrong number of args passed to:
user$eval--12$fn--14$G--1 (NO_SOURCE_FILE:0)
user=>

Perhaps varargs isn't supported yet?

/Karl

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