slide init

This commit is contained in:
JKF
2026-06-02 22:57:36 +02:00
parent 4792bf29fb
commit e7597f0f1d
4 changed files with 114 additions and 19 deletions
+75
View File
@@ -0,0 +1,75 @@
---
theme: dracula
paginate: true
_paginate: false
footer: Topics in Compilers and Concurrency · Julius Fischer · 10.06.2026
_footer: ""
style: |
h1 {
position: absolute;
top: 60px;
left: 75px;
right: 75px;
}
---
# Destination Calculus:
## A Linear 𝜆-Calculus for Purely Functional Memory Writes
### Topics in Compiler and Concurrency
#### Julius Fischer
###### 10. Juni 2026
---
# What are Destinations?
- Destination Passing Style
- Imperative
- Function takes destination instead of returning structure
---
# Example in C
```
int* vec_add(int v1[], int v2[], int size) {
int* res = malloc(size * sizeof(int));
for (int i = 0; i < size; i++) {
res[i] = v1[i] + v2[i];
}
return res;
}
```
- Add an 'out parameter'
```
void dps_vec_add(int res[], int v1[], int v2[], int size) {
for (int i = 0; i < size; i++) {
res[i] = v1[i] + v2[i];
}
}
```
---
# Motivation for DPS
- Typical functional map implementation
```
map f (x:xs) = (f x : map f xs1)
> (f x : map f xs)
> (map f x1 : (f x2 : map f xs2))
> ...
```
- Not tail recursive
- Performance issue
- Inefficient stack growth
```
map f (x:xs) dest = map f xs (push dest (f x))
> map f xs1 (push dest (f x1))
> map f xs2 (push dest (f x2))
```
---
# 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$
---
# Destination Calculus
- It's
---
# Referenes