[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Concern around use of eval

From: Joost Kremers
Subject: Re: Concern around use of eval
Date: 19 Mar 2015 08:12:04 GMT
User-agent: slrn/pre1.0.0-18 (Linux)

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                         
Selbst in die Unterwelt dringt durch Spalten Licht

reply via email to

[Prev in Thread] Current Thread [Next in Thread]