Coder Social home page Coder Social logo

fp's People

Contributors

sghaida avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

fp's Issues

Add Generic Map (Apply)

definition
Map[A](f: A => B, list: Container[A]): Container[B]

solution.
it would be nice to have a mapping function for any primitive or complex type, which is generic enough to take any data type using some constructor that lifts any type to MapType where A => F[A], and f (A => B) has to apply Transformation for every A inside to produce F[B]

apply parallelism if slice is greater than 1000 for map

Is your feature request related to a problem? Please describe.
since map is done using reflection, performance is going to be affected for big slices and to make it more acceptable from a performance point of view. some partitioning for the operations and to handle a small amount of data per routine makes a lot of sense

solution
partition the data above 1000 to multiples of 1000's and run all in goroutines that they fan-in to the resulting slice using some channel. the problem with that to make it fast, the order of elements in the case of slice shouldn't be maintained

Additional context
this applies to slices bigger than 1000 to accelerate the process
as doing a map over 1000 int elements take on average 600 nanosecond, which is good enough

Add Flatmap

defintion
FlatMap[B](f: A => Container[B]): Container[B]

solution
Flatmap is a combination of a map operation then flat operation

Additional context
this could be very useful to convert slice[A] to slice[B] where f is function A => Slice[B]
in the context of having []string and apply f to produce []byte

Add Options

Is your feature request related to a problem? Please describe.
dealing with nils is a nightmare so the idea of option is to eliminate the usage of nil and instead
use SomeType or NoneType as data containers

Add Either

Is your feature request related to a problem? Please describe.
add either type which contains some value on error and related functionalities such as

  1. IsLeft -> bool
  2. IsRight -> bool
  3. Either() -> EitherType
  4. Left(error) set left -> EitherType
    5.Right(some data) set right -> EitherType
  5. Get() returns the right -> some data if right is available

add reduce

Is your feature request related to a problem? Please describe.
add reduce functionality to be able to do aggregation on slices

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.