Created
January 23, 2024 15:00
-
-
Save ashiato45/200fde8f48bbd7b7ddf6367aa00f289b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang slideshow | |
(require racket/control) | |
;(reset (shift k "hello")) | |
;(define (f x) (reset (string-append (shift k "hello")) "world")) | |
((reset (- (+ 3 (shift k k)) 1)) 3) | |
(let ((c (reset (string-append (shift k k) "fuga")))) | |
(c "poyo")) | |
;; kは普通は外からデータを差し込んでもらってつかうものだが、 | |
;; shiftでkを使うラムダ式を返すことで、「kはこうやって使ってね」という使い方まで示してしまっている。 | |
;; 結果として、単に外からは計算の再開タイミングを教えてもらうだけになっている | |
(let ((c (reset (string-append (shift k (lambda (x) (k "hoge-"))) "fuga")))) | |
(c '())) | |
((lambda (_) 2) 3) | |
;; 確かに米田を感じる | |
((reset (string-append "hello " (shift k (lambda (s) (k s))) "!")) "world") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment