map

Christian Harms's picture

Javascript Functional programming with Underscore or ECMAScript5

Intro: A little excursion to code more functional with javascript. It contain examples with the classic for-loop-code, the more functional variant with Underscore.js and the HTML5 functional enhancements. It does not explain the basic idea of functional programming - it shows the differences in code examples.

motivation

Last week I got access on the address book from Matthias' well known entry Jennifer. But I had no time to scan all the other girls addresses. With many lines of source code filled with for-loop-code - no way. I have to find a smarter coding way to scan the address book.Read more

Christian Harms's picture

Functional programming with Python

To work with lists many c/c++ programmer use a simple for-loop. I will try to explain how this can be made a little bit easier. For that I use the self-explaining script language python.

Here is a simple example to filter all odd integers from a list in simple python 2.x syntax.

def filter_odd(myList):  
   result = []               # initialize the result list  
   for num in myList:               # iterate over the list  
     if num % 2 == 1:        # modulo 2 return 1 for odd integers
        result.append(num)   # add to the result
   return result                
Read more

Syndicate content