[Next][Prev] [Right] [____] [Up] [Index] [Root]

STATEMENTS AND EXPRESSIONS

 
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 Checking and Assertions
 
Iterative Statements
      Definite Iteration
      Indefinite Iteration
      Early Exit from Iterative Statements
 
Comments and Continuation
 
Timing
 
Types, Category Names and Structures
 
Random Object Generation
 
Miscellaneous
 
Bibliography







DETAILS

 
Introduction

 
Starting, Interrupting and Terminating
      <Ctrl>-C
      quit;
      <Ctrl>-\

 
Identifiers

 
Assignment

      Simple Assignment
            x := expression;
            Example State_Identifiers (H1E1)
            x_1, x_2, ..., x_n := expression;
            _ := expression;
            assigned x : Var -> BoolElt
            Example State_MultipleReturns (H1E2)

      Indexed Assignment
            x[expr_1][expr_2]...[expr_n] := expression;
            Example State_Indexing (H1E3)

      Generator Assignment
            E<x_1, x_2, ...x_n> := expression;
            E<[x]> := expression;
            Example State_GeneratorNamingSequence (H1E4)
            AssignNames(~S, [s_1, ... s_n] ) : Struct, [ MonStgElt ] ->
            Example State_GeneratorNaming (H1E5)

      Mutation Assignment
            x o:= expression;
            Example State_MutationAssignment (H1E6)

      Deletion of Values
            delete x : Var; -> Nil

 
Boolean values

      Creation of Booleans
            Booleans() : Nil -> 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 : Elt, Elt -> BoolElt
            x ne y : Elt, Elt -> BoolElt
            x cmpeq y : Elt, Elt -> BoolElt
            x cmpne y : Elt, Elt -> 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
      expression_1 where identifier is expression_2
      Example State_where (H1E9)

 
Conditional Statements and Expressions

      The Simple Conditional Statement
            if boolexpr_1 then statements_1 else statements_2 end if : ->
            Example State_if (H1E10)

      The Simple Conditional Expression
            Example State_InLineConditional (H1E11)

      The Case Statement
            case expr : when expr_i : statements end case : ->
            Example State_case (H1E12)

      The Case Expression
            case< | > : ->

      Error Checking and Assertions
            error expression, ..., expression;
            error if boolexpr, expression, ..., expression;
            assert boolexpr;

 
Iterative Statements

      Definite Iteration
            for i := expr_1 to expr_2 by expr_3 do : ->
            for i := expr_1 to expr_2 do : ->

      Indefinite Iteration
            while boolexpr do statements end while : ->
            Example State_while (H1E13)
            repeat statements until boolexpr : ->
            Example State_repeat (H1E14)

      Early Exit from Iterative Statements
            Example State_break (H1E15)

 
Comments and Continuation
      //
      /* */
      \
      Example State_Various (H1E16)

 
Timing
      Cputime() : -> FldReElt
      Cputime(t) : FldReElt -> FldReElt
      Realtime() : -> FldReElt
      Realtime(t) : FldReElt -> FldReElt
      time statement;
      vtime flag: statement;
      Example State_Time (H1E17)

 
Types, Category Names and Structures
      Type(x) : Elt -> BoolElt
      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 (H1E18)

 
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 (H1E19)

 
Miscellaneous
      IsIntrinsic(S) : MonStgElt -> Bool, Intrinsic

 
Bibliography