diff options
| author | Joel Martin <github@martintribe.org> | 2014-04-27 18:28:56 -0500 |
|---|---|---|
| committer | Joel Martin <github@martintribe.org> | 2014-04-27 18:28:56 -0500 |
| commit | 72599899e3d3ae1face46a81f01979b040d19c61 (patch) | |
| tree | 95e163ffacaa7061a1ac90ccd8a1418656ebc5e3 /php/core.php | |
| parent | d574187895c8519bffd5a0f8b4c1817e00103d91 (diff) | |
| parent | cc021efe10380039a13da5300990639203450634 (diff) | |
| download | mal-72599899e3d3ae1face46a81f01979b040d19c61.tar.gz mal-72599899e3d3ae1face46a81f01979b040d19c61.zip | |
Merge branch 'master' into gh-pages
Diffstat (limited to 'php/core.php')
| -rw-r--r-- | php/core.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/php/core.php b/php/core.php index 16d34f8..4cb4667 100644 --- a/php/core.php +++ b/php/core.php @@ -1,6 +1,8 @@ <?php require_once 'types.php'; +require_once 'readline.php'; +require_once 'reader.php'; require_once 'printer.php'; // Error/Exception functions @@ -35,6 +37,12 @@ function println() { } +// Number functions +function time_ms() { + return intval(microtime(1) * 1000); +} + + // Hash Map functions function assoc($src_hm) { $args = func_get_args(); @@ -169,11 +177,15 @@ $core_ns = array( 'false?'=> function ($a) { return _false_Q($a); }, 'symbol'=> function () { return call_user_func_array('_symbol', func_get_args()); }, 'symbol?'=> function ($a) { return _symbol_Q($a); }, + 'string?'=> function ($a) { return _string_Q($a); }, 'pr-str'=> function () { return call_user_func_array('pr_str', func_get_args()); }, 'str'=> function () { return call_user_func_array('str', func_get_args()); }, 'prn'=> function () { return call_user_func_array('prn', func_get_args()); }, 'println'=>function () { return call_user_func_array('println', func_get_args()); }, + 'readline'=>function ($a) { return mal_readline($a); }, + 'read-string'=>function ($a) { return read_str($a); }, + 'slurp'=> function ($a) { return file_get_contents($a); }, '<'=> function ($a, $b) { return $a < $b; }, '<='=> function ($a, $b) { return $a <= $b; }, '>'=> function ($a, $b) { return $a > $b; }, @@ -182,6 +194,7 @@ $core_ns = array( '-'=> function ($a, $b) { return intval($a - $b,10); }, '*'=> function ($a, $b) { return intval($a * $b,10); }, '/'=> function ($a, $b) { return intval($a / $b,10); }, + 'time-ms'=>function () { return time_ms(); }, 'list'=> function () { return call_user_func_array('_list', func_get_args()); }, 'list?'=> function ($a) { return _list_Q($a); }, |
