common-lisp

Cocoa equivalent of the Carbon method getPtrSize

I need to translate the a carbon method into cocoa into and I am having trouble finding any documentation about what the carbon method getPtrSize really does. From the code I am translating it seems that it returns the byte representation of an image but that doesn't really match up with the name. Could someone give me a good explanati...

Lisp Style question label local functions or not?

I was wondering if there is a standard practice regarding the use of labels in Lisp. I've been messing around with a Lisp implementation of the algorithm described in the first answer here http://stackoverflow.com/questions/352203/generating-permutations-lazily My current version uses labels to break out portions of functionality. (de...

Problems with ltk (common lisp)

I installed ltk to Steel Bank Common Lisp with asdf-install, but I can't even start using it V_V. The code below is the simplest example in the documentation, and is copied almost verbatim. (asdf:operate 'asdf:load-op :ltk) (defun hello-1() (with-ltk () (let ((b (make-instance 'button :master nil ...

IDE for Common Lisp (for windows and linux)

Hi to all, I need in IDE for Common Lisp, but at home i use linux and emacs + slime for lisp programming, but in my university i must use MS Windows, Emacs under Windows ... pull configuration file and the other I just do not do suits. Please advise a comfortable IDE for Common lisp that would have been a version for Windows and Linux a...

Macro doesn't work in the function.

I have problems with following code: http://lisper.ru/apps/format/96 The problem is in "normalize" function, which does not work. It fails on the fifth line: (zero-p a indexes i) (defun normalize (a &optional indexes i) "Returns normalized A." (progn (format t "Data=~A ~A ~A" a indexes i) (if (zero-p a indexes i) a ;; c...

Create a polynomial object from a number using change-class

I have written a polynomial class along the lines described in SICP 2.5.3 (except using defclass). I would like to be able to seamlessly add and multiply polynomials and regular numbers but I can't make change-class accept a number. I tried to simplify the problem by changing class from an integer to a float: (change-class 4 'float) ...

How do I disable warnings in lisp (sbcl)

How do I disable all warnings in sbcl? The extra output is rather annoying. ...

How can I SETF an element in a tree by an accessor?

We've been using Lisp in my AI course. The assignments I've received have involved searching and generating tree-like structures. For each assignment, I've ended up writing something like: (defun initial-state () (list 0 ; score nil ; children 0 ; value 0)) ; something else and building my functions around t...

Does CLOS have an eql specialization dispatch on strings?

Examples of what you can do. (defmethod some-fn ((num real)) (print "an integer")) (defmethod some-fn ((num real)) (print "a real")) (defmethod some-fn ((num (eql 0))) (print "zero")) (some-fn 19323923198319) "an integer" (some-fn 19323923198319.3) "a real" (some-fn 0) "zero" It also works with a general 'string type. (defme...

Turn off the highlight feature in the Limp

Hi all I am using the Limp in my VIM. But there is a problem, when the cursor move to a "(" or ")", it would highlight a block of code in this pair.I can not see the code clearly. Is there any way to turn off or delete this feature? Best Regards, ...

Install CLSQL on Mac OS X

I have SBCL installed (via macports/darwinports) on my Intel Core 2 Duo Macbook running 10.5.8. I've installed several libraries like this: (require 'asdf) (require 'asdf-install) (asdf-install:install 'cl-who) But when I tried to install CLSQL this way ('clsql) after it downloaded, I got this: ... ; registering #<SYSTEM CLSQL-UFFI ...

Common lisp error: "should be lambda expression"

I just started learning Common Lisp a few days ago, and I'm trying to build a function that inserts a number into a tree. I'm getting an error, * - SYSTEM::%EXPAND-FORM: (CONS NIL LST) should be a lambda expression From googling around, it seems like this happens when you have too many sets of parenthesis, but after looking at this...

Examples of excellent Common Lisp code?

I've learned enough Common Lisp to be able to muddle my way through writing an application. I've read Seibel's Practical Common Lisp What libraries or programs should I be reading to understand the idioms, the Tao, of Common Lisp? ...

How do I reuse a previously-opened port, using SBCL's sockets?

Creating a server-side socket will fail if I'm trying to use the same port I've used before. An address-in-use error occurs. (make-instance 'sb-bsd-sockets:inet-socket :type :stream :protocol :tcp) How do I stop this from happening? Hints and code snippets very welcome! (CL newbie here.) Thanks! ...

Common Lisp's equivalent of \r inside the format function?

Basically, I'd like to do the following, only using Common Lisp instead of Python: print("Hello world.\r\n") I can do this, but it only outputs the #\newline character and skips #\return: (format t "Hello world.~%") I believe I could accomplish this using an outside argument, like this: (format t "Hello world.~C~%" #\return) But...

How do I splice into a list outside of a macro in Common Lisp?

Say I have a function foo: (defun foo (x y &rest args) ...) And I later want to wrap it with a function bar: (defun bar (x &rest args) (foo x 100 args)) Assume bar was then called like this: (bar 50 1 2 3) With this setup, args is a list within the body of bar that holds the trailing parameters, so when I pass it to foo, inste...

Dealing with &rest-parameters in common lisp

I want to define a function that accepts &rest parameters and delegates them to another function. (html "blah" "foo" baz) => "<html>blahfoobaz</html>" I did not find a better way than this one: (defun html (&rest values) (concatenate 'string "<html>" (reduce #'(lambda (a b) ...

a question on common lisp

Hello people, I'm getting crazy with a small problem here, I keep getting an error and I cant seem to figure out why, the code is supposed to change the range of a list, so if we give it a list with values (1 2 3 4) and we want to change the range in 11 to fourteen the result would be (11 12 13 14) the problem is that the last functio...

common-lisp: difference between binding and symbol

What's (in simple terms) the difference between setting a binding (LET) and symbols (=variables) in common lisp? ...

How to remove nested parentheses in LISP

How can I remove nested parentheses recursively in Common LISP Such as (unnest '(a b c (d e) ((f) g))) => (a b c d e f g) (unnest '(a b)) => (a b) (unnest '(() ((((a)))) ())) => (a) Thanks ...