Hi,

Look at your parenthesis.
You did not close your first function.

Antoine

2012/5/17 Sargash <gerby...@gmail.com>

> Hi!
>
> I have a problem. With that code:
>
> ; =======================================
> ; ex 1.17 multiply
> (defn ex1_17 []
>  (defn double [x] (+ x x))
>  (defn halve [x] (/ x 2))
>
>  (defn * [a b]
>    (cond
>      (= b 0) 0
>      (even? b) (* (double a) (halve b))
>      :else (+ a (* a (- b 1)))))
>
>  (println (* 5 5))
> )
> (ex1_17 )
>
> I gave that exception:
>
> Exception in thread "main" java.lang.NullPointerException, compiling:
> (D:\workprivate\ll\1\src\first.clj:3)
>        at clojure.lang.Compiler.analyzeSeq(Compiler.java:6462)
>        at clojure.lang.Compiler.analyze(Compiler.java:6262)
>        at clojure.lang.Compiler.analyzeSeq(Compiler.java:6443)
>        at clojure.lang.Compiler.analyze(Compiler.java:6262)
>        at clojure.lang.Compiler.access$100(Compiler.java:37)
>        at clojure.lang.Compiler$DefExpr$Parser.parse(Compiler.java:518)
>        at clojure.lang.Compiler.analyzeSeq(Compiler.java:6455)
>        at clojure.lang.Compiler.analyze(Compiler.java:6262)
>        at clojure.lang.Compiler.analyze(Compiler.java:6223)
>        at clojure.lang.Compiler.eval(Compiler.java:6515)
>        at clojure.lang.Compiler.load(Compiler.java:6952)
>        at clojure.lang.Compiler.loadFile(Compiler.java:6912)
>        at clojure.main$load_script.invoke(main.clj:283)
>        at clojure.main$script_opt.invoke(main.clj:343)
>        at clojure.main$main.doInvoke(main.clj:427)
>        at clojure.lang.RestFn.invoke(RestFn.java:408)
>        at clojure.lang.Var.invoke(Var.java:415)
>        at clojure.lang.AFn.applyToHelper(AFn.java:161)
>        at clojure.lang.Var.applyTo(Var.java:532)
>        at clojure.main.main(main.java:37)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> 39)
>        at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> 25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at com.intellij.rt.execution.application.AppMain.main(AppMain.java:
> 120)
> Caused by: java.lang.NullPointerException
>        at clojure.lang.Compiler$ObjExpr.emitVar(Compiler.java:4774)
>        at clojure.lang.Compiler$DefExpr.emit(Compiler.java:418)
>        at clojure.lang.Compiler$BodyExpr.emit(Compiler.java:5659)
>        at clojure.lang.Compiler$FnMethod.doEmit(Compiler.java:5215)
>        at clojure.lang.Compiler$FnMethod.emit(Compiler.java:5069)
>        at clojure.lang.Compiler$FnExpr.emitMethods(Compiler.java:3600)
>        at clojure.lang.Compiler$ObjExpr.compile(Compiler.java:4233)
>        at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3732)
>        at clojure.lang.Compiler.analyzeSeq(Compiler.java:6453)
>        ... 24 more
>
> Could you tell me where I wrong?
>
> --
> 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