Skip to content

Instantly share code, notes, and snippets.

View bennn's full-sized avatar

Ben Greenman bennn

View GitHub Profile
;; List of high-frequency English words.
;; Taken from John Clement's morse-code library
;; https://github.com/jbclements/morse-code-trainer/blob/master/morse-code-trainer/frequency.rktd
(
"the"
"be"
"and"
"of"
"to"
"a"
#lang racket/base
(module trie typed/racket
(provide lookup bind trie insert Trie tries)
(require racket/match)
(define-type-alias (Key A) (Listof A))
(define-struct: Mt ())
(define-struct: (A) Some ([elem : A]))
#lang racket/base
;; Minimized version of `good-news.rkt`
;; Runs on (slowly) on 6.3, crashes on 6.3.0.11
;;
;; Error message:
;; vector-ref: chaperone produced a result that is not a chaperone of the original result
;; chaperone result: (object:automata% ...)
;; original result: (object:automata% ...)
;; context...:
#lang racket/base
;; Apparently builds repeated wrappers
;; when comparing a recursive contract to an "opaque" recursive contract
;;
;; (object/c (-> evaluate ... (object/c (-> evaluation ...
;; vs
;; (recursive-contract g27 #:impersonator)
;;
;; Not sure where the recursive contract came from
#lang racket/base
(module automata racket/base
(provide
choose-randomly
build-automata)
(require racket/class racket/match)
(define (choose-randomly vals num-to-choose)
#lang racket/base
;; Repeatedly passes an object through a simple type boundary.
(define OPAQUE-TIME 1)
(define ITERS 30000)
(module t typed/racket/base
(require typed/racket/class)
(define-type C% (Class (f (-> C C))))
#lang racket
(require
(prefix-in - (only-in racket/base struct))
(for-syntax syntax/parse racket/syntax))
(define-syntax (struct stx)
(syntax-parse stx
[(_ name (field* ...) other-arg* ...)
#:with define-name (format-id stx "define-~a" (syntax-e #'name))
#:with (name-field ...) (for/list ([field (in-list (syntax-e #'(field* ...)))])
#lang rosette
;; Posted to Coq-Club by Fred Smith, 2016-09-24
;; https://sympa.inria.fr/sympa/arc/coq-club/2016-09/msg00185.html
;; The five-story Manning Building, located in the Wall Streat area of
;; Manhattan, houses the home offices of Matt and four other prominent
;; businessmen.
;;
;; Each man's business is located on a different floor of the building, and each
#lang racket
(require file/glob pict racket/draw)
(define (path->pict path)
(bitmap (make-object bitmap% path 'png)))
(define p
(parameterize (#;[current-directory (build-path "Users" "ben" "Desktop")])
(apply vc-append 20 (map path->pict (glob "/Users/ben/Desktop/Screen*png")))))
version: 1.0.{build}
platform: x64
environment:
PATH: C:\Program Files\Racket;%PATH%
build_script:
- ps: >-
Invoke-WebRequest https://github.com/pauldalewilliams/chocolatey-comm-pkgs/raw/48c2d2110beae07ff38b3125ea57f03ab67ced20/racket/racket.6.10.nupkg -OutFile racket.6.10.nupkg
Invoke-WebRequest https://raw.githubusercontent.com/pauldalewilliams/chocolatey-comm-pkgs/48c2d2110beae07ff38b3125ea57f03ab67ced20/racket/racket.nuspec -OutFile racket.nuspec