Dex (named for "index") is a research language for typed, functional array processing. The goal of the project is to explore:
- Type systems for array programming
- Mathematical program transformations like differentiation and integration
- User-directed compilation to parallel hardware
- Interactive and incremental numerical programming and visualization
- Dex prelude
- Mandelbrot set
- Ray tracer
- Estimating pi
- Hamiltonian Monte Carlo
- ODE integrator
- Sierpinski triangle
- Basis function regression
- Brownian bridge
- Dynamic programming (Levenshtein distance)
Or for a more comprehensive look, there's
- The InDex of all documents, libraries, and examples included in this repository.
- Install stack
- Install LLVM 12
apt-get install llvm-12-dev
brew install llvm@12
- Make sure
llvm@12is on your
PATHbefore building. Example:
export PATH="$(brew --prefix llvm@12)/bin:$PATH"
- Make sure
- Install clang 12 (may be installed together with llvm)
apt-get install clang-12
- macOS: installs with llvm
- Install libpng (often included by default in *nix platforms)
apt-get install libpng-dev
brew install libpng
To build and install a release version of Dex run
The default installation directory is
$HOME/.local/bin, so make sure to add
that directory to
$PATH after installing Dex. To install Dex somewhere else,
PREFIX environment variable before running
make install. For
PREFIX=$HOME make install installs
- Build Dex in development (unoptimized) mode:
- Run tests in development mode:
It is convenient to set up a
dex alias (e.g. in
.bashrc) for running Dex in
# Linux: alias dex="stack exec dex -- --lib-path lib" # macOS: alias dex="stack exec --stack-yaml=stack-macos.yaml dex -- --lib-path lib"
You might also want to consider other development build targets:
build-optfor local optimized builds,
build-dbgfor local debug builds,
build-proffor local optimized builds with profiling enabled.
Those non-standard targets require different aliases. Please consult the documentation
at the top of the
for detailed instructions.
Haskell Language Server
In order to use HLS with the Haskell code in this project:
- Install ghcup
ghcup install hls
- Create a file in the root
hie.yamlwith the following contents:
cradle: stack: stackYaml: "./stack-macos.yaml" # Or stack.yaml if not on MacOS
Unfortunately one cannot dynamically select the
stack.yaml file to use based
on the environment, and so one has to create an appropriate
manually. This will be ignored by git.
This should work out of the box with Emacs'
Building with Nix
Nix is a functional package manager and build system.
To build with vanilla Nix:
To build with flakes-enabled Nix:
$ nix build .#dex
dex binary should be in
For development purposes, you can use a Nix environment with
$ nix-shell $ nix develop # With flakes
make to use Stack to build Dex.
- Traditional REPL:
- Execute script:
dex script examples/pi.dx
- Live-updated notebook display
dex web examples/pi.dx(html) or
dex watch examples/pi.dx(terminal).
This is an early-stage research project, not an official Google product.