I created a function that returns a function in Elisp:
(defun singleton-set (elem) (defun f (n) (= n elem)) f)
I try to run this in IELM, a
How to make functions returning functions possible in Emacs Lisp?
Using fake closures, and lexical-let.
lexical-let
What is the reason this mechanism is different from other languages like Python, Scala or Clojure?
Richard Stallman answered this question in a paper he wrote a while ago.