Skip to content

Instantly share code, notes, and snippets.

@samdphillips
samdphillips / identity.rkt
Created December 17, 2019 04:09
Some benchmark scripts for Rebellion transducers
#lang racket/base
(require rebellion/streaming/reducer
rebellion/streaming/transducer)
(time (transduce (in-range 1000000)
#:into (into-for-each void)))
@samdphillips
samdphillips / record-stuff.rkt
Created December 11, 2019 21:53
Normalize a bunch of records
#lang racket/base
(require ...)
(define (fill-missing-fields [missing-value #f])
(make-transducer
#:name 'fill-missing
#:starter
(lambda ()
(variant #:consume (pair null empty-keyset)))
@rocketnia
rocketnia / lazy-merge-sort.rkt
Created November 13, 2019 04:08
A lazy merge sort of Racket streams, potentially useful for Rebellion
#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
@samdphillips
samdphillips / 00-README.md
Last active November 5, 2019 00:30
Using Rebellion in Anger

Rebellion Examples

Here are some "real world" (some day to day one-time tasks from my work) using Rebellion(pkg, github) an infrastructure library for Racket.

@modernserf
modernserf / bestiary.md
Last active December 27, 2020 21:54
Syntax bestiary

Simple value literals

Numbers

syntax examples languages
decimal literals -123.45 (most languages)
scientific notation 1.23e-2
prefix hexadecimal 0xDEADBEEF
prefix binary 0b1110
prefix octal 0o777
@greghendershott
greghendershott / validate-email.rkt
Created November 3, 2017 21:48
Validating email addresses
#lang racket/base
(require racket/match
net/dns)
(provide validate-address)
(define (validate-address s)
(match s
[(regexp "^([^@]+)@(.+)$" (list _ user domain))
@deeglaze
deeglaze / standard-cat.rkt
Last active July 20, 2019 14:11
working out the definition of Racket's to-be standard-cat
#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))]
@greghendershott
greghendershott / trace.log-rkt
Last active October 25, 2018 22:48
Make racket/trace output go to a logger
#lang racket/base
(require racket/format
racket/list
racket/match
racket/trace)
(provide (all-defined-out)
(all-from-out racket/trace))
#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])
@greghendershott
greghendershott / pkgs.md
Created November 11, 2015 20:05
Some interesting Racket packages

Sound and Vision

identikon

rsound

Testing and Coverage

rackunit-chk