A reducer is Signum's single callable form. It takes one argument (by convention called a) and returns one value.
@ double : a
((a * 2) >> se_ok) ->
..
(5 >> double) >> print ~~ prints 10
Compose by piping
@ shout : a
((a + "!") >> se_ok) ->
..
("hi" >> shout >> shout) >> print ~~ prints hi!!
Reducers are pure: same input, same output, every backend, every machine. There are no hidden globals and no I/O side effects inside a reducer unless it explicitly pipes into an io.* builtin.
Shapes
The argument a is usually a dict, which lets a reducer accept named fields and ignore the rest:
@ classify : a
n ~ a["n"]
? (n = 0) ("zero" >> se_ok) -> ..
("nonzero" >> se_ok) ->
..
{"n": 0, "note": "ignored"} >> classify >> print