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
Hello Bruno!
Thank you for that explanation. Behaves exactly like you describe and explains things.
I wonder though, whether that let wrapped code should actually cause an error, or that is a bug in Guile.
Also thanks for the idea with sessions + separate import source block. I thought that should work, but apparently that also has the same error, when running for the first time:
~~~~START~~~~ #+name: scheme-time-imports #+begin_src scheme :eval query-export :noweb strip-export :session scheme-time :results output replace drawer" (import ;; let-values (srfi srfi-11)) #+end_src #+RESULTS: scheme-time-imports #+name: scheme-time #+begin_src scheme :eval query-export :noweb strip-export :session scheme-time :results output replace drawer :var x=1 :var y=2 <<scheme-time-imports>> (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)) #+end_src #+RESULTS: scheme-time :results: ice-9/boot-9.scm:1685:16: In procedure raise-exception: Unbound variable: a Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue. scheme@(guile-user) [1]> :end: ~~~~~END~~~~~
Regards,
Zelphir
-- repositories: https://notabug.org/ZelphirKaltstahl