On Mon, Jan 16, 2012 at 5:28 PM, Cedric Greevey <cgree...@gmail.com> 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 lines\nas well") in the output, change (apply > str v p1) to (apply str v (interleave (repeat \space) p1)) or (apply > str v (interleave (repeat \newline) p1)).
Addendum: it looks like maybe you wanted a sequence of strings instead of a single string as the value, i.e. a sub-line-seq. If so, just change (apply str v p1) to (cons v p1)! Also, note that I didn't use interpose in the above rather than interleave because it would omit a delimiter between the value start in v and the first continuation of it in p1. Adding an explicit extra \space or \newline between v and (interpose ...) would result in single-line values having a trailing space or newline, which I assumed was undesirable (particularly as you clearly started your processing by trimming blanks from the ends of input lines!); interleave, on the other hand, gives exactly the desired result, prefixing every item in p1 with the delimiter, including the first, and emitting no delimiters if p1 is empty. -- 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 your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en