Skip to content

Instantly share code, notes, and snippets.

@epicallan
Last active June 28, 2016 06:38
Show Gist options
  • Save epicallan/a41c9894ce75a6acf7b2701c75d6b64f to your computer and use it in GitHub Desktop.
Save epicallan/a41c9894ce75a6acf7b2701c75d6b64f to your computer and use it in GitHub Desktop.
Functional Programming Notes & concepts

First class functions

When we say functions are "first class", we mean they are just like everyone else. We can treat functions like any other data type and there is nothing particularly special about them - they may be stored in arrays, passed around, assigned to variables, what have you. (dr boolean)

PointFree Functions

Pointfree style means never having to say your data. Excuse me. It means functions that never mention the data upon which they operate.

Functor

A functor is a function, given a value and a function, unwraps the values to get to its inner value(s), calls the given function with the inner value(s), wraps the returned values in a new structure, and returns the new structure. (http://functionaljavascript.blogspot.ug/2013/07/functors.html)

In the case of JavaScript, filter is a functor because it returns an Array, however forEach is not a functor because it returns undefined. ie. forEach does not maintain structure.

A Functor is a type that implements map and obeys some laws (dr boolean)

Functor is a type that can be mapped over.(jcouyang)

A pointed functor is a functor with an of method

Monads are pointed functors that can flatten

An applicative functor is a pointed functor with an ap method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment