The (aux commons) module

test/map-values: pass

(define (test/map-values _)
  (⊦= '(1 2 3) (map (λ (i) (values (add1 i) i)) '(0 1 2)))
  (⊦= '(1 2 3)
      ((map/call-with-values (λ (i) (values (add1 i) i)) (λ (more less) more))
       '(0 1 2)))
  (⊦= '((1 1) (3 3))
      ((map/values (λ (p) (values (add1 (car p)) (cadr p)))) '((0 1) (2 3)))))
((eta 0.0) (memory #(6291456 2028552 1048576)) (stdout "") (stderr ""))

test/tuple-pred: pass

(define (test/tuple-pred _)
  (⊦= #t ((tuple/pred? <) '(1 2) '(2 3) '(3 4)))
  (⊦= #f ((tuple/pred? <) '(1 5) '(2 3) '(3 4)))
  (⊦= #f ((tuple/pred? <) '(1 5) '(2) '(3 4)))
  (⊦= #t ((tuple/pred? =) '() '()))
  (⊦= #f ((tuple/pred? =) '() '(1))))
((eta 0.0) (memory #(6291456 2029616 1048576)) (stdout "") (stderr ""))

test/remove-duplicates/last: pass

(define (test/remove-duplicates/last _)
  (⊦= '(a b c d e) (remove-duplicates/last (reverse '(a b c d e))))
  (⊦= '(e c d a b) (remove-duplicates/last '(a b a a c d c e e)))
  (⊦= '(a b c d e) (remove-duplicates '(a b a a c d c e e))))
((eta 0.0) (memory #(6291456 2030752 1048576)) (stdout "") (stderr ""))

test/identity*-collect-values: pass

(define (test/identity*-collect-values _)
  (⊦= '(hello world) (call-with-values (τ (values 'hello 'world)) identity*))
  (⊦= 'hello (identity* 'hello))
  (⊦= '() (identity*))
  (⊦= '(1 2) (collect-values (τ (values 1 2))))
  (⊦= 1 (collect-values (τ (values 1)))))
((eta 0.0) (memory #(6291456 2032000 1048576)) (stdout "") (stderr ""))

test/symbol∼subscripts: pass

(define (test/symbol∼subscripts _)
  (⊦= 'g₁₂₃ (symbol∼subscripts 'g123))
  (⊦= 'x₀₉ (symbol∼subscripts 'x09))
  (⊦= 'hello (symbol∼subscripts 'hello))
  (⊦= 'α₁ (symbol∼subscripts 'α1))
  (⊦= "₇" (hash-table-ref subscripts #\7)))
((eta 0.0) (memory #(6291456 2033152 1048576)) (stdout "") (stderr ""))

test/rtc: pass

(define (test/rtc _)
  (let1 (→ (λ (n) (if (< n 5) (add1 n) n)))
        (⊦= '(0 1 2 3 4 5) ((rtc →) 0))
        (⊦= '(5) ((rtc →) 5))))
((eta 0.0) (memory #(6291456 2034552 1048576)) (stdout "") (stderr ""))

test/group: pass

(define (test/group _)
  (⊦= '((#f 5 3 1) (#t 4 2))
      (sort/lex<=?
        ((group even? (λ (p) (cons (car p) (cdr p)))) '(1 2 3 4 5)))))
((eta 0.0) (memory #(6291456 2035856 1048576)) (stdout "") (stderr ""))

test/foldl1: pass

(define (test/foldl1 _)
  (⊦= '() ((foldl1 +) '()))
  (⊦= 10 ((foldl1 +) '(1 2 3 4)))
  (⊦= 20 ((foldl1 + #:H₀ (λ (x) (* 11 x))) '(1 2 3 4)))
  (⊦= 8 ((foldl1/lshift + #:H₀ (λ (x) (values x cddr))) '(1 2 3 4)))
  (⊦= 10 ((foldl1/lshift +) '(1 2 3 4)))
  (⊦= '((1 . 2) . 3) ((foldl1/lshift cons) '(1 2 3))))
((eta 0.0) (memory #(6291456 2036544 1048576)) (stdout "") (stderr ""))

test/within?: pass

(define (test/within? _)
  (⊨ ((within? 1 3) 1))
  (⊨ ((within? 1 3) 2))
  (⊨ ((within? 1 3) 3))
  (⊭ ((within? 1 3) 4))
  (⊭ ((within? 1 3) 0)))
((eta 0.0) (memory #(6291456 2037680 1048576)) (stdout "") (stderr ""))

test/map/tree: pass

(define (test/map/tree _)
  (⊦= '(2 (3 4) ((5)) 6) ((map/tree add1) '(1 (2 3) ((4)) 5)))
  (⊦= '((2) () 3 (())) ((map/tree add1) '((1) () 2 (()))))
  (⊦= '(() (1 1)) ((map/tree (λ (x) (list x x))) '(() 1))))
((eta 0.0) (memory #(6291456 2038864 1048576)) (stdout "") (stderr ""))

test/map/with-index: pass

(define (test/map/with-index _)
  (⊦= '((10 a) (11 b) (12 c))
      ((map/with-index (λ (i) (λ (x) (list i x))) 10) '(a b c))))
((eta 0.0) (memory #(6291456 2040264 1048576)) (stdout "") (stderr ""))

test/accumulator: pass

(define (test/accumulator _)
  (let1 (A (accumulator + 0)) (⊦= 1 (A 1)) (⊦= 3 (A 2)) (⊦= 6 (A 3)))
  (let1 (A (accumulator cons '())) (A 'a) (⊦= '(b a) (A 'b))))
((eta 0.0) (memory #(6291456 2041624 1048576)) (stdout "") (stderr ""))

test/curried-helpers: pass

(define (test/curried-helpers _)
  (⊦= '(2 3) ((fmap add1) '(1 2)))
  (⊦= 6 ((fapply +) '(1 2 3)))
  (⊦= '(2 4) ((ffilter even?) '(1 2 3 4)))
  (⊦= '((c . 1) (a . 2) (b . 3)) ((fsort cdr <) '((a . 2) (b . 3) (c . 1))))
  (⊦= 'b ((flist-ref '(a b c)) 1))
  (⊦= 'c ((fvector-ref #(a b c)) 2))
  (⊨ ((equals-to? '(a)) '(a)))
  (⊨ ((=to? '(a)) '(a)))
  (⊭ ((=to? (list 'a) #:same? eq?) (list 'a)))
  (⊦= 'num (cond/λ 3 (symbol? (K 'sym)) (number? (K 'num)) (else identity)))
  (⊦= "s" (cond/λ "s" (symbol? (K 'sym)) (number? (K 'num)) (else identity))))
((eta 0.0) (memory #(6291456 2042312 1048576)) (stdout "") (stderr ""))

test/cond/λ/single-evaluation: pass

(define (test/cond/λ/single-evaluation _)
  (define c 0)
  (define (v) (set! c (add1 c)) 5)
  (⊦= 6
      (cond/λ
        (v)
        (symbol? identity)
        (string? identity)
        (number? add1)
        (else identity)))
  (⊦= 1 c)
  (⊦= 5 (cond/λ (v) (symbol? identity) (else identity)))
  (⊦= 2 c))
((eta 0.0) (memory #(6291456 2043752 1048576)) (stdout "") (stderr ""))

test/numeric-and-strings: pass

(define (test/numeric-and-strings _)
  (⊦= 3 (sub2 5))
  (⊨ (≠ 'a 'b))
  (⊭ (≠ '(a) '(a)))
  (⊦= 1/4 (⁻¹ 4))
  (⊦= 16 (² 4))
  (⊦= '|42| (number->symbol 42))
  (⊦= "(1 a)" (to-string '(1 "a")))
  (call+stdout
    (τ (display "hello") 'result)
    (λ (r s) (⊦= 'result r) (⊦= "hello" s))))
((eta 0.0) (memory #(6291456 2044712 1048576)) (stdout "") (stderr ""))
Categories: scheme 

See also

The (aux anthropic) module The Anthropic Messages API, offline The (aux cml) module Events, threads, synchronous variables, the library and I/O The (aux hakaru10) modules Random sources, distributions, the language, exact inference and examples The (aux kanren) modules Arithmetic, dates, presentation of answers and a union-find miniKanren The (aux games dice-of-doom) module Dice of Doom The (aux machine) modules Environments, the SC machine and the SECD machine The (aux schemer seasoned) module The Seasoned Schemer The (aux continuation) modules Classic operators, escapers, amb and Collatz sequences The (aux category) modules Monads: list, maybe, probability, ziplist, difference lists and state The (aux timsort) module Sorting and the trace buffer The (aux fds) modules Functional queues and union-find The (aux sxml) module Rendering SXML to HTML The (aux variable) module Logic variables introduced by fresh The (aux tabling) module Memoization and tabled definitions Learning tests for CHICKEN Scheme Promises delay and make-promise The Ackermann function On unary numbers, as lists Concurrent ML for CHICKEN Scheme Porting SML/NJ CML as the (aux cml) library CHICKEN Scheme Versions and implementation notes The SBRAL data structure Skew Binary Random-Access Lists Pattern matching Scheme macrology: a generalized pattern matcher The (aux hansei) modules Inference, random sources, lazy lists, logic programming and example models The (aux nondeterministic) module Learning tests for Scheme The (aux stream) modules Streams, streams after SICP, and sequences and power series The (aux unittest) module Bootstrapping a unittest framework Scheme lang: Chez, 48 and Chicken Some docs, refs and containers, respectively. The Reasoned Schemer miniKanren, microKanren and some implementations Aggregation predicates for µkanren Groups, window functions, sets and enumerations miniKanren, live and untagged Quine generation via relational interpreters Pure, declarative, and constructive arithmetic relations A declarative pearl Final shift for call/cc Direct implementation of shift and reset Call with Current Continuation Patterns Cogen in six lines The Seasoned Schemer The Little Schemer Adding generic functions to Scheme Handling control