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

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.

主站蜘蛛池模板: 渑池县| 北京市| SHOW| 琼海市| 古田县| 年辖:市辖区| 霍邱县| 阜平县| 宁明县| 马鞍山市| 灵台县| 吉林市| 儋州市| 安阳市| 洞口县| 平陆县| 通渭县| 保靖县| 万载县| 正蓝旗| 渭源县| 通城县| 农安县| 察雅县| 罗城| 宁乡县| 筠连县| 元阳县| 曲麻莱县| 林西县| 咸阳市| 台州市| 黎平县| 乌兰浩特市| 永寿县| 佛学| 浦东新区| 普定县| 大兴区| 那曲县| 塘沽区|