Moving Window Function

2009-06-22 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 "C

Re: Compiling from command line (solved)

2009-06-22 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 *m

Re: How can I stop "leaking" memory?

2009-06-22 Thread Daniel Lyons
On Jun 22, 2009, at 11:36 PM, Christophe Grand wrote: > Selecting the top N out of n items is a O(n*sqrt(N)) operation so > it's linear when n dominates N and thus must beat take + sort. Plus > it won't retain the whole realized seq in memory. Just because I'm curious, I can see how to do m

Re: How can I stop "leaking" memory?

2009-06-22 Thread Christophe Grand
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 merely uses memory > > space for 10 items, but it keeps a refe

Re: macroexpand question

2009-06-22 Thread Sean Devlin
Another advantage to the second form is that it doesn't collide with any versions of x you may have defined ;This will do weird stuff to x (let [x 2] (take-until1 (do-stuff-to-x))) ;This will behave like you expect (let [x 2] (take-until2 (do-stuff-to-x))) Meikel wrote a good set of guidelines

Re: macroexpand question

2009-06-22 Thread CuppoJava
macro #2 is the idiomatic way of writing a macro. You generally shouldn't worry about the expanded form of the macro. All that extra clojure.core/ stuff is actually for your benefit. Imagine if you use that macro in a different namespace where take- while has been redefined. You probably intende

Re: How can I stop "leaking" memory?

2009-06-22 Thread Four of Seventeen
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 sequence. > If I leave out the sort its all ok, and done la

Re: intro to mutation?

2009-06-22 Thread Kai
I'm going to bash my own Stack Overflow post by repeating my disclaimer about not learning from it. I literally learned about mutation today and picked up Clojure about 3 days ago (although I've used Lisp and Java before so the learning curve wasn't huge). Otherwise, I'm glad if it helps :) On J

Re: macroexpand question

2009-06-22 Thread Four of Seventeen
On Jun 22, 8:24 pm, arasoft wrote: > I just wrote my first practice macro, first without and then with > syntax quoting: > > (defmacro take-until1 [function sq] >   (list 'take-while (list 'fn (vector 'x) (list 'not (list function > 'x))) sq)) > > (defmacro take-until2 [function sq] >   `(take-wh

Re: Code generation at runtime

2009-06-22 Thread Mike Hinchey
I think the best way for me to approach this is to ask what you want to do. This is a generalization, but most code doesn't need to call eval - the REPL does, and some advanced uses of generating code at runtime based on data. The normal Lisp approach for code that generates code is macros (defma

Re: Compiling from command line (solved)

2009-06-22 Thread pmf
On Jun 23, 12:30 am, Thibaut Barrère wrote: > btw - if there is a better way to achieve this, I'm ready to learn :) There's the main-proc in clojure.lang.Compile, which uses the system property clojure.compile.path to define the output directory and accepts a list of libs to compile. (I don't kn

Re: Code generation at runtime

2009-06-22 Thread Chouser
On Mon, Jun 22, 2009 at 5:11 PM, Nicolas Oury wrote: > > Of course, there is eval, but eval is not very competent in manipulating > namespace and bindings at runtinme. eval is exactly what the REPL uses, one call to eval per top-level form. In several examples you put an 'ns' form and others int

Re: Question/Problem re (set! *warn-on-reflection* true)

2009-06-22 Thread arasoft
Thank you for your help. I have posted a message on the Enclojure group yesterday and I am still waiting for it to show up... On Jun 22, 5:46 am, "Stephen C. Gilardi" wrote: > On Jun 21, 2009, at 11:17 PM, arasoft wrote: > > > When I enter the following function into the REPL it compiles and > >

macroexpand question

2009-06-22 Thread arasoft
I just wrote my first practice macro, first without and then with syntax quoting: (defmacro take-until1 [function sq] (list 'take-while (list 'fn (vector 'x) (list 'not (list function 'x))) sq)) (defmacro take-until2 [function sq] `(take-while (fn [x#] (not (~function x#))) ~sq)) Both seem

Re: How can I stop "leaking" memory?

2009-06-22 Thread Raoul Duke
> Does anyone know how to sort and avoid large memory consumptions? well, presumably the sort needs to look at all the data in order to be able to sort it, no?! so it is kinda just a tough cookie reality that the memory will be used. on the other hand, maybe you can do some form of the Schwartzi

How can I stop "leaking" memory?

2009-06-22 Thread beatle...@gmail.com
Dear all, I really love programming in Clojure, and have done so for the past couple of months, building my company's software recommendation engine in Clojure (not in production yet), which I originally wrote in Ruby. However I have run into the following a memory problem, which actually was poi

Compiling from command line (solved)

2009-06-22 Thread Thibaut Barrère
Hi, I found instructions about how to compile from the REPL very quickly, but it took me longer to manage to compile from the command-line. I'm sharing it here in case it's useful to someone else. To compile a .clj file, I've used this: java -cp libs/clojure-1.0.0.jar:. clojure.main -e "(set! *

intro to mutation?

2009-06-22 Thread Raoul Duke
seems like Clojure has a range of choices when it comes to dealing with mutation. is there a great online tutorial that explains what the options are, and that suggests when to not/use them? many thanks. oh wait. http://stackoverflow.com/questions/1028318/clojure-mutable-storage-types :-) --~--

Re: leveraging Clojure STM in other JVM languages?

2009-06-22 Thread Daniel Lyons
On Jun 22, 2009, at 3:45 PM, Wilson MacGyver wrote: > that seems very hard to do. I wrote some code that called Clojure from Jython just to see if it would work. All you have to do is use :gen-class to compile it and call it as though it's Java. I haven't used Scala so I'm not sure what it

Re: leveraging Clojure STM in other JVM languages?

2009-06-22 Thread Raoul Duke
> So Raoul, did you give it a try after all of this? in a word... no. :-} --~--~-~--~~~---~--~~ 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 post

Re: leveraging Clojure STM in other JVM languages?

2009-06-22 Thread Wilson MacGyver
that seems very hard to do. How would you grantee no side effect from other languages? On Mon, Jun 22, 2009 at 3:18 PM, wilfred wrote: > > So Raoul, did you give it a try after all of this? > > On May 1, 7:40 pm, Raoul Duke wrote: > > hi, > > > > has anybody experimented with using Clojure code

Re: leveraging Clojure STM in other JVM languages?

2009-06-22 Thread wilfred
So Raoul, did you give it a try after all of this? On May 1, 7:40 pm, Raoul Duke wrote: > hi, > > has anybody experimented with using Clojure code from e.g. Scala, to > get Clojure STM goodness in other languages? > > thanks. --~--~-~--~~~---~--~~ You received th

Code generation at runtime

2009-06-22 Thread Nicolas Oury
Dear all, I am quite new to clojure, and I can't find any good way to generate code at runtime. Of course, there is eval, but eval is not very competent in manipulating namespace and bindings at runtinme. For example, this: - (binding [*ns* *ns*] (eval '(do (ns Blop (:gen-class))

Re: Clojure in "Computing in Science and Engineering"

2009-06-22 Thread Jon Harrop
On Monday 22 June 2009 22:33:24 Stephen C. Gilardi wrote: > On Jun 22, 2009, at 5:53 PM, Jon Harrop wrote: > > If that is spawning a new thread every time a future is created then > > it is > > really for concurrent programming rather than parallel programming. > > The thread is from a cached thre

Re: Clojure in "Computing in Science and Engineering"

2009-06-22 Thread Stephen C. Gilardi
On Jun 22, 2009, at 5:53 PM, Jon Harrop wrote: If that is spawning a new thread every time a future is created then it is really for concurrent programming rather than parallel programming. The thread is from a cached thread pool provided by the Executors class: http://java.sun.com/javase/

Re: Clojure in "Computing in Science and Engineering"

2009-06-22 Thread Jon Harrop
On Monday 22 June 2009 12:01:19 Konrad Hinsen wrote: > Java threads, according to the documentation: > > clojure.core/future > ([& body]) > Macro >Takes a body of expressions and yields a future object that will >invoke the body in another thread, and will cache the result and >return

Re: Solving memory problems with Clojure code

2009-06-22 Thread Rob Wolfe
BerlinBrown napisał(a): > I want to make it clear, that it probably isn't Clojure's memory > problem but something with my code. > > Anyway, I was trying to figure out my heap memory goes up so much on > various operations in my application. Sure, it could be anything but > I know I am doing so

Re: javafx

2009-06-22 Thread Rob
On Jun 21, 11:02 pm, Pinocchio wrote: > CuppoJava wrote: > > I'm still not very clear about what JavaFX actually is and what's its > > relation to Java. Do you know of any links that explain it clearly? > > Its basically a way of declaring Swing GUI items and their layout. One > of its cool fea

Re: why is io! not enforced?

2009-06-22 Thread Stu Hood
This won't work unfortunately, because it means that the in-memory transaction has already commited before the disk write is performed by the agent. If the application crashed at that point, your write was not durable. -- Sent from my Palm Pre ataggart wrote: On Jun 20, 4:59 pm, Rowdy Rednos

Re: Solving memory problems with Clojure code

2009-06-22 Thread Berlin Brown
On Jun 22, 12:32 pm, Marko Kocić wrote: > Have you tried (.close stream) in the end of let block? > > On 22 јун, 16:10, BerlinBrown wrote: > > > I want to make it clear, that it probably isn't Clojure's memory > > problem but something with my code. > > > Anyway, I was trying to figure out my

Re: why is io! not enforced?

2009-06-22 Thread ataggart
On Jun 20, 4:59 pm, Rowdy Rednose wrote: > On a side-note: I actually think it can make sense to do io in > transactions in Clojure, and I believe (knowing that transactions can > be replayed) it is possible to use that to e.g. implement a > transaction log written to disk that could be used to

Re: Shouldn't c.l.Namespace implement c.l.Named?

2009-06-22 Thread Emeka
kedu pmf What about this (str *ns*)? I remember reading it from chouser's post. Regards, Emeka --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups

Re: Solving memory problems with Clojure code

2009-06-22 Thread Marko Kocić
Have you tried (.close stream) in the end of let block? On 22 јун, 16:10, BerlinBrown wrote: > I want to make it clear, that it probably isn't Clojure's memory > problem but something with my code. > > Anyway, I was trying to figure out my heap memory goes up so much on > various operations in m

Re: Clojure in "Computing in Science and Engineering"

2009-06-22 Thread Richard Newman
> Maybe I'm just perverse, and I bet *nobody* here will agree with me, > but > sometimes I feel "wrong" when I use a language like a Lisp, with its > symbolic and meta-everything sweet spot, to do something as brutish > and > mundane as picking apart awful binary formats and chewing through >

Re: Incanter classpath difficulties

2009-06-22 Thread Richard Newman
Just another 2¢ in case someone stumbles across this thread from a search… I've actually seen oddities like this on OpenSolaris and my Mac, too, when running from a jar: I'm a little hazy on the details (working late is not good for the memory!) but IIRC there was some unhappy interaction

Re: Clojure in "Computing in Science and Engineering"

2009-06-22 Thread Kyle Schaffrick
On Sun, 21 Jun 2009 14:39:37 +0100, Jon Harrop wrote: > > I had not looked at Intel's offering because it does not (AFAIK) support > accurate garbage collection. Also, it is worth noting that there is no > difference between data and task parallelism in a genuine functional > language. > We

Re: Incanter classpath difficulties

2009-06-22 Thread liebke
Excellent, I'm glad you figured it out. I'll note the problem with / Library/Java/Extensions, in case it happens to others in the future. Thanks, David On Jun 22, 9:11 am, Anand Patil wrote: > OK, figured it out... the problem was I had copied incanter.clj to > /Library/Java/Extensions. When

Re: Incanter classpath difficulties

2009-06-22 Thread Konrad Hinsen
On Jun 22, 2009, at 15:11, Anand Patil wrote: > OK, figured it out... the problem was I had copied incanter.clj to / > Library/Java/Extensions. When I removed that copy, everything > worked as expected. Weird, but I'm glad it's not happening anymore. I have seen strange behaviour with Clojure

Solving memory problems with Clojure code

2009-06-22 Thread BerlinBrown
I want to make it clear, that it probably isn't Clojure's memory problem but something with my code. Anyway, I was trying to figure out my heap memory goes up so much on various operations in my application. Sure, it could be anything but I know I am doing something wrong. Here is the applicati

Re: Is it possible to tweak *compile-path* ?

2009-06-22 Thread Thibaut Barrère
Hi, > Yup, you can either using binding to create a thread-local value for > *compile-path*, or use set! to alter the root binding. Usage of set! > is usually discouraged outside of the REPL, I believe, but it's an > option. It works! I just used: (set! *compile-path* ".") The need for classes

Re: Incanter classpath difficulties

2009-06-22 Thread Anand Patil
OK, figured it out... the problem was I had copied incanter.clj to /Library/Java/Extensions. When I removed that copy, everything worked as expected. Weird, but I'm glad it's not happening anymore. Anand On Mon, Jun 22, 2009 at 1:52 PM, Anand Patil < anand.prabhakar.pa...@gmail.com> wrote: > Hi D

Re: Dynamically accessing static fields

2009-06-22 Thread Sean Devlin
There's already a miglayout wrapper in contrib. It seemed usable when I looked at it. On Jun 22, 7:35 am, Laurent PETIT wrote: > Hi, > > BTW, if it can be an option for you, there's also the MigLayout layout > manager (http://www.miglayout.com/) that allows to write constraints > as Strings. It

Re: Incanter classpath difficulties

2009-06-22 Thread Anand Patil
Hi David, no worries, thanks for trying. I'll let you know if I find a solution. Cheers Anand On Mon, Jun 22, 2009 at 1:41 PM, liebke wrote: > > Anand, you've stumped me! You can import the class directly, but you > can't load incanter.core because it can't import the class? I'm not > sure what

Re: Incanter classpath difficulties

2009-06-22 Thread liebke
Anand, you've stumped me! You can import the class directly, but you can't load incanter.core because it can't import the class? I'm not sure what would cause that behavior, and I can't reproduce it. Whenever I encounter weird errors like this, I try rebooting. You might also try cloning incanter

Re: Is it possible to tweak *compile-path* ?

2009-06-22 Thread J. McConnell
On Mon, Jun 22, 2009 at 7:15 AM, Thibaut Barrère wrote: > > I read that I should be able to change *compile-path* (I'd like to set > it to the same folder where the .clj files is). > > Is it possible and how can I achieve that ? Yup, you can either using binding to create a thread-local value fo

Is it possible to tweak *compile-path* ?

2009-06-22 Thread Thibaut Barrère
Hi, I'm just starting to learn about clojure, partly to be able to integrate it into a jruby+java audio processing project (http:// github.com/thbar/opaz-plugdk/tree/master). I want to use ahead-of-time compile. I managed to compile an existing .clj file (as long as a classes folder exist). I r

Another javadoc + clojure/slime integration

2009-06-22 Thread Ram Krishnan
Hi all, Long time reader, first time poster. Thanks to Rich and the other contributors for all the great work on Clojure. I recently had a chance to use Clojure on a non-trivial project, which required integrating with a number of Java libraries. In the course of that I was getting tired of swit

Another javadoc + clojure/slime integration

2009-06-22 Thread Ram Krishnan
Hi all, Long time reader, first time poster. Thanks to Rich and the other contributors for all the great work on Clojure. I recently had a chance to use Clojure on a non-trivial project, which required integrating with a number of Java libraries. In the course of that I was getting tired of swit

Re: Dynamically accessing static fields

2009-06-22 Thread Laurent PETIT
Hi, BTW, if it can be an option for you, there's also the MigLayout layout manager ( http://www.miglayout.com/ ) that allows to write constraints as Strings. It has already been mentioned on this ml, so maybe there's clojure stuff done for integrating it more closely with clojure ? HTH, -- Lau

Re: Clojure in "Computing in Science and Engineering"

2009-06-22 Thread Konrad Hinsen
On Jun 20, 2009, at 12:29, Jon Harrop wrote: > The Task Parallel Library. It uses concurrent wait-free work- > stealing queues > to provide an efficient implementation of "work items" than can > spawn other > work items with automatic load balancing on shared memory machines. > Cilk uses > t

Re: Incanter classpath difficulties

2009-06-22 Thread Anand Patil
On Mon, Jun 22, 2009 at 2:41 AM, liebke wrote: > > Hi Anand, > > Try changing the INCANTER_HOME variable in the clj script to the > absolute path to the incanter directory, instead of a relative path, > like ./ or ../ > > Let me know if that doesn't work. > Hi David, Didn't work, unfortunately.