Jannis
11/25/2019, 7:50 PMraulraja
11/25/2019, 8:31 PMJannis
11/25/2019, 8:46 PM// all methods are stdlib
(1..10000).asSequence().fold(emptySequence<Int>()) { acc, el ->
acc + el
}.first()
Also fails with a stackoverflow. Fold on its own is perfectly fine. First on infinite sequences is as well. That leaves only plus as the culprit. Either way, defining sequence methods that are refolds from sequence to sequence should not be done using fold in the first place as that forces the entire sequenceraulraja
11/25/2019, 8:52 PMfoldRight
stack safe?Jannis
11/25/2019, 8:53 PMJannis
11/25/2019, 9:01 PMJannis
11/25/2019, 10:14 PMJannis
11/25/2019, 10:15 PMraulraja
11/25/2019, 10:15 PM