Here are some "real world" (some day to day one-time tasks from my work) using Rebellion(pkg, github) an infrastructure library for Racket.
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/base | |
(require rebellion/streaming/reducer | |
rebellion/streaming/transducer) | |
(time (transduce (in-range 1000000) | |
#:into (into-for-each void))) |
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/base | |
(require ...) | |
(define (fill-missing-fields [missing-value #f]) | |
(make-transducer | |
#:name 'fill-missing | |
#:starter | |
(lambda () | |
(variant #:consume (pair null empty-keyset))) |
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/base | |
(require racket/contract/base) | |
(provide | |
(contract-out | |
[in-merge-sorted (-> (-> any/c any/c boolean?) stream? stream?)])) | |
(require racket/match | |
racket/promise |
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/base | |
(require racket/match | |
net/dns) | |
(provide validate-address) | |
(define (validate-address s) | |
(match s | |
[(regexp "^([^@]+)@(.+)$" (list _ user domain)) |
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 pict/color) | |
(provide | |
(contract-out | |
[cat-silhouette | |
(->i ([width positive?] [height positive?]) | |
(#:left-ear-extent [left-ear-extent (>=/c 0)] | |
#:left-ear-arc [left-ear-arc (real-in 0 (* 2 pi))] | |
#:left-ear-angle [left-ear-angle (real-in 0 (* 2 pi))] |
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/base | |
(require racket/format | |
racket/list | |
racket/match | |
racket/trace) | |
(provide (all-defined-out) | |
(all-from-out racket/trace)) |
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/base | |
(require net/url | |
racket/match) | |
(define pkgs | |
(let ([pkgs (call/input-url (string->url "https://pkgs.racket-lang.org/pkgs-all") | |
get-pure-port | |
read)]) | |
(for/fold ([pkgs pkgs]) |
NewerOlder