summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAdam Bard <github@adambard.com>2018-08-22 19:47:55 -0700
committerGitHub <noreply@github.com>2018-08-22 19:47:55 -0700
commitf81e0f451b026e5db34bb7181a7f210734566338 (patch)
tree84e7144e3e78b6ac14e4ea9a77f9c889a0186005
parent883fe074104c01e46d88d3f90ed6da2ca8651f88 (diff)
parent55d4030e97ff206267bc28e5ee42d2ad07db3143 (diff)
Merge pull request #3190 from ephetic/patch-1
[julia/en] add comprehension filter example
-rw-r--r--julia.html.markdown3
1 files changed, 2 insertions, 1 deletions
diff --git a/julia.html.markdown b/julia.html.markdown
index a30871eb..047bb538 100644
--- a/julia.html.markdown
+++ b/julia.html.markdown
@@ -506,9 +506,10 @@ add_10(3) # => 13
map(add_10, [1,2,3]) # => [11, 12, 13]
filter(x -> x > 5, [3, 4, 5, 6, 7]) # => [6, 7]
-# We can use list comprehensions for nicer maps
+# We can use list comprehensions
[add_10(i) for i=[1, 2, 3]] # => [11, 12, 13]
[add_10(i) for i in [1, 2, 3]] # => [11, 12, 13]
+[x for x in [3, 4, 5, 6, 7] if x > 5] # => [6, 7]
####################################################
## 5. Types