4 ms·
Any purely functional language will : https://en.wikipedia.org/wiki/List_of_programming_languages_by_type#Pure https://en.wikipedia.org/wiki/List_of_programmin
by weavie 8y ago
Any purely functional language will :
https://en.wikipedia.org/wiki/List_of_programming_languages_by_type#Pure https://en.wikipedia.org/wiki/List_of_programming_languages_...
If a language is pure then there is no point running an instruction other than to return a result since the only point in ignoring a result would be if the instruction had a side efffect, which a purely functional language disallows.
Haskell does simulate this chaining instruction via the do notation..
do
a <- getLine
b <- getLine
putStrLn ( a ++ b )
It looks like it is chaining instructions, but really this gets rewritten by the compiler to something like this (in pseudo js) :
bind(getLine, function(a) {
bind(getLine, function (b) {
putStrLn a + b;
})
})
- lolive 8y agoI have spent ages understanding this. And I am super happy that what you summarize is the mental model I have made up.