function type signature notation

machine readable function type signature syntax



expressions separated by: "->"

example: input -> output

example: input ->

output arguments are optional. if left-out the output is unspecified

multiple arguments

expressions separated by a space character: " "

example: a b c -> d

alternative data-types

expressions separated by a slash: "/"

example: a b/c/d -> e

example: a port/string/integer -> e

alternative names

expressions separated by a colon: ":"

example: a b:c:d -> e

data-types always come first


example: a port:input-port:source -> e

optional arguments

enclosed with square brackets: []

example: a [b c] -> d


none or many consecutive occurences of an expression

expression followed by a space character and three dots: " ..."

example: a b ... c ... -> d

function-name specification

identifier followed by a space character and two colons: " ::"

example: name :: a b -> c

procedures, dictionaries

a function signature enclosed with curly brackets: "{" "}"

unlimited nesting

example: {a ->}

example with data-type: procedure:{a ... -> list:b}

example: hashtable:{key -> value}

lists, vectors, pairs, and more

using scheme read syntax

example list: (a (b c))

example vector: #(a #(b c))

example using both: (integer #(char ...))

multiline signatures

two colons followed by a newline, optionally followed by one or multiple input expressions per line separated by newlines, a line with only a "->", optionally followed by output expression separated by newlines, ending with end-of-string or two successive newline characters



line outside of signature


list any [symbol:exclusive/inclusive] -> (list:left list:right)
procedure:{any -> boolean} procedure:{list:matched-elements -> list:replacements} list:source -> list
procedure:{alist:header procedure:fold-lines:{string:line any:result procedure:next:{any:result -> any} -> any} result -> any}
procedure:{header port result ->} any port [string]


reading/parsing and writing can be done with (sph lang parser type-signature)

tags: start q1 syntax specification type-signature computer