Re: Partitioning a list when the result of a predicate becomes a certain value.

2012-05-12 Thread Ant
Thanks for the replies guys - has given me things to mull over. On Thursday, 10 May 2012 22:11:18 UTC+1, Ant wrote: > > Hi all, > > I am battering my head against the following problem which I'm sure is > straightforward if only I knew how. I want to partition t

Re: Partitioning a list when the result of a predicate becomes a certain value.

2012-05-10 Thread Ant
After posting, I had the idea of checking out the source for partition- by, and solved the problem: (defn partition-when "Applies f to each value in coll, splitting it each time f returns the specified value. Returns a lazy seq of partitions." [f value coll] (lazy-seq (when-let [s (s

Partitioning a list when the result of a predicate becomes a certain value.

2012-05-10 Thread Ant
Hi all, I am battering my head against the following problem which I'm sure is straightforward if only I knew how. I want to partition the following list: '("aa123" "x" "y" "z" "bb123" "ccq23" "3" "yg") into the following: (("aa123" "x" "y" "z") ("bb123") ("ccq23" "3" "yg")) The predicate is:

Re: Noob question on strings.

2008-12-09 Thread Ant
Hi all, > I think the reader gets confused after your initial "C:\dev\java > \clojure\clj-repl.bat" > If you start the repl again and try the string with \\ it works fine. > Also, when the reader gets confused by the above string, it seems to > miss the " at the end. If you enter a " by itself it

Noob question on strings.

2008-12-09 Thread Ant
Hi all, I've just started looking with interest at the language, and have decided to port some of my smaller programs and scripts to Clojure as a way of getting to know the language. I am stumbling over Strings at the moment, as I am trying to read a file. I have tried the following: user=> "C:\