miniMAL

A Delightfully Diminutive Lisp

miniMAL:  min ( 932 bytes), orig (4460 bytes)
Core Lib: min (1012 bytes), orig (4278 bytes)

miniMAL at a glance

Lisp-0 / JSON Source

Scalars 123, null, true, false, "symbol", "+"
Strings ["`", "quoted symbol is a string"]
List [7, 8, 9]
Objects {"a": 123, "b": 789}

Functions

Calling ["+", 2, 3]
Anonymous ["fn", ["a"], ["+", 2, "a"]]
Named ["def", "inc2",
  ["fn", ["a"], ["+", 2, "a"]]]
Higher Order ["map", "inc2",
  ["list", 2,3,4]]
Variadic ["def", "drop1",
  ["fn", ["a", "&", "b"], "b"]]

JavaScript Interop

Evaluate JavaScript ["js", ["`", "2 + 3"]]
Method call/access [".", "Object",
  ["`", "keys"], {"a": 1}]
Data Type ["classOf", 123]

Metaprogramming

Macros ["def","unless",["~",["fn",["p","a","b"],
  ["list",["`","if"],"p","b","a"]]]]
Eval ["eval",["`", ["+", 2,3]]]

Special Forms

Conditional ["if", [">", 3, 2], 7, 8]
Multiple Actions
(side-effects)
["do", ["prn", 123], 456]
Environment Bindings ["def", "x", 123]
["let", ["y", 456],
  ["*", 2, "y"]]
Quote ["`", ["prn", 123]]
Error Handling ["try", "abc",
  ["catch", "e",
    ["prn", "e"]]]

Core Library

Math "+", "-", "*", "/"
Conditional Macros "and", "or"
Comparison/Boolean "=", "<", ">", "<=", ">=", "not"
Predicates "null?", "true?", "false?", "string?", "list?", "contains?", "empty?"
List Functions "apply", "list", "cons", "concat", "nth", "first", "last", "rest", "count", "empty?"
Object Functions "get", "set", "contains?", "keys", "vals"
String Functions "str", "pr-str", "prn", "println"