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

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

Re: How to create a higher order function?


From: Emanuel Berg
Subject: Re: How to create a higher order function?
Date: Tue, 21 Sep 2021 06:50:45 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Marcin Borkowski wrote:

> ;;; -*- lexical-binding: nil; -*-
> (defun negate (fun)
>   "Return a function returning the logical opposite of FUN."
>   `(lambda (&rest args)
>     (not (apply ,(symbol-function fun) args))))
>
> It seems to work fine, even if it's a bit complicated.

symbol -> list

If you want a symbol to symbol mapping you can use
`make-symbol' and then `setf' on the `symbol-function' of the
argument symbol - maybe ...

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

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