Re: phobos and splitting things... but not with whitespace.

2012-06-24 Thread simendsjo
On Sun, 24 Jun 2012 10:02:07 +0200, Roman D. Boiko wrote: Just found a follow-up post: http://dblog.aldacron.net/2012/06/24/my-only-gripes-about-d/ Just found it myself. RSS for the win :) I can't say I disagree. You have to read through several modules to find what you need: std.string, s

Re: phobos and splitting things... but not with whitespace.

2012-06-24 Thread Roman D. Boiko
Just found a follow-up post: http://dblog.aldacron.net/2012/06/24/my-only-gripes-about-d/

Re: phobos and splitting things... but not with whitespace.

2012-06-23 Thread Chad J
On 06/23/2012 03:41 PM, simendsjo wrote: On Sat, 23 Jun 2012 20:41:29 +0200, Chad J wrote: IMO the "take away a single line" thing should be accomplishable with a single concise expression This takes a range to match against, so much like startsWith: auto findSplitAny(Range, Ranges...)(Rang

Re: phobos and splitting things... but not with whitespace.

2012-06-23 Thread Chad J
On 06/23/2012 02:53 PM, simendsjo wrote: On Sat, 23 Jun 2012 20:41:29 +0200, Chad J wrote: Hey, thanks for doing all of that. I didn't expect you to write all of that. np Once I've established that the issue isn't just a lack of learning on my part, my subsequent objective is filling any m

Re: phobos and splitting things... but not with whitespace.

2012-06-23 Thread simendsjo
On Sat, 23 Jun 2012 20:41:29 +0200, Chad J wrote: IMO the "take away a single line" thing should be accomplishable with a single concise expression This takes a range to match against, so much like startsWith: auto findSplitAny(Range, Ranges...)(Range data, Ranges matches) { auto rest

Re: phobos and splitting things... but not with whitespace.

2012-06-23 Thread simendsjo
On Sat, 23 Jun 2012 20:41:29 +0200, Chad J wrote: Hey, thanks for doing all of that. I didn't expect you to write all of that. np Once I've established that the issue isn't just a lack of learning on my part, my subsequent objective is filling any missing functionality in phobos.

Re: phobos and splitting things... but not with whitespace.

2012-06-23 Thread Chad J
On 06/23/2012 02:17 PM, simendsjo wrote: On Sat, 23 Jun 2012 19:52:32 +0200, Chad J wrote: As an additional note: I could probably do this easily if I had a function like findSplit where the predicate is used /instead/ of a delimiter. So like this: auto findSplit(alias pred = "a", R)(R haysta

Re: phobos and splitting things... but not with whitespace.

2012-06-23 Thread simendsjo
On Sat, 23 Jun 2012 19:52:32 +0200, Chad J wrote: As an additional note: I could probably do this easily if I had a function like findSplit where the predicate is used /instead/ of a delimiter. So like this: auto findSplit(alias pred = "a", R)(R haystack); ... auto tuple = findSplit!(

Re: phobos and splitting things... but not with whitespace.

2012-06-23 Thread Chad J
On 06/23/2012 01:24 PM, Chad J wrote: On 06/23/2012 01:02 PM, simendsjo wrote: On Sat, 23 Jun 2012 18:56:24 +0200, simendsjo wrote: On Sat, 23 Jun 2012 18:50:05 +0200, Chad J wrote: Looking for findSplit? http://dlang.org/phobos/std_algorithm.html#findSplit Cool, that's what I want! Now if

Re: phobos and splitting things... but not with whitespace.

2012-06-23 Thread Chad J
On 06/23/2012 01:02 PM, simendsjo wrote: On Sat, 23 Jun 2012 18:56:24 +0200, simendsjo wrote: On Sat, 23 Jun 2012 18:50:05 +0200, Chad J wrote: Looking for findSplit? http://dlang.org/phobos/std_algorithm.html#findSplit Cool, that's what I want! Now if I could find the elegant way to remove

Re: phobos and splitting things... but not with whitespace.

2012-06-23 Thread simendsjo
On Sat, 23 Jun 2012 18:56:24 +0200, simendsjo wrote: On Sat, 23 Jun 2012 18:50:05 +0200, Chad J wrote: Looking for findSplit? http://dlang.org/phobos/std_algorithm.html#findSplit Cool, that's what I want! Now if I could find the elegant way to remove exactly one line from the text wi

Re: phobos and splitting things... but not with whitespace.

2012-06-23 Thread simendsjo
On Sat, 23 Jun 2012 18:50:05 +0200, Chad J wrote: Looking for findSplit? http://dlang.org/phobos/std_algorithm.html#findSplit Cool, that's what I want! Now if I could find the elegant way to remove exactly one line from the text without scanning the text after it... Isn't that exactly

Re: phobos and splitting things... but not with whitespace.

2012-06-23 Thread Chad J
On 06/23/2012 11:44 AM, simendsjo wrote: On Sat, 23 Jun 2012 17:39:55 +0200, Chad J wrote: On 06/23/2012 11:31 AM, simendsjo wrote: On Sat, 23 Jun 2012 17:19:59 +0200, Chad J wrote: http://dlang.org/phobos/std_array.html#splitter The first thing I don't understand is why splitter is in /

Re: phobos and splitting things... but not with whitespace.

2012-06-23 Thread simendsjo
On Sat, 23 Jun 2012 17:39:55 +0200, Chad J wrote: On 06/23/2012 11:31 AM, simendsjo wrote: On Sat, 23 Jun 2012 17:19:59 +0200, Chad J wrote: http://dlang.org/phobos/std_array.html#splitter The first thing I don't understand is why splitter is in /std.array/ and yet only works on /string

Re: phobos and splitting things... but not with whitespace.

2012-06-23 Thread Chad J
On 06/23/2012 11:31 AM, simendsjo wrote: On Sat, 23 Jun 2012 17:19:59 +0200, Chad J wrote: http://dlang.org/phobos/std_array.html#splitter The first thing I don't understand is why splitter is in /std.array/ and yet only works on /strings/. It is defined > in terms of whitespace, and I don't

Re: phobos and splitting things... but not with whitespace.

2012-06-23 Thread Chad J
I'm realizing that if I want to remove exactly one line from a string of text and make no assumptions about the type of newline ("\n" or "\r\n" or "\r") and without scanning the rest of the text then I'm not sure how to do this with a single call to phobos functions. I'd have to use indexOf an

Re: phobos and splitting things... but not with whitespace.

2012-06-23 Thread simendsjo
On Sat, 23 Jun 2012 17:19:59 +0200, Chad J wrote: http://dlang.org/phobos/std_array.html#splitter The first thing I don't understand is why splitter is in /std.array/ and yet only works on /strings/. It is defined > in terms of whitespace, and I don't understand how whitespace is well-de

phobos and splitting things... but not with whitespace.

2012-06-23 Thread Chad J
http://dlang.org/phobos/std_array.html#splitter The first thing I don't understand is why splitter is in /std.array/ and yet only works on /strings/. It is defined in terms of whitespace, and I don't understand how whitespace is well-defined for things besides text. Why wouldn't it be in std