trying to fix some of the verbose open coding
This commit is contained in:
parent
bf5a921836
commit
bf9305d5c9
|
@ -52,11 +52,21 @@
|
|||
(assemble-binop-chain "plt.baselib.numbers.divide" checked-operands)]
|
||||
|
||||
[(add1)
|
||||
(assemble-binop-chain "plt.baselib.numbers.add" (cons "1" checked-operands))]
|
||||
(string-append
|
||||
(format "(typeof(~a)==='number'&&(~a)<9E15?(~a)+1"
|
||||
(first operands) (first operands) (first operands))
|
||||
":"
|
||||
(format "RT.checkedAdd1(M, ~a)" (first operands))
|
||||
")")]
|
||||
|
||||
|
||||
[(sub1)
|
||||
(assemble-binop-chain "plt.baselib.numbers.subtract" (append checked-operands (list "1")))]
|
||||
|
||||
(string-append
|
||||
(format "(typeof(~a)==='number'&&(~a)>-9E15?(~a)-1"
|
||||
(first operands) (first operands) (first operands))
|
||||
":"
|
||||
(format "RT.checkedSub1(M, ~a)" (first operands))
|
||||
")")]
|
||||
[(<)
|
||||
(assemble-boolean-chain "plt.baselib.numbers.lessThan" checked-operands)]
|
||||
|
||||
|
|
|
@ -804,6 +804,21 @@
|
|||
};
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
var checkedAdd1 = function(M, n) {
|
||||
return plt.baselib.numbers.add(
|
||||
testArgument(M, 'number', isNumber, n, 0, 'add1'),
|
||||
1);
|
||||
};
|
||||
|
||||
var checkedSub1 = function(M, n) {
|
||||
return plt.baselib.numbers.subtract(
|
||||
testArgument(M, 'number', isNumber, n, 0, 'add1'),
|
||||
1);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@ -940,4 +955,6 @@
|
|||
exports['checkClosureAndArity'] = checkClosureAndArity;
|
||||
exports['checkPrimitiveArity'] = checkPrimitiveArity;
|
||||
|
||||
exports['checkedAdd1'] = checkedAdd1;
|
||||
exports['checkedSub1'] = checkedSub1;
|
||||
}(this.plt, this.plt.baselib));
|
|
@ -7,4 +7,4 @@
|
|||
(provide version)
|
||||
(: version String)
|
||||
|
||||
(define version "1.133")
|
||||
(define version "1.135")
|
||||
|
|
Loading…
Reference in New Issue
Block a user