Description Usage Arguments Examples
This function implements list comprehension, an alternative to Filter and Map for working
with lists. The syntax is as follows: lc(expr, lists, predicates) where expr
is some expression to be evaluated for all elements in the lists
,
where lists
are one or more named lists, where these are specified by a name
and an expression name = list_expr
, and where predicates
are expressions
that should evaluated to a boolean value. For example, to get a list of all even numbers, squared,
from a list x
we can write lc(x ** 2, x = x, x %% 2 == 0). The result of a call to lc
is a list constructed from the expressions in expr
,
for all elements in the input lists where the predicates evaluate to true.
1 |
expr |
An expression that will be evaluated for each element in the input lists. |
... |
Additional list or predicate arguments. |
1 2 3 4 5 6 7 8 9 10 11 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.