Purpose
The interactive examples in the introductory course use BiwaScheme 0.8.3. The bundle is self-hosted by r7.rs and loaded only on pages that contain an interactive block.
This page records the boundary: what the browser evaluator is good for, what it cannot claim, and how numeric examples should be treated.
Pinned Version
The pinned browser interpreter is BiwaScheme 0.8.3. The vendored bundle is stored at /assets/vendor/biwascheme/0.8.3/biwascheme-0.8.3-min.js. The local manifest and MIT license text are stored in the same directory.
The published minified bundle is about 378 KB uncompressed and about 79 KB with gzip compression.
Source links:
What It Is For
Use the browser evaluator for short expression-level practice:
(+ 2 3)
(define (large? n) (> n 10))
(large? 12)
'finish!
That is enough for early lessons on expressions, names, predicates, quotation, simple lists, and small procedures.
What It Is Not
The browser evaluator is not the conformance engine for this course. Checked .scm files are still run with external Scheme implementations.
BiwaScheme 0.8.3 documents these important R7RS differences:
- It lacks
syntax-rules. - It lacks the R7RS exception system.
- It lacks the R7RS library system.
- Strings are immutable.
- Integers are not distinguished from floats.
Because the R7RS library system is absent, browser examples cannot run lesson files that begin with imports such as this unchanged:
(import (scheme base)
(scheme write)
(scheme process-context))
Differences Found in Testing
These were observed by running expressions through the site's own playground runner with BiwaScheme 0.8.3. They are not all in BiwaScheme's documentation.
Three are bugs that can give a wrong result, an error, or a wrong count of side effects:
orevaluates a true operand twice.(or #f (begin (display "x") 1))printsxx, where R7RS printsx. The value is still right, so pure code is unaffected, but output, mutation, and work inside a true operand are doubled.andis not affected.maxandminreject a single argument.(max 5)is an error, where R7RS returns5. A neutral extra argument avoids it, for example(apply max 0 heights)when every height is non-negative.appendrejects zero arguments.(append)is an error, where R7RS returns(), so(apply append lists)fails whenlistsis empty. Adding'()as a first argument avoids it:(apply append '() lists).(+),(*),(list), and(string-append)work.
Others are missing features or departures from R7RS:
- Fraction literals such as
355/113are read as objects that arithmetic rejects. Write(/ 355 113)instead; the result is a decimal. - These procedures are unbound:
error,square,exact,inexact,exact->inexact,exact-integer?,gcd,string-set!, and the(scheme char)procedures such aschar-upcase,char-alphabetic?, andchar-numeric?. A procedure that only mentionserrorin a branch that is not taken still works. define-record-typeuses the older R6RS syntax, so R7RS record definitions fail.eqv?treats2and2.0as the same, because exact and inexact numbers are not distinguished.- Integers above 2^53 lose exactness:
(+ 9007199254740992 1)gives9007199254740992. - Operands are evaluated right to left. R7RS leaves operand order unspecified, so this is allowed, but CHICKEN and Guile evaluate left to right, and an example whose operands print or change state can show its effects in a different order in the browser.
Checked .scm files are unaffected by all of these, because they run on external implementations.
Numeric Tower and Exactness
R7RS Scheme distinguishes exact and inexact numbers, and portable programs must be careful about exactness. Later lessons will treat exact integers, inexact numbers, rational arithmetic, and numeric tower behavior as standard-sensitive topics.
BiwaScheme is useful for basic arithmetic practice, but its documented JavaScript limitation means that browser results should not be used as the authority for exactness-sensitive claims. If an example depends on exact vs inexact behavior, rational arithmetic, or a numeric tower edge case, the lesson should say so and the checked external implementation should be treated as authoritative.
Plain Text Course Copies
Interactive HTML pages should not be the only form of the course. The build currently generates non-interactive .txt siblings for authored lesson pages. When a course track is complete, it should also have a reviewed single-file plain-text edition.