From: Zelphir Kaltstahl <zelphirkaltstahl@posteo.de>
To: Bruno Barbier <brubar.cs@gmail.com>
Cc: emacs-orgmode@gnu.org, Ihor Radchenko <yantar92@posteo.net>
Subject: Re: org-babel guile source block bug in handling multiple values
Date: Wed, 8 Mar 2023 01:13:45 +0000 [thread overview]
Message-ID: <e9fd2664-6e28-d3c6-a3f2-e69de3563b70@posteo.de> (raw)
In-Reply-To: <64079614.170a0220.5a0d3.0a23@mx.google.com>
[-- Attachment #1: Type: text/plain, Size: 2868 bytes --]
On 3/7/23 20:52, Bruno Barbier wrote:
> Zelphir Kaltstahl<zelphirkaltstahl@posteo.de> writes:
>
>
>> If org merely wraps in a `let`, it should not notice any of the multiple values
>> business, because that is something done internally in `let-values`.
>>
> The "let", to define the org variables, ends up putting the "import"
> inside the scheme expression, like this:
>
> ;; -*- geiser-scheme-implementation: guile -*-
> (let ((x '1)
> (y '2))
> (import (except (rnrs base) error vector-map)
> (only (guile)
> lambda*
> λ)
> ;; let-values
> (srfi srfi-11))
>
> (let-values ([(a b) (values x y)])
> (simple-format #t "~a ~a\n" a b))
> )
>
>
> which raises an error when evaluated the first time (the second time,
> the "import" has already imported the new "let-values" feature
> (srfi-11), so, the evaluation works). You can test this manually in a
> guile session.
>
> I guess you'll have to use sessions, and do the "import" in a separate
> block first.
>
> Bruno
Actually, now that I think about it, the whole problem is gone, when replacing
the wrapping let with 2 separate (define ...), which I originally thought org
would do:
~~~~START~~~~
$ guile
GNU Guile 3.0.9
Copyright (C) 1995-2023 Free Software Foundation, Inc.
Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.
Enter `,help' for help.
scheme@(guile-user)> (define x 1)
scheme@(guile-user)> (define y 2)
scheme@(guile-user)> (import (except (rnrs base) error vector-map)
... (only (guile)
... lambda*
... λ)
... ;; let-values
... (srfi srfi-11))
scheme@(guile-user)> (let-values ([(a b) (values x y)])
... (simple-format #t "~a ~a\n" a b))
1 2
~~~~~END~~~~~
Or in one input to the REPL:
~~~~START~~~~
$ guile
GNU Guile 3.0.9
Copyright (C) 1995-2023 Free Software Foundation, Inc.
Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.
Enter `,help' for help.
scheme@(guile-user)> (define x 1)
scheme@(guile-user)> (define y 2)
scheme@(guile-user)> (import (except (rnrs base) error vector-map)
... (only (guile)
... lambda*
... λ)
... ;; let-values
... (srfi srfi-11))
scheme@(guile-user)> (let-values ([(a b) (values x y)])
... (simple-format #t "~a ~a\n" a b))
1 2
~~~~~END~~~~~
Is there a reason it has to be wrapped in a let, instead of simply define-ing
the variables?
Regards,
Zelphir
--
repositories:https://notabug.org/ZelphirKaltstahl
[-- Attachment #2: Type: text/html, Size: 3652 bytes --]
next prev parent reply other threads:[~2023-03-08 1:21 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-07 11:27 org-babel guile source block bug in handling multiple values Zelphir Kaltstahl
2023-03-07 14:36 ` Ihor Radchenko
2023-03-07 15:18 ` Zelphir Kaltstahl
2023-03-07 19:52 ` Bruno Barbier
2023-03-08 0:55 ` Zelphir Kaltstahl
2023-03-08 19:38 ` Bruno Barbier
2023-03-09 0:44 ` Zelphir Kaltstahl
2023-03-09 13:04 ` [BUG] Inconsistent global/local :var assignments in ob-* for lisps and non-lisps (was: org-babel guile source block bug in handling multiple values) Ihor Radchenko
2023-03-10 10:39 ` Zelphir Kaltstahl
2023-03-11 9:58 ` Ihor Radchenko
2023-03-11 18:30 ` Zelphir Kaltstahl
2023-03-12 11:33 ` Ihor Radchenko
2023-03-19 13:50 ` [PATCH] lisp/ob-scheme.el Zelphir Kaltstahl
2023-03-22 10:43 ` Ihor Radchenko
2023-03-25 14:34 ` Zelphir Kaltstahl
2023-03-26 9:32 ` Ihor Radchenko
2023-04-25 12:28 ` Ihor Radchenko
2023-04-29 11:08 ` Zelphir Kaltstahl
2023-03-09 13:10 ` org-babel guile source block bug in handling multiple values Ihor Radchenko
2023-03-10 10:42 ` Zelphir Kaltstahl
2023-03-11 10:18 ` Ihor Radchenko
2023-06-02 13:11 ` Ihor Radchenko
2023-03-09 13:11 ` Ihor Radchenko
2023-03-09 14:21 ` Daniel Kraus
2023-03-10 11:57 ` Ihor Radchenko
2023-03-10 10:45 ` Zelphir Kaltstahl
2023-03-08 1:13 ` Zelphir Kaltstahl [this message]
2023-03-08 8:55 ` Ihor Radchenko
2023-03-07 15:44 ` Max Nikulin
2023-03-07 21:41 ` Rudolf Adamkovič
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=e9fd2664-6e28-d3c6-a3f2-e69de3563b70@posteo.de \
--to=zelphirkaltstahl@posteo.de \
--cc=brubar.cs@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=yantar92@posteo.net \
/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).