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 {
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();
(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("
(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)))