let
Bind a variable
Section titled “Bind a variable”Given a file named “main.scm” with:
(import (scheme base))
(write-u8 (let ((x 65)) x))
When I successfully run stak main.scm
Then the stdout should contain exactly “A”.
Bind two variables
Section titled “Bind two variables”Given a file named “main.scm” with:
(import (scheme base))
(write-u8 (let ((x 60) (y 5)) (+ x y)))
When I successfully run stak main.scm
Then the stdout should contain exactly “A”.
Call a bound procedure
Section titled “Call a bound procedure”Given a file named “main.scm” with:
(import (scheme base))
(define (f) 65)
(define (g) (let ((h f)) (h)))
(write-u8 (g))
When I successfully run stak main.scm
Then the stdout should contain exactly “A”.
Cause a side effect in a body
Section titled “Cause a side effect in a body”Given a file named “main.scm” with:
(import (scheme base))
(write-u8 (let ((x 66)) (write-u8 65) x))
When I successfully run stak main.scm
Then the stdout should contain exactly “AB”.
Do not corrupt a procedure environment
Section titled “Do not corrupt a procedure environment”Given a file named “main.scm” with:
(import (scheme base))
(define (f) (let ( (g (let ((x 65)) (lambda () x)))) g))
(write-u8 ((f)))
When I successfully run stak main.scm
Then the stdout should contain exactly “A”.