From ce5c6a3d87e1efe974ac31f8ffa29e32e0f5491f Mon Sep 17 00:00:00 2001 From: Danny Yoo Date: Mon, 27 Jun 2011 12:33:35 -0400 Subject: [PATCH] integrating more primitives --- js-assembler/runtime-src/runtime.js | 61 +++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/js-assembler/runtime-src/runtime.js b/js-assembler/runtime-src/runtime.js index 5ccfc03..86cca62 100644 --- a/js-assembler/runtime-src/runtime.js +++ b/js-assembler/runtime-src/runtime.js @@ -1300,6 +1300,67 @@ if(this['plt'] === undefined) { this['plt'] = {}; } } }); + installPrimitiveProcedure( + 'angle', + 1, + function(MACHINE) { + testArgument(MACHINE, + 'number', + isNumber, + MACHINE.env[MACHINE.env.length-1], + 0, + 'angle'); + return jsnums.angle(MACHINE.env[MACHINE.env.length-1]); + }); + + + installPrimitiveProcedure( + 'exp', + 1, + function(MACHINE) { + testArgument(MACHINE, + 'number', + isNumber, + MACHINE.env[MACHINE.env.length-1], + 0, + 'exp'); + return jsnums.exp(MACHINE.env[MACHINE.env.length-1]); + }); + + + installPrimitiveProcedure( + 'expt', + 2, + function(MACHINE) { + testArgument(MACHINE, + 'number', + isNumber, + MACHINE.env[MACHINE.env.length - 1], + 0, + 'expt'); + testArgument(MACHINE, + 'number', + isNumber, + MACHINE.env[MACHINE.env.length - 2], + 1, + 'expt'); + return jsnums.expt(MACHINE.env[MACHINE.env.length - 1], + MACHINE.env[MACHINE.env.length - 2]); + }); + + + installPrimitiveProcedure( + 'exact?', + 1, + function(MACHINE) { + testArgument(MACHINE, + 'number', + isNumber, + MACHINE.env[MACHINE.env.length - 1], + 0, + 'exact?'); + return jsnums.isExact(x); + });