2 Language Concepts

This section documents the language forms in Pyret, as well as a number of Pyret-specific libraries and concepts, like Testing and Equality.

    2.1 Language Constructs

      2.1.1 Primitives and Literals Names String Literals Number Literals Boolean Literals

      2.1.2 Programs

      2.1.3 Import Statements

      2.1.4 Provide Statements

      2.1.5 Bindings Name bindings Annotated bindings Shadowing Tuple bindings

      2.1.6 Blocks Block Shorthand

      2.1.7 Declarations Let Declarations Function Declaration Expressions Data Declarations Variable Declarations Type Declarations Newtype Declarations

      2.1.8 Statements When Statements Assignment Statements Binop Expression “Statements”

      2.1.9 Expressions Lambda Expressions Curly-Brace Lambda Shorthand Anonymous Method Expressions Application Expressions Curried Application Expressions Chaining Application Instantiation Expressions Binary Operators Tuple Expressions Tuple Access Expressions Object Expressions Dot Expressions Extend Expressions If Expressions Ask Expressions Cases Expressions For Expressions Template (...) Expressions Tables

 Sorting Table Rows

 Transforming Table Rows

 Extracting Table Columns

 Adding Table Columns Table Loading Expressions Reactor Expressions Mutable fields Construction expressions Expression forms of bindings

      2.1.10 Annotations Name Annotations Parametric Annotations Arrow Annotations Predicate Annotations Tuple Annotations Record Annotations

    2.2 Testing

      2.2.1 check: and where: blocks check: blocks where: blocks

      2.2.2 Testing Operators Binary Test Operators Unary Test Operators Exception Test Operators

    2.3 equality

      2.3.1 Types of Equality

      2.3.2 Equal Now Equal Now and Primitives Equal Now and Structured Data Equal Now and References

      2.3.3 Identical Identical and Primitives Identical and Structural Equality Identical and Mutable Data

      2.3.4 Always Equal Always Equal and Mutable Data

      2.3.5 Properties of Equality Functions

      2.3.6 Bounded Equalities

      2.3.7 Undefined Equalities Roughnums and Equality Functions and Equality

      2.3.8 Total Equality Functions (Avoiding Incomparability Errors)

      2.3.9 Datatype-defined Equality

      2.3.10 Inequalities

    2.4 Brands

    2.5 Type Checking

      2.5.1 Required Annotations

      2.5.2 Working with Data Types

      2.5.3 Record Types