This project is read-only.

Netural Math Language Definition and Syntax

Constant Literals

Constant literals are values directly defined through the source code. It is a way of inputing a value into a program without obtaining it from a user response, file, or function.

There are several ways to add literals to the system depending on their inital Data Types

Boolean Constant Literals

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

Numeric Constant Literals

Numeric constant literals are entered by keying in a standard decimal representation of a number. The number can contain an optional '+' or '-' sign, and may also contain a decimal point. The following are all numeric literals:
:> a = 10
:> b = 10.0
:> c = -10.0
:> d = (-10)
:> e = -1.2345

The numeric constants for infinity and negative infinity can be used by providing the {infinity} keyword:
:> x = infinity
:> y = -infinity
:> z = x + y
:> print x

:> print y

:> print z


Range Constant Literals

Range constant literals are entered using two numeric values seperated by the single arrow ({->}) sign. This specifies the minimum and maximum values for a range. In order to specify a range as a limit, you must wrap the numeric value in parentheses. The left (minimum) value must always be smaller than the right (maximum) value.
:> a = 1->10       // a simple range of all values from one to ten
:> b = (1)->10     // a range with a lower limit of one, and an upper bound of ten
:> c = (1.5)->(10) // a range with lower limit of 1.5 and an upper limit of ten
:> d = -10->(13)  // a range with a lower bound of negative ten and and and upper limit of thirteen
:> e = -1->1        // a range with a lower bound of negative one and a upper bound of one

String Constant Literals

String constant literals are entered by keying in a sequence of characters surrounded by single quotes ({'}). If two single quotes are placed together ({''}), the value that is returned will be the empty string constant.
:> a = 'this is a string'
:> b = 'this is also a string'
:> c = 'one string, two string'
:> d = 'red string, blue string'
:> e = ''  // empty string constant

Set Constant Literals

Set constant literals are entered by keying in a series of one or more values seperated by a comma (',') between square brackets ('[]'). If two square brakets are used with no values, the literal will return the EmptySet constant. Any other literal data type, or the result of a function call or variable may be placed with the set. In this way, the set is a collection of arbirary data consisting of other values.
:> a = [1, 2, 3, 4]                // set consisting of four numeric values
:> b = [-1, 2, sin(3), '4']        // set of two numbers, the result of a function call, and a string
:> c = ['1', '2', 'bob', 'mary']   // set consisting of four strings
:> d = ['earl']                    // set consisting of a single string.
:> e = []                          // empty set

Void Constant Literal

Void values always returns the void constant.
:> a = void

See Also

User Defined Constants

Last edited Oct 14, 2010 at 4:49 PM by zanethorn, version 7


No comments yet.