class functions (the rest is up to the dev team to enforce) • immutability, referential transparency, purity, types (esp ADTs), pattern matching, TCO* • open object model, dynamic context, duck typing, non-strict arity, metaprogramming • despite all that, there are some really exciting things happening.
:: Int -> Int -> Int var addSome = function(x) { return function(y) { return x + y; } } // ES2016 (the new way) // addSome :: Int -> Int -> Int const addSome = x => y => x + y const addTwo = addSome(2) addTwo(2) // -> 4 FP newbies, remember this pattern!
spread operator, existential (Maybe monadic*) expression, everything is an expression, shorthand function notations - compiled white space sensitive, a ‘radical’ departure. • underscore.js • utility toolbelt for (mostly data enumeration) akin to the Enumerable module in Ruby. Also, partial application, compose, combinators.
var counter = up.map(1).merge(down.map(-1)) .scan(0, function(x,y) { return x + y }); counter.assign($('#counter'), 'text'); https://baconjs.github.io/
data flow makes it a ‘perfect target’ for immutability and other functional ideas. • Immutability is not just an FP idea, but it is typical in most FP languages.
javascript apps. • Often used with React • Takes cues from Elm (remember that from slide 2) • designed around returning a new state that is the aggregate of reduction functions
can be used with or without react/redux • written in TypeScript (remember that from slide 2) • uses structural sharing via tries just like Scala and Clojure
• https://medium.com/@dtipson • State of the art JavaScript 2016 • https://goo.gl/0ePp12 • functional programming for javascript people • https://goo.gl/ATjZET • hardcore* functional programming in javascript • https://frontendmasters.com/courses/functional-javascript/ • https://egghead.io/series/getting-started-with-redux