This file contains hidden or 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 send-exp racket | |
(require racket/draw) | |
(define-syntax-rule (build-path (p) body ...) | |
(let ((p (new dc-path%))) | |
body ... | |
p)) | |
(define (quarter-circle p cx cy quarter radius) |
This file contains hidden or 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 re- parser-tools/lex-sre) | |
parser-tools/yacc) | |
(provide (all-defined-out)) | |
(define-tokens a (NUM VAR)) | |
(define-empty-tokens b (+ - EOF LET IN)) | |
(define-lex-trans number | |
(syntax-rules () |
This file contains hidden or 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
module type CELL = sig | |
type 'a cell | |
type 'a exp | |
val return : 'a -> 'a exp | |
val (>>=) : 'a exp -> ('a -> 'b exp) -> 'b exp | |
val cell : 'a exp -> 'a cell exp | |
val get : 'a cell -> 'a exp |
This file contains hidden or 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
http://chronos-st.blogspot.com/2007/12/smalltalk-in-one-page.html | |
http://www.csci.csusb.edu/dick/samples/smalltalk.syntax.html | |
Formal EBNF Specification of Smalltalk Syntax | |
1. Character = ? Any Unicode character ?; | |
2. WhitespaceCharacter = ? Any space, newline or horizontal tab character ?; | |
3. DecimalDigit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"; | |
4. Letter = "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | |
| "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z" |
This file contains hidden or 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 pict/color) | |
(provide | |
(contract-out | |
[cat-silhouette | |
(->i ([width positive?] [height positive?]) | |
(#:left-ear-extent [left-ear-extent (>=/c 0)] | |
#:left-ear-arc [left-ear-arc (real-in 0 (* 2 pi))] | |
#:left-ear-angle [left-ear-angle (real-in 0 (* 2 pi))] |
This file contains hidden or 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 2d racket | |
(require 2d/match) | |
(define (fizz? n) | |
(zero? (modulo n 5))) | |
(define (buzz? n) | |
(zero? (modulo n 3))) |
This file contains hidden or 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 json racket/draw math/base) | |
(define (lat-lon->map-point coordinates) | |
(match-define (list lon lat _ ...) coordinates) | |
(define-values (x y) (values (degrees->radians lon) (asinh (tan (degrees->radians lat))))) | |
(list (/ (+ 1 (/ x pi)) 2) (/ (- 1 (/ y pi)) 2))) | |
(define (draw-polygon dc polygons) | |
(define path |
This file contains hidden or 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/base | |
;; License: Apache-2.0 | |
(require racket/draw | |
pict | |
racket/class | |
racket/math | |
racket/list | |
racket/contract) |
This file contains hidden or 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 plot) | |
(let ([blue '(0 0 164)] [red '(164 0 0)]) | |
(parameterize ([plot-decorations? #f]) | |
(plot3d | |
(list | |
(surface3d (λ(x y)(/ x 10)) 0 5 0 1 #:color red #:line-color red) | |
(surface3d (λ(x y)(- 1 (/ (+ 1 (exp (- 5 x)))))) 0 10 0 1 #:color blue #:line-color blue)) |
This file contains hidden or 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/base | |
(require racket/match racket/list racket/port racket/string | |
flomat) | |
;;; | |
;;; Homogeneous coordinates for 3 dimensions | |
;;; | |
; Follow the tutorial | |
; http://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices/ |