[mercury-users] Pred defns

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Mar 30 20:27:41 AEST 1998


On 30-Mar-1998, Bart Demoen <bmd at CS.kuleuven.ac.be> wrote:
> 
> Fergus wrote:
> 
> > In general improving writability at the expense of readability is not a
> > good trade-off ...
> 
> To me readability is definitely not improved by introducing the
> operators #?, #^v, #^ and 4 more that look alike.

Yes, this is definitely a major weak point in my proposal.
As well as your comments and Tyson's, I've been discussing it
here with David Jeffrey and Mark Brown and they agree ;-)

So, an alternative would be to drop `#{' and `#:-', and to
distinguish between `#<' (head state pair) and `#>'
(state pair) based on their position.  This would leave us
with just 3 operators (`#?', `#^', and `#>') rather than 6,
and so we could perhaps use just `#', `##', and `###' for
"current state", "next state", and "state pair"
(= current state plus next state) respectively.

For example:

	main(###io) :-
		print("Hello world\n", ###io),
		#x = 42,
		##x = #x + 1,
		print("42 + 1 =", ###io), print(#x, ###io).

With this proposal, `,' doesn't necessarily mean conjunction anymore,
but if a sub-goal (A,B) has no `##'s or `###'s, then the `,' is
indeed conjunction.  I suppose that in practice the `##'s or `###'s in
the body would be enough of a red flag that using `#{...}' or `#:-'
would not really be needed.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.



More information about the users mailing list