Content deleted Content added
Hairy Dude (talk | contribs) →Overview: "cut" is not a prolog keyword, it's spelled "!" Tags: Mobile edit Mobile web edit |
Hairy Dude (talk | contribs) →Examples: example of state variable desugaring Tags: Mobile edit Mobile web edit |
||
Line 129:
io.nl(!IO).
% Could instead use io.format("fib(10) = %d\n", [i(fib(10))], !IO).
</source>
<code>!IO</code> is a "state variable", which is [[syntactic sugar]] for a pair of variables which are assigned concrete names at compilation; for example, the above is desugared to something like:
<source lang="prolog">
main(IO0, IO) :-
io.write_string("fib(10) = ", IO0, IO1),
io.write_int(fib(10), IO1, IO2),
io.nl(IO2, IO).
</source>
|