Re: S-expressions
Lieven Marchand <mal-x0HW/[email protected]> 07 Aug 2003 21:33:01 +0200
| Newsgroups | gmane.comp.programming.pragmatic |
|---|---|
| Message-ID | <[email protected]> |
Aaron Optimizer Digulla <[email protected]> writes: > On Thu, Aug 07, 2003 at 07:54:52PM +0200, Lieven Marchand wrote: > > > > > * generalized assignment (the setf macro) > > > > > > So I can (setf a b)? What's wrong with a=b? > > > > The generalized part. a[i][j][k] is written in Lisp as (aref a i j k) > > and to set that element you do (setf (aref a i j k) b). Hash table > > lookup is done as (get-hash key hash-table) and setting one is done as > > (setf (get-hash key hash-table) b). Now suppose I have a function > > (circumference triangle). I can define > > > > (defun (setf circumference) (new-circumference triangle) > > ; scale sides so circumference is new-circumference > > ) > > > > and then I can do (setf (circumference triangle) 1) > > So that assigns the value 1 to "circumference triangle"? > Besides the nice feature that variables in lisp can contain > spaces in their names, what is the big advantage? No. It will call code that will adjust the sides of the object triangle. The comment was meant to stand in for that code. -- Jane - Daria? Come on, the neighbors are starting to talk. Daria - Um... good. Soon they'll progress to cave drawings and civilization will be on its way. ------------------------ Yahoo! Groups Sponsor ---------------------~--> Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511 http://us.click.yahoo.com/l.m7sD/LIdGAA/qnsNAA/W4wwlB/TM ---------------------------------------------------------------------~-> To unsubscribe from this group, send an email to: pragmatic_lang-unsubscribe-hHKSG33TihhbjbujkaE4pw@public.gmane.org Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/