3 ms·
I wonder how they handle array out-of-bounds accesses...
by tomp 8y ago
I wonder how they handle array out-of-bounds accesses...
- vilu 8y agoMaybe by making the API of index based list datatypes return the value inside of a container type. In general it's a helpful strategy when creating total functions.
- dleclere 8y agoLooks like they're using an indexed Algebraic Data Type. https://github.com/grain-lang/grain/blob/master/src/grain-stdlib/lists.grlib https://github.com/grain-lang/grain/blob/master/src/grain-st...
- masklinn 8y agoThere's no indexing in that.
- masklinn 8y agoLikely like Elm, where indexing into an array returns a Maybe. OOB return Nothing, while in-bound returns Just <value>. Or they don't support indexing at all.