From: Cameron Ball Date: Tue, 24 Mar 2020 15:36:15 +0000 (+0800) Subject: Some minor updates to notes X-Git-Url: http://cameron1729.xyz/?p=fp-lecture.git;a=commitdiff_plain;h=15e3634bf0f24be5656b44deb6cdf0b4b73b4ae5 Some minor updates to notes --- diff --git a/index.html b/index.html index ad5fcfb..56f1afb 100644 --- a/index.html +++ b/index.html @@ -205,9 +205,9 @@
=<< Welcome to the Talk Called >>=
- +
Wide-Eyed Crazy Functional Programming
- +
@@ -540,7 +540,7 @@
=<< Big Brain Moment >>=
-
Programming languages ARE human languages.
+
Programming languages ARE human languages.
    @@ -574,13 +574,13 @@
    =<< Why is declaritive mood good? >>=
    -
    Declarative programs express what they actually do Leaving more "brain space" to focus on solving the problem.
    +
    Declarative programs express what they actually do leaving more "brain space" to focus on solving the problem.
    • A declaritive program expresses its operation in terms of relationships.
    • -
    • In an imperative paradigm, thinking about the program means thinking about changes over time
    • -
    • In a declaritive one, thinking about the program means thinking about relationships
    • +
    • In an imperative paradigm, thinking about the program means thinking about changes over time => keeping track of changes
    • +
    • In a declaritive one, thinking about the program means thinking about relationships => look at what the thing is, how it relates to the other thing, and move on
    @@ -688,7 +688,7 @@
    =<< Big Brain Moment >>=
    -
    Programming languages ARE human languages.
    +
    Programming languages ARE human languages.
      @@ -912,6 +912,12 @@ threeFs = repeat("f").substr(0,3); >>= (\x -> Right (x ++ " then get here")) >>= (\x -> Right (x ++ " and finally here!"))
    +
    +
      +
    • It does not matter what order the promises resolve in, the final promise will always be resolved with "We start here..."
    • +
    • In this specific example, there is nothing asynchronous happening, but it's not much work to adapt it so there is. I just wanted to really highlight the similarities with haskell
    • +
    +
    =<< Promises >>=
    @@ -930,6 +936,7 @@ threeFs = repeat("f").substr(0,3);
      +
    • Likewise, we can put a failure anywhere in the chain. It doesn't matter if the failure happens first, last, or anywhere in between. The result is always a failed promise of "Oh noes!"
    • So, if you've ever used promises, you've been doing declaritive style programming without even realising it!
    • They give us some new powers, we can now write atemporal code, which explains why they emerged in JS, a place where people are constantly dealing with requests that can finish in any order
    • So it's super cool that people using a language very far removed from haskell ended up solving the problem in the same way