Something went wrong. Try again.
Monorepo for Aesthetic.Computer aesthetic.computer
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287; check addition(cons (if (equal? ((lambda (l) (+ . l)) '(1 2 3)) 6) 'passed 'failed) '(+))
; check subtraction(cons (if (equal? ((lambda (l) (- . l)) '(1 2 3)) -4) 'passed 'failed) '(-))
; check multiplication(cons (if (equal? ((lambda (l) (* . l)) '(1 2 3)) 6) 'passed 'failed) '(*))
; check division(cons (if (equal? ((lambda (l) (/ . l)) '(1 2)) 0.5) 'passed 'failed) '(/))
; check let*(cons (if (equal? (let* (x 1) (y (+ 1 x)) (let* (z (+ x y)) z)) 3) 'passed 'failed) '(let*))
; check let(cons (if (equal? (let (x 1) (y 2) (let (z (+ x y)) z)) 3) 'passed 'failed) '(let))
; check letrec* recursion(cons (if (equal? (let* (x 5) (letrec* (f (lambda (n) (if (< n 2) 1 (* n (f (- n 1)))))) (f x))) 120) 'passed 'failed) '(letrec*))
; check letrec* tail-recursive consing in left argument(cons (if (equal? (letrec* (f (lambda (xs n) (if (< n 1) xs (f (cons n xs) (- n 1))))) (f () 9)) '(1 2 3 4 5 6 7 8 9)) 'passed 'failed) '(letrec* consing left))
; check letrec* tail-recursive consing in right argument(cons (if (equal? (letrec* (f (lambda (n xs) (if (< n 1) xs (f (- n 1) (cons n xs))))) (f 9 ())) '(1 2 3 4 5 6 7 8 9)) 'passed 'failed) '(letrec* consing right))
; check letrec mutual recursion(cons (if (equal? (let* (x 5) (letrec (f (lambda (n) (if (< n 2) 1 (* n (g (- n 1)))))) (g (lambda (n) (if (< n 2) 1 (* n (f (- n 1)))))) (f x))) 120) 'passed 'failed) '(letrec))
; check letrec tail-recursive consing in left argument(cons (if (equal? (letrec (f (lambda (xs n) (if (< n 1) xs (f (cons n xs) (- n 1))))) (f () 9)) '(1 2 3 4 5 6 7 8 9)) 'passed 'failed) '(letrec consing left))
; check letrec tail-recursive consing in right argument(cons (if (equal? (letrec (f (lambda (n xs) (if (< n 1) xs (f (- n 1) (cons n xs))))) (f 9 ())) '(1 2 3 4 5 6 7 8 9)) 'passed 'failed) '(letrec consing right))
; check static scoping(cons (if (equal? (let* (x 2) ((let* (f +) (x 1) (lambda (y) (f x y))) x)) 3) 'passed 'failed) '(static scoping))
; check curring with the dot operator(cons (if (equal? (((lambda (f x) (lambda args (f x . args))) + 1) 2 3) 6) 'passed 'failed) '(currying))
; check lambda argument passing(cons (if (equal? ((lambda (x y z) (list x y z)) '(1) '(2) '(3)) '((1) (2) (3))) 'passed 'failed) '(same args))
; check lambda argument passing with extra actual arguments(cons (if (equal? ((lambda (x y) (list x y)) '(1) '(2) '(3)) '((1) (2))) 'passed 'failed) '(extra args))
; check lambda argument passing with the dot operator(cons (if (equal? ((lambda (l) ((lambda (x y z) (list x y z)) '(1) '(2) . l)) '((3))) '((1) (2) (3))) 'passed 'failed) '(caller dot))
; check lambda argument passing with the dot operator(cons (if (equal? ((lambda (x y . z) (list x y z)) '(1) '(2) '(3)) '((1) (2) ((3)))) 'passed 'failed) '(callee dot))
; check lambda argument passing with the dot operator(cons (if (equal? ((lambda (l) ((lambda (x y . z) (list x y z)) '(1) '(2) . l)) '((3))) '((1) (2) ((3)))) 'passed 'failed) '(both dot))
; check lambda argument passing with the dot operator(cons (if (equal? ((lambda (l) ((lambda (x . y) (list x y)) '(1) '(2) . l)) '((3))) '((1) ((2) (3)))) 'passed 'failed) '(extra dot))
; check lambda argument passing with the dot operator(cons (if (equal? ((lambda (l) ((lambda (x . y) (list x y)) '(1) . l)) '((2) (3))) '((1) ((2) (3)))) 'passed 'failed) '(scant dot))
; check lambda argument passing with the dot operator(cons (if (equal? ((lambda (l) ((lambda (x y . z) (list x y z)) '(1) . l)) '((2) (3))) '((1) (2) ((3)))) 'passed 'failed) '(early-dot))
; check macro expansion into Lisp code that delays code execution then force eval(cons (if (equal? (let* (delay (macro (x) (list 'lambda () x))) (f (delay (cons 1 (cons 2 (cons 3 ()))))) (f)) '(1 2 3)) 'passed 'failed) '(macro))
; assoc on a list of bindings(cons (if (equal? (let* (a 1) (b 2) (e (list (list 'x . a) (list 'y . b))) (+ (assoc 'x e) (assoc 'y e))) 3) 'passed 'failed) '(assoc))
; recurse 9 levels deep then throw an exception(cons (if (equal? (letrec* (f (lambda (n) (if (eq? n 9) (throw 9) (f (+ n 1))))) (catch (f 1))) '(ERR . 9)) 'passed 'failed) '(catch throw))
; loop with destructive setq (when defined) to calculate 5! = 120(cons (if (equal? (catch setq) '(ERR . 2)) 'skip (if (equal? (letrec* (n 5) (r 1) (f (lambda () (if (< n 1) r (begin (setq r (* r n)) (setq n (- n 1)) (f))))) (f)) 120) 'passed 'failed)) '(setq))
; destructive set-car! (when defined) to set all list elements to 1(cons (if (equal? (catch setq) '(ERR . 2)) 'skip (if (equal? (letrec* (xs (list 1 2 3)) (f (lambda (xs) (if xs (f (begin (set-car! xs 1) (cdr xs))) ()))) (begin (f xs) xs)) '(1 1 1)) 'passed 'failed)) '(set-car!))
'OK