Re: the Result Type

2013-12-08 Thread Philippe Sigaud
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

Re: the Result Type

2013-12-08 Thread Ali Çehreli
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

Re: the Result Type

2013-12-08 Thread seany
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?

Re: the Result Type

2013-12-08 Thread bearophile
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

Re: the Result Type

2013-12-08 Thread Ali Çehreli
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

Re: the Result Type

2013-12-08 Thread Marco Leise
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

Re: the Result Type

2013-12-08 Thread Marco Leise
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

Re: the Result Type

2013-12-08 Thread 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? I dont find this in your book, would you consider either adding this Volodemrot types, or in case they already

Re: the Result Type

2013-12-08 Thread Ali Çehreli
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