Re: Casting the Result of splitter() into a string array

2012-06-17 Thread Trass3r
If you want to convert a range to an array, use std.array.array This is a constant source of confusion and it also is a crappy design to use a function in a totally different module for this purpose imho. Can't these Result types get an eval() method and/or be made implicitly convertible to

Re: Casting the Result of splitter() into a string array

2012-06-17 Thread Jonathan M Davis
On Sunday, June 17, 2012 14:11:27 GreatEmerald wrote: > On Sunday, 17 June 2012 at 11:58:58 UTC, Jonathan M Davis wrote: > > splitter(" a b ") is going to return a range of strings. If you > > were to do > > array(splitter("a b ")), you'd get ["", "a", "b"]. > > Aha, that worked! Thanks! > > Stil

Re: Casting the Result of splitter() into a string array

2012-06-17 Thread bearophile
GreatEmerald: A quick and simple question, but I couldn't find the answer to it by myself: how do I cast the return type of std.array.splitter() into a string[]? splitter(), filter(), etc, are lazy, they return an iterable. Use split() instead of splitter(). Bye, bearophile

Re: Casting the Result of splitter() into a string array

2012-06-17 Thread GreatEmerald
On Sunday, 17 June 2012 at 11:58:58 UTC, Jonathan M Davis wrote: splitter(" a b ") is going to return a range of strings. If you were to do array(splitter("a b ")), you'd get ["", "a", "b"]. Aha, that worked! Thanks! Still makes me wonder how you're supposed to figure out that this type is a

Re: Casting the Result of splitter() into a string array

2012-06-17 Thread Jonathan M Davis
On Sunday, June 17, 2012 13:39:19 GreatEmerald wrote: > A quick and simple question, but I couldn't find the answer to it > by myself: how do I cast the return type of std.array.splitter() > into a string[]? > > According to the compiler, splitter() has a return type Result. > How useful... I assu

Casting the Result of splitter() into a string array

2012-06-17 Thread GreatEmerald
A quick and simple question, but I couldn't find the answer to it by myself: how do I cast the return type of std.array.splitter() into a string[]? According to the compiler, splitter() has a return type Result. How useful... I assume it's a disguised tuple? If I try to simply assign the resu