Re: Recursion Problem?

2009-11-05 Thread John Harrop
On Thu, Nov 5, 2009 at 7:48 PM, Don wrote: > I'm having problems with a recursive call I make. The problem (as far > as I gather) is that I have two recursive calls within a condition and > I'm not sure if the second recursive call is being made. > It is, but some results are being discarded.

Re: Q: Are the docs for next incorrect?

2009-11-05 Thread MarkSwanson
> I wouldn't bother. The semantics are essentially what the present docs say; > it's just that where calling seq on its argument would just call a method > whose body is "return this;" it skips that no-op for efficiency. (At least, > the body of ASeq.seq() is "return this;"; are there any ISeq im

Re: clj-iter, an iteration macro for Clojure inspired by Common Lisp's Iterate

2009-11-05 Thread Timothy Pratley
On Nov 6, 12:51 pm, Daniel Janus wrote: > As another example, consider multiplying the first 42 elements of a > list of numbers by 42, and leaving the rest unchanged. It's much more > straightforward for me to write (and then read) > > (iter (for x in lst) >      (for i from 0) >      (collect (

Recursion Problem?

2009-11-05 Thread Don
I'm having problems with a recursive call I make. The problem (as far as I gather) is that I have two recursive calls within a condition and I'm not sure if the second recursive call is being made. After both recursive calls have completed, I combine their results with 'rslt' to form a new vector

Re: clj-iter, an iteration macro for Clojure inspired by Common Lisp's Iterate

2009-11-05 Thread Daniel Janus
On 6 Lis, 02:02, John Harrop wrote: > On Thu, Nov 5, 2009 at 7:03 PM, Daniel Janus wrote: > > To avoid citing the entire README blurb, I'll just give you some > > examples: > > >    (iter (for x in [31 41 59 26]) > >          (for y from 1) > >          (collect (+ x y))) > >    ==> (32 43 62 30

Re: [ANN] clj-iter, an iteration macro for Clojure inspired by Common Lisp's Iterate

2009-11-05 Thread John Harrop
On Thu, Nov 5, 2009 at 7:03 PM, Daniel Janus wrote: > To avoid citing the entire README blurb, I'll just give you some > examples: > >(iter (for x in [31 41 59 26]) > (for y from 1) > (collect (+ x y))) >==> (32 43 62 30) > >(iter (for s on [1 2 3 4 5]) >(for

Re: clj-iter, an iteration macro for Clojure inspired by Common Lisp's Iterate

2009-11-05 Thread kyle smith
What's wrong with (map + [31 41 59 26] (iterate inc 1)) ? (use 'clojure.contrib.seq-utils) (defn sliding-window [coll size] (let [idx (into {} (indexed coll))] (map #(vals (select-keys idx (range (- % size) (+ % size 1 (range (count coll) This is the same as your second

Re: Q: Are the docs for next incorrect?

2009-11-05 Thread John Harrop
On Thu, Nov 5, 2009 at 7:24 PM, MarkSwanson wrote: > On Nov 5, 7:00 pm, MarkSwanson wrote: > > (def > > #^{:arglists '([coll]) > > :tag clojure.lang.ISeq > > :doc "Returns a seq of the items after the first. Calls seq on its > > argument. If there are no more items, returns nil."} > >

Re: Code formatter

2009-11-05 Thread John Harrop
On Thu, Nov 5, 2009 at 4:57 PM, jan wrote: > John Harrop writes: > > > The following, which I relinquish into the public domain and certify is > > original to me, takes a string and reformats it as Clojure code, > returning a > > string. It behaves similarly to the Enclojure reformatter, but: >

Re: [ANN] clj-iter, an iteration macro for Clojure inspired by Common Lisp's Iterate

2009-11-05 Thread Stefan Arentz
On 2009-11-05, at 7:03 PM, Daniel Janus wrote: > > Dear all, > > I am happy to announce the public availability of clj-iter, an > Iterate- > like iteration macro. It is free (available under the terms of MIT > license) and can be found on GitHub: http://github.com/nathell/clj- > iter > > The

Re: Q: Are the docs for next incorrect?

2009-11-05 Thread MarkSwanson
On Nov 5, 7:00 pm, MarkSwanson wrote: > (def >  #^{:arglists '([coll]) >     :tag clojure.lang.ISeq >     :doc "Returns a seq of the items after the first. Calls seq on its >   argument.  If there are no more items, returns nil."} >  next (fn next [x] (. clojure.lang.RT (next x > > PROBLEM:

[ANN] clj-iter, an iteration macro for Clojure inspired by Common Lisp's Iterate

2009-11-05 Thread Daniel Janus
Dear all, I am happy to announce the public availability of clj-iter, an Iterate- like iteration macro. It is free (available under the terms of MIT license) and can be found on GitHub: http://github.com/nathell/clj-iter The design goal was to keep it as simple as possible, and make it blend wel

Q: Are the docs for next incorrect?

2009-11-05 Thread MarkSwanson
(def #^{:arglists '([coll]) :tag clojure.lang.ISeq :doc "Returns a seq of the items after the first. Calls seq on its argument. If there are no more items, returns nil."} next (fn next [x] (. clojure.lang.RT (next x PROBLEM: seq is not called on its argument. I think the second

Re: Code formatter

2009-11-05 Thread jan
John Harrop writes: > The following, which I relinquish into the public domain and certify is > original to me, takes a string and reformats it as Clojure code, returning a > string. It behaves similarly to the Enclojure reformatter, but: > 1. Outside string literals and comments, it will take c

Re: Baffled by NPE

2009-11-05 Thread John Harrop
On Thu, Nov 5, 2009 at 3:53 PM, Meikel Brandmeyer wrote: > Hi, > > Am 03.11.2009 um 22:41 schrieb jan: > > > (defn for-each [f items] > > (when-not (empty? items) > > (f (first items)) > > (recur f (rest items > > And to not defeat the learning exercise... > > (defn for-each >

Re: Baffled by NPE

2009-11-05 Thread Meikel Brandmeyer
Hi, Am 03.11.2009 um 22:41 schrieb jan: > (defn for-each [f items] > (when-not (empty? items) > (f (first items)) > (recur f (rest items And to not defeat the learning exercise... (defn for-each [f items] (when-let [s (seq items)] (f (first s)) (recur f (next s)

Re: Continuous Integration Server & Maven/Ivy Repo

2009-11-05 Thread Tim Dysinger
I had to move the repository url. I was having trouble with it on the same url and hudson. Plus you can't poke around because hudson would take the request. So the new url is http://build.clojure.org/snapshots for maven2/ivy/etc Sorry I changed it 8 hours ago and forgot to post. :( On Wed, N

Re: Running out of memory when using loop/recur and destructuring

2009-11-05 Thread Paul Mooser
It does make me wonder, however, if having the lazy-seq cache things is sort of conflating laziness and consistency, since as you point out, not all ISeq implementations do any sort of caching. I wonder if it would be interesting to decompose it into 'lazy- seq' (uncached), and 'cached-seq'. I un

Code formatter

2009-11-05 Thread John Harrop
The following, which I relinquish into the public domain and certify is original to me, takes a string and reformats it as Clojure code, returning a string. It behaves similarly to the Enclojure reformatter, but: 1. Outside string literals and comments, it will take care of all spacing. 2. Comme