EqualityOperatorComparesListIdentitiesDRAFTNot Observed
(list a) = (list b)
compares the two list identities.
(list a) = (list b) compares the identities of list a and list b
(list a) = (list b) compares the contents of list a and list b
CorrectionHere is what's right.
The () = ()
operator compares the contents of lists.
For example, if we create two separate lists, list a
and list b
,
and add the same contents into both,
then the following Scratch code will say true
:
So the () = ()
operator does not care
whether the left and right holes contain the same list
(e.g., whether they both contain (list a)
),
but whether they contain lists with the same contents.
OriginWhere could this misconception come from?
ValueHow can you build on this misconception?
This misconception is an opportunity to discuss how one can identify something.
For example, Scratch lists (which are a kind of “object”) are identified by the name the programmer gives them when they create them. Given that Scratch programs cannot programmatically create new lists, there is no need for a concept of references (i.e., addresses of list “objects”). Every list can be identified by its name.