Introduction
The bingo-functional libraries contain tools suitable for Functional Programming. Available in the said packages are helper functions - compose()
, map()
, filter()
, fold()
and such, pattern matching utilities, functors, and monads meant to ease the cognitive burden for those who intend to use them. The subsequent text provides elucidatory material for the libraries which should help you, the reader, understand how to go about using them.
#
InstallationBefore you can use any of the bingo-functional libraries, you should have one of either Composer, Yarn, NPM, or Git installed on your system of preference. Shown below are the respective installation directives for the aforestated options:
- Composer
- Yarn
- NPM
- Git
$ composer require chemem/bingo-functional
$ yarn add bingo-functional-js
$ npm install bingo-functional-js
$ git clone https://github.com/ace411/<library>
#
Basic UsageUpon successful installation of the packages via any one of the options shown in the preceding text, you can operationalize library artifacts by invoking them in your code. The following are examples of usage in PHP and JavaScript environments.
- PHP
- JavaScript
require __DIR__ . '/vendor/autoload.php';
use Chemem\Bingo\Functional as f;
$x = f\identity(2);
import { identity } from 'bingo-functional-js' // es2016 and newer// const { identity } = require('bingo-functional-js') // es2015 and older
let x = identity(2)
#
Additional MaterialI published a book titled Functional Programming in PHP that this library features prominently in. I advise that you, a visitor of this site and prospective user of the library, consider purchasing the volume currently retailing on Leanpub.
#
Ownership
bingo-functional
,bingo-functional-js
, andbingo-functional-repl
are the works of Lochemem Bruno Michael and are licensed under Apache-2.0.