adding some missing primitive bindings
This commit is contained in:
parent
a63082088d
commit
1a9824b1d0
33
cs019/get-cs019-names.rkt
Normal file
33
cs019/get-cs019-names.rkt
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
#lang racket/base
|
||||||
|
|
||||||
|
;; Grabs all the names exported by the real cs019 language, so we can
|
||||||
|
;; compare and see what names are missing from our implementation.
|
||||||
|
(require racket/set)
|
||||||
|
|
||||||
|
(provide cs019-names
|
||||||
|
whalesong-cs019-names
|
||||||
|
missing-cs019-names)
|
||||||
|
|
||||||
|
|
||||||
|
(define-namespace-anchor anchor)
|
||||||
|
(define ns (namespace-anchor->namespace anchor))
|
||||||
|
|
||||||
|
|
||||||
|
(require (prefix-in cs019: (planet cs019/cs019/cs019)))
|
||||||
|
(define cs019-names
|
||||||
|
(for/set ([name (namespace-mapped-symbols ns)]
|
||||||
|
#:when (regexp-match #rx"^cs019:" (symbol->string name)))
|
||||||
|
(string->symbol
|
||||||
|
(substring (symbol->string name) (string-length "cs019:")))))
|
||||||
|
|
||||||
|
|
||||||
|
(require (prefix-in whalesong-cs019: "cs019.rkt"))
|
||||||
|
(define whalesong-cs019-names
|
||||||
|
(for/set ([name (namespace-mapped-symbols ns)]
|
||||||
|
#:when (regexp-match #rx"^whalesong-cs019:" (symbol->string name)))
|
||||||
|
(string->symbol
|
||||||
|
(substring (symbol->string name) (string-length "whalesong-cs019:")))))
|
||||||
|
|
||||||
|
|
||||||
|
(define missing-cs019-names
|
||||||
|
(set-subtract cs019-names whalesong-cs019-names))
|
4
cs019/info.rkt
Normal file
4
cs019/info.rkt
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
#lang setup/infotab
|
||||||
|
(define compile-omit-paths '("get-cs019-names.rkt"))
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
var isNumber = baselib.numbers.isNumber;
|
var isNumber = baselib.numbers.isNumber;
|
||||||
|
|
||||||
var isReal = baselib.numbers.isReal;
|
var isReal = baselib.numbers.isReal;
|
||||||
|
var isInexact = baselib.numbers.isInexact;
|
||||||
var isComplex = baselib.numbers.isComplex;
|
var isComplex = baselib.numbers.isComplex;
|
||||||
var isRational = baselib.numbers.isRational;
|
var isRational = baselib.numbers.isRational;
|
||||||
|
|
||||||
|
@ -25,6 +26,7 @@
|
||||||
var isList = baselib.lists.isList;
|
var isList = baselib.lists.isList;
|
||||||
var isString = baselib.strings.isString;
|
var isString = baselib.strings.isString;
|
||||||
var isSymbol = baselib.symbols.isSymbol;
|
var isSymbol = baselib.symbols.isSymbol;
|
||||||
|
var isBox = baselib.boxes.isBox;
|
||||||
var equals = baselib.equality.equals;
|
var equals = baselib.equality.equals;
|
||||||
|
|
||||||
var NULL = baselib.lists.EMPTY;
|
var NULL = baselib.lists.EMPTY;
|
||||||
|
@ -147,6 +149,7 @@
|
||||||
installPrimitiveConstant('null', NULL);
|
installPrimitiveConstant('null', NULL);
|
||||||
installPrimitiveConstant('true', true);
|
installPrimitiveConstant('true', true);
|
||||||
installPrimitiveConstant('false', false);
|
installPrimitiveConstant('false', false);
|
||||||
|
installPrimitiveConstant('eof', baselib.constants.EOF_VALUE);
|
||||||
|
|
||||||
|
|
||||||
// The parameter keys here must be uninterned symbols, so we explicitly
|
// The parameter keys here must be uninterned symbols, so we explicitly
|
||||||
|
@ -1331,6 +1334,21 @@
|
||||||
return rev;
|
return rev;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
installPrimitiveProcedure(
|
||||||
|
'void?',
|
||||||
|
1,
|
||||||
|
function(M) {
|
||||||
|
return M.e[M.e.length -1] === VOID;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
installPrimitiveProcedure(
|
||||||
|
'box?',
|
||||||
|
1,
|
||||||
|
function(M) {
|
||||||
|
return isBox(M.e[M.e.length -1]);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
installPrimitiveProcedure(
|
installPrimitiveProcedure(
|
||||||
'eof-object?',
|
'eof-object?',
|
||||||
|
@ -1352,6 +1370,14 @@
|
||||||
function(M) {
|
function(M) {
|
||||||
return isReal(M.e[M.e.length - 1]);
|
return isReal(M.e[M.e.length - 1]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
installPrimitiveProcedure(
|
||||||
|
'inexact?',
|
||||||
|
1,
|
||||||
|
function(M) {
|
||||||
|
return isInexact(M.e[M.e.length - 1]);
|
||||||
|
});
|
||||||
|
|
||||||
installPrimitiveProcedure(
|
installPrimitiveProcedure(
|
||||||
'complex?',
|
'complex?',
|
||||||
1,
|
1,
|
||||||
|
@ -1400,9 +1426,21 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
installPrimitiveProcedure(
|
||||||
|
'inexact->exact',
|
||||||
|
1,
|
||||||
|
function (M) {
|
||||||
|
return baselib.numbers.toExact(
|
||||||
|
checkNumber(M, 'inexact->exact', 0));
|
||||||
|
});
|
||||||
|
|
||||||
|
installPrimitiveProcedure(
|
||||||
|
'exact->inexact',
|
||||||
|
1,
|
||||||
|
function (M) {
|
||||||
|
return baselib.numbers.toInexact(
|
||||||
|
checkNumber(M, 'exact->inexact', 0));
|
||||||
|
});
|
||||||
|
|
||||||
installPrimitiveProcedure(
|
installPrimitiveProcedure(
|
||||||
'abs',
|
'abs',
|
||||||
|
|
|
@ -81,6 +81,7 @@
|
||||||
(provide pi
|
(provide pi
|
||||||
e
|
e
|
||||||
null
|
null
|
||||||
|
eof
|
||||||
#%plain-module-begin
|
#%plain-module-begin
|
||||||
#%module-begin
|
#%module-begin
|
||||||
#%datum
|
#%datum
|
||||||
|
@ -296,8 +297,8 @@ exn-continuation-marks
|
||||||
angle
|
angle
|
||||||
magnitude
|
magnitude
|
||||||
conjugate
|
conjugate
|
||||||
;; inexact->exact
|
inexact->exact
|
||||||
;; exact->inexact
|
exact->inexact
|
||||||
number->string
|
number->string
|
||||||
string->number
|
string->number
|
||||||
procedure?
|
procedure?
|
||||||
|
@ -306,7 +307,7 @@ exn-continuation-marks
|
||||||
procedure-rename
|
procedure-rename
|
||||||
;; (undefined? -undefined?)
|
;; (undefined? -undefined?)
|
||||||
;; immutable?
|
;; immutable?
|
||||||
;; void?
|
void?
|
||||||
symbol?
|
symbol?
|
||||||
string?
|
string?
|
||||||
char?
|
char?
|
||||||
|
@ -323,13 +324,13 @@ rational?
|
||||||
integer?
|
integer?
|
||||||
exact?
|
exact?
|
||||||
exact-nonnegative-integer?
|
exact-nonnegative-integer?
|
||||||
;; inexact?
|
inexact?
|
||||||
odd?
|
odd?
|
||||||
even?
|
even?
|
||||||
zero?
|
zero?
|
||||||
positive?
|
positive?
|
||||||
negative?
|
negative?
|
||||||
;; box?
|
box?
|
||||||
;; hash?
|
;; hash?
|
||||||
|
|
||||||
equal?
|
equal?
|
||||||
|
|
Loading…
Reference in New Issue
Block a user