diff options
Diffstat (limited to 'transp-inf110-02-typage.tex')
-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} |