Search found 96 matches
- Sun Feb 08, 2009 10:53 pm
- Forum: Common Lisp
- Topic: problem with &rest
- Replies: 8
- Views: 17682
Re: problem with &rest
I see that I've run into an infinite loop, but still do not understand why. The test (if (null lst) nil "else" ... do sth.) should work if the parameter after &rest is an ordinary list as suggests Ramaren, but it does not. The lst after the supposedly-last recursive call is the ordina...
- Sun Feb 08, 2009 1:47 pm
- Forum: Common Lisp
- Topic: problem with &rest
- Replies: 8
- Views: 17682
Re: problem with &rest
Your function does not work because of infinite recursion. The last call to the function is (app-sym nil), and the lst == '(nil). But (nill '(nil)) == NIL, so recursion is entered again. Anyway, the short and more approachable way is to write it like this: (defun ensure-list (thing) (if (listp thing...
- Thu Feb 05, 2009 1:13 pm
- Forum: Common Lisp
- Topic: How to insert data in MYSQL database from the Common LISP?
- Replies: 2
- Views: 5871
Re: How to insert data in MYSQL database from the Common LISP?
I think that the reason of this is that for INSERTs, you need not to use the clsql:query, but clsql:execute-command. They differ in that clsql:query expects that the SQL query will return some results, and clsql:execute-command does not expect results. CL-SQL uses libmysql and probably libmysql cras...
- Mon Feb 02, 2009 11:33 pm
- Forum: Common Lisp
- Topic: Allegro 8.0 Infinite Loop Stalling
- Replies: 4
- Views: 8356
Re: Allegro 8.0 Infinite Loop Stalling
Oh, and just in case anyone starts using threads, you do in fact have to use #. because otherwise the thread will default to its own *standard-output*, and you won't see output. Using #. is a bad thing. It is a read-evaluation read-macro which means that the thread will output to the stream that wa...
- Tue Jan 27, 2009 12:14 pm
- Forum: Common Lisp
- Topic: How to connect LISP with Mysql database?
- Replies: 7
- Views: 17998
Re: How to connect LISP with Mysql database?
(push #P"/usr/share/common-lisp/systems/" asdf:*central-registry*) (asdf:operate 'asdf:load-op 'clsql) (clsql:connect '("" "database_name" "user_name" "password") :database-type :mysql) (clsql-sys:query "SELECT * FROM table_name") I now un...
- Tue Jan 27, 2009 12:08 pm
- Forum: Common Lisp
- Topic: How to connect LISP with Mysql database?
- Replies: 7
- Views: 17998
Re: How to connect LISP with Mysql database?
It seems that (compile-file "database.lisp") returned NIL. That means that compiling the file failed. See the output of (compile-file "database.lisp") to see the actual error.
- Tue Jan 27, 2009 10:41 am
- Forum: Common Lisp
- Topic: How to connect LISP with Mysql database?
- Replies: 7
- Views: 17998
Re: How to connect LISP with Mysql database?
What error message is given?nitinkapoor25 wrote:it is giving the error message.
- Sun Jan 18, 2009 3:14 am
- Forum: Common Lisp
- Topic: [newbie] evaluating a list as an expression
- Replies: 5
- Views: 11412
Re: [newbie] evaluating a list as an expression
Maybe it would be better to compile a function and then call it with the arguments. Then it will be possible to reuse the function (in case the expression is needed to be evaluated with many arguments values): (defun make-function-definition (expr variables) `(lambda (,@variables) ,expr)) (defun mak...
- Sat Jan 10, 2009 1:16 am
- Forum: Common Lisp
- Topic: SICP Exercise related Question
- Replies: 2
- Views: 6703
Re: SICP Exercise related Question
1. The following always return b ; I suppose this is because + here is not treated as a function (defun a-plus-abs-b (a b) (if (> b 0) + -) a b) 2. However I can't get the following to work as well ... (defun a-plus-abs-b (a b) (if (> b 0) #'+ #'-) a b) 1. The body of the function contains 3 expres...
- Wed Jan 07, 2009 3:14 pm
- Forum: The Lounge
- Topic: sbcl newbie question
- Replies: 2
- Views: 7249
Re: sbcl newbie question
I just start to learn Lisp. And my question is When I enter (princ "Hello"), why there are two lines of Hello printed out, one without quote, one with double quote. Same happened to print or write-line. But when I type (format t "Hello"), only one line Hello came out with Nil. C...