From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Joost Kremers Newsgroups: gmane.emacs.help Subject: Re: Concern around use of eval Date: 19 Mar 2015 08:12:04 GMT Message-ID: References: NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1426752919 22813 80.91.229.3 (19 Mar 2015 08:15:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 19 Mar 2015 08:15:19 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Mar 19 09:15:18 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YYVbq-0005nx-JT for geh-help-gnu-emacs@m.gmane.org; Thu, 19 Mar 2015 09:15:18 +0100 Original-Received: from localhost ([::1]:37657 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYVbp-0002jS-UV for geh-help-gnu-emacs@m.gmane.org; Thu, 19 Mar 2015 04:15:17 -0400 Original-Path: usenet.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 39 Original-X-Trace: individual.net a2jdC772tQ49vMBaqzk16AdpQ92yo6j5yvg3dsQxSE0x4/2fFL Cancel-Lock: sha1:NOmUi2zmG+AYfKQj4weMtx+OClU= Mail-Copies-To: nobody X-Editor: Emacs of course! User-Agent: slrn/pre1.0.0-18 (Linux) Original-Xref: usenet.stanford.edu gnu.emacs.help:210930 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:103209 Archived-At: Tassilo Horn wrote: > Well, in case the `lh/label' value is available at compile-time then > `lh/define-predicates' can also be a macro and you can go like this: > > --8<---------------cut here---------------start------------->8--- > (defvar lh/labels '("label1" "label2" "label3")) > > (defmacro lh/gen-predicate (label) > `(defun ,(intern (concat "lh/" label "-p")) () > (member ,label *lh/system-label-store*))) > > (defmacro lh/define-predicates () > `(progn > ,@(mapcar (lambda (label) > `(lh/gen-predicate ,label)) > lh/labels))) > > (lh/define-predicates) > --8<---------------cut here---------------end--------------->8--- Why not do it at the top level directly? E.g.: ,---- | (defvar lh/labels '("label1" "label2" "label3")) | | (defmacro lh/gen-predicate (label) | `(defun ,(intern (concat "lh/" label "-p")) () | (member ,label *lh/system-label-store*))) | | (mapc (lambda (label) | (lh/gen-predicate label)) | lh/labels) `---- -- Joost Kremers joostkremers@fastmail.fm Selbst in die Unterwelt dringt durch Spalten Licht EN:SiS(9)