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

Michael Day mikeday at yeslogic.com
Tue Nov 19 11:07:30 AEDT 2002


> ... a lot less clear than
> 
> is_whitespace(' ', yes).
> is_whitespace('\t', yes).
> is_whitespace('\r', yes).
> is_whitespace('\n', yes).
> is_whitespace(C, no).

Change is_whitespace to a semidet predicate rather than returning a 
boolean value, then you can just write:

is_whitespace(' ').
is_whitespace('\t').
is_whitespace('\r').
is_whitespace('\n').

and any other char value is false. You may want to consider vertical tab
and form feed to be whitespace too, though :)

> No directory access, no concurrency (though I see allusions to an
> experimental multithreaded Mercury: does it use OS threads or something
> lighter?  How can I experiment with it?), no networking -- but the
> first and the last seem potentially well-covered by the foreign language
> access.

The extras/posix module has support for readdir; the extras/concurrency
modules have support for concurrency and a networking can be done using
sockets from the posix module.

Michael


--------------------------------------------------------------------------
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