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
To learn more, check out our paper, our tutorial or these example programs:
- Dex prelude
- Mandelbrot set
- Ray tracer
- Estimating pi
- Hamiltonian Monte Carlo
- ODE integrator
- Sierpinski triangle
- Basis function regression
- Brownian bridge
🚨 Dex is an experimental research project at an early stage of development. Expect monstrous bugs and razor-sharp edges!
🤝 Contributions welcome! See our issue tracker for good first issues, or browse by thematic labels.
- Install stack
- Install LLVM 9
- Ubuntu/Debian:
apt-get install llvm-9-dev
- macOS:
brew install llvm@9
- Make sure
llvm@9
is on yourPATH
before building. Example:export PATH="$(brew --prefix llvm@9)/bin:$PATH"
- Make sure
- Ubuntu/Debian:
- Install clang 9 (may be installed together with llvm)
- Ubuntu/Debian:
apt-get install clang-9
- macOS: installs with llvm
- Ubuntu/Debian:
- Install libpng (often included by default in *nix platforms)
- Ubuntu/Debian:
apt-get install libpng-dev
- macOS:
brew install libpng
- Ubuntu/Debian:
- Build Dex in development mode:
make
- Run tests in development mode:
make tests
- Install a release version of Dex:
make install
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,
set the PREFIX
environment variable before running make install
. For
example, PREFIX=$HOME make install
installs dex
in $HOME/bin
.
It is convenient to set up a dex
alias (e.g. in .bashrc
) for running Dex in
development mode:
# Linux:
alias dex="stack exec dex -- --lib-path lib"
# macOS:
alias dex="stack exec --stack-yaml=stack-macos.yaml dex -- --lib-path lib"
In order to use HLS with the Haskell code in this project:
- Install ghcup
- Run
ghcup install hls
- Create a file in the root
dex
directory calledhie.yaml
with 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 hie.yaml
file
manually. This will be ignored by git.
This should work out of the box with Emacs' lsp-haskell
package.
- Traditional REPL:
dex repl
- Execute script:
dex script examples/pi.dx
- Live-updated notebook display
dex web examples/pi.dx
(html) ordex watch examples/pi.dx
(terminal).
BSD-3
This is an early-stage research project, not an official Google product.