List equality
Issue #163
new
Following code blocks evaluate to false:
Comments (3)
-
repo owner -
Most programming languages will report false to
[1, 2, 3] = [1, 2, 3]
, but I see the pedagogical value in that. In Snap_!_ we do have list comparison. It is recursive and it avoids circular references.Here’s Jens' implementation in case we want to base ours on that one: https://github.com/jmoenig/Snap/blob/master/src/lists.js#L545
-
reporter Here is the SNAP! version:
- Log in to comment
This is worth thinking about. It would need to be recursive to handle lists inside of lists, and a recursive implementation would need to protect itself against circular data structures.
But perhaps a non-recursive implementation would be better than nothing. That would deal the case above and probably 95% of beginner situations. And those advanced enough to build more complex data structures could write their own recursive equality test.