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 isReal = baselib.numbers.isReal;
|
||||
var isInexact = baselib.numbers.isInexact;
|
||||
var isComplex = baselib.numbers.isComplex;
|
||||
var isRational = baselib.numbers.isRational;
|
||||
|
||||
|
@ -25,6 +26,7 @@
|
|||
var isList = baselib.lists.isList;
|
||||
var isString = baselib.strings.isString;
|
||||
var isSymbol = baselib.symbols.isSymbol;
|
||||
var isBox = baselib.boxes.isBox;
|
||||
var equals = baselib.equality.equals;
|
||||
|
||||
var NULL = baselib.lists.EMPTY;
|
||||
|
@ -147,6 +149,7 @@
|
|||
installPrimitiveConstant('null', NULL);
|
||||
installPrimitiveConstant('true', true);
|
||||
installPrimitiveConstant('false', false);
|
||||
installPrimitiveConstant('eof', baselib.constants.EOF_VALUE);
|
||||
|
||||
|
||||
// The parameter keys here must be uninterned symbols, so we explicitly
|
||||
|
@ -1331,6 +1334,21 @@
|
|||
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(
|
||||
'eof-object?',
|
||||
|
@ -1352,6 +1370,14 @@
|
|||
function(M) {
|
||||
return isReal(M.e[M.e.length - 1]);
|
||||
});
|
||||
|
||||
installPrimitiveProcedure(
|
||||
'inexact?',
|
||||
1,
|
||||
function(M) {
|
||||
return isInexact(M.e[M.e.length - 1]);
|
||||
});
|
||||
|
||||
installPrimitiveProcedure(
|
||||
'complex?',
|
||||
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(
|
||||
'abs',
|
||||
|
|
|
@ -81,6 +81,7 @@
|
|||
(provide pi
|
||||
e
|
||||
null
|
||||
eof
|
||||
#%plain-module-begin
|
||||
#%module-begin
|
||||
#%datum
|
||||
|
@ -296,8 +297,8 @@ exn-continuation-marks
|
|||
angle
|
||||
magnitude
|
||||
conjugate
|
||||
;; inexact->exact
|
||||
;; exact->inexact
|
||||
inexact->exact
|
||||
exact->inexact
|
||||
number->string
|
||||
string->number
|
||||
procedure?
|
||||
|
@ -306,7 +307,7 @@ exn-continuation-marks
|
|||
procedure-rename
|
||||
;; (undefined? -undefined?)
|
||||
;; immutable?
|
||||
;; void?
|
||||
void?
|
||||
symbol?
|
||||
string?
|
||||
char?
|
||||
|
@ -323,13 +324,13 @@ rational?
|
|||
integer?
|
||||
exact?
|
||||
exact-nonnegative-integer?
|
||||
;; inexact?
|
||||
inexact?
|
||||
odd?
|
||||
even?
|
||||
zero?
|
||||
positive?
|
||||
negative?
|
||||
;; box?
|
||||
box?
|
||||
;; hash?
|
||||
|
||||
equal?
|
||||
|
|
Loading…
Reference in New Issue
Block a user