yeyeye
This commit is contained in:
+40
-3
@@ -19,6 +19,11 @@ style: |
|
||||
#### Julius Fischer
|
||||
|
||||
###### 10. Juni 2026
|
||||
$$
|
||||
\def\leftcirc{{\triangleleft\kern-0.1em\circ}}
|
||||
\def\myor{{\;|\;}}
|
||||
|
||||
$$
|
||||
|
||||
---
|
||||
# What are Destinations?
|
||||
@@ -64,12 +69,44 @@ map f (x:xs) dest = map f xs (push dest (f x))
|
||||
---
|
||||
# DPS in functional languages
|
||||
- Just add pointers to mutable data?
|
||||
- $Int \mapsto Int \mapsto Int \mapsto \textcolor{red}{T}$
|
||||
- $\textcolor{red}{T *}\mapsto Int \mapsto Int \mapsto Int \mapsto Void$
|
||||
- $Int \mapsto Int \mapsto \textcolor{red}{T}$
|
||||
- $\textcolor{red}{T *}\mapsto Int \mapsto Int \mapsto \dots$
|
||||
- Multiple issues with this
|
||||
- Memory safety
|
||||
- Multilpe writes on shared memory
|
||||
- Purity
|
||||
|
||||
---
|
||||
# Destination Calculus
|
||||
- It's
|
||||
- Basic FP terms
|
||||
$$
|
||||
t, u := x \myor t' t \;|\; t ; t' \;|\; \dots
|
||||
$$
|
||||
- Case for all datatypes
|
||||
$$
|
||||
\begin{align}
|
||||
\dots \myor
|
||||
&case_m\;t\;of\;(v_1, v_2) \mapsto u \myor\\
|
||||
&case_m\;t\;of\;(Inl\;v_1) \mapsto u \myor \dots
|
||||
\end{align}
|
||||
$$
|
||||
- Additions for destination passing
|
||||
$$
|
||||
\begin{align}
|
||||
\dots \myor
|
||||
&
|
||||
new_\ltimes \myor
|
||||
from_\ltimes t \myor
|
||||
to_\ltimes t \myor
|
||||
upd_\ltimes \; t \; with \; x \mapsto t' \myor\\
|
||||
&
|
||||
t \blacktriangleleft t' \myor
|
||||
t \leftcirc t' \myor
|
||||
t \triangleleft () \myor
|
||||
t \triangleleft Inl \myor
|
||||
t \triangleleft (,) \myor \dots
|
||||
\end{align}
|
||||
$$
|
||||
|
||||
---
|
||||
# Referenes
|
||||
|
||||
Reference in New Issue
Block a user