Re: numerator fn

2010-06-06 Thread Steve Purcell
On 7 Jun 2010, at 04:28, Dave Pawson wrote: > On 6 June 2010 13:35, Moritz Ulrich wrote: >> Note the "Added in Clojure version 1.2" in the documentation of numerator ;-) > > > Not until I'd blown up the text. > Don't expect text that size to be read by everyone? If the text is illegible to yo

Re: noob : congomongo to disk

2010-06-06 Thread Meikel Brandmeyer
Hi, On Jun 6, 11:26 pm, Brian Wolf wrote: > I'm not sure why it does this anyways, according to congomongo > documentation, 'fetch' is supoosed be returning in clojure format, not > mongo. The documentation means that you don't JSON back, but some clojure data structure. It contains two keys _i

Re: noob : congomongo to disk

2010-06-06 Thread Meikel Brandmeyer
Hi, On Jun 6, 11:15 pm, Brian Wolf wrote: > hmm.. not really 'printing', just trying to save what might be any > binary data in a clojure map, as I would save say, want to save gif > images  in a java or C array. at least that's the analogy I am > comparing this case to. This is the problem wit

Re: numerator fn

2010-06-06 Thread Dave Pawson
On 6 June 2010 13:35, Moritz Ulrich wrote: > On Sunday, June 6, 2010, Dave Pawson wrote: >> On 6 June 2010 11:00, Kevin Downey wrote: >>> numerator is added after 1.1.0 was released >> >> Thanks Kevin. >> documentation ahead of software! Nice change.. if confusing! > > Note the "Added in Clojure

Re: Complex type in clojure

2010-06-06 Thread ataggart
For what it's worth, I think something like 3+5i is perfectly reasonable as the + is not an operation, but part of the notation for a single value, just as the + is not an operation in 1.234e+14. The more troubling concern is whether the imaginary component should be suffixed with an i or a j. ;)

Re: interesting problem

2010-06-06 Thread ataggart
You can get the latest builds from http://build.clojure.org As for for problem, it is a near certainty that it's not a bug in clojure, and instead something is either alter/assoc'ing stuff onto the map held by global-ref-map2 or something is ref-set'ing local-ref- map1''s map onto global-ref-map2.

Re: mapping a collection and a "transposed" collection of collections

2010-06-06 Thread ataggart
Transposition is commonly done by applying map over the outer collection: user=> (vec (apply map vector [[:00 :01][:10 :11]])) [[:00 :10] [:01 :11]] On Jun 6, 5:54 am, Eugen Dück wrote: > P.S. The transpose fn is one of the cases where I'd like to have a > more general interleave fn, as lobbied

Re: mapping a collection and a "transposed" collection of collections

2010-06-06 Thread ataggart
(map list x (apply map list y)) On Jun 6, 5:51 am, Eugen Dück wrote: > Suppose I have two collections: > > (def x [1 2]) > (def y [[\a \b] [\d \e] [\f \g]]) > > And want to iterate over them in the following manner: > > user=> (map list x (transpose y)) > ((1 (\a \d \f)) > (2 (\b \e \g))) > > Whe

Re: interesting problem

2010-06-06 Thread Allan Moore
Okay, unfortunately with the new jar I am getting an error message when I try to load my code. I type: (load "Bugs") and I get: java.lang.ExceptionInInitializerError (bugs.clj:1) The first few lines of bugs.clj are: ; ; Bugs 0.01 ; (use

Re: interesting problem

2010-06-06 Thread Allan Moore
Okay, I have the jar. Thanks very much for posting that for me. I will try it out and let you know what happens. Are you part of the Clojure development team? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to cloj

Re: interesting problem

2010-06-06 Thread patrik karlin
Hey i uploaded a jar http://rapidshare.com/files/396096758/clojure-1.2.0-master-SNAPSHOT.jar.html works 10 times so hurry :D So i cant see whats wrong with your code from that snippet so try it out with 1.2 and if it doesn't work post it on github i am a bit suspicious about it being a bug :p 20

Re: interesting problem

2010-06-06 Thread Allan Moore
The actual code is identical to what I posted except for the variable names. Posting the actual code wouldn't help much unless I posted the entire program and I don't think you want to wade through that. Link is of type struct bar and it is passed in from the caller. Basically I have a bunch of

Re: interesting problem

2010-06-06 Thread patrik karlin
(dosync (alter local-ref-map1 assoc stuff stuff-struct)) (assert (not (@global-ref-map2 stuff))) so this asserts that the global map dosent hawe something bound to the key of what stuff is refering to. from this code i dont se what the data from link comes from or how its related to the globa

interesting problem

2010-06-06 Thread Allan Moore
I have a problem in my program. When I add something to a map, it also seems to get added to a completely different map. I catch the error with an assert on the line immediately following so there isn't much room for my program to do something wrong. The program does quite a bit of processing of

Re: noob : congomongo to disk

2010-06-06 Thread Brian Wolf
I'm not sure why it does this anyways, according to congomongo documentation, 'fetch' is supoosed be returning in clojure format, not mongo. On Jun 6, 12:54 pm, Meikel Brandmeyer wrote: > Hi, > > Am 06.06.2010 um 21:46 schrieb Brian Wolf: > > > But if print-dup is just seeing clojure.lang.Persist

Re: noob : congomongo to disk

2010-06-06 Thread Brian Wolf
hmm.. not really 'printing', just trying to save what might be any binary data in a clojure map, as I would save say, want to save gif images in a java or C array. at least that's the analogy I am comparing this case to. So, at least acording to this example, print- dup has to be extended to ever

Re: : Google Chrome extension for TryClojure (try-clojure.org)

2010-06-06 Thread Sean Corfield
I want to follow up on this and thank Sergey personally for contacting me on IM and working through some debugging with me until he identified Google Analytics as the likely culprit. He removed that and had me try 0.2.1 which worked perfectly! Thanx Sergey! On Mon, May 31, 2010 at 4:33 PM, Sean C

Re: : Google Chrome extension for TryClojure (try-clojure.org)

2010-06-06 Thread Sean Corfield
On Thu, Jun 3, 2010 at 6:15 PM, Rayne wrote: > I want to add paste, but I'd terribly hate to have to break tradition > with the other trylanguage sites. :< Until I read this part of the thread, I hadn't noticed that paste didn't work (since I was highlighting code and clicking the Try Clojure but

Re: noob : congomongo to disk

2010-06-06 Thread Meikel Brandmeyer
Hi, Am 06.06.2010 um 21:46 schrieb Brian Wolf: > But if print-dup is just seeing clojure.lang.PersistentArrayMap > objects, why does it matter what type it contains? Because the map contents also have to printed, no? This is a recursive process. Sincerely Meikel -- You received this message b

Re: noob : congomongo to disk

2010-06-06 Thread Brian Wolf
But if print-dup is just seeing clojure.lang.PersistentArrayMap objects, why does it matter what type it contains? On Jun 5, 11:09 pm, Meikel Brandmeyer wrote: > Hi, > > Am 06.06.2010 um 01:47 schrieb Brian Wolf: > > >      java.lang.IllegalArgumentException: No method in multimethod > > 'print-d

Re: mapping a collection and a "transposed" collection of collections

2010-06-06 Thread Eugen Dück
P.S. The transpose fn is one of the cases where I'd like to have a more general interleave fn, as lobbied for here: http://groups.google.com/group/clojure/t/c0366933a4333b69 Because with the current version of interleave: user=> (transpose [[1 2]]) java.lang.IllegalArgumentException: Wrong number

mapping a collection and a "transposed" collection of collections

2010-06-06 Thread Eugen Dück
Suppose I have two collections: (def x [1 2]) (def y [[\a \b] [\d \e] [\f \g]]) And want to iterate over them in the following manner: user=> (map list x (transpose y)) ((1 (\a \d \f)) (2 (\b \e \g))) Where this is the transpose fn: (defn transpose [in] (partition (count in) (apply interle

Re: (apply interleave [[1 2]])

2010-06-06 Thread Eugen Dück
And we could actually also add an no-arg version. My own version of interleave that I use looks like this: (defn interleav ([] nil) ([c] (seq c)) ([c1 c2] (interleave c1 c2)) ([c1 c2 & colls] (apply interleave c1 c2 colls))) I guess that's as generic as it gets. Does Rich read all thread

Re: numerator fn

2010-06-06 Thread Moritz Ulrich
On Sunday, June 6, 2010, Dave Pawson wrote: > On 6 June 2010 11:00, Kevin Downey wrote: >> numerator is added after 1.1.0 was released > > Thanks Kevin. > documentation ahead of software! Nice change.. if confusing! Note the "Added in Clojure version 1.2" in the documentation of numerator ;-) -

Re: Recur on a function which uses keyword arguments?

2010-06-06 Thread Nurullah Akkaya
(defn countdown [& {:keys [from] :or {from 10}}] (println from) (when (pos? from) (recur {:from (dec from)}))) Passing {:from (dec from)} instead of :from (dec from) works. Regards... -- Nurullah Akkaya http://nakkaya.com On Sun, Jun 6, 2010 at 2:22 PM,

Re: numerator fn

2010-06-06 Thread Meikel Brandmeyer
Hi, Am 06.06.2010 um 12:15 schrieb Dave Pawson: > On 6 June 2010 11:00, Kevin Downey wrote: >> numerator is added after 1.1.0 was released > > Thanks Kevin. > documentation ahead of software! Nice change.. if confusing! Note the small branch links on the left hand side: http://richhickey.git

Recur on a function which uses keyword arguments?

2010-06-06 Thread Jonas Enlund
The function definition below fails with "java.lang.IllegalArgumentException: Mismatched argument count to recur, expected: 1 args, got: 2" (defn countdown [& {:keys [from] :or {from 10}}] (println from) (when (pos? from) (recur :from (dec from Is it not possible t

Re: numerator fn

2010-06-06 Thread Dave Pawson
On 6 June 2010 11:00, Kevin Downey wrote: > numerator is added after 1.1.0 was released Thanks Kevin. documentation ahead of software! Nice change.. if confusing! regards -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk -- You received this message because you are subscr

Re: numerator fn

2010-06-06 Thread Kevin Downey
numerator is added after 1.1.0 was released On Sun, Jun 6, 2010 at 2:58 AM, Dave Pawson wrote: > On 6 June 2010 10:48, Kevin Downey wrote: >> http://github.com/richhickey/clojure/commit/5293929c99c7e1b1b3bcdea3d451108c5774b3d1 >> >> vs. >> >> http://github.com/richhickey/clojure/commit/5772be9fc

Re: numerator fn

2010-06-06 Thread Dave Pawson
On 6 June 2010 10:48, Kevin Downey wrote: > http://github.com/richhickey/clojure/commit/5293929c99c7e1b1b3bcdea3d451108c5774b3d1 > > vs. > > http://github.com/richhickey/clojure/commit/5772be9fc5ac9ddf92b727908c20b9aab971224a Have no meaning to me. sorry. -- Dave Pawson XSLT XSL-FO FAQ. Docb

Re: numerator fn

2010-06-06 Thread Kevin Downey
http://github.com/richhickey/clojure/commit/5293929c99c7e1b1b3bcdea3d451108c5774b3d1 vs. http://github.com/richhickey/clojure/commit/5772be9fc5ac9ddf92b727908c20b9aab971224a On Sun, Jun 6, 2010 at 2:38 AM, Dave Pawson wrote: > On 6 June 2010 10:37, Kevin Downey wrote: >> what version of clojur

Re: numerator fn

2010-06-06 Thread Dave Pawson
On 6 June 2010 10:37, Kevin Downey wrote: > what version of clojure are you using? --- Clojure 1.1.0 user=> > > On Sun, Jun 6, 2010 at 2:33 AM, Dave Pawson wrote: >> user=> (def pie 22/7) >> #'user/pie >> user=> (class pie) >> clojure.lan

Re: numerator fn

2010-06-06 Thread Kevin Downey
what version of clojure are you using? On Sun, Jun 6, 2010 at 2:33 AM, Dave Pawson wrote: > user=> (def pie 22/7) > #'user/pie > user=> (class pie) > clojure.lang.Ratio > user=> (numerator pie) > java.lang.Exception: Unable to resolve symbol: numerator in this > context (NO_SOURCE_FILE:19) > > An

numerator fn

2010-06-06 Thread Dave Pawson
user=> (def pie 22/7) #'user/pie user=> (class pie) clojure.lang.Ratio user=> (numerator pie) java.lang.Exception: Unable to resolve symbol: numerator in this context (NO_SOURCE_FILE:19) Any idea why please? Should return 22? http://richhickey.github.com/clojure/clojure.core-api.html#clojure.core/