From c2ce60beccfa85d35182ca22c45350b54644d914 Mon Sep 17 00:00:00 2001 From: Eksperimental Date: Sun, 14 May 2017 15:16:13 -0500 Subject: [PATCH] Remove use of single vars in pattern matching (#1076) * Replace [h|t] with [head | tail] in Collections * Remove use of single letter variables and add space around cons operator --- bg/lessons/basics/collections.md | 6 +++--- bg/lessons/basics/functions.md | 2 +- bn/lessons/basics/collections.md | 6 +++--- bn/lessons/basics/functions.md | 2 +- cn/lessons/basics/collections.md | 6 +++--- cn/lessons/basics/functions.md | 2 +- de/lessons/basics/collections.md | 6 +++--- de/lessons/basics/functions.md | 2 +- es/lessons/basics/collections.md | 6 +++--- es/lessons/basics/functions.md | 2 +- fr/lessons/basics/collections.md | 6 +++--- fr/lessons/basics/functions.md | 2 +- gr/lessons/basics/collections.md | 6 +++--- gr/lessons/basics/functions.md | 2 +- id/lessons/basics/collections.md | 6 +++--- id/lessons/basics/functions.md | 2 +- it/lessons/basics/collections.md | 6 +++--- it/lessons/basics/functions.md | 2 +- jp/lessons/basics/collections.md | 6 +++--- jp/lessons/basics/functions.md | 2 +- ko/lessons/basics/collections.md | 6 +++--- ko/lessons/basics/functions.md | 2 +- lessons/basics/collections.md | 6 +++--- lessons/basics/functions.md | 2 +- lessons/basics/pattern-matching.md | 2 +- my/lessons/basics/collections.md | 6 +++--- my/lessons/basics/functions.md | 2 +- no/lessons/basics/collections.md | 6 +++--- pl/lessons/basics/collections.md | 6 +++--- pl/lessons/basics/functions.md | 2 +- pt/lessons/basics/collections.md | 6 +++--- pt/lessons/basics/functions.md | 2 +- ru/lessons/basics/collections.md | 6 +++--- ru/lessons/basics/functions.md | 2 +- sk/lessons/basics/collections.md | 6 +++--- sk/lessons/basics/functions.md | 2 +- vi/lessons/basics/collections.md | 6 +++--- vi/lessons/basics/functions.md | 2 +- 38 files changed, 76 insertions(+), 76 deletions(-) diff --git a/bg/lessons/basics/collections.md b/bg/lessons/basics/collections.md index b98f66233e..3cf0b61d9b 100644 --- a/bg/lessons/basics/collections.md +++ b/bg/lessons/basics/collections.md @@ -76,11 +76,11 @@ iex> tl [3.14, :pie, "Apple"] В допълнение към гореспоменатите функции, може да ползвате [pattern matching](../pattern-matching/) и оператора `|` за да разделите списъка на глава и опашка; ще разгледаме този подход в дълбочина в следващи уроци: ```elixir -iex> [h|t] = [3.14, :pie, "Apple"] +iex> [head | tail] = [3.14, :pie, "Apple"] [3.14, :pie, "Apple"] -iex> h +iex> head 3.14 -iex> t +iex> tail [:pie, "Apple"] ``` diff --git a/bg/lessons/basics/functions.md b/bg/lessons/basics/functions.md index 3f580fa97d..3c5627d94e 100644 --- a/bg/lessons/basics/functions.md +++ b/bg/lessons/basics/functions.md @@ -85,7 +85,7 @@ end ```elixir defmodule Length do def of([]), do: 0 - def of([_|t]), do: 1 + of(t) + def of([_ | tail]), do: 1 + of(tail) end iex> Length.of [] diff --git a/bn/lessons/basics/collections.md b/bn/lessons/basics/collections.md index 6d621ae30e..8679401e3f 100644 --- a/bn/lessons/basics/collections.md +++ b/bn/lessons/basics/collections.md @@ -75,11 +75,11 @@ iex> tl [3.14, :pie, "Apple"] এছাড়াও আমরা [pattern matching](../pattern-matching/) এবং কন্স অপারেটর `|` দিয়েও একটি লিস্টকে দুই ভাগে ভাগ করতে পারি যা সম্পর্কে পরে আলোচনা হবে। ```elixir -iex> [h|t] = [3.14, :pie, "Apple"] +iex> [head | tail] = [3.14, :pie, "Apple"] [3.14, :pie, "Apple"] -iex> h +iex> head 3.14 -iex> t +iex> tail [:pie, "Apple"] ``` diff --git a/bn/lessons/basics/functions.md b/bn/lessons/basics/functions.md index e8307c6d9c..704f419082 100644 --- a/bn/lessons/basics/functions.md +++ b/bn/lessons/basics/functions.md @@ -85,7 +85,7 @@ end ```elixir defmodule Length do def of([]), do: 0 - def of([_|t]), do: 1 + of(t) + def of([_ | tail]), do: 1 + of(tail) end iex> Length.of [] diff --git a/cn/lessons/basics/collections.md b/cn/lessons/basics/collections.md index 14c2289132..a32e345b6e 100644 --- a/cn/lessons/basics/collections.md +++ b/cn/lessons/basics/collections.md @@ -75,11 +75,11 @@ iex> tl [3.14, :pie, "Apple"] 除了上面的提到的函数,你还可以使用[模式匹配(pattern matching)](../pattern-matching/) 和 `|` 操作符来把一个列表分成头尾两部分;我们在后面的教程中还会看到这种用法。 ```elixir -iex> [h|t] = [3.14, :pie, "Apple"] +iex> [head | tail] = [3.14, :pie, "Apple"] [3.14, :pie, "Apple"] -iex> h +iex> head 3.14 -iex> t +iex> tail [:pie, "Apple"] ``` diff --git a/cn/lessons/basics/functions.md b/cn/lessons/basics/functions.md index a1d9f809e1..0588d7b6ca 100644 --- a/cn/lessons/basics/functions.md +++ b/cn/lessons/basics/functions.md @@ -85,7 +85,7 @@ end ```elixir defmodule Length do def of([]), do: 0 - def of([_|t]), do: 1 + of(t) + def of([_ | tail]), do: 1 + of(tail) end iex> Length.of [] diff --git a/de/lessons/basics/collections.md b/de/lessons/basics/collections.md index 71b2c5e18b..3a2857aae3 100644 --- a/de/lessons/basics/collections.md +++ b/de/lessons/basics/collections.md @@ -75,11 +75,11 @@ iex> tl [3.14, :pie, "Apple"] Zusätzlich zu den bereits erwähnten Funktionen kannst du [Pattern Matching](../pattern-matching/) und den Cons-Operator `|` dazu benutzen eine Liste in `head` und `tail` zu teilen; wir werden in späteren Kapiteln mehr über dieses Pattern lernen: ```elixir -iex> [h|t] = [3.14, :pie, "Apple"] +iex> [head | tail] = [3.14, :pie, "Apple"] [3.14, :pie, "Apple"] -iex> h +iex> head 3.14 -iex> t +iex> tail [:pie, "Apple"] ``` diff --git a/de/lessons/basics/functions.md b/de/lessons/basics/functions.md index c5c2e6b41d..134097005b 100644 --- a/de/lessons/basics/functions.md +++ b/de/lessons/basics/functions.md @@ -85,7 +85,7 @@ Mit unserem Wissen über pattern matching bewaffnet, lass uns mit Hilfe von bena ```elixir defmodule Length do def of([]), do: 0 - def of([_|t]), do: 1 + of(t) + def of([_ | tail]), do: 1 + of(tail) end iex> Length.of [] diff --git a/es/lessons/basics/collections.md b/es/lessons/basics/collections.md index c037f4f509..d247e123a9 100644 --- a/es/lessons/basics/collections.md +++ b/es/lessons/basics/collections.md @@ -71,11 +71,11 @@ iex> tl [3.14, :pie, "Apple"] Además de la funciones citadas, puedes usar el operador tubería `|`; veremos este patrón en futuras lecciones: ```elixir -iex> [h|t] = [3.14, :pie, "Apple"] +iex> [head | tail] = [3.14, :pie, "Apple"] [3.14, :pie, "Apple"] -iex> h +iex> head 3.14 -iex> t +iex> tail [:pie, "Apple"] ``` diff --git a/es/lessons/basics/functions.md b/es/lessons/basics/functions.md index edee076a81..9a894bed4e 100644 --- a/es/lessons/basics/functions.md +++ b/es/lessons/basics/functions.md @@ -85,7 +85,7 @@ Armados con nuestro conocimiento de coincidencia de patrones, vamos a explorar l ```elixir defmodule Length do def of([]), do: 0 - def of([_|t]), do: 1 + of(t) + def of([_ | tail]), do: 1 + of(tail) end iex> Length.of [] diff --git a/fr/lessons/basics/collections.md b/fr/lessons/basics/collections.md index 8b4e08213d..49b0d4f07b 100644 --- a/fr/lessons/basics/collections.md +++ b/fr/lessons/basics/collections.md @@ -64,11 +64,11 @@ iex> tl [3.14, :pie, "Apple"] En plus des fonctions ci-dessus, vous pouvez utiliser un pipe `|` pour déstructurer une liste. Nous verrons cet idiome dans les leçons suivantes: ```elixir -iex> [h|t] = [3.14, :pie, "Apple"] +iex> [head | tail] = [3.14, :pie, "Apple"] [3.14, :pie, "Apple"] -iex> h +iex> head 3.14 -iex> t +iex> tail [:pie, "Apple"] ``` diff --git a/fr/lessons/basics/functions.md b/fr/lessons/basics/functions.md index 1e1c434c07..984554d3fc 100644 --- a/fr/lessons/basics/functions.md +++ b/fr/lessons/basics/functions.md @@ -89,7 +89,7 @@ Armés de notre connaissance du pattern matching, explorons maintenant la récur ```elixir defmodule Length do def of([]), do: 0 - def of([_|t]), do: 1 + of(t) + def of([_ | tail]), do: 1 + of(tail) end iex> Length.of [] diff --git a/gr/lessons/basics/collections.md b/gr/lessons/basics/collections.md index 9105b5e1db..cf0c8ed33a 100644 --- a/gr/lessons/basics/collections.md +++ b/gr/lessons/basics/collections.md @@ -75,11 +75,11 @@ iex> tl [3.41, :pie, "Apple"] Επιπρόσθετα στις προαναφερθείσες συναρτήσεις, μπορείτε να χρησιμοποιήσετε [αντιπαραβολές προτύπων](../pattern-matching/) και τον τελεστή σωλήνα `|` για να χωρίσετε μια λίστα στην κεφαλή και την ουρά. Θα μάθουμε περισσότερα για αυτό το πρότυπο σε μεταγενέστερα μαθήματα: ```elixir -iex> [h|t] = [3.41, :pie, "Apple"] +iex> [head | tail] = [3.41, :pie, "Apple"] [3.41, :pie, "Apple"] -iex> h +iex> head 3.41 -iex> t +iex> tail [:pie, "Apple"] ``` diff --git a/gr/lessons/basics/functions.md b/gr/lessons/basics/functions.md index d5e9422fc8..47fb59eb0f 100644 --- a/gr/lessons/basics/functions.md +++ b/gr/lessons/basics/functions.md @@ -85,7 +85,7 @@ end ```elixir defmodule Length do def of([]), do: 0 - def of([_|t]), do: 1 + of(t) + def of([_ | tail]), do: 1 + of(tail) end iex> Length.of [] diff --git a/id/lessons/basics/collections.md b/id/lessons/basics/collections.md index 92c509a206..58cce971ee 100644 --- a/id/lessons/basics/collections.md +++ b/id/lessons/basics/collections.md @@ -66,11 +66,11 @@ iex> tl [3.14, :pie, "Apple"] Di samping kedua fungsi tersebut, anda juga bisa menggunakan operator `|`; kita akan melihat pola ini di pelajaran-pelajaran selanjutnya: ```elixir -iex> [h|t] = [3.14, :pie, "Apple"] +iex> [head | tail] = [3.14, :pie, "Apple"] [3.14, :pie, "Apple"] -iex> h +iex> head 3.14 -iex> t +iex> tail [:pie, "Apple"] ``` diff --git a/id/lessons/basics/functions.md b/id/lessons/basics/functions.md index e87ccd2651..99f5174a37 100644 --- a/id/lessons/basics/functions.md +++ b/id/lessons/basics/functions.md @@ -85,7 +85,7 @@ Dilengkapi dengan pengetahuan kita tentang pencocokan pola, mari kita eksplorasi ```elixir defmodule Length do def of([]), do: 0 - def of([_|t]), do: 1 + of(t) + def of([_ | tail]), do: 1 + of(tail) end iex> Length.of [] diff --git a/it/lessons/basics/collections.md b/it/lessons/basics/collections.md index 7f0c4999e8..018d2f50e8 100644 --- a/it/lessons/basics/collections.md +++ b/it/lessons/basics/collections.md @@ -66,11 +66,11 @@ iex> tl [3.14, :pie, "Apple"] Oltre alle funzioni menzionate in precedenza, puoi usare l'operatore _pipe_ `|`; vedremo questo operatore nelle lezioni successive: ```elixir -iex> [h|t] = [3.14, :pie, "Apple"] +iex> [head | tail] = [3.14, :pie, "Apple"] [3.14, :pie, "Apple"] -iex> h +iex> head 3.14 -iex> t +iex> tail [:pie, "Apple"] ``` diff --git a/it/lessons/basics/functions.md b/it/lessons/basics/functions.md index 387dbcaee4..02e75fa20e 100644 --- a/it/lessons/basics/functions.md +++ b/it/lessons/basics/functions.md @@ -85,7 +85,7 @@ Dotati delle nozioni sul pattern matching, proviamo ad esplorare la ricorsione u ```elixir defmodule Length do def of([]), do: 0 - def of([_|t]), do: 1 + of(t) + def of([_ | tail]), do: 1 + of(tail) end iex> Length.of [] diff --git a/jp/lessons/basics/collections.md b/jp/lessons/basics/collections.md index e0012281c5..983359358e 100644 --- a/jp/lessons/basics/collections.md +++ b/jp/lessons/basics/collections.md @@ -75,11 +75,11 @@ iex> tl [3.14, :pie, "Apple"] 前述した関数に加えて、リストを頭部と尾部に分けるのに[パターンマッチング](../pattern-matching/)やcons演算子(`|`)を使うこともできます。このパターンについては後のレッスンで取り上げます: ```elixir -iex> [h|t] = [3.14, :pie, "Apple"] +iex> [head | tail] = [3.14, :pie, "Apple"] [3.14, :pie, "Apple"] -iex> h +iex> head 3.14 -iex> t +iex> tail [:pie, "Apple"] ``` diff --git a/jp/lessons/basics/functions.md b/jp/lessons/basics/functions.md index 14f037c455..75daf4200d 100644 --- a/jp/lessons/basics/functions.md +++ b/jp/lessons/basics/functions.md @@ -85,7 +85,7 @@ end ```elixir defmodule Length do def of([]), do: 0 - def of([_|t]), do: 1 + of(t) + def of([_ | tail]), do: 1 + of(tail) end iex> Length.of [] diff --git a/ko/lessons/basics/collections.md b/ko/lessons/basics/collections.md index 39f9013196..fe5cb50d60 100644 --- a/ko/lessons/basics/collections.md +++ b/ko/lessons/basics/collections.md @@ -77,11 +77,11 @@ iex> tl [3.14, :pie, "Apple"] > [역주] : `cons`는 Lisp 계열 언어에서 애텀과 리스트를 연결할 때 쓰이는 연산입니다. 첫번째 매개변수로 주어지는 애텀을 두번째 매개변수로 주어지는 리스트의 head 부분에 삽입하게 됩니다. `(cons 1 (2 3)) == (cons 1 (cons 2 (cons 3 nil))))` ```elixir -iex> [h|t] = [3.14, :pie, "Apple"] +iex> [head | tail] = [3.14, :pie, "Apple"] [3.14, :pie, "Apple"] -iex> h +iex> head 3.14 -iex> t +iex> tail [:pie, "Apple"] ``` diff --git a/ko/lessons/basics/functions.md b/ko/lessons/basics/functions.md index 99cff68177..be5cd686e6 100644 --- a/ko/lessons/basics/functions.md +++ b/ko/lessons/basics/functions.md @@ -85,7 +85,7 @@ end ```elixir defmodule Length do def of([]), do: 0 - def of([_|t]), do: 1 + of(t) + def of([_ | tail]), do: 1 + of(tail) end iex> Length.of [] diff --git a/lessons/basics/collections.md b/lessons/basics/collections.md index bc988a11a9..785717c5c2 100644 --- a/lessons/basics/collections.md +++ b/lessons/basics/collections.md @@ -75,11 +75,11 @@ iex> tl [3.14, :pie, "Apple"] In addition to the aforementioned functions, you can use [pattern matching](../pattern-matching/) and the cons operator `|` to split a list into head and tail; we'll learn more about this pattern in later lessons: ```elixir -iex> [h|t] = [3.14, :pie, "Apple"] +iex> [head | tail] = [3.14, :pie, "Apple"] [3.14, :pie, "Apple"] -iex> h +iex> head 3.14 -iex> t +iex> tail [:pie, "Apple"] ``` diff --git a/lessons/basics/functions.md b/lessons/basics/functions.md index f8c4751128..9dff105679 100644 --- a/lessons/basics/functions.md +++ b/lessons/basics/functions.md @@ -85,7 +85,7 @@ Armed with our knowledge of pattern matching, let's explore recursion using name ```elixir defmodule Length do def of([]), do: 0 - def of([_|t]), do: 1 + of(t) + def of([_ | tail]), do: 1 + of(tail) end iex> Length.of [] diff --git a/lessons/basics/pattern-matching.md b/lessons/basics/pattern-matching.md index 6ed1a36b88..ffc8057e65 100644 --- a/lessons/basics/pattern-matching.md +++ b/lessons/basics/pattern-matching.md @@ -43,7 +43,7 @@ iex> [1|tail] = list [1, 2, 3] iex> tail [2, 3] -iex> [2|_] = list +iex> [2 | _] = list ** (MatchError) no match of right hand side value: [1, 2, 3] # Tuples diff --git a/my/lessons/basics/collections.md b/my/lessons/basics/collections.md index 74252fff49..fd47ed6801 100644 --- a/my/lessons/basics/collections.md +++ b/my/lessons/basics/collections.md @@ -64,11 +64,11 @@ iex> tl [3.14, :pie, "Apple"] Sebagai tambahan kepada fungsi-fungsi yang telah disebutkan, anda juga dibenarkan menggunakan aksara paip `|`; kita akan melihat penggunaan corak ini di dalam pelajaran seterusnya: ```elixir -iex> [h|t] = [3.14, :pie, "Apple"] +iex> [head | tail] = [3.14, :pie, "Apple"] [3.14, :pie, "Apple"] -iex> h +iex> head 3.14 -iex> t +iex> tail [:pie, "Apple"] ``` diff --git a/my/lessons/basics/functions.md b/my/lessons/basics/functions.md index 9d3ce50ddd..bbc57d5b9c 100644 --- a/my/lessons/basics/functions.md +++ b/my/lessons/basics/functions.md @@ -86,7 +86,7 @@ Bersedia dengan pengetahuan mengenai pemadanan corak, kita akan meneroka rekursi ```elixir defmodule Length do def of([]), do: 0 - def of([_|t]), do: 1 + of(t) + def of([_ | tail]), do: 1 + of(tail) end iex> Length.of [] diff --git a/no/lessons/basics/collections.md b/no/lessons/basics/collections.md index 9d68117da3..0342e3e3df 100644 --- a/no/lessons/basics/collections.md +++ b/no/lessons/basics/collections.md @@ -75,11 +75,11 @@ I tillegg til de tidligere nevnte funksjonene, kan vi også bruke cons operatoren `|` - Vi kommer tilbake til denne operatoren i en senere leksjon: ```elixir -iex> [h|t] = [3.14, :pie, "Apple"] +iex> [head | tail] = [3.14, :pie, "Apple"] [3.14, :pie, "Apple"] -iex> h +iex> head 3.14 -iex> t +iex> tail [:pie, "Apple"] ``` diff --git a/pl/lessons/basics/collections.md b/pl/lessons/basics/collections.md index 859be292d3..7009527053 100644 --- a/pl/lessons/basics/collections.md +++ b/pl/lessons/basics/collections.md @@ -74,11 +74,11 @@ iex> tl [3.14, :pie, "Apple"] Poza wyżej wymienionymi funkcjami możemy też użyć operatora `|`; spotkamy się z nim w kolejnych lekcjach: ```elixir -iex> [h|t] = [3.14, :pie, "Apple"] +iex> [head | tail] = [3.14, :pie, "Apple"] [3.14, :pie, "Apple"] -iex> h +iex> head 3.14 -iex> t +iex> tail [:pie, "Apple"] ``` diff --git a/pl/lessons/basics/functions.md b/pl/lessons/basics/functions.md index d72e33ff24..7ebabab6e6 100644 --- a/pl/lessons/basics/functions.md +++ b/pl/lessons/basics/functions.md @@ -85,7 +85,7 @@ Wykorzystując naszą wiedzę o dopasowaniu wzorców, stwórzmy funkcję rekuren ```elixir defmodule Length do def of([]), do: 0 - def of([_|t]), do: 1 + of(t) + def of([_ | tail]), do: 1 + of(tail) end iex> Length.of [] diff --git a/pt/lessons/basics/collections.md b/pt/lessons/basics/collections.md index a4d66285a5..580e72b0eb 100644 --- a/pt/lessons/basics/collections.md +++ b/pt/lessons/basics/collections.md @@ -63,11 +63,11 @@ iex> tl [3.14, :pie, "Apple"] Além das funções citadas, pode-se usar [pattern matching](../pattern-matching) e o operador cons `|` para dividir a lista em topo e cauda; veremos este padrão em futuras lições: ```elixir -iex> [h|t] = [3.14, :pie, "Apple"] +iex> [head | tail] = [3.14, :pie, "Apple"] [3.14, :pie, "Apple"] -iex> h +iex> head 3.14 -iex> t +iex> tail [:pie, "Apple"] ``` diff --git a/pt/lessons/basics/functions.md b/pt/lessons/basics/functions.md index b8a2cfda66..a09354804d 100644 --- a/pt/lessons/basics/functions.md +++ b/pt/lessons/basics/functions.md @@ -84,7 +84,7 @@ Armado com nosso conhecimento sobre pattern matching, vamos explorar recursão u ```elixir defmodule Length do def of([]), do: 0 - def of([_|t]), do: 1 + of(t) + def of([_ | tail]), do: 1 + of(tail) end iex> Length.of [] diff --git a/ru/lessons/basics/collections.md b/ru/lessons/basics/collections.md index 78851438d7..19f3e4dfee 100644 --- a/ru/lessons/basics/collections.md +++ b/ru/lessons/basics/collections.md @@ -73,11 +73,11 @@ iex> tl [3.14, :pie, "Apple"] Того же результата можно добиться с использованием оператора cons — `|`. Мы будем часто его встречать в последующих уроках. ```elixir -iex> [h|t] = [3.14, :pie, "Apple"] +iex> [head | tail] = [3.14, :pie, "Apple"] [3.14, :pie, "Apple"] -iex> h +iex> head 3.14 -iex> t +iex> tail [:pie, "Apple"] ``` diff --git a/ru/lessons/basics/functions.md b/ru/lessons/basics/functions.md index 3d8209954f..0d5925ec8c 100644 --- a/ru/lessons/basics/functions.md +++ b/ru/lessons/basics/functions.md @@ -85,7 +85,7 @@ end ```elixir defmodule Length do def of([]), do: 0 - def of([_|t]), do: 1 + of(t) + def of([_ | tail]), do: 1 + of(tail) end iex> Length.of [] diff --git a/sk/lessons/basics/collections.md b/sk/lessons/basics/collections.md index a916caa020..4657cb8373 100644 --- a/sk/lessons/basics/collections.md +++ b/sk/lessons/basics/collections.md @@ -65,11 +65,11 @@ iex> tl [3.14, :pie, "Apple"] Naviac, ako si ukážeme v neskorších lekciách, sa na tento účel dá krásne použiť operátor `|` (cons): ```elixir -iex> [h|t] = [3.14, :pie, "Apple"] +iex> [head | tail] = [3.14, :pie, "Apple"] [3.14, :pie, "Apple"] -iex> h +iex> head 3.14 -iex> t +iex> tail [:pie, "Apple"] ``` diff --git a/sk/lessons/basics/functions.md b/sk/lessons/basics/functions.md index 5095742695..e5a807e029 100644 --- a/sk/lessons/basics/functions.md +++ b/sk/lessons/basics/functions.md @@ -87,7 +87,7 @@ Vyzbrojení pattern matchingom, vyskúšajme si rekurziu pomocou pomenovaných f ```elixir defmodule Length do def of([]), do: 0 - def of([_|t]), do: 1 + of(t) + def of([_ | tail]), do: 1 + of(tail) end iex> Length.of [] diff --git a/vi/lessons/basics/collections.md b/vi/lessons/basics/collections.md index fddbc6d11e..5a62b47fe9 100644 --- a/vi/lessons/basics/collections.md +++ b/vi/lessons/basics/collections.md @@ -63,11 +63,11 @@ iex> tl [3.14, :pie, "Apple"] Bên cạnh những hàm đã nói ở trên, bạn có thể dùng toán tử ống dẫn `|`; chúng ta sẽ còn gặp lại toán tử này trong các bài sau: ```elixir -iex> [h|t] = [3.14, :pie, "Apple"] +iex> [head | tail] = [3.14, :pie, "Apple"] [3.14, :pie, "Apple"] -iex> h +iex> head 3.14 -iex> t +iex> tail [:pie, "Apple"] ``` diff --git a/vi/lessons/basics/functions.md b/vi/lessons/basics/functions.md index f4b32f6025..657b478320 100644 --- a/vi/lessons/basics/functions.md +++ b/vi/lessons/basics/functions.md @@ -85,7 +85,7 @@ Với những kiến thức về pattern matching đã biết, chúng ta hãy kh ```elixir defmodule Length do def of([]), do: 0 - def of([_|t]), do: 1 + of(t) + def of([_ | tail]), do: 1 + of(tail) end iex> Length.of []