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

FUNCTIONS, PROCEDURES AND PACKAGES

 
Acknowledgements
 
Introduction
 
Functions and Procedures
      Functions
      Procedures
      The forward Declaration
 
Packages
      Introduction
      Intrinsics
      Resolving Calls to Intrinsics
      Attaching and Detaching Package Files
      Related Files
      Importing Constants
      Argument Checking
      Package Specification Files
      User Startup Specification Files
 
Attributes
      Predefined System Attributes
      User-defined Attributes
      Accessing Attributes
 
User-defined Verbose Flags
      Examples
 
User-Defined Types
      Declaring User-Defined Types
      Creating an Object
      Special Intrinsics Provided by the User
      Examples







DETAILS

 
Introduction

 
Functions and Procedures

      Functions
            f := function(x1, ..., xn: parameters) : ->
            f := function(x1, ..., xn, ...: parameters) : ->
            function f(x1, ..., xn: parameters) : ->
            function f(x1, ..., xn, ...: parameters) : ->
            Example Func_Recursion (H2E1)
            Example Func_Parameters (H2E2)
            Example Func_Underscore (H2E3)
            Example Func_Variadic (H2E4)

      Procedures
            p := procedure(x1, ..., xn: parameters) statements : ->
            p := procedure(x1, ..., xn, ...: parameters) statements : ->
            p := proc< x1, ..., xn: parameters | expression >;
            p := proc< x1, ..., xn, ...: parameters | expression >;
            Example Func_Procedures (H2E5)

      The forward Declaration
            forward f; : identifier ->
            Example Func_forward (H2E6)

 
Packages

      Introduction

      Intrinsics
            Example Func_intrinsic (H2E7)

      Resolving Calls to Intrinsics
            Example Func_intrinsic-lookup (H2E8)

      Attaching and Detaching Package Files
            Attach(F) : MonStgElt ->
            Detach(F) : MonStgElt ->
            freeze;

      Related Files

      Importing Constants
            import "filename": ident_list;
            Example Func_import (H2E9)

      Argument Checking
            require condition: print_args;
            requirerange v, L, U;
            requirege v, L;
            Example Func_require (H2E10)

      Package Specification Files
            AttachSpec(S) : MonStgElt ->
            DetachSpec(S) : MonStgElt ->
            Example Func_spec (H2E11)

      User Startup Specification Files
            Example Func_startup-spec (H2E12)

 
Attributes

      Predefined System Attributes

      User-defined Attributes
            AddAttribute(C, F) : Cat, MonStgElt -> ;
            declare attributes C: F1, ..., Fn;

      Accessing Attributes
            S`fieldname : Str, Fieldname -> Elt
            assigned S`fieldname : Str, Fieldname -> BoolElt
            S`fieldname := expression;
            delete S`fieldname;
            GetAttributes(C) : Cat -> [ MonStgElt ]
            ListAttributes(C) : Cat ->

 
User-defined Verbose Flags
      declare verbose F, m;

      Examples
            Example Func_SystemAttributes (H2E13)
            Example Func_InteractiveUserAttributes (H2E14)
            Example Func_PackageUserAttributes (H2E15)

 
User-Defined Types

      Declaring User-Defined Types
            declare type T;
            declare type T: P1, ..., Pn;
            declare type T[E];
            declare type T[E]: P1, ..., Pn;

      Creating an Object
            New(T) : Type -> T

      Special Intrinsics Provided by the User

      Examples
            Example Func_MyRat (H2E16)
            Example Func_UserTypes2 (H2E17)

[Next][Prev] [Right] [____] [Up] [Index] [Root]
Version: V2.19 of Wed Apr 24 15:09:57 EST 2013