Comments (8)
PRS are always welcome. Understandability is more important than accuracy in this document so if you can think of a good, simple wording I'm sure it'll get pulled
from functional-programming-jargon.
Feel free to assign this to me.
from functional-programming-jargon.
👍
from functional-programming-jargon.
@daira Thank you, please feel free to do a PR.
from functional-programming-jargon.
Untill now I understood that referencial transparency and purity were the same thing, but it turns out a function can be referentially transparent and have side effects, so it is not pure.
Any reason why Referencial Transparency is so far below purity and side-effects? I think the right order of jargons helps alot, and as I understand that purity = referential transparency + no side effects
purity should be last shown of these three.
I am new to these concepts and haven't used any strictly functional language yet, so feel free to ignore me.
from functional-programming-jargon.
A side effect is an operation which is not pure. The purity implies the referential transparency (see the confluence of the lambda calculus). A function can also be observationaly pure, but with side effects inside. For example :
function sum(a, b) {
let s = a;
s = s + b;
return s;
}
We do a mutation s = s + b
, so a side effect. However, the function sum
is observationaly pure as it always returns the same result given the same arguments, and does not modify its environment.
from functional-programming-jargon.
Interesting classification of effects done in this paper
but the basic effects defined in Koka are
total
,exn
,div
,ndet
,
alloc<h>
,read<h>
,write<h>
, andio
. Of coursetotal
is not really an effect but signifies the absence of any effect and is assigned to pure mathematical functions. When a function can throw an exception, it gets theexn
effect. Potential divergence or non-termination is signified by thediv
effect. Currently, Koka uses a simple termination analysis based on inductive data types to assign this effect to recursive functions. Non-deterministic functions get thendet
effect. The effectsalloc<h>
,read<h>
andwrite<h>
are used for stateful functions over a heaph
. Finallyio
is used for functions that do any input/output operations.
alias total = <>
alias pure = <exn, div>
alias st<h> = <alloc<h>, read<h>, write<h>>
alias io = <st<ioheap>, pure, ndet>
from functional-programming-jargon.
Add totality definition http://alvinalexander.com/photos/totality-rule-functional-programming
from functional-programming-jargon.
Related Issues (20)
- Add a section on higher-kinded types HOT 2
- Explanation of `lens` HOT 2
- TOC refers to absent anchor tags HOT 2
- Idempotent inaccurate HOT 2
- Volunteering - Polish translation HOT 4
- Closure appears twice in the document HOT 2
- Avoid polluting globals HOT 2
- Add memoization HOT 1
- Add Identity Function
- Category, Functor, Monad, Comonad, etc. should mention algebraic laws HOT 1
- Natural transformations HOT 1
- Functors are maps for categories HOT 3
- Category example is a preorder/partial order HOT 1
- Suggestions from HN HOT 1
- Add Total Functions HOT 1
- Organize for extensibility HOT 3
- Functor example does not make any sense HOT 2
- Explain why HOT 1
- Monad chain does exist now in JS HOT 3
- Is array concatenation a monoid?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from functional-programming-jargon.