source-academy/frontend

Display_list bug

Closed this issue · 1 comments

https://share.sourceacademy.nus.edu.sg/a1mdc

My student, Terence Goh Yan Chen (e1490849) discovered the following bug. In particular, it should be list(1, 2, 3, 4) rather than [1, list(2, 3, 4)]. (see line 6)

He suggests the following:
from looking at the source code its because of the cycle detection, it catches all elements it has seen before and remembers them, even if it isnt nested in itself
it then looks in this cache before anything else, preventing loops when an element is nested in itself.

the fix would be to only store items you are nested in, that might reduce efficiency in some cases but will solve this i think either that or continue to process after hitting the cache, merging pairs into the list

Not frontend, but js-slang issue. Duplicate of source-academy/js-slang#1124, do you mind posting your comment there?