[racket] setf in scheme

From: Neil Van Dyke (neil at neilvandyke.org)
Date: Thu Dec 30 10:54:14 EST 2010

Razvan Rotaru wrote at 12/30/2010 10:34 AM:
> I was just wondering whether there is anything like setf in scheme.

If you mean like "set!" to accept place lvalues, SRFI-17 is one example:


Implementing such a thing for a small, fixed set of places (like "car") 
using only macros is easy.

If, however, you want it extensible to new setters, I think you'd end up 
defining matching setting procedures and hanging them off the getter 
procedures as (depending on what your Racket or Scheme version has) 
symbol properties, record-type-as-procedure, or some similar feature.

Setters like this have sometimes seemed to me to provide a nice 
linguistic symmetry, but at the same time, they are growing the language 
quite a bit despite the appeal of simplicity.  In practice, I have never 
wanted to have setters.  IMHO.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20101230/6d186f73/attachment.html>

Posted on the users mailing list.