summaryrefslogtreecommitdiff
path: root/src/scenes/reductions.tsx
blob: 5ee8961e1cc51cbe78b6f6c035a8a84f65755faa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { Layout, Txt, makeScene2D } from "@motion-canvas/2d";
import {
  Direction,
  beginSlide,
  createRef,
  slideTransition,
} from "@motion-canvas/core";
import { theme } from "../theme";

const reductions = [
  "1. α - conversion: Renaming of bound variables to avoid name clashes (out of\nscope - assume user knows not to bind variable names already chosen elsewhere).",
  "2. β - reduction: Application of a function to an argument.",
  "3. η - reduction: Conversion of a function to a point-free form (out of scope).",
];

export default makeScene2D(function* (view) {
  const rules = createRef<Txt>();

  view.add(
    <Layout layout direction="column" alignItems="center">
      <Txt fontSize={40} fontFamily={theme.font} fill={theme.text.hex}>
        The Lambda Calculus - Reductions
      </Txt>
      <Txt
        ref={rules}
        fontSize={30}
        fontFamily={theme.font}
        fill={theme.text.hex}
      ></Txt>
    </Layout>
  );

  yield* slideTransition(Direction.Right);
  yield* beginSlide("The Lambda Calculus - Reductions");

  for (const rule of reductions) {
    yield* rules().text(rules().text() + "\n\n" + rule, 1);
    yield* beginSlide("reduction - " + rule);
  }
});