In Functional Programming, what is a functor?

I’ve come across the term ‘Functor’ a few times while reading various articles on functional programming, but the authors typically assume the reader already understands the term. Looking around on the web has provided either excessively technical descriptions (see the Wikipedia article) or incredibly vague descriptions (see the section on Functors at this ocaml-tutorial website). … Read more

OOP vs Functional Programming vs Procedural [closed]

Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 4 years ago. Improve this question What are the differences between these programming paradigms, and are they better suited to particular … Read more

Why is immutability so important (or needed) in JavaScript?

I am currently working on React JS and React Native frameworks. On the half way road I came across Immutability or the Immutable-JS library, when I was reading about Facebook’s Flux and Redux implementation. The question is, why is immutability so important? What is wrong in mutating objects? Doesn’t it make things simple? Giving an … Read more

How to use underscore.js as a template engine?

I’m trying to learn about new usages of javascript as a serverside language and as a functional language. Few days ago I heard about node.js and express framework. Then I saw about underscore.js as a set of utility functions. I saw this question on stackoverflow . It says we can use underscore.js as a template … Read more

What is “lifting” in Scala?

Sometimes when I read articles in the Scala ecosystem I read the term “lifting”https://stackoverflow.com/”lifted”. Unfortunately, it is not explained what that exactly means. I did some research, and it seems that lifting has something to do with functional values or something like that, but I was not able to find a text that explains what … Read more

Javascript equivalent of Python’s zip function

Is there a javascript equivalent of Python’s zip function? That is, given multiple arrays of equal lengths create an array of pairs. For instance, if I have three arrays that look like this: var array1 = [1, 2, 3]; var array2 = [‘a’,’b’,’c’]; var array3 = [4, 5, 6]; The output array should be: var … Read more

PHP’s array_map including keys

Is there a way of doing something like this: $test_array = array(“first_key” => “first_value”, “second_key” => “second_value”); var_dump(array_map(function($a, $b) { return “$a loves $b”; }, array_keys($test_array), array_values($test_array))); But instead of calling array_keys and array_values, directly passing the $test_array variable? The desired output is: array(2) { [0]=> string(27) “first_key loves first_value” [1]=> string(29) “second_key loves second_value” … Read more

What is the difference between procedural programming and functional programming? [closed]

Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 3 years ago. Improve this question I’ve read the Wikipedia articles for both procedural programming and functional programming, but I’m still slightly … Read more