Hoeg
July 22, 2020 ยท View on GitHub
Hoeg
Hoeg is a concatenative style programming language implemented in Elixir.
What? and why?
Concatenative Programming is a style/paradigm that uses function composition instead of function application. "Why Concatenative Programming Matters" is a good article that explains the topic quite well. "The Joy of Concatenative Languages" blog post series is also nice.
For me Hoeg is more of a fun learning experience.
REPL
iex -S mix
Hoeg.REPL.start()
Stuff you can do
For bigger programs, check the examples dir.
IO
print. Ex:"hello world" print
Math
+, -, *, /, %. Ex:
14 8 + 2 * 2 -
Boolean logic
or. Ex:true false orand. Ex:true true andnot. Ex:false not>, >=, <, <=, ==, !=
Definitions
Defines a new "function".
hoeg> foo: 1 2 +;
hoeg> foo
hoeg> 3
List operations
cons. Ex:1 0 [] cons conswill create a list[1 0]being left on the stack.
Ideas
Just putting down some things I'd like to explore.
- GenServers and Supervisors. How would this work? Maybe a good idea to first introduce something around Task.async.
- Nice enough error messages. Need line numbers (and position), and explanation.
- Pattern matching...?
Installation
If available in Hex, the package can be installed
by adding hoeg to your list of dependencies in mix.exs:
def deps do
[
{:hoeg, "~> 0.2.0"}
]
end
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/hoeg.