SlideShare a Scribd company logo
Definitions	of	Functional	
Programming
Comparing	four	Definitions
slides	by @philip_schwarz
1. A	pure	function	depends	only	on	(a)	its	declared	input	parameters	and	(b)	its	algorithm	to	produce	its	result.	
A	pure	function	has	no	“back	doors,”	which	means:
1. Its	result	can’t depend	on reading any	hidden	value	outside	of	the	function	scope,	such	as	another	field	in	the	same	class or	global	variables.
2. It	cannot	modify any hidden	fields	outside	of	the	function	scope,	such	as	other	mutable fields in	the	same	class or	global	variables.
3. It	cannot depend on	any	external	I/O.	It	can’t	rely	on	input	from	files,	databases,	web	services,	UIs,	etc;	it	can’t	produce	output,	such	as	
writing to	a	file,	database,	or	web	service,	writing to	a	screen,	etc.
2.	A	pure	function	does	not	modify its	input	parameters.
A pure function has no side effects,
meaning that it does not read
anything from the outside world or
write anything to the outside world.
As a result of 1, if a pure function is
called with an input parameter x an
infinite number of times, it will
always return the same result y.
This is unlike an OOP method, which
can depend on other fields in the
same class as the method.
A pure function is a function that depends only on its declared input parameters and its algorithm to produce its output.
It does not read any other values from “the outside world” — the world outside
of the function’s scope — and it does not modify any values in the outside world
Functional	programming is	a	way	of	writing software	applications	using	only	pure	functions and	immutable	values.
FP means programming with pure functions, and a pure function is one that lacks side effects…
A function f with input type A and output type B (written in Scala as a single type: A => B , pronounced “A to B ” or “A arrow B ”) is a computation that relates every value a of type
A to exactly one value b of type B such that b is determined solely by the value of a. Any changing state of an internal or external process is irrelevant to computing the result f(a).
For example, a function intToString having type Int => String will take every integer to a corresponding string. Furthermore, if it really is a function, it will do nothing else.
In other words, a function has no observable effect on the execution of the program other than to compute a result given its inputs; we say that it has no side effects. We
sometimes qualify such functions as pure functions to make this more explicit, but this is somewhat redundant.
FP in Scala
by	Paul	Chiusano	
and	Runar	Bjarnason
@pchiusano @runarorama
by	Sam	Halliday
@fommil
by	Alvin	Alexander
@alvinalexander
Definitions	of	Functional	Programming
1.2	Pure	Functional	Programming
Functional	Programming	is	the	act	of	writing	programs	with	pure	functions.	Pure	functions	have	three	properties:
• Total:	return	a	value	for	every	possible	input
•	Deterministic:	return	the	same	value	for	the	same	input
• Inculpable:	no	(direct)	interaction	with	the	world	or	program	state.
Together, these properties give us an unprecedented ability to reason about our code. For example, input validation is
easier to isolate with totality, caching is possible when functions are deterministic, and interacting with the world is
easier to control, and test, when functions are inculpable. The kinds of things that break these properties are side
effects: directly accessing or changing mutable state (e.g. maintaining a var in a class or using a legacy API that is
impure), communicating with external resources (e.g. files or network lookup), or throwing exceptions.
PF = ODI + NSE	
Pure	Functions	=	Output	Depends	only	on	Input	+ No	Side	Effects)
FP is just programming with functions. Functions are:
1. Total: They return an output for every input.
2. Deterministic: They return the same output for the same input.
3. Pure: Their only effect is computing the output.
The rest is just composition you can learn over time.
john Ⓐ De Goes
1. A	pure	function	depends	only	on	(a)	its	declared	input	parameters	and	(b)	its	algorithm	to	produce	its	result.	
A	pure	function	has	no	“back	doors,”	which	means:
1. Its	result	can’t depend	on reading any	hidden	value	outside	of	the	function	scope,	such	as	another	field	in	the	same	class or	global	variables.
2. It	cannot	modify any hidden	fields	outside	of	the	function	scope,	such	as	other	mutable fields	in	the	same	class or	global	variables.
3. It	cannot	depend on	any	external	I/O.	It	can’t	rely	on	input	from	files,	databases,	web	services,	UIs,	etc;	it	can’t	produce	output,	such	as	
writing to	a	file,	database,	or	web	service,	writing to	a	screen,	etc.
2.	A	pure	function	does	not	modify its	input	parameters.
A pure function is a function that depends only on its declared input parameters and its algorithm to produce its output.
It does not read any other values from “the outside world” — the world outside
of the function’s scope — and it does not modify any values in the outside world
Functional	programming is	a	way	of	writing software	applications	using	only	pure	functions and	immutable	values.
FP means programming with pure functions, and a pure function is one that lacks side effects…
A function f with input type A and output type B (written in Scala as a single type: A => B , pronounced “A to B ” or “A arrow B ”) is a computation that relates every value a of type
A to exactly one value b of type B such that b is determined solely by the value of a. Any changing state of an internal or external process is irrelevant to computing the result f(a).
For example, a function intToString having type Int => String will take every integer to a corresponding string. Furthermore, if it really is a function, it will do nothing else.
In other words, a function has no observable effect on the execution of the program other than to compute a result given its inputs; we say that it has no side effects. We
sometimes qualify such functions as pure functions to make this more explicit, but this is somewhat redundant.
FP in Scala
by	Paul	Chiusano	
and	Runar	Bjarnason
@pchiusano @runarorama
by	Sam	Halliday
@fommil
by	Alvin	Alexander
@alvinalexander
Definitions	of	Functional	Programming
1.2	Pure	Functional	Programming
Functional	Programming	is	the	act	of	writing	programs	with	pure	functions.	Pure	functions	have	three	properties:
•	Total:	return	a	value	for	every	possible	input
•	Deterministic:	return	the	same	value	for	the	same	input
•	Inculpable:	no	(direct)	interaction	with	the	world	or	program	state.
Together, these properties give us an unprecedented ability to reason about our code. For example, input validation is
easier to isolate with totality, caching is possible when functions are deterministic, and interacting with the world is
easier to control, and test, when functions are inculpable. The kinds of things that break these properties are side
effects: directly accessing or changing mutable state (e.g. maintaining a var in a class or using a legacy API that is
impure), communicating with external resources (e.g. files or network lookup), or throwing exceptions.
FP is just programming with functions. Functions are:
1. Total: They return an output for every input.
2. Deterministic: They return the same output for the same input.
3. Pure: Their only effect is computing the output.
The rest is just composition you can learn over time.
TOTALITY
john Ⓐ De Goes
PF = ODI + NSE	
Pure	Functions	=	Output	Depends	only	on	Input	+ No	Side	Effects)
A pure function has no side effects,
meaning that it does not read
anything from the outside world or
write anything to the outside world.
As a result of 1, if a pure function is
called with an input parameter x an
infinite number of times, it will
always return the same result y.
This is unlike an OOP method, which
can depend on other fields in the
same class as the method.
1. A	pure	function	depends	only	on	(a)	its	declared	input	parameters	and	(b)	its	algorithm	to	produce	its	result.	
A	pure	function	has	no	“back	doors,”	which	means:
1. Its	result	can’t depend	on reading any	hidden	value	outside	of	the	function	scope,	such	as	another	field	in	the	same	class or	global	variables.
2. It	cannot	modify any hidden	fields	outside	of	the	function	scope,	such	as	other	mutable fields	in	the	same	class or	global	variables.
3. It	cannot	depend on	any	external	I/O.	It	can’t	rely	on	input	from	files,	databases,	web	services,	UIs,	etc;	it	can’t	produce	output,	such	as	
writing to	a	file,	database,	or	web	service,	writing to	a	screen,	etc.
2.	A	pure	function	does	not	modify its	input	parameters.
A pure function is a function that depends only on its declared input parameters and its algorithm to produce its output.
It does not read any other values from “the outside world” — the world outside
of the function’s scope — and it does not modify any values in the outside world
Functional	programming is	a	way	of	writing software	applications	using	only	pure	functions and	immutable	values.
FP means programming with pure functions, and a pure function is one that lacks side effects…
A function f with input type A and output type B (written in Scala as a single type: A => B , pronounced “A to B ” or “A arrow B ”) is a computation that relates every value a of type
A to exactly one value b of type B such that b is determined solely by the value of a. Any changing state of an internal or external process is irrelevant to computing the result f(a).
For example, a function intToString having type Int => String will take every integer to a corresponding string. Furthermore, if it really is a function, it will do nothing else.
In other words, a function has no observable effect on the execution of the program other than to compute a result given its inputs; we say that it has no side effects. We
sometimes qualify such functions as pure functions to make this more explicit, but this is somewhat redundant.
FP in Scala
by	Paul	Chiusano	
and	Runar	Bjarnason
@pchiusano @runarorama
by	Sam	Halliday
@fommil
by	Alvin	Alexander
@alvinalexander
Definitions	of	Functional	Programming
1.2	Pure	Functional	Programming
Functional	Programming	is	the	act	of	writing	programs	with	pure	functions.	Pure	functions	have	three	properties:
•	Total:	return	a	value	for	every	possible	input
•	Deterministic:	return	the	same	value	for	the	same	input
•	Inculpable:	no	(direct)	interaction	with	the	world	or	program	state.
Together, these properties give us an unprecedented ability to reason about our code. For example, input validation is
easier to isolate with totality, caching is possible when functions are deterministic, and interacting with the world is
easier to control, and test, when functions are inculpable. The kinds of things that break these properties are side
effects: directly accessing or changing mutable state (e.g. maintaining a var in a class or using a legacy API that is
impure), communicating with external resources (e.g. files or network lookup), or throwing exceptions.
FP is just programming with functions. Functions are:
1. Total: They return an output for every input.
2. Deterministic: They return the same output for the same input.
3. Pure: Their only effect is computing the output.
The rest is just composition you can learn over time.
DETERMINISM
john Ⓐ De Goes
PF = ODI + NSE	
Pure	Functions	=	Output	Depends	only	on	Input	+ No	Side	Effects)
A pure function has no side effects,
meaning that it does not read
anything from the outside world or
write anything to the outside world.
As a result of 1, if a pure function is
called with an input parameter x an
infinite number of times, it will
always return the same result y.
This is unlike an OOP method, which
can depend on other fields in the
same class as the method.
1. A	pure	function	depends	only	on	(a)	its	declared	input	parameters	and	(b)	its	algorithm	to	produce	its	result.	
A	pure	function	has	no	“back	doors,”	which	means:
1. Its	result	can’t depend	on reading any	hidden	value	outside	of	the	function	scope,	such	as	another	field	in	the	same	class or	global	variables.
2. It	cannot	modify any hidden	fields	outside	of	the	function	scope,	such	as	other	mutable fields	in	the	same	class or	global	variables.
3. It	cannot	depend on	any	external	I/O.	It	can’t	rely	on	input	from	files,	databases,	web	services,	UIs,	etc;	it	can’t	produce	output,	such	as	
writing to	a	file,	database,	or	web	service,	writing to	a	screen,	etc.
2.	A	pure	function	does	not	modify its	input	parameters.
A pure function is a function that depends only on its declared input parameters and its algorithm to produce its output.
It does not read any other values from “the outside world” — the world outside
of the function’s scope — and it does not modify any values in the outside world
Functional	programming is	a	way	of	writing software	applications	using	only	pure	functions and	immutable	values.
FP means programming with pure functions, and a pure function is one that lacks side effects…
A function f with input type A and output type B (written in Scala as a single type: A => B , pronounced “A to B ” or “A arrow B ”) is a computation that relates every value a of type
A to exactly one value b of type B such that b is determined solely by the value of a. Any changing state of an internal or external process is irrelevant to computing the result f(a).
For example, a function intToString having type Int => String will take every integer to a corresponding string. Furthermore, if it really is a function, it will do nothing else.
In other words, a function has no observable effect on the execution of the program other than to compute a result given its inputs; we say that it has no side effects. We sometimes
qualify such functions as pure functions to make this more explicit, but this is somewhat redundant.
FP in Scala
by	Paul	Chiusano	
and	Runar	Bjarnason
@pchiusano @runarorama
by	Sam	Halliday
@fommil
by	Alvin	Alexander
@alvinalexander
Definitions	of	Functional	Programming
1.2	Pure	Functional	Programming
Functional	Programming	is	the	act	of	writing	programs	with	pure	functions.	Pure	functions	have	three	properties:
•	Total:	return	a	value	for	every	possible	input
•	Deterministic:	return	the	same	value	for	the	same	input
•	Inculpable:	no	(direct)	interaction	with	the	world	or	program	state.
Together, these properties give us an unprecedented ability to reason about our code. For example, input validation is
easier to isolate with totality, caching is possible when functions are deterministic, and interacting with the world is
easier to control, and test, when functions are inculpable. The kinds of things that break these properties are side
effects: directly accessing or changing mutable state (e.g. maintaining a var in a class or using a legacy API that is
impure), communicating with external resources (e.g. files or network lookup), or throwing exceptions.
FP is just programming with functions. Functions are:
1. Total: They return an output for every input.
2. Deterministic: They return the same output for the same input.
3. Pure: Their only effect is computing the output.
The rest is just composition you can learn over time.
NO	SIDE	EFFECTS
john Ⓐ De Goes
PF = ODI + NSE	
Pure	Functions	=	Output	Depends	only	on	Input	+ No	Side	Effects)
A pure function has no side effects,
meaning that it does not read
anything from the outside world or
write anything to the outside world.
As a result of 1, if a pure function is
called with an input parameter x an
infinite number of times, it will
always return the same result y.
This is unlike an OOP method, which
can depend on other fields in the
same class as the method.
1. A	pure	function	depends	only	on	(a)	its	declared	input	parameters	and	(b)	its	algorithm	to	produce	its	result.	
A	pure	function	has	no	“back	doors,”	which	means:
1. Its	result	can’t depend	on reading any	hidden	value	outside	of	the	function	scope,	such	as	another	field	in	the	same	class or	global	variables.
2. It	cannot	modify any hidden	fields	outside	of	the	function	scope,	such	as	other	mutable fields	in	the	same	class or	global	variables.
3. It	cannot	depend on	any	external	I/O.	It	can’t	rely	on	input	from	files,	databases,	web	services,	UIs,	etc;	it	can’t	produce	output,	such	as	
writing to	a	file,	database,	or	web	service,	writing to	a	screen,	etc.
2.	A	pure	function	does	not	modify its	input	parameters.
A pure function is a function that depends only on its declared input parameters and its algorithm to produce its output.
It does not read any other values from “the outside world” — the world outside
of the function’s scope — and it does not modify any values in the outside world
Functional	programming is	a	way	of	writing software	applications	using	only	pure	functions and	immutable	values.
FP means programming with pure functions, and a pure function is one that lacks side effects…
A function f with input type A and output type B (written in Scala as a single type: A => B , pronounced “A to B ” or “A arrow B ”) is a computation that relates every value a of type
A to exactly one value b of type B such that b is determined solely by the value of a. Any changing state of an internal or external process is irrelevant to computing the result f(a).
For example, a function intToString having type Int => String will take every integer to a corresponding string. Furthermore, if it really is a function, it will do nothing else.
In other words, a function has no observable effect on the execution of the program other than to compute a result given its inputs; we say that it has no side effects. We
sometimes qualify such functions as pure functions to make this more explicit, but this is somewhat redundant.
FP in Scala
by	Paul	Chiusano	
and	Runar	Bjarnason
@pchiusano @runarorama
by	Sam	Halliday
@fommil
by	Alvin	Alexander
@alvinalexander
Definitions	of	Functional	Programming
1.2	Pure	Functional	Programming
Functional	Programming	is	the	act	of	writing	programs	with	pure	functions.	Pure	functions	have	three	properties:
•	Total:	return	a	value	for	every	possible	input
•	Deterministic:	return	the	same	value	for	the	same	input
•	Inculpable:	no	(direct)	interaction	with	the	world	or	program	state.
Together, these properties give us an unprecedented ability to reason about our code. For example, input validation is
easier to isolate with totality, caching is possible when functions are deterministic, and interacting with the world is
easier to control, and test, when functions are inculpable. The kinds of things that break these properties are side
effects: directly accessing or changing mutable state (e.g. maintaining a var in a class or using a legacy API that is
impure), communicating with external resources (e.g. files or network lookup), or throwing exceptions.
FP is just programming with functions. Functions are:
1. Total: They return an output for every input.
2. Deterministic: They return the same output for the same input.
3. Pure: Their only effect is computing the output.
The rest is just composition you can learn over time.
PURITY
john Ⓐ De Goes
A pure function has no side effects,
meaning that it does not read
anything from the outside world or
write anything to the outside world.
As a result of 1, if a pure function is
called with an input parameter x an
infinite number of times, it will
always return the same result y.
This is unlike an OOP method, which
can depend on other fields in the
same class as the method.
PF = ODI + NSE	
Pure	Functions	=	Output	Depends	only	on	Input	+ No	Side	Effects)
We can formalize this idea of pure functions using the concept of referential transparency (RT). This is a property of
expressions in general and not just functions. For the purposes of our discussion, consider an expression to be any part of a
program that can be evaluated to a result—anything that you could type into the Scala interpreter and get an answer. For
example, 2 + 3 is an expression that applies the pure function + to the values 2 and 3 (which are also expressions). This has no
side effect. The evaluation of this expression results in the same value 5 every time. In fact, if we saw 2 + 3 in a program we
could simply replace it with the value 5 and it wouldn’t change a thing about the meaning of our program.
This is all it means for an expression to be referentially transparent—in any program, the expression can be replaced by its
result without changing the meaning of the program. And we say that a function is pure if calling it with RT arguments is
also RT.
Referential	transparency	and	purity
An expression E is	referentially	transparent if,	for	all	programs P,	all	occurrences	of E in P can	be	replaced	by	the	result	of	
evaluating E without	affecting	the	meaning	of P.
A	function f	is pure if	the	expression	f(x)	is	referentially	transparent for	all	referentially	transparent	x.3
3 There are some subtleties to this definition, and we’ll refine it later in this book. See the chapter notes at our
GitHub site (https://github.com/pchiusano/fpinscala; see the preface) for more discussion.
Referential	Transparency	and	Purity
Functional Programming in Scala
(by	Paul	Chiusano	and	Runar	Bjarnason)
@pchiusano @runarorama

More Related Content

What's hot

Natural Transformations
Natural TransformationsNatural Transformations
Natural Transformations
Philip Schwarz
 
Compositionality and Category Theory - a montage of slides/transcript for sec...
Compositionality and Category Theory - a montage of slides/transcript for sec...Compositionality and Category Theory - a montage of slides/transcript for sec...
Compositionality and Category Theory - a montage of slides/transcript for sec...
Philip Schwarz
 
Monad as functor with pair of natural transformations
Monad as functor with pair of natural transformationsMonad as functor with pair of natural transformations
Monad as functor with pair of natural transformations
Philip Schwarz
 
Monad Fact #6
Monad Fact #6Monad Fact #6
Monad Fact #6
Philip Schwarz
 
Introduction to Python
Introduction to Python  Introduction to Python
Introduction to Python
Mohammed Sikander
 
Unison Language - Contact
Unison Language - ContactUnison Language - Contact
Unison Language - Contact
Philip Schwarz
 
The Expression Problem - Part 2
The Expression Problem - Part 2The Expression Problem - Part 2
The Expression Problem - Part 2
Philip Schwarz
 
Game of Life - Polyglot FP - Haskell - Scala - Unison - Part 3
Game of Life - Polyglot FP - Haskell - Scala - Unison - Part 3Game of Life - Polyglot FP - Haskell - Scala - Unison - Part 3
Game of Life - Polyglot FP - Haskell - Scala - Unison - Part 3
Philip Schwarz
 
Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 2
Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 2Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 2
Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 2
Philip Schwarz
 
Kleisli Composition
Kleisli CompositionKleisli Composition
Kleisli Composition
Philip Schwarz
 
‘go-to’ general-purpose sequential collections - from Java To Scala
‘go-to’ general-purpose sequential collections -from Java To Scala‘go-to’ general-purpose sequential collections -from Java To Scala
‘go-to’ general-purpose sequential collections - from Java To Scala
Philip Schwarz
 
Control structures functions and modules in python programming
Control structures functions and modules in python programmingControl structures functions and modules in python programming
Control structures functions and modules in python programming
Srinivas Narasegouda
 
Refactoring: A First Example - Martin Fowler’s First Example of Refactoring, ...
Refactoring: A First Example - Martin Fowler’s First Example of Refactoring, ...Refactoring: A First Example - Martin Fowler’s First Example of Refactoring, ...
Refactoring: A First Example - Martin Fowler’s First Example of Refactoring, ...
Philip Schwarz
 
Function Applicative for Great Good of Palindrome Checker Function - Polyglot...
Function Applicative for Great Good of Palindrome Checker Function - Polyglot...Function Applicative for Great Good of Palindrome Checker Function - Polyglot...
Function Applicative for Great Good of Palindrome Checker Function - Polyglot...
Philip Schwarz
 
Point free or die - tacit programming in Haskell and beyond
Point free or die - tacit programming in Haskell and beyondPoint free or die - tacit programming in Haskell and beyond
Point free or die - tacit programming in Haskell and beyond
Philip Schwarz
 
Game of Life - Polyglot FP - Haskell, Scala, Unison - Part 2 - with minor cor...
Game of Life - Polyglot FP - Haskell, Scala, Unison - Part 2 - with minor cor...Game of Life - Polyglot FP - Haskell, Scala, Unison - Part 2 - with minor cor...
Game of Life - Polyglot FP - Haskell, Scala, Unison - Part 2 - with minor cor...
Philip Schwarz
 
Lesson 02 python keywords and identifiers
Lesson 02   python keywords and identifiersLesson 02   python keywords and identifiers
Lesson 02 python keywords and identifiers
Nilimesh Halder
 
Implicit conversion and parameters
Implicit conversion and parametersImplicit conversion and parameters
Implicit conversion and parameters
Knoldus Inc.
 
Intro to functional programming
Intro to functional programmingIntro to functional programming
Intro to functional programming
Assaf Gannon
 
Function Composition - forward composition versus backward composition
Function Composition - forward composition versus backward compositionFunction Composition - forward composition versus backward composition
Function Composition - forward composition versus backward composition
Philip Schwarz
 

What's hot (20)

Natural Transformations
Natural TransformationsNatural Transformations
Natural Transformations
 
Compositionality and Category Theory - a montage of slides/transcript for sec...
Compositionality and Category Theory - a montage of slides/transcript for sec...Compositionality and Category Theory - a montage of slides/transcript for sec...
Compositionality and Category Theory - a montage of slides/transcript for sec...
 
Monad as functor with pair of natural transformations
Monad as functor with pair of natural transformationsMonad as functor with pair of natural transformations
Monad as functor with pair of natural transformations
 
Monad Fact #6
Monad Fact #6Monad Fact #6
Monad Fact #6
 
Introduction to Python
Introduction to Python  Introduction to Python
Introduction to Python
 
Unison Language - Contact
Unison Language - ContactUnison Language - Contact
Unison Language - Contact
 
The Expression Problem - Part 2
The Expression Problem - Part 2The Expression Problem - Part 2
The Expression Problem - Part 2
 
Game of Life - Polyglot FP - Haskell - Scala - Unison - Part 3
Game of Life - Polyglot FP - Haskell - Scala - Unison - Part 3Game of Life - Polyglot FP - Haskell - Scala - Unison - Part 3
Game of Life - Polyglot FP - Haskell - Scala - Unison - Part 3
 
Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 2
Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 2Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 2
Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 2
 
Kleisli Composition
Kleisli CompositionKleisli Composition
Kleisli Composition
 
‘go-to’ general-purpose sequential collections - from Java To Scala
‘go-to’ general-purpose sequential collections -from Java To Scala‘go-to’ general-purpose sequential collections -from Java To Scala
‘go-to’ general-purpose sequential collections - from Java To Scala
 
Control structures functions and modules in python programming
Control structures functions and modules in python programmingControl structures functions and modules in python programming
Control structures functions and modules in python programming
 
Refactoring: A First Example - Martin Fowler’s First Example of Refactoring, ...
Refactoring: A First Example - Martin Fowler’s First Example of Refactoring, ...Refactoring: A First Example - Martin Fowler’s First Example of Refactoring, ...
Refactoring: A First Example - Martin Fowler’s First Example of Refactoring, ...
 
Function Applicative for Great Good of Palindrome Checker Function - Polyglot...
Function Applicative for Great Good of Palindrome Checker Function - Polyglot...Function Applicative for Great Good of Palindrome Checker Function - Polyglot...
Function Applicative for Great Good of Palindrome Checker Function - Polyglot...
 
Point free or die - tacit programming in Haskell and beyond
Point free or die - tacit programming in Haskell and beyondPoint free or die - tacit programming in Haskell and beyond
Point free or die - tacit programming in Haskell and beyond
 
Game of Life - Polyglot FP - Haskell, Scala, Unison - Part 2 - with minor cor...
Game of Life - Polyglot FP - Haskell, Scala, Unison - Part 2 - with minor cor...Game of Life - Polyglot FP - Haskell, Scala, Unison - Part 2 - with minor cor...
Game of Life - Polyglot FP - Haskell, Scala, Unison - Part 2 - with minor cor...
 
Lesson 02 python keywords and identifiers
Lesson 02   python keywords and identifiersLesson 02   python keywords and identifiers
Lesson 02 python keywords and identifiers
 
Implicit conversion and parameters
Implicit conversion and parametersImplicit conversion and parameters
Implicit conversion and parameters
 
Intro to functional programming
Intro to functional programmingIntro to functional programming
Intro to functional programming
 
Function Composition - forward composition versus backward composition
Function Composition - forward composition versus backward compositionFunction Composition - forward composition versus backward composition
Function Composition - forward composition versus backward composition
 

Similar to Definitions of Functional Programming

Pure functions and usage in Angular
Pure functions and usage in AngularPure functions and usage in Angular
Pure functions and usage in Angular
MA Jiangfan
 
Functional Go
Functional GoFunctional Go
Functional Go
Geison Goes
 
Functions in Python.pdfnsjiwshkwijjahuwjwjw
Functions in Python.pdfnsjiwshkwijjahuwjwjwFunctions in Python.pdfnsjiwshkwijjahuwjwjw
Functions in Python.pdfnsjiwshkwijjahuwjwjw
MayankSinghRawat6
 
Functional Swift
Functional SwiftFunctional Swift
Functional Swift
Geison Goes
 
User Defined Functions
User Defined FunctionsUser Defined Functions
User Defined Functions
Praveen M Jigajinni
 
C functions list
C functions listC functions list
Functions in c++
Functions in c++Functions in c++
Functions in c++
Asaye Dilbo
 
Introduction to C Language - Version 1.0 by Mark John Lado
Introduction to C Language - Version 1.0 by Mark John LadoIntroduction to C Language - Version 1.0 by Mark John Lado
Introduction to C Language - Version 1.0 by Mark John Lado
Mark John Lado, MIT
 
Functions-Computer programming
Functions-Computer programmingFunctions-Computer programming
Functions-Computer programming
nmahi96
 
C interview questions
C interview  questionsC interview  questions
C interview questions
Kuntal Bhowmick
 
Python functional programming
Python functional programmingPython functional programming
Python functional programming
Geison Goes
 
Why functional programming in C# & F#
Why functional programming in C# & F#Why functional programming in C# & F#
Why functional programming in C# & F#
Riccardo Terrell
 
Presentation1.pptx
Presentation1.pptxPresentation1.pptx
Presentation1.pptx
AFANJIPHILL
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
AMAN ANAND
 
Vendredi Tech_ la programmation fonctionnelle.pptx
Vendredi Tech_ la programmation fonctionnelle.pptxVendredi Tech_ la programmation fonctionnelle.pptx
Vendredi Tech_ la programmation fonctionnelle.pptx
Guillaume Saint Etienne
 
Functional programming in TypeScript
Functional programming in TypeScriptFunctional programming in TypeScript
Functional programming in TypeScript
binDebug WorkSpace
 
Functional programming
Functional programmingFunctional programming
Functional programming
Kibru Demeke
 
Functions assignment
Functions assignmentFunctions assignment
Functions assignment
Ahmad Kamal
 
Lecture 11 - Functions
Lecture 11 - FunctionsLecture 11 - Functions
Lecture 11 - Functions
Md. Imran Hossain Showrov
 
Function overloading
Function overloadingFunction overloading
Function overloading
Prof. Dr. K. Adisesha
 

Similar to Definitions of Functional Programming (20)

Pure functions and usage in Angular
Pure functions and usage in AngularPure functions and usage in Angular
Pure functions and usage in Angular
 
Functional Go
Functional GoFunctional Go
Functional Go
 
Functions in Python.pdfnsjiwshkwijjahuwjwjw
Functions in Python.pdfnsjiwshkwijjahuwjwjwFunctions in Python.pdfnsjiwshkwijjahuwjwjw
Functions in Python.pdfnsjiwshkwijjahuwjwjw
 
Functional Swift
Functional SwiftFunctional Swift
Functional Swift
 
User Defined Functions
User Defined FunctionsUser Defined Functions
User Defined Functions
 
C functions list
C functions listC functions list
C functions list
 
Functions in c++
Functions in c++Functions in c++
Functions in c++
 
Introduction to C Language - Version 1.0 by Mark John Lado
Introduction to C Language - Version 1.0 by Mark John LadoIntroduction to C Language - Version 1.0 by Mark John Lado
Introduction to C Language - Version 1.0 by Mark John Lado
 
Functions-Computer programming
Functions-Computer programmingFunctions-Computer programming
Functions-Computer programming
 
C interview questions
C interview  questionsC interview  questions
C interview questions
 
Python functional programming
Python functional programmingPython functional programming
Python functional programming
 
Why functional programming in C# & F#
Why functional programming in C# & F#Why functional programming in C# & F#
Why functional programming in C# & F#
 
Presentation1.pptx
Presentation1.pptxPresentation1.pptx
Presentation1.pptx
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
 
Vendredi Tech_ la programmation fonctionnelle.pptx
Vendredi Tech_ la programmation fonctionnelle.pptxVendredi Tech_ la programmation fonctionnelle.pptx
Vendredi Tech_ la programmation fonctionnelle.pptx
 
Functional programming in TypeScript
Functional programming in TypeScriptFunctional programming in TypeScript
Functional programming in TypeScript
 
Functional programming
Functional programmingFunctional programming
Functional programming
 
Functions assignment
Functions assignmentFunctions assignment
Functions assignment
 
Lecture 11 - Functions
Lecture 11 - FunctionsLecture 11 - Functions
Lecture 11 - Functions
 
Function overloading
Function overloadingFunction overloading
Function overloading
 

More from Philip Schwarz

Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
Philip Schwarz
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Philip Schwarz
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
Philip Schwarz
 
Folding Cheat Sheet #3 - third in a series
Folding Cheat Sheet #3 - third in a seriesFolding Cheat Sheet #3 - third in a series
Folding Cheat Sheet #3 - third in a series
Philip Schwarz
 
Folding Cheat Sheet #2 - second in a series
Folding Cheat Sheet #2 - second in a seriesFolding Cheat Sheet #2 - second in a series
Folding Cheat Sheet #2 - second in a series
Philip Schwarz
 
Folding Cheat Sheet #1 - first in a series
Folding Cheat Sheet #1 - first in a seriesFolding Cheat Sheet #1 - first in a series
Folding Cheat Sheet #1 - first in a series
Philip Schwarz
 
Scala Left Fold Parallelisation - Three Approaches
Scala Left Fold Parallelisation- Three ApproachesScala Left Fold Parallelisation- Three Approaches
Scala Left Fold Parallelisation - Three Approaches
Philip Schwarz
 
Tagless Final Encoding - Algebras and Interpreters and also Programs
Tagless Final Encoding - Algebras and Interpreters and also ProgramsTagless Final Encoding - Algebras and Interpreters and also Programs
Tagless Final Encoding - Algebras and Interpreters and also Programs
Philip Schwarz
 
Fusing Transformations of Strict Scala Collections with Views
Fusing Transformations of Strict Scala Collections with ViewsFusing Transformations of Strict Scala Collections with Views
Fusing Transformations of Strict Scala Collections with Views
Philip Schwarz
 
A sighting of traverse_ function in Practical FP in Scala
A sighting of traverse_ function in Practical FP in ScalaA sighting of traverse_ function in Practical FP in Scala
A sighting of traverse_ function in Practical FP in Scala
Philip Schwarz
 
A sighting of traverseFilter and foldMap in Practical FP in Scala
A sighting of traverseFilter and foldMap in Practical FP in ScalaA sighting of traverseFilter and foldMap in Practical FP in Scala
A sighting of traverseFilter and foldMap in Practical FP in Scala
Philip Schwarz
 
A sighting of sequence function in Practical FP in Scala
A sighting of sequence function in Practical FP in ScalaA sighting of sequence function in Practical FP in Scala
A sighting of sequence function in Practical FP in Scala
Philip Schwarz
 
N-Queens Combinatorial Puzzle meets Cats
N-Queens Combinatorial Puzzle meets CatsN-Queens Combinatorial Puzzle meets Cats
N-Queens Combinatorial Puzzle meets Cats
Philip Schwarz
 
Kleisli composition, flatMap, join, map, unit - implementation and interrelat...
Kleisli composition, flatMap, join, map, unit - implementation and interrelat...Kleisli composition, flatMap, join, map, unit - implementation and interrelat...
Kleisli composition, flatMap, join, map, unit - implementation and interrelat...
Philip Schwarz
 
The aggregate function - from sequential and parallel folds to parallel aggre...
The aggregate function - from sequential and parallel folds to parallel aggre...The aggregate function - from sequential and parallel folds to parallel aggre...
The aggregate function - from sequential and parallel folds to parallel aggre...
Philip Schwarz
 
Nat, List and Option Monoids - from scratch - Combining and Folding - an example
Nat, List and Option Monoids -from scratch -Combining and Folding -an exampleNat, List and Option Monoids -from scratch -Combining and Folding -an example
Nat, List and Option Monoids - from scratch - Combining and Folding - an example
Philip Schwarz
 
Nat, List and Option Monoids - from scratch - Combining and Folding - an example
Nat, List and Option Monoids -from scratch -Combining and Folding -an exampleNat, List and Option Monoids -from scratch -Combining and Folding -an example
Nat, List and Option Monoids - from scratch - Combining and Folding - an example
Philip Schwarz
 
The Sieve of Eratosthenes - Part II - Genuine versus Unfaithful Sieve - Haske...
The Sieve of Eratosthenes - Part II - Genuine versus Unfaithful Sieve - Haske...The Sieve of Eratosthenes - Part II - Genuine versus Unfaithful Sieve - Haske...
The Sieve of Eratosthenes - Part II - Genuine versus Unfaithful Sieve - Haske...
Philip Schwarz
 
Sum and Product Types - The Fruit Salad & Fruit Snack Example - From F# to Ha...
Sum and Product Types -The Fruit Salad & Fruit Snack Example - From F# to Ha...Sum and Product Types -The Fruit Salad & Fruit Snack Example - From F# to Ha...
Sum and Product Types - The Fruit Salad & Fruit Snack Example - From F# to Ha...
Philip Schwarz
 

More from Philip Schwarz (20)

Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Folding Cheat Sheet #3 - third in a series
Folding Cheat Sheet #3 - third in a seriesFolding Cheat Sheet #3 - third in a series
Folding Cheat Sheet #3 - third in a series
 
Folding Cheat Sheet #2 - second in a series
Folding Cheat Sheet #2 - second in a seriesFolding Cheat Sheet #2 - second in a series
Folding Cheat Sheet #2 - second in a series
 
Folding Cheat Sheet #1 - first in a series
Folding Cheat Sheet #1 - first in a seriesFolding Cheat Sheet #1 - first in a series
Folding Cheat Sheet #1 - first in a series
 
Scala Left Fold Parallelisation - Three Approaches
Scala Left Fold Parallelisation- Three ApproachesScala Left Fold Parallelisation- Three Approaches
Scala Left Fold Parallelisation - Three Approaches
 
Tagless Final Encoding - Algebras and Interpreters and also Programs
Tagless Final Encoding - Algebras and Interpreters and also ProgramsTagless Final Encoding - Algebras and Interpreters and also Programs
Tagless Final Encoding - Algebras and Interpreters and also Programs
 
Fusing Transformations of Strict Scala Collections with Views
Fusing Transformations of Strict Scala Collections with ViewsFusing Transformations of Strict Scala Collections with Views
Fusing Transformations of Strict Scala Collections with Views
 
A sighting of traverse_ function in Practical FP in Scala
A sighting of traverse_ function in Practical FP in ScalaA sighting of traverse_ function in Practical FP in Scala
A sighting of traverse_ function in Practical FP in Scala
 
A sighting of traverseFilter and foldMap in Practical FP in Scala
A sighting of traverseFilter and foldMap in Practical FP in ScalaA sighting of traverseFilter and foldMap in Practical FP in Scala
A sighting of traverseFilter and foldMap in Practical FP in Scala
 
A sighting of sequence function in Practical FP in Scala
A sighting of sequence function in Practical FP in ScalaA sighting of sequence function in Practical FP in Scala
A sighting of sequence function in Practical FP in Scala
 
N-Queens Combinatorial Puzzle meets Cats
N-Queens Combinatorial Puzzle meets CatsN-Queens Combinatorial Puzzle meets Cats
N-Queens Combinatorial Puzzle meets Cats
 
Kleisli composition, flatMap, join, map, unit - implementation and interrelat...
Kleisli composition, flatMap, join, map, unit - implementation and interrelat...Kleisli composition, flatMap, join, map, unit - implementation and interrelat...
Kleisli composition, flatMap, join, map, unit - implementation and interrelat...
 
The aggregate function - from sequential and parallel folds to parallel aggre...
The aggregate function - from sequential and parallel folds to parallel aggre...The aggregate function - from sequential and parallel folds to parallel aggre...
The aggregate function - from sequential and parallel folds to parallel aggre...
 
Nat, List and Option Monoids - from scratch - Combining and Folding - an example
Nat, List and Option Monoids -from scratch -Combining and Folding -an exampleNat, List and Option Monoids -from scratch -Combining and Folding -an example
Nat, List and Option Monoids - from scratch - Combining and Folding - an example
 
Nat, List and Option Monoids - from scratch - Combining and Folding - an example
Nat, List and Option Monoids -from scratch -Combining and Folding -an exampleNat, List and Option Monoids -from scratch -Combining and Folding -an example
Nat, List and Option Monoids - from scratch - Combining and Folding - an example
 
The Sieve of Eratosthenes - Part II - Genuine versus Unfaithful Sieve - Haske...
The Sieve of Eratosthenes - Part II - Genuine versus Unfaithful Sieve - Haske...The Sieve of Eratosthenes - Part II - Genuine versus Unfaithful Sieve - Haske...
The Sieve of Eratosthenes - Part II - Genuine versus Unfaithful Sieve - Haske...
 
Sum and Product Types - The Fruit Salad & Fruit Snack Example - From F# to Ha...
Sum and Product Types -The Fruit Salad & Fruit Snack Example - From F# to Ha...Sum and Product Types -The Fruit Salad & Fruit Snack Example - From F# to Ha...
Sum and Product Types - The Fruit Salad & Fruit Snack Example - From F# to Ha...
 

Recently uploaded

Game Development with Unity3D (Game Development lecture 3)
Game Development  with Unity3D (Game Development lecture 3)Game Development  with Unity3D (Game Development lecture 3)
Game Development with Unity3D (Game Development lecture 3)
abdulrafaychaudhry
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
abdulrafaychaudhry
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)
abdulrafaychaudhry
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 

Recently uploaded (20)

Game Development with Unity3D (Game Development lecture 3)
Game Development  with Unity3D (Game Development lecture 3)Game Development  with Unity3D (Game Development lecture 3)
Game Development with Unity3D (Game Development lecture 3)
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 

Definitions of Functional Programming

  • 2. 1. A pure function depends only on (a) its declared input parameters and (b) its algorithm to produce its result. A pure function has no “back doors,” which means: 1. Its result can’t depend on reading any hidden value outside of the function scope, such as another field in the same class or global variables. 2. It cannot modify any hidden fields outside of the function scope, such as other mutable fields in the same class or global variables. 3. It cannot depend on any external I/O. It can’t rely on input from files, databases, web services, UIs, etc; it can’t produce output, such as writing to a file, database, or web service, writing to a screen, etc. 2. A pure function does not modify its input parameters. A pure function has no side effects, meaning that it does not read anything from the outside world or write anything to the outside world. As a result of 1, if a pure function is called with an input parameter x an infinite number of times, it will always return the same result y. This is unlike an OOP method, which can depend on other fields in the same class as the method. A pure function is a function that depends only on its declared input parameters and its algorithm to produce its output. It does not read any other values from “the outside world” — the world outside of the function’s scope — and it does not modify any values in the outside world Functional programming is a way of writing software applications using only pure functions and immutable values. FP means programming with pure functions, and a pure function is one that lacks side effects… A function f with input type A and output type B (written in Scala as a single type: A => B , pronounced “A to B ” or “A arrow B ”) is a computation that relates every value a of type A to exactly one value b of type B such that b is determined solely by the value of a. Any changing state of an internal or external process is irrelevant to computing the result f(a). For example, a function intToString having type Int => String will take every integer to a corresponding string. Furthermore, if it really is a function, it will do nothing else. In other words, a function has no observable effect on the execution of the program other than to compute a result given its inputs; we say that it has no side effects. We sometimes qualify such functions as pure functions to make this more explicit, but this is somewhat redundant. FP in Scala by Paul Chiusano and Runar Bjarnason @pchiusano @runarorama by Sam Halliday @fommil by Alvin Alexander @alvinalexander Definitions of Functional Programming 1.2 Pure Functional Programming Functional Programming is the act of writing programs with pure functions. Pure functions have three properties: • Total: return a value for every possible input • Deterministic: return the same value for the same input • Inculpable: no (direct) interaction with the world or program state. Together, these properties give us an unprecedented ability to reason about our code. For example, input validation is easier to isolate with totality, caching is possible when functions are deterministic, and interacting with the world is easier to control, and test, when functions are inculpable. The kinds of things that break these properties are side effects: directly accessing or changing mutable state (e.g. maintaining a var in a class or using a legacy API that is impure), communicating with external resources (e.g. files or network lookup), or throwing exceptions. PF = ODI + NSE Pure Functions = Output Depends only on Input + No Side Effects) FP is just programming with functions. Functions are: 1. Total: They return an output for every input. 2. Deterministic: They return the same output for the same input. 3. Pure: Their only effect is computing the output. The rest is just composition you can learn over time. john Ⓐ De Goes
  • 3. 1. A pure function depends only on (a) its declared input parameters and (b) its algorithm to produce its result. A pure function has no “back doors,” which means: 1. Its result can’t depend on reading any hidden value outside of the function scope, such as another field in the same class or global variables. 2. It cannot modify any hidden fields outside of the function scope, such as other mutable fields in the same class or global variables. 3. It cannot depend on any external I/O. It can’t rely on input from files, databases, web services, UIs, etc; it can’t produce output, such as writing to a file, database, or web service, writing to a screen, etc. 2. A pure function does not modify its input parameters. A pure function is a function that depends only on its declared input parameters and its algorithm to produce its output. It does not read any other values from “the outside world” — the world outside of the function’s scope — and it does not modify any values in the outside world Functional programming is a way of writing software applications using only pure functions and immutable values. FP means programming with pure functions, and a pure function is one that lacks side effects… A function f with input type A and output type B (written in Scala as a single type: A => B , pronounced “A to B ” or “A arrow B ”) is a computation that relates every value a of type A to exactly one value b of type B such that b is determined solely by the value of a. Any changing state of an internal or external process is irrelevant to computing the result f(a). For example, a function intToString having type Int => String will take every integer to a corresponding string. Furthermore, if it really is a function, it will do nothing else. In other words, a function has no observable effect on the execution of the program other than to compute a result given its inputs; we say that it has no side effects. We sometimes qualify such functions as pure functions to make this more explicit, but this is somewhat redundant. FP in Scala by Paul Chiusano and Runar Bjarnason @pchiusano @runarorama by Sam Halliday @fommil by Alvin Alexander @alvinalexander Definitions of Functional Programming 1.2 Pure Functional Programming Functional Programming is the act of writing programs with pure functions. Pure functions have three properties: • Total: return a value for every possible input • Deterministic: return the same value for the same input • Inculpable: no (direct) interaction with the world or program state. Together, these properties give us an unprecedented ability to reason about our code. For example, input validation is easier to isolate with totality, caching is possible when functions are deterministic, and interacting with the world is easier to control, and test, when functions are inculpable. The kinds of things that break these properties are side effects: directly accessing or changing mutable state (e.g. maintaining a var in a class or using a legacy API that is impure), communicating with external resources (e.g. files or network lookup), or throwing exceptions. FP is just programming with functions. Functions are: 1. Total: They return an output for every input. 2. Deterministic: They return the same output for the same input. 3. Pure: Their only effect is computing the output. The rest is just composition you can learn over time. TOTALITY john Ⓐ De Goes PF = ODI + NSE Pure Functions = Output Depends only on Input + No Side Effects) A pure function has no side effects, meaning that it does not read anything from the outside world or write anything to the outside world. As a result of 1, if a pure function is called with an input parameter x an infinite number of times, it will always return the same result y. This is unlike an OOP method, which can depend on other fields in the same class as the method.
  • 4. 1. A pure function depends only on (a) its declared input parameters and (b) its algorithm to produce its result. A pure function has no “back doors,” which means: 1. Its result can’t depend on reading any hidden value outside of the function scope, such as another field in the same class or global variables. 2. It cannot modify any hidden fields outside of the function scope, such as other mutable fields in the same class or global variables. 3. It cannot depend on any external I/O. It can’t rely on input from files, databases, web services, UIs, etc; it can’t produce output, such as writing to a file, database, or web service, writing to a screen, etc. 2. A pure function does not modify its input parameters. A pure function is a function that depends only on its declared input parameters and its algorithm to produce its output. It does not read any other values from “the outside world” — the world outside of the function’s scope — and it does not modify any values in the outside world Functional programming is a way of writing software applications using only pure functions and immutable values. FP means programming with pure functions, and a pure function is one that lacks side effects… A function f with input type A and output type B (written in Scala as a single type: A => B , pronounced “A to B ” or “A arrow B ”) is a computation that relates every value a of type A to exactly one value b of type B such that b is determined solely by the value of a. Any changing state of an internal or external process is irrelevant to computing the result f(a). For example, a function intToString having type Int => String will take every integer to a corresponding string. Furthermore, if it really is a function, it will do nothing else. In other words, a function has no observable effect on the execution of the program other than to compute a result given its inputs; we say that it has no side effects. We sometimes qualify such functions as pure functions to make this more explicit, but this is somewhat redundant. FP in Scala by Paul Chiusano and Runar Bjarnason @pchiusano @runarorama by Sam Halliday @fommil by Alvin Alexander @alvinalexander Definitions of Functional Programming 1.2 Pure Functional Programming Functional Programming is the act of writing programs with pure functions. Pure functions have three properties: • Total: return a value for every possible input • Deterministic: return the same value for the same input • Inculpable: no (direct) interaction with the world or program state. Together, these properties give us an unprecedented ability to reason about our code. For example, input validation is easier to isolate with totality, caching is possible when functions are deterministic, and interacting with the world is easier to control, and test, when functions are inculpable. The kinds of things that break these properties are side effects: directly accessing or changing mutable state (e.g. maintaining a var in a class or using a legacy API that is impure), communicating with external resources (e.g. files or network lookup), or throwing exceptions. FP is just programming with functions. Functions are: 1. Total: They return an output for every input. 2. Deterministic: They return the same output for the same input. 3. Pure: Their only effect is computing the output. The rest is just composition you can learn over time. DETERMINISM john Ⓐ De Goes PF = ODI + NSE Pure Functions = Output Depends only on Input + No Side Effects) A pure function has no side effects, meaning that it does not read anything from the outside world or write anything to the outside world. As a result of 1, if a pure function is called with an input parameter x an infinite number of times, it will always return the same result y. This is unlike an OOP method, which can depend on other fields in the same class as the method.
  • 5. 1. A pure function depends only on (a) its declared input parameters and (b) its algorithm to produce its result. A pure function has no “back doors,” which means: 1. Its result can’t depend on reading any hidden value outside of the function scope, such as another field in the same class or global variables. 2. It cannot modify any hidden fields outside of the function scope, such as other mutable fields in the same class or global variables. 3. It cannot depend on any external I/O. It can’t rely on input from files, databases, web services, UIs, etc; it can’t produce output, such as writing to a file, database, or web service, writing to a screen, etc. 2. A pure function does not modify its input parameters. A pure function is a function that depends only on its declared input parameters and its algorithm to produce its output. It does not read any other values from “the outside world” — the world outside of the function’s scope — and it does not modify any values in the outside world Functional programming is a way of writing software applications using only pure functions and immutable values. FP means programming with pure functions, and a pure function is one that lacks side effects… A function f with input type A and output type B (written in Scala as a single type: A => B , pronounced “A to B ” or “A arrow B ”) is a computation that relates every value a of type A to exactly one value b of type B such that b is determined solely by the value of a. Any changing state of an internal or external process is irrelevant to computing the result f(a). For example, a function intToString having type Int => String will take every integer to a corresponding string. Furthermore, if it really is a function, it will do nothing else. In other words, a function has no observable effect on the execution of the program other than to compute a result given its inputs; we say that it has no side effects. We sometimes qualify such functions as pure functions to make this more explicit, but this is somewhat redundant. FP in Scala by Paul Chiusano and Runar Bjarnason @pchiusano @runarorama by Sam Halliday @fommil by Alvin Alexander @alvinalexander Definitions of Functional Programming 1.2 Pure Functional Programming Functional Programming is the act of writing programs with pure functions. Pure functions have three properties: • Total: return a value for every possible input • Deterministic: return the same value for the same input • Inculpable: no (direct) interaction with the world or program state. Together, these properties give us an unprecedented ability to reason about our code. For example, input validation is easier to isolate with totality, caching is possible when functions are deterministic, and interacting with the world is easier to control, and test, when functions are inculpable. The kinds of things that break these properties are side effects: directly accessing or changing mutable state (e.g. maintaining a var in a class or using a legacy API that is impure), communicating with external resources (e.g. files or network lookup), or throwing exceptions. FP is just programming with functions. Functions are: 1. Total: They return an output for every input. 2. Deterministic: They return the same output for the same input. 3. Pure: Their only effect is computing the output. The rest is just composition you can learn over time. NO SIDE EFFECTS john Ⓐ De Goes PF = ODI + NSE Pure Functions = Output Depends only on Input + No Side Effects) A pure function has no side effects, meaning that it does not read anything from the outside world or write anything to the outside world. As a result of 1, if a pure function is called with an input parameter x an infinite number of times, it will always return the same result y. This is unlike an OOP method, which can depend on other fields in the same class as the method.
  • 6. 1. A pure function depends only on (a) its declared input parameters and (b) its algorithm to produce its result. A pure function has no “back doors,” which means: 1. Its result can’t depend on reading any hidden value outside of the function scope, such as another field in the same class or global variables. 2. It cannot modify any hidden fields outside of the function scope, such as other mutable fields in the same class or global variables. 3. It cannot depend on any external I/O. It can’t rely on input from files, databases, web services, UIs, etc; it can’t produce output, such as writing to a file, database, or web service, writing to a screen, etc. 2. A pure function does not modify its input parameters. A pure function is a function that depends only on its declared input parameters and its algorithm to produce its output. It does not read any other values from “the outside world” — the world outside of the function’s scope — and it does not modify any values in the outside world Functional programming is a way of writing software applications using only pure functions and immutable values. FP means programming with pure functions, and a pure function is one that lacks side effects… A function f with input type A and output type B (written in Scala as a single type: A => B , pronounced “A to B ” or “A arrow B ”) is a computation that relates every value a of type A to exactly one value b of type B such that b is determined solely by the value of a. Any changing state of an internal or external process is irrelevant to computing the result f(a). For example, a function intToString having type Int => String will take every integer to a corresponding string. Furthermore, if it really is a function, it will do nothing else. In other words, a function has no observable effect on the execution of the program other than to compute a result given its inputs; we say that it has no side effects. We sometimes qualify such functions as pure functions to make this more explicit, but this is somewhat redundant. FP in Scala by Paul Chiusano and Runar Bjarnason @pchiusano @runarorama by Sam Halliday @fommil by Alvin Alexander @alvinalexander Definitions of Functional Programming 1.2 Pure Functional Programming Functional Programming is the act of writing programs with pure functions. Pure functions have three properties: • Total: return a value for every possible input • Deterministic: return the same value for the same input • Inculpable: no (direct) interaction with the world or program state. Together, these properties give us an unprecedented ability to reason about our code. For example, input validation is easier to isolate with totality, caching is possible when functions are deterministic, and interacting with the world is easier to control, and test, when functions are inculpable. The kinds of things that break these properties are side effects: directly accessing or changing mutable state (e.g. maintaining a var in a class or using a legacy API that is impure), communicating with external resources (e.g. files or network lookup), or throwing exceptions. FP is just programming with functions. Functions are: 1. Total: They return an output for every input. 2. Deterministic: They return the same output for the same input. 3. Pure: Their only effect is computing the output. The rest is just composition you can learn over time. PURITY john Ⓐ De Goes A pure function has no side effects, meaning that it does not read anything from the outside world or write anything to the outside world. As a result of 1, if a pure function is called with an input parameter x an infinite number of times, it will always return the same result y. This is unlike an OOP method, which can depend on other fields in the same class as the method. PF = ODI + NSE Pure Functions = Output Depends only on Input + No Side Effects)
  • 7. We can formalize this idea of pure functions using the concept of referential transparency (RT). This is a property of expressions in general and not just functions. For the purposes of our discussion, consider an expression to be any part of a program that can be evaluated to a result—anything that you could type into the Scala interpreter and get an answer. For example, 2 + 3 is an expression that applies the pure function + to the values 2 and 3 (which are also expressions). This has no side effect. The evaluation of this expression results in the same value 5 every time. In fact, if we saw 2 + 3 in a program we could simply replace it with the value 5 and it wouldn’t change a thing about the meaning of our program. This is all it means for an expression to be referentially transparent—in any program, the expression can be replaced by its result without changing the meaning of the program. And we say that a function is pure if calling it with RT arguments is also RT. Referential transparency and purity An expression E is referentially transparent if, for all programs P, all occurrences of E in P can be replaced by the result of evaluating E without affecting the meaning of P. A function f is pure if the expression f(x) is referentially transparent for all referentially transparent x.3 3 There are some subtleties to this definition, and we’ll refine it later in this book. See the chapter notes at our GitHub site (https://github.com/pchiusano/fpinscala; see the preface) for more discussion. Referential Transparency and Purity Functional Programming in Scala (by Paul Chiusano and Runar Bjarnason) @pchiusano @runarorama