Sep 7, 2018 · 1 min read
Thanks! BTW, as you suggested I tried modifying the code to use lazy gather. That actually doubled the execution time, and I think the reason is that when grepping through one million elements the list _still_ has to be generated.
I learned something new from trying, though. When running an operation on a lazy list — the operation being grep in my case — the resulting list is lazy as well. Method like .elems won’t work on lazy lists, so I had to explicitly convert the returned lazy list to a regular list by using the eager keyword, as in…
my @new-list = eager @lazy-list;There’s apparently always something new to learn.
