Language Life
| Date: | 04/20/05 |
| Author: | Denys Duchier |
| URL: | n/a |
| Comments: | 0 |
| Info: | http://www.isg.sfu.ca/life/ |
| Score: |
<A HREF=http://www.isg.sfu.ca/life/>LIFE</A> is a constraint logic programming language.
%% LIFE version of 99 Bottles of beer
%% by Denys Duchier duchier@cs.sfu.ca
how_many(0) -> "no more".
how_many(N) -> N.
action(0) -> 99 | write("Go to the store and buy some more.\n").
action(N) -> N-1 | write("Take one down, pass it around.\n").
bottles(1) -> "bottle".
bottles(N) -> "bottles".
sing(N) :-
write(H:how_many(N)," ",B:bottles(N)," of beer on the wall, ",
H," ",B," of beer.\n"),
write(how_many(M:action(N))," ",bottles(M),
" of beer on the wall.\n\n"),
sing(M).
Download Source | Write Comment
Download Source | Write Comment
Add Comment
Please provide a value for the fields Name,
Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.
Please don't post large portions of code here! Use the form to submit new examples or updates instead!
Comments