help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: How to quote a list of functions?


From: Emanuel Berg
Subject: Re: How to quote a list of functions?
Date: Thu, 20 Aug 2015 00:04:54 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Marcin Borkowski <mbork@mbork.pl> writes:

> As I wrote: Imagine that you write a function
> operating on (general) lists. For instance, `car' is
> such a function: it takes (any) list as an argument
> (well, for the empty one it signals an error).
> Another example: some time ago I needed a `flatten'
> function, absent from Elisp, so I took one from
> message.el. (I would bet that such a function is
> defined in a lot of Elisp libraries, which is
> another story.)
>
> (defun flatten-list (list) "Return a new, flat list
> that contains all elements of LIST.
>
> \(flatten-list '(1 (2 3 (4 5 (6))) 7)) => (1 2 3 4 5 6
> 7)
>
> Taken from message.el." (cond ((consp list) (apply
> #'append (mapcar #'flatten-list list))) (list (list
> list))))
>
> Calling the argument of this function `list' seems
> natural, and has an added benefit that the second
> `cond' clause looks quite cute.

I still don't understand what this illustrates.

But, `mapcar' and `apply' are two other cases.
Both take FUNCTIONs as arguments so the sharp quote is
called for, if this method is to be adhered to.

But as for "list", I would say no, calling the
argument that isn't good because as you say, it is
already the name of a common function that people's
eyes are trained to recognize (being something else).
Better to call it "l" or whatever.

-- 
underground experts united
http://user.it.uu.se/~embe8573




reply via email to

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