Alcoveloading
Adderloading
Update Modeon input
Adder syntax in 60 seconds
Adder is a thin, indentation-based surface over Alcove. It transpiles to the same S-expressions, runs on the same runtime, and shares every builtin — only the way code looks changes:
- Calls drop the outer parens:
map f xsmeans(map f xs). Inline parens still work where they read better, e.g.(+ 1 2). - A line ending in
:opens an indented block — the more-indented lines below become its trailing elements, sohead args:+ body becomes(head args body…). - Assignment is
setf(the alias of=). A baresetis the set constructor, just like Alcove. - Quote is
'x. A comment is#followed by a space, to end of line; a#glued to a token is instead a literal:#[1 2 3]vector,#{1 2 3}set,#b"bytes"blob,#\cchar.;also starts a comment. These print-forms re-read, so a value you print can be pasted straight back.
So the keyspace form (with-db 0 …) — run the body with
database 0 selected — is written:
with-db 0:
redis-set "name" "Ada"
redis-val "name" # => b"Ada" (bytes), scoped to db 0
and a function with a loop:
def sum-to (n):
setf total 0
for i 1 n:
setf total (+ total i)
total
Both transpile to ordinary Alcove and behave identically. Each example below runs the same program through the Alcove and Adder readers so you can compare them side by side.