Skip to content

Commit 5010007

Browse files
committed
chore: minor adjustments for lecture today
Signed-off-by: Henry Schreiner <[email protected]>
1 parent da52463 commit 5010007

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

content/week07_design/functional.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ int main() {
318318
}
319319
```
320320
321-
Not that C++ is slowly gaining support; `std::fold_left` is in C++23, but for
321+
Not that C++ is slowly gaining support; `std::ranges::fold_left` is in C++23, but for
322322
C++20, we have to drop back to a classic `std::accumulate` algorithm & begin
323323
and end iterators.
324324
@@ -337,7 +337,8 @@ int main() {
337337
}
338338
```
339339
340-
Not that stdlib module support is not available yet.
340+
Not that stdlib module support is not available yet unless you enable it in
341+
CMake experimental mode and have a very recent compiler.
341342
342343
````
343344
````{tab-item} Rust

slides/week-07-1.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ Think about some functions and see which ones are pure.
211211

212212
---
213213

214-
## map, filter, reduce
214+
## lambda, map, filter, reduce
215215

216216
Functional programming often involves passing functions to functions.
217217

@@ -289,17 +289,17 @@ fn main() {
289289

290290
---
291291

292-
## Other languages: C++23 (modules not supported yet)
292+
## Other languages: C++23 (modules very experimental)
293293

294294
```cpp
295295
import std;
296296

297297
int main() {
298298
std::vector items {1, 2, 3, 4, 5};
299-
auto odd_sq = items | std::views::transform([](int i){return i*i;})
299+
auto oddsq = items | std::views::transform([](int i){return i*i;})
300300
| std::views::filter([](int i){return i%2==1;});
301-
auto sum_sq_odds = std::fold_left(odd_sq, 0, [](int a, int b){return a + b;});
302-
std::println("{}", sum_sq_odds);
301+
auto soddsq = std::ranges::fold_left(oddsq, 0, [](int a, int b){return a + b;});
302+
std::println("{}", soddsq);
303303
return 0;
304304
}
305305
```
@@ -396,7 +396,7 @@ arr = arr.at[0].set(4)
396396

397397
## JAX (3)
398398

399-
```
399+
```python
400400
@jax.jit
401401
def f(x):
402402
return x**3 + x**2 + x

0 commit comments

Comments
 (0)