Search found 94 matches
Re: cons
Actually, in Common Lisp, () is equivalent to (reads as) NIL, which is self-evaluating, so it's a completely legitimate way of writing the empty list. (Which does not mean it isn't stylistically questionable.)
- Sat Jul 14, 2012 11:34 am
- Forum: Common Lisp
- Topic: Identical Keyword Parameter
- Replies: 1
- Views: 4347
Re: Identical Keyword Parameter
http://www.lispworks.com/documentation/HyperSpec/Body/03_dad.htm : For each keyword parameter specifier, if there is an argument pair whose name matches that specifier's name (that is, the names are eq), then the parameter variable for that specifier is bound to the second item (the value) of that ...
- Sun Jul 01, 2012 8:34 am
- Forum: Common Lisp
- Topic: Questions about how lisp uses memory
- Replies: 2
- Views: 4977
Re: Questions about how lisp uses memory
If there is more than one variable with the same value, are there two places in memory with the same value or do they both point to the same address in memory? It depends on what you mean by “same.†When you have an object with identity, such as an array, a list, a struct, a CLOS class instance...
- Sat Jun 30, 2012 2:46 pm
- Forum: Common Lisp
- Topic: Problem calling a macro
- Replies: 3
- Views: 7799
Re: Problem calling a macro
Macros run (are expanded) at compile-time. Functions run at run-time. Hence, functions cannot call macros. A macro form can appear in a function's body, of course. But the same principle applies: The macro is expanded during compilation, not when the function is called. Assuming you have the followi...
- Sun Jun 10, 2012 7:12 am
- Forum: Common Lisp
- Topic: SBCL - BSD Socket
- Replies: 3
- Views: 5967
Re: SBCL - BSD Socket
Or use Drakma.
- Sun Jun 10, 2012 3:32 am
- Forum: Common Lisp
- Topic: Problem properly using defvar/defparameter/defconstant
- Replies: 3
- Views: 5983
Re: Problem properly using defvar/defparameter/defconstant
When in doubt, use late binding. (By which I mean “use symbols.â€)
Since symbols are funcallable, this will solve your problem.
Code: Select all
(defparameter *functions* `((label1 . function1) (label2 . other-function)))
- Mon May 14, 2012 1:44 am
- Forum: Homework
- Topic: Where oh where do I go?
- Replies: 1
- Views: 7434
Re: Where oh where do I go?
This is your code, correctly formatted: (defun choices (loc) (if (eql loc 'library) (append '((east upstairs-bedroom)) '((south back-stairs)))) (if (eql loc 'dining-room) (append '((east pantry)) '((west downstairs-bedroom)) '((north living-room)))) (if (eql loc 'back-stairs) (append '((north librar...
- Fri May 04, 2012 11:47 pm
- Forum: Common Lisp
- Topic: Efficient relation composition
- Replies: 6
- Views: 9076
Re: Efficient relation composition
You can tell MEMBER to use EQUAL by doing (MEMBER ... :TEST #'EQUAL).wvxvw wrote:(I don't say it become better - it's just I didn't realize `member' will act like `eq' rather than `equal')
- Sat Apr 07, 2012 1:15 pm
- Forum: Common Lisp
- Topic: Creating a synonymous name for a function
- Replies: 3
- Views: 5552
Re: Creating a synonymous name for a function
You can always use apply, of course, but it probably won't exactly improve the stack traces you see in the debugger.
If you want to portably do better than that, you might have to do code walking.
Code: Select all
(flet ((chicken (&rest args) (apply #'cow args)))
...)
- Sun Mar 25, 2012 3:28 am
- Forum: Common Lisp
- Topic: Code execution in .sbclrc
- Replies: 2
- Views: 4788
Re: Code execution in .sbclrc
For an ad-hoc, SBCL-specific hack like that, you can parse the return value of the lisp-implementation-version function. (defun parsed-lisp-implementation-version () (loop for ver = (lisp-implementation-version) then (subseq ver (1+ pos)) for pos = (position #\. ver) collect (parse-integer (if pos (...