Skip to main content

Epsil

Epsil is a programming language for scientific computing, built on the Compute Engine.

Experimental

Epsil is available as an experimental entry point. Its syntax and semantics may change between releases while the language is being exercised in notebooks and other applications.

Epsil is embedded from JavaScript through the @cortex-js/compute-engine/epsil entry point:

import { ComputeEngine, executeEpsil } from "@cortex-js/compute-engine/epsil";

const ce = new ComputeEngine();
const { value, diagnostics } = executeEpsil(ce, "1 + 2");

Here is "Hello World" in Epsil. Edit the code and press Run (or ⌘/Ctrl+Enter) — the result is the value of the last statement, shown as an Epsil value and as its underlying MathJSON.

⌘/Ctrl + Enter

Epsil is symbolic by default: expressions stay exact unless you ask for a numeric approximation with N().

⌘/Ctrl + Enter

Values have a type, and strings support \(…) interpolation:

⌘/Ctrl + Enter

Errors are ordinary values, so a program never throws to its host — a problem surfaces as an ["Error", …] value or a diagnostic:

⌘/Ctrl + Enter

Start Here

Language Reference

Collections

Epsil has literal syntax for the Compute Engine's collections.

Lists are ordered and 1-indexed with xs[i]:

⌘/Ctrl + Enter

Sets are unordered collections of unique elements:

⌘/Ctrl + Enter

Dictionaries are sets of key/value pairs. The empty dictionary is {->}:

⌘/Ctrl + Enter

Future Directions

Several keywords are reserved but not designed — they are held so that a future version of Epsil can introduce them without breaking existing programs, and using one as an ordinary name today is an error. None of the following are part of the language yet:

  • Modules and importsimport, export, module.
  • Error-handling keywordstry, catch, throw. In Epsil, errors are ordinary values, so these are not needed for the current design.
  • Concurrencyasync, await, parallel.
  • Macros and compile-time metaprogramming.

If you need a symbol whose name collides with one of these reserved words, use the verbatim form (`match`).