Slime buffer ns is always user

2009-01-07 Thread Zak Wilson
I'm using the latest Slime, swank-clojure and Clojure, with a fix from Chousuke to start up the REPL properly. I have no problem setting the namespace in the REPL, but anything I eval directly from a file (i.e. with C-x C-e) gets evaluated in the user ns. The ns in the *inferior-lisp* buffer rema

Re: Slime buffer ns is always user

2009-01-07 Thread Zak Wilson
> First, compile the buffer with C-c > C-k. Then, evaluate new definitions in the same source file and they > will be evaluated in the correct namespace (regardless of what > namespace is active in the repl). That's what I expected, but it doesn't work; new definitions are evaluated in user. It s

Re: Slime buffer ns is always user

2009-01-08 Thread Zak Wilson
Thanks for your help with this problem, Bill. The function you provided causes slime-repl-set-package to suggest the correct namespace, which is convenient. It doesn't appear to have any effect on my problem though. --~--~-~--~~~---~--~~ You received this message b

Re: Slime buffer ns is always user

2009-01-08 Thread Zak Wilson
Everything is fully up to date. The test works. Setting the ns with (ns test) works, but if I use a more complex ns form like (ns test (:use clojure.xml)), it fails to set the ns. As a workaround, (in-ns test) after the ns definition seems to work. Unless there's some reason not to, I'll just do

Re: Slime buffer ns is always user

2009-01-09 Thread Zak Wilson
I tested your patch with several more complicated namespace forms and they all worked. Thanks for the fix! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@

Re: when performance matters

2009-01-12 Thread Zak Wilson
Lisps are not inherently slow. SBCL, Clojure and several Schemes are all much faster than most popular high-level languages (e.g. Python, Perl, Ruby...) while being at least as high-level. Optimized code in SBCL may only be marginally slower than C when type declarations are used properly. The co

Re: when performance matters

2009-01-12 Thread Zak Wilson
You're probably thinking of this: http://www.flownet.com/gat/papers/lisp-java.pdf There's also the (in)famous language benchmark site: http://shootout.alioth.debian.org/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Grou

Binding values in a list of symbols and evaluating as code

2009-01-23 Thread Zak Wilson
I'm trying my hand at genetic programming. (Full post about why and how, with code coming soon - I promise.) My current technique uses a genetic algorithm to generate a list of symbols, numbers and other lists of the same form. The head is the name of any of several functions. I'm trying to figure

Re: function that takes primitives?

2009-01-23 Thread Zak Wilson
If a speed boost is what you're going for, you can probably get one from type coercion and (if you're not worried about overflow) unchecked-math. As an example: (defn step [x0, y0, xn, yn] (let [dx0 (double x0) dy0 (double y0) dxn (double xn) dyn (double yn)

Re: Binding values in a list of symbols and evaluating as code

2009-01-23 Thread Zak Wilson
It does seem like a legitimate use for eval, at least at first glance. The biggest problem is that using eval this way is really slow when each rule is being tested on hundreds of inputs. Interesting alternative, Konrad. I can probably take advantage of the fact that all of the functions I'm call

Re: Binding values in a list of symbols and evaluating as code

2009-01-23 Thread Zak Wilson
Kevin, I don't know how I managed to not think of that, but it's exactly what I was looking for. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegro

Re: Binding values in a list of symbols and evaluating as code

2009-01-23 Thread Zak Wilson
And it's now working perfectly, producing a new generation every second. Now I actually have to tweak it to produce good results. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group,

Re: Binding values in a list of symbols and evaluating as code

2009-01-24 Thread Zak Wilson
So as it turns out, I was mistaken about it working. I had something that ran, but the results were nonsense. What I'm trying now looks like this: (defmacro rulefn [r] (let [er (eval r)] `(fn [devid# raveid#] (binding [device-id devid# rave-id raveid#] ~er

Re: Binding values in a list of symbols and evaluating as code

2009-01-24 Thread Zak Wilson
Correction: it's (let [x '(+ (* 1024 device-id) rave-id)) rfn (rulefn x)] ...) that fails with "Can't eval locals". --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, s

Re: Binding values in a list of symbols and evaluating as code

2009-01-24 Thread Zak Wilson
Thanks, Christophe. It works now, and it's fast. Unfortunately, now I've run in to Nathan's problem. After a few thousand generations, resulting in the creation of about half a million functions it was using over a gig of memory and died with an OutOfMemoryError. While let-eval is cool, using it

Re: Binding values in a list of symbols and evaluating as code

2009-01-25 Thread Zak Wilson
I think using eval is generally considered an antipattern. It's generally slow, and it's easy to make confusing code with it. Phlex - thanks for the suggestion. I may give that a try. Rich - thanks for the fix. I'm trying it now. It looks like it's not experiencing any permanent growth, though i

Re: Support for disabling forms (reader macro similar to CL's #-(and))

2009-01-25 Thread Zak Wilson
Clojure has that in the comment form: (comment (do (not (eval this --~--~-~--~~~---~--~~ 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 To unsubscribe from

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-02 Thread Zak Wilson
In your example, why are you using struct-map to create your structs instead of just using struct? (struct rect-struct ::rect [50 50] 100 190) produces the same struct, but is about three times faster than using struct-map. (time (dotimes [x 100] (struct-map rect-struct :tag ::rect

Re: Stupid Java questions

2009-02-03 Thread Zak Wilson
I had similar results when I compiled jsr166y myself. There's a jar in the group's files that is known to work. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clo

Re: Possible bug in preduce

2009-02-04 Thread Zak Wilson
I got a 50% speedup using psort instead of sort with a compute- intensive comparator and a 100 element sequence on a dual-core machine. That said, I found a faster way to do it: I separated the intensive calculations from the comparator - just returning a numeric value. I used pmap to get a seque

Re: Stupid Java questions

2009-02-04 Thread Zak Wilson
The namespace is correct on clojure.org/api, but there it doesn't mention that it has a dependency that isn't included with Clojure. Clojure has been evolving very quickly, and sometimes the website doesn't keep up. It might be nice if somebody could take charge of making sure the site is up to d

Having trouble getting full performance from a quad-core with trivial code

2010-05-30 Thread Zak Wilson
I'm running Clojure code on an early Mac Pro with OS X 10.5 and Java 1.6. It has two dual-core Xeon 5150s and 5GB of memory. I'm not getting the performance I expected despite top reporting 390% steady-state CPU use, so I wrote some trivial tests to see if I was actually getting the benefit of all

Re: Having trouble getting full performance from a quad-core with trivial code

2010-05-30 Thread Zak Wilson
Heinz - playing with the size of the number doesn't have much effect, except that when it becomes very small, parallelization overhead eventually exceeds compute time. Lee - Parallel GC slowed it down by 3 seconds on the four core benchmark. -- You received this message because you are subscribe

Re: Which GUI toolkit would you like to see wrapped in an idiomatic Clojure library?

2010-05-30 Thread Zak Wilson
Swing, mainly for deployment reasons. It's not hard to set the look and feel to the platform's look and feel. That's not perfect, but it's usually not bad either, though the GTK1-style file chooser is horrid. -- You received this message because you are subscribed to the Google Groups "Clojure"

Re: Multithreading didn't make my program as much faster as I expected...

2010-05-30 Thread Zak Wilson
The trouble with pmap is that it only works well with a slow function and a short sequence. In trivial tests, it seems to be best if the sequence has as many elements as you do cores. I've been experimenting with things that are like pmap, but work better in situations that I care about. I'm havin

Re: Multithreading didn't make my program as much faster as I expected...

2010-05-31 Thread Zak Wilson
Number of CPUs + 2 is what pmap uses, and I assumed the idea was to keep all the CPUs busy in the event that one finishes before the others. I wrote it before I did testing with npmap. Since reading your last post, I did a bit of testing with modified versions of zpmap and found that it isn't makin

Re: Having trouble getting full performance from a quad-core with trivial code

2010-06-02 Thread Zak Wilson
ka, I ran some more tests, including partition-work and your version of fac. I also ran some code from http://shootout.alioth.debian.org in both C and Java. On these 10-element sequences, partition-work seems to be a few tens of milliseconds slower than partition-all. It does look generally useful

Re: Having trouble getting full performance from a quad-core with trivial code

2010-06-03 Thread Zak Wilson
> It seems very weird that my version of fac changes performance > characteristics on my machine and not yours (OS/hardware dependent?). > Can you tell your hardware configuration, esp. number of physical and > logical cores? It's an early Mac Pro with two dual-core Xeon 5150s, 5gb RAM, Mac OS 10.

Re: Having trouble getting full performance from a quad-core with trivial code

2010-06-04 Thread Zak Wilson
I have some new data that suggests there are issues inherent to pmap and possibly other parallelism with Clojure on older Intel quad+ core machines. I added a noop loop to the benchmark. It looks like this: (defn noops [n] (when (> n 0) (recur (- n 1 Running those in parallel is also n

clojure.xml/parse cannot handle filenames containing #

2010-06-23 Thread Zak Wilson
(clojure.xml/parse "test1.log") works correctly, output omitted (clojure.xml/parse "test#1.log") Premature end of file. [Thrown class org.xml.sax.SAXParseException] $ mv test\#1.log test2.log (clojure.xml/parse "test2.log") works correctly, output omitted test#1.log is a copy of test1.l

Re: clojure.xml/parse cannot handle filenames containing #

2010-06-24 Thread Zak Wilson
On Jun 23, 11:37 pm, Stuart Halloway wrote: > I can certainly see why this would be confusing! Is there a way to make it > better without violating the expectations of someone who knows the Java API > and expects strings to be treated as URIs? Perhaps throwing an appropriately informative excep

Self-joins in ClojureQL

2011-07-21 Thread Zak Wilson
SQL allows for self-joins of the form SELECT e.first_name AS 'Employee FN', e.last_name AS 'Employee LN', m.first_name AS 'Manager FN', m.last_name AS 'Manager LN' FROM employees AS e LEFT OUTER JOIN employees AS m ON e.manager =m.id I can't determine a syntax for the same in ClojureQL. The limit

Re: Self-joins in ClojureQL

2011-08-12 Thread Zak Wilson
Update: CQL does in fact support self-joins. An example of the correct syntax is here: http://pastie.org/2356343 -- 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 mem

Sobel edge detection library

2012-09-06 Thread Zak Wilson
I found a performance-optimized Sobel edge detection library on pastebin here: http://pastebin.com/auqEvM7J There's no indication of who owns it or license terms. I'd like to use it. Does someone here know whose this is? -- You received this message because you are subscribed to the Google Gro

Re: help a journalist: why Clojure?

2008-10-12 Thread Zak Wilson
I think the big ones are that it makes it easy to write concurrent programs that run fast and don't blow up, and that it integrates very nicely with Java, which the PHB probably already knows and loves. Intel already has 8-core chips on its short-term roadmap, and it won't be long before ability t

Re: packaging App (cross-platform) without scripts, only jar

2008-10-18 Thread Zak Wilson
When I try this, I get the following if I try to run the jar: Exception in thread "main" java.lang.NoSuchMethodError: clojure.lang.RT.loadResourceScript(Ljava/lang/Class;Ljava/lang/ String;Z)V This is using the latest stable Clojure and a single source file. --~--~-~--~~~

Re: Changes for AOT compilation

2008-11-14 Thread Zak Wilson
It's currently possible to compile the files and rebuild the jar. It does result in a faster startup time. There doesn't seem to be a way to generate precompiled class files with main methods at this point. Is there any reason such functionality can't be added? Right now, if I want an executable