|
1 | 1 | [ |
| 2 | + {"input": "(quote (testing 1 (2.0) -3.14e159))", "expected": ["testing", 1, [2.0], -3.14e159]}, |
| 3 | + {"input": "(+ 2 2)", "expected": 4}, |
| 4 | + {"input": "(+ (* 2 100) (* 1 10))", "expected": 210}, |
| 5 | + {"input": "(if (> 6 5) (+ 1 1) (+ 2 2))", "expected": 2}, |
| 6 | + {"input": "(if (< 6 5) (+ 1 1) (+ 2 2))", "expected": 4}, |
| 7 | + {"input": "(cond ((< 6 5) 1) ((< 5 6) 2) (else 3) )", "expected": 2}, |
| 8 | + {"input": "(cond ((< 6 5) 1) (#f 2) (else 3) )", "expected": 3}, |
| 9 | + {"input": "(cond ((< 6 5) 1) (#f 2))", "expected": null}, |
| 10 | + {"input": "(define x 3)", "expected": null}, |
| 11 | + {"input": "x", "expected": 3}, |
| 12 | + {"input": "(+ x x)", "expected": 6}, |
| 13 | + {"input": "((lambda (x) (+ x x)) 5)", "expected": 10}, |
| 14 | + {"input": "(define twice (lambda (x) (* 2 x)))", "expected": null}, |
| 15 | + {"input": "(twice 5)", "expected": 10}, |
| 16 | + {"input": "(define compose (lambda (f g) (lambda (x) (f (g x)))))", "expected": null}, |
| 17 | + {"input": "((compose list twice) 5)", "expected": [10]}, |
| 18 | + {"input": "(define repeat (lambda (f) (compose f f)))", "expected": null}, |
| 19 | + {"input": "((repeat twice) 5)", "expected": 20}, |
| 20 | + {"input": "((repeat (repeat twice)) 5)", "expected": 80}, |
| 21 | + {"input": "(define fact (lambda (n) (if (<= n 1) 1 (* n (fact (- n 1))))))", "expected": null}, |
| 22 | + {"input": "(fact 3)", "expected": 6}, |
| 23 | + {"input": "(fact 50)", "expected": 30414093201713378043612608166064768844377641568960512000000000000}, |
| 24 | + {"input": "(define abs (lambda (n) ((if (> n 0) + -) 0 n)))", "expected": null}, |
| 25 | + {"input": "(list (abs -3) (abs 0) (abs 3))", "expected": [3, 0, 3]}, |
| 26 | + {"input": "(define combine (lambda (f)\n(lambda (x y)\n(if (null? x) (quote ())\n(f (list (car x) (car y))\n((combine f) (cdr x) (cdr y)))))))", "expected": null}, |
| 27 | + {"input": "(define zip (combine cons))", "expected": null}, |
| 28 | + {"input": "(zip (list 1 2 3 4) (list 5 6 7 8))", "expected" : [[1, 5], [2, 6], [3, 7], [4, 8]]}, |
| 29 | + {"input": "(define riff-shuffle (lambda (deck) (begin\n(define take (lambda (n seq) (if (<= n 0) (quote ()) (cons (car seq) (take (- n 1) (cdr seq))))))\n(define drop (lambda (n seq) (if (<= n 0) seq (drop (- n 1) (cdr seq)))))\n(define mid (lambda (seq) (/ (length seq) 2)))\n((combine append) (take (mid deck) deck) (drop (mid deck) deck)))))", "expected" : null}, |
| 30 | + {"input": "(riff-shuffle (list 1 2 3 4 5 6 7 8))", "expected" : [1, 5, 2, 6, 3, 7, 4, 8]}, |
| 31 | + {"input": "((repeat riff-shuffle) (list 1 2 3 4 5 6 7 8))", "expected" : [1, 3, 5, 7, 2, 4, 6, 8]}, |
| 32 | + {"input": "(riff-shuffle (riff-shuffle (riff-shuffle (list 1 2 3 4 5 6 7 8))))", "expected" : [1,2,3,4,5,6,7,8]}, |
| 33 | + {"input": "(equal? \"a\" 'a)", "expected": false}, |
| 34 | + {"input": "(equal? 'a \"a\")", "expected": false}, |
| 35 | + {"input": "(equal? \"a\" \"a\")", "expected": true}, |
| 36 | + {"input": "(equal? 'a 'a)", "expected": true}, |
| 37 | + {"input": "(eq? 'a 'a)", "expected": true}, |
| 38 | + {"input": "(eqv? 'a 'a)", "expected": true}, |
2 | 39 | {"input": "()", "expected": {"type": "SyntaxError"}}, |
3 | 40 | {"input": "(set! x)", "expected": {"type": "SyntaxError"}}, |
4 | 41 | {"input": "(define 3 4)", "expected": {"type": "SyntaxError"}}, |
|
0 commit comments