Page MenuHomePhabricator

First set of builtin functions
Closed, ResolvedPublic

Description

Here's a first set of builtin functions we will provide initially:

  • if: Boolean, T, T ➝ T
  • value by key: Key reference, T ➝ U
  • reify: Any ➝ List(Pair(Key reference, Any))
  • abstract: List(Pair(Key reference, Any)) ➝ Any
  • head: List(T) ➝ T
  • tail: List(T) ➝ T
  • empty: List(T) ➝ Boolean
  • cons: T, List(T) ➝ List(T)
  • first: Pair(T1, T2) ➝ T1
  • second: Pair(T1, T2) ➝ T2
  • convert: String ➝ List(Character)
  • convert: List(Character) ➝ String
  • same: Character, Character ➝ Boolean
  • unquote: Quote ➝ Any
  • validator (for all initial types) ➝ List(Error)

Note that generics will be added only later in Phase ζ.

For completeness, here is the full list of Types expected at this time (given that we need them for the above functions and the rest of the system):

  • Z1/Object
  • Z2/Persisten object
  • Z3/Key
  • Z4/Type
  • Z5/Error (will become generic)
  • Z6/String
  • Z7/Function call
  • Z8/Function (will become generic)
  • Z9/Reference
  • Z10/List (will become generic)
  • Z11/Monolingual text
  • Z12/Multilingual text
  • Z14/Implementation
  • Z20/Test
  • Z22/Pair
  • Z99/Quote
  • Z86/Character
  • Z40/Boolean
  • Z23/Nothing