Skip to content

Instantly share code, notes, and snippets.

takikawa / gist:3422588
Created August 22, 2012 05:44
Persistent union-find
#lang racket
;; Persistent union-find from
(define-signature persistent-array^
(init get set))
(define-signature union-find^
(create find union))
takikawa / gist:4090648
Created November 16, 2012 20:32
#lang racket
;; asymmetric full coroutines from "Revisiting Coroutines"
(provide (contract-out
[create (-> procedure? coroutine?)]
[resume (->* (coroutine?) () #:rest (listof any/c) any)]
[yield (-> any/c any)]
[status (-> coroutine? (or/c 'running 'done 'suspended))]))
takikawa / gist:bd1cb0563bdf7a76cb88105b2e354b40
Created January 27, 2020 23:28
Size text picts based on slide size
#lang racket
(require racket/draw
;; Create a text pict that fits in target pixels of the slide
(define (auto-text str [style null] [target (* 0.8 client-w)] [angle 0])
(define initial-min 0)
(define initial-max 1000)
takikawa / gist:3995200
Created November 1, 2012 17:29
Generics blog example
#lang racket
;; Examples from the Racket blog post on generics
(require racket/generic
(provide gen:queue
GC: 0:min @ 1,451K(+164K)[+164K]; free 1,049K(-5,145K) 0ms @ 40
GC: 0:min @ 1,426K(+4,285K)[+168K]; free 686K(-686K) 0ms @ 44
GC: 0:min @ 1,993K(+3,718K)[+236K]; free 967K(-2,263K) 0ms @ 48
GC: 0:min @ 3,785K(+3,542K)[+248K]; free 1,408K(-1,408K) 0ms @ 56
GC: 0:min @ 5,027K(+2,732K)[+256K]; free 1,359K(-6,751K) 4ms @ 60
GC: 0:min @ 7,130K(+6,021K)[+276K]; free 1,913K(-3,209K) 4ms @ 72
GC: 0:min @ 9,977K(+4,470K)[+280K]; free 2,679K(-3,975K) 0ms @ 84
GC: 0:min @ 13,298K(+3,917K)[+288K]; free 3,163K(-16,747K) 4ms @ 96
GC: 0:min @ 16,686K(+14,113K)[+300K]; free 4,123K(-5,419K) 8ms @ 112
racket/contract: no late-neg-projection passed to build-contract-property
case $1 in
xclip -o -selection "clipboard" > /keybase/private/$USER/clipboard;;
xclip -i /keybase/private/$USER/clipboard -selection "clipboard";;
### Keybase proof
I hereby claim:
* I am takikawa on github.
* I am asumu ( on keybase.
* I have a public key ASBxw_jEWr8iVP6KFW1ckGVobdGsnbe0M9OdbCo41RNHZQo
To claim this, I am signing this object:
$ LD_LIBRARY_PATH="../src" ./pflua-compile --native "tcp"
mcode dump:
7f9f42a14000 4883FE22 cmp rsi, +0x22
7f9f42a14004 7C4E jl 0x7f9f42a14054
7f9f42a14006 480FB7470C movzx rax, word [rdi+0xc]
7f9f42a1400b 4883F808 cmp rax, +0x08
7f9f42a1400f 750D jnz 0x7f9f42a1401e
7f9f42a14011 480FB64F17 movzx rcx, byte [rdi+0x17]
7f9f42a14016 4883F906 cmp rcx, +0x06
7f9f42a1401a 743A jz 0x7f9f42a14056