Hi,
I'm trying to split a string into a list of substrings, where substrings
are delimited by blank lines.
This feels like it *should* be a primitive operation, but I can't seem
to find one that works. It's neither a fold nor a partition, since each
chunk is separated by a 2-character sequence.
On 1/13/06, Adam Turoff [EMAIL PROTECTED] wrote:
Hi,
I'm trying to split a string into a list of substrings, where substrings
are delimited by blank lines.
This feels like it *should* be a primitive operation, but I can't seem
to find one that works. It's neither a fold nor a partition,
On 1/13/06, Sebastian Sylvan [EMAIL PROTECTED] wrote:
On 1/13/06, Adam Turoff [EMAIL PROTECTED] wrote:
Hi,
I'm trying to split a string into a list of substrings, where substrings
are delimited by blank lines.
This feels like it *should* be a primitive operation, but I can't seem
to
That works except it loses single newline characters.
let s = 1234\n5678\n\nabcdefghijklmnopq\n\n,,.,.,.
Prelude blocks s
[12345678,abcdefghijklmnopq,,,.,.,.]
Jared.
On 1/13/06, Sebastian Sylvan [EMAIL PROTECTED] wrote:
On 1/13/06, Sebastian Sylvan [EMAIL PROTECTED] wrote:
On 1/13/06, Adam
On 2006-01-13 at 13:32PST Jared Updike wrote:
That works except it loses single newline characters.
let s = 1234\n5678\n\nabcdefghijklmnopq\n\n,,.,.,.
Prelude blocks s
[12345678,abcdefghijklmnopq,,,.,.,.]
Also the argument to groupBy ought to be some sort of
equivalence relation.
blocks =
On Jan 13, 2006, at 4:35 PM, Jon Fairbairn wrote:
On 2006-01-13 at 13:32PST Jared Updike wrote:
That works except it loses single newline characters.
let s = 1234\n5678\n\nabcdefghijklmnopq\n\n,,.,.,.
Prelude blocks s
[12345678,abcdefghijklmnopq,,,.,.,.]
Also the argument to groupBy ought
On 1/13/06, Sebastian Sylvan [EMAIL PROTECTED] wrote:
blocks = map concat . groupBy (const (not . null)) . lines
Thanks. That's a little more involved than I was looking for, but that
certainly looks better than pattern matching on ('\n':'\n':rest). ;-)
For the record, lines removes the