Skip to content

Commit cb24cba

Browse files
authored
fix(docs): Rename variable coll to iter for consistency (#3139)
1 parent 7bf0269 commit cb24cba

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Diff for: _overviews/collections-2.13/views.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def lazyMap[T, U](iter: Iterable[T], f: T => U) = new Iterable[U]:
3434
{% endtab %}
3535
{% endtabs %}
3636

37-
Note that `lazyMap` constructs a new `Iterable` without stepping through all elements of the given collection `coll`. The given function `f` is instead applied to the elements of the new collection's `iterator` as they are demanded.
37+
Note that `lazyMap` constructs a new `Iterable` without stepping through all elements of the given collection `iter`. The given function `f` is instead applied to the elements of the new collection's `iterator` as they are demanded.
3838

3939
Scala collections are by default strict in all their transformers, except for `LazyList`, which implements all its transformer methods lazily. However, there is a systematic way to turn every collection into a lazy one and _vice versa_, which is based on collection views. A _view_ is a special kind of collection that represents some base collection, but implements all transformers lazily.
4040

Diff for: _ru/overviews/collections-2.13/views.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ language: ru
1515

1616
В качестве примера не строгого трансформера рассмотрим следующую реализацию операции создания ленивой мапы:
1717

18-
def lazyMap[T, U](coll: Iterable[T], f: T => U) = new Iterable[U] {
19-
def iterator = coll.iterator map f
18+
def lazyMap[T, U](iter: Iterable[T], f: T => U) = new Iterable[U] {
19+
def iterator = iter.iterator map f
2020
}
2121

22-
Обратите внимание, что `lazyMap` создает новую `Iterable` , не обходя все элементы коллекции `coll`. Функция `f` применяется к элементам новой коллекции `iterator` по мере запроса ее элементов.
22+
Обратите внимание, что `lazyMap` создает новую `Iterable` , не обходя все элементы коллекции `iter`. Функция `f` применяется к элементам новой коллекции `iterator` по мере запроса ее элементов.
2323

2424
Коллекции Scala по умолчанию используют строгий способ во всех своих трансфмерах, за исключением `LazyList`, который реализует свои трансформеры не строгими (ленивыми). Однако существует практичный способ превратить любую коллекцию в ленивую и _наоборот_, основанный на отображении коллекции. _Отображение_ представляет собой особый вид коллекции, которое реализует все трансформеры лениво.
2525

0 commit comments

Comments
 (0)