[mercury-users] Pred defns
Bart Demoen
bmd at cs.kuleuven.ac.be
Tue Mar 31 16:25:13 AEST 1998
Peter Schachte wrote:
> main ::-
> print("Hello world\n"),
> #x = 42,
> ##x = #x + 1,
> print("42 + 1 ="),
> print(#x).
>
> I think that is easier to write, read, understand and maintain than the
> original. This is the syntax my global variables package supports.
I guess he meant
main ::-
print("Hello world\n"),
$x := 42,
$x := $x + 1,
print("42 + 1 ="),
print($x).
instead. Hoorah, back to simplicity !
The next step is not to require argument threading for implementing
this; it has problems related to modules and higher-order. Of course,
use argument threading for explaining it if you really want (but
higher-order is going to make that difficult or clumsy as well)
Bart
More information about the users
mailing list