With the simple typing list(top) a type error is overseen.
File flatten
Output of type checking (flatten.tap)
No improvement in typing, but the malformed list [1|2] causes a Prolog failure:
File flatten_improved
Output of type checking (flatten_improved.tap)
Problem: typing an embedded list
The following examples offer some solutions.
Possibilities for typing a list of atomics and lists
use of list(top)
File list_top
Output of type checking (list_top.tap)
use of special type element(T)
File list_element
Output of type checking (list_element.tap)
A commalist is a structure like "(1, 3, 2, 4)"
Problem: Contrary to a normal list structure, a commalist has no end-element like "[]"
use of special type element(T)
File commalist
Output of type checking (commalist.tap)
use of special type element(T)
File pred
Output of type checking (pred.tap)
PREV: Predicate declaration examples |
NEXT: Syntax of meta-type |