Two dimensional matrix-like data type using lists and/or mutable lists
I am trying to think of an implementation of a two dimensional matrix-like data type.
Normally I would take an array of arrays but I’m bound to a relatively low language level which only provides lists and mutable lists, because this is part of (but not an exercise itself, I could simply use an inefficient solution) a software project at university. In this, we are only allowed to use a specific language level.
So of cause I could take a list of mutable lists and, in search of an item in row n and column m, get the m-th mutable list and go throught it until position n. But isn’t there a better solution than going through the whole list?
What is the minimum practical definition for the Scheme language?
What is the smallest practical set of primitives that can be used to define the Scheme language?
Scheme’s define in Common Lisp
In Common Lisp, we have to use the let
form to declare a new lexically-scoped variable. This means that the code either looks like that written in C89 (all variables declared on top of scope), or acquires unreadably deep nesting. let*
is somewhat useful, but is not always applicable.