Live data from Hacker News

What Elm and Haskell are teaching mainstream JS [video]

begriffs.com

11–20 of 32 posts

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

#11
post #7

As a year-deep front end developer, I have recently taken a strong interest in functional programming principles and am trying to learn their use-cases. Does anyone have ideas for small projects I can complete that will really drive home the importance/benefits of functional programming?

Not a project, but maybe check out the book JavaScript Allonge which I believe is free to read online

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

#12
post #5

It's nice that JS devs are continuing to discover functional programming techniques, but it irks me a little that this is considered to be some sort of new development. JS has always attracted SICP-inspired programmers because of its strong resemblance to Scheme. Doug Crockford popularised prototypical inheritance and function programming techniques in JS on his blog nearly 10 years ago. KnockoutJS has been around fo…

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, Javascript is also missing those same factors (though I might be wrong about the tail recursion). Yet, I rarely hear of Python described as an infix version of Scheme, yet I often hear that remark about Javascript.

I really want to like Javascript and I already do like Scheme, so I have a vested interest in seeing the connection, but I'm still missing something. What's the strong resemblance between Scheme and Javascript?

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

#13
post #5

It's nice that JS devs are continuing to discover functional programming techniques, but it irks me a little that this is considered to be some sort of new development. JS has always attracted SICP-inspired programmers because of its strong resemblance to Scheme. Doug Crockford popularised prototypical inheritance and function programming techniques in JS on his blog nearly 10 years ago. KnockoutJS has been around fo…

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.

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

#14
post #7

As a year-deep front end developer, I have recently taken a strong interest in functional programming principles and am trying to learn their use-cases. Does anyone have ideas for small projects I can complete that will really drive home the importance/benefits of functional programming?

Elm tutorial walks you through simple "mario bross" game. It is quite fun. http://elm-lang.org/examples/mario

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

#15
post #5

It's nice that JS devs are continuing to discover functional programming techniques, but it irks me a little that this is considered to be some sort of new development. JS has always attracted SICP-inspired programmers because of its strong resemblance to Scheme. Doug Crockford popularised prototypical inheritance and function programming techniques in JS on his blog nearly 10 years ago. KnockoutJS has been around fo…

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…

maybe more an 'inspiration' than related in concrete ways...

Scheme gets mentioned re Javascript because: https://brendaneich.com/tag/history/

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

#16
post #5

It's nice that JS devs are continuing to discover functional programming techniques, but it irks me a little that this is considered to be some sort of new development. JS has always attracted SICP-inspired programmers because of its strong resemblance to Scheme. Doug Crockford popularised prototypical inheritance and function programming techniques in JS on his blog nearly 10 years ago. KnockoutJS has been around fo…

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…

ECMAScript 6+ has tail call recursion optimization, but prior versions do not.

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

#17
post #7

As a year-deep front end developer, I have recently taken a strong interest in functional programming principles and am trying to learn their use-cases. Does anyone have ideas for small projects I can complete that will really drive home the importance/benefits of functional programming?

Not a project, but maybe check out the book JavaScript Allonge which I believe is free to read online

Directly available as https://github.com/raganwald/javascript-allonge

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

#18
post #7

As a year-deep front end developer, I have recently taken a strong interest in functional programming principles and am trying to learn their use-cases. Does anyone have ideas for small projects I can complete that will really drive home the importance/benefits of functional programming?

Curiously, the biggest benefits (of typed functional languages) for me are revealed with larger codebases or spiked code that I have to revisit some weeks later.

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

#19
post #5

It's nice that JS devs are continuing to discover functional programming techniques, but it irks me a little that this is considered to be some sort of new development. JS has always attracted SICP-inspired programmers because of its strong resemblance to Scheme. Doug Crockford popularised prototypical inheritance and function programming techniques in JS on his blog nearly 10 years ago. KnockoutJS has been around fo…

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…

First-class functions (esp. anonymous functions) see relatively little use in python, due to the hobbled syntax. For example, you can't use `print` in a lambda, raise exceptions, or define any variables. In JavaScript, using an anonymous function is no different than any other function, and not surprisingly they are ubiquitous. I'd wager that this is the primary reason that JavaScript is compared to LISP so much more often than Python is. There's also the fact that JavaScript functions are all variadic, which also is similar to LISP. Also Python encourages OOP much more than JavaScript. So yeah the "look and feel" of python is quite a bit different from JS and from scheme as well.

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

#20
post #7

As a year-deep front end developer, I have recently taken a strong interest in functional programming principles and am trying to learn their use-cases. Does anyone have ideas for small projects I can complete that will really drive home the importance/benefits of functional programming?

> that will really drive home the importance/benefits of functional programming..

From my experience with Haskell, on a practical level, I think it really comes down to a guarantee that you will not be able to mess the code up beyond a certain extant.

I am not really sure if it should be attributed to the type system or to functional programming in general. A functional programming language require a really good type system, because you need it maintain sanity with you have to chain together functions a lot more than you do in an imperative language. So I think it has to be a mix of both.

Post reply on HN