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

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.

主站蜘蛛池模板: 岳阳县| 麦盖提县| 平昌县| 固原市| 古丈县| 通道| 克东县| 泽普县| 定南县| 靖边县| 凌云县| 法库县| 齐河县| 新龙县| 洮南市| 新密市| 苍梧县| 玛多县| 卓尼县| 礼泉县| 友谊县| 武隆县| 雷山县| 棋牌| 齐齐哈尔市| 加查县| 楚雄市| 自治县| 兴安县| 集安市| 屯门区| 宁津县| 九龙城区| 荔浦县| 邢台县| 腾冲县| 太原市| 宁远县| 会昌县| 田东县| 湟源县|