Improved examples
This commit is contained in:
parent
60325b23a3
commit
205cd340b5
|
@ -1,4 +1,4 @@
|
||||||
?(?0 ()) (This example demonstrates how to implement combinatory calculus.)
|
?(?-) (This example demonstrates how to implement combinatory calculus.)
|
||||||
|
|
||||||
<> (M ?x) (?x ?x)
|
<> (M ?x) (?x ?x)
|
||||||
<> (KI ?x ?y) (?y)
|
<> (KI ?x ?y) (?y)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
?(?0 ()) (This example prints to the console and demonstrates how to delay the execution of a rule.)
|
?(?-) (This example prints to the console and demonstrates how to delay the execution of a rule.)
|
||||||
|
|
||||||
<> (NAME) (Modal)
|
<> (NAME) (Modal)
|
||||||
<> (?: print String) (?:)
|
<> (?: print String) (?:)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
?(?0 ()) (This example requests 3 line delimited strings from the console.)
|
?(?-) (This example requests 3 line delimited strings from the console.)
|
||||||
|
|
||||||
<> (read ?~) (?~)
|
<> (read ?~) (?~)
|
||||||
<> (?: print ') (?:)
|
<> (?: print ') (?:)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
?(?0 ()) (This example demonstrates how to keep the runtime active between prompts.)
|
?(?-) (This example demonstrates how to keep the runtime active between prompts.)
|
||||||
|
|
||||||
<> ((You said: quit\n) send) ((You quit.) print ')
|
<> ((You said: quit\n) send) ((You quit.) print ')
|
||||||
<> (?: print ') (?:)
|
<> (?: print ') (?:)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
?(?0 ()) (This example prints hello world to the console.)
|
?(?-) (This example prints hello world to the console.)
|
||||||
|
|
||||||
<> (send ?:) (?:)
|
<> (send ?:) (?:)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
?(?0 ()) (This example reverses the string modal, into ladom.)
|
?(?-) (This example reverses the string modal, into ladom.)
|
||||||
|
|
||||||
<> (reverse List () ?*) (?*)
|
<> (reverse List () ?*) (?*)
|
||||||
<> (reverse (?*)) (reverse List (?*) ())
|
<> (reverse (?*)) (reverse List (?*) ())
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
?(?-) (This example tests various aspects of the implementation.)
|
||||||
|
|
||||||
<> (explode ?*) (str (?*))
|
<> (explode ?*) (str (?*))
|
||||||
<> (reverse (str (?h ?t))) (reverse/l ?t (?h))
|
<> (reverse (str (?h ?t))) (reverse/l ?t (?h))
|
||||||
<> (reverse (str (?h))) (?h)
|
<> (reverse (str (?h))) (?h)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
?(?0 ()) (This example demonstrates how to implement a 2-players game of Tic Tac Toe)
|
?(?-) (This example demonstrates how to implement a 2-players game of Tic Tac Toe)
|
||||||
|
|
||||||
<> (-- ?x) ()
|
<> (-- ?x) ()
|
||||||
<> (READ ?~) (?~)
|
<> (READ ?~) (?~)
|
||||||
|
|
|
@ -140,12 +140,11 @@ parse_frag(char *s)
|
||||||
while((c = *s) && c <= ' ') s++;
|
while((c = *s) && c <= ' ') s++;
|
||||||
if(*s != ')' && *s != '<' && s[1] != '>') {
|
if(*s != ')' && *s != '<' && s[1] != '>') {
|
||||||
ss = walk(s);
|
ss = walk(s);
|
||||||
if(*s == '('){
|
if(*s == '(') {
|
||||||
s++;
|
s++;
|
||||||
while(s < ss-1) *dict_++ = *s++;
|
while(s < ss - 1) *dict_++ = *s++;
|
||||||
s++;
|
s++;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
while(s < ss) *dict_++ = *s++;
|
while(s < ss) *dict_++ = *s++;
|
||||||
}
|
}
|
||||||
*dict_++ = 0;
|
*dict_++ = 0;
|
||||||
|
|
Loading…
Reference in New Issue