From: David Vazquez Date: Sat, 29 Dec 2012 14:23:45 +0000 (+0000) Subject: write-string and remove debug X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=0398158d5a4626919b41dcadc58deb9b2a9e91b9;p=jscl.git write-string and remove debug --- diff --git a/lispstrack.html b/lispstrack.html index 1500a7e..9299eb3 100644 --- a/lispstrack.html +++ b/lispstrack.html @@ -48,7 +48,10 @@ font-weight: normal; } /* The text color of the output. */ - .jqconsole-output, .jqconsole-header { + .jqconsole-output { + color: green; + } + .jqconsole-return, .jqconsole-header { color: gray; } .jqconsole-error { @@ -67,18 +70,23 @@ var jqconsole = $('#console').jqconsole('Welcome to Lisptrack!\n\n', '> '); jqconsole.RegisterMatching('(', ')', 'parents'); + lisp.write = function(str){ + jqconsole.Write(str, 'jqconsole-output'); + return str; + } + var startPrompt = function () { // Start the prompt with history enabled. jqconsole.Prompt(true, function (input) { - // Output input with the class jqconsole-output. + // Output input with the class jqconsole-return. if (input[0] != ','){ try { - jqconsole.Write(lisp.print(lisp.evalString(input)) + '\n', 'jqconsole-output'); + jqconsole.Write(lisp.print(lisp.evalString(input)) + '\n', 'jqconsole-return'); } catch(error) { jqconsole.Write('ERROR: ' + error + '\n', 'jqconsole-error'); } } else { - jqconsole.Write(lisp.compileString(input.slice(1)) + '\n', 'jqconsole-output'); + jqconsole.Write(lisp.compileString(input.slice(1)) + '\n', 'jqconsole-return'); } // Restart the prompt. startPrompt(); diff --git a/lispstrack.lisp b/lispstrack.lisp index 9c77a8b..8e87c02 100644 --- a/lispstrack.lisp +++ b/lispstrack.lisp @@ -859,9 +859,6 @@ (define-compilation quote (sexp) (literal sexp)) -(define-compilation debug (form) - (concat "console.log(" (ls-compile form env fenv) ")")) - (define-compilation while (pred &rest body) (concat "(function(){" *newline* (indent "while(" @@ -1135,6 +1132,9 @@ (compile-bool (concat "(typeof " (ls-compile x env fenv) " == 'function')"))) +(define-compilation write-string (x) + (concat "lisp.write(" (ls-compile x env fenv) ")")) + (defun macrop (x) (and (symbolp x) (eq (binding-type (lookup-function x *fenv*)) 'macro)))