Skip to content

Instantly share code, notes, and snippets.

Spencer Florence florence

Block or report user

Report or block florence

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View scribble_notes.scrbl
#lang scribble/doc
Okay, we've made a package and up loaded. But you know what would be lovely?.
Docs! This tutorial is going to start assuming you have a blank file and now clue where to start. By
the end we will have written the documentation for this line-of-best-fit library <show>.
This is racket land, so of course we have a language for documentation! #lang scribble/doc
@(require scribble/manual
@florence
florence / image-enum.rkt
Last active Dec 5, 2016
An enumeration of all bitmaps
View image-enum.rkt
#lang racket
(require data/enumerate)
(require data/enumerate/lib)
(require racket/draw)
(require pict)
;; adjust byte size to shrink the range of colors
(define byte-size 256)
(define byte/e (below/e byte-size))
(define (byte->actual x)
View SKIdex
#lang racket
(require redex)
(define-language SKI
(e ::= S K I (e e) natural +))
(define R
(reduction-relation
SKI
(--> (((S e_1) e_2) e_3)
((e_1 e_3) (e_2 e_3)))
(--> ((K e_1) e_2) e_1)
View ppict-expanders.rkt
(define-expander-type ppict-ext)
(begin-for-syntax
(define-syntax-class ppict-body
#:datum-literals (splice)
#:attributes ((flatten 1))
(pattern (splice a:ppict-body ...)
#:attr (flatten 1)
(syntax->list #'(a.flatten ... ...)))
(pattern a
View mandelbrot.rkt
#lang typed/racket
(require pict3d)
(: aprox-mandel : (Natural -> (Dir -> Dir)))
(define ((aprox-mandel n) c)
(define Z (mandel c))
(let loop : Dir ([n : Natural n] [z_n : Dir zero-dir])
(if (zero? n)
(Z z_n)
View gist:c6870b42b4c33e3b8a6c
#lang racket
(define ns (make-base-namespace))
(namespace-attach-module (current-namespace) ''#%builtin ns)
(define args (contract (vectorof string?) (vector "a") 'pos 'neg))
(parameterize ([current-namespace ns])
(define current-args
(namespace-variable-value 'current-command-line-arguments ns))
(parameterize ([current-args args])
View gist:b1c9bcb3823fc5590e23
import java.lang.reflect.*;
import sun.misc.Unsafe;
public class Print {
static Unsafe u = getUnsafe();
public static void main(String... args) {
try {
long addr = u.staticFieldOffset(System.class.getDeclaredField("err")) +4;
View at-exp-slideshow-example.rkt
#lang at-exp slideshow
(require slideshow/code racket/draw)
(define (red t)
(color "darkmagenta" t))
(define (green t)
(color "olive" t))
(define (blue t)
(color "royalblue" t))
(define (color c t)
@florence
florence / silly.rkt
Created Feb 14, 2014
logic is silly
View silly.rkt
#lang racket
(require redex)
(current-cache-all? #t)
(define-language L
(e x t f (e ∧ e) (e ∨ e) (¬ e) (e → e))
(x variable-not-otherwise-mentioned))
(define-extended-language LC L
@florence
florence / soumyeahdood.rkt
Last active Dec 24, 2015
The parse function takes in a string. space, tabs, and newlines are ignored.
View soumyeahdood.rkt
#lang racket
(require parser-tools/lex
(prefix-in : parser-tools/lex-sre))
(define-lex-trans ::?
(lambda (stx)
(syntax-case stx ()
[(_ v b)
#'(:: v (:? " ") b)])))
You can’t perform that action at this time.