Posts
Currying with JavaScript
Currying with JavaScript
There are a few ways to implement currying. I’m not exactly sure if they all fit exactly into the definition of currying. Nevertheless I will collect different curry methods in this page.
Variadic Arity Currying This version of the curry function works with any function arity. The returned curried function will take as many parameters as is passed into it at a time.
One of the bad sides of this curry method is that it will not give any warning if it’s called with too many arguments.
Posts
Synchronizing Input with Paragraph Content
Another React type of example with the pubsub and state functions.
Posts
Seconds elapsed
In this note I implemented a seconds elapsed example which is rendered below.
seconds elapsed 0
Seconds elapsed can be implemented with the same boilerplate functions (pubsub.js and state.js) that was introduced for the Simple Counter implemented here.
The implementation of the seconds elapsed component utilizing state.js and pubsub.js can be seen below:
Posts
Simple Counter
I’ve created a simple counter just like the one you usually see in examples when reading about webframeworks like React, Reagent, Elm or whatever framework.
I decided to do this by using pure HTML and JavaScript. The reasoning being not more then experimentation and maybe answer to myself on why these frameworks are needed.
Below is the counter app.
The number is now 0
increment the number The Events A natural theme in many frameworks is to connect elements in the UI to be reactive on state changes.
Posts
Composition With Javascript
A composition in functional programming is a function that has been ‘composed’ from two functions.
More formally a composition is when we have a function f that takes an argument of type A and returns B (A → B) and another function g that takes an argument of type B and returns C (B → C). Then we can create a function out of f and g that takes an argument of type A and returns C (A → C).