;;;; File: anaphora-run.scm ;;;; Author: Juergen Lorenz ;;;; ju (at) jugilo (dot) de ;;;; Date: Jun 20, 2011 (require 'anaphora) (import anaphora) (define run (lambda () (if (and (equal? (aif (memv 3 '(1 2 3 4 5)) it) '(3 4 5)) (equal? (acond ((memv 6 '(1 2 3 4 5)) it) ((memv 3 '(1 2 3 4 5)) it) (else it)) '(3 4 5)) (eq? (acond ((memv 6 '(1 2 3 4 5)) it) (else it)) #t) (eq? (acond ((memv 6 '(1 2 3 4 5)) it) (else #f)) #f) (equal? (let ((lst '(1 2 3 4 5 #f)) (res '())) (awhile (car lst) (set! res (cons (car lst) res)) (set! lst (cdr lst))) res) '(5 4 3 2 1)) (equal? (awhen (memv 3 '(1 2 3 4 5)) it) '(3 4 5)) (= (aand '(1 2 3 4 5) (cdr it) (car it)) 2) (equal? (map (alambda (n) (if (zero? n) 1 (* n (self (- n 1))))) '(1 2 3 4 5)) '(1 2 6 24 120))) (print "All tests passed") (print "##### Some tests failed #####")))) (run)