sbcl

How to customize the SBCL REPL?

徘徊边缘 提交于 2019-12-21 08:44:09
问题 Is there a way to customize the SBCL REPL in a way that makes it work similar to the CLISP REPL. The standard SBCL REPL isn't really usable on Mac OS X. I can't use the arrow keys or backspace. 回答1: You could use rlwrap If you have MacPorts installed you can get it with sudo port install rlwrap The invoke sbcl with rlwrap sbcl 回答2: There's vim+slime (slimv) too, for vim users. 回答3: Most of the people use SBCL REPL with SLIME . It gives it by far much more features, then readline , that is

How to properly save Common Lisp image using SBCL?

馋奶兔 提交于 2019-12-20 20:40:35
问题 If I want to create a Lisp-image of my program, how do I do it properly? Are there any prerequisites? And doesn't it play nicely with QUICKLISP? Right now, if I start SBCL (with just QUICKLISP pre-loaded) and save the image: (save-lisp-and-die "core") And then try to start SBCL again with this image sbcl --core core And then try to do: (ql:quickload :cl-yaclyaml) I get the following: To load "cl-yaclyaml": Load 1 ASDF system: cl-yaclyaml ; Loading "cl-yaclyaml" ....... debugger invoked on a

Reset state in Common Lisp

我只是一个虾纸丫 提交于 2019-12-20 11:14:09
问题 Newbie Common Lisp question here. Is there a way to reset the state of the environment? What I mean, is there some command that brings the REPL back to the same state it was right after it started up, that is, uninterning all variables, functions, etc. Or if that's not in the Common Lisp standard, is there some extension in SBCL (the implementation I use) to do that? ( EDIT : I know that in SLIME, M-x slime-restart-inferior-lisp does that but I wonder if there's a way without restarting the

Reset state in Common Lisp

一世执手 提交于 2019-12-20 11:12:36
问题 Newbie Common Lisp question here. Is there a way to reset the state of the environment? What I mean, is there some command that brings the REPL back to the same state it was right after it started up, that is, uninterning all variables, functions, etc. Or if that's not in the Common Lisp standard, is there some extension in SBCL (the implementation I use) to do that? ( EDIT : I know that in SLIME, M-x slime-restart-inferior-lisp does that but I wonder if there's a way without restarting the

Lisp SYMBOL-PACKAGE-LOCKED-ERROR

微笑、不失礼 提交于 2019-12-20 05:23:14
问题 I'm new to Lisp so when I wrote the function in SBCL (defun subst (new old l) (cond ((null l) '()) ((eq old (car l)) (cons new (cdr l))) ((cons (car l) (subst new old (cdr l)))))) it gives error SYMBOL-PACKAGE-LOCKED-ERROR,a Style-Warning and a Warning, please help to resolve it 回答1: You're trying to redefine cl:subst. According to §11.1.2.1.2 of the HyperSpec, it's undefined what happens when you try to do that. Most implementations have some sort of package lock which prevents such

How to handle accents in Common Lisp (SBCL)?

给你一囗甜甜゛ 提交于 2019-12-20 02:28:12
问题 That's probably very basic, but I didn't know where else to ask. I'm trying to process some text information in an SLIME REPL from a file that are written in Portuguese, hence uses lots of accents characters - such as é, á, ô, etc.. When I'm handling texts in English I use the following function: (defun txt2list (name) (with-open-file (in name) (let ((res)) (do ((line (read-line in nil nil) (read-line in nil nil))) ((null line) (reverse res)) (push line res)) res))) that cannot read accented

Handling an exception in a thread

送分小仙女□ 提交于 2019-12-20 00:55:09
问题 One of my threads entered the debugger. I want to switch to it, expect that stacktrace, choose a restart, etc... How can I do that? I am using bordeaux-threads . 回答1: If you use SLIME, it should work automatically. Otherwise it depends on your implementation. In SBCL, (SB-THREAD:RELEASE-FOREGROUND) should let the other thread use the terminal. SBCL manual, 12.8 Sessions/Debugging Within a single session, threads arbitrate between themselves for the user's attention. A thread may be in one of

redefining built-in function

青春壹個敷衍的年華 提交于 2019-12-19 03:18:42
问题 How would i redefine a built-in function, while keeping a reference to the old function under a different name? ie with SBCL (unlock-package 'common-lisp) (defun old+ (a b) ?????? (defun + (a b) (old+ a b)) I'm porting code to a LISP implementation that doesn't have float data type. So I wanted to redefine the the math ops to use fixed integer math. I suppose i can solve this problem with search-and-replace as well :) 回答1: To answer your specific question: (defconstant +old-plus+ (fdefinition

Reading a character without requiring the Enter button pressed

可紊 提交于 2019-12-17 20:57:31
问题 read-line and read-char both require you press Enter key after typing something. Is there any mechanism in Common Lisp that would allow the program to continue upon the press of any single character immediately, without requiring the additional step of pressing Enter? I'm trying to build a quick, dynamic text input interface for a program so users can quickly navigate around and do different things by pressing numbers or letters corresponding to onscreen menus. All the extra presses of the

slime prints my (format …) calls only when called function ends

走远了吗. 提交于 2019-12-17 17:33:32
问题 I have emacs + sbcl + slime installed. I have this function defined (defun jugar () (let* ((nodoActual *nodo-inicial*) (estadoActual (nodo-estado nodoActual)) (timeStart nil) (timeEnd nil) ) (loop while (not (es-estado-final estadoActual)) do (setf *hojas* 0) (setf timeStart (get-universal-time)) (setf nodoActual (decision-minimax nodoActual *profundidad* timeStart)) (setf timeEnd (get-universal-time)) (setf estadoActual (nodo-estado nodoActual)) (imprime-en-fichero estadoActual) (format t