[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
How to quote a list of functions?
From: |
Marcin Borkowski |
Subject: |
How to quote a list of functions? |
Date: |
Sun, 09 Aug 2015 01:42:10 +0200 |
Hi all,
It is well known that functions should be quoted with sharp-quote and
not just regular quote, i.e., #'my-function and not 'my-function. (See
http://endlessparentheses.com/get-in-the-habit-of-using-sharp-quote.html,
for instance.) Does that mean that I should quote a /list/ of functions
with it, too? So: #'(some-function some-other-function), for example?
(A list of functions makes sense in customizing certain behaviors, like
hooks or filter lists in Org.)
An even more complicated situation: in my use case, the list of function
is a format for displaying something. (The "something" has a bunch of
fields/properties, and I want the user to be able to customize which
fields, in what order and what format should be displayed. So, for
example, I'll have a function like
(defun format-field-one (record width)
(format (format "%%%ds" width) (cdr (assoc 'field-one record))))
I want to be able to include in my custom "format" things like
(format-field-one 4)
which would make it so that the function format-field-one will be called
with arguments "record" and "4" (for subseqeuent records). Like this:
(mapcar (lambda (record)
(mapcar (lambda (field-specifier)
(apply (car field-specifier)
record
(cdr field-specifier)))
custom-format))
record-list)
(Hopefully I didn't mess up the above - I'll test it soon anyway, but
you get the idea.)
So, should I define custom-format like
(setq custom-format #'((format-field-one 4) ...))
or just
(setq custom-format '((format-field-one 4) ...))?
TIA,
--
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University
- How to quote a list of functions?,
Marcin Borkowski <=
- Re: How to quote a list of functions?, Dmitry Gutov, 2015/08/08
- Message not available
- Re: How to quote a list of functions?, Pascal J. Bourguignon, 2015/08/08
- Re: How to quote a list of functions?, Marcin Borkowski, 2015/08/09
- Message not available
- Re: How to quote a list of functions?, Pascal J. Bourguignon, 2015/08/09
- Re: How to quote a list of functions?, Marcin Borkowski, 2015/08/09
- Message not available
- Re: How to quote a list of functions?, Pascal J. Bourguignon, 2015/08/09
Re: How to quote a list of functions?, Emanuel Berg, 2015/08/08