Sfoglia il codice sorgente

Improve currying slides further

master
Julian Ospald 9 anni fa
parent
commit
a8f9458649
Non sono state trovate chiavi note per questa firma nel database ID Chiave GPG: 220CD1C5BDEED020
2 ha cambiato i file con 8 aggiunte e 3 eliminazioni
  1. +8
    -2
      VL2/content/VL2_currying5.1.tex
  2. +0
    -1
      VL2/content/VL2_currying6.tex

+ 8
- 2
VL2/content/VL2_currying5.1.tex Vedi File

@@ -6,5 +6,11 @@ f x y z = x + y + z
-- ...for this
f = \x -> (\y -> (\z -> x + y + z)) -- right-associative
\end{haskellcode}

\ifger{Frage: was passiert, wenn wir nur $x = 3$ übergeben?}{Question: what happens if we just pass $x = 3$?}
\ifger{Frage: was passiert, wenn wir nur $x = 3$ übergeben?}{Question: what happens if we just pass $x = 3$?}
\vspace{\baselineskip}
\\
\pause
\ifger{Wieso nicht das?}{Why not this?}
\begin{haskellcode}
f = \x -> x + (\y -> y + (\z -> z)) -- no!
\end{haskellcode}

+ 0
- 1
VL2/content/VL2_currying6.tex Vedi File

@@ -8,8 +8,6 @@ addInt = \x -> (\y -> x + y)

addTwo :: Int -> Int
addTwo = addInt 2
addTwo = \y -> addInt 2 y
\end{haskellcode}
\ifger{Wir haben \hinline{addInt} ein Argument übergeben, also ist die Arität (im Beispiel vorher Dimension) einer weniger und damit ist noch ein Argument notwendig um den endgültigen Wert zu bekommen.
\vspace{\baselineskip}\\


Caricamento…
Annulla
Salva