Thank you for these solutions. You helped me a lot to get a tiny bit
of clojure. This is indeed a different way to think about problems. At
least it feels different to me.
On Mon, Jan 16, 2012 at 11:49 PM, Meikel Brandmeyer wrote:
> Hi,
>
> here another, slightly different, although in the core s
On Tue, Jan 17, 2012 at 12:20 AM, Brandon Harvey wrote:
> Sorry to be naive, but can I ask why you folks are not using recur?
Because we're using lazy-seq instead, which ends up having a similar
effect to trampoline (the "recursion" actually winds up as a
succession of calls to the function insid
Sorry to be naive, but can I ask why you folks are not using recur?
--
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
Note that posts from new members are moderated - please be patient with y
Hi,
here another, slightly different, although in the core similar solution.
(defn pair-seq
[lines]
(lazy-seq
(when-let [lines (seq lines)]
(let [line (first lines)
lines (next lines)
equal-sign (.indexOf line "=")
contd (take-whil
On Mon, Jan 16, 2012 at 5:28 PM, Cedric Greevey wrote:
> If you want a map, (into {} (extract ...)). The obvious input source
> is a line-seq obtained somehow. If you want spaces or newlines at the
> concatenation sites (e.g. "value3 takes some more lines as well" or
> "value3\ntakes some more lin
Something like:
(defn skv [str]
(seq (.split str " = " 2)))
(defn second-bit-not-equal-sign? [str]
(not (second (skv str
(defn extract* [lseq]
(when lseq
(lazy-seq
(let [[f & r] lseq]
(if (second-bit-not-equal-sign? f) (throw (Exception. "no key here")))
(let
Hi all,
I am looking for a function that gives me a lazy sequence from a
simple key, value file. Keys are words at the beginning of a line.
Value start after a key and can span multiple lines. Thus, a file
looks something like:
key1 = value1 is there
and continues
key2 = new value
key3 = value3
t