December 29, 2004
The Threads of November I
I'm not sure yet whether it's a good idea, but I decided to catch up on comp.lang.lisp after months of being away.
Sven-Olof Nystrom implemented Python-style list comprehensions for Lisp:
For example, this list comprehension
(collect (list) ((* x x))
(in (x) '(1 2 3 4 5 6 7 8)))
(1 4 9 16 25 36 49 64)
Perms builds a list of all permutations of a list.
(defun perms (l)
((null l) (list nil))
(t (collect list ((cons a b))
(in a l)
(in b (perms (remove a l)))))))
Sven-Olof's collect macro handles arbitrary sequences, hash tables and multidimensional arrays. He first released a version of this code back in August of last year.
MCL and Unix
Kenny Tilton, John Desoi, Ron Garret and Thomas Russ try to figure out how to get MCL to handle unix-style files that use lone linefeeds as end of line markers.
Note: Do not put any semicolon comments before this line.
The next forms define a semicolon reader for both #\linefeed
and #\return line endings so that OpenMCL can read MCL input
files (Mac line endings). Should also work with with MCL for unix files.
(defun semicolon-reader (stream char)
(declare (ignore char))
(do ((c #\null)) ((or (char= c #\linefeed) (char= c #\return)))
(setf c (read-char stream nil #\newline t)))
(set-macro-character #\; #'semicolon-reader)
(setf CCL::*LINEFEED-EQUALS-NEWLINE* t)
I could only bear to look at one or two messages in one of the “Lisp, C++ and Game Development” threads
from mid-November, but G.A. quoted a Naughty Dog developer on their transition to C++:
After using a completely custom language for our last three PS2 projects,
coming back to C++ has been a pretty rude awakening. We were hoping we
could work around some of the deficiencies of C++ with a good preprocessor,
ideally one that provided more than symple hygienic macro substitution...
(I tried to find the source of this quote, but I guess the mailing list mentioned isn't visible to google.)
Posted by jjwiseman at December 29, 2004 11:44 PM
My guess is that Naughty Dog's switch back to C++ is related to their starting work on the PS3. Maybe it's just a time-to-market issue. They may not have time to implement a full Lisp IDE for the PS3 in time to develop a game for the PS3 launch, which is rumored to be in March of 2006.
Or maybe they just didn't find the benefits of Lisp worth the drawbacks. I sure would like to know the answer!
Huh? I think maybe you didn't understand my question. I want to know why they stopped using Lisp, not why they started using Lisp.
Actually, now that I think about it, it's possible that Naughty Dog isn't abandoning Lisp at all. The PS3 is supposed to have a normal main processor (which should be easy to support with Lisp) and a bunch of little floating point coprocessors (which may be difficult to support with Lisp.) So perhaps they are just using C++ for the coprocessors, while continuing to use Lisp for the main processor.
the switch seems to be caused because they 'lost' a/the Lisp guy.
Is that so? "the" Lisp guy at Naughty Dog is Andy Gavin, who seems to still be employed there. (I checked the company web site. Of course that could be out of date.) You may have been thinking of Jason Rubin (the other founder) who left earlier this year.
;;this list comprehension
;; (collect (list) ((* x x))
;; (in (x) '(1 2 3 4 5 6 7 8)))
;; evaluates to
;; (1 4 9 16 25 36 49 64)
And how is this better than
(mapcar #'(lambda (x) (* x x))
'(1 2 3 4 5 6 7 8))
At his presentation at ECOOP, he said something about being able to extend his list comprehensions via OOP. Anyway, MAPCAR is only defined for lists.
Incidentally, he made a quick poll of people, and it turned out LOOP was the most common way to iterate/recurse/whatever. I like it a lot, though perhaps I really need to start learning series:
(loop for i from 1 to 8
collect (* i i))
From what I heard Andy will no longer be working full time (ie he is now semi-retired) at Naughty Dog and they don't have a replacement who wants to rebuild all the Lisp tools for the next gen.