failed attempts to intercept copy command when the cursor is in the empty text field...
[LeanCalc.git] / help / TYPE
1 Builtin types
2
3     The calculator has the following built-in types.
4
5     null value
6             This is the undefined value type.  The function 'null'
7             returns this value.  Functions which do not explicitly
8             return a value return this type.  If a function is called
9             with fewer parameters than it is defined for, then the
10             missing parameters have the null type.  The null value is
11             false if used in an IF test.
12
13     rational numbers
14             This is the basic data type of the calculator.
15             These are fractions whose numerators and denominators
16             can be arbitrarily large.  The fractions are always
17             in lowest terms.  Integers have a denominator of 1.
18             The numerator of the number contains the sign, so that
19             the denominator is always positive.  When a number is
20             entered in floating point or exponential notation, it is
21             immediately converted to the appropriate fractional value.
22             Printing a value as a floating point or exponential value
23             involves a conversion from the fractional representation.
24
25             Numbers are stored in binary format, so that in general,
26             bit tests and shifts are quicker than multiplies and divides.
27             Similarly, entering or displaying of numbers in binary,
28             octal, or hex formats is quicker than in decimal.  The
29             sign of a number does not affect the bit representation
30             of a number.
31
32     complex numbers
33             Complex numbers are composed of real and imaginary parts,
34             which are both fractions as defined above.  An integer which
35             is followed by an 'i' character is a pure imaginary number.
36             Complex numbers such as "2+3i" when typed in, are processed
37             as the sum of a real and pure imaginary number, resulting
38             in the desired complex number.  Therefore, parenthesis are
39             sometimes necessary to avoid confusion, as in the two values:
40
41                     1+2i ^2             (which is -3)
42                     (1+2i) ^2   (which is -3+4i)
43
44             Similar care is required when entering fractional complex
45             numbers.  Note the differences below:
46
47                     3/4i                (which is -(3/4)i)
48                     3i/4                (which is (3/4)i)
49
50             The imaginary unit itself is input using "1i".
51
52     strings
53             Strings are a sequence of zero or more characters.
54             They are input using either of the single or double
55             quote characters.  The quote mark which starts the
56             string also ends it.  Various special characters can
57             also be inserted using back-slash.  Example strings:
58
59                     "hello\n"
60                     "that's all"
61                     'lots of """"'
62                     'a'
63                     ""
64
65             There is no distinction between single character and
66             multi-character strings.  The 'str' and 'ord' functions
67             will convert between a single character string and its
68             numeric value.  The 'str' and 'eval' functions will
69             convert between longer strings and the corresponding
70             numeric value (if legal).  The 'strcat', 'strlen', and
71             'substr' functions are also useful.
72
73     matrices
74             These are one to four dimensional matrices, whose minimum
75             and maximum bounds can be specified at runtime.  Unlike C,
76             the minimum bounds of a matrix do not have to start at 0.
77             The elements of a matrix can be of any type.  There are
78             several built-in functions for matrices.  Matrices are
79             created using the 'mat' statement.
80
81     associations
82             These are one to four dimensional matrices which can be
83             indexed by arbitrary values, instead of just integers.
84             These are also known as associative arrays.  The elements of
85             an association can be of any type.  Very few operations are
86             permitted on an association except for indexing.  Associations
87             are created using the 'assoc' function.
88
89     lists
90             These are a sequence of values, which are linked together
91             so that elements can be easily be inserted or removed
92             anywhere in the list.  The values can be of any type.
93             Lists are created using the 'list' function.
94
95     files
96             These are text files opened using stdio.  Files may be opened
97             for sequential reading, writing, or appending.  Opening a
98             file using the 'fopen' function returns a value which can
99             then be used to perform I/O to that file.  File values can
100             be copied by normal assignments between variables, or by
101             using the result of the 'files' function.  Such copies are
102             indistinguishable from each other.
103