Seeing code type declarations

We can list both system types and user types using, respectively, stypes and types. Without arguments these will list all types. We can follow these with a comma separated list of atoms. The interpreter will respond by listing all types whose name includes one of the supplied atoms. For example
| ?? stypes line, term.


act get_line(Line : ?string, Stream : !stream_type default stdin)
"Read Line from Stream"

act put_line(Line : !string, Stream : !stream_type default stdout)
"Write Line to Stream"

rel copy_term(Term : @term, Copy : ??term)
"Copy Term with all variables in Term replaced by fresh variables."

act read_term(??term, Stream : !stream_type default stdin)
"Unifies its argument with the next term denoted by the next
sequence of characters in the stream followed by fullstop, return."

rel string2term(String : !string, Term : ??term)
"String is a string comprising the character sequence of a QuLog term.
Term is unified with that term."

rel term2string(Term : @term, String : ?string)
"Term is converted to String - the string representation of the term."
success

| ?? types curr.

fun curry(fun(T1, T2) -> T3) -> fun(T1) -> fun(T2) -> T3
"Curried form of F"
fun curryR(rel(T1, ??T2)) -> fun(T1) -> rel(??T2),
curryR(rel(T1, ?T2)) -> fun(T1) -> rel(?T2),
curryR(rel(T1, !T2)) -> fun(T1) -> rel(!T2)
fun uncurry(fun(T1) -> fun(T2) -> T3) -> fun(T1, T2) -> T3
fun uncurryR(fun(T1) -> rel(!T2)) -> rel(T1, !T2),
uncurryR(fun(T1) -> rel(?T2)) -> rel(T1, ?T2),
uncurryR(fun(T1) -> rel(?T2)) -> rel(T1, ?T2),
uncurryR(fun(T1) -> rel(??T2)) -> rel(T1, ??T2)

success

| ?? types tree2.

def tree2(N, L) ::= leaf(L) | none() |
node(tree2(N, L), N, tree2(N, L))
rel on_tree2(?tree_val(N, L), !tree2(N, L))
act to_parse_tree2(!list(string), ?parse_tree)
fun tree2list(tree(T)) -> list(T)
rel tree_to_tree2(!tree(T), ?tree2(T, T)),
tree_to_tree2(?tree(T), !tree2(T, T))

success

Similar to types, we can also show user code definitions using show as follows. This is similar to listing in Prolog. Note that both the type declaration and any "...." quoted comment string are displayed, along with the defining rules.

| ?? show age_. % This will show defs for all code beginning with age_

dyn age_of(H : human, A : age)
"H is a human, A is an age"
age_of(roger, 110)
age_of(tom, 26)
age_of(june, 23)
age_of(bill, 40)
age_of(mary, 40)
age_of(rose, 40)
age_of(penny, 1)

success

| ?? show inc.

act inc_a(?int)
"Increment the global value a and return the incremented value"
inc_a(N) ::
N = $a + 1 ~>
a +:= 1


fun inc(nat) -> nat
inc(N) -> N + 1


success