Live data from Hacker News

What Elm and Haskell are teaching mainstream JS [video]

begriffs.com

31–32 of 32 posts

Re: What Elm and Haskell are teaching mainstream JS [video]

#31

Earlier quoted context omitted.

As a recovering schemer, I often heard how Javascript is very closely related to Scheme, but I've never really seen the resemblance. Granted, both languages possess: * Dynamic Typing * Garbage Collection * First Class Functions However, Python also meets those requirements. Now, looking at it from the Scheme perspective, Python is missing * Tail Recursion * Macros * Continuations * Concise Language Spec However, Java…

Lexical scope and first-class functions are about as far as the similarities go. JavaScript has nothing on Scheme.

Doesn't have to have anything `on`, simply coming from is enough.

Re: What Elm and Haskell are teaching mainstream JS [video]

#32
post #30
post #27

Some developers are taking a really "creative" interpretation of the lessons of functional programming. I am currently dealing with a codebase (CoffeeScript) full of: _.reduce some_array, (result_array, object) -> ... result_array.push xyz ... return result_array , []

In a lot of languages, stdlibs, what have you, map is implemented in terms of a reduce like this. In a non-lazy language, this kind of a reduce is usually necessary when you want to omit an item efficiently from the resultant array - map does not offer a way to do this.

Did you miss the explicit side-effects in the code above? This isn't like a map/filter in terms of fold, it is a very stupid way of writing a 'for' loop.
Post reply on HN