minor changes
This commit is contained in:
parent
78021ea4b9
commit
a17e314489
|
@ -281,7 +281,7 @@ EOF
|
|||
[(boolean? val)
|
||||
(if val "true" "false")]
|
||||
[(empty? val)
|
||||
(format "undefined")]
|
||||
(format "Primitives.NULL")]
|
||||
[else
|
||||
(format "~s" val)])))
|
||||
|
||||
|
|
|
@ -210,7 +210,9 @@ function createXMLHTTPObject() {
|
|||
var comet = function() {
|
||||
sendRequest("/eval",
|
||||
function(req) {
|
||||
console.log(req.responseText);
|
||||
// debug:
|
||||
if (console && typeof(console.log) === 'function') { console.log(req.responseText); }
|
||||
|
||||
var invoke = eval(req.responseText)();
|
||||
var output = [];
|
||||
var startTime, endTime;
|
||||
|
|
|
@ -462,10 +462,26 @@
|
|||
(test (begin (define (sum-integers a b)
|
||||
(if (> a b)
|
||||
0
|
||||
(+ a (sum-integers (+ a 1) b))))
|
||||
(+ a (sum-integers (+ a 1) b))))
|
||||
(sum-integers 1 100))
|
||||
(* 50 101))
|
||||
|
||||
|
||||
(test (begin (define (sum term a next b)
|
||||
(if (> a b)
|
||||
0
|
||||
(+ (term a)
|
||||
(sum term (next a) next b))))
|
||||
(define (inc n) (+ n 1))
|
||||
(define (identity x) x)
|
||||
(define (cube x) (* x x x))
|
||||
(define (sum-cubes a b) (sum cube a inc b))
|
||||
(define (sum-integers a b) (sum identity a inc b))
|
||||
|
||||
(list (sum-cubes 1 10)
|
||||
(sum-integers 1 10)))
|
||||
(list 3025 55))
|
||||
|
||||
|
||||
;(simulate (compile (parse '42) 'val 'next))
|
||||
;(compile (parse '(+ 3 4)) 'val 'next)
|
Loading…
Reference in New Issue
Block a user