Re: clojure-mini kanren implementation of nonvar

2010-11-06 Thread Sunil S Nandihalli
David, Would you know the difference between mem-o and member-o in Jim's implementation...? Thanks, Sunil. On Sat, Nov 6, 2010 at 7:36 AM, Sunil S Nandihalli < sunil.nandiha...@gmail.com> wrote: > Hi David, > I get (20) whether "(& x 10)" is commented out or not.. I was expecting it > to return

Re: clojure-mini kanren implementation of nonvar

2010-11-06 Thread Sunil S Nandihalli
after looking through his source code ... I discovered that replacing cond-u with cond-a gives me the expected output .. but I am unable to explain what I have found... Regards, Sunil. On Fri, Nov 5, 2010 at 7:16 PM, David Nolen wrote: > On Thu, Nov 4, 2010 at 11:36 PM, Sunil S Nandihalli < > su

Re: Python is way faster than Clojure on this task

2010-11-06 Thread pepijn (aka fliebel)
Awesome. You managed to reproduce my initial solution, but working with arrays all the way. It is already quite a bit faster than what I have, but still nowhere near Python. I'll put it on the list for things to look at. On Nov 6, 1:27 am, Benny Tsai wrote: > Oops, sorry, got my terminology wron

Re: Python is way faster than Clojure on this task

2010-11-06 Thread Peter Schuller
> You can use Visual VM (https://visualvm.dev.java.net/) to see how the > VM is using memory.  I don't think it specifically show a log of GC > activity, but it is pretty clear from the graphs. Or just use -XX:+PrintGC and maybe -XX:+PrintGCDetails and -XX:+PrintGCTimeStamps. I haven't checked wh

Re: From jetty to war?

2010-11-06 Thread iko...@gmail.com
You'll learn Python quickly enough anyhow. Python is not very hard. 2010/11/5 Sean Corfield > On Fri, Nov 5, 2010 at 2:33 PM, Mike Meyer > wrote: > > This affect only works if the languages are sufficiently different to > > have different "obvious" solutions for a large number of problems. > >

Re: Python is way faster than Clojure on this task

2010-11-06 Thread pepijn (aka fliebel)
[GC 524288K->103751K(2009792K), 0.1105872 secs] [GC 628039K->105751K(2009792K), 0.0925628 secs] [GC 630039K->109023K(2009792K), 0.0702017 secs] [GC 633311K->115263K(2009792K), 0.0766341 secs] [GC 639551K->117723K(2009792K), 0.0731049 secs] [GC 642011K->120195K(1980096K), 0.0755788 secs] [GC 614787K

Re: NoSuchMethodError: clojure.lang.Symbol.create error from clojure.contrib.sql?

2010-11-06 Thread Stuart Halloway
This is fixed now. Stu > Just FYI, using clojure 1.3.0-master-SNAPSHOT and contrib/standalone > 1.3.0-SNAPSHOT, I get the following error when I (:use > [clojure.contrib.sql]): > > Exception in thread "main" java.lang.RuntimeException: > java.lang.NoSuchMethodError: > clojure.lang.Symbol.create(

Re: Python is way faster than Clojure on this task

2010-11-06 Thread Bob Hutchison
On 2010-11-06, at 9:08 AM, pepijn (aka fliebel) wrote: > I increased the heap space a lot, but I'm just bordering on the edge > of my real memory, so it's not helping much. Did you try pushing the minimum heap space up. I'm usually lazy and set them to the same. I've had serious trouble caused

Re: Python is way faster than Clojure on this task

2010-11-06 Thread Peter Schuller
> For 30 second worth of calculations, this doesn't look to bad to me. If that was for all of the 30 seconds then yeah, GC is not the issue. -- / Peter Schuller -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to cl

Re: Python is way faster than Clojure on this task

2010-11-06 Thread Peter Schuller
>> I increased the heap space a lot, but I'm just bordering on the edge >> of my real memory, so it's not helping much. > > Did you try pushing the minimum heap space up. I'm usually lazy and set them > to the same. I've had serious trouble caused by the way the JVM increases the > heap space. Se

Re: Python is way faster than Clojure on this task

2010-11-06 Thread Bob Hutchison
On 2010-11-06, at 10:22 AM, Peter Schuller wrote: >>> I increased the heap space a lot, but I'm just bordering on the edge >>> of my real memory, so it's not helping much. >> >> Did you try pushing the minimum heap space up. I'm usually lazy and set them >> to the same. I've had serious trouble

Re: From jetty to war?

2010-11-06 Thread Sean Corfield
On Sat, Nov 6, 2010 at 5:59 AM, iko...@gmail.com wrote: > You'll learn Python quickly enough anyhow. Python is not very hard. I generally pick up new programming languages pretty quickly. I started my (working) life as a compiler writer and spent three years prior doing research into functional l

Re: NoSuchMethodError: clojure.lang.Symbol.create error from clojure.contrib.sql?

2010-11-06 Thread Sean Corfield
Thanx! Confirmed that my code now runs perfectly on 1.3.0 (master) SNAPSHOT. On Sat, Nov 6, 2010 at 6:33 AM, Stuart Halloway wrote: > This is fixed now. > > Stu > >> Just FYI, using clojure 1.3.0-master-SNAPSHOT and contrib/standalone >> 1.3.0-SNAPSHOT, I get the following error when I (:use >>

Re: clojure-mini kanren implementation of nonvar

2010-11-06 Thread David Nolen
On Sat, Nov 6, 2010 at 5:02 AM, Sunil S Nandihalli < sunil.nandiha...@gmail.com> wrote: > after looking through his source code ... I discovered that replacing > cond-u with cond-a gives me the expected output .. but I am unable to > explain what I have found... > Regards, > Sunil. > mem-o is the

Re: clojure-mini kanren implementation of nonvar

2010-11-06 Thread jim
David, That's exactly right. (Pending a review of "The Reasoned Schemer" when I get home) Jim On Nov 6, 11:18 am, David Nolen wrote: > On Sat, Nov 6, 2010 at 5:02 AM, Sunil S Nandihalli < > > sunil.nandiha...@gmail.com> wrote: > > after looking through his source code ... I discovered that repl

Re: Clojure 1.3 Alpha 3

2010-11-06 Thread Jacek Laskowski
On Sat, Nov 6, 2010 at 1:53 AM, Stuart Halloway wrote: > Clojure 1.3 Alpha 2 is now available at Hi, ^^^ note the version, but the subject says it all, so... I downloaded the alpha3 release and have run it with the recent build of clojure-contrib #253 [1]. When I u

map versus pmap

2010-11-06 Thread philip schwarz
Hi all, be gentle please: I have only just started using clojure. I run the following on an Intel Core 2 Duo CPU (starting clojure with "java -Xms1000m -Xmx1000m -jar clojure.jar"): user=> (time (nth (doall (map inc (range 1000))) 999)) "Elapsed time: 5944.068355 msecs" 1000 user=>

The Genuine Sieve of Eratosthenes

2010-11-06 Thread thattommyhall
Hey, I read http://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf a while ago and noticed you had referenced the paper and implemented the naive algorithm in contrib and thought I could chip in and do the sieve for you but get an error in my current implementation with only a million primes. "Excepti

Re: The Genuine Sieve of Eratosthenes

2010-11-06 Thread Ken Wesson
On Sat, Nov 6, 2010 at 11:28 AM, thattommyhall wrote: > Hey, > > I read http://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf a while ago > and noticed you had referenced the paper and implemented the naive > algorithm in contrib and thought I could chip in and do the sieve for > you but get an error

Re: Python is way faster than Clojure on this task

2010-11-06 Thread Benny Tsai
While grocery shopping this morning, it occurred to me that it would be even faster to do a single pass over the blocks array, and update the count in one of 128 maps depending on the current index. Of course, when I got home and took another look at your gist page, it turns out that's you've alre

Re: map versus pmap

2010-11-06 Thread Andy Fingerhut
The amount of work in each element of the pmap is so small that the overhead per element is dominating the CPU usage, e.g. overhead like constructing a future for each element of the collection you are mapping over. Try a test case where the computation being done in the function you supply to

Re: map versus pmap

2010-11-06 Thread philip schwarz
thanks On Nov 6, 6:04 pm, Andy Fingerhut wrote: > The amount of work in each element of the pmap is so small that the overhead > per element is dominating the CPU usage, e.g. overhead like constructing a > future for each element of the collection you are mapping over.  Try a test > case where

Re: map versus pmap

2010-11-06 Thread nickikt
using more then one thread is no silver bullet. What would you do if you have to count to 1. Would you just start counting or would go and hire 2 more people explain them what to do and then count together? In this case you would just start counting because you know that you will be faster b

bootclasspath

2010-11-06 Thread Phil Hagelberg
Has anyone successfully used Clojure 1.3 from the bootclasspath? I ran into issues with Clojure 1.2 where you couldn't transitively require from namespaces on the bootclasspath. So if you loaded clojure.test, it wouldn't work unless you required clojure.template, clojure.stacktrace, and the other

Re: bootclasspath

2010-11-06 Thread Phil Hagelberg
On Sat, Nov 6, 2010 at 2:00 PM, Phil Hagelberg wrote: > Has anyone successfully used Clojure 1.3 from the bootclasspath? Before anyone asks why I'm suggesting going to such lengths to work with the bootclasspath, I should note that on my machine it cuts Clojure's boot time in half. (1.243s -> 0.5

Re: The Genuine Sieve of Eratosthenes

2010-11-06 Thread Juha Arpiainen
On Nov 6, 7:57 pm, Ken Wesson wrote: > Here's a Clojure sieve that works fine up to at least 50 > million and is reasonably fast (though the same algorithm implemented > in Java is 10x faster even with the type hints and primitive > arithmetic in the Clojure; not sure why). > > (defn primes-to [n]

Re: The Genuine Sieve of Eratosthenes

2010-11-06 Thread Ken Wesson
On Sat, Nov 6, 2010 at 5:50 PM, Juha Arpiainen wrote: > On Nov 6, 7:57 pm, Ken Wesson wrote: >>           (filter identity (map #(if %1 %2) (drop 2 sieve) (iterate inc 2))) > > Returning a lazy seq doesn't seem to make much sense here, > especially since (map ... (drop 2 sieve)) holds onto the >

Re: Why isn't there a fold-right?

2010-11-06 Thread Michel Alexandre Salim
On Fri, 05 Nov 2010 19:03:20 -0700, Yang Dong wrote: > Maybe because Clojure has a vector, and conj conjoins new elements to > the end of the vector, so there's mere little use of fold-right. But, > fold-right is an abstraction tool, missing it in the core is kind of > pity. fold-right and reduce

Re: map versus pmap

2010-11-06 Thread André Thieme
Am 06.11.2010 12:57, schrieb philip schwarz: Hi all, be gentle please: I have only just started using clojure. I run the following on an Intel Core 2 Duo CPU (starting clojure with "java -Xms1000m -Xmx1000m -jar clojure.jar"): user=> (time (nth (doall (map inc (range 1000))) 999)) "El

Re: map versus pmap

2010-11-06 Thread Ken Wesson
On Sat, Nov 6, 2010 at 11:25 PM, André Thieme wrote: > Am 06.11.2010 12:57, schrieb philip schwarz: >> >> Hi all, >> >> be gentle please: I have only just started using clojure. >> >> I run the following on an Intel Core 2 Duo CPU (starting clojure with >> "java -Xms1000m -Xmx1000m -jar clojure.ja

Re: map versus pmap

2010-11-06 Thread André Thieme
Am 07.11.2010 04:29, schrieb Ken Wesson: On Sat, Nov 6, 2010 at 11:25 PM, André Thieme Try (time (count (map (fn [_] (Thread/sleep 1)) (range 1000 vs. (time (count (pmap (fn [_] (Thread/sleep 1)) (range 1000 On my system this is 1002 msecs vs. 39 msecs. Your system has TWENTY-FIVE COR

Re: The Genuine Sieve of Eratosthenes

2010-11-06 Thread Mark Engelberg
I like tinkering with prime sieve algorithms. Here's the fastest one I've come up with: (defn bit-sieve [n] (let [n (int n)] "Returns a vector of all primes from 2 to n (not including n)" (let [root (int (Math/round (Math/floor (Math/sqrt n] (loop [i (int 3) a (ja

Re: Why isn't there a fold-right?

2010-11-06 Thread Alan
Clojure's reduce is fold-left, not fold-right. My suspicion is that fold-right is not as amenable to laziness or to tail-call recursion as fold-right, but I don't have much experience in the area so I could be wrong. What I'm surprised we're missing is unfold, not foldr: unfold is easy to define l