Re: swank-clojure bug fix

2009-07-07 Thread George Jahad
Hi Phil: I guess it's swank night tonight! The newer versions of slime.el changed the name of the frame-source- location-for-emacs slimefn to frame-source-location, which breaks stack trace source file viewing. This patch fixes that and adds support for finding java files in addition to the clo

Re: Penumbra, a new set of OpenGL bindings

2009-07-07 Thread philip.hazel...@gmail.com
On Jul 1, 8:16 am, ztellman wrote: > Most of the OpenGL code I've seen has been a fairly literal > translation of the corresponding Java, so as a way of getting my feet > wet in Clojure I've written something that tries to be a little more > idiomatic.  It can be found athttp://github.com/ztellma

logging

2009-07-07 Thread Timothy Pratley
I've been playing around with java.util.logging - comments welcome: http://github.com/timothypratley/strive/blob/5a6d406750f3531bb1b406e528e95a8f8bdd6e75/clj/timothypratley/logging.clj http://github.com/timothypratley/strive/blob/5a6d406750f3531bb1b406e528e95a8f8bdd6e75/clj/timothypratley/test-log

Re: loneclojurian at ICFP programming contest

2009-07-07 Thread Jon Harrop
On Tuesday 07 July 2009 02:08:57 Bradbev wrote: > On Jul 6, 4:30 pm, fft1976 wrote: > > On Jul 5, 11:42 pm, Bradbev wrote: > > > more to modern x86 chips.  After you have the best algorithm for the > > > job, you very quickly find that going fast is entirely bound by memory > > > speed (actually

Re: loneclojurian at ICFP programming contest

2009-07-07 Thread Jon Harrop
On Sunday 05 July 2009 23:19:31 fft1976 wrote: > On Jul 5, 10:53 am, igorrumiha wrote: > > I think it's safe to say that once again it's proved that Clojure > > easily matches the Java level of performance. > > I think one shouldn't generalize from one [unverified] example. > > Personally, I'll w

Help with example from "A Field Guide to Genetic Programming"

2009-07-07 Thread Robert Campbell
I'm trying to write the first basic GP example in this free book: http://www.lulu.com/items/volume_63/2167000/2167025/2/print/book.pdf I've gotten a lot of the suppor methods working correctly (like fitness) but I'm having problem convering the pseudocode on page 14 for generating random expressi

Re: Mysterious ClassFormatError after simple code change.

2009-07-07 Thread John Harrop
On Mon, Jul 6, 2009 at 7:50 PM, Richard Newman wrote: > > > Since it's not apparently a simple bug in my function above, but > > something about a combination of that version of that function and > > some other part of my code, I can't think of a way to track the > > cause down short of the very

Re: Mysterious ClassFormatError after simple code change.

2009-07-07 Thread John Harrop
On Mon, Jul 6, 2009 at 11:25 PM, John Harrop wrote: > On Mon, Jul 6, 2009 at 7:50 PM, Richard Newman wrote: > >> Have you tried simpler things like splitting the offending function >> into a separate namespace, or seeing what happens with (or without) >> AOT compilation? > > > I didn't get aroun

Re: Is this unquote dangerous?

2009-07-07 Thread Mike
On Jul 6, 4:00 pm, Chouser wrote: > On Mon, Jul 6, 2009 at 3:47 PM, Sean Devlin wrote: > > > I think your unquote is okay.  ClojureQL does something similar. > > > However, my gut says this should be in a doseq, not a for statement. > > Could be totally wrong, tough. > > I think the OP is trying

Re: Is this unquote dangerous?

2009-07-07 Thread Mike
(not sure where my reply to Chouser et al. went, but basically I said that I was writing a macro and I might be overdoing it. I was right!) Here's what I was trying to accomplish, but in functions, not macros: (defn slice "Returns a lazy sequence composed of every nth item of coll, starti

Questions / guidelines for adopting Clojure

2009-07-07 Thread Roman Roelofsen
Hi all! I've been playing around with Clojure in the last couple of days. Very interesting! However, I have never used a non-OO, lispy, pure functional language before and several questions popped up while digging deeper into the Clojure world. I hope you don't mind if I post them together in one

Re: Mysterious ClassFormatError after simple code change.

2009-07-07 Thread Stephen C. Gilardi
On Jul 7, 2009, at 5:51 AM, John Harrop wrote: Somehow, code that is treated as valid when compiled a function at a time is treated as invalid when compiled all at once. That pretty much proves it's an implementation bug, since the same code can't both be buggy and be fine at the same time

Re: procedural docstring attachment

2009-07-07 Thread philip.hazel...@gmail.com
On Jul 7, 5:11 am, Timothy Pratley wrote: > I have a function that relies on a keyword being supplied. The keyword > is used to find something in a static map. I want to put in the doc- > string: > (str "blah blah blah, arg1 must be one of " (keys map)) > Suggestions? You can put the docstring d

Re: Questions / guidelines for adopting Clojure

2009-07-07 Thread Richard Lyman
On Tue, Jul 7, 2009 at 6:08 AM, Roman Roelofsen < roman.roelof...@googlemail.com> wrote: > > Hi all! Hello! Welcome to the group. * Syntax * > > I never used a LISP-like language before and I can't read the clojure > code as fluent as code from different languages. Take for example this > sca

Re: Questions / guidelines for adopting Clojure

2009-07-07 Thread Sean Devlin
Let me take a stab at you parametrization question > * Parametrization of "function groups" * > > Lets say I have a bunch of functions that provide database operations > (read, write, delete, ...). They all share information about the > database the operate on. In an OO language, I would define t

Re: Questions / guidelines for adopting Clojure

2009-07-07 Thread Chouser
On Tue, Jul 7, 2009 at 8:08 AM, Roman Roelofsen wrote: > > (0 until 100) map (_ * 2) filter (_ % 3 == 0) > > I can easily read this line from left to right (just like english) and > instantly see whats going on. By contrast, I have to read the clojure > version a couple of times to understand it:

Re: Questions / guidelines for adopting Clojure

2009-07-07 Thread Laurent PETIT
Hi, 2009/7/7 Chouser : > > On Tue, Jul 7, 2009 at 8:08 AM, Roman > Roelofsen wrote: >> >> (0 until 100) map (_ * 2) filter (_ % 3 == 0) >> >> I can easily read this line from left to right (just like english) and >> instantly see whats going on. By contrast, I have to read the clojure >> version

Re: Questions / guidelines for adopting Clojure

2009-07-07 Thread Shawn Hoover
On Tue, Jul 7, 2009 at 11:47 AM, Chouser wrote: > > On Tue, Jul 7, 2009 at 8:08 AM, Roman > Roelofsen wrote: > > * Real-world macros * > > > > Correct me if I am wrong, but it seems that people often use macros > > for lazy evaluation of parameters. In Scala, it is quite easy to > > accomplish th

Re: I/O in Nailgun

2009-07-07 Thread Phil Hagelberg
George Jahad writes: > I think it is just an input stream encoding problem. I think if you > change this line: > (copy (-> context .in) out) > > to this: > (copy (-> context .in InputStreamReader.) out) > > it will work. Thanks, but that gives the same result. =\ Contributing to the p

Re: I/O in Nailgun

2009-07-07 Thread George Jahad
Hmmm. I'm seeing different behaviour. When I run your code untouched, I never get the "unchunked" error. Instead, I see a bunch of garbage printed after the echoed "hello" like so: echo "hello" | ng nailgun.Example hello ^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^

Re: swank-clojure bug fix

2009-07-07 Thread George Jahad
Here's a better version that handles finding inner classes in Java source: diff --git a/swank/commands/basic.clj b/swank/commands/basic.clj index d668d2d..32c01b7 100644 --- a/swank/commands/basic.clj +++ b/swank/commands/basic.clj @@ -330,8 +330,14 @@ that symbols accessible in the current names

Re: Questions / guidelines for adopting Clojure

2009-07-07 Thread Jarkko Oranen
Shawn Hoover wrote: > For example, Java doesn't have language support like C#'s using statement > for executing some block of code and deterministically cleaning up an object > at the end. You could implement that as a function (in many languages) and > call it like this: > (defn do-and-close [o

Re: loneclojurian at ICFP programming contest

2009-07-07 Thread Bradbev
On Jul 7, 6:23 am, Jon Harrop wrote: > On Tuesday 07 July 2009 02:08:57 Bradbev wrote: > > > On Jul 6, 4:30 pm, fft1976 wrote: > > > On Jul 5, 11:42 pm, Bradbev wrote: > > > > more to modern x86 chips.  After you have the best algorithm for the > > > > job, you very quickly find that going fast

Re: tests involving threads

2009-07-07 Thread Stuart Sierra
On Jul 6, 5:52 am, Jarkko Oranen wrote: > My guess is that having 'is inside a future messes up the per- > thread bindings that clojure.test uses. Yes, this doesn't work because the future fn is executed in a new thread, that does not inherit the dynamic context in which the future was created.

Re: Questions / guidelines for adopting Clojure

2009-07-07 Thread Roman Roelofsen
Thanks a lot to everbody for the great responses! They certainly helped a lot! Cheers, Roman --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegrou

Re: procedural docstring attachment

2009-07-07 Thread Stuart Sierra
On Jul 7, 12:11 am, Timothy Pratley wrote: > I have a function that relies on a keyword being supplied. The keyword > is used to find something in a static map. I want to put in the doc- > string: > (str "blah blah blah, arg1 must be one of " (keys map)) > Suggestions? You can procedurally alter

Re: Calling static methods on a variable holding a class

2009-07-07 Thread Stuart Sierra
On Jul 6, 6:59 pm, Nicolas Buduroi wrote: > Hi, I needed to call a static method on a class stored in a var > yesterday and found that it was a little bit trickier than I initially > thought. My first impression is that this is probably not the best way to go about this. Java classes are not li

Re: Calling static methods on a variable holding a class

2009-07-07 Thread Stephen C. Gilardi
On Jul 7, 2009, at 3:29 PM, Stuart Sierra wrote: If you really don't know what the class is (for example, you get a Class object returned by some library function) then you can use the Java Reflection API to call the static method. See http://java.sun.com/docs/books/tutorial/reflect/ If you

Re: I/O in Nailgun

2009-07-07 Thread Phil Hagelberg
George Jahad writes: > Hmmm. I'm seeing different behaviour. When I run your code > untouched, I never get the "unchunked" error. Instead, I see a bunch > of garbage printed after the echoed "hello" like so: > > echo "hello" | ng nailgun.Example > > hello > ^...@^@^...@^@^...@^@^...@^@^...@^@

Re: loneclojurian at ICFP programming contest

2009-07-07 Thread fft1976
On Jul 6, 6:08 pm, Bradbev wrote: > On Jul 6, 4:30 pm, fft1976 wrote:> On Jul 5, 11:42 pm, > Bradbev wrote: > > > > more to modern x86 chips.  After you have the best algorithm for the > > > job, you very quickly find that going fast is entirely bound by memory > > > speed (actually latency) -

Re: swank-clojure bug fix

2009-07-07 Thread Phil Hagelberg
Sudish Joseph writes: > The patch below fixes the computation of swank-version, which broke when > (clojure-version) was defined to returned a string. The bug only > manifests itself if swank-clojure-compile-p is set to t. Thanks! Applied. -Phil --~--~-~--~~~---~-

Re: swank-clojure bug fix

2009-07-07 Thread Phil Hagelberg
George Jahad writes: > I guess it's swank night tonight! > > The newer versions of slime.el changed the name of the frame-source- > location-for-emacs slimefn to frame-source-location, which breaks > stack trace source file viewing. > > This patch fixes that and adds support for finding java fil

Re: Is this unquote dangerous?

2009-07-07 Thread Jonathan Smith
On Jul 6, 6:00 pm, Chouser wrote: > On Mon, Jul 6, 2009 at 4:18 PM, Meikel Brandmeyer wrote: > > Hi, > > > Am 06.07.2009 um 22:00 schrieb Chouser: > > >> Or if you really do need a list: > > >>  (for [x [1 2 3]] (cons 'some-symbol (list x))) > > > o.O > > > *cough*(list 'some-symbol x)*cough* ;

Re: Mysterious ClassFormatError after simple code change.

2009-07-07 Thread John Harrop
On Tue, Jul 7, 2009 at 9:30 AM, Stephen C. Gilardi wrote: > > On Jul 7, 2009, at 5:51 AM, John Harrop wrote: > > Somehow, code that is treated as valid when compiled a function at a time >> is treated as invalid when compiled all at once. That pretty much proves >> it's an implementation bug, si

Passing primitives from an inner loop to an outer loop efficiently

2009-07-07 Thread John Harrop
Problem: Passing primitives from an inner loop to an outer loop efficiently. Here is what I've found. The fastest method of result batching, amazingly, is to pass out a list and: (let [foo (loop ... ) x (double (first foo)) r1 (rest foo) y (double (first r1)) r2 (rest r1) z (double (first r2))] .

Implementing ISeq

2009-07-07 Thread Garth Sheldon-Coulson
Hello Clojurians--- I'm about to begin writing a Clojure wrapper for a Java data structure that's amenable to seq-ability. 1) I'd like to implement the ISeq interface. Could someone point me to some up-to-date documentation on what I need to implement? Sorry if this is covered somewhere obvious..

Re: Implementing ISeq

2009-07-07 Thread Rich Hickey
On Jul 7, 5:31 pm, Garth Sheldon-Coulson wrote: > Hello Clojurians--- > > I'm about to begin writing a Clojure wrapper for a Java data structure > that's amenable to seq-ability. > > 1) I'd like to implement the ISeq interface. Could someone point me to some > up-to-date documentation on what I

Re: Implementing ISeq

2009-07-07 Thread Garth Sheldon-Coulson
Thanks Rich, I'll take a look. By the way, Clojure is a beautiful and enriching thing. Keep up the great work. On Tue, Jul 7, 2009 at 6:21 PM, Rich Hickey wrote: > > > > On Jul 7, 5:31 pm, Garth Sheldon-Coulson wrote: > > Hello Clojurians--- > > > > I'm about to begin writing a Clojure wrappe

Re: procedural docstring attachment + argument descriptions

2009-07-07 Thread Timothy Pratley
Perfect, thanks Stuart! That works great :) I put it in a convenience macro: ; Stuart Sierra (defmacro defn-with-doc "Like defn but accepts a procedurally generated string." [fun doc-str & body] `(let [f# (defn ~fun ~...@body)] (alter-meta! (var ~fun) assoc :doc ~doc-str) f#)) Got

Re: Help with example from "A Field Guide to Genetic Programming"

2009-07-07 Thread Michel Salim
On Jul 7, 8:18 am, Robert Campbell wrote: > First, how can I print out the definition of a function in clojure? > For example, if I do (defn add [x y] (+ x y)) how can inspect this > definition, like (show-def add) -> (defn add [x y] (+ x y)). This > would help a lot in debugging the random pro

Re: Help with example from "A Field Guide to Genetic Programming"

2009-07-07 Thread Timothy Pratley
It seems to me you want: user=> (list + 1 2) (# 1 2) As opposed to: user=> '(+ 1 2) (+ 1 2) Regarding examining a function, contrib has some helpers written by Chris user=> (use 'clojure.contrib.repl-utils) (source func) (show func) In your case source wont be useful as the function is generated

Dependency management

2009-07-07 Thread Phil Hagelberg
I've been noodling on the problem of dependency management for a while now. It's definitely a pain point for projects with more than a couple dependencies. Currently our approach has been to use maven, but that involves a fair amount of arcane knowledge as well as writing a bunch of XML, which is

Re: Help with example from "A Field Guide to Genetic Programming"

2009-07-07 Thread kyle smith
> I am guessing I need to start reading and using macros at this point? I also wrote something to do symbolic regression. I used plain functions to manipulate quoted trees, and one macro to wrap the expression in a fn and eval. --~--~-~--~~~---~--~~ You received t

Re: Dependency management

2009-07-07 Thread Wilson MacGyver
interesting idea! It reminds me a bit of the Grape system in groovy. Groovy uses Ivy for this. and you can grab the needed library either via annotation like @Grab(group='com.jidesoft', module='jide-oss', version='[2.2.1,2.3.0)') or method call like Grape.grab(group:'org.jidesoft', module:'jid

Re: Dependency management

2009-07-07 Thread ataggart
Phil, it might be worthwhile to look at Ivy (http://ant.apache.org/ ivy). It has real good interop with ant and can easily pull from a maven repo and read pom files. On Jul 7, 9:28 pm, Phil Hagelberg wrote: > I've been noodling on the problem of dependency management for a while > now. It's def

Does anyone need any clojure work done?

2009-07-07 Thread ataggart
After having spent the last decade doing server-side java, lots of infrastructure level code which I enjoy), and going blind on xml, I'd really like to get more into clojure. I've been playing with it off and on for about a year now, reading whatever FP-related material I can get my hands on, but

Re: Does anyone need any clojure work done?

2009-07-07 Thread fft1976
On Jul 7, 10:18 pm, ataggart wrote: > After having spent the last decade doing server-side java, lots of > infrastructure level code which I enjoy), and going blind on xml, I'd > really like to get more into clojure. > > I've been playing with it off and on for about a year now, reading > whateve

Re: Passing primitives from an inner loop to an outer loop efficiently

2009-07-07 Thread Jonathan Smith
On Jul 7, 5:10 pm, John Harrop wrote: > Problem: Passing primitives from an inner loop to an outer loop efficiently. > Here is what I've found. > > The fastest method of result batching, amazingly, is to pass out a list and: > > (let [foo (loop ... ) > x (double (first foo)) > r1 (rest foo) > y