I've got a simple function which loops through a list of strings, 
accumulating the total length of each, and returning a summary tuple based 
on some criteria.

The last part of the function looks like this:

    (loop [eligible-strings eligible-strings, counted-length 0, ind -1]
      (if (>= counted-length target-length)
        (list ind (- counted-length target-length))
        (recur (rest eligible-strings) (+ counted-length (.length (first 
eligible-strings))) (inc ind))))))

The stuff prior to this establishes the target-length condition, but that's 
not relevant to my question.

When I run this in the lein repl inside emacs (i.e., using nrepl), 
everything works as expected.

But when I use the standalone jar file created by 'lein uberjar', I get 
this error:

Exception in thread "main" java.lang.IllegalArgumentException: No matching 
field found: length for class java.lang.Long

Running 'lein check' gives me this, pointing to the line number for the 
code above:

core.clj:62 recur arg for primitive local: counted_length is not matching 
primitive, had: Object, needed: long
Auto-boxing loop arg: counted-length

Which I don't understand, since there's no reason for counted-length to be 
taken for an object (the first time it's defined is in the loop parameter, 
as shown above).

Another strange thing: initially, my project.clj file was missing an :aot 
reference after :main. 

When I added it, 'lein check' no longer gives me any errors or warnings, 
but when I create a standalone jar with 'lein uberjar' (after doing 'lein 
clean', 'lein check'), I get the same exception while running the 
standalone jar file.

So, how can I get the standalone jar file to work?

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to