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

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.

主站蜘蛛池模板: 沐川县| 藁城市| 阳信县| 县级市| 乐业县| 霞浦县| 建始县| 阿拉善盟| 武定县| 青浦区| 上栗县| 武夷山市| 寿宁县| 宜都市| 织金县| 张家川| 金溪县| 丰顺县| 康马县| 五家渠市| 左云县| 繁峙县| 湟中县| 新宾| 琼结县| 葵青区| 金塔县| 霍林郭勒市| 宝山区| 潞城市| 平罗县| 龙岩市| 石楼县| 米泉市| 沾益县| 潢川县| 红桥区| 祁阳县| 盘锦市| 聊城市| 丘北县|