Search found 64 matches

by qbg
Tue Jan 06, 2009 1:32 pm
Forum: Common Lisp
Topic: Problems with allegro express and slime
Replies: 7
Views: 9671

Re: Problems with allegro express and slime

Hi I have an issue when trying to set up slime for allegro express on ubuntu. When it loads it says that it cannot find package clc and instead of going to the slime listener it actually opens up allegro's ide. Does anyone know what a fix for this is? Thanks in advance. clc is evil. I would uninsta...
by qbg
Tue Dec 23, 2008 10:07 am
Forum: Common Lisp
Topic: accept both numbers and letters
Replies: 4
Views: 10438

Re: accept both numbers and letters

Hey I need your help for a program in common lisp. The program has to do with polynomial manipulation. My problem is when i do simple arithmetic operations does not accept any letters e.g (p+ x 4) (defun p+ (p1 p2) (list '+ p1 p2)) (defun p+ (p1 p2) (+ p1 p2)) How can i make it in order to accept l...
by qbg
Thu Dec 18, 2008 8:39 am
Forum: Common Lisp
Topic: Crosscompiling Linux->Windows
Replies: 7
Views: 15936

Re: Crosscompiling Linux->Windows

Let's assume that I'll develop my app on my Linux box. The app makes use of some libraries. Finally, I'm happy with it and I want to deploy it on my friend's machine. My friend uses Windows. Is it possible to make a Lisp image on my Linux box and to run it on Windows, provided that the same (native...
by qbg
Wed Dec 17, 2008 2:51 pm
Forum: Books and Resources
Topic: Yet another Lisp related screencast
Replies: 10
Views: 50124

Re: Yet another Lisp related screencast

Paul Donnelly wrote:I still have no idea where it's described.
Well, defun takes a function name as its first argument, and a function name is "1. (in an environment) A symbol or a list (setf symbol) that is the name of a function in that environment. 2. A symbol or a list (setf symbol)."
by qbg
Sat Dec 13, 2008 3:22 pm
Forum: Common Lisp
Topic: Looking for good examples of Lisp macros
Replies: 6
Views: 13490

Re: Looking for good examples of Lisp macros

Pattern matching is fun: (defun simp (e) (pattern-if ((? op) (? v1) (? v2)) e (setf e `(,op ,(simp v1) ,(simp v2)))) (pattern-case e ((+ 0 (? v1)) (simp v1)) ((+ (? v1) 0) (simp v1)) ((+ (? number v1) (? number v2)) (+ v1 v2)) ((- (? v1) 0) (simp v1)) ((- (? number v1) (? number v2)) (- v1 v2)) ((* ...
by qbg
Mon Dec 08, 2008 7:41 am
Forum: Common Lisp
Topic: Choose numbers at random
Replies: 14
Views: 23007

Re: Choose numbers at random

Keep in mind, that one will have to iterate over the list twice, once to get its length, and once to get the random element (apologies if you know this already). It's probably fine for your purposes, but if it seems slower than it should be, consider either not using a list or storing the list leng...
by qbg
Sun Dec 07, 2008 9:14 pm
Forum: Common Lisp
Topic: Choose numbers at random
Replies: 14
Views: 23007

Re: Choose numbers at random

I suspected someone would be along with a way to do it in one traversal, and I think I meant only that particular implementation when I referred to the necessity of iterating twice. Don't know why I would make a blanket statement like that. To clarify: I was not implying that that you stated all im...
by qbg
Sat Dec 06, 2008 11:34 am
Forum: Common Lisp
Topic: Choose numbers at random
Replies: 14
Views: 23007

Re: Choose numbers at random

Keep in mind, that one will have to iterate over the list twice, once to get its length, and once to get the random element (apologies if you know this already). It's probably fine for your purposes, but if it seems slower than it should be, consider either not using a list or storing the list leng...
by qbg
Mon Dec 01, 2008 7:59 pm
Forum: Common Lisp
Topic: changing argument variables
Replies: 10
Views: 19675

Re: changing argument variables

Dynamic variables would be one solution, should you really want to do this.

Code: Select all

(defun hello (name)
   (set name 6))
=> HELLO

(defun test ()
   (let ((*a* 4))
     (declare (special *a*))
     (hello '*a*)
     *a*))
=> TEST

(test)
=> 6
by qbg
Tue Nov 25, 2008 7:49 am
Forum: Common Lisp
Topic: Using static typing in CL
Replies: 5
Views: 16122

Re: Using static typing in CL

The assertions inform the type inference, and you will usually get compile-time warnings for code that violates type declarations. Two small examples: * (defun foo (x) (if (numberp x) (car x) x)) ; in: LAMBDA NIL ; (CAR X) ; ; caught WARNING: ; Asserted type LIST conflicts with derived type (VALUES...