machine-readable function type signature syntax
input -> output
inputs and outputs are separated by ->.
element1 element2 ...
multiple arguments are separated by a single space .
a b c -> d
element1/element2/...
alternative data types are separated by a slash /.
a b/c/d -> e a port/string/integer -> e
data-type:alias1:alias2
alternative names for a data type are separated by a colon :. data types always come first.
a b:c:d -> e a port:input-port:source -> e
[argument ...]
optional arguments are enclosed in square brackets [].
a [b c] -> d
element ...
indicates none or many consecutive occurrences of an element. use a space followed by three dots ....
a b ... c ... -> d
name :: arguments -> result
function names are specified by writing the identifier followed by a space and two colons ::.
name :: a b -> c
{signature}function signatures can be enclosed within curly brackets {} to represent functions or dictionaries. nesting is allowed.
{a ->}
function:{a ... -> list:b}
hashtable:{key -> value}(element ...)
lists and arrays are denoted using round brackets ().
(a (b c))
{key -> value}associations are represented similarly to functions and dictionaries using curly brackets {}.
:: input1 input2 -> output
multiline signatures start with two colons :: followed by a newline. inputs and outputs are listed on separate lines, with -> on a line by itself. the signature ends with the end of the string or two successive newline characters.
:: a b -> c line outside of signature
signature ::= input "->" output
multiple ::= element element ...
alternatives ::= element "/" element ...
names ::= type ":" alias ...
optional ::= "[" element ... "]"
repetition ::= element "..."
naming ::= name "::" arguments "->" result
list ::= "(" element ... ")"
map_or_function ::= "{" key_or_input "->" value_or_output "}"list splitting function:
list any [symbol:exclusive/inclusive] -> (list:left list:right)
function transformation:
function:{any -> boolean} function:{list:matched-elements -> list:replacements} list:source -> listcomplex multiline signature:
::
function:{alist:header function:fold-lines:{string:line any:result function:next:{any:result -> any} -> any} result -> any}
function:{header port result ->} any port [string]
->
anysph-lib includes a reader and writer