|
|
|
|
|
|
Result:
|
|
|
Log:
|
|
Features:
- Proper tail-recursion
- First-class continuations with even
dynamic-wind :-)
- Boolean, string, number, char, and vector data types
(no complex / rational numbers)
- Limited
syntax-rules transformer (written in Scheme) :-)
- Optional just-in-time compilation to javascript
(does not support continuations;
library can be pre-compiled with
(compile-lib)
and inserted in init() -
this will speed up loading in price of ~200Kb
- Almost no error checking
- No I/O like
load , read-char ,
open-input-file , etc.
- Limited
values support (only first value is displayed;
all continuations may receive multiple values, not only those created
with call-with-values ):
(values 1 2 3) => 1
(+ (values 1 2 3)) => 6
(list (values 1 2 3)) => (1 2 3)
(call-with-values (lambda () (values 1 2 3)) +) => 6
- Predicates like
= and string>?
takes only 2 arguments, but can be extended in this way:
(define < ((lambda() (define old< <)
(lambda (x y . rest)
(if (old< x y)
(if (null? rest)
#t
(apply < y rest))
#f)))))
(< 1 2 3 4 5) => #t
(< 1 2 3 4 3) => #f
map works on improper lists:
(map + '(1 2 . 3) '(40 20 . 10)) => (41 22 . 13)
(map + 14 9) => 23
- Most of R5RS features / library is implemented
- Passes all
r5rs_pitfall.scm tests (included in SISC)
- Strings are immutable; no
string-fill! and string-set!
begin is a primitive language expression (same as
lambda , if , define ,
set! and quote ) not derived/library as
R5RS defines;
moreover, lambda bodies with several statements are
enclosed in begin in internal representation to emphasize
that they express different concepts - the first is a function
and the second is an operators sequencing
- Written 23 July - 8 August, 2003
- Copyright (c) 2003 by Alex Yakovlev. All rights reserved.
- Can be freely redisributed under GPL terms.
- Tested in IE6 only :-(
Links:
other implementations in JS:
in Java:
|
|
Symbols:
|