getting a stack overflow in clojure function.
guidance appreciated :) (defn length [xs] (if ,(not= xs nil) (println (+ 1 (length (rest xs)))) (println 0))) ...
guidance appreciated :) (defn length [xs] (if ,(not= xs nil) (println (+ 1 (length (rest xs)))) (println 0))) ...
I need to perform numerical analysis like that supported by MatLab or NumPy. Is there a good library that is supported by Scheme/Lisp/Clojure(Java)? I don't want to leave my round braces. Thanks a lot. ...
I read that Vectors are not seqs, but Lists are. I'm not sure what the rationale is for using one over the other. It seems that vectors are used the most, but is there a reason for that? Any answers are appreciated, thanks! ...
I have a main function but NetBeans needs a main class in order for stepping. How do you guys debug Clojure in NetBeans? ...
How do i allocate a vector with 1042 empty indexes? Will the storage for it be lazily allocated? like this (def a (array-creation-function 1042)) (def b (assoc a 1041 42)) (b 1041) --> 42 ...
I have a little script (use :reload-all 'com.example.package1 'com.example.package2 'com.example.package3 'com.example.testlib) (run-tests 'com.example.package1 'com.example.package2 'com.example.package3) that I use to quickly reload everything and fire off the unit tests. trouble is that each time (deftest ... ) is evalua...
I am starting Clojure development in Eclipse I have a new package called "apackage" under src. In it I have JavaClass.java and Test.clj. How do I call the constructor of the JavaClass from the clojure file? I tried (def a (new apackage.JavaClass)) but I am getting a ClassNotFoundException. What am I doing wrong? ...
What is the difference between the evaluation of double and #'double in Clojure/Lisp? 1:2 user=> double #<core$double__4077 clojure.core$double__4077@1acd47> 1:3 user=> #'double #'clojure.core/double ...
In Scheme, we just had define for all the definition, why does Clojure and Lisp use different keywords for different declarations? ...
Hi, I have started a Compojure (Jetty) server with: (defonce *server* (run-server {:host "localhost" :port 8080} "/*" (servlet routes))) but netstat still shows that it is listening on 0.0.0.0:8080, i.e. all IPs. What is the correct parameter to pass to run-server to make it listen on a single IP? ...
I have a set of functions saved in .clj. How do I Provide selected set of functions and then import these functions in my other file? ...
I wrote 3 functions that count the number of times an-element appears in a-list. I tried various inputs and profiled it but I still dont know which function is the best in terms of stack usage efficiency and time efficiency. Please Help me out. ;; Using an accumulator (defn count-instances1 [a-list an-element] (letfn [(cou...
I am very very new to clojure. The zip utility looks interesting but I cant seem to use it. I tried ;; ZIP (:use "zip") (def data '[[a * b] + [c * d]]) (def dz (zip/vector-zip data)) But I am getting java.lang.Exception: No such namespace: zip How do yo use external libraries? ...
I read somewhere where rich hickey said: "I think continuations might be neat in theory, but not in practice" I am not familiar with clojure. 1. Does clojure have continuations? 2. If no, dont you need continuations? I have seen a lot of good examples especially from this guy. What is the alternative? 3. If yes, is there a docu...
I have a function called show which shows a dialog with the message. I need to map this function to all the items in alist. But Clojure doesnt show me any messages. What am I doing wrong? (defn show[message] (. javax.swing.JOptionPane (showMessageDialog nil message))) (defn action[] (map show '(HELLO Sweet love))) ...
How do I convert Symbol to String ,Integer to Float and other similar type conversion in Clojure? ...
I am having a hard time writing type checks in Clojure. Pleas help me. How do I write/perform 'char?' in Clojure? How do I write/perform 'atom?' in Clojure? How do I know what type an item is in Clojure? Can I write (type? an-item)? ...
I am learning the concept of sequence and nil in Clojure. This was the result of a small experimentation. 1:6 user=> (first '()) nil 1:7 user=> (rest '()) () 1:8 user=> (first (rest '())) nil Does this mean that '() is actually a sequence of nils? ...
How have you used the meta data information in your Clojure Program? I saw one example from Programming Clojure (defn shout [#^{:tag String} message] (.toUpperCase message)) ;; Clojure casts message to String and then calls the method. What are some of the usage? This form of programming is completely new to me. Thanks. ...
Why do people prefer list comprehensions like (for [x '(1 2 3)] (* 2 x)) instead of (map #(* %1 2) '(1 2 3))? Are there benefits to this kind of programming? 1. Is it more readable? 2. Is it faster in some cases? 3. Is it better for certain kinds of operations and data structures? ...