4 ms·
Probably a good signal for potential O(n^2) when reading the code. EDIT: Nope. I was wrong. This is not a list comprehension.
by Existenceblinks 4y ago
Probably a good signal for potential O(n^2) when reading the code.
EDIT: Nope. I was wrong. This is not a list comprehension.
- loeg 4y agoWhy do you say so? It's equivalent to iterating indexes from 0 to N-1 of two (or more) lists with N elements and providing syntax sugar for those lists' elements at that index. This is O(N).
- Existenceblinks 4y agoTrue. I misread it, it's a zip pattern. I thought it was a fancy list comprehension.
- tuukkah 4y agoRight, it's not an ordinary list comprehension. It's a parallel list comprehension though: zip as bs = [(a,b) | a <- as | b <- bs] https://downloads.haskell.org/ghc/latest/docs/users_guide/exts/parallel_list_comprehensions.html https://downloads.haskell.org/ghc/latest/docs/users_guide/ex...