diff options
Diffstat (limited to 'js/types.js')
| -rw-r--r-- | js/types.js | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/js/types.js b/js/types.js index 062b0dd..18fad0a 100644 --- a/js/types.js +++ b/js/types.js @@ -2,6 +2,9 @@ var types = {}; if (typeof module === 'undefined') { var exports = types; +} else { + // map output/print to console.log + var print = exports.print = function () { console.log.apply(console, arguments); }; } // General utility functions @@ -112,13 +115,13 @@ function str() { } function prn() { - console.log.apply(console, Array.prototype.map.call(arguments,function(exp) { + print.apply({}, Array.prototype.map.call(arguments,function(exp) { return _pr_str(exp, true); })); } function println() { - console.log.apply(console, Array.prototype.map.call(arguments,function(exp) { + print.apply({}, Array.prototype.map.call(arguments,function(exp) { return _pr_str(exp, false); })); } @@ -325,7 +328,13 @@ function concat(lst) { } function conj(lst) { - return lst.concat(Array.prototype.slice.call(arguments, 1)); + if (list_Q(lst)) { + return Array.prototype.slice.call(arguments, 1).reverse().concat(lst); + } else { + var v = lst.concat(Array.prototype.slice.call(arguments, 1)); + v.__isvector__ = true; + return v; + } } function first(lst) { return lst[0]; } |
