1.2 RC2 exception line numbering bug.

2010-08-07 Thread Jason Wolfe
This bug still seems to be present in 1.2 RC2, and is more general than I previously thought: jawo...@[~/Projects/testproj]: cat > src/test.clj bla jawo...@[~/Projects/testproj]: cat > src/test2.clj (bla) jawo...@[~/Projects/testproj]: lein repl user=> (require 'test) java.lang.Exception: Unabl

Re: slow raw io

2010-08-07 Thread cageface
Any chance of getting this in before 1.2? On Jun 25, 7:43 am, cageface wrote: > Thanks Stuart & Peter for following up on this. Now I can get back to > plowing through this mountain of ldiff data with Clojure! -- You received this message because you are subscribed to the Google Groups "Clojure

Re: Slightly Off Topic: .NET books

2010-08-07 Thread Dan Moniz
On Fri, 06 Aug 2010 17:49 -0400, "Mark Rathwell" wrote: > +1 for: > > _The C# Programming Language, 3rd Edition_ by Anders Hejlsberg, Mads > Torgersen, Scott Wiltamuth, and Peter Golde > > Pretty decent book, but I'm not sure if it's been updated since 2.0 (a > lot of cool stuff came in 3.0 and 4

maven compilation of a clojure project hangs due to still running thread pools

2010-08-07 Thread Christian Schuhegger
Hi all, I just had a lengthy debugging session behind me to find out why maven hangs when trying to execute the "clojure:compile" target of the clojure-maven-plugin. I found out that the problem does not lie in maven but in clojure (or in my code if you want to see it that way). My code executes

take-while2?

2010-08-07 Thread bonega
Hi. Are there some function like this: (defn take-while2 [f pred coll] ... usage: (take-while2 + #(< % 100) (iterate inc 0)) returns: (0 1 2 3 4 5 6 7 8 9 10 11 12 13) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send emai

Re: slow raw io

2010-08-07 Thread Stuart Halloway
No. We want to collect more information and do more comparisons before moving away from the recommended Java buffering. Stu > Any chance of getting this in before 1.2? > > On Jun 25, 7:43 am, cageface wrote: >> Thanks Stuart & Peter for following up on this. Now I can get back to >> plowing t

Re: 1.2 RC2 exception line numbering bug.

2010-08-07 Thread Stuart Halloway
I don't think this is a regression -- I can see the same thing in 1.1. Can you please open a ticket, along with any additional information on which kinds of errors do/do not exhibit the problem? Stu > This bug still seems to be present in 1.2 RC2, and is more general > than I previously thought

Re: take-while2?

2010-08-07 Thread Steve Purcell
On 7 Aug 2010, at 11:15, bonega wrote: > Hi. > > Are there some function like this: > > (defn take-while2 [f pred coll] ... > > usage: (take-while2 + #(< % 100) (iterate inc 0)) > returns: (0 1 2 3 4 5 6 7 8 9 10 11 12 13) I'm feeling a bit stupid because I can't see from the above example ho

Re: slow raw io

2010-08-07 Thread Peter Schuller
> No. We want to collect more information and do more comparisons before moving > away from the recommended Java buffering. Interesting. Why do you consider it recommended to read one character at a time in a case like this? Maybe there is such a recommendation that I don't know about, but in gen

Re: Slightly Off Topic: .NET books

2010-08-07 Thread Mark Rathwell
> My copy of Third Edition covers C# 3.0. Sorry about that, I just copied and pasted your entry, I have Second Edition. On Fri, Aug 6, 2010 at 7:34 PM, Dan Moniz wrote: > On Fri, 06 Aug 2010 17:49 -0400, "Mark Rathwell" > wrote: > > > +1 for: > > > > _The C# Programming Language, 3rd Edition_

Re: slow raw io

2010-08-07 Thread j-g-faustus
On Aug 7, 2:02 pm, Stuart Halloway wrote: > > No. We want to collect more information and do more comparisons before > > moving away from the recommended Java buffering. Maybe this comparison can be of interest? http://nadeausoftware.com/articles/2008/02/java_tip_how_read_files_quickly Somebody

Re: System calls

2010-08-07 Thread j-g-faustus
On Aug 7, 7:27 am, Meikel Brandmeyer wrote: > (defn to-env >   [env-vars-map] >   (->> env-vars-map >     (map #(str (name (key %)) "=" (val %))) >     into-array)) > > And an invocation: > > user=> (to-env {:PATH "/bin:/usr/bin" :HOME "/Users/mb" :foo "bar"}) > # > user=> (seq *1) > ("PATH=/bin:/

Re: take-while2?

2010-08-07 Thread Andreas Liljeqvist
It should use "+" for reducing the taken list. Behind the scenes I would envision some accumulator passed to pred. This examples takes elements while their total sum is less than 100. 2010/8/7 Steve Purcell > On 7 Aug 2010, at 11:15, bonega wrote: > > > Hi. > > > > Are there some function like t

Re: System calls

2010-08-07 Thread Dave
Thanks everyone. I have already tried the full path: (defn get-msms-pts-OSX ;; Finds the msms points for a density (optional DEFAULT = 1.0) and radius (optional DEFAULT = 1.5) [pdb-file density radius] (execute (str "/Users/daviddreisigmeyer/msms_MacOSX_2.6.1/ pdb_to_xyzr " pdb-file

Re: take-while2?

2010-08-07 Thread Steve Purcell
Oh, right, so maybe: (last (take-while #(< (apply + %) 100) (reductions conj [] (iterate inc 0 => [0 1 2 3 4 5 6 7 8 9 10 11 12 13] -Steve On 7 Aug 2010, at 13:57, Andreas Liljeqvist wrote: > It should use "+" for reducing the taken list. > Behind the scenes I would envision some accumulat

Re: take-while2?

2010-08-07 Thread Joop Kiefte
Maybe you should call that take-until or something like that :) 2010/8/7 Steve Purcell : > Oh, right, so maybe: > (last (take-while #(< (apply + %) 100) (reductions conj [] (iterate inc > 0 > => [0 1 2 3 4 5 6 7 8 9 10 11 12 13] > -Steve > > On 7 Aug 2010, at 13:57, Andreas Liljeqvist wrote: >

Re: Bug: contains? doesn't work on transient maps or sets

2010-08-07 Thread Nicolas Oury
Same here. get does not work either on set. But works on transient map. Very difficult to workaround for Sets (as get do not work) On Sun, Aug 1, 2010 at 8:25 PM, Mark Engelberg wrote: > I just tested this in Clojure 1.2, and the bug is still there: > > (contains? (transient #{1 2}) 1) -> false

Re: maven compilation of a clojure project hangs due to still running thread pools

2010-08-07 Thread Armando Blancas
It seems to me that agents and functions like pmap should require additional coding. Given the problem you've encounter, maybe a cached thread pool isn't the best choice, especially if one proposal to deal with this situation is to lower the keep alive value to the point that this thing isn't much

Re: maven compilation of a clojure project hangs due to still running thread pools

2010-08-07 Thread Armando Blancas
> It seems to me that agents and functions like pmap should require > additional coding. Wait, don't commit! I meant should NOT require that... -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.

Re: take-while2?

2010-08-07 Thread gary ng
On Sat, Aug 7, 2010 at 8:14 AM, Steve Purcell wrote: > Oh, right, so maybe: > (last (take-while #(< (apply + %) 100) (reductions conj [] (iterate inc > 0 > => [0 1 2 3 4 5 6 7 8 9 10 11 12 13] > -Steve or user=> (map second (take-while (fn [e] (< (first e) 100)) (rest (reductions (fn [a x] [

Re: take-while2?

2010-08-07 Thread Steve Purcell
On 7 Aug 2010, at 20:23, gary ng wrote: > On Sat, Aug 7, 2010 at 8:14 AM, Steve Purcell wrote: >> Oh, right, so maybe: >> (last (take-while #(< (apply + %) 100) (reductions conj [] (iterate inc >> 0 >> => [0 1 2 3 4 5 6 7 8 9 10 11 12 13] >> -Steve > > or > > user=> (map second (take-while

Re: take-while2?

2010-08-07 Thread gary ng
On Sat, Aug 7, 2010 at 12:46 PM, Steve Purcell wrote: > > Nice - that's about twice as fast as my version (with the 100 limit scaled up > to 1 million), though perhaps a less general pattern since the code structure > assumes knowledge of +'s cumulative nature. > Yes, it needs a proper initiali

Re: take-while2?

2010-08-07 Thread Andreas Liljeqvist
Thanks that works. What I really want is a function like in my initial posting. Is there something like that in core or contrib? Your example code can be quite slow since all sublists are summed before comparision. I would like a function that does this with a accumulator for the reduced values.

TextMate users, what bundle are you using?

2010-08-07 Thread frou
Searching Google, I see there are several TextMate bundles for Clojure support. Some old, some new-ish. I'm sure there are others I didn't find. Who's using TextMate for Clojure? What's your tip for the best bundle / auxiliary tools? Thank you -- You received this message because you are subscr

Re: take-while2?

2010-08-07 Thread Meikel Brandmeyer
Hi, Am 07.08.2010 um 19:44 schrieb Andreas Liljeqvist: > Your example code can be quite slow since all sublists are summed before > comparision. > I would like a function that does this with a accumulator for the reduced > values. You can always go low-level: (defn take-until [f initial pre

Re: take-while2?

2010-08-07 Thread gary ng
On Sat, Aug 7, 2010 at 10:44 AM, Andreas Liljeqvist wrote: > Thanks that works. > What I really want is a function like in my initial posting. > Is there something like that in core or contrib? > Your example code can be quite slow since all sublists are summed before > comparision. I believe my v

Re: TextMate users, what bundle are you using?

2010-08-07 Thread David Nolen
On Sat, Aug 7, 2010 at 4:47 PM, frou wrote: > Searching Google, I see there are several TextMate bundles for Clojure > support. Some old, some new-ish. I'm sure there are others I didn't > find. > > Who's using TextMate for Clojure? What's your tip for the best > bundle / auxiliary tools? > > Tha

looking for a simpler implementation of a function I'm using

2010-08-07 Thread David Cabana
Here are a couple of implementations of a function I'm calling 'partition-when'. I feel like there should be a simpler way than either of these. If you have one, I'd love to see it. (defn partition-when;;version 1 "Partition a sequence into subsequences; begin a new s

Re: looking for a simpler implementation of a function I'm using

2010-08-07 Thread Michael Gardner
(partition-by #(when (even? %) (gensym)) -- 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 members are moderated - please be patient with your first post. To unsubsc

Re: looking for a simpler implementation of a function I'm using

2010-08-07 Thread gary ng
On Sat, Aug 7, 2010 at 6:12 PM, David Cabana wrote: > Speed is no big deal for me; the sequences I'm handling are short, say > about length100. BTW, one of these is considerably faster than the > other for longish sequences. Can you guess which? > if you don't mind about performance, this seems to

Re: looking for a simpler implementation of a function I'm using

2010-08-07 Thread gary ng
On Sat, Aug 7, 2010 at 6:35 PM, Michael Gardner wrote: > (partition-by #(when (even? %) (gensym)) nice, why do I need the gensym ? -- 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

Re: looking for a simpler implementation of a function I'm using

2010-08-07 Thread gary ng
On Sat, Aug 7, 2010 at 6:39 PM, gary ng wrote: > On Sat, Aug 7, 2010 at 6:35 PM, Michael Gardner wrote: >> (partition-by #(when (even? %) (gensym)) > nice, why do I need the gensym ? ah, the gensym is for 'break'. but why does it behave like this user=> (partition-by #(when (even? %) (gensym))

Re: looking for a simpler implementation of a function I'm using

2010-08-07 Thread Michael Gardner
On Aug 7, 2010, at 8:35 PM, Michael Gardner wrote: > (partition-by #(when (even? %) (gensym)) Whoops, hit 'send' too soon. And it doesn't actually work, since it splits before and after the even values. On Aug 7, 2010, at 8:39 PM, gary ng wrote: > nice, why do I need the gensym ? The gensym w

Re: looking for a simpler implementation of a function I'm using

2010-08-07 Thread Michael Gardner
On Aug 7, 2010, at 8:48 PM, Michael Gardner wrote: > On Aug 7, 2010, at 8:39 PM, gary ng wrote: > >> nice, why do I need the gensym ? > > The gensym was just a cheesy way of generating a unique value. To elaborate a bit more on my failure, I was reading the docs for partition-by thinking that

Re: looking for a simpler implementation of a function I'm using

2010-08-07 Thread gary ng
On Sat, Aug 7, 2010 at 6:55 PM, Michael Gardner wrote: > On Aug 7, 2010, at 8:48 PM, Michael Gardner wrote: > >> On Aug 7, 2010, at 8:39 PM, gary ng wrote: >> >>> nice, why do I need the gensym ? >> >> The gensym was just a cheesy way of generating a unique value. > > To elaborate a bit more on my

Re: 1.2 RC2 exception line numbering bug.

2010-08-07 Thread Jason Wolfe
OK, done. http://www.assembla.com/spaces/clojure/tickets/420-some-compiler-exceptions-erroneously-using-repl-line-numbers- I don't have more details on what kinds of errors are affected; but, I believe the wrong line numbers are the REPL line numbers, if that helps.. Thanks, Jason On Aug 7, 5:0

Re: looking for a simpler implementation of a function I'm using

2010-08-07 Thread David Cabana
On Sat, Aug 7, 2010 at 9:36 PM, gary ng wrote: > if you don't mind about performance, this seems to be natural to me > > user=> (reverse (map reverse (reduce (fn [a e] (if (even? e) (cons [e] a) > (cons > (cons e (first a)) (rest a (list) [1 2 3 7 5 4 1]))) > ((1) (2 3 7 5) (4 1)) I reworked

Re: looking for a simpler implementation of a function I'm using

2010-08-07 Thread David Cabana
Using a vector instead of a list as the accumulator makes it possible to skip the mapping of reverse used in the earlier version of pw: (defn pw [f? x] (let [phi (fn [a e] (if (f? e) (cons [e] a ) (cons (conj (first a) e) (rest

Re: looking for a simpler implementation of a function I'm using

2010-08-07 Thread gary ng
On Sat, Aug 7, 2010 at 8:27 PM, David Cabana wrote: > Using a vector instead of a list as the accumulator makes it possible > to skip the mapping of reverse used in the earlier version of pw: > > (defn pw [f? x] >  (let [phi (fn [a e] >              (if (f? e) >                (cons [e] a ) >    

Re: take-while2?

2010-08-07 Thread Randy Hudson
Andreas, there's no such function in Clojure core, and I'm fairly sure there's not one in contrib. Stop reading if you don't want to see my version; it was a fun little puzzle. (defn take-while-reduction [f pred coll] (let [rf (juxt #(reductions f %) identity)] (->> coll rf (apply map vecto

Re: take-while2?

2010-08-07 Thread Michał Marczyk
Yet another version: (defn take-while-acc [f pred coll] (map (fn [_ x] x) (take-while pred (reductions f coll)) coll)) Seems to work: user> (take-while-acc + #(< % 100) (range)) (0 1 2 3 4 5 6 7 8 9 10 11 12 13) Note that reductions does use an "accumulator" (in the form of a cl

Re: System calls

2010-08-07 Thread j-g-faustus
On Aug 7, 4:46 pm, Dave wrote: >   (execute (str "/../pdb_to_xyzr " pdb-file " > /.."))) > > Here it seemed to run (the above error isn't shown) but nothing > happened and the REPL become unresponsive again.   I think the issue is that Runtime.exec doesn't start a shell, just a subprocess, so thi

Re: take-while2?

2010-08-07 Thread Randy Hudson
Nice! On Aug 7, 11:56 pm, Michał Marczyk wrote: > Yet another version: > > (defn take-while-acc [f pred coll] >   (map (fn [_ x] x) >        (take-while pred (reductions f coll)) >        coll)) > > Seems to work: > > user> (take-while-acc + #(< % 100) (range)) > (0 1 2 3 4 5 6 7 8 9 10 11 12 13)

Re: looking for a simpler implementation of a function I'm using

2010-08-07 Thread David Cabana
> conj sounds like 'append' to me which I have no idea about the > performance characteristics in clojure(it is a no-no in F#, Haskell ++ > is better but would grow the stack). conj is not the same as append; it will insert the new element in the smart (most efficient) way. For instance: user> (co