Skip to content

zizhengtai/funs_old

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Funs

License Join the chat at https://gitter.im/ZizhengTai/funs

Funs is a functional programming library for C . It is currently only a proof of concept, but is under active development.

Examples

std::vector<int> v1{1, 2, 3};

auto v2 = on(v1)
    .map([](int x) { return x * x; })
    .flatMap([](int x) {
        auto s = std::to_string(x)   "!";
        return std::vector<std::string>{s, s};
    })
    .val();

// v2 == std::vector<std::string>{"1!", "1!", "4!", "4!", "9!", "9!"}

Typeclasses

  • Functor (map)
  • Apply (ap)
  • Applicative (pure)
  • Monad (flatMap flatten)
  • Foldable (foldLeft foldRight)
  • Traverse (traverse)

Default Implementations

  • funs::Id
  • std::list
  • std::vector
  • std::unique_ptr
  • std::shared_ptr

Related Projects

Funs is inspired by Cats.

License

This project is licensed under the MIT license. See the LICENSE file for details.

About

Functional programming library for C

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages