common-lisp

I can't close the last parenthesis and send my function to the REPL using lisp-mode in Slime

This is a very simple question. I have installed Emacs 22.2.1 (from the Ubuntu (9.04) repo and I downloaded Slime-current from the repo on their homepage. I followed the instructions provided with slime and it works. I can start slime and use it as expected. However, when I enter lisp-mode (M-x lisp-mode) I can no longer interact with ...

Drawing trees in common lisp

Hello all, This question probably has an embarrassingly simple answer, but is there a Right Way to format/draw trees in Common Lisp? I've tried a few books as well as googling about, but the problem seems to fall between the cracks of the search terms. Thanks in advance! ...

Allegro Webactions not serving on SBCL. Methods to debug or possible solutions?

I am trying to get Portable Allegro Serve and Webactions up and running on SBCL. I have so far managed to make paserve properly serve pages. But webactions chunks out with the following warning in the console: 1-aserve-worker: 05/27/09 - 21:28:43 - processing clp file "/home/user/pages/index.html" got error The value NIL ...

Lisp style: setq vs. setf

Peter Norvig mentions in Paradigms of Artificial Intelligence Programming, on page 50, the trade off between specificity and consistency and when choosing to use setq or setf to update a variable to a value. What do you recommend? Have you ever run into a situation where it mattered much beyond readability? ...

Separate Namespaces for Functions and Variables in Common Lisp versus Scheme

Scheme uses a single namespace for all variables, regardless of whether they are bound to functions or other types of values. Common Lisp separates the two, such that the identifier "hello" may refer to a function in one context, and a string in another. (Note 1: This question needs an example of the above; feel free to edit it and add ...

Getting command line arguments in Common Lisp

How can I get the command line arguments in (specifically in GNU, if there are any differences) Common Lisp? ...

How to Connect a Web App to Hunchentoot

I am writing a web app that would require the hunchentoot web server. I have almost no working knowledge of hunchentoot, or any web server for that matter, and I am wondering how my app written in Common Lisp would serve pages to a web client. I have seen some excellent examples (e.g. Hunchentoot Primer, Lisp for the Web) esp. the one li...

Why must 'require' be evaluated in a separate expression to use of the package

I have some lisp initialisation code: (eval-when (:compile-toplevel :load-toplevel :execute) (require 'asdf)) (eval-when (:compile-toplevel :load-toplevel :execute) (push #p"c\:\\lisp\\clsql-4.0.4\\" asdf:*central-registry*)) Why does that version compile, while this version: (eval-when (:compile-toplevel :load-toplevel :execute...

How can I reuse a gethash lookup in Common Lisp?

I have a hash table where the keys are rather complex lists, with sublists of symbols and integers, and the value should be modified depending on the already existing value. The table is created with :test #'equal. I do something similar to this a lot: (defun try-add (i) (let ((old-i (gethash complex-list table nil))) (if (may-ad...

Lisp: Elegant way to strip trailing nil's from a list? (Review)

I want to write a function that removes trailing nil's from a list. I first tried to write it elegantly with recursion, but ended up like this: (defun strip-tail (lst) (let ((last-item-pos (position-if-not #'null lst :from-end t))) (if last-item-pos (subseq lst 0 (1+ last-item-pos))))) ; Test cases. (assert (eq nil (strip-t...

Newbie question about Lisp and Packages

Here is the back story skip to the bottom if you do not care and only want to see the question. So I have been playing around in LISP for a little while. Some basic functions, some classes ,and file IO. When I run across this article: http://www.adampetersen.se/articles/lispweb.htm And I am excited to try and use lisp for a web appli...

Can I use Common Lisp for SICP or is Scheme the only option?

Also, even if I can use Common Lisp, should I? Is Scheme better? ...

Recommendations for a lisp setup on Mac OS X (any dialect)?

What is your Mac OS X (Intel) based lisp setup (of any dialect), how do you like it, and how painful was it to set up? I'm looking for a versatile lisp that is easy to set up, but if you feel strongly about investing more effort, or even money, I would like to hear why you think it's worth it. I am currently using newLisp, which was a b...

Lisp: CHAR is neither declared nor bound

I have decided to learn (Common) Lisp a few days ago and I realize that this is quite a newbie question and it is probably extremely trivial to someone with at least a bit of experience. So basically what happens is that I load up Emacs + Slime (via Lisp in a Box) and write my program (included below): (defun last-char (s) "Get last ch...

How to embed a common lisp interpreter into a gui application

I want to know how to embed a lisp interpreter into a gui application, i.e. something like what pyshell does for Python. ...

Difference between deftype in Common Lisp and Scheme

I'm trying to translate some Common Lisp code into Scheme code. The Common Lisp code has a deftype. Are deftypes in Scheme the same as deftypes in Common Lisp? How do you translate a deftype in Common Lisp into equivalent code in Scheme? ...

Variable references in lisp

Another newbie (Common) LISP question: Basically in most programming languages there's a mean for functions to receive references to variables instead of just values, that is, passing by reference instead of passing by value. Let's say, for the sake of simplicity, I want to write a LISP function that receives a variable and increases th...

Equivalent of defsetf in Scheme

Is there an equivalent in Scheme of Common Lisp's defsetf? ...

How might I format an alist in common lisp?

I'm beginning to write me some Common Lisp and am just getting the hang of consing things together and formatting them. Let's suppose I have an alist, like this: (defvar *map* '((0 . "zero") (1 . "one") (2 . "two"))) How do I format it like this? 0: zero 1: one 2: two I was thinking something like (format t "~{~{~a: ~a~}~%~}" *map...

What is the best open source common lisp implementation that works with Eclipse?

I have started working my way through Practical Common Lisp and am looking for a Common LISP implementation that works on Eclipse. It would be nice if it had some kind of IDE integration besides the editor and the REPL (although I'm not sure what that would be). Also, I have Linux, Windows, and OS X, although my primary workstation is a ...