X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=README.md;fp=README.md;h=ad9bcb622e2c916baae578c9dedecef398a47242;hb=82370fd12b07679559c9e0b3f720aade582d42fb;hp=a873afe8640012eb0aa5230f95b730fd449870ca;hpb=eb6e5aec7684f2db4bab65b46b7d067d598bff85;p=cl-mock.git diff --git a/README.md b/README.md index a873afe..ad9bcb6 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,32 @@ e.g. dynamic `FLET` and method bindings with `PROGM` may be of general interest. +# GENERIC FUNCTIONS + +Since behaviour isn't bound to classes, but to generic functions, +creating new classes on the fly isn't particularly interesting. + +We provide the form `PROGM` to bind a number of methods during the +execution of its contained body: + + > (progm + > '((baz NIL (list))) + > '((lambda (list) list)) + > ...) + +For example: + + > (defclass foo () ()) + > (defgeneric baz (foo) + (:method ((foo foo)) + 42)) + > (progm '((baz NIL (list))) + '((lambda (list) list)) + (values (baz (make-instance 'foo)) (baz '(1 2 3)))) + > => 42 + > => (1 2 3) + + # UTILITIES `DFLET` dynamically rebinds functions similar to `FLET`: @@ -43,5 +69,4 @@ The underlying function `PROGF` may be used as well similarly to standard > => 23 > (OR) => 42, if FOO was inlined - [1]: http://common-lisp.net/project/closer/closer-mop.html