Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [closures]

The tag has no usage guidance.

6
votes
1answer
853 views

How to make local function binding for closure?

For example, when defining the natural number sequence stream, I can use ;; -*- lexical-binding: t; -*- (defun nats (n) (cons n (lambda () (nats (1+ n))))) (nats 0) => (0 closure ((n . 0) ...
3
votes
1answer
88 views

About closure creation

After reading this article about readable closures, I check that: Since closures are byte-code function objects, they print readably. You can capture an environment in a closure, serialize it, ...
2
votes
1answer
276 views

Why does this straightforward use of a closure fail?

Suppose you save the following code to some file test.el and then do load-file test.el ;;; -*- lexical-binding: t -*- (let ((closure-vbl 0)) (defun tst () (eval 'closure-vbl))) (tst) You get ...
0
votes
1answer
26 views

capture and replay a closure later

I am having a problem working with closures. I hope I can explain this clearly. When I try to start a compilation I typically do it like this: (let ((dir (get-dir)) (model-root root) (default-...