What is a primitive?
mlochbaum.github.io
What is a primitive?
1–10 of 19 posts
Re: What is a primitive?
#2Re: What is a primitive?
#3Some 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"
Re: What is a primitive?
#4Re: What is a primitive?
#5When 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".
Re: What is a primitive?
#6Along vaguely related lines is https://gist.github.com/chrispsn/b1020918a83a28ab8b4442d8aff...
Re: What is a primitive?
#7When 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"
Re: What is a primitive?
#8When 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"
Are you saying that you consider strings in Haskell to be a primitive?
The languages i’ve written are pretty basic. e.g. the data types might be
- Number - String - True, false, null - Array of values - Record of fields (key + value) - Variant of options (key + value)
So the distinction is clearer.
Re: What is a primitive?
#9Author here if you have any questions. The main reason to write this document is people used to APL wondering why BQN leaves out certain primitives (answer: I don't think they're really primitives), but probably more HNers would wonder why it has so many that ASCII isn't even fit to keep them all (the full list is at https://mlochbaum.github.io/BQN/doc/primitive.html ). Just as well; hopefully I've addressed both con…
Re: What is a primitive?
#10Author here if you have any questions. The main reason to write this document is people used to APL wondering why BQN leaves out certain primitives (answer: I don't think they're really primitives), but probably more HNers would wonder why it has so many that ASCII isn't even fit to keep them all (the full list is at https://mlochbaum.github.io/BQN/doc/primitive.html ). Just as well; hopefully I've addressed both con…
What tool did you use to make those diagrams?
[1] https://raw.githubusercontent.com/mlochbaum/BQN/master/comme...