3 ms·
Feels like an API that was backed by lazy cons lists like Haskell's would give you actual circular lists for free here.
by whateveracct 1y ago
Feels like an API that was backed by lazy cons lists like Haskell's would give you actual circular lists for free here.
- Jaxan 1y agoIt would still have a beginning. And it would not be “for free” as the used/seen part of the data structure would remain in memory.
- whateveracct 1y agoThe list in memory would not have duplicates (which this one seems to have) because the list itself would be cyclical. It could be infinite in both directions. That's just a zipper or ([a], a, [a])