Searching the documentation


The new features in uLisp 4.4 make it possible to write functions that process the integral documentation provided in uLisp.

For example, the following function find-doc lets you search the documentation for a particular substring:

(defun find-doc (str)
   #'(lambda (k)
       (let ((d (documentation k)))
         (when (search str d) (format t "~a~%~%" d))))
   (apropos-list ""))

This uses apropos-list, which returns a list of symbols matching a specified string. Giving the empty string returns a list of all the symbols.

Then it uses documentation to return the documentation string for each function, and search to search that for the specified substring.

For example, suppose you’ve forgotten what the Lisp function is to raise a number to a power. You can simply do:

> (find-doc "power")
(expt number power)
Returns number raised to the specified power.
Returns the result as an integer if the arguments are integers and the result will be within range,
otherwise a floating-point number.

(sleep secs)
Puts the processor into a low-power sleep mode for secs.
Only supported on some platforms. On other platforms it does delay(1000*secs).