NeturalMath Language Definition and Syntax

Bool

A Bool is a representation of a Boolean value in NetrualMath. It must contain one of two descrete values, either {true} or {false}. A bool is approximately equivalent to the System.Boolean data type in .NET, and functions much like the {bool} type in C#.

Type information

The Bool data type will return the String {'bool'} when queried.
:> x = true
:> numType = type(x)
:> print numType

'bool'


If output, the bool data type will return either the constants '{true}' or '{false}'
:> x = true
:> print x

true
:> y = false
:> print y

false

Literals

Literals are entered by keying in as either the literal value {true} or the literal value {false}
:> a = true
:> b = false

Operations

Add Operator +

Logic Table
right
left false true
false false true
true true true

Bools are treated as a single bit (0 or 1) for the purposes of arithmetic calculations. The Add Operation adds the values, limiting the result to 1 in the case where it would overflow the numeric domain (true plus true). The Add Operation has the same functional result as the OR Operation on boolean values.
:> print true + true

true
:> print true + false

true
:> print false + false

false
:> print false + true

true

Subtract Operator -

Logic Table
right
left false true
false false false
true true false

Bools are treated as a single bit (0 or 1) for the purposes of arithmetic calculations. The Subtract Operation adds the values, limiting the result to 0 in the case where it would yield a result that is less than zero. Functionally, the Subtract operator will only return true if the first value is true, and the second value is false
:> print true - true

false
:> print true - false

true
:> print false - false

false
:> print false - true

false

Multiply Operator *

Logic Table
right
left false true
false false false
true false true

Bools are treated as a single bit (0 or 1) for the purposes of arithmetic calculations. The Multiply Operation multiplies the values as if they were bits. Functionally, the Subtract operator works the same as the And Operator for boolean values.
:> print true * true

true
:> print true * false

false
:> print false * false

false
:> print false * true

false

Conversions

Bools exhibit the following behaviors when converted to other types:
This section is not complete

Complex

This section is not complete

Number

This section is not complete

Range

This section is not complete

Set

This section is not complete

String

This section is not complete

Units

This section is not complete

Functions

The following System Functions consume the Bool data type:
This section is not complete

See Also:

This section is not complete

Last edited Oct 21, 2010 at 8:48 PM by zanethorn, version 10

Comments

No comments yet.