How do I do closures in Emacs Lisp?

2019-01-08 11:38发布

I'm trying to create a function on the fly that would return one constant value.

In JavaScript and other modern imperative languages I would use closures:

function id(a) {
    return function() {return a;};
}

but Emacs lisp doesn't support those.

I can create mix of identity function and partial function application but it's not supported either.

So how do I do that?

7条回答
啃猪蹄的小仙女
2楼-- · 2019-01-08 12:31
登录 后发表回答