Re: Improving the documentation

2009-08-18 Thread Seth
I'm also very interested in a more public wiki for Clojure and would help maintain it. Seth On Aug 17, 11:39 am, Ollie Saunders oliver.saund...@gmail.com wrote: OK, so given all the support this idea got and the amount of material we already have. Who should I talk to about getting access to

clojure article in french magazine

2009-08-18 Thread rb
Hey, I was looking computer magazines and I had the good surprise to see clojure mentioned on the cover of Programmez, a french magazine. The article is titled 'Cloure, a Lisp for the JVM, and seems positive (eg, it says Clojure (...) est génial meaning Clojure is great):

Re: Improving the documentation

2009-08-18 Thread John Newman
I believe http://en.wikibooks.org/wiki/Clojure_Programming is the intended central location for contributing documentation. I've heard complaints about it's openness though. Is it a pain to try to contribute there? On Tue, Aug 18, 2009 at 4:52 AM, Seth seth.schroe...@gmail.com wrote: I'm

Re: Improving the documentation

2009-08-18 Thread Harold Ancell
At 09:18 AM 8/18/2009, John Newman wrote: I believe http://en.wikibooks.org/wiki/Clojure_Programminghttp://en.wikibooks.org/wiki/Clojure_Programming is the intended central location for contributing documentation. One issue with that site is its limited scope, Wikibooks is a Wikimedia

Re: Improving the documentation

2009-08-18 Thread Meikel Brandmeyer
Hi, On Aug 18, 4:50 pm, Harold Ancell h...@ancell-ent.com wrote: When I stumbled on the clojure-1.0.0.jar problem I updated the appropriate page there in a few minutes including registering an account, which isn't required: The problem with the wikibook site is, that they came up with some

Re: Pure-functional N-body benchmark implementation

2009-08-18 Thread Brad Beveridge
On 2009-08-17, at 8:58 PM, FFT fft1...@gmail.com wrote: On Mon, Aug 17, 2009 at 9:25 AM, Bradbevbrad.beveri...@gmail.com wrote: On Aug 17, 1:32 am, Nicolas Oury nicolas.o...@gmail.com wrote: I was referring to the rules of the benchmark game. When you benchmark language, using

Re: Idiom for array slicing

2009-08-18 Thread John Harrop
On Mon, Aug 17, 2009 at 11:35 PM, Mark Triggs mark.h.tri...@gmail.comwrote: Thanks all. So combining a few suggested ideas: (defn slice Return the items in coll at index positions keys. (slice [0 4 6] \abcdefg\) = (\\a \\e \\g) [keys coll] (let [max-idx (apply max keys)

Re: Idiom for array slicing

2009-08-18 Thread CuppoJava
The most straight-forward answer I would have given is also: (defn slice [indices coll] (map #(nth coll %) indices)) Is there some disadvantage with this approach that I'm not seeing? -Patrick --~--~-~--~~~---~--~~ You received this message because you are

Re: Improving the documentation

2009-08-18 Thread Harold Ancell
At 10:20 AM 8/18/2009, Meikel Brandmeyer wrote: Hi, Greetings and salutations. On Aug 18, 4:50 pm, Harold Ancell h...@ancell-ent.com wrote: When I stumbled on the clojure-1.0.0.jar problem I updated the appropriate page there in a few minutes including registering an account, which isn't

Re: Idiom for array slicing

2009-08-18 Thread Andrew Baine
If coll has O(n) access and we impose the restriction that indices is increasing (or sort it up front), we can do better than this by only doing one pass through coll. On Aug 18, 10:46 am, CuppoJava patrickli_2...@hotmail.com wrote: The most straight-forward answer I would have given is also:

Re: Memory leak in vec (and maybe persistent!)?

2009-08-18 Thread Andy Fingerhut
On Aug 17, 3:51 am, Christophe Grand christo...@cgrand.net wrote: On Sat, Aug 15, 2009 at 4:23 PM, Andy Fingerhut andy_finger...@alum.wustl.edu wrote: Not to say this ought to be done, but would it be possible to have no 'edit' field *at all* for persistent data structures (not even a

Re: Pure-functional N-body benchmark implementation

2009-08-18 Thread FFT
On Mon, Aug 17, 2009 at 9:25 AM, Bradbevbrad.beveri...@gmail.com wrote: On Aug 17, 1:32 am, Nicolas Oury nicolas.o...@gmail.com wrote: I was referring to the rules of the benchmark game. When you benchmark language, using another language is not fair. If you were to do your own program, of

Re: JDBC-ODBC Bridge

2009-08-18 Thread Sean Devlin
I believe your result set is closed by the time you execute your statement. If you use (class (sel)) you will notice it is a resultset. Start by executed your desired s-exp inside the macro at the REPL. Then I would use a let/map combination to turn it into a fn. Hope this helps, Sean On Aug

JDBC-ODBC Bridge

2009-08-18 Thread shane
I am trying to use the JDBC-ODBC with the following code: (use '[clojure.contrib.sql]) (def db {:classname sun.jdbc.odbc.JdbcOdbcDriver :subprotocol odbc :subname jdbc:odbc:D2D1 :username ERASUSR :password REPORTS}) (defn sel [] (with-connection db

Re: JDBC-ODBC Bridge

2009-08-18 Thread shane
entering (with-connection db) on the repl yields the same error, making me think it's still something wrong with how I am going about connection to the dsn. On Aug 18, 3:07 pm, Sean Devlin francoisdev...@gmail.com wrote: I believe your result set is closed by the time you execute your

Re: Pure-functional N-body benchmark implementation

2009-08-18 Thread Aaron Cohen
On Tue, Aug 18, 2009 at 11:28 AM, Brad Beveridgebrad.beveri...@gmail.com wrote: On 2009-08-17, at 8:58 PM, FFT fft1...@gmail.com wrote: On Mon, Aug 17, 2009 at 9:25 AM, Bradbevbrad.beveri...@gmail.com wrote: Ah, that makes more sense re the cheating then.  Your insight for array range

Re: JDBC-ODBC Bridge

2009-08-18 Thread Michael Wood
2009/8/18 shane semmon...@gmail.com: I am trying to use the JDBC-ODBC with the following code: (use '[clojure.contrib.sql]) (def db {:classname sun.jdbc.odbc.JdbcOdbcDriver         :subprotocol odbc         :subname jdbc:odbc:D2D1 [...] I use this dsn (D2P1) in a number of other

Inheriting Clojure special variables in child threads

2009-08-18 Thread Constantine Vetoshev
Clojure's binding form only establishes vars with dynamic extent limited to the current thread. This makes a lot of sense. However, I have a use case where I'd like it to establish the dynamic extent in a way which affects the current thread and all threads started within the current thread.

Re: Pure-functional N-body benchmark implementation

2009-08-18 Thread Aaron Cohen
On Tue, Aug 18, 2009 at 3:32 PM, Aaron Cohenremled...@gmail.com wrote: On Tue, Aug 18, 2009 at 11:28 AM, Brad Beveridgebrad.beveri...@gmail.com wrote: On 2009-08-17, at 8:58 PM, FFT fft1...@gmail.com wrote: On Mon, Aug 17, 2009 at 9:25 AM, Bradbevbrad.beveri...@gmail.com wrote: Ah, that

Re: Idiom for array slicing

2009-08-18 Thread Mark Triggs
Yep, this was my thinking too. Maybe it doesn't matter, but I'm always a little reluctant to make those sort of compromises when writing general-purpose utility functions. Mark Andrew Baine andrew.ba...@gmail.com writes: If coll has O(n) access and we impose the restriction that indices is

Re: JDBC-ODBC Bridge

2009-08-18 Thread Meikel Brandmeyer
Hi, Am 18.08.2009 um 20:28 schrieb shane: (defn sel [] (with-connection db (with-query-results rs [SELECT * FROM DB2PROD.ED0CDT_CYCLE_DATES] (map :CYCLE_IND rs Michael's suggestion about the typo is plausible. Should that fix the connection problem, you will almost surely want

Dan Weinreb Google Tech Talk

2009-08-18 Thread Tom Emerson
http://www.youtube.com/watch?v=xquJvmHF3S8 Dan Weinreb gave a great talk at Google entitled Lisp for High-Performance Transaction Processing on Monday, where he talks about the use of Common Lisp at ITA Software. The last 10 - 15 minutes of the talk he discusses the future of Lisp: Common Lisp,

Re: Inheriting Clojure special variables in child threads

2009-08-18 Thread Meikel Brandmeyer
Hi, Am 18.08.2009 um 21:40 schrieb Constantine Vetoshev: (binding* [*x* 3] (start-jetty :port 8001 :my-servlet servlet-implemented-in-clojure)) There are two Assembla tickets, which go into that direction: http://www.assembla.com/spaces/clojure/tickets/169-thread-local-bindings-interface

Daniel Weinreb on Clojure

2009-08-18 Thread Rock
Daniel Weinreb (of Common Lisp fame) talks about Clojure in the second part of this Google Tech Talk: http://www.youtube.com/watch?v=xquJvmHF3S8 Rock --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group.

Re: Idiom for array slicing

2009-08-18 Thread CuppoJava
Ah... and the function that I called split should really be called slice. And lazy_reduce should really be called lazy-reduce i keep on forgetting to use hypens instead of underscores. -Patrick --~--~-~--~~~---~--~~ You received this message because you are

Re: Infinite Sequence of Coin Flips

2009-08-18 Thread CuppoJava
repeatedly is the function that you're looking for in the first question. And = should work I think: (= [1 2 3] [1 2 3]) returns true. Hope that helps -Patrick --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: Idiom for array slicing

2009-08-18 Thread CuppoJava
I see. Thanks for explaining. If speed is an issue, and if you can assume that indices are properly sorted in ascending order, I believe this looks like a lazy-reduce problem. Clojure has no lazy-reduce (or does it?) so I've written my own: (defn lazy_reduce [f val coll] (lazy-seq (if

Infinite Sequence of Coin Flips

2009-08-18 Thread tmountain
Hi, I was wondering if there's a more idiomatic way to do the following: (defn flip-coin [] (int (rand 2))) (let [coin-flips (for [x (repeat true)] (flip-coin))] Basically I want to generate an infinite lazy sequence based on the output of a given function with zero or more arguments.

Re: Infinite Sequence of Coin Flips

2009-08-18 Thread Tayssir John Gabbour
On Aug 19, 1:08 am, tmountain tinymount...@gmail.com wrote: Hi, I was wondering if there's a more idiomatic way to do the following: (defn flip-coin [] (int (rand 2))) To add to CuppoJava's advice, (rand-int 2) is a synonym of (int (rand 2)). All the best, Tayssir

Re: Improving the documentation

2009-08-18 Thread Ollie Saunders
Status: I've applied for membership on the dev list, citing this thread so this can be discussed with the major contributors. 2009/8/18 Harold Ancell h...@ancell-ent.com: At 10:20 AM 8/18/2009, Meikel Brandmeyer wrote: Hi, Greetings and salutations. On Aug 18, 4:50 pm, Harold Ancell

Re: Idiom for array slicing

2009-08-18 Thread Mark Triggs
That works nicely, even for infinite sequences, but appears to hang on to the head: user= (split [2000 2001] (repeatedly #(int-array 102400))) java.lang.OutOfMemoryError: Java heap space The map/nth variant has this same problem, unfortunately. My original version works around these issues

Re: Infinite Sequence of Coin Flips

2009-08-18 Thread tmountain
And = should work I think: (= [1 2 3] [1 2 3]) returns true. Oh man... now I feel stupid. Thanks for the help! Travis On Aug 18, 7:17 pm, CuppoJava patrickli_2...@hotmail.com wrote: repeatedly is the function that you're looking for in the first question. And = should work I think:  (=

Quirk with filter

2009-08-18 Thread Sean Devlin
Hello Clojurians, I commonly use a set in my filtering operations, like the example below. user= (filter #{\a \e \i \o \u} The quick brown fox jumped over the lazy dog) (\e \u \i \o \o \u \e \o \e \e \a \o) Today I found myself using the following code user= (filter #{false} [true false false

Re: Idiom for array slicing

2009-08-18 Thread Rock
What if someone wanted to slice a multi-dimensional vector (vector of vectors of vectors ...) or even just an ordinary matrix (vector of vectors). Is there a way to extend this beyond an ordinary one-dimensional vector? Rock On Aug 18, 3:17 am, Mark Triggs mark.h.tri...@gmail.com wrote: Hi

Re: Quirk with filter

2009-08-18 Thread J. McConnell
On Tue, Aug 18, 2009 at 7:37 PM, Sean Devlin francoisdev...@gmail.comwrote: user= (filter #{false} [true false false true]) () Obviously, this is not what I intended. The best I could do was the following user= (filter (comp not nil? #{false}) [true false false true]) (false false)

Re: Quirk with filter

2009-08-18 Thread Sean Devlin
The set is being passed in as a parameter, so that will be a problem. Still, I'll be able to re-write my routine with false. Thanks! On Aug 18, 8:18 pm, J. McConnell jdo...@gmail.com wrote: On Tue, Aug 18, 2009 at 7:37 PM, Sean Devlin francoisdev...@gmail.comwrote: user= (filter #{false}

Re: Idiom for array slicing

2009-08-18 Thread CuppoJava
Hmm... I suppose so. That would depend on the semantics that you want. How exactly would a multi-dimensional slice work? Right now, if you use slice on a multi-dimensional vector, it will return a list of vectors for you, which you can further slice to your heart's content. Perhaps that's good

Re: Idiom for array slicing

2009-08-18 Thread CuppoJava
Sigh... I never did understand that head hanging part. I need to go back and read Rich's post in more detail. Does anyone know if there's a compounded collection of all of Rich's webpages which aren't officially online yet? eg. clojure.org/lazy, clojure.org/streams, etc... -Patrick

Re: Quirk with filter

2009-08-18 Thread Mark Reid
Hi, The problem here is that filter is expecting a predicate and you are passing a set. When used as a function like so user= (#{1 2 3} 2) 2 user= (#{1 2 3} 5) nil the set returns the argument if it is in the set and nil otherwise. The problem you are observing is because the

Using the var special-form

2009-08-18 Thread samppi
Why doesn't this work? Clojure 1.0.0- user= (declare aaa) #'user/aaa user= (var (symbol aaa)) java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Symbol (NO_SOURCE_FILE:2) user= (var 'aaa) java.lang.ClassCastException: clojure.lang.Cons cannot be cast to

Re: Quirk with filter

2009-08-18 Thread CuppoJava
Hi Sean, I think your solution with (comp not nil? ... ) is very clean already. But in case you don't like that, here's another way of writing it: (filter #(contains? #{false} %) [false true false true]) returns (false false) It probably gets compiled to almost the same thing under the hood.

Re: Using the var special-form

2009-08-18 Thread Timothy Pratley
user= (resolve (symbol aaa)) #'user/aaa might be what you want? On Aug 19, 1:11 pm, samppi rbysam...@gmail.com wrote: Why doesn't this work? Clojure 1.0.0- user= (declare aaa) #'user/aaa user= (var (symbol aaa)) java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast