From: Nick Dokos <ndokos@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Scheme code block gives false error message
Date: Mon, 14 Sep 2015 23:10:52 -0400 [thread overview]
Message-ID: <87lhc8gywz.fsf@pierrot.dokosmarshall.org> (raw)
In-Reply-To: 87twqxglwu.fsf@pierrot.dokosmarshall.org
[-- Attachment #1: Type: text/plain, Size: 1251 bytes --]
Nick Dokos <ndokos@gmail.com> writes:
> Lawrence Bottorff <borgauf@gmail.com> writes:
>
>> I think this
>> (https://mobiusengineering.wordpress.com/2015/01/11/using-emacs-org-with-mit-scheme/)
>> describes my problem. Basically, it's with ob-scheme.el. The article
>> seems to say that my problem is scheme stuff being handled improperly
>> by the elisp of ob-scheme.el.
>
> Yes, that sounds right.
>
>> I'll try his workaround and see if it works. He also seems to believe Scheme is a second-class
>> citizen in babel-land.
>>
Actually... I don't know why that (read result) is there at all: result
is a string representation of the result that the scheme interpreter
returned. It does not make any sense to me that we try to read that and
make it into an elisp object: we should just return the string itself.
With that change (see attached patch) on more-or-less current master
(the exact version is Org-mode version 8.3.1 (release_8.3.1-236-g14f5f6
@ /home/nick/src/emacs/org/org-mode/lisp/), I can evaluate everything
that you sent out without any error (see attached file "scheme.org"
which includes evaluation results).
N.B. this is with guile: I have not tried chicken, MIT Scheme or any
other scheme implementation.
Thoughts?
--
Nick
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: [PATCH-RFC] org-babel-scheme-execute-with-geiser fix --]
[-- Type: text/x-patch, Size: 736 bytes --]
From 14f5f6312f77b0252f4d29609f996af42c78a938 Mon Sep 17 00:00:00 2001
From: Nick Dokos <ndokos@gmail.com>
Date: Mon, 14 Sep 2015 22:51:26 -0400
Subject: [PATCH] Return result, not (read result) from
org-babel-scheme-execute-with-geiser
---
lisp/ob-scheme.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lisp/ob-scheme.el b/lisp/ob-scheme.el
index b10dfc3..c8f7f5e 100644
--- a/lisp/ob-scheme.el
+++ b/lisp/ob-scheme.el
@@ -172,7 +172,7 @@ is true; otherwise returns the last value."
(setq result (if (or (string= result "#<void>")
(string= result "#<unspecified>"))
nil
- (read result)))))
+ result))))
result))
(defun org-babel-execute:scheme (body params)
--
2.4.3
[-- Attachment #3: scheme.org - scheme examples from Lawrence Bottorff --]
[-- Type: text/plain, Size: 814 bytes --]
#+BEGIN_SRC scheme :session ch1 :exports both
(define (check-it x)
(cond
((string? x) (string-length x))
((number? x) (if (<= x 0) x (- x 1)))
((boolean? x) (if (and #t x) 10 20))
(else #f)))
#+END_SRC
#+RESULTS:
#+BEGIN_SRC scheme :session ch1
(define (square x)
(* x x))
#+END_SRC
#+RESULTS:
#+BEGIN_SRC scheme :session ch1
(check-it "Foobar")
#+END_SRC
#+RESULTS:
: 6
#+BEGIN_SRC scheme :session ch1
(square 5)
#+END_SRC
#+RESULTS:
: 25
#+BEGIN_SRC scheme :session ch1 :exports both
(define (bool-imply a b)
(if (or (not a) b) #t #f))
#+END_SRC
#+RESULTS:
#+BEGIN_SRC scheme :session ch1 :exports both
(bool-imply #t #f)
#+END_SRC
#+RESULTS:
: #f
#+BEGIN_SRC scheme :session ch1 :exports both
map
#+END_SRC
#+RESULTS:
: #<procedure map (f l) | (f l1 l2) | (f l1 . rest)>
next prev parent reply other threads:[~2015-09-15 3:11 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-12 1:23 Scheme code block gives false error message Lawrence Bottorff
2015-09-13 4:03 ` Lawrence Bottorff
2015-09-13 5:41 ` Nick Dokos
2015-09-13 13:14 ` Lawrence Bottorff
2015-09-13 19:48 ` Nick Dokos
2015-09-14 3:50 ` Lawrence Bottorff
2015-09-14 13:39 ` Nick Dokos
2015-09-14 15:56 ` Lawrence Bottorff
2015-09-14 18:55 ` Nick Dokos
2015-09-14 21:18 ` Lawrence Bottorff
2015-09-15 1:38 ` Nick Dokos
2015-09-15 3:10 ` Nick Dokos [this message]
2015-09-15 4:41 ` Nick Dokos
2015-09-15 4:48 ` Nick Dokos
2015-09-15 17:08 ` Lawrence Bottorff
2015-09-15 17:25 ` Lawrence Bottorff
2015-09-15 18:54 ` Lawrence Bottorff
2015-09-15 19:14 ` Nick Dokos
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=87lhc8gywz.fsf@pierrot.dokosmarshall.org \
--to=ndokos@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).