No, set! mutates variable bindings while set-car! mutates cons cells (the first 
slot of a data structure). 


On Mar 5, 2014, at 1:13 PM, Daniel Carrera wrote:

> Hello,
> 
> My understanding is that Racket intentionally does not provide set-car! and 
> set-cdr! and that this is one of the ways in which Racket is not fully 
> compatible with Scheme.
> 
> Am I right to think that it is trivially easy to add these features to 
> Racket? Specifically, I'm thinking of:
> 
> 
> (define-syntax set-car!
>   (syntax-rules ()
>     ((_ l new_car) (set! l (cons new_car (cdr l))))))
> 
> (define-syntax set-cdr!
>   (syntax-rules ()
>     ((_ l new_cdr) (set! l (cons (car l) new_cdr)))))
> 
> 
> Or did I miss something?
> 
> Cheers,
> Daniel.
> -- 
> When an engineer says that something can't be done, it's a code phrase that 
> means it's not fun to do.
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users


____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to