Skip to content
/ mlatu Public
forked from mlatu-lang/mlatu

A statically-typed purely-functional concatenative programming language

License

Notifications You must be signed in to change notification settings

helvm/mlatu

 
 

Repository files navigation

The Mlatu Programming Language

Join the chat at https://gitter.im/mlatu-lang/community

Mlatu is a statically typed, stack-based purely functional programming language designed for simplicity, speed, and safety.

Very experimental: contributions welcome, but please don't use this in production. If you wish to contribute see here for more information.

I make announcements, discuss the languaage, and am available to answer questions on this Discord channel and this Gitter community.

Features

Functions are first-class values, (higher-order functions) can be passed around as function arguments and results, and stored in data structures exactly as other values. The use of algebraic data types combined with pattern matching make it easy to handle very complex data structures in a natural way. The strong type system and automatic type inference provide increased safety from programming errors. Parametric polymorphism encourages the programmer to write general functions that can later be reused.

Examples

Here's a naive recursive fibonacci function:

define fib (nat -> nat) {
  -> x; match (x 2 le) | true { 1 } | false { x pred fib x pred pred fib + }
}

20 fib println

Here's the definition of exists in std/common/list.mlt, which demonstrates a more functional style, as well as some of the functions available out of the gate in the prelude.

define exists (for t. t list, (t -> bool) -> bool) {
  -> f; true { f call or } fold-left
}

See the /examples folder for more examples.

Installation and Usage

Installation

These installation instructions presume you have the Haskell Tool Stack installed. If you don't you can install it here.

Via stack:

git clone https://github.com/brightly-salty/mlatu.git
cd mlatu
stack install

Note: cabal v2-install exe:mlatu should also work.

Usage

The Mlatu programming language

Usage: mlatu COMMAND

Available options:
  -h,--help                Show this help text

Available commands:
  repl                     Start the interactive REPL
  check                    Checks Mlatu files for correctness without running
                           them
  fmt                      Formats Mlatu files prettily
  run                      Runs Mlatu files
  build                    Builds Mlatu files into an executable

Type :help in the interactive REPL for command options.

Miscellany

"Mlatu" is the Lojban word for "cat", referencing Cat by Christopher Diggins, Kitten by Jon Purdy, and the fact that Mlatu is a concatenative programming language.

"Mlatu" is pronounced "melatoo".

The source is based with gratitude off of the source of Kitten by Jon Purdy.

Mlatu is licensed under the Peace Public License v0.0+ available here. The canonical version is located at https://github.com/brightly-salty/peace-license

About

A statically-typed purely-functional concatenative programming language

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Languages

  • Haskell 99.9%
  • Dhall 0.1%