# Add \`filter\` and \`ifSome(then:)\` to Optional

**URL:** <https://forums.swift.org/t/add-filter-and-ifsome-then-to-optional/8143>\
**Category:** Pitches\
**Created:** [January 21, 2018, 8:01am UTC](https://forums.swift.org/t/add-filter-and-ifsome-then-to-optional/8143 "2018-01-21T08:01:59Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![xwu](https://avatars.discourse-cdn.com/v4/letter/x/b487fb/32.png) [@xwu](https://forums.swift.org/u/xwu)\
**Post date:** [January 21, 2018, 8:28pm UTC](https://forums.swift.org/t/add-filter-and-ifsome-then-to-optional/8143/12 "2018-01-21T20:28:48Z")

</div>

> [@stephencelis](#):
>
> Idiomatic use of map comes from functional programming, no? When I read map I expect referential transparency, no side effects, and for these two lines to behave the same:

It's true that `map` is borrowed from functional programming, but Swift has no concept of 'pure' functions and has never made such a requirement for `map`. _The Swift Programming Language_ itself has (or at least, one of its editions once had) an example of `map(print)`, so I think it's fair to say that such usage is 'idiomatic' Swift.

---

_[View the full topic](https://forums.swift.org/t/add-filter-and-ifsome-then-to-optional/8143)._
