The type of "n" (passed to main) is a string.  Command line arguments
are strings.

 - Brandon


On Thu, May 17, 2012 at 11:39 PM, Ankit Goel <ankit.ca...@gmail.com> wrote:
> Hi,
>
> I have recently started learning clojure and have been setting up
> leiningen for managing projects.
> I create a new project using "lein new" and modified the "src/
> factorial/core.clj" file to contain the following code
>
> (ns factorial.core
>  (:gen-class))
>
> (defn fact [n]
>  (if (= n 1)
>       1
>        (*  n  (fact (- n 1)))))
>
> (defn -main [n]
>  (fact n))
>
> This code runs fine in the REPL. However, when i run the jar file
> obtained after running "lein uberjar" i get the following error:
>
> "Exception in thread "main" java.lang.ClassCastException:
> java.lang.String cannot be cast to java.lang.Number"
>
> Why is there this difference in behavior between interactive and
> compiled code?
>
> Thanks,
>
> Ankit
>
> --
> 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

Reply via email to