Skip to main content
Rm text not true in latest version of answer
Source Link
The Fifth Marshal
  • 6.3k
  • 1
  • 25
  • 44

Common Lisp

(setq *debugger-hook* (lambda (a b) (abort)))

(set-macro-character #\( (lambda (stream char)
                           (read-delimited-list #\) stream)
                           (values)))

Step one is to disable the debugger. I do this by binding the *debugger-hook* (which is called immediately before entering the debugger) to a function which cancels whatever tried to enter the debugger in the first place. Then, I turned ( into a comment character- everything up to its matching close paren is completely ignored. I cache the existing function used to parse lists in *old-paren* so I don't have to reimplement the logic for parsing lists just to comment them out.

The result, tested on sbcl at the repl (both line-by-line and #'load ing it from a file), is a repl which completely ignores any meaningful code. Literal values (number, strings, symbols, etc.) work just fine, but anything else is just ignored.

Common Lisp

(setq *debugger-hook* (lambda (a b) (abort)))

(set-macro-character #\( (lambda (stream char)
                           (read-delimited-list #\) stream)
                           (values)))

Step one is to disable the debugger. I do this by binding the *debugger-hook* (which is called immediately before entering the debugger) to a function which cancels whatever tried to enter the debugger in the first place. Then, I turned ( into a comment character- everything up to its matching close paren is completely ignored. I cache the existing function used to parse lists in *old-paren* so I don't have to reimplement the logic for parsing lists just to comment them out.

The result, tested on sbcl at the repl (both line-by-line and #'load ing it from a file), is a repl which completely ignores any meaningful code. Literal values (number, strings, symbols, etc.) work just fine, but anything else is just ignored.

Common Lisp

(setq *debugger-hook* (lambda (a b) (abort)))

(set-macro-character #\( (lambda (stream char)
                           (read-delimited-list #\) stream)
                           (values)))

Step one is to disable the debugger. I do this by binding the *debugger-hook* (which is called immediately before entering the debugger) to a function which cancels whatever tried to enter the debugger in the first place. Then, I turned ( into a comment character- everything up to its matching close paren is completely ignored.

The result, tested on sbcl at the repl (both line-by-line and #'load ing it from a file), is a repl which completely ignores any meaningful code. Literal values (number, strings, symbols, etc.) work just fine, but anything else is just ignored.

Shortened it a bit.
Source Link
djeis
  • 291
  • 1
  • 5

Common Lisp

(setq *debugger-hook* (lambda (a b) (abort)))

(defparameter *old-paren* (get-macro-character #\())
(set-macro-character #\( (lambda (stream char)
                           (funcall *oldread-paren*delimited-list stream#\) charstream)
                           (values)))

Step one is to disable the debugger. I do this by binding the *debugger-hook* (which is called immediately before entering the debugger) to a function which cancels whatever tried to enter the debugger in the first place. Then, I turned ( into a comment character- everything up to its matching close paren is completely ignored. I cache the existing function used to parse lists in *old-paren* so I don't have to reimplement the logic for parsing lists just to comment them out.

The result, tested on sbcl at the repl (both line-by-line and #'load ing it from a file), is a repl which completely ignores any meaningful code. Literal values (number, strings, symbols, etc.) work just fine, but anything else is just ignored.

Common Lisp

(setq *debugger-hook* (lambda (a b) (abort)))

(defparameter *old-paren* (get-macro-character #\())
(set-macro-character #\( (lambda (stream char)
                           (funcall *old-paren* stream char)
                           (values)))

Step one is to disable the debugger. I do this by binding the *debugger-hook* (which is called immediately before entering the debugger) to a function which cancels whatever tried to enter the debugger in the first place. Then, I turned ( into a comment character- everything up to its matching close paren is completely ignored. I cache the existing function used to parse lists in *old-paren* so I don't have to reimplement the logic for parsing lists just to comment them out.

The result, tested on sbcl at the repl (both line-by-line and #'load ing it from a file), is a repl which completely ignores any meaningful code. Literal values (number, strings, symbols, etc.) work just fine, but anything else is just ignored.

Common Lisp

(setq *debugger-hook* (lambda (a b) (abort)))

(set-macro-character #\( (lambda (stream char)
                           (read-delimited-list #\) stream)
                           (values)))

Step one is to disable the debugger. I do this by binding the *debugger-hook* (which is called immediately before entering the debugger) to a function which cancels whatever tried to enter the debugger in the first place. Then, I turned ( into a comment character- everything up to its matching close paren is completely ignored. I cache the existing function used to parse lists in *old-paren* so I don't have to reimplement the logic for parsing lists just to comment them out.

The result, tested on sbcl at the repl (both line-by-line and #'load ing it from a file), is a repl which completely ignores any meaningful code. Literal values (number, strings, symbols, etc.) work just fine, but anything else is just ignored.

Source Link
djeis
  • 291
  • 1
  • 5

Common Lisp

(setq *debugger-hook* (lambda (a b) (abort)))

(defparameter *old-paren* (get-macro-character #\())
(set-macro-character #\( (lambda (stream char)
                           (funcall *old-paren* stream char)
                           (values)))

Step one is to disable the debugger. I do this by binding the *debugger-hook* (which is called immediately before entering the debugger) to a function which cancels whatever tried to enter the debugger in the first place. Then, I turned ( into a comment character- everything up to its matching close paren is completely ignored. I cache the existing function used to parse lists in *old-paren* so I don't have to reimplement the logic for parsing lists just to comment them out.

The result, tested on sbcl at the repl (both line-by-line and #'load ing it from a file), is a repl which completely ignores any meaningful code. Literal values (number, strings, symbols, etc.) work just fine, but anything else is just ignored.