Re: Compiling from command line (solved)

2009-06-23 Thread Laurent PETIT
Hi, If I remember correctly and if it has not changed since, for the second solution (where there is the classes folder - which I would recommand btw, aka not mixing source folders and compilation artifacts folders -), the classes folder (or any other name you could set *compile-path* to) also

Moving Window Function

2009-06-23 Thread Sean Devlin
Hey all, Does anyone know of a moving window function? I'm curious if there are any tools like this for digital signals processing, 30-day moving averages, etc. Sean --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: How can I stop leaking memory?

2009-06-23 Thread Christophe Grand
I don't know if it has an official name but basically it's a modified tree-sort: for each item you insert a value in a sorted coll of size N and remove one item from this sorted coll, both ops are O(sqrt(N)) thus O(n*sqrt(N)) for processing an input whose length is n. I'm away from a REPL but I

Re: Moving Window Function

2009-06-23 Thread Christophe Grand
If understand what you are looking for, I think partition can be useful: (map avg (partition 30 1 daily-data)) Christophe On Tue, Jun 23, 2009 at 8:36 AM, Sean Devlin francoisdev...@gmail.comwrote: Hey all, Does anyone know of a moving window function? I'm curious if there are any tools

Re: How can I stop leaking memory?

2009-06-23 Thread Christophe Grand
(assoc % (dec n)) should read: (assoc % min (dec n)) 2009/6/23 Christophe Grand christo...@cgrand.net I don't know if it has an official name but basically it's a modified tree-sort: for each item you insert a value in a sorted coll of size N and remove one item from this sorted coll, both

Re: How can I stop leaking memory?

2009-06-23 Thread Daniel Lyons
On Jun 23, 2009, at 1:47 AM, Christophe Grand wrote: I don't know if it has an official name but basically it's a modified tree-sort: for each item you insert a value in a sorted coll of size N and remove one item from this sorted coll, both ops are O(sqrt(N)) thus O(n*sqrt(N)) for

Re: How can I stop leaking memory?

2009-06-23 Thread beatle...@gmail.com
On Jun 23, 4:16 am, Four of Seventeen fsevent...@gmail.com wrote: On Jun 22, 6:46 pm, beatle...@gmail.com beatle...@gmail.com wrote: (take 10 (sort (for [x (range 100)] (rand) Now the problem is the memory usage, as it does not merely uses memory space for 10 items, but it keeps

Re: How can I stop leaking memory?

2009-06-23 Thread Jules
Let N be the total number of elements in your collection (e.g. 1000,000), and n the number of elements that you want to take out of this collection (e.g 10). By sorting the collection of N elements you spend N log N time. By repeatedly adding an to the small collection and removing the minimum

Re: How can I stop leaking memory?

2009-06-23 Thread beatle...@gmail.com
On Jun 23, 7:36 am, Christophe Grand christo...@cgrand.net wrote: Hi all, On Tue, Jun 23, 2009 at 4:16 AM, Four of Seventeen fsevent...@gmail.comwrote: On Jun 22, 6:46 pm, beatle...@gmail.com beatle...@gmail.com wrote: (take 10 (sort (for [x (range 100)] (rand) Now the

Re: How can I stop leaking memory?

2009-06-23 Thread Daniel Lyons
Jules, On Jun 23, 2009, at 2:25 AM, Jules wrote: Let N be the total number of elements in your collection (e.g. 1,000,000), and n the number of elements that you want to take out of this collection (e.g 10). By sorting the collection of N elements you spend N log N time. By repeatedly

Re: How can I stop leaking memory?

2009-06-23 Thread Christophe Grand
On Tue, Jun 23, 2009 at 10:14 AM, Daniel Lyons fus...@storytotell.orgwrote: I have to admit I don't really understand your code, so my apologies if I've missed something obvious. I think if you consider each element of N and do an operation that costs sqrt(N) with it, you'd arrive at

Re: Poll for a new name for clojure eclipse plugin 'clojure-dev'

2009-06-23 Thread arasoft
Clojipsy clojure-eclipse On Jun 23, 1:47 pm, Laurent PETIT laurent.pe...@gmail.com wrote: Hello, Since the switch to git, there has also been the creation of a mailing list called clojure-dev for discussions concerning clojure development, and a twitter account also named clojuredev.

Re: Poll for a new name for clojure eclipse plugin 'clojure-dev'

2009-06-23 Thread Christophe Grand
On Tue, Jun 23, 2009 at 1:47 PM, Laurent PETIT laurent.pe...@gmail.comwrote: * eclojure (named after nothing, but an interesting contraction of the beginning of ECLipse and CLOJURE). maybe too close to enclojure. eclojion? (I'm afraid this j-pun is going to get tirejome) -- Professional:

Re: Poll for a new name for clojure eclipse plugin 'clojure-dev'

2009-06-23 Thread Matt Clark
I vote for Clojure Development Tools. There's something to be said for consistency, and I agree that the j insertion will be getting old soon. On Jun 23, 8:47 am, Laurent PETIT laurent.pe...@gmail.com wrote: Hello, Since the switch to git, there has also been the creation of a mailing list

Re: Moving Window Function

2009-06-23 Thread Kyle Schaffrick
On Mon, 22 Jun 2009 23:36:25 -0700 (PDT), Sean Devlin francoisdev...@gmail.com wrote: Hey all, Does anyone know of a moving window function? I'm curious if there are any tools like this for digital signals processing, 30-day moving averages, etc. If you need weighted moving averages, this

Re: Moving Window Function

2009-06-23 Thread Kyle Schaffrick
On Tue, 23 Jun 2009 10:20:52 -0400 Kyle Schaffrick k...@raidi.us wrote: On Mon, 22 Jun 2009 23:36:25 -0700 (PDT), Sean Devlin francoisdev...@gmail.com wrote: Hey all, Does anyone know of a moving window function? I'm curious if there are any tools like this for digital signals

Re: Code generation at runtime

2009-06-23 Thread chris
You could generate a file and call 'load-file'. Then if it didn't work the way you expect you have an artifact you can debug with. I think eval is really making your life a bit more difficult and I am not following your eval'd code very well. Chris On Jun 23, 4:12 am, Nicolas Oury

Re: Poll for a new name for clojure eclipse plugin 'clojure-dev'

2009-06-23 Thread Laurent PETIT
2009/6/23 Christophe Grand christo...@cgrand.net On Tue, Jun 23, 2009 at 1:47 PM, Laurent PETIT laurent.pe...@gmail.comwrote: * eclojure (named after nothing, but an interesting contraction of the beginning of ECLipse and CLOJURE). maybe too close to enclojure. yeah maybe, but would that

Re: Poll for a new name for clojure eclipse plugin 'clojure-dev'

2009-06-23 Thread Laurent PETIT
2009/6/23 Matt Clark matt.clar...@gmail.com I vote for Clojure Development Tools. There's something to be said for consistency, and I agree that the j insertion will be getting old soon. I also like the fact that it is very clear. But for referencing it, we will have to have a simpler

Re: Poll for a new name for clojure eclipse plugin 'clojure-dev'

2009-06-23 Thread Laurent PETIT
Hi, 2009/6/23 arasoft t...@arasoft.de Clojipsy :) clojure-eclipse This one has the merit to clearly state that it relates to clojure and eclipse (even more cleary than eclojure). Looks like an interesting candidate to me. On Jun 23, 1:47 pm, Laurent PETIT laurent.pe...@gmail.com

Re: Poll for a new name for clojure eclipse plugin 'clojure-dev'

2009-06-23 Thread Christophe Grand
On Tue, Jun 23, 2009 at 5:56 PM, Laurent PETIT laurent.pe...@gmail.comwrote: 2009/6/23 Christophe Grand christo...@cgrand.net On Tue, Jun 23, 2009 at 1:47 PM, Laurent PETIT laurent.pe...@gmail.comwrote: * eclojure (named after nothing, but an interesting contraction of the beginning of

Re: Poll for a new name for clojure eclipse plugin 'clojure-dev'

2009-06-23 Thread Laurent PETIT
What about eclipjure ? 2009/6/23 Christophe Grand christo...@cgrand.net On Tue, Jun 23, 2009 at 5:56 PM, Laurent PETIT laurent.pe...@gmail.comwrote: 2009/6/23 Christophe Grand christo...@cgrand.net On Tue, Jun 23, 2009 at 1:47 PM, Laurent PETIT laurent.pe...@gmail.comwrote: * eclojure

Re: Moving Window Function

2009-06-23 Thread Christophe Grand
I think you could simplify your code by using map twice. What about: (untested) (defn weighted-moving-average Generate a lazy sequence consisting of weighted moving averages over the input sequence. The weighting is given by weight-fn, having a domain 0..1 which will be scaled across

Re: Poll for a new name for clojure eclipse plugin 'clojure-dev'

2009-06-23 Thread Wilson MacGyver
I like to suggest conjclipse it's a pun on conj in clojure. On Tue, Jun 23, 2009 at 7:47 AM, Laurent PETIT laurent.pe...@gmail.comwrote: Hello, Since the switch to git, there has also been the creation of a mailing list called clojure-dev for discussions concerning clojure development, and

Re: Poll for a new name for clojure eclipse plugin 'clojure-dev'

2009-06-23 Thread Vagif Verdi
Clojure, enclojure, compojure, conjure... I say enough with jure already. There are lot's of beautiful project names like Tapestry, Wicket, Hunchentoot, that do not include parts of the programming language name they are written in. How about a normal word, like Eclair ?

Re: Poll for a new name for clojure eclipse plugin 'clojure-dev'

2009-06-23 Thread Laurent PETIT
2009/6/23 Vagif Verdi vagif.ve...@gmail.com Clojure, enclojure, compojure, conjure... I say enough with jure already. I totally understand that jure has been used and abused, but please note that the project is an IDE for writing clojure code : it's not even written in clojure yet (so we

Re: Poll for a new name for clojure eclipse plugin 'clojure-dev'

2009-06-23 Thread John Newman
How 'bout eclj? On Tue, Jun 23, 2009 at 9:01 PM, Meikel Brandmeyer m...@kotka.de wrote: Hi, Am 23.06.2009 um 18:00 schrieb Laurent PETIT: clojure-eclipse This one has the merit to clearly state that it relates to clojure and eclipse (even more cleary than eclojure). Looks like an

Was it decided to add these functions to core?

2009-06-23 Thread CuppoJava
Hi everyone, I remember reading a few old posts that mentioned adding some functions to core, and I was wondering what was the result of that discussion. The functions I'm interested in are: (iterate inc 0) (map vector ...) both of which I use fairly often. Right now in my own code: I have

Re: Code generation at runtime

2009-06-23 Thread Chris Dean
Nicolas Oury nicolas.o...@gmail.com writes: So I need, to compile some expressions before I run the loop that keeps evaluating these expressions. So there are a few solutions: Here are solutions I have used in the past on other Lisps for this sort of problem. They may (or may not) fit your

Re: Moving Window Function

2009-06-23 Thread Kyle Schaffrick
On Tue, 23 Jun 2009 18:23:01 +0200 Christophe Grand christo...@cgrand.net wrote: I think you could simplify your code by using map twice. What about: (untested) (defn weighted-moving-average Generate a lazy sequence consisting of weighted moving averages over the input sequence.

Re: Code generation at runtime

2009-06-23 Thread Daniel Lyons
Nicolas, Perhaps a rules engine could be of use to you? I have to put in a small plug for Jess: http://www.jessrules.com/ Jess is a rules engine designed for integration with Java, especially for writing expert systems and other situations in which you might want forward- chaining

Re: Was it decided to add these functions to core?

2009-06-23 Thread Chouser
On Tue, Jun 23, 2009 at 1:09 PM, CuppoJavapatrickli_2...@hotmail.com wrote: (iterate inc 0) Just riffing here, but what if range took some kind of sentinel to indicate an infinite range? So instead of (iterate inc 0), you could say (range 0 :forever). Then that would also allow: (range 0

Re: Was it decided to add these functions to core?

2009-06-23 Thread Four of Seventeen
On Jun 23, 1:09 pm, CuppoJava patrickli_2...@hotmail.com wrote: Hi everyone, I remember reading a few old posts that mentioned adding some functions to core, and I was wondering what was the result of that discussion. The functions I'm interested in are: (iterate inc 0) (map vector ...)

Re: Moving Window Function

2009-06-23 Thread Christophe Grand
On Tue, Jun 23, 2009 at 8:02 PM, Daniel Lyons fus...@storytotell.orgwrote: On Jun 23, 2009, at 11:37 AM, Kyle Schaffrick wrote: As an aside, I also notice you prefer 'reduce to 'apply when using arithmetic functions, yet I've seen both in the wild. I'm just guessing you prefer to make

Re: Poll for a new name for clojure eclipse plugin 'clojure-dev'

2009-06-23 Thread Laurent PETIT
2009/6/23 J. McConnell jdo...@gmail.com: On Tue, Jun 23, 2009 at 7:47 AM, Laurent PETIT laurent.pe...@gmail.com wrote: Would you help us find a new name, by giving ideas of voting for your favorite ? enclave: n. A distinctly bounded area enclosed within a larger unit. Interesting, I

Re: Moving Window Function

2009-06-23 Thread Daniel Lyons
On Jun 23, 2009, at 12:41 PM, Christophe Grand wrote: On Tue, Jun 23, 2009 at 8:02 PM, Daniel Lyons fus...@storytotell.org wrote: On Jun 23, 2009, at 11:37 AM, Kyle Schaffrick wrote: As an aside, I also notice you prefer 'reduce to 'apply when using arithmetic functions, yet I've

Re: Poll for a new name for clojure eclipse plugin 'clojure-dev'

2009-06-23 Thread Wilson MacGyver
how about Corona? It's the visible part of the sun during eclipse. On Tue, Jun 23, 2009 at 3:02 PM, Laurent PETITlaurent.pe...@gmail.com wrote: 2009/6/23 J. McConnell jdo...@gmail.com: On Tue, Jun 23, 2009 at 7:47 AM, Laurent PETIT laurent.pe...@gmail.com wrote: Would you help us find a

Re: Was it decided to add these functions to core?

2009-06-23 Thread CuppoJava
Ah, sorry I wasn't very clear. iterate and map are in core already I know. But there's been previous discussions that talked about introducing new shorthands for (iterate inc 0) and (map vector...) since they're two idioms that are used extremely often. I'm just wondering if anything ever

Re: Poll for a new name for clojure eclipse plugin 'clojure-dev'

2009-06-23 Thread Laurent PETIT
I like reptile, and also Corona for the meaning it conveys, a lot ! 2009/6/23 Stephan Mühlstrasser stephan.muehlstras...@web.de: I think there are too many of the j names already. I thought about leveraging a hint to the REPL. What about calling it REPtiLe? This could also provide an idea

Re: Compiling from command line (solved)

2009-06-23 Thread Thibaut Barrère
Hi guys, thanks for the comments! -- Thibaut --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are

Re: javafx

2009-06-23 Thread brianh
In case you haven't seen it, there is a java api to JavaFX called Scene Graph that's been around for some time now: https://scenegraph.dev.java.net/faq.html I've been monitoring it for some time now as a potential replacement for Piccolo2D. I last played with it several months ago and it was

Re: Moving Window Function

2009-06-23 Thread Christophe Grand
On Tue, Jun 23, 2009 at 9:14 PM, Daniel Lyons fus...@storytotell.orgwrote: Wish it were so, because I like your theory better than my reality: :) Drat! Stupid reality! Now I have to bend it to make my theory valid. range is wily, it bit me before. It's a specialized seq. Can we try with a

Re: Was it decided to add these functions to core?

2009-06-23 Thread Stephen C. Gilardi
On Jun 23, 2009, at 2:07 PM, Chouser wrote: On Tue, Jun 23, 2009 at 1:09 PM, CuppoJavapatrickli_2...@hotmail.com wrote: (iterate inc 0) Just riffing here, but what if range took some kind of sentinel to indicate an infinite range? So instead of (iterate inc 0), you could say (range 0

Re: Poll for a new name for clojure eclipse plugin 'clojure-dev'

2009-06-23 Thread Kyle Schaffrick
On Tue, 23 Jun 2009 21:35:33 +0200 Laurent PETIT laurent.pe...@gmail.com wrote: I like reptile, and also Corona for the meaning it conveys, a lot ! I like Corona as well. It lends itself nicely to some kind of visual pun involving a partial eclipse and a parenthesis :) -Kyle

Re: Was it decided to add these functions to core?

2009-06-23 Thread joshua-choi
On creating an infinite range, I think it'd be wonderful if Double/ POSITIVE_INFINITY or something like it would be bound to a core symbol, such as infinity or something. That'd way, one would be able to do things like (range 3 infinity) or ( infinity 5). CuppoJava, how long ago did those

Small question: Best way to create a map with vector vals

2009-06-23 Thread samppi
The idiom (into {} coll-of-entries) is often used to create a map from a collection of entries or two-sized vectors. But what if I want to do something like this: (mystery-fn [[:a 1] [:b 3] [:b 5] [:c 1]]) ; returns {:a [1], :b [3 5], :c [1]}) The only way I can think of doing this is with a

Recursive function that does not terminate!

2009-06-23 Thread pupsik
The following recursive function does not terminate if I exexute it in my REPL. What is wrong? (This example is from the official Clojure-website). (defn my-zipmap [keys vals] (loop [my-map {} my-keys (seq keys) my-vals (seq vals)] (if (and my-keys my-vals) (recur

Re: Was it decided to add these functions to core?

2009-06-23 Thread Chouser
On Tue, Jun 23, 2009 at 5:15 PM, Stephen C. Gilardisquee...@mac.com wrote: On Jun 23, 2009, at 2:07 PM, Chouser wrote: On Tue, Jun 23, 2009 at 1:09 PM, CuppoJavapatrickli_2...@hotmail.com wrote: (iterate inc 0) Just riffing here, but what if range took some kind of sentinel to indicate

Re: Moving Window Function

2009-06-23 Thread Daniel Lyons
On Jun 23, 2009, at 2:38 PM, Christophe Grand wrote: On Tue, Jun 23, 2009 at 9:14 PM, Daniel Lyons fus...@storytotell.org wrote: Wish it were so, because I like your theory better than my reality: :) Drat! Stupid reality! Now I have to bend it to make my theory valid. range is wily,

Re: Small question: Best way to create a map with vector vals

2009-06-23 Thread joshua-choi
Come to think of it, this would also work for me: keeping the vector of pairs, and instead using filter to get the values of a key: (defn get-from-pairs [pairs key-to-fetch] (map #(get % 1) (filter #(= key-to-fetch (get % 0)) pairs))) (I wish the key and val functions were defined on vectors

Re: Small question: Best way to create a map with vector vals

2009-06-23 Thread Krešimir Šojat
Hi, Try: (def x [[:a 1] [:b 3] [:b 5] [:c 1]]) (into {} (map (fn [[k v]] [k [v]]) a)) Returns: {:c [1], :b [5], :a [1]} -- Krešimir Šojat --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to

Re: Small question: Best way to create a map with vector vals

2009-06-23 Thread Cosmin Stejerean
On Tue, Jun 23, 2009 at 5:09 PM, samppi rbysam...@gmail.com wrote: The idiom (into {} coll-of-entries) is often used to create a map from a collection of entries or two-sized vectors. But what if I want to do something like this: (mystery-fn [[:a 1] [:b 3] [:b 5] [:c 1]]) ; returns {:a [1],

Recursive function that does not terminate!

2009-06-23 Thread pupsik
When I execute the following code snippet in the REPL I get an infinite loop. (The example is from the official Clojure-website, topic 'Functional Programming') What is wrong? (defn my-zipmap [keys vals] (loop [my-map {} my-keys (seq keys) my-vals (seq vals)] (if (and

Re: Recursive function that does not terminate!

2009-06-23 Thread Cosmin Stejerean
On Tue, Jun 23, 2009 at 5:22 PM, pupsik an_niko...@yahoo.de wrote: (defn my-zipmap [keys vals] (loop [my-map {} my-keys (seq keys) my-vals (seq vals)] (if (and my-keys my-vals) (recur (assoc my-map (first my-keys) (first my-vals)) (rest my-keys)

Re: Poll for a new name for clojure eclipse plugin 'clojure-dev'

2009-06-23 Thread Rayne
I vote Corona. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your

Re: Was it decided to add these functions to core?

2009-06-23 Thread Stephen C. Gilardi
On Jun 23, 2009, at 6:41 PM, Chouser wrote: On Tue, Jun 23, 2009 at 5:15 PM, Stephen C. Gilardisquee...@mac.com wrote: http://groups.google.com/group/clojure/browse_frm/thread/5e665ce7a318f44a/158419414f9150a0?lnk=gstq=%3Ainfinity#158419414f9150a0 Gah, I stole your idea! And your name was

Re: Poll for a new name for clojure eclipse plugin 'clojure-dev'

2009-06-23 Thread Wilson MacGyver
A lot of people will associate snake with python though Sent from my iPhone On Jun 23, 2009, at 3:22 PM, Stephan Mühlstrasser stephan.muehlstras...@web.d e wrote: I think there are too many of the j names already. I thought about leveraging a hint to the REPL. What about calling it

Re: Recursive function that does not terminate!

2009-06-23 Thread Stephen C. Gilardi
On Jun 23, 2009, at 6:22 PM, pupsik wrote: The following recursive function does not terminate if I exexute it in my REPL. What is wrong? (This example is from the official Clojure-website). (defn my-zipmap [keys vals] (loop [my-map {} my-keys (seq keys) my-vals (seq vals)]

Re: Poll for a new name for clojure eclipse plugin 'clojure-dev'

2009-06-23 Thread verec
A bit facetious, I know, but a not too sarcastic pun on the current economic climate ... foreclojure :-) Has good Googleability too :-) On Jun 23, 5:21 pm, Laurent PETIT laurent.pe...@gmail.com wrote: What about eclipjure ? 2009/6/23 Christophe Grand christo...@cgrand.net On Tue, Jun

Re: Poll for a new name for clojure eclipse plugin 'clojure-dev'

2009-06-23 Thread Wilson MacGyver
hmm... developing clojure code using eclipse makes you poor. :) On Tue, Jun 23, 2009 at 9:05 PM, verec jeanfrancois.brouil...@googlemail.com wrote: A bit facetious, I know, but a not too sarcastic pun on the current economic climate ... foreclojure :-) Has good Googleability too :-)

Re: Poll for a new name for clojure eclipse plugin 'clojure-dev'

2009-06-23 Thread Alvaro Vilanova Vidal
Corona rocks! It also means crown in spanish. Sent from my android :P El 24 de jun de 2009, 3:07 a.m., Wilson MacGyver wmacgy...@gmail.com escribió: hmm... developing clojure code using eclipse makes you poor. :) On Tue, Jun 23, 2009 at 9:05 PM, verec jeanfrancois.brouil...@googlemail.com

Re: Was it decided to add these functions to core?

2009-06-23 Thread CuppoJava
I support the nil or :infinity end for range. But I think there needs to be a shorter shorthand as well. (range 0 :infinity 1) is not any shorter than (iterate inc 0) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: Small question: Best way to create a map with vector vals

2009-06-23 Thread samppi
Thanks everyone. They all seem to take less time than the filter way too. On Jun 23, 4:05 pm, Cosmin Stejerean cstejer...@gmail.com wrote: On Tue, Jun 23, 2009 at 5:09 PM, samppi rbysam...@gmail.com wrote: The idiom (into {} coll-of-entries) is often used to create a map from a collection

Re: How can I stop leaking memory?

2009-06-23 Thread Bradbev
A further optimization would be to keep track of the lowest value in your keep set. A simple compare against that value will eliminate many of the add/removes from the keep set. Brad On Jun 23, 1:35 am, Christophe Grand christo...@cgrand.net wrote: On Tue, Jun 23, 2009 at 10:14 AM, Daniel

Re: Was it decided to add these functions to core?

2009-06-23 Thread Allen Rohner
(range 0 :infinity 1) is not any shorter than (iterate inc 0) It's not shorter, but it is a lot more clear. That alone makes it worthwhile IMO. Allen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group.

Re: Was it decided to add these functions to core?

2009-06-23 Thread Stephen C. Gilardi
On Jun 23, 2009, at 10:20 PM, CuppoJava wrote: (range 0 :infinity 1) From: user= (doc range) - clojure.core/range ([end] [start end] [start end step]) Returns a lazy seq of nums from start (inclusive) to end (exclusive), by step, where start defaults to 0 and

Re: the inverse function of load or load-file

2009-06-23 Thread Adrian Cuthbertson
You can use the following; (defn frm-save Save a clojure form to file. [#^java.io.File file form] (with-open [w (java.io.FileWriter. file)] (binding [*out* w *print-dup* true] (prn frm (defn frm-load Load a clojure form from file. [#^java.io.File file] (with-open [r

Re: the inverse function of load or load-file

2009-06-23 Thread Adrian Cuthbertson
Sorry, (prn frm) should have been (prn form). On Wed, Jun 24, 2009 at 5:33 AM, Adrian Cuthbertson adrian.cuthbert...@gmail.com wrote: You can use the following; (defn frm-save Save a clojure form to file. [#^java.io.File file form] (with-open [w (java.io.FileWriter. file)]

Re: Was it decided to add these functions to core?

2009-06-23 Thread Konrad Hinsen
Stephen C. Gilardi a écrit : These could also have shorter spellings: (in-ns 'clojure.core) (def +inf Double/POSITIVE_INFINITY) (def -inf Double/NEGATIVE_INFINITY) yielding: (range +inf) I like those a lot. And I wish I had known about Double/POSITIVE_INFINITY

Re: leveraging Clojure STM in other JVM languages?

2009-06-23 Thread MattH
I'm calling the clojure.lang.Ref and LockingTransaction classes directly from Java (as suggested by Rich above). Yes, as Daniel says you to need to segregate side effects from the code that runs in a transaction. I'm using some lightweight wrappers around Ref and LockingTransaction to store a

Re: How can I stop leaking memory?

2009-06-23 Thread Four of Seventeen
On Jun 23, 10:46 pm, Bradbev brad.beveri...@gmail.com wrote: A further optimization would be to keep track of the lowest value in your keep set.  A simple compare against that value will eliminate many of the add/removes from the keep set. (defn top [n comptr coll] (let [m (reduce #(assoc

Re: How can I stop leaking memory?

2009-06-23 Thread Christophe Grand
On Wed, Jun 24, 2009 at 7:02 AM, Four of Seventeen fsevent...@gmail.comwrote: (defn top [n comptr coll] (let [m (reduce #(assoc %1 %2 true) (sorted-map-by comptr) (take n coll))] (keys (reduce #(let [t (assoc %1 %2 true)] (dissoc t (first (last t m