|
From: | Marc Tfardy |
Subject: | Re: elisp - anonymous function in an association list? |
Date: | Thu, 29 Nov 2007 15:50:45 +0100 |
User-agent: | Thunderbird 2.0.0.9 (Windows/20071031) |
apatheticagnostic schrieb:
take, for example this code showing what I mean: (defvar sample-alist '(("a" '(lambda () (message "We worked!"))) ("b" #'(lambda () (message "B worked too!"))))) (defun test-call (x) (funcall (cdr (assoc x sample-alist)))) (test-call "a") (test-call "b") Both calls fail, with an error message like so:
This seems to work: (defvar sample-alist '(("a" (lambda () (message "We worked!"))) ("b" (lambda () (message "B worked too!"))))) (defun test-call (x) (funcall (eval (car (cdr (assoc x sample-alist)))))) (test-call "a") "We worked!" (test-call "b") "B worked too!" regards Marc
[Prev in Thread] | Current Thread | [Next in Thread] |