Example where Euphoria defaults on a boolean expression
- Posted by Rom <kjehas at frisurf.no> Nov 23, 2002
- 686 views
You get a phone call from your boss where you are ordered to search for = information about dyslexia .. immediately! You go to the PC and start = websearching. In the phone conversation you were told which words to = search for...... it was "dyslexia"(A) and "adult"(B) and something = else(C) which you don't remember. What to do when you don't know the = third search criterium? In this situation you will probably dismiss C from the rule and state: if A and B then match..... Is this a valid transformation of boolean logic ... when one variable is = unknown? What this rule returns is not the same as what your boss asked = you to do. Any variable may be nil (=3Duninstanciated). That has a lot of = implications. if A and B and C then match.... When A=3DTrue, B=3DTrue and C=3Dnil then this rule CANNOT be solved as = True or False (i.e result is nil). That is consistent with boolean = logic (and any other logic too)=20 Logically you could deduct that the paper you return is: not (what he asked for) and not (not (what he asked for)) If E =3D what he asked for then not E and not( not E) =3D> not E and E =3D> E and not E The paper you returned to your boss was what he asked for and was not he = asked for ( =3D "maybe" what he asked for) So how do Euphoria handle this? atom e,=20 e =3D 2 -- what he asked for f =3D 3 -- what you gave him if (f =3D e) and not ( f !=3D e) then print( 1, 1) else print ( 1, 0) end if object line line =3D gets( 0) The Euphoria program returns "0" ...... which is wrong! "not E and E" is unsolvable, neither true nor false.=20 Euphoria cannot handle this (like C and Pascal). Rom