Quick Start¶
Run the REPL¶
makrell
Example session¶
> 2 + 3
5
> [2 3 5] | sum
10
What this shows¶
Even the smallest REPL session already shows two common family patterns:
ordinary expressions such as
2 + 3pipeline-oriented usage such as
[2 3 5] | sum
Run a script¶
makrell myscript.mr
Small example¶
{fun add [x y]
x + y}
add3 = {add 3 _}
[2 5 8] | {map add3} | sum
What to notice¶
This small example introduces several MakrellPy basics at once:
funfor function definitionplaceholder-based partial application with
_a pipeline-oriented way of writing data flow
Async example¶
{import asyncio}
{async fun just_sleep [n]
{await {asyncio.sleep n}}
n + 2}
{async fun main []
n = {await {just_sleep 1}}
{print n}}
{asyncio.run {main}}
MakrellPy already supports the shared family baseline of {async fun ...}
and {await ...}, and it also goes further with Python-shaped async forms
such as async for and async with.