Re: clojure-contrib master now in submodules

2010-08-23 Thread B Smith-Mannschott
On Mon, Aug 23, 2010 at 07:04, ataggart alex.tagg...@gmail.com wrote: Yes, you can easily work offline. Simply recursively wget the entire maven repo from http://repo1.maven.org/maven2/ It may take a while. Whatever you do, please DO NOT DO THAT! e.g.

Re: cool compiler-project?

2010-08-23 Thread Moritz Ulrich
Memoization is implemented at language-leve. The function is called memoize. (It's a three-liner or so) On Sun, Aug 22, 2010 at 11:45 PM, Sreeraj a writeto...@gmail.com wrote: What about automatic memoization? Does clojure already implement memoization? is adding auto memoization to the

Re: does clojure take advantage of multicore

2010-08-23 Thread Konrad Hinsen
On 22 Aug 2010, at 17:48, Belun wrote: does clojure take advantage of my multicore processor ? if i write a program (not using multiple threads) that is going to take 1 day in a java environment, then will my program run 4 times faster on my 4 core processor if i build it in clojure ? No. No

Re: cool compiler-project?

2010-08-23 Thread nickikt
I think he talkes about automatic detection where memoization would be good for performence. I don't think it is done ATM but I would surly be a intressting topic. The Clojure compiler is still in Java. I think befor someone does a big project with the compiler it should be translated to clojure.

What is the best way to parasitically invade a java project with clojure goodness?

2010-08-23 Thread Robert McIntyre
Let's say my group has a fairly large java project on which ~20 people are working. We want to start using clojure with our existing code. Specifically, we want to have clojure classes that provide functions for our java classes, and vice versa. Two questions on the best way to do this: (:1

Re: why data structure

2010-08-23 Thread Victor Olteanu
Some examples to illustrate this would be very welcome. On Aug 22, 2010, at 9:17 AM, Nicolas Oury nicolas.o...@gmail.com wrote: On Sun, Aug 22, 2010 at 11:30 AM, Belun alexandrurep...@gmail.com wrote: why does everything have to be a data structure ? like (operation parameter parameter ...)

parallel execution

2010-08-23 Thread nchubrich
I have a simulation program that runs a Number of random Simulations and then Averages them. It basically looks like this: (reduce Average (repeatedly Number Simulate)) What is the best way of making this parallel? I noticed there was no parallel version of repeatedly. I suppose I could

Re: AOT compilation newbie mistakes

2010-08-23 Thread Robert McIntyre
oh yes -- please don't do it manually for anything production But, it's good to know what's actually going on behind the scenes, especially when things stop working :) --Robert McIntyre On Sun, Aug 22, 2010 at 7:05 PM, Wilson MacGyver wmacgy...@gmail.com wrote: On Sun, Aug 22, 2010 at 2:39 PM,

Re: why data structure

2010-08-23 Thread Nicolas Oury
On Mon, Aug 23, 2010 at 3:45 AM, Victor Olteanu bluestar...@gmail.com wrote: Some examples to illustrate this would be very welcome. Any macro is an example of that. For example, from clojure/core.clj (defmacro - Threads the expr through the forms. Inserts x as the second item in the first

Re: why data structure

2010-08-23 Thread Meikel Brandmeyer
Hi, On 23 Aug., 14:03, Nicolas Oury nicolas.o...@gmail.com wrote: If the AST of LISP were more complicated, this kind of program would be more complicated. eg. see OCaml's camlp4. I found it complicated compared to Lisp style macros. Sincerely Meikel -- You received this message because

Re: why data structure

2010-08-23 Thread Nicolas Oury
And it's usage is far less generalised than macros in LISP. It is not an usual solution to write acamlp4 preprocessor. On Mon, Aug 23, 2010 at 1:06 PM, Meikel Brandmeyer m...@kotka.de wrote: Hi, On 23 Aug., 14:03, Nicolas Oury nicolas.o...@gmail.com wrote: If the AST of LISP were more

Re: parallel execution

2010-08-23 Thread Konrad Hinsen
On 23.08.2010, at 04:45, nchubrich wrote: I have a simulation program that runs a Number of random Simulations and then Averages them. It basically looks like this: (reduce Average (repeatedly Number Simulate)) I guess that Simulate is a function and that Average calls functions and

Re: parallel execution

2010-08-23 Thread Nicolas Oury
This seemed to be in clojure.parallel, but parallel is deprecated.  Why is it deprecated, and what's the replacement for it? I'd like to know that as well! I am not sure, so don't believe this blindly. I think it is due to changes in the plan for Java 7 and JSR266y. Some of the dependency

Re: parallel execution

2010-08-23 Thread Meikel Brandmeyer
Hi, maybe work is of interest to you: http://measuringmeasures.com/blog/2010/8/16/clojure-workers-and-large-scale-http-fetching.html Sincerely Meikel -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Clojure 1.2 and ELPA

2010-08-23 Thread Rising_Phorce
Hi: I'm using Ubuntu and emacs 23 with elpa to manage clojure-mode, paren- edit, slime, slime-repl and swank-clojure. ELPA doesn't like list swank-clojure 1.2 yet. Can I upgrade manually? It looks like ~/.swank-clojure contains the clojure and clojure contrib jar files. But this directory is

Re: Compilation fails in Clojure Box 1.2.0

2010-08-23 Thread Shawn Hoover
It's because slime-compile-file (C-c M-k) doesn't do anything unless the optional load parameter is true, and when you run the function from the keyboard shortcut, it doesn't get set. C-c C-k ends up calling that function with load=true. The distinction between to the two is false in Clojure

Re: Another JavaFX and Clojure Demo

2010-08-23 Thread polypus74
hi sam, thanks for the demo. looks like there's mounting interest in javafx and clojure. good to know. see this thread: http://groups.google.com/group/clojure/browse_thread/thread/35aabe2fa9302aff# i'm hard at work and should release shortly. _c On Aug 21, 8:43 pm, Sam Griffith

Re: JavaFX and Clojure

2010-08-23 Thread Jeff Rose
I started using the scenario scenegraph library from JavaFX to create GUI elements in project Overtone, but it seems development has stopped on the project (at least in the public repository) and we are weary of becoming dependent on a dead or closed source library. It's really too bad, because

Re: What is the best way to parasitically invade a java project with clojure goodness?

2010-08-23 Thread Allen Johnson
(:1 Should the clojure source files intermingle with the java source files, each according to it's relavance to the problem, or should there be a top level separation between them?) IMO, they should be separated. Since the project was started with Java I'd continue treating it as the

Re: What is the best way to parasitically invade a java project with clojure goodness?

2010-08-23 Thread Allen Johnson
Oops, s/create an instead/create an instance/ :) On Mon, Aug 23, 2010 at 10:03 AM, Allen Johnson akjohnso...@gmail.com wrote: (:1 Should the clojure source files intermingle with the java source files, each according to it's relavance to the problem, or should there be a top level separation

Re: Compilation fails in Clojure Box 1.2.0

2010-08-23 Thread Arie van Wingerden
Hi Shawn. This kind of thing always bothers me. It makes me a bit unsure wether the installation was done correctly; hence the question. But I'll regard that menu entry as not existent then anyway from now on. Thanks! Arie 2010/8/23 Shawn Hoover shawn.hoo...@gmail.com It's because

Re: AOT compilation newbie mistakes

2010-08-23 Thread Isaac Gouy
On Aug 22, 4:28 pm, Robert McIntyre r...@mit.edu wrote: oh yes -- please don't do it manually for anything production But, it's good to know what's actually going on behind the scenes, especially when things stop working :) For my simple needs - java -cp .:clojure.jar

Where is (re? x)

2010-08-23 Thread Jeff Rose
It looks like regular expressions are the only type with built-in syntax that don't have a predicate function. How about: (def ^{:arglists '([x]) :doc Return true if x is a regular expression (java.util.regex.Pattern) :added 1.3} re? (fn re? [x] (instance? java.util.regex.Pattern x)))

Re: Clojure 1.2 and ELPA

2010-08-23 Thread Phil Hagelberg
The elisp side of swank-clojure is deprecated. You just need clojure-mode and slime-repl on the Emacs side. Then launch a swank server with your build tool. See the swank-clojure readme. On Aug 23, 2010 6:21 AM, Rising_Phorce josh.fe...@gmail.com wrote: Hi: I'm using Ubuntu and emacs 23 with

Re: Where is (re? x)

2010-08-23 Thread James Reeves
Why use def? You could just place re? after the definition of defn, and write it: (defn re? Return true if x is a regular expression {:added 1.3} [x] (instance? java.util.regex.Pattern x)) - James On 23 August 2010 16:17, Jeff Rose ros...@gmail.com wrote: It looks like regular

trouble using nested map fn

2010-08-23 Thread Glen Rubin
I am trying to write a fn to correlate 2 signals using 3 nested map fn. I have 2 collections of data. THe first group of signals called target looks something like this. target: ( (1,2,3,4) (2,3,4,5) ...) The second collection is called signal and looks like this: signal: (

Re: trouble using nested map fn

2010-08-23 Thread Luka Stojanovic
On Mon, 23 Aug 2010 17:26:44 +0200, Glen Rubin rubing...@gmail.com wrote: I am trying to write a fn to correlate 2 signals using 3 nested map fn. I have 2 collections of data. THe first group of signals called target looks something like this. target: ( (1,2,3,4) (2,3,4,5) ...) The second

Re: Another JavaFX and Clojure Demo

2010-08-23 Thread joshua-choi
This is fascinating—I too am interested in Clojure-JavaFX interaction. Thanks a lot for putting this up! On Aug 21, 8:43 pm, Sam Griffith stayp...@mac.com wrote: Hello group, I'd replied a long time ago to one of the posts about JavaFX and Clojure working together... I've now finally gotten

Re: trouble using nested map fn

2010-08-23 Thread gary ng
On Mon, Aug 23, 2010 at 8:31 AM, Luka Stojanovic li...@magrathea.rs wrote: It's not about nested maps, but about nested anonymous functions: if you nest anonimous functions you must use (fn [] ...) like: (map (fn [t s] (map #(map * %1 %2) t s)) target signal) This has me question, how useful

Re: trouble using nested map fn

2010-08-23 Thread Btsai
Ah, so this is the context for your previous thread about multiplying lists. Re-using some of the code from that thread: (def target [[1 2 3 4] [2 3 4 5]]) (def signal [[[1 2 3 4] [2 3 4 5] [3 4 5 6]] [[2 3 4 5] [3 4 5 6] [4 5 6 7]]]) (defn correlate [target signal] (let [mult-lists (fn [x

Re: trouble using nested map fn

2010-08-23 Thread Joop Kiefte
uses like #(first %) keeps the code cleaner on the other hand, for more complicated things I would really not recommend the short form 2010/8/23 gary ng garyng2...@gmail.com: On Mon, Aug 23, 2010 at 8:31 AM, Luka Stojanovic li...@magrathea.rs wrote: It's not about nested maps, but about nested

Re: trouble using nested map fn

2010-08-23 Thread gary ng
On Mon, Aug 23, 2010 at 8:50 AM, Joop Kiefte iko...@gmail.com wrote: uses like #(first %) keeps the code cleaner Is that the same as just 'first' like : (map first [[1 2] [3 4]]) (map #(first %) [[1 2] [3 4])) -- You received this message because you are subscribed to the Google Groups

Re: trouble using nested map fn

2010-08-23 Thread Joop Kiefte
bad example =/ Yes, it is but you get the gist I hope better example: #(first (sort %)) ;) 2010/8/23 gary ng garyng2...@gmail.com: On Mon, Aug 23, 2010 at 8:50 AM, Joop Kiefte iko...@gmail.com wrote: uses like #(first %) keeps the code cleaner Is that the same as just 'first' like : (map

Re: Where is (re? x)

2010-08-23 Thread Jeff Rose
Sure, I was just copying the style of the existing predicate functions in core.clj to keep it consistent. -Jeff On Aug 23, 5:25 pm, James Reeves jree...@weavejester.com wrote: Why use def? You could just place re? after the definition of defn, and write it: (defn re?   Return true if x is a

Re: Where is (re? x)

2010-08-23 Thread Sean Devlin
Be very careful when copying the style of clojure.core. There are a lot of non-standard practices in there, because Rich is bootstrapping the language. For example, defn doesn't work like we're all used to in core until about 80% of the way through. Follow these style guidelines instead:

Clojure 1.2 and the Computer Language Benchmarks Game

2010-08-23 Thread Isaac Gouy
Now Clojure 1.2 has been released, Clojure programs will be included in the Computer Language Benchmarks Game. If you'd like to contribute Clojure programs, please follow the step- by-step http://shootout.alioth.debian.org/help.php#contribute -- You received this message because you are

Re: JavaFX and Clojure

2010-08-23 Thread Mark Engelberg
Rather than creating the JavaFX language they would have done so much more for the community to just focus on this scenegraph library, animation, etc... I agree. I'm not interested in the JavaFX language, but am interested in doing Flash-like user interfaces and animations from Clojure. --

Re: clojure-contrib master now in submodules

2010-08-23 Thread Konrad Hinsen
On 20 Aug 2010, at 16:22, Stuart Sierra wrote: *** For clojure-contrib developers: Each library has its own directory under the modules directory at the top level of clojure-contrib. Each module directory contains a pom.xml file specifying the name, version number, and dependencies of that

Re: Why the mix of dot syntax in clojure.core?

2010-08-23 Thread Daniel Werner
On Aug 22, 2:39 am, Legilimens bort...@gmail.com wrote: Would people be interested in a patch that replaces all of the older static calls using . to the newer method using / ? I personally don't mind the leftovers of old syntax in core. However, the question of why is it being used comes up

Re: clojure-contrib master now in submodules

2010-08-23 Thread Stuart Sierra
On Aug 23, 2:51 pm, Konrad Hinsen konrad.hin...@fastmail.net wrote: Or is there any simple way to make a jar containing only the source code files? Ys, the maven assembly plugin can do this. Ill work on it when I get back later this week. -S -- You received this message because you are

Re: trouble using nested map fn

2010-08-23 Thread Cameron
Again with the bad examples but... (map #(even? %) coll) is faster than (map (partial even?) coll) So it's at least got that going for it. (I know this SHOULD be written as (map even? coll)) On Aug 23, 1:59 pm, Michael Gardner gardne...@gmail.com wrote: On Aug 23, 2010, at 11:13 AM, Luka

Unsigned-right-shift patch

2010-08-23 Thread Cameron
Hey all, I had an itch this weekend... so I scratched it. I was doing some bit twiddling stuff and needed the Java operator. I had written some workarounds but they were overly-complicated and slower than I would have hoped, so I dug directly into core and added it as a first class citizen next

Re: Unsigned-right-shift patch

2010-08-23 Thread Alan
Without commenting on the usefulness of this (it doesn't really interest me), there are a couple style things I would change. First, :added ought to be 1.3 (maybe 1.2?), not 1.0. Second, the newsgroup seems to think that if you're changing clojure.core you might as well update from (. staticMember

Re: trouble using nested map fn

2010-08-23 Thread Alan
Really? I would be interested to hear why; is it maybe because partial has to take any number of arguments and then (apply even? args)? I've taken to using partial when I can, precisely because of the difficulty of nesting anonymous functions, and while performance isn't a big deal for me I'm

Re: Unsigned-right-shift patch

2010-08-23 Thread Cameron Pulsford
Yes the 1.0 was a slip on my part, and I agree that I should have used the class/staticMembers syntax; at the time I was simply trying to fit in. Regardless, here is the updated patch with those two comments fixed:

Re: trouble using nested map fn

2010-08-23 Thread Cameron Pulsford
The difference is not HUGE, but in a critical section it might be a valid micro-optimization. I'd also be interested to know why, but I bet you're assumption of apply being thrown in the mix is probably pretty close to true. user= (time (dotimes [_ 1e6] (doall (map #(filter even? %) (for [i

Re: cool compiler-project?

2010-08-23 Thread Daniel Glauser
I thought that much of the driver behind protocols and records were to support the Clojure-in-Clojure effort. Can anyone confirm? Thanks, Daniel On Aug 23, 3:59 am, nickikt nick...@gmail.com wrote: I think he talkes about automatic detection where memoization would be good for performence. I

Re: trouble using nested map fn

2010-08-23 Thread Randy Hudson
Well, #(= lo % hi) is to my mind much more readable than (fn [x] (= lo x hi)), especially embedded in another form or two (as it would be). On Aug 23, 11:48 am, gary ng garyng2...@gmail.com wrote: On Mon, Aug 23, 2010 at 8:31 AM, Luka Stojanovic li...@magrathea.rs wrote: It's not about nested

Re: date serialization in clojure-contrib json

2010-08-23 Thread Dmitri
Transforming the data after it comes out of the parser can be cumbersome with complex data structures though, it would be nice to have a way for the parser to return the data in the desired format. I updated clojure.contrib.json with the ability to add custom deserializers: (def *deserializers*

Re: trouble using nested map fn

2010-08-23 Thread gary ng
On Mon, Aug 23, 2010 at 8:26 AM, Glen Rubin rubing...@gmail.com wrote: I am trying to write a fn to correlate 2 signals using 3 nested map fn.  I have 2 collections of data.  THe first group of signals called target looks something like this. target: ( (1,2,3,4) (2,3,4,5) ...) The second

Re: trouble using nested map fn

2010-08-23 Thread gary ng
On Mon, Aug 23, 2010 at 5:41 PM, Randy Hudson randy_hud...@mac.com wrote: Well, #(= lo % hi) is to my mind much more readable than (fn [x] (= lo x hi)), especially embedded in another form or two (as it would be). that may be true. though this IMO is partly due to the (=) construct's argument

Re: trouble using nested map fn

2010-08-23 Thread David Sletten
There may be some value in the intellectual exercise to try something like your solution, but I think this is far more tractable if you use meaningful variable names: (map (fn [group scalars] (map (fn [trial] (map (fn [signal scalar] (* signal scalar)) trial scalars)) group)) signal target)

Re: What is the best way to parasitically invade a java project with clojure goodness?

2010-08-23 Thread Seth
Going from Java to Clojure isn't quite as easy as going the other way, as @brweber2 demonstrated at the local Clojure meetup. Here's the code he used in the presentation, might send him a direct message on Twitter for more info: http://github.com/brweber2/javacallclj On Aug 22, 7:48 pm, Robert

Re: Clojure 1.2 and the Computer Language Benchmarks Game

2010-08-23 Thread ataggart
It's never been clear to me exactly what the code is supposed to be do. For example, the spec for the binary-tree test is so wholly lacking in any details that I'm left to infer that one is supposed to copy an implementation used previously, though without any indication as to which is the

Re: Where is (re? x)

2010-08-23 Thread Robert McIntyre
I think the re? definition might belong around line 447 of core with the rest of the more normal looking instance? functions. On Mon, Aug 23, 2010 at 1:27 PM, Sean Devlin francoisdev...@gmail.com wrote: Be very careful when copying the style of clojure.core.  There are a lot of non-standard

Re: Clojure 1.2 and the Computer Language Benchmarks Game

2010-08-23 Thread Robert McIntyre
I hear you --- I got excited about this too, and implemented the fannuchredux algorithm, only to be thwarted by an undocumented checksum each program is also supposed to calculate. This checksum depends heavily on the exact order in which a set of permutations are traversed. And of course, they

Re: trouble using nested map fn

2010-08-23 Thread Meikel Brandmeyer
Hi, On 24 Aug., 03:08, gary ng garyng2...@gmail.com wrote: (map #(for [s %2] (map * %1 s)) target signal) Though personally I still think the %2 %1 is a bit confusing.- Zitierten Text ausblenden - If you don't like it, don't use it.You can always give things meaningful names. (for