awesome-python icon indicating copy to clipboard operation
awesome-python copied to clipboard

Add mapfun package

Open zakarialaoui10 opened this issue 1 year ago • 2 comments

What is this Python project?

mapfun is a function that applies a mapping function to an infinite number of input elements, with options to skip certain elements and selectively apply the mapping to keys and/or values of objects.

The mapfun function has been developed in JavaScript and Python, offering the same functionality in different programming languages.

What's the difference between this Python project and similar ones?

Enumerate comparisons.

--

Anyone who agrees with this pull request could submit an Approve review to it.

zakarialaoui10 avatar May 24 '23 17:05 zakarialaoui10

I feel that most of the functionality would be there with plain map and filter. How does it differ that? If it's more full fledged stream processing, how does it differ from stream processing libraries like rxpy or maybe bytewax?

igordertigor avatar May 25 '23 08:05 igordertigor

@igordertigor Thank you for your feedback the mapfun function can be seen as a recursive implementation of a deep map Example : this code is valid

from math import exp
from mapfun import mapfun
print(mapfun(exp,{},{"y":1},[
  (
    [-1,
      (
        [
          {"z":[
            1,
            {"x":2}
          ]
          }
        ]
      ),-3
    ]
  ),7
]
            )
     )

and it map the exp function to each elements and keep the same structure in the returned values

zakarialaoui10 avatar May 25 '23 13:05 zakarialaoui10