Skip to content

Instantly share code, notes, and snippets.

@leafac
Created January 2, 2021 08:41
Show Gist options
  • Save leafac/bd595f3226e9148bfcaa327b896b84d8 to your computer and use it in GitHub Desktop.
Save leafac/bd595f3226e9148bfcaa327b896b84d8 to your computer and use it in GitHub Desktop.
#lang racket
; call/cc : ((α → β) → α) → α
; call/cc : ?
(+ 2 3)
(+ 2 (call/cc (λ (continuation) 3)))
; call/cc : (? → ?) → Number
(+ 2 (call/cc (λ (continuation) (continuation 3))))
; (define (continuation x) (+ 2 x))
; call/cc : ((Number → ?) → ?) → Number
(+ 2 (call/cc (λ (continuation) (continuation 3) 6)))
; call/cc : ((Number → ?) → Number) → Number
(+ 2 (call/cc (λ (continuation) (zero? (continuation 3)) 6)))
(+ 2 (call/cc (λ (continuation) (string-length (continuation 3)) 6)))
; call/cc : ((Number → β) → Number) → Number
(string-append "Hello " (call/cc (λ (continuation) (zero? (continuation "World")) "NOT ME")))
; call/cc : ((α → β) → α) → α
(write (if #t 23 "Hello"))
(string-append "Hello " (call/cc (λ (continuation) (zero? (continuation "World")) #f)))
; call/cc : ((α → β) → γ) → (α ∪ γ)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment