Subject: Re: Impressing colleagues with Lisp - looking for stories from the trenches From: Erik Naggum <email@example.com> Date: Fri, 03 May 2002 02:20:15 GMT Newsgroups: comp.lang.lisp Message-ID: <firstname.lastname@example.org> * Erik Naggum > (setf (user-id (find-user "username")) 666) * Christopher Browne | Interesting. | | The one problem I'd see with this is that it would get awfully | inefficient if you try to do a more extensive update Well, you seldom do this in the first place because it is so inefficient. Only in the very rare case would you ever want to change a user's uid. But that you could express the operation abstractly simply as a setf on the innocuous accessor, is sufficiently elegant that a competent sysadmin would see the sheer charm of it. I mean, the whole point of this thread is to share stories of how we convinced people that Common Lisp was good, right? I did just that. *sigh* | (setf (id1 (find-user "id1")) 666 | (id2 (find-user "id2")) 667 | (id3 (find-user "id3")) 668 | (id4 (find-user "id4")) 669) I am not sure what you think this does, but my example has find-user, which takes a user-name and returns all the data about a user in a user object, and user-id which is an accessor into the object. The fact that it has access to the old value and can do more intelligent things than just setting the slot in the user information was kind of the key here. | The scheme would get rather "old" rather quick if you had to rewrite | /etc/passwd each time you do a component of the SETF... That is a separate layer of abstraction entirely and is not even handled. The accessors into the user database are already sufficiently abstract in, e.g., Linux that editing /etc/passwd is deprecated and discouraged. -- In a fight against something, the fight has value, victory has none. In a fight for something, the fight is a loss, victory merely relief. 70 percent of American adults do not understand the scientific process.