Giter VIP home page Giter VIP logo

pyfuncol's People

Contributors

dependabot[bot] avatar gondolav avatar m-doescode avatar samuelchassot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pyfuncol's Issues

[FEATURE] Optimise chained transformations

Describe the solution you'd like
We should optimise chained transformations in a similar way as what Apache Spark does: they should be lazy and re-ordered so that transformations reducing the number of elements are always executed first.

[FEATURE] Add lazy operations

Describe the solution you'd like
List operations like lazy_map, lazy_filter should return generators instead of lists.

Describe alternatives you've considered
An alternative would be adding a lazy argument to each operation, but it's less clean IMHO.

[FEATURE] Make forbiddenfruit optional

It would be great if forbiddenfruit was made optional. Since forbiddenfruit requires CPython and I think if it would be better if it could work on other versions of python.

Instead of:

import pyfuncol

my_list = [1, 2, 3]
print(my_list.map(lambda x: x * 2))

I can do:

from pyfuncol.list import *

my_list = [1, 2, 3]
print(map(my_list, lambda x: x * 2))

Maybe there can be a check to see if forbiddenfruit is installed. If it is, add all the functions to the builtin classes, otherwise do nothing.

Sorry if I misunderstand how this works.

[FEATURE] Add memoization

Is your feature request related to a problem? Please describe.
Expensive computations that are repeated in a map do not leverage the fact that we already computed once the result.

Describe the solution you'd like
We can memoize pure functions on hashable inputs with something like:

cached_f = functools.cache(f)
return [cached_f(x) for x in self]

To not restrict the library's usages, it would probably make sense to create pure_map, pure_filter, etc.

[BUG] Built-in subclasses are not preserved

Describe the bug
Applying transformations on built-in subclasses, like OrderedDict, returns a plain dict.

Expected behavior
Subclasses should be preserved.

Desktop (please complete the following information):

  • OS: macOS Monterey 12.1
  • Python version 3.9.7
  • pyfuncol version 1.0

Additional context
Could be solved by doing type(self)(...) before returning the result.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.