[racket] Redefining selectors - another newbie question
On 7/1/10 4:14 PM, Matthias Felleisen wrote:
>
> It's not about verbosity alone.
>
> (define-struct posn (x y z))
>
> (define s (struct 1 2 3))
>
> (posn-z s) performs two different tasks
> -- checks that s is an instance of posn
> -- then retrieves 3 from the structure
>
> s.z in C or C++ does only the second.
> s.z in Java is statically assigned a type.
If it weren't clear already, I think Matthias meant to write
(define s (posn 1 2 3))
David