Re: sorted-map-by sample call

2009-06-22 Thread kkw
Hi Steve, I didn't know the difference between a keyfn and a comparator. Thanks for pointing that out! Kev On Jun 22, 3:50 pm, Stephen C. Gilardi squee...@mac.com wrote: On Jun 22, 2009, at 1:23 AM, kkw wrote:    I had some fortune with the sorted-by function: 1:11 user= (sort-by

Re: Incanter classpath difficulties

2009-06-22 Thread Anand Patil
On Mon, Jun 22, 2009 at 2:41 AM, liebke lie...@gmail.com 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,

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 the same

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

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

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 thibaut.barr...@gmail.com 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

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 lie...@gmail.com 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

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 laurent.pe...@gmail.com 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

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

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

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

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

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 anand.prabhakar.pa...@gmail.com wrote: OK, figured it out... the problem was I had copied incanter.clj to

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 j...@ffconsultancy.com 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

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

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 berlin.br...@gmail.com 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

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 vectors

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

Re: why is io! not enforced?

2009-06-22 Thread ataggart
On Jun 20, 4:59 pm, Rowdy Rednose rowdy.redn...@gmx.net 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

Re: Solving memory problems with Clojure code

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

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

Re: javafx

2009-06-22 Thread Rob
On Jun 21, 11:02 pm, Pinocchio cchino...@gmail.com 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

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

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 it on

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 thread pool

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: 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 rao...@gmail.com wrote: hi, has anybody experimented with using Clojure code from e.g. Scala, to get Clojure STM goodness in other languages? thanks. --~--~-~--~~~---~--~~ You

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 posts

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

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

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!

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

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

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: 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 squee...@mac.com wrote: On Jun 21, 2009, at 11:17 PM, arasoft wrote: When I enter the following function into the REPL it

Re: Code generation at runtime

2009-06-22 Thread Chouser
On Mon, Jun 22, 2009 at 5:11 PM, Nicolas Ourynicolas.o...@gmail.com 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'

Re: Compiling from command line (solved)

2009-06-22 Thread pmf
On Jun 23, 12:30 am, Thibaut Barrère thibaut.barr...@gmail.com 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

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

Re: macroexpand question

2009-06-22 Thread Four of Seventeen
On Jun 22, 8:24 pm, arasoft t...@arasoft.de 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]  

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

Re: How can I stop leaking memory?

2009-06-22 Thread Four of Seventeen
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 a reference to the entire sequence. If I leave out the sort its all

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

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 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 problem is the memory usage, as it does not merely uses memory space for

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 max