Sign in

Lets try to understand list in rescript better by creating our own list

Prerequisite:

If you have already used or tried Rescript, then you should be already familiar with list{} in rescript. list{} is powerful but may cause performance issues if you don't understand how list{} works exactly. So lets try to understand it by creating our own list.

Lets first define the type.


Things get interesting when you want to filter an array of values, with a function returning promise of boolean instead of just a boolean.

Prerequisite:

It is easy to filter an array of values using a function returning a boolean. Let see an example.


Create scan function in typescript/javascript in just one line using lodash

Prerequisite:

I will be using lodash library for some of the examples and to implement the one liner.

scan function is a higher order function similar to reduce, but reduce returns a single value whereas a scan returns an array of values. Lets see some examples to understand better.

REDUCE :

Passing [1 , 2, 3, 4, 5] to reduce function with identity element as 0 and sum as the input function will produce 15 as the output.

Praveenkumar

I am a passionate full stack developer. I develop primarily using JS specifically TS. I also work on JAVA and python. I like exploring latest languages.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store