diff --git a/episode_58/class-list/src/index.js b/episode_58/class-list/src/index.js index 9d14040..101e9e5 100644 --- a/episode_58/class-list/src/index.js +++ b/episode_58/class-list/src/index.js @@ -262,7 +262,8 @@ class List { yield accumulator; } } - return new List(scanLGenerator.bind(this), this.start, this.end); + // a poor way of memoization -- using toList and fromList + return List.fromList( new List(scanLGenerator.bind(this), this.start, this.end).toList() ); } scanr(scanFn, accumulator) {