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 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 |
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 | |
(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) |
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 | |
(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) |
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-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 |
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 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) |
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 | |
(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]) |
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
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; |
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 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) |
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 | |
(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 |
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 | |
(require parser-tools/lex | |
(prefix-in : parser-tools/lex-sre)) | |
(define-lex-trans ::? | |
(lambda (stx) | |
(syntax-case stx () | |
[(_ v b) | |
#'(:: v (:? " ") b)]))) |