IMPLIES via IF THEN

This forum is for any questions about the language Tutorial D or the Rel implementation of it.
Post Reply
drago
Posts: 2
Joined: Mon Nov 26, 2018 5:50 am
Location: Croatia

IMPLIES via IF THEN

Post by drago »

Hi,
I suggest adding IMPLIES keyword to the language (having EQUIV but not IMPLIES is strange) and/or adding the following IF-THEN >>Boolean expression<< simple forms (default ELSE to TRUE in case q is Boolean):
IF p THEN q =
IF p THEN q END IF =
IF p THEN q ELSE true END IF

(the need for the trailing "ELSE true END IF" is really unnecessary if we just want IMPLIES and in Boolean expressions we almost always do).

Having those simple forms we define:
p IMPLIES q = IF p THEN q

Here is an example.

Current syntax:
AND (P, IF color = 'Red' THEN city = 'London' ELSE true END IF)

Proposed syntax:
AND (P, IF color = 'Red' THEN city = 'London')
or
AND (P, color = 'Red' IMPLIES city = 'London')

----

Similarly, CASE WHEN-THEN could have a simple/default form when q is Boolean:
CASE WHEN p THEN q =
CASE WHEN p THEN q END CASE =
CASE WHEN p THEN q ELSE true END CASE

Having those simple forms we define:
p IMPLIES q = IF p THEN q = CASE WHEN p THEN q

Current syntax of the example:
AND (P, CASE WHEN color = 'Red' THEN city = 'London' ELSE true END CASE)

Proposed syntax:
AND (P, CASE WHEN color = 'Red' THEN city = 'London')
or
AND (P, color = 'Red' IMPLIES city = 'London')
BR,
Drago
Dave
Site Admin
Posts: 368
Joined: Sun Nov 27, 2005 7:19 pm

Re: IMPLIES via IF THEN

Post by Dave »

The trailing END IF, END CASE, or just END is needed to disambiguate the end of the conditional subexpression from the remainder of the expression.
Post Reply