Skip to content

Intrinsics

Get a tag of a pair with a non-cons cdr

Given a file named “main.scm” with:

(import (scheme base))
(rib-tag (cons 1 2))

When I successfully run scheme main.scm

Then the exit status should be 0.

Preserve a tag when a cdr is set

Given a file named “main.scm” with:

(import (scheme base) (scheme write))
(define x (rib 0 #f #f 7))
(write-u8 (+ 48 (rib-tag x)))
(write-u8 (if (rib-cdr x) 65 66))
(rib-set-cdr! x #t)
(write-u8 (+ 48 (rib-tag x)))
(write-u8 (if (rib-cdr x) 65 66))

When I successfully run scheme main.scm

Then the stdout should contain exactly “7B7A”.