Re: complex number library

2010-12-16 Thread Laurent PETIT
2010/12/16 Sunil S Nandihalli > double-dispatch in clojure .. thats neat... Thanks Stuart. Really, that's "double-dispatch with protocols", 'cause double-triple-whatever-dispatch on anything you know 'bout the function arguments is solved since the introduction of multimethods. Cheers, -- La

Re: Looking for a better way

2010-12-16 Thread Laurent PETIT
Indeed ! I was stuck in the macro thinking, thanks for getting us out of it ! And then this solution not only works for literal strings: user=> (foo (str "yo" "man")) #'user/yoman user=> yoman "yoman" user=> 2010/12/16 Robert McIntyre > no need to use macros at all: > > (defn foo > "creates

Re: complex number library

2010-12-16 Thread Sunil S Nandihalli
my bad .. thats what I meant..:) On Thu, Dec 16, 2010 at 2:10 PM, Laurent PETIT wrote: > 2010/12/16 Sunil S Nandihalli > > double-dispatch in clojure .. thats neat... Thanks Stuart. > > > Really, that's "double-dispatch with protocols", 'cause > double-triple-whatever-dispatch on anything you kn

Re: Catching ClassNotFoundException.

2010-12-16 Thread Meikel Brandmeyer
Hi, Am 16.12.2010 um 04:16 schrieb Nicolas Buduroi: > So we could always use RT/classForName to detect what classes are > available. Do you think the extend-type thrown exception can possibly > be fixed or is it a fundamental limitation? I think the problem here is „when“ not „where.“ The „exten

Re: Looking for a better way

2010-12-16 Thread Emeka
Laurent and Robert, Thank you all. On Thu, Dec 16, 2010 at 9:44 AM, Laurent PETIT wrote: > Indeed ! > > I was stuck in the macro thinking, thanks for getting us out of it ! > > And then this solution not only works for literal strings: > > user=> (foo (str "yo" "man")) > #'user/yoman > user=> y

Re: Clojure 1.3 Alpha 4

2010-12-16 Thread Stuart Halloway
> Worse, from the sounds of it the new + isn't exactly the old > unchecked-+; it still checks for overflow rather than allowing > wrapping. That's going to add a compare-and-branch to every add > instruction and halve the speed of those operators on typical > hardware. Compare-and-throw-exception i

Re: Clojure 1.3 Alpha 4

2010-12-16 Thread Stuart Halloway
> On Tue, Dec 14, 2010 at 9:56 PM, David Nolen wrote: >> On Tue, Dec 14, 2010 at 9:04 PM, Ken Wesson wrote: >>> >>> On Tue, Dec 14, 2010 at 8:23 PM, Benny Tsai wrote: As Brian said, primitive math is now the default in 1.3. If auto- promotion on overflow is desired, you can use the +

Re: Clojure 1.3 Alpha 4

2010-12-16 Thread Stuart Halloway
> In practice, I haven't seen a significant speed improvement in the new branch > of Clojure (except on specific benchmarks that intentionally test Clojure's > new default primitive math). In my day-to-day code, all my numbers, despite > being perfectly small enough to fit in a long, end up get

MethodHandles and the future

2010-12-16 Thread Robbie Gibson
Hi all, Are there any plans to move in the direction John Rose is talking about here? I guess the timeframe would depend on when this tech makes it into production branches, but is it on the radar at least? http://blogs.sun.com/jrose/entry/scheme_in_one_class Regards, Robbie -- You rec

Re: unquote

2010-12-16 Thread Jay Fields
In general you should prefer doseq because it doesn't hold on to the head, correct? Sent from my iPhone On Dec 15, 2010, at 5:14 PM, Meikel Brandmeyer wrote: > Hi, > > Am 15.12.2010 um 19:54 schrieb Brian Marick: > >> (See also #'dorun.) > > Argh. See also doseq. > > Sincerely > Meikel >

Re: unquote

2010-12-16 Thread Meikel Brandmeyer
Hi, Am 16.12.2010 um 14:50 schrieb Jay Fields: > In general you should prefer doseq because it doesn't hold on to the head, > correct? dorun does the same. But it constructs a lazy sequence of return values which is thrown away immediately. This is very ugly and wasteful. Doing some microbenc

Re: MethodHandles and the future

2010-12-16 Thread Stuart Sierra
Certainly on the radar. But not usable until it's available in the majority of production JDKs out there. Java moves slowly; even Clojure's dependence on 1.5 has been a blocker for some folks. -Stuart Sierra clojure.com -- You received this message because you are subscribed to the Google Grou

Re: Midje: a different slant on clojure testing

2010-12-16 Thread .Bill Smith
Thank you for sharing Midje with us. I too would like to hear how it relates to clojure.test. -- 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 moderate

Re: Midje: a different slant on clojure testing

2010-12-16 Thread Brian Marick
On Dec 16, 2010, at 12:21 AM, Shantanu Kumar wrote: > 1. Is there any example app that demonstrates how to use Midje? The introduction to the basic feature set is here: https://github.com/marick/Midje/blob/master/examples/sweet-examples/basic/test/basic/core_test.clj As a simple example, I conve

Re: Catching ClassNotFoundException.

2010-12-16 Thread Nicolas Buduroi
Cool, that explain everything. Thanks On Dec 16, 4:40 am, Meikel Brandmeyer wrote: > Hi, > > Am 16.12.2010 um 04:16 schrieb Nicolas Buduroi: > > > So we could always use RT/classForName to detect what classes are > > available. Do you think the extend-type thrown exception can possibly > > be fix

Re: Clojure 1.3 Alpha 4

2010-12-16 Thread Ken Wesson
On Thu, Dec 16, 2010 at 8:13 AM, Stuart Halloway wrote: >> Worse, from the sounds of it the new + isn't exactly the old >> unchecked-+; it still checks for overflow rather than allowing >> wrapping. That's going to add a compare-and-branch to every add >> instruction and halve the speed of those o

Re: Clojure 1.3 Alpha 4

2010-12-16 Thread Ken Wesson
On Thu, Dec 16, 2010 at 8:17 AM, Stuart Halloway wrote: > I wrote: >> Breaking source compatibility with just about every single preexisting >> line of Clojure code out there is supposed to make our lives *easier*? >> I'd dearly love to know how -- my cousin is a stage magician and he's >> always

Re: Clojure 1.3 Alpha 4

2010-12-16 Thread nicolas.o...@gmail.com
> The > common case is test and accept the result, returning it, in both > cases; so the common case should have comparable execution speed given > both implementations. If not, something is wrong someplace else with > at least one of the implementations (or, much less likely, with the > JVM/JIT).

Re: Clojure 1.3 Alpha 4

2010-12-16 Thread David Nolen
On Thu, Dec 16, 2010 at 11:18 AM, Ken Wesson wrote: > On Thu, Dec 16, 2010 at 8:13 AM, Stuart Halloway > wrote: > >> Worse, from the sounds of it the new + isn't exactly the old > >> unchecked-+; it still checks for overflow rather than allowing > >> wrapping. That's going to add a compare-and-b

Re: Midje: a different slant on clojure testing

2010-12-16 Thread Brian Marick
On Dec 16, 2010, at 12:21 AM, Shantanu Kumar wrote: > 2. Why would I use Midje instead of clojure.test? Oh, one other thing: you can mix and match Midje and Clojure.test tests. Midje uses the clojure.test reporting mechanism. You can start adding Midje tests to your existing test files and c

Re: Clojure 1.3 Alpha 4

2010-12-16 Thread Stuart Halloway
> On Thu, Dec 16, 2010 at 8:17 AM, Stuart Halloway > wrote: >> I wrote: >>> Breaking source compatibility with just about every single preexisting >>> line of Clojure code out there is supposed to make our lives *easier*? >>> I'd dearly love to know how -- my cousin is a stage magician and he's >>

Re: Clojure 1.3 Alpha 4

2010-12-16 Thread Ken Wesson
On Thu, Dec 16, 2010 at 11:36 AM, David Nolen wrote: > On Thu, Dec 16, 2010 at 11:18 AM, Ken Wesson wrote: >> >> On Thu, Dec 16, 2010 at 8:13 AM, Stuart Halloway >> wrote: >> >> Worse, from the sounds of it the new + isn't exactly the old >> >> unchecked-+; it still checks for overflow rather th

Re: Clojure 1.3 Alpha 4

2010-12-16 Thread Ken Wesson
On Thu, Dec 16, 2010 at 12:04 PM, Stuart Halloway wrote: > I wrote: >> On Thu, Dec 16, 2010 at 8:17 AM, Stuart Halloway >> wrote: >>> I wrote: Breaking source compatibility with just about every single preexisting line of Clojure code out there is supposed to make our lives *easier*? >>

Re: Clojure 1.3 Alpha 4

2010-12-16 Thread Stuart Halloway
>>> Worse, from the sounds of it the new + isn't exactly the old >>> unchecked-+; it still checks for overflow rather than allowing >>> wrapping. That's going to add a compare-and-branch to every add >>> instruction and halve the speed of those operators on typical >>> hardware. Compare-and-throw-e

Re: Clojure 1.3 Alpha 4

2010-12-16 Thread nicolas.o...@gmail.com
> > The overflow check is the same whether you react to an overflow by > boxing the result or react to an overflow by throwing an exception! But then all the rest of the code has to check whether things are boxed or not. Moreover, the JVM makes it very hard (impossible) to manipulate something th

Re: Clojure 1.3 Alpha 4

2010-12-16 Thread Terrance Davis
*begin rant* I have yet to see anyone who posts the classic "rtfm" (even politely) response search previous posts and realize that "rtfm" responses have already been sent and refrain from sending the same explanation of how to use a mailing list over and over and over. Simple customer service

Re: Clojure 1.3 Alpha 4

2010-12-16 Thread Baishampayan Ghose
>> It takes almost zero time to offer opinions without bothering to check. > > That looks like yet another unproductive, non-constructive personal criticism. Why do you think so? These people are just requesting you to check things for yourself instead engaging in this meaningless argument. The de

Java out of memory problem

2010-12-16 Thread clj123
Hello, I'm trying to insert in a database large number of records, however it's not scaling correctly. For 100 records it takes 10 seconds, for 100 records it takes 2 min to save. But for 250 records it throws Java Heap out of memory exception. I've tried separting the records processing

Re: Clojure 1.3 Alpha 4

2010-12-16 Thread David Nolen
On Thu, Dec 16, 2010 at 12:06 PM, Ken Wesson wrote: > The overflow check is the same whether you react to an overflow by > boxing the result or react to an overflow by throwing an exception! > It's not the same at all. If you box the result all further arithmetic computations slows down. You ca

Re: Clojure 1.3 Alpha 4

2010-12-16 Thread Ken Wesson
On Thu, Dec 16, 2010 at 12:13 PM, Stuart Halloway wrote: Worse, from the sounds of it the new + isn't exactly the old unchecked-+; it still checks for overflow rather than allowing wrapping. That's going to add a compare-and-branch to every add instruction and halve the speed o

Re: Clojure 1.3 Alpha 4

2010-12-16 Thread Ken Wesson
On Thu, Dec 16, 2010 at 12:14 PM, nicolas.o...@gmail.com wrote: >> >> The overflow check is the same whether you react to an overflow by >> boxing the result or react to an overflow by throwing an exception! > > But then all the rest of the code has to check whether things are boxed or > not. > M

Re: Clojure 1.3 Alpha 4

2010-12-16 Thread Rich Hickey
On Dec 16, 2010, at 11:19 AM, Ken Wesson wrote: > On Thu, Dec 16, 2010 at 8:17 AM, Stuart Halloway > wrote: >> I wrote: >>> Breaking source compatibility with just about every single preexisting >>> line of Clojure code out there is supposed to make our lives *easier*? >>> I'd dearly love to kno

Re: Clojure 1.3 Alpha 4

2010-12-16 Thread Ken Wesson
On Thu, Dec 16, 2010 at 12:22 PM, Baishampayan Ghose wrote: >>> It takes almost zero time to offer opinions without bothering to check. >> >> That looks like yet another unproductive, non-constructive personal >> criticism. > > Why do you think so? Because of the implication that my opinions are

Re: Clojure 1.3 Alpha 4

2010-12-16 Thread Ken Wesson
On Thu, Dec 16, 2010 at 12:24 PM, David Nolen wrote: > On Thu, Dec 16, 2010 at 12:06 PM, Ken Wesson wrote: >> >> The overflow check is the same whether you react to an overflow by >> boxing the result or react to an overflow by throwing an exception! > > It's not the same at all. > If you box the

Re: Clojure 1.3 Alpha 4

2010-12-16 Thread Baishampayan Ghose
>> yet you are accusing people of criticizing you just because they feel you >> should do a bit more >> research about this. > > I'm asking them to explain themselves better, and their responses are > not any kind of explanation. Please try putting yourself in their shoes. They have already expla

Re: Clojure 1.3 Alpha 4

2010-12-16 Thread David Nolen
On Thu, Dec 16, 2010 at 1:06 PM, Ken Wesson wrote: > I don't know how common dynamic binding is in application code. It > tends to be in library code more often, which is a smaller number of > changes to make. Plus, the dynamic binding changes have a rationale > behind them that actually seems to

Re: Clojure 1.3 Alpha 4

2010-12-16 Thread Stuart Halloway
> wrote: > Worse, from the sounds of it the new + isn't exactly the old > unchecked-+; it still checks for overflow rather than allowing > wrapping. That's going to add a compare-and-branch to every add > instruction and halve the speed of those operators on typical > hardware.

Re: Clojure 1.3 Alpha 4

2010-12-16 Thread Ken Wesson
On Thu, Dec 16, 2010 at 1:15 PM, Baishampayan Ghose wrote: >>> yet you are accusing people of criticizing you just because they feel you >>> should do a bit more >>> research about this. >> >> I'm asking them to explain themselves better, and their responses are >> not any kind of explanation. >

Re: Java out of memory problem

2010-12-16 Thread zeph
You might be coming to near OOM with using in-memory processing but don't know it, and the batched (lazy) version is probably holding onto data creating the mem leak. Would you be able to post the relevant source? -- You received this message because you are subscribed to the Google Groups "Cloj

Possible to use << from clojure.contrib.strint with a string variable

2010-12-16 Thread Michael
I'm trying to use << from clojure.contrib.strint perform string interpolation in a string variable. The following, (ns strint-test (:use clojure.contrib.strint)) (def v 1) (println (<< "v: ~{v}")) (def s "v: ~{v}") (println (<< (str s))) (println (<< s)) results in v: 1 v: ~{v} java.lang.Runt

Improving the documentation

2010-12-16 Thread Mike Meyer
On Thu, 16 Dec 2010 10:18:47 -0700 Terrance Davis wrote: > *begin rant* > > I have yet to see anyone who posts the classic "rtfm" (even politely) > response search previous posts and realize that "rtfm" responses have > already been sent and refrain from sending the same explanation of how >

Re: Erlang-esque bit syntax in Clojure?

2010-12-16 Thread Michael Ossareh
> > I was wondering if anyone has been working > on implementing a bit syntax for Clojure in the rough conceptual style > of Erlang's bit syntax. > I'm not an erlang-pro, just dabbled enough to know I like the pattern matching, which is what you're talking about here, I believe. > I'm looking fo

Re: Possible to use << from clojure.contrib.strint with a string variable

2010-12-16 Thread Ken Wesson
On Thu, Dec 16, 2010 at 2:56 PM, Michael wrote: > > I'm trying to use << from clojure.contrib.strint perform string > interpolation in a string variable.  The following, > > (ns strint-test (:use clojure.contrib.strint)) > > (def v 1) > (println (<< "v: ~{v}")) > > (def s "v: ~{v}") > (println (<<

Re: Improving the documentation

2010-12-16 Thread Stuart Halloway
> On Thu, 16 Dec 2010 10:18:47 -0700 > Terrance Davis wrote: > >> *begin rant* >> >> I have yet to see anyone who posts the classic "rtfm" (even politely) >> response search previous posts and realize that "rtfm" responses have >> already been sent and refrain from sending the same explanation

Re: Erlang-esque bit syntax in Clojure?

2010-12-16 Thread Zach Tellman
The only things I know that Gloss lacks relative to Erlang's functionality is arbitrary bit-lengths for integers and mixed-endian support, both of which I plan to add in the near future. Lacking Erlang's built in pattern matching, the Clojure implementation will probably be less elegant in some ca

Re: Erlang-esque bit syntax in Clojure?

2010-12-16 Thread Ken Wesson
On Thu, Dec 16, 2010 at 6:01 PM, Zach Tellman wrote: > The only things I know that Gloss lacks relative to Erlang's > functionality is arbitrary bit-lengths for integers and mixed-endian > support, both of which I plan to add in the near future.  Lacking > Erlang's built in pattern matching, the C

Re: Improving the documentation

2010-12-16 Thread Mike Meyer
On Thu, 16 Dec 2010 17:50:58 -0500 Stuart Halloway wrote: > > On Thu, 16 Dec 2010 10:18:47 -0700 > > Terrance Davis wrote: > > > >> *begin rant* > >> > >> I have yet to see anyone who posts the classic "rtfm" (even politely) > >> response search previous posts and realize that "rtfm" response

Re: Erlang-esque bit syntax in Clojure?

2010-12-16 Thread Daniel Janus
Hi Daniel, I'm fairly certain this is not exactly what you're looking for, but it's somewhat related and it might give you a fuller image -- my tiny clj-bitfields library: https://github.com/nathell/clj-bitfields Best, Daniel Janus -- You received this message because you are subscribed to t

Re: Java out of memory problem

2010-12-16 Thread Michael Ossareh
On Thu, Dec 16, 2010 at 09:19, clj123 wrote: > Hello, > > I'm trying to insert in a database large number of records, however > it's not scaling correctly. For 100 records it takes 10 seconds, for > 100 records it takes 2 min to save. But for 250 records it > throws Java Heap out of memor

Re: Possible to use << from clojure.contrib.strint with a string variable

2010-12-16 Thread Alex Osborne
Michael writes: > I'm trying to use << from clojure.contrib.strint perform string > interpolation in a string variable. The following, > (def s "v: ~{v}") > (println (<< (str s))) > (println (<< s)) This is not going to be possible (at least not efficiently: you could technically do itwith &en