clisp

How to change SBCL's current directory?

限于喜欢 提交于 2019-12-03 03:03:19
It is very easy to change CLisp's current working directory: >cat ~/.clisprc.lisp ;;; The following lines added by ql:add-to-init-file: #-quicklisp (let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp" (user-homedir-pathname)))) (when (probe-file quicklisp-init) (load quicklisp-init))) (cd "/media/E/www/qachina/db/doc/money") (load "money") However, it seems there is no cd similar function in SBCL. How can this be done with SBCL? CL-USER> (sb-posix:chdir "/home/apugachev") 0 CL-USER> (sb-posix:getcwd) "/home/apugachev" CL-USER> (sb-posix:chdir "/tmp/") 0 CL-USER> (sb-posix:getcwd) "

Apache + mod_lisp + clisp

冷暖自知 提交于 2019-12-02 20:55:47
How to to configure apache + mod_lisp + clisp and set up a "Hello World!"? I couldn't find any complete howto on the subject. Thanks. Edit: Vebjorn's solution works, but then I don't how to code the "hello world!". Can anyone tell me how to proceed? There's something like SWANKing the clisp, then connect to it with SLIME, but then when I launch mod_lisp's demo, the test page is not served and my slime doesn't return? Thanks again. Download http://www.fractalconcept.com:8000/public/open-source/mod_lisp/mod_lisp.c Compile and install Apache module with sudo apxs -i -c mod_lisp.c Add the

Lisp randomize and using two functions to pull from list into another

吃可爱长大的小学妹 提交于 2019-12-02 07:49:31
问题 Okay, so I am new to lisp and i have been working on this program for a couple days getting to know lisp and researching certain parts of lisp such as cons,cdr, let,funcall and some other ones. I am trying to create a candy machine that dispense colors randomly. I have ran this code numerous times and at first it took me a while to stop getting errors for the random function and now it is saying i have too few arguments for the cons in generate-candy-supply. Any one have any suggestions on

Lisp randomize and using two functions to pull from list into another

自闭症网瘾萝莉.ら 提交于 2019-12-02 03:30:33
Okay, so I am new to lisp and i have been working on this program for a couple days getting to know lisp and researching certain parts of lisp such as cons,cdr, let,funcall and some other ones. I am trying to create a candy machine that dispense colors randomly. I have ran this code numerous times and at first it took me a while to stop getting errors for the random function and now it is saying i have too few arguments for the cons in generate-candy-supply. Any one have any suggestions on where to go and any solution to this? so far my code is... (defvar candy-color '(yellow red blue green

Why is #' (sharp-quote) notation unnecessary in CLISP?

你说的曾经没有我的故事 提交于 2019-12-01 21:10:23
I'm learning Lisp from the book 'Practical Common Lisp'. At one point, I'm supposed to enter the following bit of code: [1] (remove-if-not #'evenp '(1 2 3 4 5 6 7 8 9 10)) (2 4 6 8 10) I suppose the idea here is of course that remove-if-not wants a function that can return either T or NIL when an argument is provided to it, and this function is then applied to all symbols in the list, returning a list containing only those symbols where it returned NIL. However, if I now write the following code in CLISP: [2] (remove-if-not 'evenp '(1 2 3 4 5 6 7 8 9 10) (2 4 6 8 10) It still works! So my

Why is #' (sharp-quote) notation unnecessary in CLISP?

≯℡__Kan透↙ 提交于 2019-12-01 18:32:08
问题 I'm learning Lisp from the book 'Practical Common Lisp'. At one point, I'm supposed to enter the following bit of code: [1] (remove-if-not #'evenp '(1 2 3 4 5 6 7 8 9 10)) (2 4 6 8 10) I suppose the idea here is of course that remove-if-not wants a function that can return either T or NIL when an argument is provided to it, and this function is then applied to all symbols in the list, returning a list containing only those symbols where it returned NIL. However, if I now write the following

Is there a way to get the CLISP compiled with dynamic FFI support on Mac OS?

有些话、适合烂在心里 提交于 2019-12-01 02:30:08
问题 I use clisp 2.48 (2009-07-28) on Mac OS X 10.6.4. I downloaded the clisp with 'sudo port install clisp'. After installing quick lisp, I installed some packages, and most of them are OK. However, when I tried to install "sqlite", I got the following error. [1]> (ql:quickload "sqlite") To load "sqlite": Load 1 ASDF system: sqlite ; Loading "sqlite" [package cffi-sys] *** - CFFI requires CLISP compiled with dynamic FFI support. It says that my clisp installed with mac port doesn't have FFI

running shell commands with gnu clisp

為{幸葍}努か 提交于 2019-11-30 17:47:49
问题 I'm trying to create a "system" command for clisp that works like this (setq result (system "pwd")) ;;now result is equal to /my/path/here I have something like this: (defun system (cmd) (ext:run-program :output :stream)) But, I am not sure how to transform a stream into a string. I've reviewed the hyperspec and google more than a few times. edit: working with Ranier's command and using with-output-to-stream, (defun system (cmd) (with-output-to-string (stream) (ext:run-program cmd :output

Stack overflow from recursive function call in Lisp

北战南征 提交于 2019-11-29 19:29:31
问题 I am learning Lisp from the book "The Land of Lisp" by Conrad Barski. Now I have hit my first stumbling block, where the author says: Calling yourself in this way is not only allowed in Lisp, but is often strongly encouraged after showing the following example function to count the items in a list: (defun my-length (list) (if list (1+ (my-length (cdr list))) 0)) When I call this function my-length with a list containing a million items, I get a stack overflow error. So either you never expect

Unusual stack overflow when inserting nodes in binary tree

寵の児 提交于 2019-11-28 14:28:34
CLISP Version: 2.49 Leaf Node (value (NIL) (NIL)) Non-Leaf Node (value (value (NIL) (NIL)) (NIL)) Code ("format" for debug only) ; (nil) means NULL (defun binary-insert (root obj <) (if (null (cdr root)) (progn (format t "In Null [~A] => " root) (setf (car root) obj) (format t "mid [~A] => " root) (setf (cdr root) '((nil) (nil))) (format t "[~A]~%" root)) (if (funcall < obj (car root)) (progn (format t "In Left [~A] => " root) (binary-insert (nth 1 root) obj <) (format t "[~A]~%" root)) ; Left (progn (format t "In Right [~A] => " root) (binary-insert (nth 2 root) obj <) (format t "[~A]~%" root