Re: lazy-cat

2009-05-16 Thread Laurent PETIT
2009/5/16 Sean Devlin : > > I'm sorry, it's an Americanism.  By "Dog People", I meant someone that > prefers a dog as a pet, not a cat.  It was meant as a joke. OK, I know understand the joke and the play on words :-$ > > You're right, I should be more considerate of the international > audience

Re: Override the + operator for a 'struct'

2009-05-16 Thread Adrian Cuthbertson
>Yes, the general consensus is that basic math needs to be as fast as >possible, even at the expense of some flexibility. It's worth noting here that one can also use binding to override other than arithmetic core functions; (defn ustr [s] (binding [clojure.core/str (fn [x] (.toUpperCase x))]

Question about building modular code in Clojure

2009-05-16 Thread Mark Engelberg
So I've built a file/namespace with several functions. There are several globals defined at the top of the file (for example, *gravity*) which many of the functions refer to. I made them globals precisely because it would have been a pain to thread them through every single function that uses th

Re: Override the + operator for a 'struct'

2009-05-16 Thread Phil Hagelberg
bradford cross writes: > First item of business - there are no operators, operators are functions. > > I think the Clojure way to do this is via multimethods: > http://clojure.org/multimethods > > I might just be naive, but it seems like more of core would need to be > implemented as multimeth

Re: Override the + operator for a 'struct'

2009-05-16 Thread Trevor Caira
One way to accomplish this is via :refer-clojure in ns. Usage is like: (ns test (:refer-clojure :exclude [+])) This would allow you to, for example, dispatch the implementation based on the type of the first argument via multimethods (as Michel S. noted, at a performance penalty). The origina

Re: Override the + operator for a 'struct'

2009-05-16 Thread bradford cross
First item of business - there are no operators, operators are functions. I think the Clojure way to do this is via multimethods: http://clojure.org/multimethods I might just be naive, but it seems like more of core would need to be implemented as multimethods in order to do this. Has this come

Re: list vs vector

2009-05-16 Thread Stephen C. Gilardi
On May 16, 2009, at 8:23 PM, Michel S. wrote: That's a bit of a red herring, though? You can always rewrite the code to use normal (as opposed to tail) recursion, if you don't want to use reverse. Depending on how large the resulting list is, it's a space- vs- time tradeoff: the normal recurs

Re: list vs vector

2009-05-16 Thread Michel S.
On May 15, 4:41 pm, "Stephen C. Gilardi" wrote: > > Another nice benefit of Clojure's efficient vectors over lists is that   > functions that produce a collection of results can produce and store   > them in order without needing to "reverse" the result just before   > returning. Reversing is a

Re: Override the + operator for a 'struct'

2009-05-16 Thread Michel S.
On May 16, 4:32 pm, Saptarshi wrote: > Hello, > I am totally new to Clojure and have dabbled in Scala. In Scala, it is > possible to override the + operator ,e.g a class A can overide +. > In Clojure, I would have a struct and not a class. Can I still > override the + operator in Clojure? > In

Override the + operator for a 'struct'

2009-05-16 Thread Saptarshi
Hello, I am totally new to Clojure and have dabbled in Scala. In Scala, it is possible to override the + operator ,e.g a class A can overide +. In Clojure, I would have a struct and not a class. Can I still override the + operator in Clojure? Regards Saptarshi --~--~-~--~~---

Re: 3D Grapher in Clojure

2009-05-16 Thread Curran Kelleher
Ah yes, good point! I'll change that code to dereference inside the transaction (you're totally right, that's the whole point of transactions!) and not use "ref" as a local binding. Thanks for the tips! Sorry, I should have included a run script or something, or at least instructions on using JOG

Re: list vs vector

2009-05-16 Thread Mark Engelberg
In my own experimentation, I was really surprised to find that traversal over vectors seemed to be faster than lists, so I tend to use vectors rather than lists for any "fixed collection" that I'm basically just traversing once I've built. Haven't benchmarked recently, though, so this could have

Re: lazy-cat

2009-05-16 Thread Meikel Brandmeyer
Hi, Am 16.05.2009 um 22:42 schrieb Sean Devlin: I was making a joke about housecats. Argh. Sorry. I always pronounce "cat" in german rather than english. Some strange tick of mine. So I didn't get the play of words. Sincerely Meikel smime.p7s Description: S/MIME cryptographic signature

Re: lazy-cat

2009-05-16 Thread Sean Devlin
I was making a joke about housecats. Maybe I should file a bug report saying cat should default to being lazy :) Again, sorry for the confusion. On May 16, 4:34 pm, Meikel Brandmeyer wrote: > Hi, > > Am 16.05.2009 um 21:58 schrieb Sean Devlin: > > > Lazy cat is redundant. > > concat != lazy-ca

Re: lazy-cat

2009-05-16 Thread Meikel Brandmeyer
Hi, Am 16.05.2009 um 21:58 schrieb Sean Devlin: Lazy cat is redundant. concat != lazy-cat. lazy-cat is obviously not redundant. Sincerely Meikel smime.p7s Description: S/MIME cryptographic signature

Re: lazy-cat

2009-05-16 Thread Sean Devlin
I'm sorry, it's an Americanism. By "Dog People", I meant someone that prefers a dog as a pet, not a cat. It was meant as a joke. You're right, I should be more considerate of the international audience, and careful to make my tone more clear. Thank you for speaking up. Sean On May 16, 4:13 p

Re: tree-utils

2009-05-16 Thread kyle smith
Sounds good. Unless there are other suggestions, can someone make the minor changes and commit it to contrib? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to cloj

Re: lazy-cat

2009-05-16 Thread Laurent PETIT
2009/5/16 Sean Devlin : > > Clearly you are all dog people. Hello, What means calling others "dog people" exactly ? Not being a native english person, I'm unsure whether the above is an insult, is ironic, or something else ? Anyway, the above sentence, without any smiley of some sort to explai

Re: lazy-cat

2009-05-16 Thread Sean Devlin
Clearly you are all dog people. Lazy cat is redundant. On May 16, 3:55 pm, Meikel Brandmeyer wrote: > Hi, > > Am 16.05.2009 um 21:48 schrieb George Jahad: > > > I can't come up with  a reason to use lazy-cat over concat.  Is it > > just around for backwards compatibility, or am I missing someth

Re: lazy-cat

2009-05-16 Thread Meikel Brandmeyer
Hi, Am 16.05.2009 um 21:48 schrieb George Jahad: I can't come up with a reason to use lazy-cat over concat. Is it just around for backwards compatibility, or am I missing something? (defmacro lazy-cat [& colls] `(concat ~@(map #(list `lazy-seq %) colls))) There is a difference! Consider

lazy-cat

2009-05-16 Thread George Jahad
I can't come up with a reason to use lazy-cat over concat. Is it just around for backwards compatibility, or am I missing something? (defmacro lazy-cat [& colls] `(concat ~@(map #(list `lazy-seq %) colls))) Thanks, George --~--~-~--~~~---~--~~ You received

Re: Classpath problem with r1369 ?

2009-05-16 Thread Meikel Brandmeyer
Hi again, I think I found the root cause of my problem. Since clojure compiles namespaces as they are encountered it depends on when c.c.def is compiled. If it's compiled first, it's anonymous function is created in clojure.core. Hence you get the clojure/core$clojure_contrib_def_... .class file

Re: Feedback on new persistentmatrix datatype

2009-05-16 Thread aperotte
Yes Anand, I'm worried about that. What I think the solution should be is to allow mutability in the implementation of algorithms in the java back end for the reasons you mentioned, but a clean immutable interface on the clojure side. When users are faced with serious memory limitations, though,

Re: list vs vector

2009-05-16 Thread Trevor Caira
Remember clojure, like other lisps, is homoiconic: the program code itself is clojure data. Lists are very common in clojure, since a list is is used in the function invocation syntax, e.g. (inc 0). Otherwise, used as a general purpose lists have the same benefits of linked lists over arrays that

Re: Classpath problem with r1369 ?

2009-05-16 Thread Meikel Brandmeyer
Hi, Am 16.05.2009 um 06:32 schrieb Paul Mooser: I've been using clojure for a while at this point, and the approach I've settled on launches clojure using -cp clojure.jar, and then my user.clj file contains code that loads a bunch of thing into my classpath. After updating to r1369, which mad

Best practices for Slime with Clojure

2009-05-16 Thread Glen Stampoultzis
Hi, I've recently been trying to work with Emacs and Slime on Windows using Clojure Box. Having never used emacs at all it is tough going. I had a question or two regarding best practices. The first is regarding classpaths. I've managed to figure out how to setup my classpath and library path (s