Hi all, I would like to propose the following adjustment to the way that key-forms for btree indexes are converted into functions. Currently this is done by looking up the fdefinition of the symbol provided or calling compile nil on the form. I would like to amend this to also allow function forms eg. '(create-indexer "foo")
Keyform lookup would then work as follows. a) (and (symbolp key) (fboundp key)) => (fdefintiion key) b) (and (consp key) (eql (first key) 'lambda)) => (compile nil key) c) (consp key) => (apply (first key) (rest key)) d) error 'invalid-keyform and is used something like the following. (defun create-indexer (tag) (lambda (idx k v) (declare (ignore idx k)) (values (find tag (tags-of v)) (tags-of v)))) and indexes using this can be created by using (list 'create-indexer name) as the key-form. While the functionality of this can be accomplished using (compile nil ...) it seems a bit lispier to invoke a function which subsequently returns a function (and also offers a performance advantage). I've attached a patch which implements this on the shared-initalize :after method for btree-index. cheers, sean.
funcalls.darcs
Description: Binary data
_______________________________________________ elephant-devel site list elephant-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/elephant-devel