Messaging Apps powered by Machine Learning

Pez is designed for data analysis. It is functional in nature, has consistent semantics across data structures, and most importantly, is easy to learn.

Basic Syntax

Identifiers

Start with an underscore or a letter, followed by any alphanumeric character plus underscore.

Primitive Types

Pez supports characters and numbers. No distinction is made between integers and floating point numbers.

See Primitive Types for more information.

Lists

Create lists using square brackets: [1, 2, 3, 4]. The same list can be created using sequence notation: 1..4. Lists in pez are heterogeneous (like R lists but not vectors), so [1, 'a', [2,3]] is valid.

To get the length of a list, use the length function, such as length([1,2,3]). If the list is assigned to a variable, x = 1..4, then bar notation can be used: |x|.

See Data Structures for more information.

Data Frames

See Data Structures for more information.

Functions

Functions are the basis of computation in pez.

Defining functions

Function definition follows ML syntax. Use the keyword fn followed by the argument list, separated by white space. All functions are lambda abstractions and are limited to one expression, which is separated from the argument list with a colon.

While it may seem limiting to require single expressions, this has the consequence of simplifying functions. There is, however, a way to write multiline functions, and that is with a let expression, discussed later.

Applying functions

All functions are anonymous, so to use them they need to be bound to a variable.

Once it is bound to a variable, the function can be applied to an argument list in one of two ways. Like ML, no parentheses are necessary, so the simplest function application is simply the function followed by its arguments.

Alternatively, the arguments can be wrapped in parentheses and separated by commas.

Composing functions

See Functions for more information.