-
Notifications
You must be signed in to change notification settings - Fork 9
Standard Library
bobappleyard edited this page Sep 13, 2010
·
11 revisions
When a new interpreter is created, a default set of bindings are available. These comprise the standard library.
(boolean? x)
(object->boolean x)
(not x)
(number? x)
(fixnum? x)
(flonum? x)
(zero? x)
(even? x)
(odd? x)
The fixnum type in Golisp corresponds to the Go type int
, likewise flonum to float
.
(+ x y)
(- x y)
(* x y)
(/ x y)
Standard arithmetic functions. If all arguments are fixnums, they will return fixnums, except in the case of /
, which will return a fixnum if there is no remainder to any of the divisions.
(quotient x y)
(remainder x y)
(modulo x m)
Perform integer division on fixnums. Given x_/_y = q + r, quotient
returns q and remainder
returns r. modulo
returns x (mod m).