Add `Iterable.filterMap` #363

Open
FroMage opened this Issue Nov 26, 2013 · 6 comments

Comments

Projects
None yet
4 participants
@FroMage
Member

FroMage commented Nov 26, 2013

That does both a filter and a map in a single operation. I guess we're going to have to define a special value for something which we filter out, because if we use Boolean|New filterMap(Old val) we can't map Boolean values.

@gavinking

This comment has been minimized.

Show comment
Hide comment
@gavinking

gavinking Nov 26, 2013

Member

It's not really clear to me that this is much better than iterable.map(fun).coalesced.

I guess we're going to have to define a special value for something which we filter out

And we seriously can't use null for that?

Member

gavinking commented Nov 26, 2013

It's not really clear to me that this is much better than iterable.map(fun).coalesced.

I guess we're going to have to define a special value for something which we filter out

And we seriously can't use null for that?

@tombentley

This comment has been minimized.

Show comment
Hide comment
@tombentley

tombentley May 13, 2014

Member

@FroMage do you still this this is worthwhile?

Member

tombentley commented May 13, 2014

@FroMage do you still this this is worthwhile?

@FroMage

This comment has been minimized.

Show comment
Hide comment
@FroMage

FroMage May 13, 2014

Member

Yes, people expect it to be there

Member

FroMage commented May 13, 2014

Yes, people expect it to be there

@gavinking

This comment has been minimized.

Show comment
Hide comment
@gavinking

gavinking May 13, 2014

Member

Yes, people expect it to be there

They do?

Honestly I'm not sure if there is much call for it, since we can just write:

iterable.map(fun).coalesced
Member

gavinking commented May 13, 2014

Yes, people expect it to be there

They do?

Honestly I'm not sure if there is much call for it, since we can just write:

iterable.map(fun).coalesced
@gavinking

This comment has been minimized.

Show comment
Hide comment
@gavinking

gavinking May 13, 2014

Member

I mean it's really just mapFilteringNulls().

Member

gavinking commented May 13, 2014

I mean it's really just mapFilteringNulls().

@gavinking gavinking modified the milestones: 1.2, 1.1 Jun 6, 2014

@marvelous

This comment has been minimized.

Show comment
Hide comment
@marvelous

marvelous Feb 24, 2015

Now that I discovered the iterable.map(fun).coalesced idiom, I have to say that I don't long for a filterMap anymore. Previously, I was using flatMap returning [value] or [].

Now that I discovered the iterable.map(fun).coalesced idiom, I have to say that I don't long for a filterMap anymore. Previously, I was using flatMap returning [value] or [].

@CeylonMigrationBot CeylonMigrationBot referenced this issue in eclipse/ceylon Nov 14, 2015

Open

Add `Iterable.filterMap` #5241

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment