Just getting started, in “Intro to Clojure”, Exercise 1.
I tried to create a function for adding milk/sugar/flour. It worked fine, but I forgot to release the cup. When I added that to the function, I got the following error:
user=> (defn add-scoop [ n stuff ]
#_=> (dotimes [m n] ((grab :cup) (scoop stuff) (add-to-bowl) (release))))
user=> (add-scoop 1 :flour)
IllegalArgumentException Wrong number of args passed to keyword: :error clojure.lang.Keyword.throwArity (Keyword.java:97)
I see in the REPL that executing one function at time returns
:ok. So I guess I have inadvertently set up a situation where
:ok is being used as function … not sure why that blows up when I have four forms in my function, but not when I had three.
I’m sure this is a basic mistake. Appreciate any help!