Search found 12 matches

by vanekl
Tue Apr 12, 2011 9:27 am
Forum: Common Lisp
Topic: INPUT BUFFERED FILE-STREAM CHARACTER
Replies: 2
Views: 4475

Re: INPUT BUFFERED FILE-STREAM CHARACTER

Here are three alternatives. (defun removeSortIterative(x l) (let ((result ())) (dolist (e l result) (when (not (equal x e)) (setq result (append result (list e))))))) (defun removeSortIterative(x list) (reduce (lambda (acc e) (when (not (equal x e)) (nconc acc (list e)))) list :initial-value (list ...
by vanekl
Wed Mar 23, 2011 5:25 am
Forum: Common Lisp
Topic: checking item from input list
Replies: 6
Views: 7440

Re: checking item from input list

I have the symbol exported and I keep loading the asd file, which I don't even know is necessary but I am doing it anyway just in case.
ASDF normally doesn't reload code if you ask it to after it's been loaded once. To force it to reload you have to use the :force t option.
by vanekl
Sun Feb 20, 2011 5:06 pm
Forum: Common Lisp
Topic: authentication framework for hunchentoot ?
Replies: 2
Views: 4080

Re: authentication framework for hunchentoot ?

I don't think there is one, but the hunchentoot mailing list may know different. http://common-lisp.net/cgi-bin/mailman/listinfo/tbnl-devel I wrote my own, but it's not something that could be teased out into a separate module since authentication can be performed in so many different ways. There ar...
by vanekl
Sat Feb 05, 2011 7:32 am
Forum: Common Lisp
Topic: Reading standard input
Replies: 5
Views: 9591

Re: Reading standard input

asked and answered on c.l.l.
by vanekl
Fri Jan 14, 2011 11:56 am
Forum: Common Lisp
Topic: Destructive function on constant data
Replies: 7
Views: 11009

Re: Destructive function on constant data

It's a combination of quote and nreverse. Nreverse tries to destructively change x in some versions of lisp, but it cannot because the quote makes x constant. On the other hand, 'reverse' makes a copy of x and doesn't try to change x, so no error.
by vanekl
Fri Jan 14, 2011 11:08 am
Forum: Common Lisp
Topic: Destructive function on constant data
Replies: 7
Views: 11009

Re: Destructive function on constant data

Some versions of lisp don't allow you to destructively modify what it considers constant data when you use a quote.
Try this instead:

Code: Select all

(let ((x (list 1 2 3 4 5))
       y)
  (setf y (nreverse x))
  (values y x))
by vanekl
Sat Jan 08, 2011 4:16 pm
Forum: Common Lisp
Topic: I just release a fastcgi toolkit (sb-fastcgi) for SBCL
Replies: 6
Views: 8118

Re: I just release a fastcgi toolkit (sb-fastcgi) for SBCL

TEST> (sb-fastcgi:load-libfcgi "/usr/lib/libfcgi.so.0") T TEST> (defun simple-app (req) (let ((c (format nil "Content-Type: text/plain Hello, I am a fcgi-program using Common-Lisp"))) (sb-fastcgi:fcgx-puts req c))) ; compiling (SB-FASTCGI:SIMPLE-SERVER (FUNCTION SIMPLE-APP))SIMP...
by vanekl
Sat Jan 08, 2011 2:41 pm
Forum: Common Lisp
Topic: I just release a fastcgi toolkit (sb-fastcgi) for SBCL
Replies: 6
Views: 8118

Re: I just release a fastcgi toolkit (sb-fastcgi) for SBCL

<520 /var/lib/cl>git clone https://github.com/KDr2/sb-fastcgi
Initialized empty Git repository in /var/lib/cl/sb-fastcgi/.git/
fatal: https://github.com/KDr2/sb-fastcgi/info/refs not found: did you run git update-server-info on the server?
by vanekl
Thu Jan 06, 2011 2:24 pm
Forum: Common Lisp
Topic: Cartesian product of 2 lists which is NOT dependent
Replies: 8
Views: 16048

Re: Cartesian product of 2 lists which is NOT dependent

I think copy-tree is what you want. (let ((ss '((1 (XX 1)) (1 (YY 1)))) (tt '((1 (ZX 1)) (1 (ZY 1)))) u) (flet ((pr () (format t "~%u: ~s~%ss: ~s~%tt: ~s~%" u ss tt))) (setf u (mapcan (lambda (x) (mapcar (lambda (y) (list (copy-tree x)(copy-tree y))) ss)) tt)) (pr) (setf (car (cdr (car (cd...
by vanekl
Thu Jan 06, 2011 2:41 am
Forum: Common Lisp
Topic: Cartesian product of 2 lists which is NOT dependent
Replies: 8
Views: 16048

Re: Cartesian product of 2 lists which is NOT dependent

As Warren said, this would only work if the lists were composed of atoms. You are using lists of lists, which works differently -- the lists aren't copied. Maybe you can better see what's going on if you run this: (let ((ss '((1 (XX 1)) (1 (YY 1)))) (tt '((1 (ZX 1)) (1 (ZY 1)))) u) (flet ((pr () (fo...