3 ms·
> And that’s it! The Scan ‘n’ Span model is dramatically simpler than the pointer model. As an added bonus, it’s also way faster on account of not needing to bo
by thethirdone 5y ago
> And that’s it! The Scan ‘n’ Span model is dramatically simpler than the pointer model. As an added bonus, it’s also way faster on account of not needing to bother with constant array-indexing and bounds-checking.
I believe there should be an asterisk saying "in Idris". I don't believe this method removes any extra bounds checking or array-indexing at the assembly level.
I completely agree that in functional programing a dual list method makes more sense than an index into a list. I wouldn't be surprised if the compiler just optimizes better with the more functional code.
> Instead of a list, a single number can be used as a span. Implement Tape (ScanNSpan Nat). (Hint: this amounts to a sort of Gödel numbering.)
If you can restrict the `Color` to a finite set (which is necessary for any turing machine), you can just use multiplication and division which should be vastly faster than encoding based on primes.