Open malcolmsng opened 3 years ago
hi, from the question they are asking how many times filter or map is eagerly called so it kind of doesnt matter if there is no terminal operation. I feel that the answer is just 98 and 97 repectively, but it cant be that simple right? anyone else knows the actual correct answer to this?
i also think it would be 98 and 97 since filter or map would be called for all the elements in the respective IntRanges.
Sorry, this may be off-topic but wasn't LazyList non-examinable or are you doing it for the sake of interest?
Hi where yall get this paper from? I can't find it on the pyp search library...
Hi @jordanwwb @gracefour11 @malcolmsng, do y'all have the LazyList.java file that was mentioned in the question? If not, then I don't think we are able determine how many times filter or map is eagerly evaluated.
Consider this implementation of LazyList:
LazyList.iterate(101, 200).map(x -> 2 * x);
The code will not eagerly evaluate map, so the answer is 0. However, my guess for filter would be at least 1 time to ensure that the LazyList's head contains the right value (and it is not an empty LazyList).
Let me know if you disagree or you find any errors in my code. This is probably not tested for finals but we can discuss this. Hope this helps! :)
Summary
I just wanted to clarify my answers for this question
Suggested Answer (if any):
Im not sure if this is correct but my first guess for part A is 98 while for part B it is 97. However, since there is no terminal operation, I feel that the answer could be 0 for both. Could you guys share your answers?
Screenshots (if any):