News for hackers. Stuff that matters.
Re:A practical introduction to functional programming by jacquesm on Monday January 26, 2015 @12:24PM (#8948229)
Suggested minor change to the non_fp one:

  var inList = [1,2,3,4,5,6,7,8,9,10];
  
  var non_fp = function ( myListOfNumbers ) {
  	var out = [];
  
  	// square the numbers
  	for (var i = 0; i < myListOfNumbers.length; i++) {
  		var x = myListOfNumbers[i] * myListOfNumbers[i];
                if (x > 10 && x < 100) {
                        out.push( x );
                }
  	}
  
  	return out;
  }
Re:A practical introduction to functional programming by angersock on Monday January 26, 2015 @02:07PM (#8948863)
That's a correct change--I chose the implementation that I did so that it was very obvious how the things remap to a "functional" approach. :)

You see the point I'm driving at, though?

(and thanks for prodding me into writing code to illustrate things better)

Re:A practical introduction to functional programming by jacquesm on Monday January 26, 2015 @02:29PM (#8949005)
> You see the point I'm driving at, though?

Yes, absolutely. I thought you were right on the money with the words but I figured a bit of code would do wonders to hammer it down.

Erlang does an even better job I think:

  [X * X || X <- lists:seq(1,10), X * X > 10, X * X < 100].
Or:

  [Y || Y <- [X * X || X <- lists:seq(1,10)], Y > 10, Y < 100].
Slightly longer, but without that X * X repetition.
Re:A practical introduction to functional programming by angersock on Monday January 26, 2015 @03:05PM (#8949237)
Yep. Erlang/Elixir is actually kind of a joy to work in for math stuff. Shoot me an email if you'd like to chat about that.
Re:A practical introduction to functional programming by jacquesm on Monday January 26, 2015 @04:59PM (#8949858)
I'm slowly slogging my way through Project Euler in Erlang, it's my default way of learning anything new and so far I've been making progress but I'm pretty sure that what I'm writing is absolutely horrible non-idiomatic erlang. I will probably take you up on that but after I've learned a bit more so at least I stand half a chance of understanding you.