Compare commits
3 Commits
24771b982a
...
2ec25ff498
Author | SHA1 | Date | |
---|---|---|---|
2ec25ff498 | |||
7bf5fde5bc | |||
b7f824e942 |
79
README.org
79
README.org
@ -5043,6 +5043,38 @@ ruff "$@" | cat
|
||||
# End:
|
||||
#+end_src
|
||||
|
||||
*** Org Babel Ackermann Python test
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: sec:obap-test
|
||||
:END:
|
||||
|
||||
#+caption[Org Babel Ackermann Python test]:
|
||||
#+caption: Org Babel Ackermann Python test.
|
||||
#+name: lst:obap-test
|
||||
#+header: :wrap "src text -n"
|
||||
#+begin_src python -n :eval never-export :exports both :session
|
||||
# https://rosettacode.org/wiki/Ackermann_function#Python
|
||||
# https://www.youtube.com/watch?v=i7sm9dzFtEI
|
||||
|
||||
def ack(M, N):
|
||||
if M == 0:
|
||||
return N + 1
|
||||
elif N == 0:
|
||||
return ack(M - 1, 1)
|
||||
else:
|
||||
return ack(M - 1, ack(M, N - 1))
|
||||
|
||||
ack(3, 3)
|
||||
#+end_src
|
||||
|
||||
#+caption[Org Babel Ackermann Python test result]:
|
||||
#+caption: Org Babel Ackermann Python test result.
|
||||
#+name: lst:obap-test-result
|
||||
#+RESULTS: lst:obap-test
|
||||
#+begin_src text -n
|
||||
61
|
||||
#+end_src
|
||||
|
||||
*** [[https://pip.pypa.io/en/stable/][Package Installer for Python]]
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: sec:pip-python
|
||||
@ -5058,7 +5090,7 @@ results in listing [[lst:shell-pip-list-outdated-results]] and
|
||||
#+caption: Show how to use =pip list --outdated=.
|
||||
#+header: :wrap "src text -n"
|
||||
#+name: lst:shell-pip-list-outdated
|
||||
#+begin_src shell :exports both :results verbatim
|
||||
#+begin_src shell -n :exports both :results verbatim
|
||||
# WARNING: "pip index" is currently an experimental command.
|
||||
pip list --outdated
|
||||
#+end_src
|
||||
@ -5080,7 +5112,7 @@ ypy-websocket 0.8.2 0.9.0 wheel
|
||||
#+caption: Show how to use =pip index versions=.
|
||||
#+header: :wrap "src text -n"
|
||||
#+name: lst:shell-pip-index-versions
|
||||
#+begin_src shell :exports both :results verbatim
|
||||
#+begin_src shell -n :exports both :results verbatim
|
||||
# WARNING: "pip index" is currently an experimental command.
|
||||
pip index versions circular-buffer --no-color
|
||||
#+end_src
|
||||
@ -5265,7 +5297,7 @@ buffer to check whether upgrading has made the dependencies incompatible."
|
||||
#+caption[Emacs interface to get the dependency tree of installed packages]:
|
||||
#+caption: Emacs interface to get the dependency tree of installed packages.
|
||||
#+name: lst:pip-dependency-tree
|
||||
#+begin_src emacs-lisp :results silent
|
||||
#+begin_src emacs-lisp -n :results silent
|
||||
(defvar pip-package-dependency-tree nil
|
||||
"Python package dependency tree.")
|
||||
|
||||
@ -5524,33 +5556,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]]
|
||||
|
Loading…
Reference in New Issue
Block a user