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 (for-syntax syntax/parse racket/syntax)) | |
(define-values (prop:indexable indexable? indexable-accessor) | |
(make-struct-type-property 'indexable)) | |
(define-syntax (% stx) | |
(syntax-parse stx | |
[(_ thing index) |
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 | |
;; Run in DrRacket to see the SVG logo | |
(require ffi/unsafe | |
ffi/unsafe/define | |
racket/draw | |
racket/draw/unsafe/cairo) | |
;; you'll probably need to adjust this line a bit |
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 -I typed/racket | |
Welcome to Racket v5.3.3.7. | |
-> (: g (All (a ...) (a ... a -> Void))) | |
-> (define (g . rst) (void)) | |
-> g | |
- : (All (a ...) (a ... a -> Void)) | |
#<procedure:g> | |
-> (: h (All (b ...) (b ... b -> Void))) | |
-> (define h g) | |
-> g |
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 | |
(module a racket | |
(define f (λ () (displayln ((thread-receive) 'foo)))) | |
(provide f)) | |
(module b typed/racket | |
(require/typed (submod ".." a) | |
[f (-> Void)]) | |
(define t (thread 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/gui | |
(define (iterations a z i) | |
(define z′ (+ (* z z) a)) | |
(if (or (= i 255) (> (magnitude z′) 2)) | |
i | |
(iterations a z′ (add1 i)))) | |
(define (iter->color i) | |
(if (= i 255) |
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
(;; random ID | |
0 187 | |
;; QR Opcode AA TC RD RA Z RCODE | |
;; 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 | |
129 128 | |
;; QDCOUNT | |
0 1 | |
;; ANSCOUNT | |
0 1 | |
;; NSCOUNT |
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-syntax (go stx) | |
(local-expand #'(begin (define x 3) | |
x) | |
'top-level | |
null)) | |
(go) |
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 r6rs | |
(library (irregex) | |
(export irregex string->irregex sre->irregex string->sre | |
maybe-string->sre irregex? irregex-match-data? | |
irregex-new-matches irregex-reset-matches! irregex-search | |
irregex-search/matches irregex-match | |
irregex-search/chunked irregex-match/chunked | |
make-irregex-chunker irregex-match-substring | |
irregex-match-subchunk ;irregex-match-start-source |
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 rackjure | |
(~> (list 1 2 3) | |
((lambda (xs) (map add1 xs))) | |
((curry map add1)) | |
displayln) |
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 typed/racket | |
;; from Wikipedia | |
(struct: (A B) :<: ([left : A] [right : B]) | |
#:transparent) | |
(struct: Epsilon ()) | |
(define-type (Nested A) | |
(U (:<: A (Nested (Listof A))) Epsilon)) |