You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
zipper: issue with latest test case from sync #902
the JavaScript reference to a node (variable, object key, etc)
the Zipper instance (which holds unto a node reference)
I might have two zippers a and b that hold the same reference (2) to the same data(1) - because they are the same path (even if arrived at my different routes), but they are (in my implementation) different pointer instances (3)... I'm confused as to why this should be a requirement or even exactly what it means for it to be a requirement.
The directions say nothing about this requirement.
Questions:
It seems that what matters here should be 1/2 (pointer equality) not 3 (whether we have 1 or 2 discrete pointers), no?
And of course this stops being true if one calls a set anywhere along the route, correct?
How does this test even pass given the code for right - it literally calls new Zipper() always...
Wow... I still think there is a lot to be confused about here (and I'm conflating toBe and toEqual above), but I don't think the test names help add much clarity in this regard... "same zipper" in what sense? I'd personally word it more like "different paths lead to same node" (which is actually what is truly being compared, not zipper instances).
...but I did get the last test to pass easily by changing:
value = () => this.node.value
(which seems to trip up equality since I assume there are now two different value functions)
to
value() {
return this.node.value
}
Are we purposely intending to penalize students for writing code in this fashion?
Proposal:
test('should access same node via different paths',()=>{constz1=zipper.left().up().right();constz2=zipper.right();expect(z1.node).toBe(z2.node);});```
@joshgoebel I re-opened this and adjusted the title and labels, then you don't have to copy your thoughts into a new issue.
I put "discussion" for now until a maintainer had time to take a closer look and decide how to proceed.
Activity
sachinmk27 commentedon Sep 17, 2021
I'd like to work on this
Add test case for practice/zipper. Fix exercism#902
Add test case for practice/zipper. Fix #902 (#1354)
joshgoebel commentedon Mar 4, 2022
@SleeplessByte I don't understand this test at all... It seems wholly at odds with the problem specificiation:
All mutation/navigation
returns a new zipper, this directly contradicts the most recent test of "same zipper".Should I open a new issue?
joshgoebel commentedon Mar 4, 2022
To me I see 3 levels of abstraction here...
I might have two zippers
aandbthat hold the same reference (2) to the same data(1) - because they are the same path (even if arrived at my different routes), but they are (in my implementation) different pointer instances (3)... I'm confused as to why this should be a requirement or even exactly what it means for it to be a requirement.The directions say nothing about this requirement.
Questions:
setanywhere along the route, correct?right- it literally callsnew Zipper()always...joshgoebel commentedon Mar 4, 2022
This also seems a direct contradiction of the immediate prior test:
These are the same path (root), so why are they not the "same" zipper?
joshgoebel commentedon Mar 4, 2022
Wow... I still think there is a lot to be confused about here (and I'm conflating
toBeandtoEqualabove), but I don't think the test names help add much clarity in this regard... "same zipper" in what sense? I'd personally word it more like "different paths lead to same node" (which is actually what is truly being compared, not zipper instances)....but I did get the last test to pass easily by changing:
(which seems to trip up equality since I assume there are now two different value functions)
to
Are we purposely intending to penalize students for writing code in this fashion?
Proposal:
[-]zipper: sync with canonical data[/-][+]zipper: issue with latest test case from sync[/+]junedev commentedon Mar 16, 2022
@joshgoebel I re-opened this and adjusted the title and labels, then you don't have to copy your thoughts into a new issue.
I put "discussion" for now until a maintainer had time to take a closer look and decide how to proceed.