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
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
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
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
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
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