;;helpers;;
(defn ++ [x]
(inc x))
;;infinite-counting;;
(defn infinite-counting [start]
(while true
(loop [count start]
(println (str count "!"))
(recur (++ count)))))
;;fibbonaci;;
; 1 1 2 3 5 8 13 etc. (prevprev + current = next)
(defn count-fibbonaci []
(while true
(loop [prevprev 0 curr 1 next 1]
(println (str curr))
(recur curr next (+ prevprev curr)))))
;;list length;;
(defn give-me-length [num x] "Helper for calculating list-length."
(give-me-length (++ num) (rest x)))
(def list-length [x] "Gives the length of a list using 'give-me-
length"
(give-me-length 0 x))
(def test-list '(:1 :2 :3))
(list-length test-list)
Thats my full script.
On Mar 8, 8:43 pm, Timothy McDowell <[email protected]> wrote:
> Exception in thread "main" java.lang.Exception: Too many arguments to
> def (test.clj:26)
>
> both
> (def test-list (list (:one :two :three)))
> and
> (def test-list '(:one :two :three))
> and changing the one/two/three into strings also gives me the error on
> running. I don't get the error using the REPL. Bug?
>
> I execute the script with 'java -cp clojure.jar clojure.lang.Script
> test.clj'. Also, is there a way to compile my scripts into classes to
> be used by other scripts (like my own custom utility class?)
> ex.: 'javac -cp clojure.jar clojure.lang.Script test.clj'
>
> Thanks, Timothy McDowell
>
> --
> --Timothy.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---