diff --git a/README.md b/README.md
new file mode 100644
index 0000000..4a3b313
--- /dev/null
+++ b/README.md
@@ -0,0 +1 @@
+`animations don't need to be written cleanly :))`
diff --git a/public/img/profile.svg b/public/img/profile.svg
new file mode 100644
index 0000000..0cc3308
--- /dev/null
+++ b/public/img/profile.svg
@@ -0,0 +1,15 @@
+
+
+
\ No newline at end of file
diff --git a/script.md b/script.md
index 88b16bb..585d74e 100644
--- a/script.md
+++ b/script.md
@@ -84,7 +84,7 @@ def make_valentines_letters(people):
Good! Now they will all share our love.
-But a few months goes by, and soon all their birthdays are coming up! So we make another black box to generate a letter, and in how many days we should give it to them:
+[SPACE] But a few months goes by, and all our friends' birthdays are soon coming up (why are so many cs people born in June)! We don't want to make them sad, as we see here, so we make another black box to generate a letter, and in how many days we should give it to them:
```python
def make_birthday_cards(people):
@@ -101,9 +101,11 @@ def make_birthday_cards(people):
return cards
```
-But this is getting annoying; what about Christmas, Thanksgiving, Easter, or another life event such as a wedding? Making this function to make a list of new cards, going through each person every single time is getting really tedious.
+There, now, we can make sure our friends are happy on their birthdays!
-To help, we create a bunch of black boxes that take a person and create them a card, specifically. Then we create a black box that takes a list of people and another black box and creates a new card for each person?
+But, this is getting annoying; what about Christmas, Thanksgiving, or Easter? Making a new black box to make a list of new cards, going through each person, every single time to construct a list of cards, is getting really tedious.
+
+What if we generalized this? We create a bunch of black boxes that take a person, and generate them a card, specifically; like a template for a card you could print off and fill in manually.
```python
def valentine_letter(person):
@@ -116,7 +118,11 @@ def birthday_card(person):
card = f"Happy Birthday {name}\nI can't believe you're already {newAge} years old!"
cards.append({ "message": card, "deliverInDays": daysUntilBirthday })
+```
+Then, we can use a black box that takes a list of people, and applies this template to each person.
+
+```
def buildCards(people, cardMaker):
cards = []
for person in people:
@@ -128,7 +134,7 @@ people = [{"name": "Joseph", birthday: new Date()}, {"name": "DeeDee", birthday:
buildCards(people, birthdayCard)
```
-The ability to pass a function around like this - like a variable - is what makes functions "first class". And the `buildCards` function takes a function as input, making it a "higher order function". (TODO: slides)
+The ability in a language to pass a function around like this - like a variable - is what makes functions "first class". And the `buildCards` function takes a function as input, making it a "higher order function". (TODO: slides)
Functional Reproduction
===
@@ -250,7 +256,7 @@ But there are also downsides:
+ Keeping immutability requires more computation (data structures)
+ More difficult to write (huge selling point for Object Oriented Programming; encapsulation)
-But like all relationships, we need to compromise with our black boxes. Side effects are _unavoidable_ as programmers; when people press the button, they don't want the computation to just exist out there in the computer void. No! They want to see the pop up box, and the value updated on their account. We need to be able to mutate state where the tradeoff of extra compute time is unavoidable like in I/O or a relatively large database.
+But like all relationships, we need to compromise with our black boxes. Side effects are effectively _unavoidable_ as programmers; when people press the button, they don't want the computation to just exist out there in the computer void. No! They want to see the pop up box, and the value updated on their account. We need to be able to mutate state where the tradeoff of extra compute time is unavoidable like in I/O or a relatively large database.
Writing Code Functionally
===
diff --git a/src/components/function_box.tsx b/src/components/function_box.tsx
index d116a47..b2221b4 100644
--- a/src/components/function_box.tsx
+++ b/src/components/function_box.tsx
@@ -20,7 +20,7 @@ export interface FunctionBoxProps extends NodeProps {
arity?: number;
- isChild?: boolean;
+ isChild?: boolean; // todo: attach DNA
}
type FunctionArgs = { node?: Node; val: any }[];
@@ -59,7 +59,7 @@ export class FunctionBox extends Node {
this.arity = props?.arity ?? 1;
if (props.fn) {
- this.source = props.fn.toString();
+ this.source = props.source ?? props.fn.toString();
this.function = props.fn;
} else {
this.source = props?.source ?? `(x: number): number => x + 2`;
@@ -273,7 +273,7 @@ export class FunctionBox extends Node {
,
);
diff --git a/src/components/person.tsx b/src/components/person.tsx
new file mode 100644
index 0000000..35aa475
--- /dev/null
+++ b/src/components/person.tsx
@@ -0,0 +1,105 @@
+import { Layout, Node, NodeProps, SVG, Txt } from "@motion-canvas/2d";
+import { theme } from "../theme";
+import { all, createRef, waitFor } from "@motion-canvas/core";
+
+export const PEOPLE: PersonI[] = [
+ {
+ name: "Alan Turing",
+ birthday: new Date("06/23/1912"),
+ color: theme.green.hex,
+ },
+ {
+ name: "Grace Hopper",
+ birthday: new Date("12/09/1906"),
+ color: theme.flamingo.hex,
+ },
+ {
+ name: "Edsger Dijkstra",
+ birthday: new Date("07/11/1930"),
+ color: theme.red.hex,
+ },
+ {
+ name: "Alonzo Church",
+ birthday: new Date("06/14/1912"),
+ color: theme.sapphire.hex,
+ },
+ {
+ name: "Margaret Hamilton",
+ birthday: new Date("12/09/1902"),
+ color: theme.yellow.hex,
+ },
+];
+
+const profileSrc = (color: string) => `
+
+`;
+
+export interface PersonI {
+ name: string;
+ birthday: Date;
+ color: string;
+}
+
+export interface PersonProps extends NodeProps {
+ person: PersonI;
+
+ width?: number;
+ height?: number;
+}
+
+export class Person extends Node {
+ private readonly svg = createRef