Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: UX: Support deferreds in addition to lambdas in Array.map, Array.filter #8180

Closed
1 task done
NickCrews opened this issue Feb 1, 2024 · 3 comments · Fixed by #8267
Closed
1 task done

feat: UX: Support deferreds in addition to lambdas in Array.map, Array.filter #8180

NickCrews opened this issue Feb 1, 2024 · 3 comments · Fixed by #8267
Labels
feature Features or general enhancements

Comments

@NickCrews
Copy link
Contributor

Is your feature request related to a problem?

these lambdas are often really simple, and it would be shorter and cleaner to use Deferreds

Describe the solution you'd like

gmails = emails.filter(_.contains("@gmail.com"))

What version of ibis are you running?

main

What backend(s) are you using, if any?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@NickCrews NickCrews added the feature Features or general enhancements label Feb 1, 2024
@cpcloud
Copy link
Member

cpcloud commented Feb 1, 2024

Can you give this a try on the-epic-split? I believe we have addressed this there.

@cpcloud
Copy link
Member

cpcloud commented Feb 1, 2024

Oh, nevermind, this is slightly different than what I originally thought.

@kszucs
Copy link
Member

kszucs commented Feb 3, 2024

I like this feature request. The implementation should be about checking for Deferred in ArrayValue.filter() method, and the input is indeed a deferred then wrap it with a function calling .resolve().

Implementation suggestion:

if isinstance(predicate, Deferred):
    body = predicate.resolve(parameter.to_expr())
else:
    body = predicate(parameter.to_expr())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Features or general enhancements
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants