David Lambert wrote: > I wrote the rosetta code red-black tree entry. I haven't read/reviewed the Red-Black tree implementation on RosettaCode, but it did remind me of an argument I once made for supplying I. with an inverse [1]:
> I.-space is useful, particularly when the domain (input & output) > is boolean, but the translation is most easily expressed as arithmetic > on indicies. I've wanted this to locate the children in a binary tree > stored as a vector, for example: > > assert 'r' = red_black_tree #~ (# {. ([: , 1 2 +/~ +:)&. I) 'b' = > red_black_tree=.'brrbbbbrrr' This is an example of the kind of accomodations I believe we'd have to build into the language to make working with trees (again, as trees, not as a type of orthotopic array) simpler and more elegant. -Dan [1] "Proposed inverse for monad I.": http://www.jsoftware.com/pipermail/general/2006-April/026876.html ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm