keithlisp/doc/stdlib_misc.md

47 lines
1.0 KiB
Markdown

# Miscellaneous Functions
## `type-of`
```
(type-of value)
```
`type-of` returns an atom indicating the type of `value`, or nil if
`value` is nil.
## `addr-of`
```
(addr-of value)
```
`addr-of` returns the raw immediate value of its argument as an int. For
conses, strings, and funptrs, this is their memory address (hence the
name). For ints, floats, and atoms, this returns their raw bytes
interpreted as a signed 2's-complement integer.
## `set`
```
(set atom value)
```
`set` changes the value associated with `atom` in the syms-alist, or
creates the association if it does not already exist. It then returns
`value`.
## `unset!`
```
(unset! atom)
```
`unset` deletes the topmost entry for `atom` in the syms-alist, and
returns the value `atom` previously held.
## `fun`
```
(fun atom)
```
`fun` returns the function associated with `atom` in the funs-alist, or
nil if no such function exists.
## `print`
```
(print &rest values)
```
`print` outputs each of its arguments to standard output, separated by
spaces and followed by a newline.