Fail to run dynamic binding code with Clojure1.4

2012-10-30 Thread Satoru Logic
Hi, all. I am reading Clojure in Action. In the scope section of Chapter3, there are examples like this: defn twice [x] (println original function) (* 2 x)) (defn call-twice [y] (twice y)) (defn with-log [function-to-call log-statement] (fn [ args]

Re: Fail to run dynamic binding code with Clojure1.4

2012-10-30 Thread Satoru Logic
Could you please recommend a book that's more up-to-date? On Wednesday, October 31, 2012 11:26:48 AM UTC+8, Sean Corfield wrote: Yes, it's very unfortunate that Manning released Clojure in Action without a final pass to make it Clojure 1.3 compatible. I talked to them about it when they

Re: Fail to run dynamic binding code with Clojure1.4

2012-10-30 Thread Satoru Logic
to annotate that it is a dynamic var, like so: (defn ^:dynamic twice [x] (println original function) (* 2 x)) With that change, it works in Clojure 1.3 and later. Andy On Oct 30, 2012, at 5:42 PM, Satoru Logic wrote: Hi, all. I am reading Clojure in Action. In the scope section

Re: Fail to run dynamic binding code with Clojure1.4

2012-10-30 Thread Satoru Logic
Thanks On Wednesday, October 31, 2012 12:41:24 PM UTC+8, Sean Corfield wrote: On Tue, Oct 30, 2012 at 8:38 PM, Satoru Logic sator...@gmail.comjavascript: wrote: Could you please recommend a book that's more up-to-date? Clojure Programming http://www.clojurebook.com/ would be my first

slow repl startup because of package finding

2012-11-02 Thread Satoru Logic
Hi, all. Every time I type `*lein repl*`, several line of log get printed out: Could not find artifact org.clojure:clojure:pom:1.+ in central (http://repo1.maven.org/maven2) Could not find artifact org.clojure:clojure:pom:1.+ in clojars (https://clojars.org/repo/) Could not find artifact

Re: slow repl startup because of package finding

2012-11-02 Thread Satoru Logic
+1 schrieb Satoru Logic: Hi, all. Every time I type `*lein repl*`, several line of log get printed out: Could not find artifact org.clojure:clojure:pom:1.+ in central ( http://repo1.maven.org/maven2) Could not find artifact org.clojure:clojure:pom:1.+ in clojars ( https://clojars.org/repo

Re: slow repl startup because of package finding

2012-11-02 Thread Satoru Logic
On Friday, November 2, 2012 4:23:01 PM UTC+8, Meikel Brandmeyer (kotarak) wrote: Hi, Am Freitag, 2. November 2012 08:50:09 UTC+1 schrieb Satoru Logic: My ~/.lein/profiles.clj contains one line only: {:user {:plugins [[lein-minnow 0.1.4]]}} Is it the case that this plugin requiring

What's the difference between `seq` and `lazy-seq`?

2012-11-02 Thread Satoru Logic
Hi, all. I read the following description of `sequence` in the book Clojure Programming: * Obtaining the length of a seq carries a cost. * The contents of sequences may be computed lazily and actually realized only when the value involved are accessed. So a sequence is something lazy,

Re: What's the difference between `seq` and `lazy-seq`?

2012-11-02 Thread Satoru Logic
the worst case which is a traversal of the whole sequences -- plus if the sequence is lazy (and not yet realized) the traversal will cause its realization. hth, Christophe On Fri, Nov 2, 2012 at 1:34 PM, Satoru Logic sator...@gmail.comjavascript: wrote: Hi, all. I read the following

Problem installing Noir with Lein

2012-11-02 Thread Satoru Logic
Hi, all. I am trying to install Noir following instructions on http://www.webnoir.org/. With the latest lein I installed, `lein plugin install lein-noir 1.2.1` simply won't work. So I add a line of requirement into `~/.lein/profiles.clj`: [lein-noir 1.2.1] Then I follow the Noir

Re: Problem installing Noir with Lein

2012-11-02 Thread Satoru Logic
On Saturday, November 3, 2012 12:07:02 PM UTC+8, Sean Corfield wrote: On Fri, Nov 2, 2012 at 8:15 PM, Satoru Logic sator...@gmail.comjavascript: wrote: So I add a line of requirement into `~/.lein/profiles.clj`: [lein-noir 1.2.1] You should not need that. Thanks. I

Why is a non-transient `into` faster than the built-in one?

2012-11-03 Thread Satoru Logic
Hi, all. I am following an example demonstrating that `transient` can help optimize mass updates to data structures: First, a function is defined, which doesn't use transient collection: (defn naive-into [coll source] (reduce conj coll source)) This is supposed to run slower than the

Re: Why is a non-transient `into` faster than the built-in one?

2012-11-03 Thread Satoru Logic
I restart the repl and run the two versions, still `into` is slower: user= (time (do (into #{} (range 1e6)) nil)) Elapsed time: 4913.818 msecs nil user= (time (do (naive-into #{} (range 1e6)) nil)) Elapsed time: 5599.32 msecs nil user= user= (time (do (naive-into #{} (range 1e6)) nil))

Re: Why is a non-transient `into` faster than the built-in one?

2012-11-04 Thread Satoru Logic
Hi, I'm using Clojure1.4.0, Java1.6 on MacOS. user= (clojure-version) 1.4.0 ~ satoru$ java -version java version 1.6.0_35 Java(TM) SE Runtime Environment (build 1.6.0_35-b10-428-11M3811) Java HotSpot(TM) 64-Bit Server VM (build 20.10-b01-428, mixed mode) On Sunday, November 4, 2012

Re: Why is a non-transient `into` faster than the built-in one?

2012-11-04 Thread Satoru Logic
can't use `doc` on it. Cheers, Marko On Sunday, November 4, 2012 8:36:19 AM UTC+1, Satoru Logic wrote: Hi, I'm using Clojure1.4.0, Java1.6 on MacOS. user= (clojure-version) 1.4.0 ~ satoru$ java -version java version 1.6.0_35 Java(TM) SE Runtime Environment (build 1.6.0_35-b10-428

Re: Why is a non-transient `into` faster than the built-in one?

2012-11-04 Thread Satoru Logic
BTW, I can't even reproduce the examples here: http://clojure.org/Transients#toc5 On Sunday, November 4, 2012 6:49:50 PM UTC+8, Marko Kocić wrote: On Sunday, November 4, 2012 11:41:23 AM UTC+1, Satoru Logic wrote: On Sunday, November 4, 2012 6:20:37 PM UTC+8, Marko Kocić wrote: I get

Re: Why is a non-transient `into` faster than the built-in one?

2012-11-04 Thread Satoru Logic
time: 399.972445 msecs Clojure 1.4.0 java version 1.6.0_26 Java(TM) SE Runtime Environment (build 1.6.0_26-b03) Java HotSpot(TM) Server VM (build 20.1-b02, mixed mode) Cheers. Marek. On Sunday, November 4, 2012 3:41:14 AM UTC+1, Satoru Logic wrote: Hi, all. I am following

`CompilerException` raised when running `Monger` code snippet

2012-11-08 Thread Satoru Logic
Hi, all. When I try to run the following `macro` in `lein repl` (with clojure1.3 and clojure1.4): (defmacro ^{:private true} defoperator [operator] (def ^{:const true} ~(symbol (str operator)) ~(str operator))) But a `CompilerException` is raised: CompilerException

Re: `CompilerException` raised when running `Monger` code snippet

2012-11-08 Thread Satoru Logic
, Satoru Logic wrote: Hi, all. When I try to run the following `macro` in `lein repl` (with clojure1.3 and clojure1.4): (defmacro ^{:private true} defoperator [operator] (def ^{:const true} ~(symbol (str operator)) ~(str operator))) But a `CompilerException` is raised

is it possible to run `lein repl` without generating a `repl-port` file?

2012-11-09 Thread Satoru Logic
Hi, all. I notice that in every directory that I have runed `lein repl`, a file named `repl-port`is generated. I wonder if it's possible to set things up so that this file is not generated, or maybe I can set up some directory for these files. -- You received this message because you are

Re: is it possible to run `lein repl` without generating a `repl-port` file?

2012-11-09 Thread Satoru Logic
Cool! Thanks. On Saturday, November 10, 2012 10:20:14 AM UTC+8, Phil Hagelberg wrote: This is a bug that's been fixed on master. A new release is just around the corner. -Phil -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this

EOFException when using clojuredocs under repl

2012-11-09 Thread Satoru Logic
HI, all. I read in a `leiningen` tutorial that we can use `clojuredocs` to get docs and examples. But when I try, it failed with an `EOFException`: user= (clojuredocs pprint) EOFException Unexpected end of ZLIB input stream java.util.zip.InflaterInputStream.fill

Re: EOFException when using clojuredocs under repl

2012-11-09 Thread Satoru Logic
On Saturday, November 10, 2012 1:34:20 PM UTC+8, Sean Corfield wrote: On Fri, Nov 9, 2012 at 8:50 PM, Satoru Logic sator...@gmail.comjavascript: wrote: But when I try, it failed with an `EOFException`: user= (clojuredocs pprint) EOFException Unexpected end of ZLIB input

run-jetty doesn't shut down the server after ctrl+c?

2012-11-13 Thread Satoru Logic
Hi, all. I am playing with the `ring` library in `repl`. After using `run-jetty` to start a server, I typed `ctrl+c` to send the SIGINT signal, this ended the `run-jetty` function, but it didn't kill the server: user= (require '[ring.adapter.jetty :refer [run-jetty]]) user= (require

Re: run-jetty doesn't shut down the server after ctrl+c?

2012-11-13 Thread Satoru Logic
On Wednesday, November 14, 2012 12:38:55 PM UTC+8, Sean Corfield wrote: On Tue, Nov 13, 2012 at 8:33 PM, Satoru Logic sator...@gmail.comjavascript: wrote: BindException Address already in use sun.nio.ch.Net.bind (Net.java:-2) user= 2012-11-14 11:44:21.370

Re: run-jetty doesn't shut down the server after ctrl+c?

2012-11-13 Thread Satoru Logic
wrote: On Tue, Nov 13, 2012 at 8:33 PM, Satoru Logic sator...@gmail.comjavascript: wrote: BindException Address already in use sun.nio.ch.Net.bind (Net.java:-2) user= 2012-11-14 11:44:21.370:WARN:oejuc.AbstractLifeCycle:FAILED SelectChannelConnector@0.0.0.0:3000

Re: run-jetty doesn't shut down the server after ctrl+c?

2012-11-14 Thread Satoru Logic
-server command in terminal, be it `python manage.py runserver` or `lein run`, I would use ctrl-C to stop the process. `run-jetty` is just like other functions, it returns the server object. On Wed, Nov 14, 2012 at 4:33 AM, Satoru Logic sator...@gmail.comjavascript: wrote: Hi, all. I am

Fail to run `lein bootstrap` in ClojureScript One

2012-11-21 Thread Satoru Logic
HI, all. I'm following the instructions on http://clojurescriptone.com/getting-started.html, and run `lein bootstrap` in the `one` directory, but `lein` complains that *'bootstrap' is not a task*. How can I install this `bootstrap` task? -- You received this message because you are

Re: Fail to run `lein bootstrap` in ClojureScript One

2012-11-21 Thread Satoru Logic
Got it. Thanks. On Thursday, November 22, 2012 3:12:53 PM UTC+8, Sean Corfield wrote: ClojureScript One still requires Leiningen 1.x - it hasn't been updated to Leiningen 2.x yet. On Wed, Nov 21, 2012 at 10:06 PM, Satoru Logic sator...@gmail.comjavascript: wrote: HI, all. I'm