-
Notifications
You must be signed in to change notification settings - Fork 0
/
docs9.txt
20 lines (13 loc) · 983 Bytes
/
docs9.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Mode Statements
* In the following,
test_types_cases(2,`[[n,function],[[v,a],[v,b],[v,c]]]`,
`[[[n,function],[[t,number],[t,string],[t,predicatename]]]]`,
`[[[n,function],[output,output,output]]]`,
[
`[[n,function],[[v,a],[v,b],[v,c]],":-",[[[n,=],[[v,a],1]],[[n,=],[[v,b],"a"]],[[n,=],[[v,c],[n,a]]]]]`
],
`[[[[v,a], 1],[[v,b], "a"],[[v,c], [n,a]]]]`).
* `[[[n,function],[output,output,output]]]`, is the mode statement, which must follow the type statement (although these are optional). The Mode Statement specifies whether each of the variables takes input or gives output.
# Functional List Prolog (FLP)
* List Prolog has an optional functional mode. In FLP, function calls may be passed as variables and functions may have strong types.
* Functional algorithms may be recursive (see test 7 in <a href="https://github.com/luciangreen/listprologinterpreter/blob/master/lpiverify4_types.pl">lpiverify4_types.pl</a>), i.e. they may repeat until triggering the base case: