Lang is a functional programming language with static types. It uses a
modern, s-expression syntax and compiles to Java classfiles.
Lang aims to be a language fusing the ease of development found in
Clojure, the type safety found in Haskell and the data extensibility
found in PureScript.
- argument capture
- algebraic data types
- type inference
- arbitrary precision arithmetic
- macros that actually work
- labelled arguments
- superclass constraints
- sum and product types
- structural records and variants
- JVM code generation
- Java interop
- Emacs mode
- powerful standard library
- effect system
As you can see, there is plenty of work to be done. If you would like
to see any of the missing features completed, or any features not
mentioned here at all, our policy is "PRs welcome!".
Option type with map and lambda
(defmodule examples.option (:import [lang.io :as io] [lang.string :as string])) (deftype (Option T) (| [:none] [:some T])) (defn default [option fallback] (match option [:none] fallback [:some value] value)) (defn map [f option] (match option [:none] [:none] [:some value] [:some (f value)])) (defn main [argv : (Array String)] (io/println (default (map (fn [x] (string/concat x ", world!")) [:some "Hello"]) "fail")))
Installation & usage
The following requires git, a recent JDK and leiningen:
$ git clone https://github.com/jgertm/lang ... $ cd lang $ lein uberjar $ export LANG_HOME=`pwd`/std $ ./lang signature std/lang/option.lang lang.option type (Option T) default : (∀ α (-> (Option α) α α)) $ ./lang compile examples/option.lang ... $ java -cp out examples.option Planet World
Code of Conduct
Don't be a jerk. Seriously.
Hello there! The jam required you to work as a team of at least 2 people and submit a team repl. I see that you have submitted a personal repl instead.
If you have a team and team members, please edit the post description to include them.