[____]
STATEMENTS AND EXPRESSIONS
Acknowledgements Introduction
Starting, Interrupting and Terminating
Identifiers
Assignment
Simple Assignment
Indexed Assignment
Generator Assignment
Mutation Assignment
Deletion of Values
Boolean Values
Creation of Booleans
Boolean Operators
Equality Operators
Iteration
Coercion
The where ... is Construction
Conditional Statements and Expressions
The Simple Conditional Statement
The Simple Conditional Expression
The Case Statement
The Case Expression
Error Handling Statements
The Error Objects
Error Checking and Assertions
Catching Errors
Iterative Statements
Definite Iteration
Indefinite Iteration
Dual Iteration
Early Exit from Iterative Statements
Runtime Evaluation: the eval Expression
Comments and Continuation
Timing
Types, Category Names, and Structures
Random Object Generation
Miscellaneous
Bibliography
Introduction
Starting, Interrupting and Terminating
<Ctrl>-C
quit;
<Ctrl>-\
Identifiers
Assignment
Simple Assignment
x := expression;
Example State_Identifiers (H1E1)
x1, x2, ..., xn := expression;
_ := expression;
assigned x : Var -> BoolElt
Example State_MultipleReturns (H1E2)
Indexed Assignment
x[expr1][expr2]...[exprn] := expression;
Example State_Indexing (H1E3)
Generator Assignment
E<x1, x2, ...xn> := expression;
E<[x]> := expression;
Example State_GeneratorNamingSequence (H1E4)
AssignNames(~S, [s1, ... sn] ) : Str, [ MonStgElt ] ->
Example State_GeneratorNaming (H1E5)
Mutation Assignment
x o:= expression;
Example State_MutationAssignment (H1E6)
Deletion of Values
delete x : Var ->
Boolean Values
Creation of Booleans
Booleans() : -> Bool
# B : Bool -> RngIntElt
true
Random(B) : Bool -> BoolElt
Boolean Operators
x and y : BoolElt, BoolElt -> BoolElt
x or y: BoolElt, BoolElt -> BoolElt
x xor y: BoolElt, BoolElt -> BoolElt
not x : BoolElt -> BoolElt
Equality Operators
x eq y : Any, Any -> BoolElt
x ne y : Any, Any -> BoolElt
x cmpeq y : Any, Any -> BoolElt
x cmpne y : Any, Any -> BoolElt
Example State_Equality (H1E7)
Iteration
Example State_Booleans (H1E8)
Coercion
S ! x : Str, Elt -> Elt
IsCoercible(S, x) : Str, Elt -> Bool, Elt
The where ... is Construction
expression1 where identifier is expression2
Example State_where (H1E9)
Conditional Statements and Expressions
The Simple Conditional Statement
if-then-else
elif
Example State_if (H1E10)
The Simple Conditional Expression
Example State_InLineConditional (H1E11)
The Case Statement
case expr : when expri : statements end case : ->
Example State_case (H1E12)
The Case Expression
case< expr | exprleft, 1 : expr_((right), 1), ..., expr_((left), n) : expr_((right), n), default : exprdef> : ->
Error Handling Statements
The Error Objects
Error(x) : Any -> Err
e`Position : Err -> MonStgElt
e`Traceback : Err -> MonStgElt
e`Object : Err -> Any
e`Type : Err -> MonStgElt
Error Checking and Assertions
error expression, ..., expression;
error if boolexpr, expression, ..., expression;
assert boolexpr;
Catching Errors
try statements catch e statements end try : ->
Example State_while (H1E13)
Iterative Statements
Definite Iteration
for i := expr1 to expr2 by expr3 do
for
Indefinite Iteration
while
Example State_while (H1E14)
repeat-until
Example State_repeat (H1E15)
forrandom
Dual Iteration
for
forrandom
Early Exit from Iterative Statements
Example State_break (H1E16)
Runtime Evaluation: the eval Expression
eval expression
Example State_eval1 (H1E17)
Example State_eval2 (H1E18)
Comments and Continuation
//
/* */
\
Example State_Various (H1E19)
Timing
Cputime() : -> FldReElt
Cputime(t) : FldReElt -> FldReElt
Realtime() : -> FldReElt
Realtime(t) : FldReElt -> FldReElt
ClockCycles() : -> RngIntElt
Time() : -> MonStgElt
Time(T) : MonStgElt -> MonStgElt
time statement;
vtime flag: statement;
SetShowRealTime(v) : BoolElt ->
GetShowRealTime() : -> BoolElt
Example State_Time (H1E20)
Example State_TimeMultiThreaded (H1E21)
Types, Category Names, and Structures
Type(x) : Elt -> Cat
ExtendedType(x) : Elt -> ECat
ISA(T, U) : Cat, Cat -> BoolElt
BaseType(T) : ECat -> Cat
# T : ECat -> RngIntElt
T[i] : ECat, RngIntElt -> .
Example State_ExtendedTypeAccessors (H1E22)
MakeType(S) : MonStgElt -> Cat
ElementType(S) : Str -> Cat
CoveringStructure(S, T) : Str, Str -> Str
ExistsCoveringStructure(S, T) : Str, Str -> BoolElt, Str
Example State_TypeStructures (H1E23)
Random Object Generation
SetSeed(s, c) : RngIntElt, RngIntElt ->
GetSeed() : -> RngIntElt, RngIntElt
Random(S) : Str -> Elt
Random(a, b) : RngIntElt, RngIntElt -> RngIntElt
Random(b) : RngIntElt -> RngIntElt
Example State_IsIntrinsic (H1E24)
Miscellaneous
IsIntrinsic(S) : MonStgElt -> Bool, Intrinsic
Example State_IsIntrinsic (H1E25)
Bibliography
[Next][Prev] [Right] [____] [Up] [Index] [Root]
|