lux

Types

AST

The type of AST nodes for Lux syntax.

(type: AST
  (Meta Cursor (AST' (Meta Cursor))))

AST'

(type: (AST' w)
  (#BoolS Bool)
  (#NatS Nat)
  (#IntS Int)
  (#FracS Frac)
  (#RealS Real)
  (#CharS Char)
  (#TextS Text)
  (#SymbolS Ident)
  (#TagS Ident)
  (#FormS (List (w (AST' w))))
  (#TupleS (List (w (AST' w))))
  (#RecordS (List [(w (AST' w)) (w (AST' w))])))

Analysis

(type: Analysis
  (Meta [Type Cursor] Void))

Ann-Value

The value of an individual annotation.

(type: #rec Ann-Value
  (#BoolM Bool)
  (#NatM Nat)
  (#IntM Int)
  (#FracM Frac)
  (#RealM Real)
  (#CharM Char)
  (#TextM Text)
  (#IdentM Ident)
  (#ListM (List Ann-Value))
  (#DictM (List [Text Ann-Value])))

Anns

A set of annotations associated with a definition.

(type: Anns
  (List [Ident Ann-Value]))

Bindings

(type: (Bindings k v)
  {#counter Nat
   #mappings (List [k v])})

Bool

Your standard, run-of-the-mill boolean values.

(type: Bool
  (host java.lang.Boolean))

Bottom

The type of things whose type is unknown or undefined.

Useful for expressions that cause errors or other "extraordinary" conditions.

(type: Bottom
  (All [a] a))

Char

Your standard, run-of-the-mill character values.

(type: Char
  (host java.lang.Character))

Compiler

Represents the state of the Lux compiler during a run.

It is provided to macros during their invocation, so they can access compiler data.

Caveat emptor: Avoid fiddling with it, unless you know what you're doing.

(type: Compiler
  {#info Compiler-Info
   #source Source
   #cursor Cursor
   #modules (List [Text Module])
   #scopes (List Scope)
   #type-vars (Bindings Nat (Maybe Type))
   #expected (Maybe Type)
   #seed Nat
   #scope-type-vars (List Nat)
   #host Void})

Compiler-Info

Information about the current version and type of compiler that is running.

(type: Compiler-Info
  {#compiler-name Text
   #compiler-version Text
   #compiler-mode Compiler-Mode})

Compiler-Mode

A sign that shows the conditions under which the compiler is running.

(type: Compiler-Mode
  #Release
  #Debug
  #Eval
  #REPL)

Cursor

Cursors are for specifying the location of AST nodes in Lux files during compilation.

(type: Cursor
  {#module Text
   #line Int
   #column Int})

Def

Represents all the data associated with a definition: its type, its annotations, and its value.

(type: Def
  [Type Anns Void])

Either

A choice between two values of different types.

(type: (Either l r)
  (#Left l)
  (#Right r))

Frac

Fractional numbers that live in the interval [0,1).

Useful for probability, and other domains that work within that interval.

(type: Frac
  (host #Frac))

Ident

An identifier.

It is used as part of Lux syntax to represent symbols and tags.

(type: Ident
  [Text Text])

Int

Your standard, run-of-the-mill integer numbers.

(type: Int
  (host java.lang.Long))

List

A potentially empty list of values.

(type: (List a)
  #Nil
  (#Cons a (List a)))

Lux

Computations that can have access to the state of the compiler.

These computations may fail, or modify the state of the compiler.

(type: (Lux a)
  (-> Compiler (Either Text [Compiler a])))

Macro

Functions that run at compile-time and allow you to transform and extend the language in powerful ways.

(type: Macro
  (-> (List AST) (Lux (List AST))))

Maybe

A potentially missing value.

(type: (Maybe a)
  #None
  (#Some a))

Meta

The type of things that can have meta-data of arbitrary types.

(type: (Meta m v)
  {#meta m
   #datum v})

Module

All the information contained within a Lux module.

(type: Module
  {#module-hash Int
   #module-aliases (List [Text Text])
   #defs (List [Text Def])
   #imports (List Text)
   #tags (List [Text Nat (List Ident) Bool Type])
   #types (List [Text (List Ident) Bool Type])
   #module-anns Anns})

Nat

Natural numbers (unsigned integers).

They start at zero (+0) and extend in the positive direction.

(type: Nat
  (host #Nat))

Real

Your standard, run-of-the-mill floating-point numbers.

(type: Real
  (host java.lang.Double))

Scope

(type: Scope
  {#name (List Text)
   #inner-closures Int
   #locals (Bindings Text Analysis)
   #closure (Bindings Text Analysis)})

Source

(type: Source
  (List (Meta Cursor Text)))

Text

Your standard, run-of-the-mill string values.

(type: Text
  (host java.lang.String))

Top

The type of things whose type doesn't matter.

It can be used to write functions or data-structures that can take, or return, anything.

(type: Top
  (Ex [a] a))

Type

This type represents the data-structures that are used to specify types themselves.

(type: #rec Type
  (#HostT Text (List Type))
  #VoidT
  #UnitT
  (#SumT Type Type)
  (#ProdT Type Type)
  (#LambdaT Type Type)
  (#BoundT Nat)
  (#VarT Nat)
  (#ExT Nat)
  (#UnivQ (List Type) Type)
  (#ExQ (List Type) Type)
  (#AppT Type Type)
  (#NamedT Ident Type))

Unit

An unusual type that only possesses a single value: []

(type: Unit
  Unit)

Void

An unusual type that possesses no value, and thus can't be instantiated.

(type: Void
  Void)

Macros

$

## Allows you to refer to the type-variables in a polymorphic function's type, by their index.
## In the example below, +0 corresponds to the 'a' variable.
(def: #export (from-list list)
  (All [a] (-> (List a) (Vector a)))
  (List/fold add
             (: (Vector ($ +0))
                empty)
             list))

$_

## Right-association for the application of binary functions over variadic arguments.
($_ Text/append "Hello, " name ".\nHow are you?")

## =>
(Text/append "Hello, " (Text/append name ".\nHow are you?"))

&

## Tuple types:
(& Text Int Bool)

## The empty tuple, a.k.a. Unit.
(&)

'

## Quotation as a macro.
(' "YOLO")

->

## Function types:
(-> Int Int Int)

## This is the type of a function that takes 2 Ints and returns an Int.

:

## The type-annotation macro.
(: (List Int) (list 1 2 3))

:!

## The type-coercion macro.
(:! Dinosaur (list 1 2 3))

:!!

## Coerces the given expression to the type of whatever is expected.
(: Dinosaur (:!! (list 1 2 3)))

::

## Allows accessing the value of a structure's member.
(:: Codec<Text,Int> encode)

## Also allows using that value as a function.
(:: Codec<Text,Int> encode 123)

<|

## Reverse piping macro.
(<| (fold Text/append "") (interpose " ") (map ->Text) elems)

## =>
(fold Text/append ""
      (interpose " "
                 (map ->Text elems)))

@post

## Post-conditions.
## Given a predicate and an expression to run, evaluates the expression and then tests the output with the predicate.
## If the predicate returns true, returns the value of the expression.
## Otherwise, an error is raised.
(@post i.even?
       (i.+ 2 2))

@pre

## Pre-conditions.
## Given a test and an expression to run, only runs the expression if the test passes.
## Otherwise, an error is raised.
(@pre (i.= 4 (i.+ 2 2))
      (foo 123 456 789))

All

## Universal quantification.
(All [a]
  (-> a a))

## A name can be provided, to specify a recursive type.
(All List [a]
  (| Unit
     [a (List a)]))

Ex

## Existential quantification.
(Ex [a]
  [(Codec Text a)
   a])

## A name can be provided, to specify a recursive type.
(Ex Self [a]
  [(Codec Text a)
   a
   (List (Self a))])

Rec

## Parameter-less recursive types.
## A name has to be given to the whole type, to use it within it's body.
(Rec Self
  [Int (List Self)])

^

## Macro-expanding patterns.
## It's a special macro meant to be used with 'case'.
(case (: (List Int) (list 1 2 3))
  (^ (list x y z))
  (#Some ($_ i.* x y z))

  _
  #None)

^=>

## Multi-level pattern matching.
## Useful in situations where the result of a branch depends on further refinements on the values being matched.
## For example:
(case (split (size static) uri)
  (^=> (#lux;Some[chunk uri']) [(Text/= static chunk) true])
  (match-uri endpoint? parts' uri')

  _
  (#lux;Left(format "Static part " (%t static) " doesn't match URI: " uri)))

## Short-cuts can be taken when using boolean tests.
## The example above can be rewritten as...
(case (split (size static) uri)
  (^=> (#lux;Some[chunk uri']) (Text/= static chunk))
  (match-uri endpoint? parts' uri')

  _
  (#lux;Left(format "Static part " (%t static) " doesn't match URI: " uri)))

^@

## Allows you to simultaneously bind and de-structure a value.
(def: (hash (^@ set [Hash<a> _]))
  (List/fold (lambda [elem acc] (n.+ (:: Hash<a> hash elem) acc))
             +0
             (to-list set)))

^open

## Same as the "open" macro, but meant to be used as a pattern-matching macro for generating local bindings.
## Can optionally take a "prefix" text for the generated local bindings.
(def: #export (range (^open) from to)
  (All [a] (-> (Enum a) a a (List a)))
  (range' <= succ from to))

^or

## Or-patterns.
## It's a special macro meant to be used with 'case'.
(type: Weekday
  #Monday
  #Tuesday
  #Wednesday
  #Thursday
  #Friday
  #Saturday
  #Sunday)

(def: (weekend? day)
  (-> Weekday Bool)
  (case day
    (^or #Saturday #Sunday)
    true

    _
    false))

^slots

## Allows you to extract record members as local variables with the same names.
## For example:
(let [(^slots [#foo #bar #baz]) quux]
  (f foo bar baz))

^template

## It's similar to do-template, but meant to be used during pattern-matching.
(def: (beta-reduce env type)
  (-> (List Type) Type Type)
  (case type
    (#;HostT name params)
    (#;HostT name (List/map (beta-reduce env) params))

    (^template [<tag>]
      (<tag> left right)
      (<tag> (beta-reduce env left) (beta-reduce env right)))
    ([#;SumT] [#;ProdT])

    (^template [<tag>]
      (<tag> left right)
      (<tag> (beta-reduce env left) (beta-reduce env right)))
    ([#;LambdaT]
     [#;AppT])

    (^template [<tag>]
      (<tag> old-env def)
      (case old-env
        #;Nil
        (<tag> env def)

        _
        type))
    ([#;UnivQ]
     [#;ExQ])

    (#;BoundT idx)
    (default type (list;at idx env))

    _
    type
    ))

^|>

## Pipes the value being pattern-matched against prior to binding it to a variable.
(case input
  (^|> value [n.inc (n.% +10) (n.max +1)])
  (foo value))

^~

## Use global defs with simple values, such as text, int, real, bool and char, in place of literals in patterns.
## The definitions must be properly-qualified (though you may use one of the short-cuts Lux provides).
(def: (empty?' node)
  (All [K V] (-> (Node K V) Bool))
  (case node
    (^~ (#Base lux;clean-bitmap_))
    true

    _
    false))

_$

## Left-association for the application of binary functions over variadic arguments.
(_$ Text/append "Hello, " name ".\nHow are you?")

## =>
(Text/append (Text/append "Hello, " name) ".\nHow are you?")

`

## Hygienic quasi-quotation as a macro. Unquote (~) and unquote-splice (~@) must also be used as forms.
## All unprefixed macros will receive their parent module's prefix if imported; otherwise will receive the prefix of the module on which the quasi-quote is being used.
(` (def: (~ name)
     (lambda [(~@ args)]
       (~ body))))

`'

## Unhygienic quasi-quotation as a macro. Unquote (~) and unquote-splice (~@) must also be used as forms.
(`' (def: (~ name)
      (lambda [(~@ args)]
        (~ body))))

and

Short-circuiting "and".
(and true false true) ## => false

case

## The pattern-matching macro.
## Allows the usage of macros within the patterns to provide custom syntax.
(case (: (List Int) (list 1 2 3))
  (#Cons x (#Cons y (#Cons z #Nil)))
  (#Some ($_ i.* x y z))

  _
  #None)

comment

## Throws away any code given to it.
## Great for commenting-out code, while retaining syntax high-lighting and formatting in your text editor.
(comment 1 2 3 4)

cond

## Branching structures with multiple test conditions.
(cond (n.even? num) "even"
      (n.odd? num) "odd"
      ## else-branch
      "???")

def:

## Defines global constants/functions.
(def: (rejoin-pair pair)
  (-> [AST AST] (List AST))
  (let [[left right] pair]
    (list left right)))

(def: branching-exponent
  Int
  5)

default

## Allows you to provide a default value that will be used
## if a (Maybe x) value turns out to be #;None.
(default 20 (#;Some 10)) => 10

(default 20 #;None) => 20

do-template

## By specifying a pattern (with holes), and the input data to fill those holes, repeats the pattern as many times as necessary.
(do-template [<name> <diff>]
             [(def: #export <name>
                (-> Int Int)
                (i.+ <diff>))]

             [i.inc  1]
             [i.dec -1])

doc

## Creates code documentation, embedding text as comments and properly formatting the forms it's being given.

## For Example:
(doc "Allows arbitrary looping, using the \"recur\" form to re-start the loop.
      Can be used in monadic code to create monadic loops."
     (loop [count 0
            x init]
       (if (< 10 count)
         (recur (i.inc count) (f x))
         x)))

exec

## Sequential execution of expressions (great for side-effects).
(exec
  (log! "#1")
  (log! "#2")
  (log! "#3")
  "YOLO")

get@

## Accesses the value of a record at a given tag.
(get@ #field my-record)

## Can also work with multiple levels of nesting:
(get@ [#foo #bar #baz] my-record)

## And, if only the slot/path is given, generates an
## accessor function:
(let [getter (get@ [#foo #bar #baz])]
  (getter my-record))

host

## Macro to treat host-types as Lux-types.
(host java.lang.Object)

(host java.util.List [java.lang.Long])

ident-for

## Given a symbol or a tag, gives back a 2 tuple with the prefix and name parts, both as Text.
(ident-for #lux;doc)

## =>
["lux" "doc"]

if

Picks which expression to evaluate based on a boolean test value.

(if true
  "Oh, yeah!"
  "Aw hell naw!")

== "Oh, yeah!"

lambda

## Syntax for creating functions.
## Allows for giving the function itself a name, for the sake of recursion.
(: (All [a b] (-> a b a))
   (lambda [x y] x))

(: (All [a b] (-> a b a))
   (lambda const [x y] x))

let

## Creates local bindings.
## Can (optionally) use pattern-matching macros when binding.
(let [x (foo bar)
      y (baz quux)]
  (op x y))

let%

## Controlled macro-expansion.
## Bind an arbitraty number of ASTs resulting from macro-expansion to local bindings.
## Wherever a binding appears, the bound ASTs will be spliced in there.
(test: "AST operations & structures"
  (let% [<tests> (do-template [<expr> <text> <pattern>]
                   [(compare <pattern> <expr>)
                    (compare <text> (:: AST/encode show <expr>))
                    (compare true (:: Eq<AST> = <expr> <expr>))]

                   [(bool true)                             "true"       [["" -1 -1] (#lux;BoolStrue)]]
                   [(bool false)                            "false"      [_ (#lux;BoolSfalse)]]
                   [(int 123)                               "123"        [_ (#lux;IntS123)]]
                   [(real 123.0)                            "123.0"      [_ (#lux;RealS123.0)]]
                   [(char #"\n")                            "#\\"\\n\\"" [_ (#lux;CharS#"\n")]]
                   [(text "\\n")                            "\\"\\n\\""  [_ (#lux;TextS"\\n")]]
                   [(tag ["yolo" "lol"])                    "#yolo;lol"  [_ (#lux;TagS["yolo" "lol"])]]
                   [(symbol ["yolo" "lol"])                 "yolo;lol"   [_ (#lux;SymbolS["yolo" "lol"])]]
                   [(form (list (bool true) (int 123)))     "(true 123)" (^ [_ (#lux;FormS(list [_ (#lux;BoolStrue)] [_ (#lux;IntS123)]))])]
                   [(tuple (list (bool true) (int 123)))    "[true 123]" (^ [_ (#lux;TupleS(list [_ (#lux;BoolStrue)] [_ (#lux;IntS123)]))])]
                   [(record (list [(bool true) (int 123)])) "{true 123}" (^ [_ (#lux;RecordS(list [[_ (#lux;BoolStrue)] [_ (#lux;IntS123)]]))])]
                   [(local-tag "lol")                       "#lol"       [_ (#lux;TagS["" "lol"])]]
                   [(local-symbol "lol")                    "lol"        [_ (#lux;SymbolS["" "lol"])]])]

    (test-all <tests>)))

list

## List-construction macro.
(list 1 2 3)

list&

## List-construction macro, with the last element being a tail-list.
## In other words, this macro prepends elements to another list.
(list& 1 2 3 (list 4 5 6))

loop

## Allows arbitrary looping, using the "recur" form to re-start the loop.
## Can be used in monadic code to create monadic loops.
(loop [count 0
       x init]
  (if (< 10 count)
    (recur (i.inc count) (f x))
    x))

macro:

Macro-definition macro.

(macro: #export (ident-for tokens)
  (case tokens
    (^template [<tag>]
     (^ (list [_ (<tag> [prefix name])]))
     (return (list (` [(~ (text$ prefix)) (~ (text$ name))]))))
    ([#;SymbolS] [#;TagS])

    _
    (fail "Wrong syntax for ident-for")))

module:

Module-definition macro.

Can take optional annotations and allows the specification of modules to import.

## Examples
(;module: {#;doc "Some documentation..."}
  lux
  (lux (control (monad #as M #refer #all))
       (data (text #open ("Text/" Monoid<Text>))
             (struct (list #open ("List/" Monad<List>)))
             maybe
             (ident #open ("Ident/" Codec<Text,Ident>)))
       meta
       (macro ast))
  (.. (type #open ("" Eq<Type>))))

(;module: {#;doc "Some documentation..."}
  lux
  (lux (control ["M" monad #*])
       (data [text "Text/" Monoid<Text>]
             (struct [list "List/" Monad<List>])
             maybe
             [ident "Ident/" Codec<Text,Ident>])
       meta
       (macro ast))
  (.. [type "" Eq<Type>]))

open

## Opens a structure and generates a definition for each of its members (including nested members).
## For example:
(open Number<Int> "i:")
## Will generate:
(def: i:+ (:: Number<Int> +))
(def: i:- (:: Number<Int> -))
(def: i:* (:: Number<Int> *))
...

or

Short-circuiting "or".
(or true false true) ## => true

set@

## Sets the value of a record at a given tag.
(set@ #name "Lux" lang)

## Can also work with multiple levels of nesting:
(set@ [#foo #bar #baz] value my-record)

## And, if only the slot/path and (optionally) the value are given, generates a
## mutator function:
(let [setter (set@ [#foo #bar #baz] value)]
  (setter my-record))

(let [setter (set@ [#foo #bar #baz])]
  (setter value my-record))

sig:

## Definition of signatures ala ML.
(sig: #export (Ord a)
  (: (Eq a)
     eq)
  (: (-> a a Bool)
     <)
  (: (-> a a Bool)
     <=)
  (: (-> a a Bool)
     >)
  (: (-> a a Bool)
     >=))

struct

Not meant to be used directly. Prefer "struct:".

struct:

## Definition of structures ala ML.
(struct: #export Ord<Int> (Ord Int)
  (def: eq Eq<Int>)
  (def: (< test subject)
    (lux;< test subject))
  (def: (<= test subject)
    (or (lux;< test subject)
        (lux;= test subject)))
  (def: (lux;> test subject)
    (lux;> test subject))
  (def: (lux;>= test subject)
    (or (lux;> test subject)
        (lux;= test subject))))

template:

## Define macros in the style of do-template and ^template.
## For simple macros that don't need any fancy features.
(template: (square x)
  (i.* x x))

type

## Takes a type expression and returns it's representation as data-structure.
(type (All [a] (Maybe (List a))))

type-of

## Generates the type corresponding to a given definition or variable.
(let [my-num (: Int 123)]
  (type-of my-num))

## ==
Int

type:

## The type-definition macro.
(type: (List a)
  #Nil
  (#Cons a (List a)))

undefined

## Meant to be used as a stand-in for functions with undefined implementations.
## Undefined expressions will type-check against everything, so they make good dummy implementations.
(def: (square x)
  (-> Int Int)
  (undefined))

## If an undefined expression is ever evaluated, it will raise an error.

update@

## Modifies the value of a record at a given tag, based on some function.
(update@ #age i.inc person)

## Can also work with multiple levels of nesting:
(update@ [#foo #bar #baz] func my-record)

## And, if only the slot/path and (optionally) the value are given, generates a
## mutator function:
(let [updater (update@ [#foo #bar #baz] func)]
  (updater my-record))

(let [updater (update@ [#foo #bar #baz])]
  (updater func my-record))

with-cursor

## Given some text, appends to it a prefix for identifying where the text comes from.
## For example:
(with-cursor (format "User: " user-id))

## Would be the same as:
(format "[the-module,the-line,the-column] " (format "User: " user-id))

|

## Variant types:
(| Text Int Bool)

## The empty tuple, a.k.a. Void.
(|)

|>

## Piping macro.
(|> elems (map ->Text) (interpose " ") (fold Text/append ""))

## =>
(fold Text/append ""
      (interpose " "
                 (map ->Text elems)))

|>.

## Similar to the piping macro, but rather than taking an initial object to work on, creates a function for taking it.
(|> (map ->Text) (interpose " ") (fold Text/append ""))
## =>
(lambda [<something>]
  (fold Text/append ""
         (interpose " "
                    (map ->Text <something>))))

Values

.

Function composition.

(All [a b c] (-> (-> b c) (-> a b) a c))

(error! message)

## Causes an error, with the given error message.
(error! "OH NO!")

(-> Text Bottom)

f.%

Frac(tional) remainder.

(-> Frac Frac Frac)

f.*

Frac(tional) multiplication.

(-> Frac Frac Frac)

f.+

Frac(tional) addition.

(-> Frac Frac Frac)

f.-

Frac(tional) substraction.

(-> Frac Frac Frac)

f./

Frac(tional) division.

(-> Frac Frac Frac)

f.<

Fractional less-than.

(-> Frac Frac Bool)

f.<=

Fractional less-than-equal.

(-> Frac Frac Bool)

f.=

Fractional equality.

(-> Frac Frac Bool)

f.>

Fractional greater-than.

(-> Frac Frac Bool)

f.>=

Fractional greater-than-equal.

(-> Frac Frac Bool)

f.max

Frac(tional) maximum.

(-> Frac Frac Frac)

f.min

Frac(tional) minimum.

(-> Frac Frac Frac)

(frac-to-real input)

(-> Frac Real)

i.%

Int(eger) remainder.

(-> Int Int Int)

i.*

Int(eger) multiplication.

(-> Int Int Int)

i.+

Int(eger) addition.

(-> Int Int Int)

i.-

Int(eger) substraction.

(-> Int Int Int)

i./

Int(eger) division.

(-> Int Int Int)

i.<

Integer less-than.

(-> Int Int Bool)

i.<=

Integer less-than-equal.

(-> Int Int Bool)

i.=

Integer equality.

(-> Int Int Bool)

i.>

Integer greater-than.

(-> Int Int Bool)

i.>=

Integer greater-than-equal.

(-> Int Int Bool)

(i.dec value)

Decrement function.

(-> Int Int)

(i.even? n)

(-> Int Bool)

(i.inc value)

Increment function.

(-> Int Int)

i.max

Int(eger) maximum.

(-> Int Int Int)

i.min

Int(eger) minimum.

(-> Int Int Int)

(i.odd? n)

(-> Int Bool)

(id x)

Identity function.

Does nothing to it's argument and just returns it.

(All [a] (-> a a))

(int-to-nat input)

(-> Int Nat)

(int-to-real n)

(-> Int Real)

(is left right)

## Tests whether the 2 values are identical (not just "equal").
## This one should succeed:
(let [value 5]
  (is 5 5))

## This one should fail:
(is 5 (i.+ 2 3))

(All [a] (-> a a Bool))

log!

Logs message to standard output.

Useful for debugging.

(-> Text Unit)

n.%

Nat(ural) remainder.

(-> Nat Nat Nat)

n.*

Nat(ural) multiplication.

(-> Nat Nat Nat)

n.+

Nat(ural) addition.

(-> Nat Nat Nat)

n.-

Nat(ural) substraction.

(-> Nat Nat Nat)

n./

Nat(ural) division.

(-> Nat Nat Nat)

n.<

Natural less-than.

(-> Nat Nat Bool)

n.<=

Natural less-than-equal.

(-> Nat Nat Bool)

n.=

Natural equality.

(-> Nat Nat Bool)

n.>

Natural greater-than.

(-> Nat Nat Bool)

n.>=

Natural greater-than-equal.

(-> Nat Nat Bool)

(n.dec value)

Decrement function.

(-> Nat Nat)

(n.even? n)

(-> Nat Bool)

(n.inc value)

Increment function.

(-> Nat Nat)

n.max

Nat(ural) maximum.

(-> Nat Nat Nat)

n.min

Nat(ural) minimum.

(-> Nat Nat Nat)

(n.odd? n)

(-> Nat Bool)

(nat-to-int input)

(-> Nat Int)

not

## Boolean negation.

(not true) == false

(not false) == true

(-> Bool Bool)

r.%

Real remainder.

(-> Real Real Real)

r.*

Real multiplication.

(-> Real Real Real)

r.+

Real addition.

(-> Real Real Real)

r.-

Real substraction.

(-> Real Real Real)

r./

Real division.

(-> Real Real Real)

r.<

Real less-than.

(-> Real Real Bool)

r.<=

Real less-than-equal.

(-> Real Real Bool)

r.=

Real equality.

(-> Real Real Bool)

r.>

Real greater-than.

(-> Real Real Bool)

r.>=

Real greater-than-equal.

(-> Real Real Bool)

r.max

Real minimum.

(-> Real Real Real)

r.min

Real minimum.

(-> Real Real Real)

(real-to-frac input)

(-> Real Frac)

(real-to-int n)

(-> Real Int)