0
votes
5answers
40 views

Functionally prepending an array element

Is there a functional way to prepend an element to an array. Something like: [1,2].prepend(3); // should return [3, 1, 2] Kindly notice that a reference to the result array is returned. The reason ...
2
votes
2answers
39 views

Rewrite cycle in functional style

I've created simple function: it has array as input and id. Function suppose to take all elements 'before' given idea. function takeBefore(stars, id) { var taken = []; for(var i = ...
3
votes
2answers
62 views

is any JavaScript statement an expression?

I know that functional languages like Lisp don't have statements. Everything there is an expression. JavaScript is a functional language. So I came to a conclusion that every JavaScript statement is ...
0
votes
3answers
60 views

In Javascript, why does array.map(String) return array of strings?

The list processing routine map on an array object is very convenient at times. Here's one of the handy ways to use it: var numarr = [1,2,3,4]; console.log(numarr.map(String)) >>> ["1", ...
57
votes
5answers
37k views

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 ...
0
votes
2answers
55 views

Scheme namespace use convention. Compared with Javascript

Had to learn javascript for a project, do not miss it one bit! (Though I recognize its use and scale of its impact, not only in the desktop, but server and mobile spaces likewise). One of the things ...
5
votes
5answers
98 views

Can anyone explain me what is state and mutable data?

In computer science, functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data. ...
5
votes
9answers
2k views

What is the fastest way to learn Javascript?

What is the fastest way to learn Javascript for someone eloquent with class-based OOP & typed functional programming (Scala, Java), and having some knowledge of metaprogramming (Python, Ruby, ...
1
vote
2answers
36 views

Functions returning functions aproach in JavaScript

i have almost a half year since i continuously learn javascript and started to use more seriously. JS has the C like syntax and other parts like closures, dynamic typing, optional paramates, etc. ...
-2
votes
1answer
42 views

Persistent data structures: a persistent index? [closed]

Functional programming utilizes immutable data. When you modify something you reinstantiate "the world" reusing the previous incarnation in as much as possible for your augmented world. I am ...
3
votes
1answer
61 views

Correct use of a fold or reduce function to long-to-wide data in python or javascript?

Trying to learn to think like a functional programmer a little more---I'd like to transform a data set with what I think is either a fold or a reduce operation. In R, I would think of this as a ...
3
votes
3answers
53 views

Functional Programming: Printing to JS console in Chrome

I'm implementing functional programming from Eloquent Javascript to my JS console in Google Chrome. There's a function that loops through each element in an array and performs the given action in the ...
3
votes
1answer
99 views

Functional programming: reflecting state in absence of actual state change?

I am new to some of the advanced functional programming ideas, in particular: how to work with immutable data. Data structures are often composites, composed of smaller data structures. For ...
7
votes
3answers
118 views

Call each function in the list

I've got an array of functions and looking for a concise way to call each one in order. fns = [ function a() { console.log('a') }, function b() { console.log('b') }, function c() { ...
0
votes
2answers
56 views

How to use chains without applying anti-patterns in JavaScript?

If you try to program in a functional style on JavaScript, you'll probably realize the conventional fn(obj,params...) form gets unreadable fast. console.log( join( map(function(row){ ...

1 2 3 4 5 12
15 30 50 per page