Making generalized Trie type in D
Roman D. Boiko
rb at d-coding.com
Mon Jun 4 22:20:06 PDT 2012
On Tuesday, 5 June 2012 at 04:42:07 UTC, Dmitry Olshansky wrote:
> On 05.06.2012 2:28, Roman D. Boiko wrote:
>> My example concern was about fundamental problem of range APIs
>> for
>> immutable data structures, which is not possible to emulate:
>> popFront is
>> mutating by design.
>
> Keep in mind Ranges are temporary object most of the time. They
> are grease for wheels of algorithms. Given data structure S,
> it's range is R(element of S). Thus for immutable data
> structure range will be mutable entity of immutable element
> type.
>
> Interesting example is immutable strings, that still have
> ranges over them, that even return dchar not an immutable(char).
I'm currently trying this approach (instead of working with
immutable data structures directly, which would require recursion
everywhere) in my experimental functional data structures, and it
looks promising. :)
More information about the Digitalmars-d
mailing list