Zulip Chat Archive

Stream: Is there code for X?

Topic: Apply function to every Element in a set


Christian K (Mar 09 2024 at 15:41):

Is it possible to apply a function to every element in a set.
A very basic example would be this function:

def add_one (x : Set ) : Set  := sorry

It takes a set of Natural Numbers and (should) add 1 to every element and return a new set.

Kyle Miller (Mar 09 2024 at 15:48):

Yes, that's docs#Set.image, which has the notation f '' s for f the function you want to apply to s.

Christian K (Mar 09 2024 at 17:56):

Thank you very much, I overlooked this one


Last updated: May 02 2025 at 03:31 UTC