Displaying 1 result from an estimated 1 matches for "maxheap".
Did you mean:
maxgap
2009 Jan 25
3
Defining an iterator
...efine an iterator.
First I tried overloading `for` to allow the definition of iterator
classes, but as a primitive function, `for` cannot be overloaded.
Then I tried to see how the Containers package handles iterators:
> library(Containers);.jinit();.jpackage("Containers")
> ah = MaxHeap(); ah$insert(3)
> for (i in ah) print(i)
[1] NA
> as.list(ah)
[[1]]
[1] NA
Bit it appears that the Containers package's Iterators don't interface
with R's `for` or type conversion system.
So I gave up on iterators, but thought I'd try automatic conversion to lists.
So I def...