(define size 2)
I'm using Structure and Interpretation of Computer Programs as a guide to teaching myself computer science, and while I enjoy the book as a reading experience, I've found the degree to which the author throws in terms without any explanation as to the nuances and differences between them pretty frustrating.
The author says the name and value in the example are size
and 2
respectively but doesn't go into which part of the example is the variable or object. I'm super new to the subject and cannot tell if he is using terms interchangeably (ie value and variable).
size
is the name of the variable. A variable is a storage location with a name. There can also be storage locations that aren't variables. For instance (car foo)
is an expression that returns the value stored in the first slot of a pair; the variable's value is the pair, but the first slot doesn't have a name, so it's not a variable.
In this context, "object" and "value" are equivalent. Value refers to the role that the object serves in the assignment expression.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With