[m-dev.] Suggestion for a new "where" operator

Ralph Becket rafe at cs.mu.OZ.AU
Tue Aug 5 13:22:28 AEST 2003


Zoltan Somogyi, Tuesday,  5 August 2003:
> 
> If by "predicate syntax" you mean the use of :- in the definitions of
> functions, you'll need to explain why you believe that to be a problem.

That's what I mean.

The simplest example I can come up with is the expression

	( if   Cond
	  then (E1 where P)
	  else (E2 where Q)
	)

where P and Q denote (possibly compound) goals, not expressions.

Not having where expressions means I have to either
(1) recode this expression (and the entire function it appears in) using
goal form or
(2) add (P, Q) somewhere else (say after the `:-' if this is a function)
and take an efficiency hit for unnecessary computation (e.g. computing Q
when only the then branch is needed.)

I *have* found this to be a problem, but I write all of my code in the
functional style where appropriate.

-- Ralph
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list