Why doesn't Ol implement the full R7RS standard? Because Ol tries to be:
- as simple as possible (i'm sure it's one of the simplest languages),
- as small as possible (less than half Meg for a full language),
- as predictable as possible (exactly the same behavior for a wide range of different hardware, even without a floating point math processor),
- and as fast as possible (avoids unnecessary code executions).
And voila, we have a very simple, elegant and portable language with a nice syntax that is a pleasure to program in.
This is almost a complete list of differences between Ol and R7RS.
Most important:
- 2.1. Identifiers
- Ol is definitely case sensitive, but Sheme is configurable with #!fold-case and #!no-fold-case.
- 4.1.6. Assignments
- No
set!
in Ol.
- No
- 4.3. Macros
- Ol have three more macro declarations (
define-macro
,define-instant-macro
anddefine-lazy-macro
, which differs in the parameters evaluation stages) in addition to the hygienicdefine-syntax
, while Scheme have only hygienic one.
- Ol have three more macro declarations (
- 6.2.5. Syntax of numerical constants
Numbers without precision
considered to be exact in Ol, but inexact in Scheme.
- 6.8. Vectors
- NEGATIVE indices of a vector are valid in Ol, but invalid in Scheme.
All:
-
2.1. Identifiers
- Ol is definitely case sensitive, but Sheme is configurable with #!fold-case and #!no-fold-case.
|\t\t|
and|\x9;\x9;|
are different in Ol, but the same in Scheme.- note: In such cases, just use real tabs. Newlines and anything but
|
are also available.
- note: In such cases, just use real tabs. Newlines and anything but
-
4.1.5. Conditionals
- Ol provides extended
if
withthen
andelse
keywords in forms:(if <condition> then <then1-clause>..<thenN-clause>)
,(if <condition> <then-clause> else <else1-clause>..<elseN-clause>)
,(if <condition> then <then1-clause>..<thenN-clause> else <else1-clause>..<elseN-clause>)
.
- Ol provides extended
-
4.1.6. Assignments
- No
set!
in Ol.- explanation: Ol is a purely functional language.
- note: Use
define
instead. - note: Dynamic variables are available via
(scheme dynamic-bindings)
library. With some speed impact, sure. - note: Very limited support of
set-car!
,set-cdr!
, andset-ref!
functions are provided. Avoid using them.
- No
-
4.1.7. Inclusion
- No
include
andinclude-ci
in Ol.- note: Use libraries (
import
,define-library
,export
, etc.) instead. - note: Top-level ",load" (",l" and ",include" as synonyms) REPL command is available.
- note: Use libraries (
- No
-
4.2.1. Conditionals
- Result of the
when
expression is value returned by the last expression in Ol, but unspecified in Scheme. - Result of the
unless
expression is value returned by the last expression in Ol, but unspecified in Scheme. - Extended form of
case
is available in Ol.
- Result of the
-
4.2.5. Delayed evaluation
Nodelay-force
,promise?
in Ol.- note: Added in Ol 2.5.
-
4.2.7. Exception handling
- No
guard
in Ol.- note: But
with-exception-handler
andraise
works as expected.
- note: But
- No
-
4.3. Macros
- No
let-syntax
andletrec-syntax
in Ol.- note: Use global
define-syntax
instead.
- note: Use global
- Ol have three more macro declarations (
define-macro
,define-instant-macro
anddefine-lazy-macro
, which differs in the parameters evaluation stages) in addition to the hygienicdefine-syntax
, while Scheme have only hygienic one.
- No
-
5.5. Record-type definitions
- No
define-record-type
in Ol.
- No
-
5.6.1. Library Syntax
- No
include-ci
due to fundamental ambiguity.- note: The
include
is fine for sure.
- note: The
- Additional library terms
prefix
,version
,license
,keywords
,description
.
- No
-
6.1. Equivalence predicate
eqv?
(eqv? +nan.0 +nan.0)
is #true in Ol, but unspecified in Scheme. The same is for+inf.0
and-inf.0
.
-
6.2.5. Syntax of numerical constants
Numbers without precision
considered to be exact in Ol, but inexact in Scheme.- explanation: Inexactness can be disabled by compiler features or/and unsupported by platform. Ol designed with respect for the same functionality of the program, independently of inexactness support (unless we directly use inexact numbers, sure).
-
6.2.6. Numerical operations
- note:
complex?
is same asnumber?
, like in Scheme. integer?
for inexact numbers always returns #false in Ol, but can be #true in Scheme when(= number (round number))
.- explanation: Inexactness is an inexactness, we may lose the fractional part and not to be noticed about. So let's be a little paranoid.
sqrt
is included in base library profile while not included in Scheme.- explanation: due to frequent use.
- note:
-
6.4. Pairs and lists
memq
andassq
behavior with short numbers (aka 'enumerations', 'enums') as first argument is fully specified in Ol, but unspecified in Scheme.- note: those numbers processed by memq and assq as usual elements.
-
6.6. Characters
- CHARACTERS in Ol are small numbers (aka 'enums'), but are characters in Scheme.
- explanation: This is due to historical reasons.
Ol supports two types of numbers: small numbers (enumerations, enums, which is values) and long numbers (any other numbers, which is references). Small numbers are used as runes (or glyphs in other word) inside strings for Unicode support. An additional character type with requirement to use the char->integer and integer->char functions every time is too boring and slow. Thanks. - note: Ol supports the full Unicode 16.0.0 (2024 Sep 10) character set.
- note: If you want to print a character in the form of a letter (or a digit, etc.) use
write-char
function, i.e. instead of(print #\λ)
do the(write-char #\λ)
, otherwise you will print a number 955. Or(print (string #\λ))
, if you want.
- explanation: This is due to historical reasons.
- CHARACTERS in Ol are small numbers (aka 'enums'), but are characters in Scheme.
-
6.7. Strings
- NEGATIVE indices in
substring
are valid in Ol, but invalid in Scheme.- note: "-1" is the last rune of the string, "-2" is before the last rune, etc.
- NEGATIVE indices in
-
6.8. Vectors
- NEGATIVE indices of a vector are valid in Ol, but invalid in Scheme.
- note: Negative vector indices can be used to access the n-th element from the end of the vector. This means that "-1" is the last element of the vector, "-2" is before the last element, "-n" is the n-th element from the end of the vector.
- NEGATIVE indices of a vector are valid in Ol, but invalid in Scheme.
-
6.10. Control features
apply
arguments count is limited to 249 in Ol, but unlimited in Scheme.- note: Use
fold
instead in such cases, like(apply + '(1 2 3))
->(fold + '(1 2 3))
.
- note: Use
-
6.13.3. Output
print
function provided by Ol out-of-the-box, while no such widely used familiar function in Scheme, just olderdisplay
andwrite
.
-
Ol has builtin regular expressions while Scheme not.
- note: you can use
m/<pattern>/
for match,g/<pattern>/
for grab,s/<expression>/<new-expression>/
with optional 'g' suffix for substitute, andc/<pattern>/
for split strings and lists.
- note: you can use