I gave it a bit of thought, but I couldn't think of any good way to hash them correctly. So I just go through the list of functions from the top to the bottom. So the one that is defined first will be the one that is evaluated.
Good fun! I am actually not sure this kind of "power" is useful or more useful than normal macros but it is fun to invent esolangs. I actually had a very similar idea to this with patterns rather than functions or variables. But my syntax was rather awkward:
yours:let (foo ?a) = (bar ?a)
mine:foo x1 means bar x1
I was going for making a language that was essentially English, and grammatical. But it is impractical for when you pass a "function" another function the English becomes meaningless.
Isn't this just a macro system?
ttthttpd 1 year ago
Looks interesting... just one question: how does your language handle this?
let (foo ?a) => (id 1)
let (?a bar) => (id 2)
(foo bar)
thequux 2 years ago
I gave it a bit of thought, but I couldn't think of any good way to hash them correctly. So I just go through the list of functions from the top to the bottom. So the one that is defined first will be the one that is evaluated.
SturmDarkblade 2 years ago
Good fun! I am actually not sure this kind of "power" is useful or more useful than normal macros but it is fun to invent esolangs. I actually had a very similar idea to this with patterns rather than functions or variables. But my syntax was rather awkward:
yours:let (foo ?a) = (bar ?a)
mine:foo x1 means bar x1
I was going for making a language that was essentially English, and grammatical. But it is impractical for when you pass a "function" another function the English becomes meaningless.
Disprofuse 3 years ago
With pattern matching, one could easily define a crude english-like language. For example:
let (if ?a then ?b else ?c) => (if ?a ?b ?c)
or a 'english map' like:
let (map the pattern ?a across the list ?b) => (map ?a ?b)
To make the english make sense in a larger context, you could define specialized pattern such as:
let (?a and then reverse) => (reverse ?a)
So you could write stuff as:
((map the pattern double across the list (test scores)) and then reverse)
Almost english ;-)
SturmDarkblade 3 years ago