Starting, Interrupting and Terminating
<Ctrl>-C
quit;
<Ctrl>-\
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 ->
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 boolexpr1 then statements1 else statements2 end if : ->
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< | > : ->
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)
Definite Iteration
for i := expr1 to expr2 by expr3 do : ->
for i := expr1 to expr2 do : ->
Indefinite Iteration
while boolexpr do statements end while : ->
Example State_while (H1E14)
repeat statements until boolexpr : ->
Example State_repeat (H1E15)
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 statement;
vtime flag: statement;
Example State_Time (H1E20)
Types, Category Names, and Structures
Type(x) : Elt -> Cat
ExtendedType(x) : Elt -> ECat
ISA(T, U) : Cat, Cat -> BoolElt
MakeType(S) : MonStgElt -> Cat
ElementType(S) : Str -> Cat
CoveringStructure(S, T) : Str, Str -> Str
ExistsCoveringStructure(S, T) : Str, Str -> BoolElt, Str
Example State_TypeStructures (H1E21)
Random Object Generation
SetSeed(s, c) : RngIntElt ->
GetSeed() : -> RngIntElt, RngIntElt
Random(S) : Str -> Elt
Random(a, b) : RngIntElt, RngIntElt -> RngIntElt
Random(b) : RngIntElt -> RngIntElt
Example State_IsIntrinsic (H1E22)
Miscellaneous
IsIntrinsic(S) : MonStgElt -> Bool, Intrinsic
Example State_IsIntrinsic (H1E23)
Bibliography
[Next][Prev] [Right] [____] [Up] [Index] [Root]
Version: V2.19 of
Mon Dec 17 14:40:36 EST 2012