Does D have "structural sharing" of immutable collections?
Roman D. Boiko
rb at d-coding.com
Wed May 23 14:54:42 PDT 2012
On Wednesday, 23 May 2012 at 19:51:02 UTC, Steven Schveighoffer
wrote:
> If you need a sorted tree structure that supports sharing
> immutable state, you likely have to find a different algorithm
> than redblack, since adding nodes can modify the tree structure
> via rotates.
>
> -Steve
I don't need to invent here, and it is definitely feasible.
Okasaki provided efficient algorithm for inserting nodes, and,
IIRC, rotations (not for deleting, though). But OCaml doesn't map
to D easily (neither does Haskel, I think).
A side note, I've learned D and switched to Linux in February
'12, so I struggle with newbie problems regularly...
More information about the Digitalmars-d
mailing list