sghaida / fp Goto Github PK
View Code? Open in Web Editor NEWsome experimentation to bridge the gap between GO and FP languages, since its more fun doing FP
License: Apache License 2.0
some experimentation to bridge the gap between GO and FP languages, since its more fun doing FP
License: Apache License 2.0
Additional context
add tests for map
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]
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
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
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
Is your feature request related to a problem? Please describe.
add either type which contains some value on error and related functionalities such as
Is your feature request related to a problem? Please describe.
add reduce functionality to be able to do aggregation on slices
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.