Re: puzzlement over lazy sequences

2011-09-12 Thread Michael Gardner
On Sep 12, 2011, at 11:28 PM, Ken Wesson wrote: > But if, as you say, take, drop, etc. work for larger n, it should be > easy to make nth work with larger n and non-random-access seqs, just > by changing the non-random-access case to (first (drop n the-seq)). I'd be rather surprised if nth sudden

Re: Generating Bash scripts from Clojure

2011-09-12 Thread Ambrose Bonnaire-Sergeant
Hi, Check out Stevedore: https://github.com/pallet/stevedore Example: http://hugoduncan.org/post/2010/shell_scripting_in_clojure_with_pallet.xhtml User group: http://groups.google.com/group/pallet-clj Thanks, Ambrose On Tue, Sep 13, 2011 at 1:09 PM, Denis Labaye wrote: > Hi, > > I have to wri

Re: debugging

2011-09-12 Thread JosephLi
Eclipse with CounterClockwise is ok (relatively speaking). With it one can do the usual: - breakpoints (no conditional) - stepping in/out - examine variables from different call frames But thats pretty much what it can do now. Neither Changing variable's value nor expression evaluation works,

Generating Bash scripts from Clojure

2011-09-12 Thread Denis Labaye
Hi, I have to write a bunch of Bash scripts, and not a lot of time :) The final script would perform a full install, provisionning, sanity checks, ... in one command. I wonder if I could generate them using Clojure. Of course the output script(s) won't have the Clojure runtime. Any advices / th

Re: puzzlement over lazy sequences

2011-09-12 Thread Ken Wesson
On Mon, Sep 12, 2011 at 11:55 AM, Stuart Halloway wrote: > I'm guessing there are similar bugs in drop, take, and so forth with > large n and large (or infinite) seqs. They should all be fixed. > > The other fns are ok, thanks to their separate heritage. drop, take, et al > are sequence functions,

Re: How to compose futures?

2011-09-12 Thread Alex Miller
I'm low on time but I will throw a few rocks in the pool here. Composition of futures / asynchronous tasks leads you towards dataflow concurrency (a trend in the making). People are dipping their toes in this all over right now but it needs further pushing. imho this is going to be big in 3-5 yea

Re: Clojure sort: is it specified to be stable for all targets?

2011-09-12 Thread Stuart Sierra
In general, if it's not specified in the doc string, then it's not a promise. That said, the implementation of `sort` in Clojure on the JVM uses java.util.Arrays#sort, which is specified to be stable. I would generally expect a language built-in `sort` routine to be stable, so take that for wha

Re: Migration to 1.3 for mortals

2011-09-12 Thread Stuart Sierra
> Since the new, separated contrib libraries are supposed to be > compatible with Clojure 1.2, you could perhaps also start migrating > one lib at a time at your leisure. This might even enable you to > contribute to a migration document. > Yes, this is what I am hoping people will do. Move to

Overtone 0.3 released

2011-09-12 Thread Sam Aaron
Hey everyone, I've just pushed out a shiny new Overtone release to Clojars. Although it's only been a little over a month since the last release, there's been quite a lot of work committed that it definitely warranted a new number and a little release party! So update your music project depende

Re: Newbie question: How to add external clojure jars properly in Eclipse.

2011-09-12 Thread JosephLi
hi Laurent, Sorry for going silent for several days the usual excuse, work deadline, families etc Anyway, really appreciate ur jumping in and try to give me a hand. I finally found out why: 1.) I have to indicate in Eclipse that the user library, that pointed to the jar downloaded from

Re: Misleading Exception due to function name containing ->

2011-09-12 Thread Stefan Kamphausen
Just some more, maybe even simpler examples: Clojure 1.3.0-master-SNAPSHOT user=> (defn foo>>bar [] "") user=> (foo>>bar "a") ArityException Wrong number of args (1) passed to: user$foo-GT clojure.lang.AFn.throwArity (AFn.java:439) user=> (defn foo++bar [a] "") user=> (foo++bar) ArityException

Re: Strategy direction for ClojureScript regarding Google Dash?

2011-09-12 Thread Timothy Baldridge
> I think it's probably too early to speculate, but does the clojure/ > core team have any thoughts on how Google Dash might affect > ClojureScript? Given that ClojureScript currently compiles to Closure > Javascript, can we then compile that into Dash for performance > enhancements? I think the

Strategy direction for ClojureScript regarding Google Dash?

2011-09-12 Thread logan
I think it's probably too early to speculate, but does the clojure/ core team have any thoughts on how Google Dash might affect ClojureScript? Given that ClojureScript currently compiles to Closure Javascript, can we then compile that into Dash for performance enhancements? http://css.dzone.com/ne

Re: Misleading Exception due to function name containing ->

2011-09-12 Thread Stefan Kamphausen
Hi, On Monday, September 12, 2011 8:07:22 PM UTC+2, Chouser wrote: > > > https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/AFn.java#L436 > looks like a subtle bug, doesn't it? The compiler translates '-' to '_' (Compiler.java:2619) and '>' to '_GT_' (Compiler.java:2623). Toge

Re: Misleading Exception due to function name containing ->

2011-09-12 Thread Chouser
On Mon, Sep 12, 2011 at 11:39 AM, Sean Corfield wrote: > On Mon, Sep 12, 2011 at 8:16 AM, Stefan Kamphausen > wrote: >> Maybe the example becomes clearer with a little less foo and a little more >> bar and baz: >> >> shell> lein repl >> REPL started; server listening on localhost port 64913 >> us

Re: puzzlement over lazy sequences

2011-09-12 Thread Stuart Halloway
> I'm guessing there are similar bugs in drop, take, and so forth with > large n and large (or infinite) seqs. They should all be fixed. The other fns are ok, thanks to their separate heritage. drop, take, et al are sequence functions, and proceed iteratively. nth is of a different lineage. It w

Re: Misleading Exception due to function name containing ->

2011-09-12 Thread Sean Corfield
On Mon, Sep 12, 2011 at 8:16 AM, Stefan Kamphausen wrote: > Maybe the example becomes clearer with a little less foo and a little more > bar and baz: > > shell> lein repl > REPL started; server listening on localhost port 64913 > user=> (defn foo [arg] "foo") > #'user/foo > user=> (defn bar->baz [

Re: Misleading Exception due to function name containing ->

2011-09-12 Thread Stefan Kamphausen
Maybe the example becomes clearer with a little less foo and a little more bar and baz: shell> lein repl REPL started; server listening on localhost port 64913 user=> (defn foo [arg] "foo") #'user/foo user=> (defn bar->baz [a b] "bar->baz") #'user/bar->baz user=> (foo (bar->baz "a")) java.lang.Il

Re: Misleading Exception due to function name containing ->

2011-09-12 Thread Michael Wood
On 12 September 2011 15:49, Christina Conway wrote: > user=> (defn foo [a] "") > #'user/foo > user=> (defn foo->foo2 [a b] "") > #'user/foo->foo2 > user=> (foo (foo->foo2 "a")) > java.lang.IllegalArgumentException: Wrong number of args (1) passed to: > user$foo (NO_SOURCE_FILE:0) > > This example

Re: Migration to 1.3 for mortals

2011-09-12 Thread Michael Wood
Hi On 12 September 2011 11:43, Jan Rychter wrote: > On Sep 10, 9:31 pm, Sean Corfield wrote: >> On Sat, Sep 10, 2011 at 9:46 AM, Jan Rychter wrote: >> > If you use Clojure to build an application that you subsequently >> > launch and maintain, it is pretty much a given that you use contrib. >>

Re: Thoughts on CUDA + Clojure

2011-09-12 Thread Timothy Baldridge
> In my opinion It would be wiser to target OpenCL first. So this effort > will not depend on particular hardware vendor. Sadly, I've found yet another limitation of OpenCL over the weekend. Apparently OpenCL doesn't support GPU function pointers. Without function pointers, and with OpenCL only su

Re: Thoughts on CUDA + Clojure

2011-09-12 Thread Petr Gladkikh
On Fri, Sep 9, 2011 at 1:43 AM, Timothy Baldridge wrote: > I've been kicking around an idea for some time, of starting a > Clojure->CUDA compiler. I would like to start a discussion about this > to figure out what some possible solutions are. First of all let me > start a simple fact list: > > CUD

Re: Misleading Exception due to function name containing ->

2011-09-12 Thread Christina Conway
user=> (defn foo [a] "") #'user/foo user=> (defn foo->foo2 [a b] "") #'user/foo->foo2 user=> (foo (foo->foo2 "a")) java.lang.IllegalArgumentException: Wrong number of args (1) passed to: user$foo (NO_SOURCE_FILE:0) This example illustrates the problem. The exception indicates that the foo function

Re: Misleading Exception due to function name containing ->

2011-09-12 Thread Chouser
On Fri, Sep 9, 2011 at 4:47 AM, Christina Conway wrote: > A function name contains the characters -> >   e.g.  foo->fn > The function causes an exception. > However the exception is not reported on the function but on another > function called before it. >   java.lang.IllegalArgumentException: Wro

Re: Clojure in Emacs Seemingly Impossible

2011-09-12 Thread Harrison Maseko
+1 On Sep 11, 4:04 pm, David Nolen wrote: > As an avid Emacs user - don't bother. If you just want a no hassle > environment that supports Clojure development use Clooj. Steps - > > 1) Download > 2) Double-click > > https://github.com/arthuredelstein/clooj > > David > > > > On Sat, Sep 10, 2011 a

Re: puzzlement over lazy sequences

2011-09-12 Thread Ken Wesson
On Mon, Sep 12, 2011 at 12:54 AM, Alan Malloy wrote: > Integer overflow. > > user> (mod 9876543210 (bigint (Math/pow 2 32))) > 1286608618 Oops. But nth can probably be fixed while keeping good performance: (defn- small-drop [s n] (loop [n (int n) s (seq s)] (if (zero? n) s (recur (dec n)

Re: Misleading Exception due to function name containing ->

2011-09-12 Thread Christina Conway
Thanks for the suggestion BG. I tried using clj-stacktrace but the function name is still not displayed correctly in the trace. Regards, cc On 11 September 2011 13:53, Baishampayan Ghose wrote: > > The foo->fn function is compiled to a .class file as: > > foo__GT_fn.class > > The foo>fn functio

Re: Migration to 1.3 for mortals

2011-09-12 Thread Jan Rychter
On Sep 10, 9:31 pm, Sean Corfield wrote: > On Sat, Sep 10, 2011 at 9:46 AM, Jan Rychter wrote: > > If you use Clojure to build an application that you subsequently > > launch and maintain, it is pretty much a given that you use contrib. > > Lots of it, in fact. > > I think that depends on when yo

trace-forms macro

2011-09-12 Thread Jonathan Fischer Friberg
Hello, I made a small macro, if anyone is interested. https://gist.github.com/1209498 It wraps one or more forms and if an exception is thrown, prints the form that caused it, and throws the exception itself. Examples: user=> (trace-forms 3) 3 user=> (trace-forms (+ 6 (/ 9 0))) java.lang.Arith

Re: Exceptions in Haskell and in Clojure

2011-09-12 Thread Jonathan Fischer Friberg
Incidentally, I was just working on such a thing. I'll send it in a new thread. Jonathan On Sun, Sep 11, 2011 at 7:03 PM, Michael Jaaka wrote: > Couldn't match expected type `(t, t1)' > against inferred type `(t2, t3, t4)' > In the expression: (8, 11, 5) > In the expression: [(1, 2), (8, 11, 5)

Re: What's wrong with my *print-dup* persistence?

2011-09-12 Thread Tassilo Horn
Chouser writes: > I haven't tried all the above, but I had a couple thoughts that might help: > > First, inside #=(), arguments aren't evaluated. They act as if quoted: > > #=(+ 1 (+ 2 4)) > ; ClassCastException clojure.lang.PersistentList cannot be cast to > java.lang.Number clojure.lan

Re: java interop not possible in #=(..) reader syntax?

2011-09-12 Thread Tassilo Horn
Hi! >> Hm, but even without the reader #=(..) syntax, there's some strangeness: >> >> --8<---cut here---start->8--- >> user> (. java.util.Date newInstance) >> ; Evaluation aborted. >> java.lang.NoSuchFieldException: newInstance >>  [Thrown class java.lang.Runtim