Editing Talk:1312: Haskell
Please sign your posts with ~~~~ |
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 6: | Line 6: | ||
:"Expression?" I don't know Haskel, but that's what I would call it in another functional language. --[[User:Rael|Rael]] ([[User talk:Rael|talk]]) 16:31, 3 January 2014 (UTC) | :"Expression?" I don't know Haskel, but that's what I would call it in another functional language. --[[User:Rael|Rael]] ([[User talk:Rael|talk]]) 16:31, 3 January 2014 (UTC) | ||
− | |||
::That's a little imprecise, as it doesn't capture the idea of binding a value to a single symbol. [[Special:Contributions/108.162.231.13|108.162.231.13]] 17:03, 3 January 2014 (UTC) | ::That's a little imprecise, as it doesn't capture the idea of binding a value to a single symbol. [[Special:Contributions/108.162.231.13|108.162.231.13]] 17:03, 3 January 2014 (UTC) | ||
Line 26: | Line 25: | ||
::::And here's one which is closer to what an Haskeller would write (if he ever needed to compute Fibonacci numbers and couldn't bother using one of the good (non-linear) algorithms) : | ::::And here's one which is closer to what an Haskeller would write (if he ever needed to compute Fibonacci numbers and couldn't bother using one of the good (non-linear) algorithms) : | ||
<nowiki>fibs :: [Integer] | <nowiki>fibs :: [Integer] | ||
− | fibs = | + | fibs = 1 : 1 : zipWith (+) fibs (tail fibs)</nowiki> |
− | ::::The first two numbers are | + | ::::The first two numbers are 1, 1 and you get the rest by adding fibs and tail fibs (fibs offset by 1 element) (zipping them together with +). |
::::The surprising part is that fibs is used in its own computation but that's no problem since each needed element can be computed by the time you need it (we "primed the pump" with the first two elements) and Haskell has lazy evaluation (sometimes named "call-by-need"). | ::::The surprising part is that fibs is used in its own computation but that's no problem since each needed element can be computed by the time you need it (we "primed the pump" with the first two elements) and Haskell has lazy evaluation (sometimes named "call-by-need"). | ||
::::Note that this version only compute each element once, contrary to the previous one (which is horrendous since it does the whole inefficient (O(fib n)) Fibonacci computation for each element). | ::::Note that this version only compute each element once, contrary to the previous one (which is horrendous since it does the whole inefficient (O(fib n)) Fibonacci computation for each element). | ||
Line 41: | Line 40: | ||
"thus Haskell may have value but no one has either invoked it to get that value or requested such a language." The point of the title text is (a joke that) programmers of Haskell are lazy, but no one tells them so. The point is not that no one uses Haskell. That is the point of the comic itself. {{unsigned ip|108.162.219.202}} | "thus Haskell may have value but no one has either invoked it to get that value or requested such a language." The point of the title text is (a joke that) programmers of Haskell are lazy, but no one tells them so. The point is not that no one uses Haskell. That is the point of the comic itself. {{unsigned ip|108.162.219.202}} | ||
− | |||
... I am confused by the description. Is it possible that someone can put this into "plain language" that a non-programmer and a non-mathematician can understand? (Go ahead and add "slow" to that description, too, if you so choose...) [[Special:Contributions/173.245.54.54|173.245.54.54]] 09:11, 5 January 2014 (UTC) | ... I am confused by the description. Is it possible that someone can put this into "plain language" that a non-programmer and a non-mathematician can understand? (Go ahead and add "slow" to that description, too, if you so choose...) [[Special:Contributions/173.245.54.54|173.245.54.54]] 09:11, 5 January 2014 (UTC) | ||
: Functional programming languages are many -- explaining the difference to a non-programmer can be hard, but typically Lisp as the grandfather and related languages such a Scheme, Haskell [ {{w|List_of_programming_languages_by_category#Functional_languages|list here}} ] are considered {{w|functional programming}} languages, where Java, C, Basic, Fortan etc typically depending on changing state of variables and are called {{w|Procedural_programming|Procedural}} or {{w|Imperative programming}} programming languages -- The best advice for futher explanation is to read the wikipedia links. [[User:Spongebog|Spongebog]] ([[User talk:Spongebog|talk]]) 18:22, 5 January 2014 (UTC) | : Functional programming languages are many -- explaining the difference to a non-programmer can be hard, but typically Lisp as the grandfather and related languages such a Scheme, Haskell [ {{w|List_of_programming_languages_by_category#Functional_languages|list here}} ] are considered {{w|functional programming}} languages, where Java, C, Basic, Fortan etc typically depending on changing state of variables and are called {{w|Procedural_programming|Procedural}} or {{w|Imperative programming}} programming languages -- The best advice for futher explanation is to read the wikipedia links. [[User:Spongebog|Spongebog]] ([[User talk:Spongebog|talk]]) 18:22, 5 January 2014 (UTC) |