From: George Mauer <gmauer@gmail.com>
To: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Get generators working in an src block?
Date: Sat, 4 Jul 2020 17:02:07 -0500 [thread overview]
Message-ID: <CA+pajWL5DKjHMPx2sRJ3zPt1LMAvLJ6YhG+ubTmrJ-xyA4-ZLw@mail.gmail.com> (raw)
[-- 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 --]
next reply other threads:[~2020-07-04 22:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-04 22:02 George Mauer [this message]
2020-07-05 0:24 ` Get generators working in an src block? Kyle Meyer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CA+pajWL5DKjHMPx2sRJ3zPt1LMAvLJ6YhG+ubTmrJ-xyA4-ZLw@mail.gmail.com \
--to=gmauer@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).