emacs-devel
[Top][All Lists]
Advanced

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

Re: Always-true predicate?


From: Andrea Corallo
Subject: Re: Always-true predicate?
Date: Wed, 17 Feb 2021 12:31:57 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Currently, Emacs has:
>
> ----
>    Sometimes, when you call a functional, it is useful to supply a no-op
> function as the argument.  Here are two different kinds of no-op
> function:
>
>  -- Function: identity argument
>      This function returns ARGUMENT and has no side effects.
>
>  -- Function: ignore &rest arguments
>      This function ignores any ARGUMENTS and returns ‘nil’.
> ----
>
> `identity' is kinda-sorta used as the opposite of `ignore' many places
> where you're feeding predicates to functions, but takes only one
> parameter and, of course, returns nil if you give it nil.
>
> Would it make sense to add a function that's exactly the opposite of
> `ignore' (for symmetry and convenience)?  If so, what would it be
> called?
>
> I've googled to see what other languages do.  Rust and NPM has "always",
> and many more Java-inspired frameworks have "truePredicate", but this
> isn't trivial to google for...

Maybe something like CONSTANTLY would be more generic?

<http://www.lispworks.com/documentation/HyperSpec/Body/f_cons_1.htm>

  Andrea



reply via email to

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