To compile an arbitrary form form (as opposed to a function), call
(compile form)
This compiles form as if by compile-file but without any file related processing and does it in-memory, so it has also the same effect as loading. This has a similar effect to compiling a definition in the LispWorks Editor tool, except that there is no source recording.
Using compile this way is especially useful if you need to dynamically define something that is normally defined by a top level or, for example kw:defrule
.
LispWorks User Guide and Reference Manual - 20 Sep 2017