std.algorithm.splitter seems to return all its return values as a
type "Result", without quotes, and i dont not seem to be able to
cast it to string[] or int[] with cast(string[]) ( or even cast
(string) - i tried that too).
I tried to use a function
void function(T, R)(T arr, out R output)
On 12/08/2013 12:24 AM, seany wrote:
> std.algorithm.splitter seems to return all its return values as a type
> "Result", without quotes, and i dont not seem to be able to cast it to
> string[] or int[] with cast(string[]) ( or even cast (string) - i tried
> that too).
>
> I tried to use a funct
O_O
with that knowledge, would also be possible to define new types
(not aliases, but new encapsulated types) representing things
such as Graph, Ring, Topology, surreal number, etc?
I dont find this in your book, would you consider either adding
this Volodemrot types, or in case they already
Am Sun, 08 Dec 2013 09:24:53 +0100
schrieb "seany" :
> std.algorithm.splitter seems to return all its return values as a
> type "Result", without quotes, and i dont not seem to be able to
> cast it to string[] or int[] with cast(string[]) ( or even cast
> (string) - i tried that too).
>
> I t
Am Sun, 08 Dec 2013 09:59:55 +0100
schrieb "seany" :
> O_O
>
> with that knowledge, would also be possible to define new types
> (not aliases, but new encapsulated types) representing things
> such as Graph, Ring, Topology, surreal number, etc?
All these Result types are simply structs. Struct
On 12/08/2013 12:59 AM, seany wrote:
> I dont find this in your book, would you consider either adding this
> Volodemrot types,
I think at least a short mention is in order. :)
There are two reasons why they don't appear in the book (yet):
1) They are not a proper language feature, rather a ha
Ali Çehreli:
When you eagerly need an actual array of the elements, call
std.array.array on Result:
import std.array;
import std.algorithm;
void main()
{
auto input = "hello world";
auto splittedWords = input.splitter(' ').array;
Or just use the eager split() function.
Bye,
bearoph
On Sunday, 8 December 2013 at 11:02:40 UTC, Ali Çehreli wrote:
(I remember Andrei's original newsgroup post about this
discovery but I cannot find it at this time.)
http://www.digitalmars.com/d/archives/digitalmars/D/announce/Voldemort_Types_in_D_23511.html
this?
On 12/08/2013 03:41 AM, seany wrote:
On Sunday, 8 December 2013 at 11:02:40 UTC, Ali Çehreli wrote:
(I remember Andrei's original newsgroup post about this discovery but
I cannot find it at this time.)
http://www.digitalmars.com/d/archives/digitalmars/D/announce/Voldemort_Types_in_D_23511.html
On Sun, Dec 8, 2013 at 9:59 AM, seany wrote:
> O_O
>
> with that knowledge, would also be possible to define new types (not
> aliases, but new encapsulated types) representing things such as Graph,
> Ring, Topology, surreal number, etc?
Other posters already answered your questions concerning ran
prints:
["a", "b", "c", "d", "e"]
Result
What is the purpose of this 'Result' type? To serve as a generic
range? Because, it seems to only cause problems. For example,
you cannot assign or cast the result type into a range, even when
assert(c.equal(e));
typeof(c).stringof.writeln;
}
```
The program prints:
["a", "b", "c", "d", "e"]
Result
What is the purpose of this 'Result' type? To serve as a
generic range? Because, it seems to only cause problems. For
exam
typeof(c).stringof.writeln;
}
```
The program prints:
["a", "b", "c", "d", "e"]
Result
What is the purpose of this 'Result' type? To serve as a generic
range? Because, it seems to only cause problems. For example, you
cann
pose of this 'Result' type? To serve as a generic
> range?
It's a Voldemort type, representing a range that iterates over its
elements lazily.
> Because, it seems to only cause problems. For example, you cannot
> assign or cast the result type into a range, even when the
On Friday, 20 January 2023 at 03:30:56 UTC, Steven Schveighoffer
wrote:
On 1/19/23 10:11 PM, Ruby The Roobster wrote:
...
The point is to be a range over the original input, evaluated
lazily. Using this building block, you can create an array, or
use some other algorithm, or whatever you want.
On Fri, Jan 20, 2023 at 03:34:43AM +, Ruby The Roobster via
Digitalmars-d-learn wrote:
> On Friday, 20 January 2023 at 03:30:56 UTC, Steven Schveighoffer wrote:
> > On 1/19/23 10:11 PM, Ruby The Roobster wrote:
> > ...
> >
> > The point is to be a range over the original input, evaluated
> >
On 1/19/23 10:34 PM, Ruby The Roobster wrote:
On Friday, 20 January 2023 at 03:30:56 UTC, Steven Schveighoffer wrote:
On 1/19/23 10:11 PM, Ruby The Roobster wrote:
...
The point is to be a range over the original input, evaluated lazily.
Using this building block, you can create an array, or u
On Friday, 20 January 2023 at 03:11:33 UTC, Ruby The Roobster
wrote:
Take this example:
[...]
What is the purpose of this 'Result' type? To serve as a
generic range?
Yes this is a lazy input range. Use `.array` to yield directly as
a concrete value,
then you can append using `~=`.
Note tha
On Friday, 20 January 2023 at 03:11:33 UTC, Ruby The Roobster
wrote:
What is the purpose of this 'Result' type? To serve as a
generic range? Because, it seems to only cause problems...
No.
When I first started learning this language, I thought the same
thing. However, such a designm cons
On 1/19/23 19:11, Ruby The Roobster wrote:
> typeof(c).stringof.writeln;
> The program prints:
>
> ["a", "b", "c", "d", "e"]
> Result
>
> What is the purpose of this 'Result' type?
Just to make sure, 'Result' is what the programmer of a Phobos algorithm
chose to name a struct type. It cou
On Friday, 20 January 2023 at 04:46:07 UTC, Ali Çehreli wrote:
Different instantiations of templates are distinct types. For
example, if I called 'alternate' with two 'long' values, both
alternate!int (as instantiated by the code above) and
alternate!long would have different MyResult struct ty
On Friday, 20 January 2023 at 03:39:48 UTC, H. S. Teoh wrote:
On Fri, Jan 20, 2023 at 03:34:43AM +, Ruby The Roobster via
Digitalmars-d-learn wrote:
On Friday, 20 January 2023 at 03:30:56 UTC, Steven
Schveighoffer wrote:
> On 1/19/23 10:11 PM, Ruby The Roobster wrote:
> ...
>
> The point i
On Fri, Jan 20, 2023 at 12:49:54PM +, Ruby The Roobster via
Digitalmars-d-learn wrote:
[...]
> Thank you. I didn't know that there was such a property `.array`.
It's not a property, it's a Phobos function from std.array.
T
--
INTEL = Only half of "intelligence".
23 matches
Mail list logo