clojure

How do you change Clojure version in Leiningen and LightTable?

倾然丶 夕夏残阳落幕 提交于 2019-12-21 04:07:09
问题 When I type (clojure-version) into my repl in LightTable, I get "1.5.1" as output. Is there any way to upgrade to 1.6.0? I am assuming that it is drawing the Clojure version from Leiningen (2.3.4 on my machine), which is stocked with 1.5.1 out of the box. How can I make sure that both Leiningen and LightTable are using the most recent version of Clojure? I have googled around and can't find any clear answers. I did find this SO question, but it didn't address my problem specifically. Is there

How to add directory to Clojure's classpath?

北城以北 提交于 2019-12-21 03:58:49
问题 I have installed the libraries with Maven to the ~/.m2/repository/ directory. I would like to add that path to the default Clojure classpath. I could not find the documentation how to do that. Any hints? Cheers! clj Clojure 1.4.0 user=> (require '[clojure.java.jmx :as jmx]) FileNotFoundException Could not locate clojure/java/jmx__init.class or clojure/java/jmx.clj on classpath: clojure.lang.RT.load (RT.java:432) The class path by default is: user=> (println (seq (.getURLs (java.lang

How to compile file in clojure

喜夏-厌秋 提交于 2019-12-21 03:56:26
问题 I've created file "hello.clj" (ns clojure.examples.hello (:gen-class)) (defn -main [greetee] (println (str "Hello " greetee "!"))) and try to compile clojurec hello.clj But I got this error Exception in thread "main" java.io.FileNotFoundException: Could not locate hello/clj__init.class or hello/clj.clj on classpath: at clojure.lang.RT.load(RT.java:398) at clojure.lang.RT.load(RT.java:367) at clojure.core$load__5058$fn__5061.invoke(core.clj:3734) at clojure.core$load__5058.doInvoke(core.clj

ClojureScript - convert arbitrary JavaScript object to Clojure Script map

爷,独闯天下 提交于 2019-12-21 03:56:08
问题 I am trying to convert a Javascript object to a Clojure. However, I get the following error : (js/console.log (js->clj e)) ;; has no effect (pprint (js->clj e)) ;; No protocol method IWriter.-write defined for type object: [object Geoposition] Yes, this object comes from the Geolocation API. I suppose that I have to extend IEncodeClojure and IWriter , but I have no clue how. For instance adding the following : (extend-protocol IEncodeClojure Coordinates (-js->clj [x options] (println "HERE "

Can you have leiningen load library code from locally checked out source?

随声附和 提交于 2019-12-21 03:49:35
问题 Let's say I was hacking on a clojure library I was using in my project: /User/SCdF/Code/myproject/ /User/SCdF/Code/other-peoples-projects/clojure-library-cloned-from-github Currently, when I make changes in clojure-library-cloned-from-github I then run lein install to push my new version to the local repository (I've changed my and their project.clj to point to a newer -SNAPSHOT version of the library so it gets updated every time) and then restart / run lein deps on myproject . Is there a

What is the difference between clojure's APersistentMap implementations

徘徊边缘 提交于 2019-12-21 03:43:26
问题 I'm trying to figure out what the difference is between a PersistentHashMap, PersistentArrayMap, PersistentTreeMap, and PersistentStructMap. Also if I use {:a 1} it gives me a PersistentArrayMap but can this change to any of the other ones if I give it objects or things other than keys? 回答1: The four implementations you list fall into three groups: "literal" : PersistentArrayMap and PersistentHashMap : basic map types used when dealing with map literals (though constructor functions are also

What is the difference between clojure's APersistentMap implementations

家住魔仙堡 提交于 2019-12-21 03:43:08
问题 I'm trying to figure out what the difference is between a PersistentHashMap, PersistentArrayMap, PersistentTreeMap, and PersistentStructMap. Also if I use {:a 1} it gives me a PersistentArrayMap but can this change to any of the other ones if I give it objects or things other than keys? 回答1: The four implementations you list fall into three groups: "literal" : PersistentArrayMap and PersistentHashMap : basic map types used when dealing with map literals (though constructor functions are also

Why is leiningen so slow when it starts?

吃可爱长大的小学妹 提交于 2019-12-21 03:39:15
问题 I'm using lein repl to execute clojure repl in console. When I run it, it takes over 15 seconds . When I run java -cp clojure-1.6.0.jar clojure.main , it takes just a few seconds. Why is lein repl so slow? Are there anyways to make it faster? My env: H/W: MacBookAir O/S: Mac OS 10.9 Mavericks CPU: i7 MEM: 8GB 回答1: Leiningen starts two JVMs, and hooks them together. It's got to load extra stuff to do that. The prompt you type into is a different process from the Clojure process that evaluates

Lazy sequences in R

冷暖自知 提交于 2019-12-21 03:32:21
问题 In Clojure, it's easy to create infinite sequences using the lazy sequence constructor. For example, (def N (iterate inc 0)) returns a data object N which is equivalent to the infinite sequence (0 1 2 3 ...) Evaluating the value N results in an infinite loop. Evaluating (take 20 N) returns the top 20 numbers. Since the sequence is lazy, the inc function is only iterated when you ask it to. Since Clojure is homoiconic, the lazy sequence is stored recursively. In R, is it possible to do

Can't launch `lein` REPL in Emacs

我的梦境 提交于 2019-12-21 03:30:32
问题 In Emacs, when using clojure-mode , I ought to be able to launch a REPL with C-c C-z . Whenever I try, though, I get the error: Searching for program: no such file or directory: lein I have lein installed in /usr/local/bin (via brew ) and /usr/local/bin is in my PATH (even Emacs says so, via eval-expression (getenv "PATH") ). What am I missing? 回答1: Ah! The PATH environment variable isn't the end-all and be-all of emacs search paths. There's also the "exec-path". It apparently does mostly the