Skip to content

case-lambda

Given a file named “main.scm” with:

(import (scheme base) (scheme case-lambda))
(define foo
(case-lambda
((x) x)
((x y) (+ x y))))
(write-u8 (foo 65))

When I successfully run stak main.scm

Then the stdout should contain exactly “A”.

Given a file named “main.scm” with:

(import (scheme base) (scheme case-lambda))
(define foo
(case-lambda
((x) x)
((x y) (+ x y))))
(write-u8 (foo 65 1))

When I successfully run stak main.scm

Then the stdout should contain exactly “B”.

Given a file named “main.scm” with:

(import (scheme base) (scheme case-lambda))
(define foo
(case-lambda
((x) x)
((x . xs) (apply + x xs))))
(write-u8 (foo 65 1 2 3))

When I successfully run stak main.scm

Then the stdout should contain exactly “G”.