[mercury-users] Style, Newbie decision question, "What? No X?!", Microbenchmark

Julian Fondren cleverjulian at hotmail.com
Thu Nov 21 02:20:38 AEDT 2002


>disjunction (;) is right associative, so you don't need all those
>parentheses.  You can instead lay this out as:
>
>	is_whitespace(C, Bool) :-
>		 (   C = ' '  -> Bool = yes
>		 ;   C = '\t' -> Bool = yes
>		 ;   C = '\r' -> Bool = yes
>		 ;   C = '\n' -> Bool = yes
>		 ;   Bool = no
>		 ).
>
>which I think is a lot easier to read.

Yes =)

>But for something like this, I think a semidet predicate like
>
>	is_whitespace(' ').
>	is_whitespace('\t').
>	is_whitespace('\r').
>	is_whitespace('\n').
>
>is still clearer, and also easier to use.

ah, thanks.


_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail

--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list