All Projects → rgrannell1 → Kea

rgrannell1 / Kea

Composable Functional Programming in R

Programming Languages

r
7636 projects

Projects that are alternatives of or similar to Kea

F
Functional stuff for Python
Stars: ✭ 113 (+527.78%)
Mutual labels:  collections, functional-programming
Mu Scala
Mu is a purely functional library for building RPC endpoint based services with support for RPC and HTTP/2
Stars: ✭ 266 (+1377.78%)
Mutual labels:  monads, functional-programming
HelloWorlds
Hello-World program in most programming languages
Stars: ✭ 102 (+466.67%)
Mutual labels:  lists, collections
Neither
Either and Maybe monads for better error-handling in C++ ↔️
Stars: ✭ 236 (+1211.11%)
Mutual labels:  monads, functional-programming
Whyhaskellmatters
In this article I try to explain why Haskell keeps being such an important language by presenting some of its most important and distinguishing features and detailing them with working code examples. The presentation aims to be self-contained and does not require any previous knowledge of the language.
Stars: ✭ 418 (+2222.22%)
Mutual labels:  monads, functional-programming
Pratica
🥃 Functional Algebraic Data Types
Stars: ✭ 246 (+1266.67%)
Mutual labels:  monads, functional-programming
NonEmptyCollections
A type-safe implementation for collections that cannot be empty. Life is too short for emptiness-checks!
Stars: ✭ 45 (+150%)
Mutual labels:  lists, collections
Funcj
Assorted functional-oriented data structures and algorithms for Java.
Stars: ✭ 60 (+233.33%)
Mutual labels:  monads, functional-programming
True Myth
A library for safer and smarter error- and "nothing"-handling in TypeScript.
Stars: ✭ 360 (+1900%)
Mutual labels:  monads, functional-programming
Language Ext
C# functional language extensions - a base class library for functional programming
Stars: ✭ 3,964 (+21922.22%)
Mutual labels:  monads, functional-programming
Maryamyriameliamurphies.js
A library of Haskell-style morphisms ported to ES2015 JavaScript using Babel.
Stars: ✭ 177 (+883.33%)
Mutual labels:  monads, functional-programming
Learn Fp
learn-by-doing course/tutorial for functional programming on scala
Stars: ✭ 548 (+2944.44%)
Mutual labels:  monads, functional-programming
Scala Workflow
Boilerplate-free syntax for computations with effects
Stars: ✭ 173 (+861.11%)
Mutual labels:  monads, functional-programming
Cyclops
An advanced, but easy to use, platform for writing functional applications in Java 8.
Stars: ✭ 1,180 (+6455.56%)
Mutual labels:  collections, functional-programming
Fpgo
Monad, Functional Programming features for Golang
Stars: ✭ 165 (+816.67%)
Mutual labels:  monads, functional-programming
PowerCollections
Powerfull Collections, Sets, Lists and Maps.
Stars: ✭ 15 (-16.67%)
Mutual labels:  lists, collections
Purefun
Functional Programming library for Java
Stars: ✭ 37 (+105.56%)
Mutual labels:  monads, functional-programming
Monio
Async-capable IO monad for JS
Stars: ✭ 311 (+1627.78%)
Mutual labels:  monads, functional-programming
Arrow
Λrrow - Functional companion to Kotlin's Standard Library
Stars: ✭ 4,771 (+26405.56%)
Mutual labels:  monads, functional-programming
Freestyle
A cohesive & pragmatic framework of FP centric Scala libraries
Stars: ✭ 627 (+3383.33%)
Mutual labels:  monads, functional-programming

Kea 0.78.0 Build Status

![Gitter](https://badges.gitter.im/Join Chat.svg)

Coverage Status

'By relieving the brain of all unnecessary work, a good notation sets it free to concentrate on more advanced problems, and, in effect, increases the mental power of the race.' -- Alfred N. Whitehead

Kea is a functional programming library built to do three things:

  • maximise developer happiness
  • be quick to write, debug, and run
  • make writing large programs easy

In practice, Kea is a collection of higher-order functions and standard collection algorithms that abstracts over the difference between atomic vectors, lists and pairlists. In this way Kea resembles the STL for C++ or Underscore for JavaScript.

1. Installation

The best way to get Kea is through github. You must install from the releases branch; Kea is in rapid development and breaking changes are frequently made.

if (!require(devtools)) {
    install.packages("devtools"); library(devtools)
}

devtools::install_github("rgrannell1/kea", ref = 'releases')

Go here for accompanying Sublime Text 3 snippets.

2. Syntax

- Partial Application

Kea functions are partially applicable; they don't require all their arguments be supplied at once.

xIsMatch('[0-9]+')
# -- base R syntax
function (str) xIsMatch('[0-9]+', str)

# -- xIsMatch is given a regular expression, then mapped over some strings.

xMap(xIsMatch('[0-9]+'), c('123', 'abc'))
# list(True, False)

- Methods

Every function has a corresponding method. To call a method you first pass data to the kea object constructor (x_) and then call methods using the $ operator.

x_(1:10) $ xMap(sqrt) $ x_Reduce('+')
# 22.46828

- Arrow Functions

Arrow functions are a shorthand notation for creating functions:

x := x

# base library.
function (x) x

(a : b) := {
	(a + b) / b
}

# base library
function (a, b) {
	(a + b) / b
}

- Wildcard Operators

Wildcard operators fix the right operand of an operator, leaving a function that takes the left operand.

xMap(x. + 1, 0:3)
# 1:4

- Variadic Functions

Most collection functions in Kea have forms that take a collection of items, or an indeterminate number of items through the ellipses parametre ( ... ). The latter form is denoted with an underscore suffix and is more succinct, but less flexible than its alternative.

xMap (x := x, list(1, 2, 3))
xMap_(x := x, 1, 2, 3)

- Function Composition

Function composition joins multiple functions end-to-end into a new function, that applies both transformations to an input in order.

birds <- list(list('kea', 'New Zealand'), list('grouse', 'Ireland'))
xMap(xFirstOf %then% xCharsOf, birds)

list(3, 6)

Special operators are also available for combining predicate functions.

xSelect_(is.integer %or% is.double, 'a', 1, 2L, '3', 4)
list(1, 2, 4)

5. Algorithms

4. Licensing

Kea is released under the terms of the GNU General Public License version 3.

5. Versioning

All versions post-release will be compliant with the Semantic Versioning 2.0.0 standard.

http://semver.org/

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].