From 0c476e92e1807928ffb30864126076ef4c6a0821 Mon Sep 17 00:00:00 2001
From: Elizabeth Hunt <elizabeth.hunt@simponic.xyz>
Date: Tue, 13 Feb 2024 20:00:02 -0700
Subject: add all the stuff

---
 src/scenes/lambda_reduction_example.tsx | 47 +++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)
 create mode 100644 src/scenes/lambda_reduction_example.tsx

(limited to 'src/scenes/lambda_reduction_example.tsx')

diff --git a/src/scenes/lambda_reduction_example.tsx b/src/scenes/lambda_reduction_example.tsx
new file mode 100644
index 0000000..8f2436a
--- /dev/null
+++ b/src/scenes/lambda_reduction_example.tsx
@@ -0,0 +1,47 @@
+import { Layout, makeScene2D } from "@motion-canvas/2d";
+import {
+  Direction,
+  beginSlide,
+  createRef,
+  slideTransition,
+} from "@motion-canvas/core";
+import { LambdaReducer } from "../components/lambda_reducer";
+import { baseDefinitions } from "../utils/lambdas";
+
+export default makeScene2D(function* (view) {
+  const lambdaReducer = createRef<LambdaReducer>();
+  const layout = createRef<Layout>();
+
+  view.add(
+    <Layout layout ref={layout} direction="column" alignItems="center" gap={50}>
+      <LambdaReducer
+        ref={lambdaReducer}
+        lambdaTerm={"(succ zero)"}
+        definitions={baseDefinitions}
+      ></LambdaReducer>
+    </Layout>
+  );
+
+  yield* slideTransition(Direction.Right);
+  yield* beginSlide("Example Reductions");
+
+  for (let i = 0; !lambdaReducer().isDone(); i++) {
+    yield* lambdaReducer().step(0.5);
+    yield* beginSlide("1 Next Step " + i);
+  }
+
+  const one = lambdaReducer().getCode();
+  const reduceToTwo = createRef<LambdaReducer>();
+  layout().add(
+    <LambdaReducer
+      ref={reduceToTwo}
+      lambdaTerm={`(succ ${one})`}
+      definitions={baseDefinitions}
+    ></LambdaReducer>
+  );
+
+  for (let i = 0; !reduceToTwo().isDone(); i++) {
+    yield* reduceToTwo().step(0.5);
+    yield* beginSlide("2 Next Step " + i);
+  }
+});
-- 
cgit v1.2.3-70-g09d2

