Thanks a lot for the help Meikel and Jim.
@ Meikel: it worked great as per your suggestion.

I was just hoping it would be a bit more dynamic and infer the types!!

On May 18, 11:48 pm, "Jim - FooBar();" <jimpil1...@gmail.com> wrote:
> Try wrapping your if statement in a let with a binding : [k
> (Integer/parseInt n) ]
> and then use k from then on....as Ankit said, arguments passed from cmd
> are always strings...
>
> Jim
>
> On 18/05/12 07:39, Ankit Goel 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

Reply via email to