|
|
|
|
|
by armchairhacker
1783 days ago
|
|
When I write programming languages, I usually define primitives as "any value without children". Strings, numbers, booleans, are primitives. Collections and records are not. Some edge cases: literal ranges would be primitives, because their ast is represented (in Haskell) as "Range Int Int". Ranges which take values wouldn't be primitives, because their ast is represented as "Range expr expr" |
|
In contrast, primitives are the starting point for programming, particularly tacit programming ("point-free" in Haskell). While the two names have a similar meaning, I think it fits a little better to call values that are indivisible from a particular perspective "atoms" and the ones that are meant to really be fundamental "primitives".
[0] https://mlochbaum.github.io/BQN/doc/types.html
[1] https://mlochbaum.github.io/BQN/doc/train.html