2 ms·
First of all, a map can be defined as a list where the even elts are labels and the odd ones are values. So it would be a lot like lisp but every elt in every l
by javajosh 6y ago
First of all, a map can be defined as a list where the even elts are labels and the odd ones are values. So it would be a lot like lisp but every elt in every list would have an extra before it, a short string name.
- brabel 6y agoIt's the other way around, actually. If you define a map as a list, it will have none of the properties of a map: you can't lookup a key in constant time. But if you start with maps, then you can represent a list as a special case of a map in which the keys are integers that get incremented, starting at 0.
- Reelin 6y agoGP isn't talking about the runtime implementation but rather the serialization format. You can serialize a map as a list. Therefore, a hypothetical Lisp-like language based around maps could simply end up consisting of lists that contain key value pairs.