Functional Programming for the Web - Februar 2016
Program:
Tom Duncalf: Functional Programming Concepts
Recommended reading: Professor Frisby’s Mostly Adequate Guide to Functional Programming
Pure function is a function that given the same input will always return same output and has no observable side effects.
Hindley–Milner type system
In type theory and functional programming, Hindley–Milner (HM) (also known as Damas–Milner or Damas–Hindley–Milner) is a classical type system for the lambda calculus with parametric polymorphism, first described by J. Roger Hindley and later rediscovered by Robin Milner. Luis Damas contributed a close formal analysis and proof of the method in his PhD thesis.
Among HM’s more notable properties is completeness and its ability to deduce the most general type of a given program without the need of any type annotations or other hints supplied by the programmer. Algorithm W is a fast algorithm, performing type inference in almost linear time with respect to the size of the source, making it practically usable to type large programs.[note 1] HM is preferably used for functional languages. It was first implemented as part of the type system of the programming language ML. Since then, HM has been extended in various ways, most notably by constrained types as used in Haskell. – Wikipedia
First class functions are functions treated like any other data type: can be passed as argument, stored in var, array etc. They are only called when invoked with()
Curried functions can be called with fewer arguments than it expects. If called with fewer args will return a “partially appplied” function that takes the remaining arguments allow us to make new domain specific functions from generic one.
Composition
f and g are functions, x is the value being piped through, then:
function(f, g) {
return function (x) {
return f(g(x));
}
};Functions which doesn’t mention data we working on are good indication how functional code is.
Functors
-
is a type that implements map and obeys some laws
- Maybe functor: for handling null responses
- IO
- Task
Monads are functors with join and ..chain function (flat_map)
Presentation
Ben Ford: Various Ways of Using Haskell
Combining Structures is the essence of Haskell.
Miyamoto Musashi
(c. 1584 – June 13, 1645), also known as Shinmen Takezō, Miyamoto Bennosuke or, by his Buddhist name, Niten Dōraku, was an expert Japanese swordsman and rōnin. Musashi, as he was often simply known, became renowned through stories of his excellent, and unique double bladed swordsmanship and undefeated record in his 60 duels. He was the founder of the Hyōhō Niten Ichi-ryū or Niten-ryū style of swordsmanship and in his final years authored the The Book of Five Rings, a book on strategy, tactics, and philosophy that is still studied today. – Wikipedia
- The strategist makes small things into big things.
- Think lightly of yourself and deeply of the world.
Date:
2016-02-23 18:30
Location:
| Skills Matter | CodeNode, 10 South Place, London, EC2M 7EB |