3 ms·
For anyone finding the syntax of list comprehensions a bit confusing (like me), I found this comparison to be useful if you're familiar with the more readable (
by robbles 13y ago
For anyone finding the syntax of list comprehensions a bit confusing (like me), I found this comparison to be useful if you're familiar with the more readable (usually) Python equivalent:
[expression(element) || element <- list, conditions]
is the same as
[expression(element) for element in list if condition]