Search found 71 matches
- Tue Jun 16, 2009 10:22 am
- Forum: Common Lisp
- Topic: Copying a multidimensional array
- Replies: 10
- Views: 12857
Copying a multidimensional array
As far as I have found, copying multidimensional arrays is not directly supported by the CL standard. It can be accomplished by a sort of "dimension casting" and COPY-SEQ: (defun copy-array (array) (make-array (array-dimensions array) :element-type (array-element-type array) :displaced-to ...
- Tue Jun 09, 2009 6:28 am
- Forum: Common Lisp
- Topic: Replacing elements in a list
- Replies: 22
- Views: 25917
Re: Replacing elements in a list
I think that your problem is that you don't know what you want to do. What I read out of your last posts is that you want to apply some function to all members of a list. This function can be either pre-defined or created "on the fly" (by using LAMBDA). There is a built-in function MAPCAR ...
- Tue Jun 02, 2009 10:42 am
- Forum: Common Lisp
- Topic: Replacing elements in a list
- Replies: 22
- Views: 25917
Re: Replacing elements in a list
What kind of value do you expect "*-1" to be? The way you write it, it can only be a symbol, but the other elements seem to be numbers. What kind of values should the input list contain? By the way, you should properly indent your code to help with reading it. A nice explanation can be fou...
- Tue Jun 02, 2009 10:34 am
- Forum: Common Lisp
- Topic: Need help with lambda function
- Replies: 7
- Views: 9755
Re: Need help with lambda function
The way you formatted it, it looks like on function definition, but in fact, it is just 6 top level forms. Comments are made by semicolons, by the way. (defun test(n) (greaterp high n low)) (setq l ‘(4 7 2)) (setq high 7) (setq low 3) (mapcar ‘test l) (t nil nil) ; the result of the mapcar If yo...
- Tue May 12, 2009 7:01 pm
- Forum: Other Dialects
- Topic: make script lisp-write-line error
- Replies: 2
- Views: 8654
Re: make script lisp-write-line error
I think that this is AutoLisp, not Common Lisp.
You should post this to "Other dialects", or a moderator might be able to move it there.
Anyway, it seems to me as if your write-line statement is quoted, thus not doing anything. I may be wrong, though, I am not familiar with AutoLisp.
You should post this to "Other dialects", or a moderator might be able to move it there.
Anyway, it seems to me as if your write-line statement is quoted, thus not doing anything. I may be wrong, though, I am not familiar with AutoLisp.
- Wed Apr 29, 2009 8:08 pm
- Forum: Common Lisp
- Topic: Question about intern and symbols
- Replies: 10
- Views: 14361
Re: Question about intern and symbols
Very nice! So: CL-USER> (defparameter *test* 1) *TEST* CL-USER> *test* 1 CL-USER> (symbol-value '*test*) 1 CL-USER> (let ((*test* 2)) (symbol-value '*test*)) 2 CL-USER> (let ((*test* 2)) (setf (symbol-value '*test*) 3) (print *test*) (print (symbol-value '*test*))) 3 3 3 CL-USER> (symbol-value '*tes...
- Wed Apr 29, 2009 4:39 am
- Forum: Common Lisp
- Topic: Question about intern and symbols
- Replies: 10
- Views: 14361
Re: Question about intern and symbols
Thanks, Dave, that cleared up a lot for me.
Of course, this begs some new questions. Is there a tutorial somewhere that explains the inner workings of dynamic and lexical variables with respect to CL's symbols?
Of course, this begs some new questions. Is there a tutorial somewhere that explains the inner workings of dynamic and lexical variables with respect to CL's symbols?
- Tue Apr 28, 2009 5:29 am
- Forum: Common Lisp
- Topic: Question about intern and symbols
- Replies: 10
- Views: 14361
Re: Question about intern and symbols
Symbol plists also are, obviously, global values, and all problems with global variables apply. That's an interesting question. In Common Lisp, "global" variables are special , i.e. dynamic, not really global. It may at first seem the same, but this mediates the problems associated with g...
- Mon Apr 27, 2009 4:13 pm
- Forum: Common Lisp
- Topic: Archaic Code Contest in Common Lisp
- Replies: 14
- Views: 20306
Re: Archaic Code Contest in Common Lisp
COND is even more archaic than IF. If I recall correctly, John McCarthy put COND as the basic branching construct into the first Lisp.
- Mon Apr 27, 2009 10:14 am
- Forum: Common Lisp
- Topic: Question about intern and symbols
- Replies: 10
- Views: 14361
Re: Question about intern and symbols
SETF is serious magic. It can set many places, for example hash-table entries, array elements, or just arbitrary symbols. It is a macro that will analyze what kind of place its first (or rather, all odd) argument is, and call the appropriate setter function. If it doesn't know the kind of place, it ...