Rewrite the "Org Babel Ackermann Scheme test" section

This commit is contained in:
Gerard Vermeulen 2023-05-14 07:06:18 +02:00
parent 24771b982a
commit b7f824e942
1 changed files with 26 additions and 15 deletions

View File

@ -5524,33 +5524,44 @@ curl https://3e8.org/pub/chicken-doc/chicken-doc-repo-5.tgz | sudo tar zx
geiser-scheme-implementation 'chez))
#+end_src
*** Org Babel Scheme test
*** Org Babel Ackermann Scheme test
:PROPERTIES:
:CUSTOM_ID: sec:ob-scheme-test
:CUSTOM_ID: sec:obas-test
:END:
Listing [[lst:test-ob-scheme][minimal Org Babel Scheme test]] allows to check whether the setup works
for [[https://cisco.github.io/ChezScheme/][Chez Scheme]]. To test [[https://call-cc.org/][Chicken Scheme]], [[https://www.gnu.org/software/guile/][GNU Guile]], or [[https://www.gnu.org/software/mit-scheme/][MIT/GNU Scheme]], evaluate
one of the following expressions before the [[lst:test-ob-scheme][minimal Org Babel Scheme test]]:
Listing [[lst:obas-test][Org Babel Ackermann Scheme test]] allows to check whether the setup works
for [[https://cisco.github.io/ChezScheme/][Chez Scheme]] by default. To switch between [[https://call-cc.org/][Chicken Scheme]], [[https://www.gnu.org/software/guile/][GNU Guile]], or
[[https://www.gnu.org/software/mit-scheme/][MIT/GNU Scheme]], evaluate one of the following expressions:
1. src_emacs-lisp{(setopt scheme-default-implementation 'chicken)},
2. src_emacs-lisp{(setopt scheme-default-implementation 'guile)},
3. src_emacs-lisp{(setopt scheme-default-implementation 'mit)}.
Sofar, the test fails for [[https://www.gnu.org/software/mit-scheme/][MIT/GNU Scheme]].
Sofar, [[https://www.gnu.org/software/mit-scheme/][MIT/GNU Scheme]] does not work with =ob-scheme=, although it works with
=geiser-mit=.
#+caption[Minimal Org Babel Scheme test]:
#+caption: Minimal Org Babel Scheme test.
#+name: lst:test-ob-scheme
#+caption[Org Babel Ackermann Scheme test]:
#+caption: Org Babel Ackermann Scheme test.
#+name: lst:obas-test
#+header: :wrap "src text -n"
#+begin_src scheme -n :eval never-export :exports both
(* 1 2 3 4 5)
;; https://rosettacode.org/wiki/Ackermann_function#Scheme
;; https://www.youtube.com/watch?v=i7sm9dzFtEI
(define (ack m n)
(cond
((= m 0) (add1 n))
((= n 0) (ack (sub1 m) 1))
(else (ack (sub1 m) (ack m (sub1 n))))))
;; None of the Scheme implementations handles m > 3 and n > 3:
(ack 3 3)
#+end_src
#+caption[Minimal Org Babel Scheme test result]:
#+caption: Minimal Org Babel Scheme test result.
#+name: lst:test-ob-scheme-result
#+RESULTS: lst:test-ob-scheme
#+caption[Org Babel Ackermann Scheme test result]:
#+caption: Org Babel Ackermann Scheme test result.
#+name: lst:obas-test-result
#+RESULTS: lst:obas-test
#+begin_src text -n
120
61
#+end_src
* [[https://github.com/emacs-tw/awesome-emacs#library][Libraries]]