Skip to content

Commit

Permalink
[sk] Update Enum.chunk_by in translated guides elixirschool#529 (el…
Browse files Browse the repository at this point in the history
…ixirschool#546)

* [sk] Update `Enum.chunk_by` in translated guides (elixirschool#529)

* Update enum.md

Restore the first example in `chunk_by` section.
  • Loading branch information
michalvalasek authored and doomspork committed Jul 28, 2016
1 parent 00f1f27 commit 5eeb51b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sk/lessons/basics/enum.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@ Táto funckia má niekoľko možností použitia, pozrite sa do oficiálnej doku

### chunk_by

Ak potrebujete rozdeliť kolekciu do menších na základe niečoho iného, než ich veľkosť, použite funkciu `chunk_by`:
Ak potrebujete rozdeliť kolekciu do menších na základe niečoho iného, než ich veľkosť, použite funkciu `chunk_by`. Ako argumenty funkcia berie kolekciu (Enum) a funkciu - ak sa zmení jej výstup, ukončí sa aktuálna podkolekcia a začne sa vytvárať ďalšia:

```elixir
iex> Enum.chunk_by(["one", "two", "three", "four", "five"], fn(x) -> String.length(x) end)
[["one", "two"], ["three"], ["four", "five"]]
iex> Enum.chunk_by(["one", "two", "three", "four", "five", "six"], fn(x) -> String.length(x) end)
[["one", "two"], ["three"], ["four", "five"], ["six"]]
```

### each
Expand Down

0 comments on commit 5eeb51b

Please sign in to comment.