Hi,

I tried to create the function below in a Lighttable instarepl.  In lieu of
any better idea for formatting, the <  > statements below indicate
instarepl output.

(defn avged ([x]
((def sumed (reduce + x)) < 10 >
(def counted (count x)) < 4 >
(def result (/ sumed counted)) < 5/2 >
result
)))

(avged [1 2 3 4]) < java.lang.ClassCastException: java.lang.Long cannot be
cast to clojure.lang.IFn
Var.java:392 clojure.lang.Var.fn
Var.java:423 clojure.lang.Var.invoke
(Unknown Source) user/avged >

The objective of this function is just a learning exercise.

I have three questions:

1. Why doesn't it work, return a value?

2. What does the error message mean?  and seeing this or similar again, how
do I investigate to get a meaningful Clojure solution?

3.  Code Style, what can I do to improve readability and form?


Thanks.

--
Stephen Feyrer.

-- 
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/d/optout.

Reply via email to