Skip to content

The R5RS library

Add numbers

Given a file named “main.scm” with:

(import (scheme r5rs))
(write (+ 40 2))

When I successfully run stak main.scm

Then the stdout should contain exactly “42”.

Quote a list

Given a file named “main.scm” with:

(import (scheme r5rs))
(for-each write-char '(#\A #\B #\C))

When I successfully run stak main.scm

Then the stdout should contain exactly “ABC”.

Read an S-expression

Given a file named “main.scm” with:

(import (scheme r5rs))
(write (read))

And a file named “input.txt” with:

(1 2 3)

When I run stak main.scm interactively

And I pipe in the file “input.txt”

Then the exit status should be 0

And the stdout should contain exactly “(1 2 3)”.

Write an S-expression

Given a file named “main.scm” with:

(import (scheme r5rs))
(write '(1 2 3))

When I successfully run stak main.scm

Then the stdout should contain exactly “(1 2 3)”.

Force a promise

Given a file named “main.scm” with:

(import (scheme r5rs))
(write-char (force (delay (integer->char 65))))

When I successfully run stak main.scm

Then the stdout should contain exactly “A”.

Evaluate an S-expression

Given a file named “main.scm” with:

(import (scheme r5rs))
(write
(eval
'(+ 40 2)
(scheme-report-environment 5)))

When I successfully run stak main.scm

Then the stdout should contain exactly “42”.