emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Get generators working in an src block?
@ 2020-07-04 22:02 George Mauer
  2020-07-05  0:24 ` Kyle Meyer
  0 siblings, 1 reply; 2+ messages in thread
From: George Mauer @ 2020-07-04 22:02 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 910 bytes --]

I prefer to use source blocks for pretty much all my language learning.

I am trying to figure out generators in emacs-lisp but can't seem to run it
in a block.

I have

```
    #+begin_src emacs-lisp :results output
      (setq lexical-binding t)
      (require 'generator)

      (iter-defun my-iter (x)
        (let (val (iter-yield (1+ x)))
          (iter-yield (1+ val)))
        -1)

      (let* ((it1 (my-iter 5))
             (it2 (my-itr 0)))
        (print (iter-next it1))
        (print (iter-next it1 8))
        (print (iter-next it2 nil))
        (condition-case x
            (iter-next it1)
          (iter-end-of-sequence
           (print (cdr x)))))
    #+end_src
```

But running that gives me

> executing Emacs-Lisp code block...
> cl--assertion-failed: Assertion failed: lexical-binding

I thought that setting lexical-binding to t was enough, but apparently
something else is needed?

[-- Attachment #2: Type: text/html, Size: 1430 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-05  0:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-04 22:02 Get generators working in an src block? George Mauer
2020-07-05  0:24 ` Kyle Meyer

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).