diff options
author | David A. Madore <david+git@madore.org> | 2023-12-12 20:52:02 +0100 |
---|---|---|
committer | David A. Madore <david+git@madore.org> | 2023-12-12 20:52:02 +0100 |
commit | 3264fc74f818d3b92de4d490d59a0ae69edc3944 (patch) | |
tree | 8ec847523aac965235660ee001bbceae26233604 | |
parent | fc401219084fdd6c2acfd914f5025bed8f1a3337 (diff) | |
download | inf110-lfi-3264fc74f818d3b92de4d490d59a0ae69edc3944.tar.gz inf110-lfi-3264fc74f818d3b92de4d490d59a0ae69edc3944.tar.bz2 inf110-lfi-3264fc74f818d3b92de4d490d59a0ae69edc3944.zip |
Expand last example slightly.
-rw-r--r-- | transp-inf110-02-typage.tex | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/transp-inf110-02-typage.tex b/transp-inf110-02-typage.tex index 08cf5a9..4a033df 100644 --- a/transp-inf110-02-typage.tex +++ b/transp-inf110-02-typage.tex @@ -3518,7 +3518,11 @@ let rec fibonacci\_cps = fun n -> fun k -> if n <= 1 then k n\\ \ \ \ \ \ \ sum\_cps v1 v2 k)))) ;;\\ {\color{purple}val fibonacci\_cps : int -> (int -> 'a) -> 'a = <fun>}\\ fibonacci\_cps 8 (fun x -> x) ;;\\ -{\color{purple}- : int = 21} +{\color{purple}- : int = 21}\\ +let callcc\_cps = fun g -> fun k -> g (fun v -> fun k0 -> k v) k ;;\\ +(* translation of: callcc (fun kf -> ((kf 42) + 1)) *)\\ +callcc\_cps (fun kf -> fun k -> kf 42 (fun v -> sum\_cps v 1 k)) (fun x -> x) ;;\\ +{\color{purple}- : int = 42} \par} \end{frame} |