Skip to content

Commit 40c9412

Browse files
committed
[Add] eager and lazy enum examples.
1 parent f646da1 commit 40c9412

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.log
2+
.env
3+
.idea/

eager.exs

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
odd? = &(rem(&1, 2) != 0)
2+
3+
Enum.filter(1..3, odd?)

function_capturing.exs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ fun.([1, [[2], 3]], [4, 5])
55

66
# Is the same as writing
77

8-
fn(list, tail) -> List.flatten(list, tal)
8+
fn(list, tail) -> List.flatten(list, tal) end

lazy.exs

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
stream = Stream.cycle([1, 2, 3])
2+
3+
Enum.take(stream, 10)

0 commit comments

Comments
 (0)