SlideShare a Scribd company logo
Functional JavaScript
Alexey Kovalenko
Wix
alexk@wix.com
https://github.com/xxllexx
Functional JavaScript
Imperative & Declarative
Functional JavaScript
1. Imperative and Declarative
What and How
Imperative
Declarative
Functional JavaScript
1. Imperative and Declarative
Imperative
var numbers = [1,2,3,4,5],
total = 0;
for(var i = 0; i < numbers.length; i++) {
total += numbers[i];
}
console.log(total); //=> 15
Functional JavaScript
1. Imperative and Declarative
Declarative
var numbers = [1,2,3,4,5];
var total = numbers.reduce(function(sum, n) {
return sum + n;
});
console.log(total) //=> 15
Functional JavaScript
1. Imperative and Declarative
Declarative Imperative
Java C/C++SQL Go
PHP Python
Haskell
Prolog
Functional JavaScript
1. Imperative and Declarative
JavaScript
Multi Paradigm Language, child of Self and Scheme
From Self:
From Scheme
1) Dynamic dispatch
2) Encapsulation
etc.
1) First class functions
2) Closures
Functional Programming Theory
Functional JavaScript
2. Func. Programming Theory
var str = '';
function join(arr) {
for (var i = 0, l = arr.length; i < l; i++) {
str = str + arr[i];
}
console.log(str);
}
join([0,1,2,3]);//-> ‘0123’
console.log(str === ‘0123');//-> true
Functional JavaScript
2. Func. Programming Theory
function join(arr) {
var str = ‘';
for (var i = 0, l = arr.length; i < l; i++) {
str = str + arr[i];
}
return str;
}
var joinedArr = join([0,1,2,3]);
console.log(joinedArr === ‘0123');//-> true
Functional JavaScript
2. Func. Programming Theory
function join(arr, index, str) {
if (index === arr.length) {
return str
}
return join( arr
, (index || 0) + 1
, (str ? str : '') + arr[index || 0]
);
}
var joinedArr = join([0,1,2,3]);
console.log(joinedArr === ‘0123');//-> true
TCO => ES6
Functional JavaScript
2. Func. Programming Theory
function join(arr, index, str) {
return (index === arr.length)
? str
: join(arr
,(index || 0) + 1
,(str ? str : '') + arr[index || 0]
);
}
var joinedArr = join([0,1,2,3]);
console.log(joinedArr === ‘123');//-> true
Curried functions
Functional JavaScript
3.Curry
var add = function (a, b) {
return a + b;
}
add(1, 2); //-> 3
add(1, 2, 3) //-> 3
add(1); //-> NaN
Functional JavaScript
3.Curry
Developed by Haskell Brooks Curry
curry(f) -> X-> ( Y -> (Z ->N) )
Functional JavaScript
3.Curry
var add = function (a, b) {
return function (b) {
return a + b;
}
}
var result = add(1);
console.log(result);//-> function
console.log(result(100));//-> 101
Functional JavaScript
3.Curry
var fn = curry(function(a, b, c) {
return [a, b, c];
});
fn(‘a', ‘b', ‘c');
fn(‘a', ‘b’)('c');
fn(‘a’)('b', ‘c');
fn(‘a’)(‘b’)('c');
//=> [‘a’, ‘b’, ‘c’]
Functional JavaScript
3.Curry
var filter = curry(function(fn, arr){
return arr.filter(fn);
});
var getOdds = filter(isOdd);
var modulo = curry(function (devisor, devided) {
return devided % devisor;
});
var isOdd = modulo(2);
console.log(filter(isOdd, [1,2,3,4,5,6])) //-> [1, 3, 5];
console.log(getOdds([10,11,12,13,14])) //-> [11, 13];
Functional JavaScript
3.Curry
Lodash: _.curry
Wu.js: wu.autoCurry
Ramdajs: R.curry
Composition (Category Theory)
Functional JavaScript
4. Composition
Composition
A B
C
g
f
f ∘ g
f ∘ g = f(g(x))
Functional JavaScript
4. Composition
var compose = function(f, g) {
return function(x) {
return f(g(x));
};
};
Simple Javascript composition function
var sine = function(x) { return Math.sin(x) };
var cube = function(x) { return x * x * x };
var sineOfCube = compose(sine, cube);
sineOfCube(10) === sine(cube(10)); //-> true
Functional JavaScript
4. Composition
Composition & Curry
var limit = curry(function(num, data){
return data.slice(0, num);
});
var _map = curry(function(fn, arr){
return arr.map(fn);
});
var getProp = curry(function(prop, obj){
return obj[prop];
});
Functional JavaScript
4. Composition
Composition & Curry
var users = [
{name: 'Ivan', age: 18},
{name: 'Katya', age: 23},
{name: 'Victor', age: 18},
{name: 'Nata', age: 14},
{name: 'Alex', age: 18},
{name: 'Sveta', age: 34}
];
var usersList = compose(_map(getProp('name')), limit(4));
usersList(users);//-> ["Ivan", "Katya", "Victor", "Nata"]
users{6}users{4}users{4}:name
Functors
Functional JavaScript
5. Functor
function addOne(a) {
return a + 1;
};
addOne(5);
//-> 6
addOne([5]);
//-> 51
Functional JavaScript
5. Functor
fmap :: (a -> b) -> f a -> f b
class (typeclass) Functor f where
Functional JavaScript
5. Functor
fmap :: (a -> b) -> [a] -> [b]
JS map -> Functor Lift
[0, 1, 2, 3].map(addOne);
//-> [1, 2, 3, 4];
[addOne(0), addOne(1), addOne(2) ...]
//-> [1, 2, 3, 4];
Functional JavaScript
5. Functor
var fmap = curry(function(f, obj) {
return obj.fmap(f);
});
Functional JavaScript
5. Functor
var AnyFunctor = function(val){
if(!(this instanceof AnyFunctor))
return new AnyFunctor(val);
this.val = val;
};
AnyFunctor.prototype.fmap = function(fn){
return AnyFunctor(fn(this.val));
}
fmap(addOne, AnyFunctor(2)); //-> AnyFunctor(3)
Functional JavaScript
5. Functor
AnyFunctor.prototype.fmap = function(fn){
return AnyFunctor(this.val.map(fn));
}
fmap(addOne, AnyFunctor([0, 2, 3, 4]));
//-> AnyFunctor([1, 2, 3, 4]);
Functional JavaScript
5. Functor
Functor Maybe
Functional JavaScript
5. Functor
var Maybe = function(val) {
if (!(this instanceof Maybe)) {
return new Maybe(val);
}
this.val = val;
};
Maybe.prototype.fmap = function(f){
return this.val == null
? Maybe(null)
: Maybe(f(this.val));
};
Functional JavaScript
5. Functor
var concat = curry(function(foo, bar){ return foo + bar; });
var pluck = curry(function(prop, obj){ return obj[prop]; });
var match = curry(function (reg, str) { return str.match(reg); });
var showLength = compose(concat('The length is: '), pluck('length'));
var getWords = compose(Maybe, match(/w+/g));
var program = compose(fmap(showLength), getWords);
var result = program('Hello world'); //-> Maybe {val: "The length is: 2"}
Functional JavaScript
5. Functor
var match = curry(function (reg, str) {
return str.match(reg);
});
getWords('Hello World')
//-> Maybe {val: ['Hello', 'World']}
getWords()
//-> Maybe {val: null}
var getWords = compose(fmap(match(/w+/g)), Maybe);
compose(
fmap(match(/w+/g)),
Maybe
);
String | null
Maybe {
val: String | null,
fmap: fn
}
Maybe.fmap(match(reg))
Maybe {
val: match(reg)(String)
}
Maybe {
val: null
}
String
null
Ramda
“a practical functional library for Javascript programmers.”
Functional JavaScript
6. Ramda
Underscore / Lodash
var map = R.map(function(n) { return n * 2; });
map([1, 2, 3]);
_.map([1, 2, 3], function(n) { return n * 2; });
Ramda
R.map(function(n) { return n * 2; }, [1, 2, 3]);
data function
datafunction
Functional JavaScript
6. Ramda
Underscore / Lodash
var users = [
{ 'user': 'Alex', 'age': 36 },
{ 'user': 'Ivan', 'age': 40 },
{ 'user': 'Ted', 'age': 1 }
];
var youngest = _.chain(users)
.sortBy('age')
.map(function(chr) {
return chr.user + ' is ' + chr.age;
})
.first()
.value();
var youngest = _.first(_.map(_.sortBy(users, 'age'), function(ch){
return chr.user + ' is ' + chr.age;
}));
Functional JavaScript
6. Ramda
Ramda
var sorted = R.sortBy(R.prop('age'));
var transformed = R.map(mapFn);
var getOne = R.take(1);
var program = R.compose(transformed, getOne, sorted);
var youngest = program(users);
var mapFn = function(chr){
return chr.user + ' is ' + chr.age;
};
console.log(sorted(users));
console.log(transformed(users));
console.log(getOne(users));
console.log(youngest);
Functional JavaScript
6. Ramda
Ramda
var capitalize = R.compose(
R.map(R.toUpper),
R.map(R.prop('textContent')),
Maybe,
R.bind(document.getElementById, document)
);
// String -> DOMElement
// Object -> Maybe Object
// Maybe Object -> Maybe String
// Maybe String -> Maybe String
<div id="elementId">Hello World</div>
capitalize('elementId');
//-> Maybe {val: "HELLO WORLD", map: function}
capitalize('elementId2');
//-> Maybe {val: null, map: function}
Links
Taking Things Out of Context: Functors in JavaScript:
http://mattfield.github.io/javascript/2013/07/28/taking-things-out-of-context-functors-in-javascript/
Functors, Applicatives, And Monads In Pictures:
http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_pictures.html
Hey Underscore, You're Doing It Wrong!:
https://www.youtube.com/watch?v=m3svKOdZijA
Functional programming patterns for the non-mathematician (cut):
https://www.youtube.com/watch?v=AvgwKjTPMmM
https://github.com/DrBoolean/patterns_talk
Functional JavaScript, Part 4: Function Currying:
http://tech.pro/tutorial/2011/functional-javascript-part-4-function-currying
Introducing Ramda:
http://buzzdecafe.github.io/code/2014/05/16/introducing-ramda/
Thank You!

More Related Content

What's hot

Scala - where objects and functions meet
Scala - where objects and functions meetScala - where objects and functions meet
Scala - where objects and functions meetMario Fusco
 
Type Driven Development with TypeScript
Type Driven Development with TypeScriptType Driven Development with TypeScript
Type Driven Development with TypeScript
Garth Gilmour
 
ES6 - Next Generation Javascript
ES6 - Next Generation JavascriptES6 - Next Generation Javascript
ES6 - Next Generation Javascript
Ramesh Nair
 
Functor, Apply, Applicative And Monad
Functor, Apply, Applicative And MonadFunctor, Apply, Applicative And Monad
Functor, Apply, Applicative And Monad
Oliver Daff
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with ClojureDmitry Buzdin
 
All Aboard The Scala-to-PureScript Express!
All Aboard The Scala-to-PureScript Express!All Aboard The Scala-to-PureScript Express!
All Aboard The Scala-to-PureScript Express!
John De Goes
 
A taste of Functional Programming
A taste of Functional ProgrammingA taste of Functional Programming
A taste of Functional Programming
Jordan Open Source Association
 
Java8 stream
Java8 streamJava8 stream
Java8 streamkoji lin
 
Sneaking inside Kotlin features
Sneaking inside Kotlin featuresSneaking inside Kotlin features
Sneaking inside Kotlin features
Chandra Sekhar Nayak
 
Java 7, 8 & 9 - Moving the language forward
Java 7, 8 & 9 - Moving the language forwardJava 7, 8 & 9 - Moving the language forward
Java 7, 8 & 9 - Moving the language forwardMario Fusco
 
Poor Man's Functional Programming
Poor Man's Functional ProgrammingPoor Man's Functional Programming
Poor Man's Functional ProgrammingDmitry Buzdin
 
Quark: A Purely-Functional Scala DSL for Data Processing & Analytics
Quark: A Purely-Functional Scala DSL for Data Processing & AnalyticsQuark: A Purely-Functional Scala DSL for Data Processing & Analytics
Quark: A Purely-Functional Scala DSL for Data Processing & Analytics
John De Goes
 
friends functionToshu
friends functionToshufriends functionToshu
friends functionToshuSidd Singh
 
Being functional in PHP (PHPDay Italy 2016)
Being functional in PHP (PHPDay Italy 2016)Being functional in PHP (PHPDay Italy 2016)
Being functional in PHP (PHPDay Italy 2016)
David de Boer
 
EcmaScript 6 - The future is here
EcmaScript 6 - The future is hereEcmaScript 6 - The future is here
EcmaScript 6 - The future is here
Sebastiano Armeli
 
Monad Transformers In The Wild
Monad Transformers In The WildMonad Transformers In The Wild
Monad Transformers In The WildStackMob Inc
 
Orthogonal Functional Architecture
Orthogonal Functional ArchitectureOrthogonal Functional Architecture
Orthogonal Functional Architecture
John De Goes
 
First-Class Patterns
First-Class PatternsFirst-Class Patterns
First-Class Patterns
John De Goes
 
What's New In C# 7
What's New In C# 7What's New In C# 7
What's New In C# 7
Paulo Morgado
 
Explaining ES6: JavaScript History and What is to Come
Explaining ES6: JavaScript History and What is to ComeExplaining ES6: JavaScript History and What is to Come
Explaining ES6: JavaScript History and What is to Come
Cory Forsyth
 

What's hot (20)

Scala - where objects and functions meet
Scala - where objects and functions meetScala - where objects and functions meet
Scala - where objects and functions meet
 
Type Driven Development with TypeScript
Type Driven Development with TypeScriptType Driven Development with TypeScript
Type Driven Development with TypeScript
 
ES6 - Next Generation Javascript
ES6 - Next Generation JavascriptES6 - Next Generation Javascript
ES6 - Next Generation Javascript
 
Functor, Apply, Applicative And Monad
Functor, Apply, Applicative And MonadFunctor, Apply, Applicative And Monad
Functor, Apply, Applicative And Monad
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with Clojure
 
All Aboard The Scala-to-PureScript Express!
All Aboard The Scala-to-PureScript Express!All Aboard The Scala-to-PureScript Express!
All Aboard The Scala-to-PureScript Express!
 
A taste of Functional Programming
A taste of Functional ProgrammingA taste of Functional Programming
A taste of Functional Programming
 
Java8 stream
Java8 streamJava8 stream
Java8 stream
 
Sneaking inside Kotlin features
Sneaking inside Kotlin featuresSneaking inside Kotlin features
Sneaking inside Kotlin features
 
Java 7, 8 & 9 - Moving the language forward
Java 7, 8 & 9 - Moving the language forwardJava 7, 8 & 9 - Moving the language forward
Java 7, 8 & 9 - Moving the language forward
 
Poor Man's Functional Programming
Poor Man's Functional ProgrammingPoor Man's Functional Programming
Poor Man's Functional Programming
 
Quark: A Purely-Functional Scala DSL for Data Processing & Analytics
Quark: A Purely-Functional Scala DSL for Data Processing & AnalyticsQuark: A Purely-Functional Scala DSL for Data Processing & Analytics
Quark: A Purely-Functional Scala DSL for Data Processing & Analytics
 
friends functionToshu
friends functionToshufriends functionToshu
friends functionToshu
 
Being functional in PHP (PHPDay Italy 2016)
Being functional in PHP (PHPDay Italy 2016)Being functional in PHP (PHPDay Italy 2016)
Being functional in PHP (PHPDay Italy 2016)
 
EcmaScript 6 - The future is here
EcmaScript 6 - The future is hereEcmaScript 6 - The future is here
EcmaScript 6 - The future is here
 
Monad Transformers In The Wild
Monad Transformers In The WildMonad Transformers In The Wild
Monad Transformers In The Wild
 
Orthogonal Functional Architecture
Orthogonal Functional ArchitectureOrthogonal Functional Architecture
Orthogonal Functional Architecture
 
First-Class Patterns
First-Class PatternsFirst-Class Patterns
First-Class Patterns
 
What's New In C# 7
What's New In C# 7What's New In C# 7
What's New In C# 7
 
Explaining ES6: JavaScript History and What is to Come
Explaining ES6: JavaScript History and What is to ComeExplaining ES6: JavaScript History and What is to Come
Explaining ES6: JavaScript History and What is to Come
 

Viewers also liked

Монады для барабанщиков. Антон Холомьёв
Монады для барабанщиков. Антон ХоломьёвМонады для барабанщиков. Антон Холомьёв
Монады для барабанщиков. Антон Холомьёв
Юрий Сыровецкий
 
Анонимные записи в Haskell. Никита Волков
Анонимные записи в Haskell. Никита ВолковАнонимные записи в Haskell. Никита Волков
Анонимные записи в Haskell. Никита Волков
Юрий Сыровецкий
 
Intro to Functional Programming
Intro to Functional ProgrammingIntro to Functional Programming
Intro to Functional Programming
Hugo Firth
 
Who's More Functional: Kotlin, Groovy, Scala, or Java?
Who's More Functional: Kotlin, Groovy, Scala, or Java?Who's More Functional: Kotlin, Groovy, Scala, or Java?
Who's More Functional: Kotlin, Groovy, Scala, or Java?Andrey Breslav
 
Airbnb tech talk: Levi Weintraub on webkit
Airbnb tech talk: Levi Weintraub on webkitAirbnb tech talk: Levi Weintraub on webkit
Airbnb tech talk: Levi Weintraub on webkit
naseemh
 
Pushing Python: Building a High Throughput, Low Latency System
Pushing Python: Building a High Throughput, Low Latency SystemPushing Python: Building a High Throughput, Low Latency System
Pushing Python: Building a High Throughput, Low Latency SystemKevin Ballard
 
CSS/SVG Matrix Transforms
CSS/SVG Matrix TransformsCSS/SVG Matrix Transforms
CSS/SVG Matrix Transforms
Marc Grabanski
 
HTML5 Essentials
HTML5 EssentialsHTML5 Essentials
HTML5 Essentials
Marc Grabanski
 
jQuery Essentials
jQuery EssentialsjQuery Essentials
jQuery Essentials
Marc Grabanski
 
Functional Programming in JavaScript by Luis Atencio
Functional Programming in JavaScript by Luis AtencioFunctional Programming in JavaScript by Luis Atencio
Functional Programming in JavaScript by Luis Atencio
Luis Atencio
 
Map, Flatmap and Reduce are Your New Best Friends: Simpler Collections, Concu...
Map, Flatmap and Reduce are Your New Best Friends: Simpler Collections, Concu...Map, Flatmap and Reduce are Your New Best Friends: Simpler Collections, Concu...
Map, Flatmap and Reduce are Your New Best Friends: Simpler Collections, Concu...
Chris Richardson
 
Introduction to Functional Programming in JavaScript
Introduction to Functional Programming in JavaScriptIntroduction to Functional Programming in JavaScript
Introduction to Functional Programming in JavaScript
tmont
 
Domain Modeling in a Functional World
Domain Modeling in a Functional WorldDomain Modeling in a Functional World
Domain Modeling in a Functional World
Debasish Ghosh
 
Category theory for beginners
Category theory for beginnersCategory theory for beginners
Category theory for beginners
kenbot
 
Functional Programming Patterns (BuildStuff '14)
Functional Programming Patterns (BuildStuff '14)Functional Programming Patterns (BuildStuff '14)
Functional Programming Patterns (BuildStuff '14)
Scott Wlaschin
 
Introduction to Storm
Introduction to Storm Introduction to Storm
Introduction to Storm Chandler Huang
 
DNS Security Presentation ISSA
DNS Security Presentation ISSADNS Security Presentation ISSA
DNS Security Presentation ISSA
Srikrupa Srivatsan
 
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013Introduction and Overview of Apache Kafka, TriHUG July 23, 2013
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013
mumrah
 
From cache to in-memory data grid. Introduction to Hazelcast.
From cache to in-memory data grid. Introduction to Hazelcast.From cache to in-memory data grid. Introduction to Hazelcast.
From cache to in-memory data grid. Introduction to Hazelcast.
Taras Matyashovsky
 
Cassandra Introduction & Features
Cassandra Introduction & FeaturesCassandra Introduction & Features
Cassandra Introduction & Features
DataStax Academy
 

Viewers also liked (20)

Монады для барабанщиков. Антон Холомьёв
Монады для барабанщиков. Антон ХоломьёвМонады для барабанщиков. Антон Холомьёв
Монады для барабанщиков. Антон Холомьёв
 
Анонимные записи в Haskell. Никита Волков
Анонимные записи в Haskell. Никита ВолковАнонимные записи в Haskell. Никита Волков
Анонимные записи в Haskell. Никита Волков
 
Intro to Functional Programming
Intro to Functional ProgrammingIntro to Functional Programming
Intro to Functional Programming
 
Who's More Functional: Kotlin, Groovy, Scala, or Java?
Who's More Functional: Kotlin, Groovy, Scala, or Java?Who's More Functional: Kotlin, Groovy, Scala, or Java?
Who's More Functional: Kotlin, Groovy, Scala, or Java?
 
Airbnb tech talk: Levi Weintraub on webkit
Airbnb tech talk: Levi Weintraub on webkitAirbnb tech talk: Levi Weintraub on webkit
Airbnb tech talk: Levi Weintraub on webkit
 
Pushing Python: Building a High Throughput, Low Latency System
Pushing Python: Building a High Throughput, Low Latency SystemPushing Python: Building a High Throughput, Low Latency System
Pushing Python: Building a High Throughput, Low Latency System
 
CSS/SVG Matrix Transforms
CSS/SVG Matrix TransformsCSS/SVG Matrix Transforms
CSS/SVG Matrix Transforms
 
HTML5 Essentials
HTML5 EssentialsHTML5 Essentials
HTML5 Essentials
 
jQuery Essentials
jQuery EssentialsjQuery Essentials
jQuery Essentials
 
Functional Programming in JavaScript by Luis Atencio
Functional Programming in JavaScript by Luis AtencioFunctional Programming in JavaScript by Luis Atencio
Functional Programming in JavaScript by Luis Atencio
 
Map, Flatmap and Reduce are Your New Best Friends: Simpler Collections, Concu...
Map, Flatmap and Reduce are Your New Best Friends: Simpler Collections, Concu...Map, Flatmap and Reduce are Your New Best Friends: Simpler Collections, Concu...
Map, Flatmap and Reduce are Your New Best Friends: Simpler Collections, Concu...
 
Introduction to Functional Programming in JavaScript
Introduction to Functional Programming in JavaScriptIntroduction to Functional Programming in JavaScript
Introduction to Functional Programming in JavaScript
 
Domain Modeling in a Functional World
Domain Modeling in a Functional WorldDomain Modeling in a Functional World
Domain Modeling in a Functional World
 
Category theory for beginners
Category theory for beginnersCategory theory for beginners
Category theory for beginners
 
Functional Programming Patterns (BuildStuff '14)
Functional Programming Patterns (BuildStuff '14)Functional Programming Patterns (BuildStuff '14)
Functional Programming Patterns (BuildStuff '14)
 
Introduction to Storm
Introduction to Storm Introduction to Storm
Introduction to Storm
 
DNS Security Presentation ISSA
DNS Security Presentation ISSADNS Security Presentation ISSA
DNS Security Presentation ISSA
 
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013Introduction and Overview of Apache Kafka, TriHUG July 23, 2013
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013
 
From cache to in-memory data grid. Introduction to Hazelcast.
From cache to in-memory data grid. Introduction to Hazelcast.From cache to in-memory data grid. Introduction to Hazelcast.
From cache to in-memory data grid. Introduction to Hazelcast.
 
Cassandra Introduction & Features
Cassandra Introduction & FeaturesCassandra Introduction & Features
Cassandra Introduction & Features
 

Similar to "Немного о функциональном программирование в JavaScript" Алексей Коваленко

Functional Programming for OO Programmers (part 2)
Functional Programming for OO Programmers (part 2)Functional Programming for OO Programmers (part 2)
Functional Programming for OO Programmers (part 2)
Calvin Cheng
 
From Javascript To Haskell
From Javascript To HaskellFrom Javascript To Haskell
From Javascript To Haskell
ujihisa
 
Javascript
JavascriptJavascript
Javascript
Vlad Ifrim
 
FunctionalJS - George Shevtsov
FunctionalJS - George ShevtsovFunctionalJS - George Shevtsov
FunctionalJS - George Shevtsov
Georgiy Shevtsov
 
1. George Shevtsov - Functional JavaScript
1. George Shevtsov - Functional JavaScript1. George Shevtsov - Functional JavaScript
1. George Shevtsov - Functional JavaScript
Innovecs
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing UpDavid Padbury
 
JavaScript Fundamentals with Angular and Lodash
JavaScript Fundamentals with Angular and LodashJavaScript Fundamentals with Angular and Lodash
JavaScript Fundamentals with Angular and Lodash
Bret Little
 
ES6 Overview
ES6 OverviewES6 Overview
ES6 Overview
Bruno Scopelliti
 
Javascript Basics
Javascript BasicsJavascript Basics
Javascript Basics
msemenistyi
 
Functional Reactive Programming with RxJS
Functional Reactive Programming with RxJSFunctional Reactive Programming with RxJS
Functional Reactive Programming with RxJS
stefanmayer13
 
ECMAScript 6 Review
ECMAScript 6 ReviewECMAScript 6 Review
ECMAScript 6 Review
Sperasoft
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript Introduction
Dmitry Sheiko
 
Composition in JavaScript
Composition in JavaScriptComposition in JavaScript
Composition in JavaScript
Josh Mock
 
Groovy
GroovyGroovy
Groovy
Zen Urban
 
Javascript & Ajax Basics
Javascript & Ajax BasicsJavascript & Ajax Basics
Javascript & Ajax BasicsRichard Paul
 
Damn Fine CoffeeScript
Damn Fine CoffeeScriptDamn Fine CoffeeScript
Damn Fine CoffeeScript
niklal
 
ECMAScript 6
ECMAScript 6ECMAScript 6
ECMAScript 6
WebF
 
Composition birds-and-recursion
Composition birds-and-recursionComposition birds-and-recursion
Composition birds-and-recursion
David Atchley
 
Intro to Javascript
Intro to JavascriptIntro to Javascript
Intro to Javascript
Anjan Banda
 
The Beauty of Java Script
The Beauty of Java ScriptThe Beauty of Java Script
The Beauty of Java Script
Michael Girouard
 

Similar to "Немного о функциональном программирование в JavaScript" Алексей Коваленко (20)

Functional Programming for OO Programmers (part 2)
Functional Programming for OO Programmers (part 2)Functional Programming for OO Programmers (part 2)
Functional Programming for OO Programmers (part 2)
 
From Javascript To Haskell
From Javascript To HaskellFrom Javascript To Haskell
From Javascript To Haskell
 
Javascript
JavascriptJavascript
Javascript
 
FunctionalJS - George Shevtsov
FunctionalJS - George ShevtsovFunctionalJS - George Shevtsov
FunctionalJS - George Shevtsov
 
1. George Shevtsov - Functional JavaScript
1. George Shevtsov - Functional JavaScript1. George Shevtsov - Functional JavaScript
1. George Shevtsov - Functional JavaScript
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing Up
 
JavaScript Fundamentals with Angular and Lodash
JavaScript Fundamentals with Angular and LodashJavaScript Fundamentals with Angular and Lodash
JavaScript Fundamentals with Angular and Lodash
 
ES6 Overview
ES6 OverviewES6 Overview
ES6 Overview
 
Javascript Basics
Javascript BasicsJavascript Basics
Javascript Basics
 
Functional Reactive Programming with RxJS
Functional Reactive Programming with RxJSFunctional Reactive Programming with RxJS
Functional Reactive Programming with RxJS
 
ECMAScript 6 Review
ECMAScript 6 ReviewECMAScript 6 Review
ECMAScript 6 Review
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript Introduction
 
Composition in JavaScript
Composition in JavaScriptComposition in JavaScript
Composition in JavaScript
 
Groovy
GroovyGroovy
Groovy
 
Javascript & Ajax Basics
Javascript & Ajax BasicsJavascript & Ajax Basics
Javascript & Ajax Basics
 
Damn Fine CoffeeScript
Damn Fine CoffeeScriptDamn Fine CoffeeScript
Damn Fine CoffeeScript
 
ECMAScript 6
ECMAScript 6ECMAScript 6
ECMAScript 6
 
Composition birds-and-recursion
Composition birds-and-recursionComposition birds-and-recursion
Composition birds-and-recursion
 
Intro to Javascript
Intro to JavascriptIntro to Javascript
Intro to Javascript
 
The Beauty of Java Script
The Beauty of Java ScriptThe Beauty of Java Script
The Beauty of Java Script
 

More from Fwdays

"What I learned through reverse engineering", Yuri Artiukh
"What I learned through reverse engineering", Yuri Artiukh"What I learned through reverse engineering", Yuri Artiukh
"What I learned through reverse engineering", Yuri Artiukh
Fwdays
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
Fwdays
 
"Micro frontends: Unbelievably true life story", Dmytro Pavlov
"Micro frontends: Unbelievably true life story", Dmytro Pavlov"Micro frontends: Unbelievably true life story", Dmytro Pavlov
"Micro frontends: Unbelievably true life story", Dmytro Pavlov
Fwdays
 
"Objects validation and comparison using runtime types (io-ts)", Oleksandr Suhak
"Objects validation and comparison using runtime types (io-ts)", Oleksandr Suhak"Objects validation and comparison using runtime types (io-ts)", Oleksandr Suhak
"Objects validation and comparison using runtime types (io-ts)", Oleksandr Suhak
Fwdays
 
"JavaScript. Standard evolution, when nobody cares", Roman Savitskyi
"JavaScript. Standard evolution, when nobody cares", Roman Savitskyi"JavaScript. Standard evolution, when nobody cares", Roman Savitskyi
"JavaScript. Standard evolution, when nobody cares", Roman Savitskyi
Fwdays
 
"How Preply reduced ML model development time from 1 month to 1 day",Yevhen Y...
"How Preply reduced ML model development time from 1 month to 1 day",Yevhen Y..."How Preply reduced ML model development time from 1 month to 1 day",Yevhen Y...
"How Preply reduced ML model development time from 1 month to 1 day",Yevhen Y...
Fwdays
 
"GenAI Apps: Our Journey from Ideas to Production Excellence",Danil Topchii
"GenAI Apps: Our Journey from Ideas to Production Excellence",Danil Topchii"GenAI Apps: Our Journey from Ideas to Production Excellence",Danil Topchii
"GenAI Apps: Our Journey from Ideas to Production Excellence",Danil Topchii
Fwdays
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
Fwdays
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
Fwdays
 
"What is a RAG system and how to build it",Dmytro Spodarets
"What is a RAG system and how to build it",Dmytro Spodarets"What is a RAG system and how to build it",Dmytro Spodarets
"What is a RAG system and how to build it",Dmytro Spodarets
Fwdays
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
Fwdays
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
Fwdays
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
Fwdays
 
"Distributed graphs and microservices in Prom.ua", Maksym Kindritskyi
"Distributed graphs and microservices in Prom.ua",  Maksym Kindritskyi"Distributed graphs and microservices in Prom.ua",  Maksym Kindritskyi
"Distributed graphs and microservices in Prom.ua", Maksym Kindritskyi
Fwdays
 
"Rethinking the existing data loading and processing process as an ETL exampl...
"Rethinking the existing data loading and processing process as an ETL exampl..."Rethinking the existing data loading and processing process as an ETL exampl...
"Rethinking the existing data loading and processing process as an ETL exampl...
Fwdays
 
"How Ukrainian IT specialist can go on vacation abroad without crossing the T...
"How Ukrainian IT specialist can go on vacation abroad without crossing the T..."How Ukrainian IT specialist can go on vacation abroad without crossing the T...
"How Ukrainian IT specialist can go on vacation abroad without crossing the T...
Fwdays
 
"The Strength of Being Vulnerable: the experience from CIA, Tesla and Uber", ...
"The Strength of Being Vulnerable: the experience from CIA, Tesla and Uber", ..."The Strength of Being Vulnerable: the experience from CIA, Tesla and Uber", ...
"The Strength of Being Vulnerable: the experience from CIA, Tesla and Uber", ...
Fwdays
 
"[QUICK TALK] Radical candor: how to achieve results faster thanks to a cultu...
"[QUICK TALK] Radical candor: how to achieve results faster thanks to a cultu..."[QUICK TALK] Radical candor: how to achieve results faster thanks to a cultu...
"[QUICK TALK] Radical candor: how to achieve results faster thanks to a cultu...
Fwdays
 
"[QUICK TALK] PDP Plan, the only one door to raise your salary and boost care...
"[QUICK TALK] PDP Plan, the only one door to raise your salary and boost care..."[QUICK TALK] PDP Plan, the only one door to raise your salary and boost care...
"[QUICK TALK] PDP Plan, the only one door to raise your salary and boost care...
Fwdays
 
"4 horsemen of the apocalypse of working relationships (+ antidotes to them)"...
"4 horsemen of the apocalypse of working relationships (+ antidotes to them)"..."4 horsemen of the apocalypse of working relationships (+ antidotes to them)"...
"4 horsemen of the apocalypse of working relationships (+ antidotes to them)"...
Fwdays
 

More from Fwdays (20)

"What I learned through reverse engineering", Yuri Artiukh
"What I learned through reverse engineering", Yuri Artiukh"What I learned through reverse engineering", Yuri Artiukh
"What I learned through reverse engineering", Yuri Artiukh
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
"Micro frontends: Unbelievably true life story", Dmytro Pavlov
"Micro frontends: Unbelievably true life story", Dmytro Pavlov"Micro frontends: Unbelievably true life story", Dmytro Pavlov
"Micro frontends: Unbelievably true life story", Dmytro Pavlov
 
"Objects validation and comparison using runtime types (io-ts)", Oleksandr Suhak
"Objects validation and comparison using runtime types (io-ts)", Oleksandr Suhak"Objects validation and comparison using runtime types (io-ts)", Oleksandr Suhak
"Objects validation and comparison using runtime types (io-ts)", Oleksandr Suhak
 
"JavaScript. Standard evolution, when nobody cares", Roman Savitskyi
"JavaScript. Standard evolution, when nobody cares", Roman Savitskyi"JavaScript. Standard evolution, when nobody cares", Roman Savitskyi
"JavaScript. Standard evolution, when nobody cares", Roman Savitskyi
 
"How Preply reduced ML model development time from 1 month to 1 day",Yevhen Y...
"How Preply reduced ML model development time from 1 month to 1 day",Yevhen Y..."How Preply reduced ML model development time from 1 month to 1 day",Yevhen Y...
"How Preply reduced ML model development time from 1 month to 1 day",Yevhen Y...
 
"GenAI Apps: Our Journey from Ideas to Production Excellence",Danil Topchii
"GenAI Apps: Our Journey from Ideas to Production Excellence",Danil Topchii"GenAI Apps: Our Journey from Ideas to Production Excellence",Danil Topchii
"GenAI Apps: Our Journey from Ideas to Production Excellence",Danil Topchii
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
"What is a RAG system and how to build it",Dmytro Spodarets
"What is a RAG system and how to build it",Dmytro Spodarets"What is a RAG system and how to build it",Dmytro Spodarets
"What is a RAG system and how to build it",Dmytro Spodarets
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
"Distributed graphs and microservices in Prom.ua", Maksym Kindritskyi
"Distributed graphs and microservices in Prom.ua",  Maksym Kindritskyi"Distributed graphs and microservices in Prom.ua",  Maksym Kindritskyi
"Distributed graphs and microservices in Prom.ua", Maksym Kindritskyi
 
"Rethinking the existing data loading and processing process as an ETL exampl...
"Rethinking the existing data loading and processing process as an ETL exampl..."Rethinking the existing data loading and processing process as an ETL exampl...
"Rethinking the existing data loading and processing process as an ETL exampl...
 
"How Ukrainian IT specialist can go on vacation abroad without crossing the T...
"How Ukrainian IT specialist can go on vacation abroad without crossing the T..."How Ukrainian IT specialist can go on vacation abroad without crossing the T...
"How Ukrainian IT specialist can go on vacation abroad without crossing the T...
 
"The Strength of Being Vulnerable: the experience from CIA, Tesla and Uber", ...
"The Strength of Being Vulnerable: the experience from CIA, Tesla and Uber", ..."The Strength of Being Vulnerable: the experience from CIA, Tesla and Uber", ...
"The Strength of Being Vulnerable: the experience from CIA, Tesla and Uber", ...
 
"[QUICK TALK] Radical candor: how to achieve results faster thanks to a cultu...
"[QUICK TALK] Radical candor: how to achieve results faster thanks to a cultu..."[QUICK TALK] Radical candor: how to achieve results faster thanks to a cultu...
"[QUICK TALK] Radical candor: how to achieve results faster thanks to a cultu...
 
"[QUICK TALK] PDP Plan, the only one door to raise your salary and boost care...
"[QUICK TALK] PDP Plan, the only one door to raise your salary and boost care..."[QUICK TALK] PDP Plan, the only one door to raise your salary and boost care...
"[QUICK TALK] PDP Plan, the only one door to raise your salary and boost care...
 
"4 horsemen of the apocalypse of working relationships (+ antidotes to them)"...
"4 horsemen of the apocalypse of working relationships (+ antidotes to them)"..."4 horsemen of the apocalypse of working relationships (+ antidotes to them)"...
"4 horsemen of the apocalypse of working relationships (+ antidotes to them)"...
 

Recently uploaded

The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 

Recently uploaded (20)

The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 

"Немного о функциональном программирование в JavaScript" Алексей Коваленко

  • 4. Functional JavaScript 1. Imperative and Declarative What and How Imperative Declarative
  • 5. Functional JavaScript 1. Imperative and Declarative Imperative var numbers = [1,2,3,4,5], total = 0; for(var i = 0; i < numbers.length; i++) { total += numbers[i]; } console.log(total); //=> 15
  • 6. Functional JavaScript 1. Imperative and Declarative Declarative var numbers = [1,2,3,4,5]; var total = numbers.reduce(function(sum, n) { return sum + n; }); console.log(total) //=> 15
  • 7. Functional JavaScript 1. Imperative and Declarative Declarative Imperative Java C/C++SQL Go PHP Python Haskell Prolog
  • 8. Functional JavaScript 1. Imperative and Declarative JavaScript Multi Paradigm Language, child of Self and Scheme From Self: From Scheme 1) Dynamic dispatch 2) Encapsulation etc. 1) First class functions 2) Closures
  • 10. Functional JavaScript 2. Func. Programming Theory var str = ''; function join(arr) { for (var i = 0, l = arr.length; i < l; i++) { str = str + arr[i]; } console.log(str); } join([0,1,2,3]);//-> ‘0123’ console.log(str === ‘0123');//-> true
  • 11. Functional JavaScript 2. Func. Programming Theory function join(arr) { var str = ‘'; for (var i = 0, l = arr.length; i < l; i++) { str = str + arr[i]; } return str; } var joinedArr = join([0,1,2,3]); console.log(joinedArr === ‘0123');//-> true
  • 12. Functional JavaScript 2. Func. Programming Theory function join(arr, index, str) { if (index === arr.length) { return str } return join( arr , (index || 0) + 1 , (str ? str : '') + arr[index || 0] ); } var joinedArr = join([0,1,2,3]); console.log(joinedArr === ‘0123');//-> true TCO => ES6
  • 13. Functional JavaScript 2. Func. Programming Theory function join(arr, index, str) { return (index === arr.length) ? str : join(arr ,(index || 0) + 1 ,(str ? str : '') + arr[index || 0] ); } var joinedArr = join([0,1,2,3]); console.log(joinedArr === ‘123');//-> true
  • 15. Functional JavaScript 3.Curry var add = function (a, b) { return a + b; } add(1, 2); //-> 3 add(1, 2, 3) //-> 3 add(1); //-> NaN
  • 16. Functional JavaScript 3.Curry Developed by Haskell Brooks Curry curry(f) -> X-> ( Y -> (Z ->N) )
  • 17. Functional JavaScript 3.Curry var add = function (a, b) { return function (b) { return a + b; } } var result = add(1); console.log(result);//-> function console.log(result(100));//-> 101
  • 18. Functional JavaScript 3.Curry var fn = curry(function(a, b, c) { return [a, b, c]; }); fn(‘a', ‘b', ‘c'); fn(‘a', ‘b’)('c'); fn(‘a’)('b', ‘c'); fn(‘a’)(‘b’)('c'); //=> [‘a’, ‘b’, ‘c’]
  • 19. Functional JavaScript 3.Curry var filter = curry(function(fn, arr){ return arr.filter(fn); }); var getOdds = filter(isOdd); var modulo = curry(function (devisor, devided) { return devided % devisor; }); var isOdd = modulo(2); console.log(filter(isOdd, [1,2,3,4,5,6])) //-> [1, 3, 5]; console.log(getOdds([10,11,12,13,14])) //-> [11, 13];
  • 21.
  • 23. Functional JavaScript 4. Composition Composition A B C g f f ∘ g f ∘ g = f(g(x))
  • 24. Functional JavaScript 4. Composition var compose = function(f, g) { return function(x) { return f(g(x)); }; }; Simple Javascript composition function var sine = function(x) { return Math.sin(x) }; var cube = function(x) { return x * x * x }; var sineOfCube = compose(sine, cube); sineOfCube(10) === sine(cube(10)); //-> true
  • 25. Functional JavaScript 4. Composition Composition & Curry var limit = curry(function(num, data){ return data.slice(0, num); }); var _map = curry(function(fn, arr){ return arr.map(fn); }); var getProp = curry(function(prop, obj){ return obj[prop]; });
  • 26. Functional JavaScript 4. Composition Composition & Curry var users = [ {name: 'Ivan', age: 18}, {name: 'Katya', age: 23}, {name: 'Victor', age: 18}, {name: 'Nata', age: 14}, {name: 'Alex', age: 18}, {name: 'Sveta', age: 34} ]; var usersList = compose(_map(getProp('name')), limit(4)); usersList(users);//-> ["Ivan", "Katya", "Victor", "Nata"] users{6}users{4}users{4}:name
  • 27.
  • 29. Functional JavaScript 5. Functor function addOne(a) { return a + 1; }; addOne(5); //-> 6 addOne([5]); //-> 51
  • 30. Functional JavaScript 5. Functor fmap :: (a -> b) -> f a -> f b class (typeclass) Functor f where
  • 31. Functional JavaScript 5. Functor fmap :: (a -> b) -> [a] -> [b] JS map -> Functor Lift [0, 1, 2, 3].map(addOne); //-> [1, 2, 3, 4]; [addOne(0), addOne(1), addOne(2) ...] //-> [1, 2, 3, 4];
  • 32. Functional JavaScript 5. Functor var fmap = curry(function(f, obj) { return obj.fmap(f); });
  • 33. Functional JavaScript 5. Functor var AnyFunctor = function(val){ if(!(this instanceof AnyFunctor)) return new AnyFunctor(val); this.val = val; }; AnyFunctor.prototype.fmap = function(fn){ return AnyFunctor(fn(this.val)); } fmap(addOne, AnyFunctor(2)); //-> AnyFunctor(3)
  • 34. Functional JavaScript 5. Functor AnyFunctor.prototype.fmap = function(fn){ return AnyFunctor(this.val.map(fn)); } fmap(addOne, AnyFunctor([0, 2, 3, 4])); //-> AnyFunctor([1, 2, 3, 4]);
  • 36. Functional JavaScript 5. Functor var Maybe = function(val) { if (!(this instanceof Maybe)) { return new Maybe(val); } this.val = val; }; Maybe.prototype.fmap = function(f){ return this.val == null ? Maybe(null) : Maybe(f(this.val)); };
  • 37. Functional JavaScript 5. Functor var concat = curry(function(foo, bar){ return foo + bar; }); var pluck = curry(function(prop, obj){ return obj[prop]; }); var match = curry(function (reg, str) { return str.match(reg); }); var showLength = compose(concat('The length is: '), pluck('length')); var getWords = compose(Maybe, match(/w+/g)); var program = compose(fmap(showLength), getWords); var result = program('Hello world'); //-> Maybe {val: "The length is: 2"}
  • 38. Functional JavaScript 5. Functor var match = curry(function (reg, str) { return str.match(reg); }); getWords('Hello World') //-> Maybe {val: ['Hello', 'World']} getWords() //-> Maybe {val: null} var getWords = compose(fmap(match(/w+/g)), Maybe); compose( fmap(match(/w+/g)), Maybe ); String | null Maybe { val: String | null, fmap: fn } Maybe.fmap(match(reg)) Maybe { val: match(reg)(String) } Maybe { val: null } String null
  • 39. Ramda “a practical functional library for Javascript programmers.”
  • 40. Functional JavaScript 6. Ramda Underscore / Lodash var map = R.map(function(n) { return n * 2; }); map([1, 2, 3]); _.map([1, 2, 3], function(n) { return n * 2; }); Ramda R.map(function(n) { return n * 2; }, [1, 2, 3]); data function datafunction
  • 41. Functional JavaScript 6. Ramda Underscore / Lodash var users = [ { 'user': 'Alex', 'age': 36 }, { 'user': 'Ivan', 'age': 40 }, { 'user': 'Ted', 'age': 1 } ]; var youngest = _.chain(users) .sortBy('age') .map(function(chr) { return chr.user + ' is ' + chr.age; }) .first() .value(); var youngest = _.first(_.map(_.sortBy(users, 'age'), function(ch){ return chr.user + ' is ' + chr.age; }));
  • 42. Functional JavaScript 6. Ramda Ramda var sorted = R.sortBy(R.prop('age')); var transformed = R.map(mapFn); var getOne = R.take(1); var program = R.compose(transformed, getOne, sorted); var youngest = program(users); var mapFn = function(chr){ return chr.user + ' is ' + chr.age; }; console.log(sorted(users)); console.log(transformed(users)); console.log(getOne(users)); console.log(youngest);
  • 43. Functional JavaScript 6. Ramda Ramda var capitalize = R.compose( R.map(R.toUpper), R.map(R.prop('textContent')), Maybe, R.bind(document.getElementById, document) ); // String -> DOMElement // Object -> Maybe Object // Maybe Object -> Maybe String // Maybe String -> Maybe String <div id="elementId">Hello World</div> capitalize('elementId'); //-> Maybe {val: "HELLO WORLD", map: function} capitalize('elementId2'); //-> Maybe {val: null, map: function}
  • 44. Links Taking Things Out of Context: Functors in JavaScript: http://mattfield.github.io/javascript/2013/07/28/taking-things-out-of-context-functors-in-javascript/ Functors, Applicatives, And Monads In Pictures: http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_pictures.html Hey Underscore, You're Doing It Wrong!: https://www.youtube.com/watch?v=m3svKOdZijA Functional programming patterns for the non-mathematician (cut): https://www.youtube.com/watch?v=AvgwKjTPMmM https://github.com/DrBoolean/patterns_talk Functional JavaScript, Part 4: Function Currying: http://tech.pro/tutorial/2011/functional-javascript-part-4-function-currying Introducing Ramda: http://buzzdecafe.github.io/code/2014/05/16/introducing-ramda/