Information Technology Reference
In-Depth Information
Fig. 3.3
The function
'confirm' in the language
clarity
In Clarity, the method of 'running' a diagram is to type into a 'control' window the
function 'name' followed by its appropriate parameters. This activates the function
'
confirm
' where the answer for the 'QUERY' is given on the next line thus:
QUERY
>
confirm
[
implies
isvowel iseven] ['A' 'D' #4 #7]
[ 'A' #7 ]
or thus:
QUERY
>
confirm
[
implies
iseven isvowel ] ['a' 'd' #4 #7]
[ 'D' #4 ]
The boxes in this diagram, whatever their colour, are either functions defined
previously in the same way or library functions already provided by the system.
The function '
myinverseN
' will produce a subset of the truth values for the logic
operator specified by the variable '?2' in the first parameter (this is 'implies' in our
initial example but could also be 'or', 'and' etc). The variables '?3' and '?4' are
the logic tests to be applied to a list of the items in
confirm
's second parameter.
The function '
myinverseN
' will list the Truth values (see Table
3.1
) for the operator
'?2' where the results are either
False
or
True
as requested by its second parameter.
So for 'implies' the following combinations are
True
(see line 1, 3, 4 of the above
Table
3.1
).
QUERY
>
myinverseN
implies
True
[ [ False False][False True ] [ True True ] ]
And in the following combination there is only one that is
False
(see line 2 of the
Table
3.1
).
QUERY
>
myinverseN
implies
False
[ [ True False ] ]
The function can also be used for other Truth operators such as 'or' (expressed as '||')
and 'and' (expressed as '&&').