(defn fac [n] (if (= n 1) 1 (* n fac (- n 1
your code tries to multiply n by function
this is correct:
(defn fac [n] (if (= n 1) 1 (* n (fac (- n 1)
On Aug 2, 8:11 am, recurve7 dan.m...@gmail.com wrote:
In browsing this group I see this topic has been brought up several
times over
On 3 août, 03:00, Mark markaddle...@gmail.com wrote:
The compiler might not be able to do better but the runtime system certainly
could. In this case, both filtered and more information is what's needed.
Why couldn't the runtime generate a message like:
Symbol fac of type clojure.lang.IFn
On Aug 2, 8:39 am, Ken Wesson kwess...@gmail.com wrote:
It is true that the messages commonly encountered could stand to be
better documented on a Clojure site. I'm wondering if we could go
further, though, and make REPL exception printing more informative.
The Java exception gets stored in
On Aug 2, 2011, at 7:23 PM, Armando Blancas wrote:
Check out the work of Warren Teitelman on
Conversational LISP and Do What I Mean, way back when most in this
board weren't even born.
Around 1985, I heard Teitelman's Do What I Mean (DWIM) referred to as DWWTWHM
(Do What Warren Teitelman
In browsing this group I see this topic has been brought up several
times over the past 3 years, so I apologize for revisiting it.
I just downloaded Clojure and was excited to try it, but so far trying
to move beyond simple examples has often resulted in me making a
mistake that yields a Java
It got improved a lot in Clojure 1.3 which is beta for a while.
--
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
On Tue, Aug 2, 2011 at 3:11 AM, recurve7 dan.m...@gmail.com wrote:
Here's one example where recursion and lack of positional error
feedback make it hard for me, as someone coming from Java, to spot the
error (and seeing ClassCastException threw me off and had me
wondering where/how I had done
On Tue, Aug 2, 2011 at 3:11 AM, recurve7 dan.m...@gmail.com wrote:
Here's one example where recursion and lack of positional error
feedback make it hard for me, as someone coming from Java, to spot the
error (and seeing ClassCastException threw me off and had me
wondering where/how I had done
On Tue, Aug 2, 2011 at 12:11 AM, recurve7 dan.m...@gmail.com wrote:
user= (defn fac [n] (if (= n 1) 1 (* n fac (- n 1
#'user/fac
user= (fac 3)
java.lang.ClassCastException: user$fac cannot be cast to
java.lang.Number (NO_SOURCE_FILE:0)
Let's assume you'd put the code in a source file
Thanks for the replies. I see 1.3 Beta 1 provides some more Java
context that helps me find the problem, although it still doesn't
afford Clojure its own uniquely-searchable error system or positional
error references.
On Aug 2, 6:31 am, Sergey Didenko sergey.dide...@gmail.com wrote:
It got
Thank you, Ken. It's encouraging to see the community is thinking of
ways to improve this.
On Aug 2, 6:39 am, Ken Wesson kwess...@gmail.com wrote:
On Tue, Aug 2, 2011 at 3:11 AM, recurve7 dan.m...@gmail.com wrote:
Here's one example where recursion and lack of positional error
feedback make
Hi Jeremy,
I'm not just thinking about Clojure from the perspective of a Java
person, but also from the perspective of someone new to programming
and for kids. For the latter, it's best if languages have maximum
friendliness in error wording and error messages pointed at a specific
character
The following code may prove useful as well.
(defmacro log
for debugging, output code and code-val to stdout or optional
writer, returns val,
custom-fn accepts two arguments, the code, and the result, it must
return a string
([code]
`(let [c# ~code]
(prn '~code)
I've been coding in Clojure since mid-2008, I have a Lisp background
but coded mainly in Java for a number of years (2000-2010)
I still goof from time to time with parenthesis. Just yesterday,
I screwed up some expression imbrication in a module and
it took me at least 30 mns to figure it out.
Ok
The compiler might not be able to do better but the runtime system certainly
could. In this case, both filtered and more information is what's needed.
Why couldn't the runtime generate a message like:
Symbol fac of type clojure.lang.IFn is used where type java.lang.Number is
expected in #2
15 matches
Mail list logo