On this page:
7.1 Syntactic Forms
lambda
quote
if
let
begin
7.2 Primitives
8.12

7 Zuo Kernel Language🔗ℹ

 #lang zuo/kernel

The body of a zuo/kernel module is a single expression using a set of core syntactic forms and primitives. The expression must produce a hash table that serves as the module’s representation (see Zuo Module Protocol).

7.1 Syntactic Forms🔗ℹ

syntax

id

syntax

literal

syntax

(expr expr ...)

syntax

(lambda formals maybe-name maybe-arity-mask expr)

 
formals = (id ...)
  | id
  | (id ... . id)
     
maybe-name = string
  | 
     
maybe-arity-mask = integer
  | 

syntax

(quote datum)

syntax

(if expr expr expr)

syntax

(let ([id expr]) expr)

syntax

(begin expr ...+)

These forms are analogous to a variable reference, literal, procedure application, lambda, quote, if, let, and begin in racket, but often restricted to a single expression or binding clause. Unlike the corresponding racket or zuo forms, the names of syntactic forms are not shadowed by a lambda or let binding, and they refer to syntactic forms only at the head of a term. A reference to an unbound variable is a run-time error. If an id appears multiple times in formals, the last instance shadows the others.

A lambda form can optionally include a name and/or arity mask. If an arity mask is provided, it must be a subset of the mask implied by the formals. If formals allows 63 or more arguments, then it must allow any number of arguments (to be consistent with the possible arities expressed by a mask).

Although let and begin could be encoded with lambda easily enough, they’re useful shortcuts to make explicit internally.

7.2 Primitives🔗ℹ

The following names provided by zuo are also available in zuo/kernel (and the values originate there):

pair? null? list? cons car cdr list append reverse length
list-ref list-set
 
integer? + - * quotient remainder < <= = >= >
bitwise-and bitwise-ior bitwise-xor bitwise-not
 
string? string-length string-ref string-u32-ref substring string
string=? string-ci=? string-sha256 string-split
 
symbol? symbol->string string->symbol string->uninterned-symbol
 
hash? hash hash-ref hash-set hash-remove
hash-keys hash-count hash-keys-subset?
 
procedure? apply call/cc call/prompt
 
eq? not void
 
opaque opaque-ref
 
path-string? build-path build-raw-path split-path relative-path?
module-path? build-module-path
 
variable? variable variable-ref variable-set!
 
handle? fd-open-input fd-open-output fd-close fd-read fd-write eof
fd-terminal? cleanable-file cleanable-cancel
 
stat ls rm mv mkdir rmdir symlink readlink cp
runtime-env current-time
 
process process-status process-wait string->shell shell->strings
 
string-read ~v ~a ~s alert error arity-error arg-error
 
kernel-env kernel-eval module->hash dump-image-and-exit exit
suspend-signal resume-signal

Changed in version 1.9: Removed modulo and added remainder.