I'm hacking some ELisp functions recently and I realize that ELisp doesn't have a filter function or support closures. That's disappointing. One sort of takes it for granted nowadays that a decent language will have both. AFAIK ELisp was written before there was a Common Lisp standard. But even then, I'm surprised it didn't evolve with the times.
I don't mind writing my own filter function since I'm only going to have to do it once. But not having closures is a little bigger impact.
Instead of being able to write something like this ...
(defun string-match-c (s) (lambda (x) (string-match s x)))
I'll have to write this instead.
(defun string-match-c (str) (lexical-let ((s str)) (lambda (x) (string-match s x))))
Usage is the same for both.
(filter (string-match-c "ba") '("foo" "bar" "baz")) ;; => ("bar" "baz")
But they really can't compare to Haskell, which doesn't need a string-match-c function defined since it supports partial application.
filter (isPrefixOf "ba") ["foo", "bar", "baz"]
Emacs is still my favorite editor, but I sure wish it was using Common Lisp, Scheme or Haskell.
maybe wlcompose.el help to solve this problem. I think Elisp support closure indirectly. In Elisp, some functions are nothing more than a list whose car is "lambda", we can construct such list(or function) as we want.