Sigrid Solveig Haflínudóttirdocs: fn*2d4315d1 month agoHistory
109 lines · 2.3 KB · Text
RawDownload
(doc-group misc  «Miscellaneous.») (defdoc T  «A boolean "true".»  :doc-example  «(not T)   ; ↳ NIL»  :doc-example  «(if T 'yes 'no)   ; ↳ yes»  :doc-group misc  :doc-see NIL) (defdoc (sym term . rest)  «Return a symbol with the name being the concatenation of terms   formatted as strings.    This is equivalent to `(sym (str …))`.»  :doc-example  «(sym "a" 'b 1)   ; ↳ ab1»   :doc-group misc   :doc-see sym?) (defdoc (set-top-level-value! sym expr)  «Evaluate the expression and assign the result to the symbol in the top   level (global) environment.    The use of this function is discouraged.  For the usual assignment of   values to names it is recommended instead to use `(def …)` and/or   `(set!  …)`.»  :doc-example  «(let {[abc 2]}     (set-top-level-value! 'abc 123)     abc)   ; ↳ 2   abc   ; ↳ 123»  :doc-group misc  :doc-see top-level-value  :doc-see set!) (defdoc (top-level-value sym)  «Return the value bound to the symbol in the top level (global)   environment.»  :doc-example  «(def abc 1)   (let {[abc 2]}     (cons abc (top-level-value 'abc)))   ; ↳ (2 . 1)   abc   ; ↳ 1»  :doc-group misc  :doc-see set-top-level-value!) (defdoc (makunbound sym)  «Make the symbol unbound.»  :doc-example  «(def x 1)   (bound? 'x)   ; ↳ T   x   ; ↳ 1   (makunbound 'x)   (bound? 'x)   ; ↳ NIL   x   ; ‼ eval: variable x has no value»  :doc-group misc  :doc-see bound?) (defdoc (size-of v)  «Return the size of the value in bytes, if applicable.    Works only with C integer types, arrays, strings, and in-memory   buffers.»  :doc-example  «(size-of "hello")   ; ↳ 5»  :doc-example  «(size-of (arr 'u32 1 2 3))   ; ↳ 12»  :doc-example  «(def b (buffer))   (io-write b "hello")   (size-of b)   ; ↳ 5»  :doc-group misc  :doc-see type-of) (defdoc (fn name code maxstack . rest)  «A function constructor.»  :doc-group misc) (defdoc (fn-code fn)  «Return the code of the function.    If the argument is a built-in function implemented in C, the   function itself is returned instead.»  :doc-group misc) (defdoc (fn-vals fn)  «Return the vector of values used by the function.»  :doc-group misc) (defdoc (fn-name fn)  «Return the name of the function as a symbol.»  :doc-group misc)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t