ShenDoc 30


 

 

Boolean Operators

The list of boolean operators contains some logical redundancy. Logically only 'if' is required to define the rest. However even ANSI C contains a version of the basic repertoire 'if', 'and', 'or', 'not' and the 'cond' is trivially compilable into a nested 'if'. Because Kλ does not contain macros and uses strict applicative order evaluation outside boolean operations, these are not efficiently interdefinable in the language itself. Note that in Kλ a 'cond' that fails in all its cases does not deliver NIL (as in CL) but an error.

Shen includes a 'cases' statement which has the syntax

  (cases test-a result-a
         test-b result-b
  ...............)
  

and which is equivalent to

(if test-a result-a (if test-b result-b ....))

If no cases apply an error is returned.

Acknowledgements

History
Basic Types in Shen and Kλ
The Primitive Functions of Kλ
The Syntax of Kλ
Notes on the Implementation of Kλ
Boolean Operators
The Syntax of Symbols
The Semantics of Symbols in Shen and Kλ
Packages
Prolog
Shen-YACC
Strings
Strings and Pattern Matching
Lists
Streams
Character Streams and Byte Streams
Bytes and Unicode
Reader Macros
Vectors
Standard Vectors and Pattern Matching
Non-standard Vectors and Tuples
Equality
I/O
Generic Functions
Eval
Type Declarations
External Global Variables
Property Lists and Hashing
Error Handling
Numbers
Floats and Integers
The Timer
Comments
Special Forms

Built by Shen Technology (c) Mark Tarver, September 2021