Skip to content

Commit 0926067

Browse files
committed
update
1 parent c688a44 commit 0926067

6 files changed

Lines changed: 58 additions & 66 deletions

File tree

_site/0-book/unit-5/section-3/1-map.md

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ The dependency created by `map` is **Static**. Once you define the relationship
3737

3838
![image](https://raw.githubusercontent.com/ken-okabe/web-images5/main/img_1752494846714.png)
3939

40+
![image](https://raw.githubusercontent.com/ken-okabe/web-images5/main/img_1745662189198.png)
41+
4042
This simple concept of a "static dependency" is the foundation for understanding the "dynamic" dependencies constructed by `bind` and `using`, which will be introduced later.
4143

4244
## Canvas Demo
@@ -76,25 +78,6 @@ console.log(labels.at(Now)); // "Score: 5"
7678
// ソースを更新すると、labelsも自動的に更新される
7779
numbers.define(Now, 100);
7880
console.log(labels.at(Now)); // "Score: 100"
79-
```txt```txt
80-
+-----------------+ .map(x => `Score: ${x}`) +-----------------+
81-
| numbers | --------------------------------> | labels |
82-
| (Timeline<number>) | | (Timeline<string>) |
83-
+-----------------+ +-----------------+
84-
^ |
85-
| .define(Now, 100) V
86-
+------------- 値が"Score: 100"へ伝播
87-
88-
```
89-
+-----------------+ .map(x => `Score: ${x}`) +-----------------+
90-
| numbers | --------------------------------> | labels |
91-
| (Timeline<number>) | | (Timeline<string>) |
92-
+-----------------+ +-----------------+
93-
^ |
94-
| .define(Now, 100) V
95-
+------------- 値が"Score: 100"へ伝播
96-
97-
```
9881
```
9982

10083
## 依存グラフ (Dependency Graph)
@@ -105,6 +88,7 @@ console.log(labels.at(Now)); // "Score: 100"
10588

10689
![image](https://raw.githubusercontent.com/ken-okabe/web-images5/main/img_1752494846714.png)
10790

91+
![image](https://raw.githubusercontent.com/ken-okabe/web-images5/main/img_1745662189198.png)
10892

10993
このシンプルな「静的な依存関係」の概念が、後に出てくる`bind``using`が構築する「動的な」依存関係を理解するための基礎となります。
11094

_site/0-book/unit-5/section-3/3-bind.md

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,23 @@ This allows us to build dynamic systems where the wiring of the dependency graph
1717
##### F#: `bind: ('a -> Timeline<'b>) -> Timeline<'a> -> Timeline<'b>`
1818

1919
##### TS: `.bind<B>(monadf: (value: A) => Timeline<B>): Timeline<B>`
20-
20+
Enumerating objects: 33, done.Enumerating objects: 33, done.
21+
Counting objects: 100% (33/33), done.
22+
Delta compression using up to 16 threads
23+
Compressing objects: 100% (17/17), done.
24+
Writing objects: 100% (18/18), 1.37 KiB | 1.37 MiB/s, done.
25+
Total 18 (delta 14), reused 0 (delta 0), pack-reused 0 (from 0)
26+
remote: Resolving deltas: 100% (14/14), completed with 12 local objects.
27+
To https://github.com/ken-okabe/ken-okabe.github.io
28+
675ec98..04b62da main -> main
29+
Counting objects: 100% (33/33), done.
30+
Delta compression using up to 16 threads
31+
Compressing objects: 100% (17/17), done.
32+
Writing objects: 100% (18/18), 1.37 KiB | 1.37 MiB/s, done.
33+
Total 18 (delta 14), reused 0 (delta 0), pack-reused 0 (from 0)
34+
remote: Resolving deltas: 100% (14/14), completed with 12 local objects.
35+
To https://github.com/ken-okabe/ken-okabe.github.io
36+
675ec98..04b62da main -> main
2137
The crucial difference from `.map()` is that the function it takes (`monadf`) accepts a value `A` and returns a **new `Timeline<B>`**.
2238

2339
## What is the use of `bind` or the Monad algebraic structure in a FRP library like Timeline?
@@ -31,7 +47,15 @@ Therefore, I would like to present a clear answer here and now.
3147
## The Diamond Problem in FRP Libraries—Atomic Update
3248

3349
### 1. Definition of the Diamond Problem
34-
50+
Enumerating objects: 33, done.
51+
Counting objects: 100% (33/33), done.
52+
Delta compression using up to 16 threads
53+
Compressing objects: 100% (17/17), done.
54+
Writing objects: 100% (18/18), 1.37 KiB | 1.37 MiB/s, done.
55+
Total 18 (delta 14), reused 0 (delta 0), pack-reused 0 (from 0)
56+
remote: Resolving deltas: 100% (14/14), completed with 12 local objects.
57+
To https://github.com/ken-okabe/ken-okabe.github.io
58+
675ec98..04b62da main -> main
3559
The diamond problem in Functional Reactive Programming (FRP) refers to issues of glitches and inefficiency that arise when a dependency graph forms a diamond shape. Specifically, it occurs when a timeline `D` depends on two other timelines, `B` and `C`, both of which depend on a common source, `A`.
3660

3761
```
@@ -362,18 +386,6 @@ To https://github.com/ken-okabe/ken-okabe.github.io
362386

363387
**Atomic update** を実現している、とも表現されます。
364388

365-
-----[main e684c6b] update
366-
2 files changed, 8 insertions(+)
367-
Enumerating objects: 7, done.
368-
Counting objects: 100% (7/7), done.
369-
Delta compression using up to 16 threads
370-
Compressing objects: 100% (4/4), done.
371-
Writing objects: 100% (4/4), 575 bytes | 575.00 KiB/s, done.
372-
Total 4 (delta 3), reused 0 (delta 0), pack-reused 0 (from 0)
373-
remote: Resolving deltas: 100% (3/3), completed with 3 local objects.
374-
To https://github.com/ken-okabe/ken-okabe.github.io
375-
6660b97..e684c6b main -> main
376-
377389
### 3\. Timelineライブラリのアプローチ:「そもそもDiamond問題なんて起こるほうがおかしい」という思想
378390

379391
`Timeline`ライブラリは、上記のような低レベルな機構に頼るのではなく、より高次元な抽象化によって、この問題を根源から断ち切ります。その思想は、 **「ダイアモンド問題が起こるような設計自体が誤りであり、より優れた設計を選択すべき」** という、極めて洗練されたものです。

src/content/docs/en/book/unit-5/section-3/1-map.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ The dependency created by `map` is **Static**. Once you define the relationship
4040

4141
![image](https://raw.githubusercontent.com/ken-okabe/web-images5/main/img_1752494846714.png)
4242

43+
![image](https://raw.githubusercontent.com/ken-okabe/web-images5/main/img_1745662189198.png)
44+
4345
This simple concept of a "static dependency" is the foundation for understanding the "dynamic" dependencies constructed by `bind` and `using`, which will be introduced later.
4446

4547
## Canvas Demo

src/content/docs/en/book/unit-5/section-3/3-bind.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,23 @@ This allows us to build dynamic systems where the wiring of the dependency graph
1919
##### F#: `bind: ('a -> Timeline<'b>) -> Timeline<'a> -> Timeline<'b>`
2020

2121
##### TS: `.bind<B>(monadf: (value: A) => Timeline<B>): Timeline<B>`
22-
22+
Enumerating objects: 33, done.Enumerating objects: 33, done.
23+
Counting objects: 100% (33/33), done.
24+
Delta compression using up to 16 threads
25+
Compressing objects: 100% (17/17), done.
26+
Writing objects: 100% (18/18), 1.37 KiB | 1.37 MiB/s, done.
27+
Total 18 (delta 14), reused 0 (delta 0), pack-reused 0 (from 0)
28+
remote: Resolving deltas: 100% (14/14), completed with 12 local objects.
29+
To https://github.com/ken-okabe/ken-okabe.github.io
30+
675ec98..04b62da main -> main
31+
Counting objects: 100% (33/33), done.
32+
Delta compression using up to 16 threads
33+
Compressing objects: 100% (17/17), done.
34+
Writing objects: 100% (18/18), 1.37 KiB | 1.37 MiB/s, done.
35+
Total 18 (delta 14), reused 0 (delta 0), pack-reused 0 (from 0)
36+
remote: Resolving deltas: 100% (14/14), completed with 12 local objects.
37+
To https://github.com/ken-okabe/ken-okabe.github.io
38+
675ec98..04b62da main -> main
2339
The crucial difference from `.map()` is that the function it takes (`monadf`) accepts a value `A` and returns a **new `Timeline<B>`**.
2440

2541
## What is the use of `bind` or the Monad algebraic structure in a FRP library like Timeline?
@@ -33,7 +49,15 @@ Therefore, I would like to present a clear answer here and now.
3349
## The Diamond Problem in FRP Libraries—Atomic Update
3450

3551
### 1. Definition of the Diamond Problem
36-
52+
Enumerating objects: 33, done.
53+
Counting objects: 100% (33/33), done.
54+
Delta compression using up to 16 threads
55+
Compressing objects: 100% (17/17), done.
56+
Writing objects: 100% (18/18), 1.37 KiB | 1.37 MiB/s, done.
57+
Total 18 (delta 14), reused 0 (delta 0), pack-reused 0 (from 0)
58+
remote: Resolving deltas: 100% (14/14), completed with 12 local objects.
59+
To https://github.com/ken-okabe/ken-okabe.github.io
60+
675ec98..04b62da main -> main
3761
The diamond problem in Functional Reactive Programming (FRP) refers to issues of glitches and inefficiency that arise when a dependency graph forms a diamond shape. Specifically, it occurs when a timeline `D` depends on two other timelines, `B` and `C`, both of which depend on a common source, `A`.
3862

3963
```

src/content/docs/ja/book/unit-5/section-3/1-map.md

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,6 @@ console.log(labels.at(Now)); // "Score: 5"
2828
// ソースを更新すると、labelsも自動的に更新される
2929
numbers.define(Now, 100);
3030
console.log(labels.at(Now)); // "Score: 100"
31-
```txt```txt
32-
+-----------------+ .map(x => `Score: ${x}`) +-----------------+
33-
| numbers | --------------------------------> | labels |
34-
| (Timeline<number>) | | (Timeline<string>) |
35-
+-----------------+ +-----------------+
36-
^ |
37-
| .define(Now, 100) V
38-
+------------- 値が"Score: 100"へ伝播
39-
40-
```
41-
+-----------------+ .map(x => `Score: ${x}`) +-----------------+
42-
| numbers | --------------------------------> | labels |
43-
| (Timeline<number>) | | (Timeline<string>) |
44-
+-----------------+ +-----------------+
45-
^ |
46-
| .define(Now, 100) V
47-
+------------- 値が"Score: 100"へ伝播
48-
49-
```
5031
```
5132

5233
## 依存グラフ (Dependency Graph)
@@ -57,6 +38,7 @@ console.log(labels.at(Now)); // "Score: 100"
5738

5839
![image](https://raw.githubusercontent.com/ken-okabe/web-images5/main/img_1752494846714.png)
5940

41+
![image](https://raw.githubusercontent.com/ken-okabe/web-images5/main/img_1745662189198.png)
6042

6143
このシンプルな「静的な依存関係」の概念が、後に出てくる`bind``using`が構築する「動的な」依存関係を理解するための基礎となります。
6244

src/content/docs/ja/book/unit-5/section-3/3-bind.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -103,18 +103,6 @@ To https://github.com/ken-okabe/ken-okabe.github.io
103103

104104
**Atomic update** を実現している、とも表現されます。
105105

106-
-----[main e684c6b] update
107-
2 files changed, 8 insertions(+)
108-
Enumerating objects: 7, done.
109-
Counting objects: 100% (7/7), done.
110-
Delta compression using up to 16 threads
111-
Compressing objects: 100% (4/4), done.
112-
Writing objects: 100% (4/4), 575 bytes | 575.00 KiB/s, done.
113-
Total 4 (delta 3), reused 0 (delta 0), pack-reused 0 (from 0)
114-
remote: Resolving deltas: 100% (3/3), completed with 3 local objects.
115-
To https://github.com/ken-okabe/ken-okabe.github.io
116-
6660b97..e684c6b main -> main
117-
118106
### 3\. Timelineライブラリのアプローチ:「そもそもDiamond問題なんて起こるほうがおかしい」という思想
119107

120108
`Timeline`ライブラリは、上記のような低レベルな機構に頼るのではなく、より高次元な抽象化によって、この問題を根源から断ち切ります。その思想は、 **「ダイアモンド問題が起こるような設計自体が誤りであり、より優れた設計を選択すべき」** という、極めて洗練されたものです。

0 commit comments

Comments
 (0)