Upgrade to Pro — share decks privately, control downloads, hide ads and more …

PLT-X2 Lambda

kanaya
June 02, 2024
57

PLT-X2 Lambda

kanaya

June 02, 2024
Tweet

Transcript

  1. pineapple.cc f(x) = ax + b def f(x): return a

    * x + b f x = a * x + b Math Python Haskell 1⃣ 2⃣ 3⃣
  2. pineapple.cc Math Math f(x) = ax + b Math f

    = x → ax + b f = ̂ x . ax + b 1⃣ 2⃣ 3⃣
  3. pineapple.cc f = λx → ax + b f =

    lambda x: a*x+b f = \x -> a*x+b Math Python Haskell 1⃣ 2⃣ 3⃣
  4. pineapple.cc Math Math z = g(y), y = f(x) Math

    z = g (f(x)) z = (g ∙ f)(x) 1⃣ 2⃣ 3⃣
  5. pineapple.cc h(x) = (g ∙ f)(x) def h(x): return g(f(x))

    h = \x -> g (f x) Math Python Haskell 1⃣ 2⃣ 3⃣
  6. pineapple.cc h = g ∙ f h = lambda x:

    g(f(x)) h = g.f Math Python Haskell 1⃣ 2⃣ 3⃣
  7. pineapple.cc y = (λx → 2x + 1)(3) y =

    (lambda x: 2*x+1)(3) y = (\x -> 2*x+1)3 Math Python Haskell 1⃣ 2⃣ 3⃣
  8. pineapple.cc Ϛοϓ 1ZUIPO Map in Python xs = [1, 2,

    3] ys = list(map(lambda x: x*2+1, xs)) print(ys) Python
  9. pineapple.cc Ϛοϓ )BTLFMM Map in Haskell Haskell xs = [1,

    2, 3] ys = map (\x -> x*2+1) xs main = print ys