Apply a callback to an array: Difference between revisions
Content added Content deleted
(→Haskell List: Added a relatively desugared equivalent of the list comprehension example, using >>=) |
|||
Line 1,322: | Line 1,322: | ||
Using list comprehension to generate a list of the squared values |
Using list comprehension to generate a list of the squared values |
||
<lang haskell>[square x | x <- values]</lang> |
<lang haskell>[square x | x <- values]</lang> |
||
More directly |
|||
<lang>[1 .. 10] >>= pure . (^ 2)</lang> |
|||
Using function composition to create a function that will print the squares of a list |
Using function composition to create a function that will print the squares of a list |