Why doesn't Ol implement the full R7RS standard? Because Ol tries to be:
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:
set!
in Ol.define-macro
, define-instant-macro
and define-lazy-macro
, which differs in the parameters evaluation stages) in addition to the hygienic define-syntax
, while Scheme have only hygienic one.Numbers without precision
considered to be exact in Ol, but inexact in Scheme.All:
2.1. Identifiers
|\t\t|
and |\x9;\x9;|
are different in Ol, but the same in Scheme.
|
are also available.4.1.5. Conditionals
if
with then
and else
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>)
.4.1.6. Assignments
set!
in Ol.
define
instead.(scheme dynamic-bindings)
library. With some speed impact, sure.set-car!
, set-cdr!
, and set-ref!
functions are provided. Avoid using them.4.1.7. Inclusion
include
and include-ci
in Ol.
import
, define-library
, export
, etc.) instead.4.2.1. Conditionals
when
expression is value returned by the last expression in Ol, but unspecified in Scheme.unless
expression is value returned by the last expression in Ol, but unspecified in Scheme.case
is available in Ol.4.2.5. Delayed evaluation
delay-force
, promise?
in Ol.4.2.7. Exception handling
guard
in Ol.
with-exception-handler
and raise
works as expected.4.3. Macros
let-syntax
and letrec-syntax
in Ol.
define-syntax
instead.define-macro
, define-instant-macro
and define-lazy-macro
, which differs in the parameters evaluation stages) in addition to the hygienic define-syntax
, while Scheme have only hygienic one.5.5. Record-type definitions
define-record-type
in Ol.5.6.1. Library Syntax
include-ci
due to fundamental ambiguity.
include
is fine for sure.prefix
, version
, license
, keywords
, description
.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.
6.2.6. Numerical operations
complex?
is same as number?
, like in Scheme.integer?
for inexact numbers always returns #false in Ol, but can be #true in Scheme when (= number (round number))
.
sqrt
is included in base library profile while not included in Scheme.
6.4. Pairs and lists
memq
and assq
behavior with short numbers (aka 'enumerations', 'enums') as first argument is fully specified in Ol, but unspecified in Scheme.
6.6. Characters
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.6.7. Strings
substring
are valid in Ol, but invalid in Scheme.
6.8. Vectors
6.10. Control features
apply
arguments count is limited to 249 in Ol, but unlimited in Scheme.
fold
instead in such cases, like (apply + '(1 2 3))
-> (fold + '(1 2 3))
.6.13.3. Output
print
function provided by Ol out-of-the-box, while no such widely used familiar function in Scheme, just older display
and write
.Ol has builtin regular expressions while Scheme not.
m/<pattern>/
for match, g/<pattern>/
for grab, s/<expression>/<new-expression>/
with optional 'g' suffix for substitute, and c/<pattern>/
for split strings and lists.此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。