sbcl

Writing Common Lisp code that executes from the command line, but not inside the interpreter

混江龙づ霸主 提交于 2019-11-29 08:41:20
问题 When writing Common Lisp code, I use SLIME. In particular, I compile the buffer containing definitions of functions by using C-C C-k, and then switch to the REPL to run those functions. Putting executable code to run those functions in the buffer does not appear to work so well. If the code has bugs it can make a mess. It would be handy to have a way to include code that doesn't get compiled in the buffer, but do get run from the command line, e.g. when doing sbcl --script foo.lisp If that

How to process input and output streams in Steel Bank Common Lisp?

主宰稳场 提交于 2019-11-29 01:30:37
问题 I'm trying to figure out how to use the output stream of one program I start with RUN-PROGRAM so it can be used as the input of another program started with RUN-PROGRAM (i.e., the moral and perhaps literal equivalent of piping). I've tried using a number of combinations of the :INPUT , :OUTPUT and :WAIT keyword arguments, but nothing I've hit upon has been productive so far. Any tips would be helpful; for example, how would I go about doing something like ls | grep lisp from the shell? One of

operator #+ and #- in .sbclrc

久未见 提交于 2019-11-28 13:26:22
Anybody know what #+ and #- operators means in .sbclrc ? I couldn't find it in the manual. I see #- in .sbclrc after I installed quicklisp: #-quicklisp (let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp" (user-homedir-pathname)))) (when (probe-file quicklisp-init) (load quicklisp-init))) I also see #+ in the SBCL User Manual, but I couldn't find explanation of their functionality. Looks like something related for loading individual module. Are they only for SBCL implementation or part of Common lisp? That's a general facility of Common Lisp, not only SBCL. There is a variable cl:

Reading a character without requiring the Enter button pressed

痞子三分冷 提交于 2019-11-28 12:27:15
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 Enter key seriously interrupt the workflow. This would also be similar to a "y/n" type of interrogation

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

◇◆丶佛笑我妖孽 提交于 2019-11-28 02:26:19
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 "Hojas analizadas: ~a ~%" *hojas*) (format t "Tiempo empleado: ~a ~%~%" time)) )) that makes a series of