Re: How can I stop "leaking" memory?

2009-06-23 Thread Christophe Grand
On Wed, Jun 24, 2009 at 7:53 AM, Richard Newman wrote: > > > Even with the optimization, sort somehow beats top for speed. It looks > > like top is best used to avoid major memory consumption for long seqs; > > if you have the memory and need the speed, sort's better. > > This is an interesting c

Re: Moving Window Function

2009-06-23 Thread Christophe Grand
On Tue, Jun 23, 2009 at 11:59 PM, Daniel Lyons wrote: > > But if I try it with your original number (10x bigger than mine) I run out > of Java heap space. Which didn't happen before either, because the lists > weren't materialized. > > So range is cheating here? How's that? > Range, like most sp

Re: How can I stop "leaking" memory?

2009-06-23 Thread Richard Newman
> Even with the optimization, sort somehow beats top for speed. It looks > like top is best used to avoid major memory consumption for long seqs; > if you have the memory and need the speed, sort's better. This is an interesting characteristic I've noticed in sorting code. In the past (I'm thin

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 wrote: > (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 (drop n coll)

Re: How can I stop "leaking" memory?

2009-06-23 Thread Four of Seventeen
On Jun 23, 10:46 pm, Bradbev 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 %1 %2 true) (sorted-m

Re: How can I stop "leaking" memory?

2009-06-23 Thread Four of Seventeen
On Jun 23, 4:25 am, Jules wrote: > 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

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 que

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_INFINI

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

2009-06-23 Thread Aaron Cohen
Isn't there already, http://www.eclipse.org/corona/ ? Sorry to be a downer, it's a cool name. How about #(eclipse) ? :) -- Aaron On Tue, Jun 23, 2009 at 9:25 PM, Alvaro Vilanova Vidal wrote: > Corona rocks! It also means crown in spanish. > > Sent from my android :P > > El 24 de jun de 2009, 3

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: 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 (java.i

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 ste

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" grou

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 wrote: > On Tue, Jun 23, 2009 at 10:14 AM, Daniel Lyons wrote: > > > I

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 wrote: > On Tue, Jun 23, 2009 at 5:09 PM, samppi wrote: > > > The idiom (into {} coll-of-entries) is often used to create a map from > > a collection of entries or two-sized vectors. B

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 Gr

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" escribió: 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

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

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 wrote: > What about eclipjure ? > > 2009/6/23 Christophe Grand > > > > > On Tue, Jun 23, 2009 at 5:56 PM, Laurent PETIT >

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 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 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 "REPtiLe"? This > could also prov

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. Gilardi wrote: http://groups.google.com/group/clojure/browse_frm/thread/5e665ce7a318f44a/158419414f9150a0?lnk=gst&q=%3Ainfinity#158419414f9150a0 Gah, I stole your idea! And your name was better, too. S

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: Recursive function that does not terminate!

2009-06-23 Thread Cosmin Stejerean
On Tue, Jun 23, 2009 at 5:22 PM, pupsik 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) > (rest

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 my-

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 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], :b [3 > 5], :

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 t

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: 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 > 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, it bit me b

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

2009-06-23 Thread Laurent PETIT
Does this fit your need ? : (reduce (fn [m [k v]] (assoc m k [v])) {} [[:a 1] [:b 3] [:b 5] [:c 1]]) HTH, -- Laurent 2009/6/24 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 > somethin

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

2009-06-23 Thread Krešimir Šojat
Sorry about that, didn't see that :b should concat it's vals: (def x [[:a 1] [:b 3] [:b 5] [:c 1]]) (reduce (fn [x [k v]] (assoc x k (if (contains? x k) (conj (x k) v) [v]))) {} x) Returns: {:c [1], :b [3 5], :a [1]} -- Krešimir Šojat --~--~-~--~~~---~--~~ You re

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. Gilardi wrote: > > On Jun 23, 2009, at 2:07 PM, Chouser wrote: > >> >> On Tue, Jun 23, 2009 at 1:09 PM, CuppoJava >> wrote: >>> >>> (iterate inc 0) >> >> Just riffing here, but what if range took some kind of >> sentinel to indicate an infinite range?  S

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 (a

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 com

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 discus

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 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 Stephen C. Gilardi
On Jun 23, 2009, at 2:07 PM, Chouser wrote: On Tue, Jun 23, 2009 at 1:09 PM, CuppoJava 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

Re: Moving Window Function

2009-06-23 Thread Christophe Grand
On Tue, Jun 23, 2009 at 9:14 PM, Daniel Lyons 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, it bit me before. It's a specialized seq. Can we try with a regular lazy-seq?

the inverse function of load or load-file

2009-06-23 Thread ogcraft
Dear all, Is there an inverse function of load or load-file. I mean the "save" function which writes the clojure variables or entire workspace context (in textual form) to the file? That we can load-file on such file and get the same variables as when "save" was originally invoked. --~--~

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 do

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 moderat

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

2009-06-23 Thread revoltingdevelopment
How about "Pinhole"? Pinhole projectors are used to view a solar eclipse, and here we get a "j" sound (the Hispanic kind) hidden in the "h". "j"-weary folks can pretend it's just an "h":-) So obscure it's obvious! --~--~-~--~~~---~--~~ You received this message

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 : > > 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 for a logo derived from

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 resulte

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

2009-06-23 Thread Stephan Mühlstrasser
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 for a logo derived from the Clojure logo, with a snake or a lizard instead of the lambda. Regards Stephan On 23 Jun., 13:47, Lauren

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 PETIT wrote: > > 2009/6/23 J. McConnell : >> >> On Tue, Jun 23, 2009 at 7:47 AM, Laurent PETIT >> wrote: >>> >>> Would you help us find a new name, by giving ideas of voting for your >>>

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 > 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 seen both in the

Re: Moving Window Function

2009-06-23 Thread Christophe Grand
Hi Kyle! On Tue, Jun 23, 2009 at 7:37 PM, Kyle Schaffrick wrote: > But, I still sometimes find it challenging to spot patterns that can be > replaced and simplified with HOFs and other functional idioms, [...] > > I wonder if anyone has a guide or tips or rules of thumb to help with > this, or i

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

2009-06-23 Thread Laurent PETIT
2009/6/23 J. McConnell : > > On Tue, Jun 23, 2009 at 7:47 AM, Laurent PETIT > 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 was also thinking about one or

Re: Moving Window Function

2009-06-23 Thread Christophe Grand
On Tue, Jun 23, 2009 at 8:02 PM, Daniel Lyons 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 seen both in the wild. I'm just > > guessing > > you prefer to make it explici

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

2009-06-23 Thread Laurent PETIT
interesting, maybe a little bit too "cryptic" ( cljdt also looks very cryptic ) 2009/6/23 John Newman : > How 'bout eclj? > > On Tue, Jun 23, 2009 at 9:01 PM, Meikel Brandmeyer wrote: >> >> Hi, >> >> Am 23.06.2009 um 18:00 schrieb Laurent PETIT: >> >>> clojure-eclipse >>> >>> This one has the me

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

2009-06-23 Thread Four of Seventeen
On Jun 23, 1:09 pm, CuppoJava 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 ...) These functions seem

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

2009-06-23 Thread Chouser
On Tue, Jun 23, 2009 at 1:09 PM, CuppoJava 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 :forever 2) ; even number

Re: Moving Window Function

2009-06-23 Thread Daniel Lyons
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 it explicit that you're doing a reduction, but I > wonder if one is better

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: 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 reason

Re: Moving Window Function

2009-06-23 Thread Kyle Schaffrick
On Tue, 23 Jun 2009 18:23:01 +0200 Christophe Grand 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. The weighting is

Re: Code generation at runtime

2009-06-23 Thread Chris Dean
Nicolas Oury 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 situation: 1. Write t

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 (ite

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

2009-06-23 Thread J. McConnell
On Tue, Jun 23, 2009 at 7:47 AM, Laurent PETIT 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. - J. --~--~-~--~~~---~--~~ You received this messag

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 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 interesti

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

2009-06-23 Thread Meikel Brandmeyer
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 interesting candidate to me. Since I'm quite uncapable of finding good names I simply rip-off o

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

2009-06-23 Thread Laurent PETIT
2009/6/23 Vagif Verdi > > 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 tend to that), but it'

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 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 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 accoun

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 wi

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 > On Tue, Jun 23, 2009 at 5:56 PM, Laurent PETIT wrote: > >> >> >> 2009/6/23 Christophe Grand >> >>> On Tue, Jun 23, 2009 at 1:47 PM, Laurent PETIT >>> wrote: >>> * eclojure (named after nothing, but an interesting contraction of the

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 wrote: > > > 2009/6/23 Christophe Grand > >> On Tue, Jun 23, 2009 at 1:47 PM, Laurent PETIT >> wrote: >> >>> * eclojure (named after nothing, but an interesting contraction of the >>> beginning of ECLipse and CLOJURE). >> >> >> maybe too close to en

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

2009-06-23 Thread Laurent PETIT
Hi, 2009/6/23 arasoft > > 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 wrote: > > Hello, > > > > Since

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

2009-06-23 Thread Laurent PETIT
2009/6/23 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. I also like the fact that it is very clear. But for referencing it, we will have to have a simpler name. For "Clojure Deve

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

2009-06-23 Thread Laurent PETIT
2009/6/23 Christophe Grand > On Tue, Jun 23, 2009 at 1:47 PM, Laurent PETIT wrote: > >> * 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 be a bad thing ? and so far it stil

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 wrote: > He

Re: Moving Window Function

2009-06-23 Thread Kyle Schaffrick
On Tue, 23 Jun 2009 10:20:52 -0400 Kyle Schaffrick wrote: > > On Mon, 22 Jun 2009 23:36:25 -0700 (PDT), Sean Devlin > 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 average

Re: Moving Window Function

2009-06-23 Thread Kyle Schaffrick
On Mon, 22 Jun 2009 23:36:25 -0700 (PDT), Sean Devlin 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 is a tad ugly but seem

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 wrote: > Hello, > > Since the switch to git, there has also been the creation of a mailing list > called clojure-dev f

Re: Moving Window Function

2009-06-23 Thread Sean Devlin
Yes, this does exactly what I want. I should have thought of it in the first place. Thank you very much. On Jun 23, 3:53 am, Christophe Grand wrote: > If understand what you are looking for, I think partition can be useful: > (map avg (partition 30 1 daily-data)) > > Christophe > > On Tue, Jun

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 wrote: > * 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: http://cgrand.net/ (f

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 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. > > While Rich didn't me

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

2009-06-23 Thread Laurent PETIT
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. While Rich didn't mention that he was bothered that the Eclipse project also has the same name, it cou

Re: Code generation at runtime

2009-06-23 Thread Nicolas Oury
Hello, Thank you very much for your answers. I know generating code at runtime (evaling) is not something very common, but that's something I need to do. I am writing a simulation software for a rule-based modelisation language. Typically, this kind of thing does millions of time the same loop

Re: How can I stop "leaking" memory?

2009-06-23 Thread Christophe Grand
On Tue, Jun 23, 2009 at 10:14 AM, Daniel Lyons wrote: > 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 O(N*sqrt(N)), which I thi

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 > repeatedl

Re: How can I stop "leaking" memory?

2009-06-23 Thread beatle...@gmail.com
On Jun 23, 7:36 am, Christophe Grand wrote: > Hi all, > > On Tue, Jun 23, 2009 at 4:16 AM, Four of Seventeen > wrote: > > > > > On Jun 22, 6:46 pm, "beatle...@gmail.com" wrote: > > > (take 10 (sort (for [x (range 100)] (rand) > > > > Now the problem is the memory usage, as it does not

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 yo

Re: How can I stop "leaking" memory?

2009-06-23 Thread beatle...@gmail.com
On Jun 23, 4:16 am, Four of Seventeen wrote: > On Jun 22, 6:46 pm, "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 a reference to the entire seq

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 Christophe Grand
(assoc % (dec n)) should read: (assoc % min (dec n)) 2009/6/23 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)) th

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 wrote: > > Hey all, > Does anyone know of a moving window function? I'm curious if there > are any tools like this for digital s

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 ha