2.1 Language Constructs

This section contains information on the various language forms in Pyret, from binary operators to data definitions to functions. This is a more detailed reference to the grammar of expressions and statements and their evaluation, rather than to

    2.1.1 Primitives and Literals

      2.1.1.1 Names

      2.1.1.2 String Literals

      2.1.1.3 Number Literals

      2.1.1.4 Boolean Literals

    2.1.2 Comments

    2.1.3 Programs

    2.1.4 Import Statements

    2.1.5 Provide Statements

    2.1.6 Bindings

      2.1.6.1 Name bindings

      2.1.6.2 Annotated bindings

      2.1.6.3 Shadowing

      2.1.6.4 Tuple bindings

    2.1.7 Blocks

      2.1.7.1 Block Shorthand

    2.1.8 Declarations

      2.1.8.1 Let Declarations

      2.1.8.2 Recursive Let Declarations

      2.1.8.3 Function Declaration Expressions

        2.1.8.3.1 Scope

        2.1.8.3.2 Where blocks

        2.1.8.3.3 Syntactic sugar

      2.1.8.4 Data Declarations

      2.1.8.5 Variable Declarations

      2.1.8.6 Type Declarations

      2.1.8.7 Newtype Declarations

    2.1.9 Contracts

    2.1.10 Statements

      2.1.10.1 When Statements

      2.1.10.2 Assignment Statements

      2.1.10.3 Binop Expression “Statements”

    2.1.11 Expressions

      2.1.11.1 Lambda Expressions

      2.1.11.2 Curly-Brace Lambda Shorthand

      2.1.11.3 Anonymous Method Expressions

      2.1.11.4 Application Expressions

      2.1.11.5 Curried Application Expressions

      2.1.11.6 Chaining Application

      2.1.11.7 Instantiation Expressions

      2.1.11.8 Binary Operators

      2.1.11.9 Tuple Expressions

      2.1.11.10 Tuple Access Expressions

      2.1.11.11 Object Expressions

      2.1.11.12 Dot Expressions

      2.1.11.13 Extend Expressions

      2.1.11.14 If Expressions

      2.1.11.15 Ask Expressions

      2.1.11.16 Cases Expressions

      2.1.11.17 For Expressions

      2.1.11.18 Template (...) Expressions

      2.1.11.19 Tables

        2.1.11.19.1 Sorting Table Rows

        2.1.11.19.2 Transforming Table Rows

        2.1.11.19.3 Extracting Table Columns

        2.1.11.19.4 Adding Table Columns

      2.1.11.20 Table Loading Expressions

      2.1.11.21 Reactor Expressions

      2.1.11.22 Mutable fields

      2.1.11.23 Construction expressions

      2.1.11.24 Expression forms of bindings

    2.1.12 Annotations

      2.1.12.1 Name Annotations

      2.1.12.2 Parametric Annotations

      2.1.12.3 Arrow Annotations

      2.1.12.4 Predicate Annotations

      2.1.12.5 Tuple Annotations

      2.1.12.6 Record Annotations