mojo icon indicating copy to clipboard operation
mojo copied to clipboard

[External] [stdlib] List.__contains__

Open rd4com opened this issue 9 months ago • 1 comments

Hello, here is List.__contains__, The conformance is done by hand with constrained, _type_is_eq and rebind so that users can do:

var x = List[Int](1,2,3)
if 3 in x: print("ok")

If value would be T2, we would not be able to do it (this is the same PR as https://github.com/modularml/mojo/pull/2662 and https://github.com/modularml/mojo/pull/2665 , started over again)

rd4com avatar May 15 '24 17:05 rd4com

Hey that's really awesome! I didn't know you could do that

helehex avatar May 16 '24 04:05 helehex

Hello @JoeLoser , glad you like it !

Your videos and the community stream helped a lot :partying_face:

I'm learning branch in order to do multiple PR at same time !

rd4com avatar May 16 '24 16:05 rd4com

✅🟣 This contribution has been merged 🟣✅

Your pull request has been merged to the internal upstream Mojo sources. It will be reflected here in the Mojo repository on the nightly branch during the next Mojo nightly release, typically within the next 24-48 hours.

We use Copybara to merge external contributions, click here to learn more.

modularbot avatar May 16 '24 20:05 modularbot

Landed in 97eb340b9ff9ad4a0245c31c92d34f3527da72a8! Thank you for your contribution 🎉

modularbot avatar May 17 '24 05:05 modularbot