Jul 20, 2023

Functional Programming in C++

FC++ is a library for functional programming in C++. Functional programming is a programming paradigm in which functions are treated as regular values. Thus, we can have functions that take other functions as parameters. The former functions are called “higher-order” functions. A common feature of functions is that they can be polymorphic. “Polymorphic” means that the same function can be used with arguments of many types. FC++ is distinguished from other libraries including the C++ Standard Library by its complete support for polymorphism FC++ polymorphic higher-order functions can take other polymorphic functions as arguments and return polymorphic functions as results. This is particularly useful i.e., simplifies code in C++ where type inference is limited and we often need to pass polymorphic functions around and determine their type later.

With FC++ you can define your own higher-order polymorphic functions, but the library also contains a large amount of functionality that can be re-used as-is in C++ programs. This includes infinite “lazy” lists, useful higher-order functions like map, compose, etc., a reference-counting facility that can be used to replace C++ pointers, many common logical and arithmetic operators in a form that can be used with higher-order functions, and more.

Checkout these related ports:
  • Zziplib - Library to provide transparent read access to zipped files
  • Zydis - Fast and lightweight x86/x86-64 disassembler library
  • Zycore-c - Support library with platform independent types, macros, etc for Zydis
  • Zthread - Platform-independent object-oriented C++ threading library
  • Zookeeper - Coordination Service for Distributed Applications
  • Zls - Zig LSP implementation + Zig Language Server
  • Zfp - High throughput library for compressed floating-point arrays
  • Zeal - Offline documentation browser
  • Zapcc - C++ caching compiler based on clang
  • Zanata-platform - Web-based translation platform
  • Zanata-cli - Zanata Java command line client
  • Z88dk - Complete Z80/Z180 development kit
  • Z80ex - ZiLOG Z80 CPU emulator library
  • Z80asm - Assembler for the Z80 microprocessor
  • Z80-asm - Z80 assembly code assembler and disassembler