Re: Var binding and lazy structures behavior (bug?)

2009-05-23 Thread Meikel Brandmeyer
Hi, Am 23.05.2009 um 08:43 schrieb Josip Gracin: I'm getting unexpected behavior trying to use binding and map. Here's what happens. (def *v*) (defn fun [i] *v*) (defn bv [] (binding [*v* 100] (map fun [1 2]))) Evaluating (bv) throws "Var *v* is unbound exception". I expected it to retu

Re: Call for Help!: Clojure Code for JavaOne Talk

2009-05-23 Thread michaelg
Thanks Chouser, very nice! I am quite aware of the performance boost of using ints instead of strings -- this was an intentional choice on my part. When I first solved the problem, I wrote it in Scala and used ints. I have one question for you, and this will show my OOP roots :-) How would you en

Re: Var binding and lazy structures behavior (bug?)

2009-05-23 Thread Josip Gracin
On Sat, May 23, 2009 at 9:37 AM, Meikel Brandmeyer wrote: > So this is no bug, but expected behaviour. I get it. Thanks Meikel! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this grou

Re: Bit-Shift without Sign-Extend?

2009-05-23 Thread ke...@ksvanhorn.com
Here's how I implemented the ">>>" operator for ints: (let [intmask (dec (bit-shift-left 1 32))] (defmacro ushr [x n] `(int (bit-shift-right (bit-and ~intmask ~x) ~n The (bit-and intmask x) expression effectively gives you the unsigned equivalent of x. For bytes, use 255 instead of intmas

Re: Call for Help!: Clojure Code for JavaOne Talk

2009-05-23 Thread David Nolen
Put them in a namespace. (ns prime-seive) ... definitions ... On Saturday, May 23, 2009, michaelg wrote: > > Thanks Chouser, very nice! I am quite aware of the performance boost > of using ints instead of strings -- this was an intentional choice on > my part. When I first solved the problem,

Re: ANN: Full, continuously updated documentation for clojure.contrib

2009-05-23 Thread Stephen C. Gilardi
Hi Tom, I like the docs a lot. Thanks for making the robot! I have a suggestion for a refinement. We've received an issue for clojure-contrib noting that the doc for zip-filter at: http://code.google.com/p/clojure-contrib/wiki/ZipFilterApiDoc contains: Usage: (ns

Re: Call for Help!: Clojure Code for JavaOne Talk

2009-05-23 Thread Chouser
On Sat, May 23, 2009 at 11:41 AM, David Nolen wrote: > > Put them in a namespace. > > (ns prime-seive) > > ... definitions ... Yes, this would probably be best. Then you can use 'defn-' instead of 'defn' for all the function definitions that you want to keep private. Another option that is usu

Re: Bit-Shift without Sign-Extend?

2009-05-23 Thread CuppoJava
That's a very elegant way of expressing it. Thanks for that tip Kevin. -Patrick --~--~-~--~~~---~--~~ 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 To unsub

question about deftype usage

2009-05-23 Thread Feng
Hi, clojure.contrib.types/deftype assumes data to tag are created fresh with no meta data. Would it be useful to have it update meta data if data are already initialized with meta data, e.g. from file or db with other meta data, but :type ::constructor are too program specific to be stored in the

Re: question about deftype usage

2009-05-23 Thread Feng
On May 24, 1:01 am, Feng wrote: > Hi, > > clojure.contrib.types/deftype assumes data to tag are created fresh > with no meta data. Would it be useful to have it update meta data if > data are already initialized with meta data, e.g. from file or db with > other meta data, but :type ::constructo