Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

Functional languages are non-destructive - meaning that they do not mutate the input, but rather return entirely new data based on the input. See this thread: http://stackoverflow.com/questions/749084/jquery-map-vs-eachhttps://stackoverflow.com/questions/749084/jquery-map-vs-each

Functional languages are non-destructive - meaning that they do not mutate the input, but rather return entirely new data based on the input. See this thread: http://stackoverflow.com/questions/749084/jquery-map-vs-each

Functional languages are non-destructive - meaning that they do not mutate the input, but rather return entirely new data based on the input. See this thread: https://stackoverflow.com/questions/749084/jquery-map-vs-each

added 254 characters in body
Source Link
sunwukung
  • 2.3k
  • 1
  • 17
  • 29

Functional languages are non-destructive - meaning that they do not mutate the input, but rather return entirely new data based on the input. See this thread: http://stackoverflow.com/questions/749084/jquery-map-vs-each

Functional languages also feature a lot of common methods in common - with names like "map", "fold", "reduce" etcthat process lists/collections. In JS, unlike other languages, we have to handcrank these into existence - see libraries like underscore.js for some examples, although the latest implementation of JS has some of these straight out the box.

Functional languages also feature a lot of common methods - with names like "map", "fold", "reduce" etc. In JS, unlike other languages, we have to handcrank these into existence - see libraries like underscore.js for some examples, although the latest implementation of JS has some of these straight out the box.

Functional languages are non-destructive - meaning that they do not mutate the input, but rather return entirely new data based on the input. See this thread: http://stackoverflow.com/questions/749084/jquery-map-vs-each

Functional languages also feature a lot of methods in common - with names like "map", "fold", "reduce" that process lists/collections. In JS, unlike other languages, we have to handcrank these into existence - see libraries like underscore.js for some examples, although the latest implementation of JS has some of these straight out the box.

added 809 characters in body
Source Link
sunwukung
  • 2.3k
  • 1
  • 17
  • 29

This means that you can use functions as data, which has the curious effect of reducing the need for variables that maintain state. If you find that yourself reaching for the var statement, or are using one or more "if" statements, then you're straying from thea functional style. Another

Another notable idiosyncrasy of functional style is that functions should ONLY return the result of their evaluation and have no side effects on the state outside of their scope:

That's not to say you shouldn't use functional constructs in Javascript - just be aware of the limitations in it's implementation relative to it's environment.

Here are some links that might be of interest to you:

A good chapter on Functional Programming in Javascript from the excellent "Eloquent Javascript"

The Little Schemer

a friend of mine wrote a JS library based on the Little Schemer

A good tutorial on Scheme that might help you better comprehend FP

This means that you can use functions as data, which has the curious effect of reducing the need for variables that maintain state. If you find that yourself reaching for the var statement then you're straying from the functional style. Another notable idiosyncrasy of functional style is that functions should ONLY return the result of their evaluation and have no side effects on the state outside of their scope:

That's not to say you shouldn't use functional constructs in Javascript - just be aware of the limitations in it's implementation relative to it's environment.

This means that you can use functions as data, which has the curious effect of reducing the need for variables that maintain state. If you find that yourself reaching for the var statement, or are using one or more "if" statements, then you're straying from a functional style.

Another notable idiosyncrasy of functional style is that functions should ONLY return the result of their evaluation and have no side effects on the state outside of their scope:

That's not to say you shouldn't use functional constructs in Javascript - just be aware of the limitations in it's implementation relative to it's environment.

Here are some links that might be of interest to you:

A good chapter on Functional Programming in Javascript from the excellent "Eloquent Javascript"

The Little Schemer

a friend of mine wrote a JS library based on the Little Schemer

A good tutorial on Scheme that might help you better comprehend FP

added 809 characters in body
Source Link
sunwukung
  • 2.3k
  • 1
  • 17
  • 29
Loading
added 809 characters in body
Source Link
sunwukung
  • 2.3k
  • 1
  • 17
  • 29
Loading
Source Link
sunwukung
  • 2.3k
  • 1
  • 17
  • 29
Loading