Hi Greg,
Welcome to Clojure!
I haven't scrutinized your code, but at a glance it looks like your
implementations are very idiomatic.
It also seems right to me that these functions can't be implemented directly
in terms of take-while and partition-by. Without more thought I can't say if
there are
That implementation of partitions feels really low level. If you
implement the monadic version of partition-when (which I call
partition-where in my own code), it looks as simple as this:
(defn partitions [xs]
(run-seq (m-partition-where (const [false true]) xs)))
-Per
On Wed, Mar 17, 2010 at
Hey thanks :) These are different than partition-by and take-while.
partition-by triggers a new partition when the predicate value
*changes*, whereas partition-when triggers a new partition at any
point in the sequence where the predicate is true. take-while takes
all the items up to the point in
Hey Greg, welcome to Clojure :)
You might want to take a look at c.c.seq-utils and the clojure cheat
sheet. Both of these already exist. See take-while & partition-by
The cheat sheet can be found here:
http://clojure.org/cheatsheet
On Mar 16, 11:12 pm, Greg Fodor wrote:
> Just saw that I ne
Just saw that I need to sign the contributor agreement. Will do
promptly. I additionally have implemented two new functions that I
believe could fit in clojure-contrib.seq and clojure-
contrib.combinatorics. The seq function partition-at-fenceposts allows
you to partition a seq based upon bits flip
Hi there, I am just learning Clojure and am processing some BER
encoded integer values. Basically, the most significant bit of the
integer in the stream indicates the split point between integers, and
so I was looking into partition-by to see if that would help. Turns
out, what I really need are tw