As a beginner of Crocks.js, it was a problem for we to figure out when to use .map() and when to use .chain(). Of course, using the docs help: map: State s a ~> (a -> b) -> State s b chain: State s a ~> (a -> State s b) -> State s b The…
Recentlly, I am learning crocks.js ADT libaray. In the beginning, it is hard to understand when to use 'runWith', 'evalWith', 'execWith'. Until I went though the coursea thrid times... I finally have some feelings for it. State has 'get, put, modify'…
It is really important to understand function signature in functional programming. The the code example below: const map = fn => anyFunctor => anyFunctor.map(fn); 'map' is pointfree version of any founctor's map, for example: Maybe.of('maybe').map(t…
Learning notes. Video. Less than: If you use 'ramda', you maybe know 'lt, gt'.. R.lt(2, 1); //=> false Is '2' less than '1' , the result is false. We can see that the data is actually come first which is 2. Normally in FP, we want data come last. Wha…
In this blog post I will talk about the changes coming in Angular 2 that will improve its support for functional programming. Angular 2 is still in active development, so all the examples are WIP. Please focus on the capabilities and ideas, and not t…
1. Functional programming treats computation as the evaluation of mathematical and avoids state and mutable data. Scala encourages an expression-oriented programming(EOP) 1) In expression-oriented programming every statement is an expression. A state…
Lifting Now, let's review map from another perspective. map :: (T -> R) -> [T] -> [R] accepts 2 parameters, a function f :: T -> R and a list list :: [T]. [T] is a generic type paramterized by T, it's not the same as T, but definitely shares s…
Functions in Java Prior to the introduction of Lambda Expressions feature in version 8, Java had long been known as a purely object-oriented programming language. "Everything is an Object" is the philosophy deep in the language design. Objects a…
background In pursuit of a real-world application, let’s say we need an e-commerce web applicationfor a mail-order coffee bean company. They sell several types of coffee and in differentquantities, both of which affect the price. Imperative methods F…
In computer science, functional programming is a programming paradigm, a style of building the structure and elements of computer programs, that treats computation as the evaluation of mathematical functions and avoids state and mutable data. It is a…
We'll learn how to take advantage of Ramda's automatic function currying and data-last argument order to combine a series of pure functions into a left-to-right composition, or pipeline, with Ramda's pipe function. A simple example will take 'teams'…
A functional programming function is like a mathematical function, which produces an output that typically depends only on its arguments. Each time a functional programming function is called with the same arguments, the same result is achieved. Func…
TCP Socket Programming in Node.js Posted on October 26th, 2011 under Node.jsTags: Client, node.js, Server, Socket, TCP Programming TCP Sockets in Node.js Eager to know how sockets are programmed in Node? There are three variants of sockets in Node -…
For example we have a component, it needs to call 'react-redux' connect function. import { compose, curry, option, propPath } from '../js/helper' const FilterButton = ({ active, onClick }) => { const classes = classnames('filterButton', { 'filterButt…
We will see a peculiar example of a pure function. This function contained a side-effect, but we dubbed it pure by wrapping its action in another function. Here's another example of this: // getFromStorage :: String -> (_ -> String) const getFromSto…
In functional programming, a monad is a design pattern that defines how functions, actions, inputs, and outputs can be used together to build generic types,[1] with the following organization: Define a data type, and how values of that data type are…
We refactor a standard node callback style workflow into a composed task-based workflow. Original Code: const app = () => { fs.readFile('config.json', 'utf-8', (err, content) => { if (err) throw err; /g, '); fs.writeFile('config1.json', newContents,…
What is applicative functor: the ability to apply functors to each other. For example we have tow functors: Container(2), Container(3) // We can't do this because the numbers are bottled up. add(Container.of(), Container.of()); // NaN We cannot just…