This file contains 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 racket | |
(define (tailtest) | |
(let ([p (make-continuation-prompt-tag)]) | |
(call-with-continuation-prompt | |
(λ () | |
(call-with-composable-continuation | |
(λ (k) | |
(abort-current-continuation p (λ () (tailtest)))) | |
p)) |
This file contains 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 racket | |
(require redex | |
redex/examples/delim-cont/grammar | |
redex/examples/delim-cont/meta | |
redex/examples/delim-cont/reduce) | |
;; nullary Z combinator | |
(define Z | |
(term (λ (f) |
This file contains 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 racket | |
;; Persistent union-find from http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.79.8494 | |
(define-signature persistent-array^ | |
(init get set)) | |
(define-signature union-find^ | |
(create find union)) |
This file contains 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
$ racket nqueens-racket-stream.rkt | |
Profiling results | |
----------------- | |
Total cpu time observed: 5292ms (out of 5412ms) | |
Number of samples taken: 95 (once every 56ms) | |
============================================================ | |
Caller | |
Idx Total Self Name+src Local% | |
ms(pct) ms(pct) Callee |
This file contains 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 racket | |
(define f | |
(call-with-continuation-prompt | |
(lambda () | |
(call/cc (lambda (k) k))))) | |
(call-with-continuation-prompt | |
(lambda () | |
(call-with-continuation-barrier |
This file contains 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 racket | |
(define k1 #f) | |
(define k2 #f) | |
(call-with-continuation-prompt | |
(lambda () | |
;; this dw will only run twice and not three for | |
;; the initial run, k1, and then k2 | |
(dynamic-wind |
This file contains 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 racket | |
(thread | |
(lambda () | |
(displayln "hi") | |
(dynamic-wind | |
void | |
(lambda () | |
(abort-current-continuation | |
(default-continuation-prompt-tag) 5)) |
This file contains 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 racket | |
;; added something like `where` clauses | |
(require (for-syntax syntax/parse | |
syntax/parse/experimental/template)) | |
(provide define/match) | |
(begin-for-syntax |
This file contains 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 racket | |
(require redex | |
redex/examples/delim-cont/reduce | |
redex/examples/delim-cont/grammar) | |
(stepper :-> | |
(term (<> () () (% 0 | |
((λ (x) | |
(wcm ((5 5)) (x))) |
This file contains 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
;; using the idea from this blog post: http://www.clojure.net/2012/06/03/Monad-Protocols/ | |
#lang racket | |
(require (for-syntax syntax/parse)) | |
(module monad racket | |
(require racket/generic) | |
(define (vector-mapcat f v) |