sbcl

SBCL initialization file

对着背影说爱祢 提交于 2019-12-05 02:52:50
I would like to know where I should save my .sbclrc file. I tried saving it in my .sbcl folder, but it doesn't seem to be working. I'm using Windows XP with Emacs version 23. I'm trying to set up asdf-install, that is why I'm mucking around with the initialization file. Thanks for your time. What is the result of evaluating this in the repl: (SB-IMPL::USERINIT-PATHNAME) 来源: https://stackoverflow.com/questions/2245854/sbcl-initialization-file

Reading the binary output of an external program in Common Lisp

别说谁变了你拦得住时间么 提交于 2019-12-04 23:47:27
问题 I'm trying to run an external program in SBCL and capture its output. The output is binary data (a png image), while SBCL insists on interpreting it as strings. I tried a number of ways, like (trivial-shell:shell-command "/path/to/png-generator" :input "some input") (with-input-from-string (input "some input") (with-output-to-string (output) (run-program "/path/to/png-generator" () :input input :output output)) (with-input-from-string (input "some input") (flexi-streams:with-output-to

How to interact with a process input/output in SBCL/Common Lisp

本秂侑毒 提交于 2019-12-04 23:45:29
问题 I have a text file with one sentence per line. I would like to lemmatize the worlds in each line using hunspell (-s option). Since I want to have the lemmas of each line separately, it wouldn't make sense to submit the whole text file to hunspell. I do need to send one line after another and have the hunspell output for each line. Following the answers from How to process input and output streams in Steel Bank Common Lisp?, I was able to send the whole text file for hunspell one line after

(Random) in Common Lisp Not So Random?

眉间皱痕 提交于 2019-12-04 23:28:24
Okay, final question and I'll have finished my number guessing game in Common Lisp! :D Whenever the game starts (or a new game begins after the first game), the following function is called. ;;; Play the game (defun play () ;; If it's their first time playing this session, ;; make sure to greet the user. (unless (> *number-of-guesses* 0) (welcome-user)) ;; Reset their remaining guesses (setq *number-of-guesses* 0) ;; Set the target value (setq *target* ;; Random can return float values, ;; so we must round the result to get ;; an integer value. (round ;; Add one to the result, because ;;

Do property lists in Common Lisp refer to some global state?

孤街醉人 提交于 2019-12-04 09:26:12
The code below has z as a local variable, yet it behaves as if it is a global: (defun foo (m) (let ((z '(stuff nil))) (push m (getf z 'stuff)) (print z))) (foo 1) (foo 2) (foo 3) I would expect the output to be (STUFF (1)) (STUFF (2)) (STUFF (3)) T but when running it with SBCL I see (STUFF (1)) (STUFF (2 1)) (STUFF (3 2 1)) T Why is this the case? Is this behaviour peculiar to property lists? In foo , z is bound to the literal expression '(stuff nil) . The function destructively alters z , thus destructively changing the value of the literal. How LISP behaves in circumstances like this is

How to Configure SBCL to Use More RAM When Started Through Emacs?

元气小坏坏 提交于 2019-12-04 08:35:46
问题 How can I configure SBCL so that it uses more memory than the default when I start it by using "M-x slime" in Emacs? From what I've seen online, the answer appears to be to call SBCL, passing the argument "--dynamic-space-size <size in MB>". Since I do not call SBCL directly, I do not know how to pass it arguments. I am using GNU Emacs 22.3.1 and SBCL 1.0.48 on Windows 7. I have no experience configuring either, so a novice's introduction would be appreciated. 回答1: The usual way is to set the

Common Lisp: compilation vs evaluation

北战南征 提交于 2019-12-04 08:18:32
On Emacs + Slime with sbcl, once I define a function (or more) in a file I have two choices: Evaluation : e.g. with C-M-x eval-defun Compilation : e.g. with C-c M-k compile-file The second one produces a .fasl file, too. What are the differences between the two? What's going on under the hood when I compile a definition / a file? What are the Pros and Cons of each one? First of all, there's a function eval [ 1 ], that allows to evaluate (i.e. execute) arbitrary CL form in the language runtime. CL implementations may have 2 different modes of operation: compilation mode and interpretation mode.

How to replace a running function in Common Lisp?

时光毁灭记忆、已成空白 提交于 2019-12-04 05:18:12
Suppose we use SBCL's #'save-lisp-and-die to create an server applicatioon App1, which works very well. Now we want to replace a function #'func1 with a new version without stopping App1. How can we do it in Common Lisp ? Any suggestion is appreciated ! You need to load the new function definition. Then new function will be available immediately; code will call newly loaded function. New function definition may be loaded in many ways: (load (compile-file "file.lisp")) where file.lisp is a source code for function (load "file.fasl") where file.fasl is compiled source code (eval (defun ...)) Of

How to customize the SBCL REPL?

女生的网名这么多〃 提交于 2019-12-04 01:28:19
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. You could use rlwrap If you have MacPorts installed you can get it with sudo port install rlwrap The invoke sbcl with rlwrap sbcl There's vim+slime (slimv) too, for vim users. Most of the people use SBCL REPL with SLIME . It gives it by far much more features, then readline , that is used in CLISP. If you aren't comfortable with using Emacs, you can try ABLE (available through quicklisp) - a very simple

why defun is not the same as (setq <name> <lambda>)?

北城以北 提交于 2019-12-03 22:29:09
I'm confused about how defun macro works, because (defun x () "hello") will create function x, but symbol x still will be unbound. If I'll bind some lambda to x then x will have a value, but it will not be treated by interpreter as function in form like this: (x) I think that it is related to the fact that defun should define function in global environment, but I'm not sure what does it exactly mean. Why can't I shadow it in the current environment? Is there any way to force interpreter treat symbol as function if some lambda was bound to it? For example: (setq y (lambda () "I want to be a