From febe35657514a1728530f5ff449b666ce75ec837 Mon Sep 17 00:00:00 2001 From: Nathan Braswell Date: Sun, 23 Apr 2023 13:02:01 -0400 Subject: [PATCH] new slides --- website/presentation.html | 45 +++++++++++++++++++++++++++++++++++---- website/recursive.css | 3 --- website/slides_to_add | 5 +++++ 3 files changed, 46 insertions(+), 7 deletions(-) create mode 100644 website/slides_to_add diff --git a/website/presentation.html b/website/presentation.html index 9f1adfb..cb4a3e2 100644 --- a/website/presentation.html +++ b/website/presentation.html @@ -24,7 +24,11 @@ h1 { float: right; width: 48%; } +.fullWidthImg > * { width: 95%; } .rerun_container { position: relative; } +.mathSize9 { font-size: 0.9em; } +.mathSize8 { font-size: 0.8em; } +.mathSize6 { font-size: 0.6em; } @@ -52,6 +56,12 @@ class: center, middle, title _Lisp Background_ --- +(from Wikipedia) +.fullWidthImg[![](images/lisp_timeline_screenshot.png)] +--- +(from Wikipedia) +.fullWidthImg[![](images/lisp_timeline_screenshot_edited.png)] +--- # Background: Lisp A quick overview: @@ -64,14 +74,13 @@ A quick overview: Essentially every non-atomic expression is a parentheses delimited list. This is true for:
(+ 1 2)                     ; function calls, evaluates to 3
-
 (if false (+ 1 2) (- 1 2))  ; other special forms like if
-
 (let ((a 1)
       (b 2))                ; or let
       (+ a b))
-
 (lambda (a b) (+ a b))      ; or lambda to create closures
+(quote (1 a 3))             ; (equivalent to (list 1 'a 3)
+'(+ 1 2)                    ; expands to (quote (+ 1 2)) -> (list '+ 1 2)
 
--- @@ -197,6 +206,34 @@ true --- # Background: Fexprs - detail +
 foldr:
+(let (helper (rec-lambda recurse (f z vs i)
+          (if (= i (len (idx vs 0)))
+              z
+              (lapply f (snoc (recurse f z vs (+ i 1))
+                              (map (lambda (x) (idx x i)) vs))))))
+     (lambda (f z & vs) (helper f z vs 0)))
+
+(lapply reduces the wrap-level of the function by 1, equivalent to quoting the inputs) +--- +# Background: Fexprs - detail +
 foldr:
+(rec-lambda recurse (f z l)
+          (if (= nil l)
+              z
+              (lapply f (list (car l) (recurse f z (cdr l))))))
+
+(lapply reduces the wrap-level of the function by 1, equivalent to quoting the inputs) +--- +# Background: Fexprs - detail +
 foldr:
+(rec-lambda recurse (f z l)
+          (if (= nil l)
+              z
+              (f (car l) (recurse f z (cdr l)))))
+
+--- +# Background: Fexprs - detail All special forms in Kaken are combiners too, and are thus also first class. In this case, we can not only pass the raw _if_ around, but we can make an _inverse_if_ which inverts its condition (kinda macro-like) and pass it around. @@ -339,7 +376,7 @@ $$ \kcombine{\kprim{0}{vau}}{(s'~(s\dots)~V)}{E} &\rightarrow& \kcomb{0}{s'}{E}{(s\dots)}{V}\\\ \kcombine{\kprim{0}{wrap}}{\kcomb{0}{s'}{E'}{(s\dots)}{V}}{E} &\rightarrow& \kcomb{1}{s'}{E'}{(s\dots)}{V}\\\ \kcombine{\kprim{1}{unwrap}}{\kcomb{1}{s'}{E'}{(s\dots)}{V}}{E} &\rightarrow& \kcomb{0}{s'}{E'}{(s\dots)}{V}\\\ - \kcombine{\kprim{0}{if0}}{(V_c~V_t~V_e)}{E} &\rightarrow& \kcombine{\kprim{0}{vif0}}{\\&&(\keval{V_c}{E}~V_t~V_e)}{E}\\\ + \kcombine{\kprim{0}{if0}}{(V_c~V_t~V_e)}{E} &\rightarrow& \kcombine{\kprim{0}{vif0}}{\\\&&(\keval{V_c}{E}~V_t~V_e)}{E}\\\ \kcombine{\kprim{0}{vif0}}{(0~V_t~V_e)}{E} &\rightarrow& \keval{V_t}{E}\\\ \kcombine{\kprim{0}{vif0}}{(n~V_t~V_e)}{E} &\rightarrow& \keval{V_e}{E} ~\text{(n != 0)}\\\ \kcombine{\kprim{0}{int-to-symbol}}{(n)}{E} &\rightarrow& 'sn ~\text{(symbol made out of the number n)}\\\ diff --git a/website/recursive.css b/website/recursive.css index 52c633d..bec3e86 100644 --- a/website/recursive.css +++ b/website/recursive.css @@ -26,9 +26,6 @@ body { padding: 0 .62em; font: 1.2em/1.62 'Recursive', sans-serif; } -.mathSize9 { font-size: 0.9em; } -.mathSize8 { font-size: 0.8em; } -.mathSize6 { font-size: 0.6em; } //body, .remark-slide-content { background-color: #eff3f5; } body, .remark-slide-content { background-color: #f5f3ef; } h1, h2, h3, h4 { diff --git a/website/slides_to_add b/website/slides_to_add new file mode 100644 index 0000000..11657d9 --- /dev/null +++ b/website/slides_to_add @@ -0,0 +1,5 @@ +x lisp tree +x explain quote +x show fold's internals +x fix if0 primitive +_ partial evaluation