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
; racket | |
(#%require srfi/69 srfi/23) | |
; chicken | |
;(require-extension (srfi 69)) | |
(define raise-user-error error) | |
(define apply-scm apply) | |
(define (new-eval exp env) | |
((analyze exp) env)) |
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
autoload -U add-zsh-hook | |
autoload colors | |
colors | |
function zsh_prompt_command() { | |
local pwdmaxlen=25 | |
local trunc_symbol=".." | |
local dir=${PWD##*/} | |
pwdmaxlen=$(( ( pwdmaxlen < ${#dir} ) ? ${#dir} : pwdmaxlen )) | |
NEW_PWD=${PWD/#$HOME/\~} |
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
thom /usr/local $ brew install -v icarus-verilog | |
==> Downloading ftp://ftp.icarus.com/pub/eda/verilog/v0.9/verilog-0.9.3.tar.gz | |
File already downloaded in /Users/thom/Library/Caches/Homebrew | |
/usr/bin/tar xf /Users/thom/Library/Caches/Homebrew/icarus-verilog-0.9.3.tar.gz | |
==> ./configure --disable-debug --disable-dependency-tracking --prefix=/usr/local/Cellar/icarus-verilog/0.9.3 | |
./configure --disable-debug --disable-dependency-tracking --prefix=/usr/local/Cellar/icarus-verilog/0.9.3 | |
checking build system type... i386-apple-darwin11.2.0 | |
checking host system type... i386-apple-darwin11.2.0 | |
checking for gcc... /usr/bin/llvm-gcc | |
checking for C compiler default output file name... a.out |
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
(define (new-bf) | |
(let ((tape (make-vector 30000 0))(ptr 0)) | |
(define (reset [sz 30000]) (set! tape (make-vector sz 0)) (set! ptr 0)) | |
(define (b>) (set! ptr (add1 ptr))) | |
(define (b<) (set! ptr (sub1 ptr))) | |
(define (b+) (vector-set! tape ptr (add1 (vector-ref tape ptr)))) | |
(define (b-) (vector-set! tape ptr (sub1 (vector-ref tape ptr)))) | |
(define (p) (write-byte (vector-ref tape ptr))) | |
(define (g) (vector-set! tape ptr (read-byte))) | |
(define ops `((#\..,p)(#\,.,g)(#\>.,b>)(#\<.,b<)(#\+.,b+)(#\-.,b-))) |
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
(((λ(_)((λ(.#)((λ(!)((λ(~)((λ(--)((λ(%)((λ(*)((λ($)((λ(d) | |
((λ(f)((λ(>)(f(λ(^)((> >)^))))(λ(>)(f(λ(^)((> >)^))))))(λ | |
(f)(λ(^)(let ~((< 0))(cond((>= <(_ ^))(void))((eq?(.# ^ < | |
)#\[)((λ(>)((λ(^)(let ~()(unless(= --(! $ *))(f ^)(~)))(~ | |
(+ > %)))(substring ^(+ % <)>)))((λ(o)((λ(f)(let ~((++ -- | |
)(f(+ f %)))((λ(<)(if(= <(- %))f(~ < (+ f %))))(case(.# o | |
f)((#\[)(+ % ++))((#\])(- ++ %))(else ++)))))<))^)))(#t(d | |
(.# ^ <))(~(+ % <)))))))))(λ(>)(cond((assoc >`((#\..,(λ @ | |
(write-byte(! $ *))))(#\,.,(λ()(~ $ *(read-byte))))(#\>., | |
(λ .(set! *(+ % *))))(#\<.,(λ()(set! *(- * %))))(#\+.,(λ( |
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/gui | |
(require data/queue) | |
(define snake% | |
(class object% | |
(super-new) | |
(init w h) | |
(define x (inexact->exact (floor (/ w 2)))) | |
(define y (inexact->exact (floor (/ h 2)))) | |
(define dir 'E) | |
(define body (let ((q (make-queue))) |
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
(define *theta-spacing* 0.07) | |
(define *phi-spacing* 0.02) | |
(define *screen-width* 300) | |
(define *screen-height* 240) | |
(define R1 1) | |
(define R2 2) | |
(define K2 5) | |
(define K1 (/ (* 3 K2 *screen-width*) (* 8 (+ R1 R2)))) | |
(define (clip n min max) (if (< n min) min (if (> n max) max n))) | |
(define donutcvs |
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/gui | |
(define (show-image-snip-in-new-frame snip) | |
(define bmp (send snip get-bitmap)) | |
(define f (new frame% [label "image snip"] | |
[width (send bmp get-width)] | |
[height (send bmp get-height)])) | |
(define c | |
(new canvas% | |
[paint-callback (λ (c dc) (send dc draw-bitmap bmp 0 0))] | |
[parent f])) |
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
(ns snake | |
(:import (java.awt Color Graphics Dimension Font) | |
(javax.swing JFrame JPanel) | |
(java.awt.event KeyEvent KeyAdapter))) | |
(def field [80 48]) ; [width height] | |
(def scale 10) | |
(def screen (Dimension. (* scale (field 0)) (* scale (field 1)))) | |
(def on? true) | |
(def tick-speed 100) |
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
(def sets | |
{:vowel #{:a :e :i :o :u} | |
:consonant #{:b :c :d :f :g :h :j} ; ... etc. | |
:other #{:y}}) | |
(defn categorize [thing] | |
(condp #(% %2) thing | |
(sets :vowel) :vowel | |
(sets :consonant) :consonant | |
(sets :other) :other |
OlderNewer