官术网_书友最值得收藏!

Working with collections

Contrary to the most common programming languages, Elixir doesn't have while or do ... while constructs, which makes sense, given all data types are immutable. The way to iterate in Elixir is by using recursion, through functions that call themselves. Most of your needs when working with collections are covered by the high-level abstractions Elixir provides, meaning that you may barely use recursion when writing your Elixir applications.

Nevertheless, we'll begin this section by briefly describing recursion, and show an example of a recursive function in Elixir. Then, we'll see how we can process a collection using the Enum module, and finish the section by talking about the benefits of processing a collection lazily, and how to do it using the Stream module.

主站蜘蛛池模板: 安福县| 吉林省| 方城县| 称多县| 安顺市| 通江县| 纳雍县| 武义县| 安平县| 高碑店市| 巩留县| 施秉县| 汶上县| 吉木乃县| 大邑县| 鹰潭市| 乌恰县| 定西市| 会同县| 深圳市| 霍州市| 民乐县| 沽源县| 孝感市| 化德县| 泰州市| 彭泽县| 井冈山市| 维西| 保靖县| 星子县| 邵武市| 咸宁市| 临邑县| 永德县| 曲松县| 岑巩县| 堆龙德庆县| 渝北区| 宜丰县| 香河县|