Yet another Lisp related screencast

Discussion of books and various other resources about Lisp
Alexander Lehmann
Posts: 23
Joined: Sat Jun 28, 2008 11:27 pm
Contact:

Yet another Lisp related screencast

Post by Alexander Lehmann » Mon Dec 15, 2008 2:43 am

Hi there,

because I liked the excellent Lisp screencasts of Marco Baringer and Rainer Joswig and due to the lack of additional freely available stuff like the beforementioned, I've thought about creating comprehensive tutorial-like screencasts myself. So, during the past summer I began with the creation of a tutorial on writing a simple raytracer in Common Lisp, consisting of multiple screencasts. As I unfortunately do not have the time for further work on it, I finally decided to make the present state available.

Please note that I do not claim to be a Lisp uber-professional and thus you may or may not encounter a few mistakes. The ones I know about have been mentioned and corrected in the subsequent screencast respectively.

If you like what you see or should you wish to contact me, I'm looking forward to hearing from you. You can find my email address as well as the mentioned work at http://home.in.tum.de/~lehmanna/lisp-tutorial.html.

Also, please note that the first part is a neccessary prerequisite for its successors. Anyways, IMHO the more interesting and explanatory stuff starts from Part 2.

Paul Donnelly
Posts: 148
Joined: Wed Jul 30, 2008 11:26 pm

Re: Yet another Lisp related screencast

Post by Paul Donnelly » Mon Dec 15, 2008 4:11 pm

Code: Select all

(defun (setf matrix-at) ...)
Wait, I can do that?

Alexander Lehmann
Posts: 23
Joined: Sat Jun 28, 2008 11:27 pm
Contact:

Re: Yet another Lisp related screencast

Post by Alexander Lehmann » Mon Dec 15, 2008 4:37 pm

Yes, definitely :)

Paul Donnelly
Posts: 148
Joined: Wed Jul 30, 2008 11:26 pm

Re: Yet another Lisp related screencast

Post by Paul Donnelly » Mon Dec 15, 2008 6:13 pm

Alexander Lehmann wrote:Yes, definitely :)
You learn something new every day. 8-) I'd been using DEFSETF this whole time.

August
Posts: 17
Joined: Fri Oct 03, 2008 1:41 pm
Location: Los Alamos, New Mexico USA
Contact:

Re: Yet another Lisp related screencast

Post by August » Tue Dec 16, 2008 10:48 pm

Paul Donnelly wrote:

Code: Select all

(defun (setf matrix-at) ...)
Wait, I can do that?
August the newb here...what does this do? I did a macroexpand-1 and compared it to a regular defun but still don't get it :oops:
---------
DarklingX, LLC
http://www.darklingx.com

Alexander Lehmann
Posts: 23
Joined: Sat Jun 28, 2008 11:27 pm
Contact:

Re: Yet another Lisp related screencast

Post by Alexander Lehmann » Wed Dec 17, 2008 1:25 am

This basically defines a new setf expander. You might want to look up defun, defsetf and the like in the CL HyperSpec for a more detailed unterstanding. However, in the case of the matrix it allows an aref-like access of the matrices elements both for reading and writing.

Paul Donnelly
Posts: 148
Joined: Wed Jul 30, 2008 11:26 pm

Re: Yet another Lisp related screencast

Post by Paul Donnelly » Wed Dec 17, 2008 4:55 am

August wrote:
Paul Donnelly wrote:

Code: Select all

(defun (setf matrix-at) ...)
Wait, I can do that?
August the newb here...what does this do? I did a macroexpand-1 and compared it to a regular defun but still don't get it :oops:
It makes it so that not only can a person do

Code: Select all

(matrix-at a b)
, they can also do

Code: Select all

(setf (matrix-at a b) c)
. There are about four ways (and counting? :roll: ) ways to define setf expanders, but this is the most concise.

August
Posts: 17
Joined: Fri Oct 03, 2008 1:41 pm
Location: Los Alamos, New Mexico USA
Contact:

Re: Yet another Lisp related screencast

Post by August » Wed Dec 17, 2008 12:32 pm

Alexander Lehmann wrote:This basically defines a new setf expander. You might want to look up defun, defsetf and the like in the CL HyperSpec for a more detailed unterstanding. However, in the case of the matrix it allows an aref-like access of the matrices elements both for reading and writing.
Thank you very much for the help guys! I did look in the Hyperspec a bit but wasn't quite able to piece it all together.
---------
DarklingX, LLC
http://www.darklingx.com

Paul Donnelly
Posts: 148
Joined: Wed Jul 30, 2008 11:26 pm

Re: Yet another Lisp related screencast

Post by Paul Donnelly » Wed Dec 17, 2008 12:58 pm

August wrote:Thank you very much for the help guys! I did look in the Hyperspec a bit but wasn't quite able to piece it all together.
It's like that sometimes. Less so once you get the hang of its conventions and precise vocabulary, but look at how I got surprised by this way of defining setf expanders. I still have no idea where it's described.

qbg
Posts: 64
Joined: Mon Jun 30, 2008 1:05 pm
Location: Minnesota

Re: Yet another Lisp related screencast

Post by qbg » Wed Dec 17, 2008 2:51 pm

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)."

Post Reply