UP | HOME

Support via Liberapay

Scheme Code Blocks in Babel

Babel support for Scheme

Introduction

Scheme is a compact and elegant dialect of Lisp with a wide variety of divergent implementations.

Requirements and Setup

Babel support for session-based Scheme evaluation requires Geiser, which supports several scheme implementations. You'll need to install Geiser and at least one Scheme supported by Geiser. You might also want to install packages that augment Geiser.

To configure Scheme code blocks in Babel, add the appropriate dotted pair to org-babel-load-languages:

(org-babel-do-load-languages
 'org-babel-load-languages
 '((scheme . t)))

Babel Features for Scheme Code Blocks

Header Arguments

There are no language-specific default values for header arguments to Scheme code blocks.

There are no language-specific header arguments for Scheme code blocks.

Sessions

Scheme sessions depend on Geiser, which will be invoked if it is not running when the Scheme code block is evaluated. Note that sessions are off by default, so you will need the :session header argument.

Result Types

All result types are supported.

Examples of Use

Here is the standard Hello World example.

In the Org mode buffer:

#+name: hello-world
#+header: :session :var message="Hello World!"
#+begin_src scheme 
message
#+end_src

HTML export of the Scheme code block:

message

HTML export of the Scheme code block result:

Hello World!

Here is a Hello World example from the Racket homepage.

#+name: hello-world-racket
#+header: :session :var my-language='Greek
#+begin_src scheme
(define translations
  #hash([English . "Hello world"]
        [French . "Bonjour le monde"]
        [German . "Hallo Welt"]
        [Greek . "Γειά σου, κόσμε"]
        [Portuguese . "Olá mundo"]
        [Spanish . "Hola mundo"]
        [Thai . "สวัสดีชาวโลก"]))
(hash-ref translations my-language
            "hello world")
#+end_src

HTML export of the Scheme code block:

(define translations
  #hash([English . "Hello world"]
        [French . "Bonjour le monde"]
        [German . "Hallo Welt"]
        [Greek . "Γειά σου, κόσμε"]
        [Portuguese . "Olá mundo"]
        [Spanish . "Hola mundo"]
        [Thai . "สวัสดีชาวโลก"]))
(hash-ref translations my-language
            "hello world")

HTML export of the Scheme code block result:

Γειά σου, κόσμε

Documentation from the orgmode.org/worg/ website (either in its HTML format or in its Org format) is licensed under the GNU Free Documentation License version 1.3 or later. The code examples and css stylesheets are licensed under the GNU General Public License v3 or later.