blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
171
content_id
stringlengths
40
40
detected_licenses
listlengths
0
8
license_type
stringclasses
2 values
repo_name
stringlengths
6
82
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
13 values
visit_date
timestamp[ns]
revision_date
timestamp[ns]
committer_date
timestamp[ns]
github_id
int64
1.59k
594M
star_events_count
int64
0
77.1k
fork_events_count
int64
0
33.7k
gha_license_id
stringclasses
12 values
gha_event_created_at
timestamp[ns]
gha_created_at
timestamp[ns]
gha_language
stringclasses
46 values
src_encoding
stringclasses
14 values
language
stringclasses
2 values
is_vendor
bool
2 classes
is_generated
bool
1 class
length_bytes
int64
4
7.87M
extension
stringclasses
101 values
filename
stringlengths
2
149
content
stringlengths
4
7.87M
has_macro_def
bool
2 classes
e48b2c4c86f73e6c3d95f0c4da2262967711fcdb
ffa71d65944d95401a8b625fc8ee7633fe41501d
/fast-math/test.rkt
4eabec05715c01749d6b6027539969ffe46b4035
[]
no_license
yuanchenyang/llvm-linear-algebra-dsl
2d54160ed5778075e44bb6698c1ab14ef98fcf5e
da540f8cd1929878e3c87d881deb6a11e4826cd4
refs/heads/master
2016-09-06T02:48:22.654229
2014-12-17T06:39:22
2014-12-17T06:39:22
39,935,881
2
0
null
null
null
null
UTF-8
Racket
false
false
1,290
rkt
test.rkt
#lang racket (require fast-math/nodes) (require fast-math/transforms) (require fast-math/matrix) (require fast-math/utils) (require fast-math/frontend) (require racket/pretty) (define env (make-hash (list (cons "a" (num 1)) (cons "b" (num 2)) (cons "m" (make-constant-matrix "m" '((1 2 3) (4 5 6))))))) (define test1 (add (symbol "a") (num 3))) (define test2 (add (symbol "b") (mul (symbol "a") (num 4)))) (define test3 (add (symbol "a") (array-reference (symbol "m") (add (num 2) (symbol "b"))))) (define test4 (let* ([i (symbol "i")] [t (symbol "t")] [ti (add i (num 1))] [m (symbol "m")] [mi (mul i (num 2))]) (for-unroll env i 2 0 -1 (list (assign (array-reference t ti) (add (num 3) (array-reference m mi))))))) ((constant-fold env) test1) ((constant-fold env) test2) ((constant-fold env) test3) (pretty-print test4) (let ([c (make-matrix "c" 10 10)] [d (make-constant-matrix "d" '((-1 0 1) (-2 0 2) (-1 0 1)))]) (pretty-print (convolve. c d))) (define (parity n1 n2) (= (modulo n1 2) (modulo n2 2))) (group-by parity '(1 3 5 2 4 1 2 3 4))
false
98b7969192ce750fb0e745c68e5b4892e5f97bea
5f8d781ca6e4c9d3d1c3c38d2c04e18d090589cc
/2/www/lectures/4/light-fun.rkt
ec867c8d480ab82e89ea9b349f671924922aea2c
[ "AFL-3.0", "AFL-2.1", "LicenseRef-scancode-unknown-license-reference" ]
permissive
plum-umd/fundamentals
a8458621131b864f0e3389b030c5197ea6bb3f41
eb01ac528d42855be53649991a17d19c025a97ad
refs/heads/master
2021-06-20T05:30:57.640422
2019-07-26T15:27:50
2019-07-26T15:27:50
112,412,388
12
1
AFL-3.0
2018-02-12T15:44:48
2017-11-29T01:52:12
Racket
UTF-8
Racket
false
false
900
rkt
light-fun.rkt
;; The first three lines of this file were inserted by DrRacket. They record metadata ;; about the language level of this file in a form that our tools can easily process. #reader(lib "htdp-intermediate-lambda-reader.ss" "lang")((modname light-fun) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f () #f))) ;; A Light is one of: ;; - "Red" ;; - "Green" ;; - "Yellow" ;; light-function : Light -> ??? (define (light-function l) (cond [(string=? "Red" l) ...] [(string=? "Green" l) ...] [(string=? "Yellow" l) ...])) ;; next : Light -> Light ;; Next light after the given light (check-expect (next "Green") "Yellow") (check-expect (next "Red") "Green") (check-expect (next "Yellow") "Red") (define (next l) (cond [(string=? "Red" l) "Green"] [(string=? "Green" l) "Yellow"] [(string=? "Yellow" l) "Red"]))
false
2aa47b14acb63c348c3b10492190d33285704702
5bbc152058cea0c50b84216be04650fa8837a94b
/paper/jfp-2016/appendix.rkt
fdc5e8621ad0444396568e7e956be5202b687ff2
[]
no_license
nuprl/gradual-typing-performance
2abd696cc90b05f19ee0432fb47ca7fab4b65808
35442b3221299a9cadba6810573007736b0d65d4
refs/heads/master
2021-01-18T15:10:01.739413
2018-12-15T18:44:28
2018-12-15T18:44:28
27,730,565
11
3
null
2018-12-01T13:54:08
2014-12-08T19:15:22
Racket
UTF-8
Racket
false
false
7,902
rkt
appendix.rkt
#lang racket/base (provide annotated-bib render-annotated-bib (rename-out [make-module-description module-description]) render-module-descriptions module render-pathologies ) (require (only-in racket/list add-between) (only-in racket/string string-join) (only-in gtp-summarize/modulegraph modulegraph->untyped-loc modulegraph->typed-loc boundaries boundary-to boundary-from boundary-provided*) racket/serialize with-cache "benchmark.rkt" "common.rkt" "typed-racket.rkt" ) ;; ============================================================================= (define month* '( "January" "February" "March" "April" "May" "June" "July" "August" "September" "October" "November" "December")) (struct abib [title author url date desc]) (define (abib<? ab1 ab2) (string<? (abib-date ab1) (abib-date ab2))) (define (abib->elem ab) (list (elem (noindent) (emph (abib-title ab)) (exact ".~~") (abib-author ab) (exact ".~~") (abib-date ab) (exact "\n\n") (noindent 1.2) (smaller (url (abib-url ab)))) #;(exact "\\vspace{-1ex}") #;(inset (abib-desc ab)))) (define (render-annotated-bib ab*) (cons (parag) (add-between (map abib->elem (sort ab* abib<?)) (parag)))) (define (annotated-bib #:title t #:author a #:url u #:date d . descr) (abib t a u d descr)) ;; ----------------------------------------------------------------------------- (define MODULES-TABLE-TITLE* '( "" "Untyped LOC" "Ann. LOC" "Adaptor?" "\\# Imports" "\\# Exports" )) (define (module-description<? m1 m2) (benchmark<? (car m1) (car m2))) (define (module name has-adaptor? . descr) (list* name has-adaptor? descr)) (define (make-module-description bm #:scale [scale 1] #:cache? [cache? #f] . m*-unsorted) (define name (benchmark-name bm)) (define m* (sort m*-unsorted string<? #:key car)) (define tikz (benchmark->tex-file bm scale)) (assert-module-names bm m*) (list* bm tikz cache? m*)) (define (assert-module-names bm m*) (define given-module-names (map car m*)) (define infer-module-names (sort (benchmark->module-names bm) string<?)) (unless (equal? given-module-names infer-module-names) (raise-user-error 'appendix "Expected '~a' modules do not match given.~n Expected: ~a~n Given: ~a" (benchmark-name bm) infer-module-names given-module-names))) (define (render-module-description md) (define bm (car md)) (define mg (benchmark-modulegraph bm)) (define B (boundaries mg)) (define tikz (cadr md)) (define cache? (caddr md)) (define m* (cdddr md)) ;; -- print: ;; benchmark-name (list (bold (symbol->string (benchmark-name bm))) (exact "\n\\vspace{-2ex}\n") (exact "\\begin{multicols}{2}\\begin{enumerate}\\setcounter{enumi}{-1}\n" (for/list ([m+a+d (in-list m*)]) (format "\\item {\\tt ~a}~n" (car m+a+d) #;(string-join (cddr m+a+d)))) "\\end{enumerate}\\end{multicols}") (exact "\n\\vspace{-1ex}\n") (parameterize ([*use-cache?* #f]) (render-table #:sep 0.5 #:title MODULES-TABLE-TITLE* #:cache (cachefile (format "module-table-~a.rktd" (benchmark-name bm))) (lambda () (for/list ([m+a+descr (in-list m*)] [i (in-naturals)]) (define m (car m+a+descr)) (define uloc (modulegraph->untyped-loc mg m)) (define tloc (modulegraph->typed-loc mg m)) (define ada? (cadr m+a+descr)) (define num-imports (for/sum ([b (in-list B)] #:when (string=? m (boundary-to b))) (length (boundary-provided* b)))) (define num-exports (for/sum ([b (in-list B)] #:when (string=? m (boundary-from b))) (length (boundary-provided* b)))) (tex-row (number->string i) (number->string uloc) (number->string (- tloc uloc)) (if ada? "\\checkmark" "") (number->string num-imports) (number->string num-exports)))))) (exact "\n\\vspace{-1ex}\n") (centered tikz) (exact "\n\\vspace{2ex}\n"))) (define (module-description? m) (and (pair? m) (benchmark? (car m)))) (define (render-module-descriptions . m*) (define key (for/list ([m (in-list m*)]) (if (module-description? m) (benchmark-name (car m)) 0))) (parameterize ([*current-cache-keys* (list (lambda () key))]) (with-cache (build-path "cache" "cache-modulegraph-appendix.rktd") #:read deserialize #:write serialize #:fasl? #f (lambda () (cons (noindent) (for/list ([m (in-list m*)]) (if (module-description? m) (render-module-description m) m))))))) (define (render-pathologies) (render-table new-pathologies #:title '("Benchmark" "Max Boundary" "Max Wraps" "Contract \\%" "Library \\%" "\\#GC") #:cache (build-path "cache" "cache-devils.rktd"))) (define (new-pathologies) (list ;; BM Most.Freq.B #|Most.Cost|# Most.Layr C% Lib.Time nGC (tex-row "{\\tt sieve}" "201,692,321" #| "X"|# "0" "59" "-" "4,705") (tex-row "{\\tt forth}" "16" #| "X"|# "3" "50" "-" "15") (tex-row "{\\tt fsm}" "361,100" #| "X"|# "4000" "25" "-" "2,329") (tex-row "{\\tt fsmoo}" "1,100" #| "X"|# "2" "93" "-" "856") (tex-row "{\\tt mbta}" "801" #| "X"|# "2" "27" "23" "38") (tex-row "{\\tt morsecode}" "821,060" #| "X"|# "2" "18" "-" "21") (tex-row "{\\tt zombie}" "13,502" #| "X"|# "67" "78" "-" "73") (tex-row "{\\tt dungeon}" "7,392" #| "X"|# "2" "84" "-" "28") (tex-row "{\\tt zordoz}" "116,167" #| "X"|# "2" "32" "6" "33") (tex-row "{\\tt lnm}" "13,064" #| "X"|# "2" "21" "96" "27") (tex-row "{\\tt suffixtree}" "145,826,484" #| "X"|# "2" "95" "-" "572") (tex-row "{\\tt kcfa}" "70,670" #| "X"|# "2" "79" "-" "8,485") (tex-row "{\\tt snake}" "18,856,600" #| "X"|# "2" "95" "-" "123") (tex-row "{\\tt take5}" "39,780" #| "X"|# "3" "66" "-" "42") (tex-row "{\\tt acquire}" "13,240" #| "X"|# "3" "40" "-" "20") (tex-row "{\\tt tetris}" "82,338,320" #| "X"|# "2" "89" "-" "212") (tex-row "{\\tt synth}" "445,637" #| "X"|# "13" "67" "-" "203") (tex-row "{\\tt gregor}" "925,521" #| "X"|# "2" "49" "5" "20") (tex-row "{\\tt quadBG}" "339,674" #| "X"|# "390" "60" "0" "69") (tex-row "{\\tt quadMB}" "281,030" #| "X"|# "543" "81" "0" "191"))) ;; ============================================================================= (module+ test (require rackunit) (define sieve-desc '(("main" "main module") ("stream" "library module"))) (test-case "assert-module-names" (check-equal? (assert-module-names sieve sieve-desc) (void)) (check-exn #rx"appendix" (lambda () (assert-module-names sieve '()))) (check-exn #rx"appendix" (lambda () (assert-module-names sieve (cons '("yo" "lo") sieve-desc))))) )
false
37110b1e4a12eca64d502b3061fdd9bbc78ce9dc
627680558b42ab91471b477467187c3f24b99082
/proposal/evaluation.rkt
a12108a695b693dfde69fc1c100fb8aef1c956fc
[]
no_license
bfetscher/dissertation
2a579aa919d6173a211560e20630b3920d108412
148d7f9bb21ce29b705522f7f4967d63bffc67cd
refs/heads/master
2021-01-12T12:57:45.507113
2016-10-06T06:54:21
2016-10-06T06:54:21
70,130,350
0
1
null
2016-10-06T14:01:38
2016-10-06T06:58:19
Racket
UTF-8
Racket
false
false
2,605
rkt
evaluation.rkt
#lang slideshow (require slideshow/play pict/balloon "plot-lines.rkt" "fades.rkt" ;(only-in "redex-typeset.rkt" freeze) (only-in plot plot-font-face plot-font-family)) (provide do-eval) (define (fade-out p) (cc-superimpose p (cellophane (colorize (filled-rectangle (pict-width p) (pict-height p)) "white") 0.6))) (define lp-pict (scale-to-fit line-plot-pict (- client-w margin margin) (- client-h margin margin))) (define enum-pict (scale-to-fit enum-plot-pict (- client-w margin margin) (- client-h margin margin))) (define lp-pict-2 (pin-over ;(fade-out lp-pict) lp-pict (/ (pict-width lp-pict) 10) (/ (pict-height lp-pict) 3) (faded-fade (scale (hc-append 20 (arrow 50 pi) (vl-append (t "7 Redex models") (t "43 bugs"))) 2) #:color "white" #:init 0.05 #:delta 2 #:grads 50))) (define palka-pict (bitmap "palka-etal.png")) (define (do-eval) (slide #:title "Grammar-based generation approaches" enum-pict) (slide #:title "Grammar-based generation approaches" (cb-superimpose enum-pict (faded-fade (vc-append (scale (hc-append 10 (hbl-append (t "10") (parameterize ([current-main-font (cons 'superscript (current-main-font))]) (t "-1"))) (scale (hc-append (arrow 20 pi) (arrow 20 0)) 7 2) (hbl-append (t "10") (parameterize ([current-main-font (cons 'superscript (current-main-font))]) (t "4")) )) 2) (blank 0 (/ (pict-height enum-pict) 10))) #:color "white" #:init 0.05 #:delta 2 #:grads 50))) (define comp-title "Derivation vs. ad-hoc generation") (slide #:title comp-title lp-pict) (for ([p (in-list line-plot-picts-with-intervals)]) (slide #:title comp-title (scale-to-fit p (- client-w margin margin) (- client-h margin margin)))))
false
e842f703096d3de1b671873b9f25791ac60829dc
80573ab25f4d751043daab38fb95038341dac5d9
/racket/progs/editor.rkt
a1365a8274854872bfeb2a133792e626a1dc5df5
[]
no_license
juliowaissman/tesis
cdd602e957623030402d98718b3992c81e8b4d9c
f94a140c64df49ddc27c4c3a731ba3ba9e5971ce
refs/heads/master
2021-01-15T13:06:38.684844
2016-08-16T23:12:40
2016-08-16T23:12:40
null
0
0
null
null
null
null
UTF-8
Racket
false
false
9,867
rkt
editor.rkt
;; -*- mode: racket; coding: utf-8 -*- #lang racket (require racket/gui/base pict pict/tree-layout pdf-read) ;;; Auxiliares str -> tex -> pdf -> pict (define *latex-template* "\\documentclass[preview]{standalone}\n\\usepackage{amsmath}\n\\begin{document}\n\\( ~a \\)\n\\end{document}") (define *latex-command* "pdflatex ~a") (define *temporary-filename* "temp") (define (latex-pict str) (define dir (make-temporary-file "latex~a" 'directory)) (dynamic-wind void (lambda () (parameterize ([current-directory dir] [current-input-port (open-input-bytes #"")] [current-output-port (open-output-string)]) (call-with-output-file* (string-append *temporary-filename* ".tex") #:exists 'truncate (lambda (p) (fprintf p *latex-template* str))) (unless (system (format *latex-command* (string-append *temporary-filename* ".tex"))) (display (get-output-string (current-output-port)) (current-error-port)) (error 'latex "La compilación a LaTeX ha fallado")) (page->pict (string-append *temporary-filename* ".pdf")))) (lambda () (delete-directory/files dir)))) ;;; (struct variable (nombre) #:transparent) (struct abstracción (argumento cuerpo) #:transparent) (struct aplicación (operador operando) #:transparent) (struct metainstrucción (nombre argumentos) #:transparent) (define (cursor-abajo #:cursor [cursor *cursor*]) (match cursor [(variable nombre) cursor] [(abstracción argumento cuerpo) cuerpo] [(aplicación operador operando) cursor] [else cursor])) (define (cursor-izquierda #:cursor [cursor *cursor*]) (match cursor [(variable nombre) cursor] [(abstracción argumento cuerpo) cursor] [(aplicación operador operando) operador] [else cursor])) (define (cursor-derecha #:cursor [cursor *cursor*]) (match cursor [(variable nombre) cursor] [(abstracción argumento cuerpo) cursor] [(aplicación operador operando) operando] [else cursor])) (define (cursor-arriba #:cursor [cursor *cursor*] #:raíz [raíz *expresión-actual*]) (define (recorre raíz) (cond [(variable? raíz) #f] [(abstracción? raíz) (if (eq? cursor (abstracción-cuerpo raíz)) raíz (recorre (abstracción-cuerpo raíz)))] [(aplicación? raíz) (if (or (eq? cursor (aplicación-operador raíz)) (eq? cursor (aplicación-operando raíz))) raíz (let ([prueba (recorre (aplicación-operador raíz))]) (if prueba prueba (recorre (aplicación-operando raíz)))))] [else #f])) (let ([resultado (recorre raíz)]) (if resultado resultado cursor))) (define *expresión-actual* (abstracción (variable "f") (aplicación (abstracción (variable "x") (aplicación (variable "f") (aplicación (variable "x") (variable "x")))) (abstracción (variable "x") (aplicación (variable "f") (aplicación (variable "x") (variable "x")))))) ) (define *cursor* (abstracción-cuerpo (aplicación-operando (abstracción-cuerpo *expresión-actual*)))) (define *expresión-figura-tex* (latex-pict "(\\lambda f.((\\lambda x.(f (x\\, x)))\\,(\\lambda x.(f (x\\, x)))))") ) (define (expresión->árbol e) (cond [(variable? e) (variable->árbol e)] [(abstracción? e) (abstracción->árbol e)] [(aplicación? e) (aplicación->árbol e)] [else (error 'expresión->árbol "No es una expresión" e)])) (define (variable->árbol v) (tree-layout #:pict (enmarcar (text (variable-nombre v)) #:border? #f #:color (if (eq? *cursor* v) "yellow" "white")))) (define (abstracción->árbol a) (tree-layout #:pict (enmarcar (text (string-append "λ " (variable-nombre (abstracción-argumento a)))) #:border? #t #:color (if (eq? *cursor* a) "yellow" "white")) (tree-edge #:edge-width 2 (expresión->árbol (abstracción-cuerpo a))))) (define (aplicación->árbol a) (tree-layout #:pict (filled-ellipse 10 10 #:draw-border? #t #:color (if (eq? *cursor* a) "yellow" "white") #:border-width 1) (tree-edge #:edge-width 2 (expresión->árbol (aplicación-operador a))) (tree-edge #:edge-width 2 (expresión->árbol (aplicación-operando a))))) (define (enmarcar x #:color [color "white"] #:border? [border? #t]) (define w (pict-width x)) (define h (pict-height x)) (define r (filled-rectangle (+ w 10) (+ h 10) #:draw-border? border? #:color color)) (pin-over r 5 5 x)) (define ventana (new frame% [label "Editor Lambda"] [width 800] [min-width 200] [height 600] [min-height 200])) (define panel (new vertical-panel% [parent ventana] [border 5] [spacing 5])) (define lienzo-árbol% (class canvas% (inherit refresh-now get-dc get-width get-height) (define minibuffer-run! #f) (define minibuffer-prompt (make-continuation-prompt-tag 'minibuffer)) (define-syntax-rule (with-minibuffer key e) (call-with-continuation-prompt (lambda () (if minibuffer-run! (minibuffer-run! key) e)) minibuffer-prompt)) (define (minibuffer-read prompt) (begin0 (call/cc (lambda (return-to-minibuffer-call) (define input-so-far "") (set! minibuffer-run! (lambda (key) (match (send key get-key-code) [#\return (return-to-minibuffer-call input-so-far)] [#\backspace (unless (string=? "" input-so-far) (set! input-so-far (substring input-so-far 0 (sub1 (string-length input-so-far)))))] [(and (? char? c) (or (? char-alphabetic?) (? char-numeric?))) (set! input-so-far (string-append input-so-far (string c)))] ['escape (set! minibuffer-run! #f) (set! input-so-far "[canceled]")] [_ (void)]) (format "~a > ~a" prompt input-so-far))) (abort-current-continuation minibuffer-prompt (lambda () (format "~a > " prompt)))) minibuffer-prompt) (set! minibuffer-run! #f))) (define/override (on-char key) (define new-status (with-minibuffer key (match (send key get-key-code) ['up (set! *cursor* (cursor-arriba)) "arriba"] ['down (set! *cursor* (cursor-abajo)) "abaho"] ['left (set! *cursor* (cursor-izquierda)) "izquierda"] ['right (set! *cursor* (cursor-derecha)) "derecha"] [#\e (minibuffer-read "Nombre de variable")] [#\q (exit 0)] [x (printf "Se capturó ~v\n" x) #f]))) (when new-status (send ventana set-status-text (format "~a" new-status))) ;(match (send key get-key-code) ; ['up (set! *cursor* (cursor-arriba))] ; ['down (set! *cursor* (cursor-abajo))] ; ['left (set! *cursor* (cursor-izquierda))] ; ['right (set! *cursor* (cursor-derecha))] ; [x (printf "Se capturó ~v\n" x)]) (refresh-now)) (define/override (on-paint) (define dc (get-dc)) (define figura (naive-layered (expresión->árbol *expresión-actual*))) (define fw (pict-width figura)) (define fh (pict-height figura)) (define lw (get-width)) (define lh (get-height)) (define escalada (if (< (- lw fw) (- lh fh)) (scale figura (* (/ lw fw) .9)) (scale figura (* (/ lh fh) .9)))) (define ew (pict-width escalada)) (define eh (pict-height escalada)) (draw-pict escalada dc (- (/ lw 2) (/ ew 2)) (- (/ lh 2) (/ eh 2)))) (super-new))) (define lienzo-árbol (new lienzo-árbol% [parent panel])) (send (send lienzo-árbol get-dc) set-smoothing 'smoothed) (define lienzo-tex% (class canvas% (inherit refresh-now get-dc get-width get-height) (define/override (on-paint) (define dc (get-dc)) (define figura *expresión-figura-tex*) (define escalada (let ([w (get-width)] [h (get-height)]) (if (< (+ w 40) (+ h 40)) (scale figura (/ (- w 40) (pict-width figura))) (scale figura (/ (- h 40) (pict-height figura)))))) (draw-pict escalada dc 20 20)) (super-new))) (define lienzo-salida (new lienzo-tex% [parent panel] [style '(hscroll no-focus)] [stretchable-height #f] [min-height 75])) (send (send lienzo-salida get-dc) set-smoothing 'smoothed) (send lienzo-salida init-auto-scrollbars 1280 900 0 0) (send ventana create-status-line) (send lienzo-árbol focus) (send ventana show #t)
true
f0e7dbdd1f7840c3a15228a32154ed745deb1728
56c5f129167943f60dab3a7256db3d0cf5be33cf
/libgit2/include/annotated_commit.rkt
4c8c52ada8d76b15e77ee69d10ca3232ead38003
[ "MIT" ]
permissive
guygastineau/libgit2
d21111384afbfe4068bd5f289bd1de811c94b93e
6d6a007543900eb7a6fbbeba55850288665bdde5
refs/heads/master
2022-12-12T15:21:28.849065
2019-05-06T20:59:17
2019-05-06T20:59:17
294,779,175
0
0
null
2020-09-11T18:26:21
2020-09-11T18:26:20
null
UTF-8
Racket
false
false
861
rkt
annotated_commit.rkt
#lang racket (require ffi/unsafe "define.rkt" "types.rkt" "utils.rkt") (provide (all-defined-out)) (define-libgit2/dealloc git_annotated_commit_free (_fun _annotated_commit -> _void)) (define-libgit2/alloc git_annotated_commit_from_fetchhead (_fun _annotated_commit _repository _string _string _oid -> _int) git_annotated_commit_free) (define-libgit2/alloc git_annotated_commit_from_ref (_fun _annotated_commit _repository _reference -> _int) git_annotated_commit_free) (define-libgit2/alloc git_annotated_commit_from_revspec (_fun _annotated_commit _repository _string -> _int) git_annotated_commit_free) (define-libgit2 git_annotated_commit_id (_fun _annotated_commit -> _oid)) (define-libgit2/alloc git_annotated_commit_lookup (_fun _annotated_commit _repository _oid -> _int) git_annotated_commit_free)
false
5ef43b63fd13fe37511479761de63ff7cb1e9b66
a284fc07c5857a716c891667617c53c968af97fe
/tests/struct/make.rkt
ed6e08fa32c547ffe1c27b4c8cbf7be9da03000e
[ "MIT" ]
permissive
gitter-badger/racketscript
1e9ba2ac378fd28b5dce766c7c9868a4e0968735
19753ccb6a1e17d9ea257ab63979efb051fbd553
refs/heads/master
2021-06-25T07:11:42.003970
2017-09-10T01:37:56
2017-09-10T01:37:56
null
0
0
null
null
null
null
UTF-8
Racket
false
false
249
rkt
make.rkt
#lang racket (provide (struct-out posn) posn0) (struct posn (x y)) (struct posn0 (x y) #:transparent) (define pa (posn 0 1)) (displayln (posn-x pa)) (displayln (posn-y pa)) (define pb (posn0 1 2)) (equal? (posn0 1 2) pb) (displayln pb)
false
fc9f8bf156f1b8a014d536e654ef5dd90c0d796e
5bbc152058cea0c50b84216be04650fa8837a94b
/pre-benchmark/ecoop/typed-db/private/generic/prepared.rkt
60e386ca510afac08bbbd36a956cc500aade28e9
[]
no_license
nuprl/gradual-typing-performance
2abd696cc90b05f19ee0432fb47ca7fab4b65808
35442b3221299a9cadba6810573007736b0d65d4
refs/heads/master
2021-01-18T15:10:01.739413
2018-12-15T18:44:28
2018-12-15T18:44:28
27,730,565
11
3
null
2018-12-01T13:54:08
2014-12-08T19:15:22
Racket
UTF-8
Racket
false
false
4,653
rkt
prepared.rkt
#lang racket/base (require racket/class "interfaces.rkt" "sql-data.rkt") (provide prepared-statement% statement:after-exec apply-type-handlers) ;; A dvec is an opaque value that describes a parameter or result field's type ;; information. (Usually a vector, thus "dvec" for "description vector".) ;; prepared-statement% (define prepared-statement% (class* object% (prepared-statement<%>) (init ([-owner owner])) (init-field handle ;; handle, determined by database system, #f means closed close-on-exec? ;; boolean param-typeids ;; (listof typeid) result-dvecs ;; (listof dvec) [stmt #f] ;; string/#f [stmt-type #f]) ;; usually symbol or #f (see classify-*-sql) (define owner (make-weak-box -owner)) (define dbsystem (send -owner get-dbsystem)) (define param-handlers (send dbsystem get-parameter-handlers param-typeids)) (define result-typeids (send dbsystem field-dvecs->typeids result-dvecs)) (define/public (get-handle) handle) (define/public (set-handle h) (set! handle h)) (define/public (get-close-on-exec?) close-on-exec?) (define/public (after-exec need-lock?) (when close-on-exec? ;; indicates ad-hoc prepared statement (finalize need-lock?))) (define/public (get-stmt) stmt) (define/public (get-stmt-type) stmt-type) (define/public (get-param-count) (length param-typeids)) (define/public (get-param-typeids) param-typeids) (define/public (get-result-dvecs) result-dvecs) (define/public (get-result-count) (length result-dvecs)) (define/public (get-result-typeids) result-typeids) (define/public (get-param-types) (send dbsystem describe-params param-typeids)) (define/public (get-result-types) (send dbsystem describe-fields result-dvecs)) ;; checktype is either #f, 'rows, or exact-positive-integer (define/public (check-results fsym checktype obj) (cond [(eq? checktype 'rows) (unless (positive? (get-result-count)) (when close-on-exec? (finalize #t)) (error/want-rows fsym obj #f))] [(exact-positive-integer? checktype) (unless (= (get-result-count) checktype) (when close-on-exec? (finalize #t)) (error/column-count fsym obj checktype (get-result-count) #f))] [else (void)])) (define/public (check-owner fsym c obj) (unless handle (error fsym "prepared statement is closed")) (unless (object=? c (weak-box-value owner)) (error fsym "prepared statement owned by another connection"))) (define/public (bind fsym params) (statement-binding this (apply-type-handlers fsym params param-handlers))) (define/public (finalize need-lock?) (when handle (let ([owner (weak-box-value owner)]) (when owner (send owner free-statement this need-lock?))))) (define/public (register-finalizer) (thread-resume finalizer-thread (current-thread)) (will-register will-executor this (lambda (pst) (send pst finalize #t)))) (super-new) (register-finalizer))) (define (statement:after-exec stmt need-lock?) (when (statement-binding? stmt) (send (statement-binding-pst stmt) after-exec need-lock?))) (define (apply-type-handlers fsym params param-handlers) (let ([given-len (length params)] [expected-len (length param-handlers)]) (when (not (= given-len expected-len)) (error/stmt-arity fsym expected-len given-len))) (for/list ([handler (in-list param-handlers)] [param (in-list params)]) (cond [(sql-null? param) sql-null] [else (handler fsym param)]))) ;; ---- (define will-executor (make-will-executor)) (define finalizer-thread ;; Set parameters for the new thread to avoid references to the ;; namespace, since prepared statements may be bound to globals, etc. (parameterize ([current-namespace (make-empty-namespace)]) (thread/suspend-to-kill (lambda () (let loop () (with-handlers ([(lambda (e) #t) (lambda (e) ((error-display-handler) (cond [(exn? e) (format "prepared statement finalizer thread handled exception:\n~a" (exn-message e))] [else "prepared statement finalizer thread handled non-exception"]) e))]) (will-execute will-executor)) (loop))))))
false
e9cc19f88366c8b9bdd2504a19ff4ca4c025461d
f81291c4468fe97425c75c1c6653030f486f72da
/parser-test.rkt
a42bfa71752c1fa8609099ab743c0c3859d9fded
[]
no_license
zkry/experimentfile
35710b45dedf996c947cc421ff1f336a14b3e9d8
dc410ea3a3eb25ea1108d1e2eec9ef776459daab
refs/heads/master
2020-08-31T17:08:56.091224
2019-11-06T08:55:17
2019-11-06T08:55:17
218,740,108
1
0
null
null
null
null
UTF-8
Racket
false
false
1,014
rkt
parser-test.rkt
#lang br (require "parser.rkt" "lexer.rkt" "expander.rkt" brag/support (for-syntax syntax/parse)) (define str #<<HERE experiment MyExpA: b = 2 * 3 * 4 y := [1, 2.0, 3.0] z := [0 to 10 step 1] subexperiment Sub1: a := 0.0 subexperiment Sub2: a := 1.0 subexperiment Sub3: a := 2.0 distribution: [[20 MyExpA] [20 MyExpB]] by "UUID" experiment MyExpA: b = 2 y := b z := b a := 0 HERE ) (define simple #<<HERE package bid_price experiment MyExperimentA: alpha := [1ms to 10ms step 1ms] message := "hello world" distribution: 10: MyExperimentA when `always` HERE ) (lex-experiment (open-input-string simple)) (define ast (parse-to-datum (lex-experiment (open-input-string simple)))) (begin-for-syntax (require racket/list) (define (find-unique-var-ids stmt-stxs) (remove-duplicates (for/list ([stx (in-list (stx-flatten stmt-stxs))] #:when (syntax-property stx 'e-id)) stx) #:key syntax->datum)))
false
00315ab3d211a43470811834c85a0005b456fa0f
4cc0edb99a4c5d945c9c081391ae817b31fc33fd
/paint-by-numbers/paint-by-numbers.rkt
ae6bb421aa7ce3ddacb998d8b2f8c2fb034bd58b
[ "Apache-2.0", "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
racket/games
c8eaa92712405890cd1db19b8ba32b1620d885b8
eba5c6fa54c524871badb8b0e205fe37640d6c3e
refs/heads/master
2023-08-19T00:41:23.930448
2023-07-24T23:29:05
2023-07-24T23:29:05
27,138,761
54
33
NOASSERTION
2020-05-04T13:46:50
2014-11-25T17:59:40
Racket
UTF-8
Racket
false
false
18,773
rkt
paint-by-numbers.rkt
#lang racket/base (require "gui.rkt" (prefix-in solve: "solve.rkt") "all-problems.rkt" "problem.rkt" "../show-scribbling.rkt" framework racket/gui) (provide game@) (application-preferences-handler void) ;; reset this after the framework sets it. ;; we don't want to open the preferences window, ;; because other games then cannot call ;; preferences:set-default (define default-font (send the-font-list find-or-create-font 10 'roman 'normal 'normal #f)) (preferences:set-default 'paint-by-numbers:font default-font (lambda (f) (is-a? f font%))) (preferences:set-un/marshall 'paint-by-numbers:font (lambda (font) (list (send font get-point-size) (send font get-family) (send font get-style) (send font get-weight) (send font get-underlined))) (lambda (lst) (let ([size (first lst)] [family (second lst)] [style (third lst)] [weight (fourth lst)] [underline (fifth lst)]) (cond [(and (number? size) (<= 1 size 72) (memq family '(default decorative roman script swiss modern symbol system)) (memq style '(normal italic slant)) (memq weight '(normal bold light)) (boolean? underline)) (or (send the-font-list find-or-create-font size family style weight underline) default-font)] [else default-font])))) (define problems (car problemss)) (define game-name "Paint by Numbers") (define editor-name "Paint by Numbers Designer") (define biggest-editor 35) (define (setup-progress max) (let* ([e (make-eventspace)] [f (parameterize ([current-eventspace e]) (make-object frame% "Solver Setup Progress"))] [g (make-object gauge% #f max f)] [counter 0]) (send g min-width 300) (send f show #t) (lambda () (set! counter (+ 1 counter)) (cond [(= counter max) (collect-garbage) (send f show #f)] [else (send g set-value counter)])))) (define show-this-help (show-scribbling '(lib "games/scribblings/games.scrbl") "paint-by-numbers")) (define (configure-font frame) (let ([font (get-font-from-user "Choose a font for the labels" frame (preferences:get 'paint-by-numbers:font))]) (when font (preferences:set 'paint-by-numbers:font font)))) (define (size-font inc) (let ([old-font (preferences:get 'paint-by-numbers:font)]) (preferences:set 'paint-by-numbers:font (if (send old-font get-face) (send the-font-list find-or-create-font (inc (send old-font get-point-size)) (send old-font get-face) (send old-font get-family) (send old-font get-style) (send old-font get-weight) (send old-font get-underlined)) (send the-font-list find-or-create-font (inc (send old-font get-point-size)) (send old-font get-family) (send old-font get-style) (send old-font get-weight) (send old-font get-underlined)))))) (define (add-font-items frame menu) (make-object menu-item% "Choose Font" menu (lambda x (configure-font frame))) (make-object menu-item% "Make Board Bigger" menu (lambda x (size-font add1)) #\b) (make-object menu-item% "Make Board Tinier" menu (lambda x (size-font sub1)) #\t)) (define generic-frame% (class (frame:standard-menus-mixin frame:basic%) (inherit set-label get-label get-area-container) (define filename #f) (define/override (edit-menu:create-preferences?) #f) ;; don't open the preferences window, ;; because other games then cannot call ;; preferences:set-default (define/override (edit-menu:preferences-callback item control) (void)) [define/public update-filename (lambda (new-name) (set! filename new-name) (let* ([short-name (if new-name (let-values ([(_1 name _2) (split-path new-name)]) name) #f)] [new-label (if short-name (format "~a - ~a" short-name (get-label)) game-name)]) (unless (string=? new-label (get-label)) (set-label new-label))))] [define/public get-pbn-filename (lambda () filename)] [define/public (do-save) (void)] [define/public (get-canvas) (void)] [define/private save-as (lambda () (let ([fn (put-file)]) (when fn (update-filename fn) (do-save))))] [define/override file-menu:new-string (lambda () "New Puzzle")] [define/override file-menu:new-callback (lambda (_1 _2) (player))] [define/override file-menu:between-new-and-open (lambda (menu) (make-object menu-item% "Design a Puzzle..." menu (lambda (_1 _2) (editor #f))) (make-object menu-item% "Design a Puzzle from a Bitmap..." menu (lambda (_1 _2) (editor #t))) ;(make-object separator-menu-item% menu) )] [define/override file-menu:save-callback (lambda (_1 _2) (if filename (do-save) (save-as)))] [define/override file-menu:save-as-callback (lambda (_1 _2) (save-as))] [define/override file-menu:open-callback (lambda (_1 _2) (let ([fn (get-file)]) (when fn (let* ([state (call-with-input-file fn read)] [type (car state)]) (case type [(editor) (let* ([name (cadr state)] [problem (make-problem name (caddr state) (cadddr state) (list->vector (map list->vector (car (cddddr state)))))]) (editor problem))] [(player) (let* ([name (cadr state)] [problem (make-problem name (caddr state) (cadddr state) (car (cddddr state)))]) (player problem (cadr (cddddr state))))] [else (message-box "Error" (format "Unknown save file ~a" fn))])))))] [define/override edit-menu:undo-callback (lambda (_1 _2) (send (get-canvas) undo))] [define/override edit-menu:redo-callback (lambda (_1 _2) (send (get-canvas) redo))] (super-new (style '(no-resize-border))) [field [top-panel (make-object horizontal-panel% (get-area-container))] [help-button (make-object button% "Help" top-panel (lambda (_1 _2) (show-this-help)))]] (send top-panel stretchable-height #f) (send top-panel set-alignment 'right 'center))) (define pbn-frame% (class generic-frame% (init-field (problem (car problems))) (inherit get-pbn-filename) [define/override do-save (lambda () (call-with-output-file (get-pbn-filename) (lambda (port) (pretty-print (list 'player (problem-name problem) (problem-rows problem) (problem-cols problem) (problem-solution problem) (send canvas get-grid)) port)) 'truncate 'text))] (inherit can-close? show) (inherit stretchable-width stretchable-height update-filename) [define/private set-problem (lambda (prlmb) (update-filename #f) (send wrong-item enable (problem-solution prlmb)) (send editor-item enable (problem-solution prlmb)) (let ([rows (problem-rows prlmb)] [cols (problem-cols prlmb)]) (set! problem prlmb) (when canvas (send canvas close-up)) (set! canvas (instantiate paint-by-numbers-canvas% () (parent canvas-panel) (row-numbers rows) (col-numbers cols))) (send canvas-panel change-children (lambda (l) (list canvas)))) (stretchable-width #f) (stretchable-height #f))] [define/private show-wrong (lambda () (let loop ([i (length (problem-cols problem))]) (unless (zero? i) (let loop ([j (length (problem-rows problem))]) (unless (zero? j) (let* ([m (- i 1)] [n (- j 1)] [board-entry (get-entry m n)] [real-answer (vector-ref (vector-ref (problem-solution problem) m) n)]) (unless (or (eq? board-entry real-answer) (eq? board-entry 'unknown) (eq? real-answer 'unknown)) (send canvas set-to-error m n))) (loop (- j 1)))) (loop (- i 1)))))] [define/private get-entry (lambda (i j) (send canvas get-rect i j))] [define/private set-entry (lambda (i j nv) (send canvas set-and-paint-rect i j nv))] (define/private (solve) (send canvas all-unknown) (send canvas on-paint) (solve:solve (problem-rows problem) (problem-cols problem) (lambda (i j nv) (set-entry i j nv)) setup-progress)) (super-new (label game-name)) [define wrong-item #f] [define solve-item #f] [define editor-item #f] (inherit get-menu-bar) (let* ([mb (get-menu-bar)] [pbn-menu (make-object menu% "Nonogram" mb)]) (set! solve-item (make-object menu-item% "Solve" pbn-menu (lambda (_1 _2) (solve)) #\l)) (set! wrong-item (make-object menu-item% "Show Mistakes" pbn-menu (lambda (_1 _2) (show-wrong)) #\h)) (set! editor-item (make-object menu-item% "Edit this Puzzle" pbn-menu (lambda (_1 _2) (editor problem)))) (make-object separator-menu-item% pbn-menu) (add-font-items this pbn-menu)) (inherit-field top-panel help-button) (inherit get-area-container) [define gap (make-object horizontal-panel% top-panel)] [define set-choice (make-object choice% "Set" set-names top-panel (lambda (choice evt) (set! problems (list-ref problemss (send choice get-selection))) (send board-choice clear) (for-each (lambda (problem) (send board-choice append (problem-name problem))) problems) (set-problem (car problems))))] [define board-choice (make-object choice% "Board" (map problem-name problems) top-panel (lambda (choice evt) (set-problem (list-ref problems (send choice get-selection)))))] [define canvas/spacer-panel (make-object horizontal-panel% (get-area-container))] [define canvas-panel (make-object vertical-pane% canvas/spacer-panel)] [define canvas #f] (send top-panel change-children (lambda (l) (list set-choice board-choice gap help-button))) (define/override get-canvas (lambda () canvas)) (define/augment on-close (lambda () (inner (void) on-close) (when canvas (send canvas close-up)))) (set-problem problem) (show #t))) (define editor-frame% (class generic-frame% (init-field indicator) (inherit get-pbn-filename) [define/override do-save (lambda () (let ([fn (get-pbn-filename)]) (call-with-output-file fn (lambda (port) (pretty-print (list 'editor (let-values ([(base name dir?) (split-path fn)]) name) (send canvas get-row-numbers) (send canvas get-col-numbers) (let ([grid (send canvas get-grid)]) (map (lambda (l) (map (lambda (x) (if (eq? x 'on) 'on 'off)) l)) grid))) port)) 'truncate 'text)))] [define/private test-puzzle (lambda () (player (make-problem "<editor test>" (send canvas get-row-numbers) (send canvas get-col-numbers) (send canvas get-grid))))] [define canvas #f] [define/override get-canvas (lambda () canvas)] [define/augment on-close (lambda () (inner (void) on-close) (when canvas (send canvas close-up)))] (super-instantiate () (label editor-name)) (inherit get-area-container) [define space/canvas-panel (make-object horizontal-panel% (get-area-container))] [define canvas-panel (make-object vertical-pane% space/canvas-panel)] (cond [(pair? indicator) (when canvas (send canvas close-up)) (set! canvas (instantiate design-paint-by-numbers-canvas% () (parent canvas-panel) (width (car indicator)) (height (cdr indicator))))] [(is-a? indicator bitmap%) (when canvas (send canvas close-up)) (set! canvas (instantiate design-paint-by-numbers-canvas% () (parent canvas-panel) (width (min biggest-editor (send indicator get-width))) (height (min biggest-editor (send indicator get-height))))) (when (or (> (send indicator get-width) biggest-editor) (> (send indicator get-height) biggest-editor)) (message-box "Paint by Numbers" (format "WARNING: Bitmap is larger than ~ax~a. Truncating." biggest-editor biggest-editor))) (send canvas set-bitmap indicator)] [(problem? indicator) (when canvas (send canvas close-up)) (set! canvas (instantiate design-paint-by-numbers-canvas% () (parent canvas-panel) (width (length (problem-cols indicator))) (height (length (problem-rows indicator))))) (send canvas set-grid (map vector->list (vector->list (problem-solution indicator))))]) (inherit get-menu-bar) (let* ([mb (get-menu-bar)] [pbn-menu (make-object menu% "Nonogram" mb)]) (make-object menu-item% "Test Puzzle" pbn-menu (lambda (_1 _2) (test-puzzle))) (make-object separator-menu-item% pbn-menu) (add-font-items this pbn-menu)))) (define (editor bitmap?) (let* ([default 15] [get-sizes (lambda () (let* ([d (make-object dialog% "Size")] [m (make-object message% "How big should the designer be?" d)] [wp (make-object horizontal-panel% d)] [wm (make-object message% "Width" wp)] [gw (make-object slider% #f 1 biggest-editor wp void default)] [hp (make-object horizontal-panel% d)] [hm (make-object message% "Height" hp)] [gh (make-object slider% #f 1 biggest-editor hp void default)] [bp (make-object horizontal-panel% d)] [cancelled? #f] [cancel (make-object button% "Cancel" bp (lambda (_1 _2) (set! cancelled? #t) (send d show #f)))] [ok (make-object button% "OK" bp (lambda (_1 _2) (send d show #f)) '(border))]) (let ([label-width (max (send wm get-width) (send hm get-width))]) (send wm min-width label-width) (send hm min-width label-width)) (send bp set-alignment 'right 'center) (send d show #t) (if cancelled? #f (cons (send gw get-value) (send gh get-value)))))] [get-bitmap (lambda () (let* ([fn (get-file "Select a bitmap")] [bm (make-object bitmap% fn)]) (if (send bm ok?) bm (begin (message-box "Paint by Numbers" (format (format "Unreadable file: ~a" fn))) #f))))] [indicator (cond [(boolean? bitmap?) (if bitmap? (get-bitmap) (get-sizes))] [(problem? bitmap?) bitmap?])]) (when indicator (send (make-object editor-frame% indicator) show #t)))) (define player (case-lambda [() (player (car problems))] [(problem) (let ([f (instantiate pbn-frame% () (problem problem))]) (send f show #t))] [(problem state) (let ([f (instantiate pbn-frame% () (problem problem))]) (send (send f get-canvas) set-grid state) (send f show #t))])) (define game@ (unit (import) (export) (player) ;(editor #f) ))
false
281914faf07c7c70f4a0de840dc8959726b8e8d4
dce2cc91b7c1bbd4569b18302737af8072b11c94
/code/laci/prop-proust.rkt
abb27d41607f6575e182f614e4c483a949c7e444
[ "MIT" ]
permissive
benknoble/junk-drawer
42126590c21cdfffd836c40b5e78de9c77a90616
4af03c47da24c5275d28143da03a86f0059baf6d
refs/heads/master
2023-05-13T01:13:49.609283
2023-05-03T16:38:33
2023-05-03T16:38:33
70,744,626
2
0
MIT
2023-05-01T22:00:03
2016-10-12T21:49:46
Java
UTF-8
Racket
false
false
8,759
rkt
prop-proust.rkt
#lang racket (provide (all-defined-out)) (require syntax/parse/define) ;; terms (struct lam (var body) #:transparent) (struct fapp (rator rand) #:transparent) (struct ann (expr type) #:transparent) (struct hole (index) #:transparent) (struct and-intro (elim0 elim1) #:transparent) (struct and-elim0 (prod) #:transparent) (struct and-elim1 (prod) #:transparent) (struct or-left (e) #:transparent) (struct or-right (e) #:transparent) (struct or-elim (t f g) #:transparent) (struct ! (e) #:transparent) ;; types (struct arrow (domain range) #:transparent) (struct prod (left right) #:transparent) (struct sum (left right) #:transparent) (struct bot () #:transparent) ;; state! (define current-expr #f) (define goal-table (make-hash)) (define c 0) (define (counter) (begin0 c (set! c (add1 c)))) (define refining (make-parameter #f #f 'refining)) (define parse-expr (match-lambda [`? (hole #f)] [(? symbol? x) x] [`(lambda ,x ,e) (parse-expr `(λ ,x ,e))] [`(λ ,(? symbol? x) ,e) (lam x (parse-expr e))] [`(,(or `and-intro `*-intro `∧-intro) ,p ,q) (and-intro (parse-expr p) (parse-expr q))] [`(,(or `and-elim0 `*-elim0 `∧-elim0) ,x) (and-elim0 (parse-expr x))] [`(,(or `and-elim1 `*-elim1 `∧-elim1) ,x) (and-elim1 (parse-expr x))] [`(,(or `or-left `+-left `∨-left) ,x) (or-left (parse-expr x))] [`(,(or `or-right `+-right `∨-right) ,x) (or-right (parse-expr x))] [`(,(or `or-elim `+-elim `∨-elim) ,t ,f ,g) (or-elim (parse-expr t) (parse-expr f) (parse-expr g))] [`(! ,e) (! (parse-expr e))] [`(,rat ,ran) (fapp (parse-expr rat) (parse-expr ran))] [`(,e : ,t) (ann (parse-expr e) (parse-type t))] [`(,rat ,ran ,rest ..1) (parse-expr `((,rat ,ran) ,@rest))])) (define parse-type (match-lambda [(or `False `false `bot `⊥) (bot)] [(? symbol? x) x] [`(,dom -> ,ran) (arrow (parse-type dom) (parse-type ran))] [`(,dom -> ,ran -> ,rest ...) (arrow (parse-type dom) (parse-type `(,ran -> ,@rest)))] [`(,p ,(or `prod `* `∧) ,q) (prod (parse-type p) (parse-type q))] [`(,p ,(or `sum `+ `∨) ,q) (sum (parse-type p) (parse-type q))] [`(,(or `not `neg `¬) ,p) (parse-type `(,p -> False))])) (define pp-expr (match-lambda [(? symbol? x) (~a x)] [(lam x b) (format "(λ ~a ~a)" x (pp-expr b))] [(fapp f x) (format "(~a ~a)" (pp-expr f) (pp-expr x))] [(ann e t) (format "(~a : ~a)" (pp-expr e) (pp-type t))] [(and-intro p q) (format "(and-intro ~a ~a)" (pp-expr p) (pp-expr q))] [(and-elim0 x) (format "(and-elim0 ~a)" (pp-expr x))] [(and-elim1 x) (format "(and-elim1 ~a)" (pp-expr x))] [(or-left x) (format "(or-left ~a)" (pp-expr x))] [(or-right x) (format "(or-right ~a)" (pp-expr x))] [(or-elim t f g) (format "(or-elim ~a ~a ~a)" (pp-expr t) (pp-expr f) (pp-expr g))] [(! e) (format "(! ~a)" (pp-expr e))] [(hole n) (format "?~a" n)])) (define pp-type (match-lambda [(? symbol? x) (~a x)] [(arrow p (bot)) (format "(not ~a)" (pp-type p))] [(arrow dom ran) (format "(~a -> ~a)" (pp-type dom) (pp-type ran))] [(prod p q) (format "(~a * ~a)" (pp-type p) (pp-type q))] [(sum p q) (format "(~a + ~a)" (pp-type p) (pp-type q))] [(bot) (format "False")])) (define (pp-ctx ctx) (string-append* (hash-map ctx (λ (e t) (format "~a: ~a\n" (pp-expr e) (pp-type t)))))) (define/match (type-check ctx expr type) [(_ (lam x b) (arrow dom ran)) (type-check (hash-set ctx x dom) b ran)] [(_ (hole n) _) (when (refining) (hash-set! goal-table n (cons type ctx))) #t] [(_ (and-intro p q) (prod P Q)) (and (type-check ctx p P) (type-check ctx q Q))] [(_ (or-left p) (sum P _)) (type-check ctx p P)] [(_ (or-right q) (sum _ Q)) (type-check ctx q Q)] [(_ (or-elim (app (curry type-synth ctx) (sum P Q)) f g) R) (and (type-check ctx f (arrow P R)) (type-check ctx g (arrow Q R)))] [(_ (! t) T) (type-check ctx t (bot))] ;; type-synth in the pattern, so needs to come later [(_ (app (curry type-synth ctx) type) type) #t]) (define (type-synth ctx expr) (match expr [(? symbol? x) (hash-ref ctx x)] [(ann e t) (type-check ctx e t) t] [(and-elim0 (app (curry type-synth ctx) (prod t _))) t] [(and-elim1 (app (curry type-synth ctx) (prod _ u))) u] [(fapp (app (curry type-synth ctx) (arrow dom ran)) x) #:when (type-check ctx x dom) ran])) (module+ test (require rackunit) (define (check-tauto p) (check-not-exn (thunk (type-synth (hash) (parse-expr p))))) (check-tauto '((λ x (λ y x)) : (A -> (B -> A)))) (check-tauto '((λ x (λ y x)) : (A -> B -> A))) (check-tauto '((λ x (λ y (y x))) : (A -> ((A -> B) -> B))))) (define (print-task) (printf "~a\n" (pp-expr current-expr))) (define print-goal (case-lambda [() (hash-for-each goal-table (λ (n _) (print-goal n)))] [(n) (match-define `(,type . ,ctx) (hash-ref goal-table n)) (printf "Goal ~a has type ~a\n" n (pp-type type)) (unless (hash-empty? ctx) (printf "in context\n~a" (pp-ctx ctx)))])) (define (set-task! goal) (define type (parse-type goal)) (set! current-expr (ann (hole 0) type)) (set! goal-table (make-hash (list (cons 0 (cons type (hash)))))) (set! c 1) (printf "Current task:\n") (print-task)) ;; main interaction with prover (define (refine n subst) (match-define `(,type . ,ctx) (hash-ref goal-table n)) (define e (parse-expr subst)) (type-check ctx e type) (define en (number-new-holes e)) (parameterize ([refining #t]) (type-check ctx en type)) (hash-remove! goal-table n) (set! current-expr (replace-goal-with n en current-expr)) (define goals (hash-count goal-table)) (printf "Current task with ~a goal~a:\n" goals (if (= 1 goals) "" "s")) (print-task) (print-goal)) (define number-new-holes (match-lambda [(lam x b) (lam x (number-new-holes b))] [(fapp f x) (fapp (number-new-holes f) (number-new-holes x))] [(ann e t) (ann (number-new-holes e) t)] [(and-intro p q) (and-intro (number-new-holes p) (number-new-holes q))] [(and-elim0 x) (and-elim0 (number-new-holes x))] [(and-elim1 x) (and-elim1 (number-new-holes x))] [(or-left x) (or-left (number-new-holes x))] [(or-right x) (or-right (number-new-holes x))] [(or-elim t f g) (or-elim (number-new-holes t) (number-new-holes f) (number-new-holes g))] [(! e) (! (number-new-holes e))] [(hole #f) (hole (counter))] [x x])) (define (replace-goal-with n repl e) (match e [(lam x b) (lam x (replace-goal-with n repl b))] [(fapp f x) (fapp (replace-goal-with n repl f) (replace-goal-with n repl x))] [(ann e t) (ann (replace-goal-with n repl e) t)] [(and-intro p q) (and-intro (replace-goal-with n repl p) (replace-goal-with n repl q))] [(and-elim0 x) (and-elim0 (replace-goal-with n repl x))] [(and-elim1 x) (and-elim1 (replace-goal-with n repl x))] [(or-left x) (or-left (replace-goal-with n repl x))] [(or-right x) (or-right (replace-goal-with n repl x))] [(or-elim t f g) (or-elim (replace-goal-with n repl t) (replace-goal-with n repl f) (replace-goal-with n repl g))] [(! e) (! (replace-goal-with n repl e))] [(hole (== n)) repl] [x x])) ;; proof helpers and automation (define (-intro n v) (refine n `(λ ,v ?))) (define-syntax-parse-rule (intro n:number v:id) (-intro n 'v)) (define (-intros n . vs) (refine n (for/fold ([e '?]) ([var (in-list (reverse vs))]) `(λ ,var ,e)))) (define-syntax-parse-rule (intros n:number v:id ...+) (-intros n 'v ...)) (define (-destruct-or n v a b) (refine n `(or-elim ,v (λ ,a ?) (λ ,b ?)))) (define-syntax-parse-rule (destruct-or n:number e:expr a:id b:id) (-destruct-or n 'e 'a 'b)) (define-syntax-parse-rule (left n:number) (refine n `(or-left ?))) (define-syntax-parse-rule (right n:number) (refine n `(or-right ?))) (define-syntax-parse-rule (destruct-and n:number) (refine n '(and-intro ? ?))) (define-syntax-parse-rule (exfalso n:number) (refine n `(! ?))) (define-syntax-parse-rule (papply n:number e:expr) (refine n `(,'e ?))) (define-syntax-parse-rule (exact n:number e:expr) (refine n 'e)) (define (assumption n) (match-define `(,type . ,ctx) (hash-ref goal-table n)) (define assumption? (for/first ([(term ttype) (in-hash ctx)] #:when (equal? type ttype)) term)) (when assumption? (refine n assumption?)))
true
c6ed535fdb2a65c08fb51f0ec7f252af8de8efc3
333b8c5ae464d75163ef379b8e3fdedc5869242f
/systems/main.rkt
f70a0fc9e220269cff831bde34d84a23e3da5ac6
[]
no_license
jFransham/racket-game
7f588d422ab992d2d058fa5aace6be2361e0bf66
5b6b8cf4a72f1404f94571c2214b59f470a9a349
refs/heads/master
2021-01-19T05:11:15.015273
2017-04-10T07:59:57
2017-04-10T08:01:16
87,416,286
2
0
null
null
null
null
UTF-8
Racket
false
false
811
rkt
main.rkt
#lang sweet-exp racket require prefix-in scran: scran prefix-in render: racket-game/systems/render prefix-in physics: racket-game/systems/physics prefix-in bounce: racket-game/systems/bounce prefix-in repl: racket-game/systems/repl racket-game/memoize racket-game/reloadable-helpers racket-game/types provide add-systems! get-systems struct-out sys struct sys physics bounce render repl #:prefab define (add-systems! c w [debug #f]) apply sys map (λ (f) {f and (f c w)}) list physics:add-sys! bounce:add-sys! render:add-sys! {debug and repl:add-sys!} define/memoized (get-systems s) filter identity list sys-physics s sys-bounce s sys-render s sys-repl s
false
15b4e833792a34edc73b43d0a791bf7e5b002f06
017f4a4aa14b740d84cc5ed7817ff904bbf2258d
/WPI_1_CS_1102_Racket/lab4/connect four 10-1.rkt
f11273d15a57df42a56f60212f88629b44314eda
[]
no_license
ezraezra101/coursework
ff4ea60c924c3d4c4f43ae444156ced2d5dd482f
7048a8fa16db897e31b73c2ac497659389943e26
refs/heads/master
2020-06-06T02:59:56.422594
2019-06-18T21:56:04
2019-06-18T21:56:04
192,617,463
0
0
null
null
null
null
UTF-8
Racket
false
false
166,864
rkt
connect four 10-1.rkt
#reader(lib"read.ss""wxme")WXME0108 ## #| This file uses the GRacket editor format. Open this file in DrRacket version 5.3.6 or later to read it. Most likely, it was created by saving a program in DrRacket, and it probably contains a program with non-text elements (such as images or comment boxes). http://racket-lang.org/ |# 30 7 #"wxtext\0" 3 1 6 #"wxtab\0" 1 1 8 #"wximage\0" 2 0 8 #"wxmedia\0" 4 1 34 #"(lib \"syntax-browser.ss\" \"mrlib\")\0" 1 0 16 #"drscheme:number\0" 3 0 44 #"(lib \"number-snip.ss\" \"drscheme\" \"private\")\0" 1 0 36 #"(lib \"comment-snip.ss\" \"framework\")\0" 1 0 93 ( #"((lib \"collapsed-snipclass.ss\" \"framework\") (lib \"collapsed-sni" #"pclass-wxme.ss\" \"framework\"))\0" ) 0 0 43 #"(lib \"collapsed-snipclass.ss\" \"framework\")\0" 0 0 19 #"drscheme:sexp-snip\0" 0 0 36 #"(lib \"cache-image-snip.ss\" \"mrlib\")\0" 1 0 68 ( #"((lib \"image-core.ss\" \"mrlib\") (lib \"image-core-wxme.rkt\" \"mr" #"lib\"))\0" ) 1 0 29 #"drscheme:bindings-snipclass%\0" 1 0 88 ( #"((lib \"pict-snip.rkt\" \"drracket\" \"private\") (lib \"pict-snip.r" #"kt\" \"drracket\" \"private\"))\0" ) 0 0 33 #"(lib \"bullet-snip.ss\" \"browser\")\0" 0 0 25 #"(lib \"matrix.ss\" \"htdp\")\0" 1 0 22 #"drscheme:lambda-snip%\0" 1 0 26 #"drracket:spacer-snipclass\0" 0 0 57 #"(lib \"hrule-snip.rkt\" \"macro-debugger\" \"syntax-browser\")\0" 1 0 26 #"drscheme:pict-value-snip%\0" 0 0 45 #"(lib \"image-snipr.ss\" \"slideshow\" \"private\")\0" 1 0 38 #"(lib \"pict-snipclass.ss\" \"slideshow\")\0" 2 0 55 #"(lib \"vertical-separator-snip.ss\" \"stepper\" \"private\")\0" 1 0 18 #"drscheme:xml-snip\0" 1 0 31 #"(lib \"xml-snipclass.ss\" \"xml\")\0" 1 0 21 #"drscheme:scheme-snip\0" 2 0 34 #"(lib \"scheme-snipclass.ss\" \"xml\")\0" 1 0 10 #"text-box%\0" 1 0 32 #"(lib \"text-snipclass.ss\" \"xml\")\0" 1 0 1 6 #"wxloc\0" 0 0 71 0 1 #"\0" 0 75 1 #"\0" 0 12 90 -1 90 -1 3 -1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 255 255 255 1 -1 0 9 #"Standard\0" 0 75 12 #"Courier New\0" 0 14 90 -1 90 -1 3 -1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 255 255 255 1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 -1 -1 2 24 #"framework:default-color\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 150 0 150 0 0 0 -1 -1 2 15 #"text:ports out\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 150 0 150 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1.0 0 -1 -1 93 -1 -1 -1 0 0 0 0 0 0 0 0 0 1.0 1.0 1.0 255 0 0 0 0 0 -1 -1 2 15 #"text:ports err\0" 0 -1 1 #"\0" 1.0 0 -1 -1 93 -1 -1 -1 0 0 0 0 0 0 0 0 0 1.0 1.0 1.0 255 0 0 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 175 0 0 0 -1 -1 2 17 #"text:ports value\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 175 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1.0 0 92 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1.0 1.0 1.0 34 139 34 0 0 0 -1 -1 2 27 #"Matching Parenthesis Style\0" 0 -1 1 #"\0" 1.0 0 92 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1.0 1.0 1.0 34 139 34 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 38 38 128 0 0 0 -1 -1 2 37 #"framework:syntax-color:scheme:symbol\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 38 38 128 0 0 0 -1 -1 2 38 #"framework:syntax-color:scheme:keyword\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 38 38 128 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 194 116 31 0 0 0 -1 -1 2 38 #"framework:syntax-color:scheme:comment\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 194 116 31 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 41 128 38 0 0 0 -1 -1 2 37 #"framework:syntax-color:scheme:string\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 41 128 38 0 0 0 -1 -1 2 39 #"framework:syntax-color:scheme:constant\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 41 128 38 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 132 60 36 0 0 0 -1 -1 2 49 #"framework:syntax-color:scheme:hash-colon-keyword\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 132 60 36 0 0 0 -1 -1 2 42 #"framework:syntax-color:scheme:parenthesis\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 132 60 36 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 255 0 0 0 0 0 -1 -1 2 36 #"framework:syntax-color:scheme:error\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 255 0 0 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 -1 -1 2 36 #"framework:syntax-color:scheme:other\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 -1 -1 2 16 #"Misspelled Text\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 81 112 203 0 0 0 -1 -1 2 38 #"drracket:check-syntax:lexically-bound\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 81 112 203 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 178 34 34 0 0 0 -1 -1 2 28 #"drracket:check-syntax:set!d\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 178 34 34 0 0 0 -1 -1 2 37 #"drracket:check-syntax:unused-require\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 255 0 0 0 0 0 -1 -1 2 36 #"drracket:check-syntax:free-variable\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 255 0 0 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 68 0 203 0 0 0 -1 -1 2 31 #"drracket:check-syntax:imported\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 68 0 203 0 0 0 -1 -1 2 47 #"drracket:check-syntax:my-obligation-style-pref\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 178 34 34 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 0 116 0 0 0 0 -1 -1 2 50 #"drracket:check-syntax:their-obligation-style-pref\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 0 116 0 0 0 0 -1 -1 2 48 #"drracket:check-syntax:unk-obligation-style-pref\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 139 142 28 0 0 0 -1 -1 2 49 #"drracket:check-syntax:both-obligation-style-pref\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 139 142 28 0 0 0 -1 -1 2 26 #"plt:htdp:test-coverage-on\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 0 0 0 255 165 0 0 0 0 -1 -1 2 27 #"plt:htdp:test-coverage-off\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 0 0 0 255 165 0 0 0 0 -1 -1 4 1 #"\0" 0 70 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 1.0 1.0 1.0 1.0 1.0 1.0 0 0 0 0 0 0 -1 -1 4 4 #"XML\0" 0 70 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 1.0 1.0 1.0 1.0 1.0 1.0 0 0 0 0 0 0 -1 -1 2 37 #"plt:module-language:test-coverage-on\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 -1 -1 2 38 #"plt:module-language:test-coverage-off\0" 0 -1 1 #"\0" 1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 0 0 0 255 165 0 0 0 0 -1 -1 4 1 #"\0" 0 71 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 1.0 1.0 1.0 1.0 1.0 1.0 0 0 0 0 0 0 -1 -1 4 1 #"\0" 0 -1 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 1 0 0 0 0 0 0 0 0 1.0 1.0 1.0 0 0 255 0 0 0 -1 -1 4 1 #"\0" 0 71 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 1 0 0 0 0 0 0 0 0 1.0 1.0 1.0 0 0 255 0 0 0 -1 -1 4 1 #"\0" 0 71 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1.0 1.0 1.0 0 100 0 0 0 0 -1 -1 2 1 #"\0" 0 71 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 1.0 1.0 1.0 1.0 1.0 1.0 0 0 0 0 0 0 -1 -1 2 1 #"\0" 0 71 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1.0 1.0 1.0 0 100 0 0 0 0 -1 -1 0 1 #"\0" 0 75 12 #"Courier New\0" 0.0 14 90 -1 90 -1 3 -1 0 1 0 1 0 0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0 255 255 255 1 -1 23 1 #"\0" 0 -1 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 1 0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0 255 255 255 -1 -1 43 1 #"\0" 0 -1 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 1 0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0 255 255 255 -1 -1 45 1 #"\0" 0 -1 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 1 0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0 255 255 255 -1 -1 4 1 #"\0" 0 -1 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 1 0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0 255 255 255 -1 -1 15 1 #"\0" 0 -1 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 1 0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0 255 255 255 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 1 0 0 0 0 0 1.0 1.0 1.0 1.0 1.0 1.0 0 0 0 0 0 0 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 1 0 0 0 0 0 0.0 0.0 0.0 1.0 1.0 1.0 65 105 225 0 0 0 -1 -1 17 1 #"\0" 0 -1 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 1 0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0 255 255 255 -1 -1 4 1 #"\0" 0 -1 1 #"\0" 1.0 0 92 -1 -1 -1 -1 -1 0 0 0 0 0 1 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0 255 255 0 -1 -1 0 1 #"\0" 0 -1 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 1.0 1.0 1.0 1.0 1.0 1.0 0 0 0 0 0 0 0 -1 14 1 #"\0" 0 -1 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 1 0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0 255 255 255 -1 -1 20 1 #"\0" 0 -1 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 1 0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0 255 255 255 -1 -1 2 1 #"\0" 0 -1 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0.0 0.0 0.0 1.0 1.0 1.0 200 0 0 0 0 0 -1 -1 19 1 #"\0" 0 -1 1 #"\0" 1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 255 255 255 -1 -1 0 7463 0 4 3 85 ( #";; The first three lines of this file were inserted by DrRacket. The" #"y record metadata" ) 0 0 4 29 1 #"\n" 0 0 4 3 85 ( #";; about the language level of this file in a form that our tools ca" #"n easily process." ) 0 0 4 29 1 #"\n" 0 0 4 3 270 ( #"#reader(lib \"htdp-intermediate-reader.ss\" \"lang\")((modname |conn" #"ect four 10-1|) (read-case-sensitive #t) (teachpacks ((lib \"univers" #"e.rkt\" \"teachpack\" \"2htdp\"))) (htdp-settings #(#t constructor r" #"epeating-decimal #f #t none #f ((lib \"universe.rkt\" \"teachpack\" " #"\"2htdp\")))))" ) 0 0 4 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 14 3 7 #"require" 0 0 23 3 1 #" " 0 0 14 3 11 #"2htdp/image" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 14 3 7 #"require" 0 0 23 3 1 #" " 0 0 14 3 14 #"2htdp/universe" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 15 3 13 #"define-struct" 0 0 23 3 1 #" " 0 0 14 3 11 #"world-state" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 8 #"position" 0 0 23 3 1 #" " 0 0 14 3 10 #"whose-turn" 0 0 23 3 1 #" " 0 0 14 3 8 #"settings" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 17 3 80 ( #";; do not modify the constants, except for experimentation with ROWS" #" and COLUMNS" ) 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 3 #"RED" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 5 #"BLACK" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 5 #"BLANK" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 4 #"ROWS" 0 0 23 3 1 #" " 0 0 20 3 1 #"6" 0 0 23 3 1 #")" 0 0 23 3 2 #" " 0 0 17 3 11 #";; can vary" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 7 #"COLUMNS" 0 0 23 3 1 #" " 0 0 20 3 1 #"7" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 17 3 11 #";; can vary" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 17 3 28 #";;Ivan Melnikov & Ezra Davis" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 17 3 17 #";; Our constants:" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 9 #"MAX_DEPTH" 0 0 23 3 1 #" " 0 0 20 3 1 #"3" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 7 #"WIN_VAL" 0 0 23 3 1 #" " 0 0 20 3 2 #"10" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 17 3 19 #";;Data Definitions:" 0 0 23 29 1 #"\n" 0 0 17 3 7 #";; Move" 0 0 23 29 1 #"\n" 0 0 17 3 33 #";; Move is (list Integer Integer)" 0 0 23 29 1 #"\n" 0 0 17 3 55 #";; interp. first item is x, second is y value of a move" 0 0 23 29 1 #"\n" 0 0 17 3 2 #"#;" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 11 #"fn-for-move" 0 0 23 3 1 #" " 0 0 14 3 1 #"m" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 2 #" " 0 0 23 3 1 #"(" 0 0 14 3 3 #"..." 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 1 #"m" 0 0 23 3 1 #")" 0 0 23 3 5 #" " 0 0 17 3 7 #";Number" 0 0 23 29 1 #"\n" 0 0 23 3 7 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"second" 0 0 23 3 1 #" " 0 0 14 3 1 #"m" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 3 #" " 0 0 17 3 7 #";Number" 0 0 23 29 1 #"\n" 0 0 17 3 23 #";; Template rules used:" 0 0 23 29 1 #"\n" 0 0 17 3 24 #";; - compound: 2 fields" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 17 3 9 #";; minmax" 0 0 23 29 1 #"\n" 0 0 17 3 56 #";; minmax is (make-minmax (list Integer Integer) Number)" 0 0 23 29 1 #"\n" 0 0 17 3 111 ( #";; interp. move is the location of a move, and val is the number ass" #"igned to that move by the minimax algorithm" ) 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 15 3 13 #"define-struct" 0 0 23 3 1 #" " 0 0 14 3 6 #"minmax" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"move" 0 0 23 3 1 #" " 0 0 14 3 3 #"val" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 17 3 2 #"#;" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 13 #"fn-for-minmax" 0 0 23 3 1 #" " 0 0 14 3 1 #"m" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 2 #" " 0 0 23 3 1 #"(" 0 0 14 3 3 #"..." 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 11 #"fn-for-move" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 11 #"minmax-move" 0 0 23 3 1 #" " 0 0 14 3 1 #"m" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 7 #" " 0 0 23 3 1 #"(" 0 0 14 3 10 #"minmax-val" 0 0 23 3 1 #" " 0 0 14 3 1 #"m" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 17 3 135 ( #";; Note: the only \"time\" functions in ISL are (time fn) - used for" #" testing, and (current-seconds) - accuracy only to the nearest secon" #"d" ) 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 17 3 30 #";; Boolean Boolean --> Boolean" 0 0 23 29 1 #"\n" 0 0 17 3 17 #";;Exclusive or..." 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 14 3 12 #"check-expect" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 3 #"xor" 0 0 23 3 1 #" " 0 0 14 3 4 #"true" 0 0 23 3 1 #" " 0 0 14 3 4 #"true" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"false" 0 0 23 3 1 #")" 0 0 17 3 20 #";;Exhaustive testing" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 14 3 12 #"check-expect" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 3 #"xor" 0 0 23 3 1 #" " 0 0 14 3 4 #"true" 0 0 23 3 1 #" " 0 0 14 3 5 #"false" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 4 #"true" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 14 3 12 #"check-expect" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 3 #"xor" 0 0 23 3 1 #" " 0 0 14 3 5 #"false" 0 0 23 3 1 #" " 0 0 14 3 5 #"false" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"false" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 14 3 12 #"check-expect" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 3 #"xor" 0 0 23 3 1 #" " 0 0 14 3 5 #"false" 0 0 23 3 1 #" " 0 0 14 3 4 #"true" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 4 #"true" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 3 #"xor" 0 0 23 3 1 #" " 0 0 14 3 3 #"one" 0 0 23 3 1 #" " 0 0 14 3 3 #"two" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 2 #" " 0 0 23 3 1 #"(" 0 0 14 3 2 #"or" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 3 #"and" 0 0 23 3 1 #" " 0 0 14 3 3 #"one" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 3 #"not" 0 0 23 3 1 #" " 0 0 14 3 3 #"two" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 3 #"and" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 3 #"not" 0 0 23 3 1 #" " 0 0 14 3 3 #"one" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 3 #"two" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 17 3 22 #";; state --> state !!!" 0 0 23 29 1 #"\n" 0 0 17 3 50 #";; you will implement this function to make a move" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 14 #"computer-moves" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 2 #" " 0 0 23 3 1 #"(" 0 0 14 3 9 #"make-move" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 2 #"ca" 0 0 14 3 4 #"lls-" 0 0 14 3 16 #"min-and-max-list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 16 #"legal-next-moves" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #" " 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 17 3 5 #";; (l" 0 0 17 3 6 #"istOf " 0 0 17 3 2 #"mo" 0 0 17 3 1 #"v" 0 0 17 3 5 #"es) S" 0 0 17 3 26 #"tate --> (list Move value)" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 2 #"ca" 0 0 14 3 20 #"lls-min-and-max-list" 0 0 23 3 1 #" " 0 0 14 3 5 #"moves" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 2 #" " 0 0 23 3 1 #"(" 0 0 15 3 4 #"cond" 0 0 23 3 1 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 6 #"empty?" 0 0 23 3 1 #" " 0 0 14 3 5 #"moves" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 6 #"+inf.0" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 8 #" " 0 0 23 3 1 #"[" 0 0 14 3 4 #"else" 0 0 23 29 1 #"\n" 0 0 23 3 9 #" " 0 0 23 3 1 #"(" 0 0 14 3 2 #"if" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"<" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"second" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 22 #"calls-min-and-max-list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"rest" 0 0 23 3 1 #" " 0 0 14 3 5 #"moves" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #" " 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 11 #"min-and-max" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 5 #"moves" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #" " 0 0 14 3 9 #"MAX_DEPTH" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 13 #" " 0 0 23 3 1 #"(" 0 0 14 3 22 #"calls-min-and-max-list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"rest" 0 0 23 3 1 #" " 0 0 14 3 5 #"moves" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 13 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 5 #"moves" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 11 #"min-and-max" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 5 #"moves" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #" " 0 0 14 3 9 #"MAX_DEPTH" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 13 #" " 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 17 3 17 #";; state --> move" 0 0 23 29 1 #"\n" 0 0 17 3 94 ( #";; makes a simple move based on our evaluation function - looking th" #"e one move into the future" ) 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 11 #"simple-move" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 2 #" " 0 0 23 3 1 #"(" 0 0 15 3 5 #"local" 0 0 23 3 1 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #" " 0 0 17 3 25 #";; (ListOf move) --> move" 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 13 #"pick-favorite" 0 0 23 3 1 #" " 0 0 14 3 3 #"lom" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 12 #" " 0 0 23 29 1 #"\n" 0 0 23 3 12 #" " 0 0 23 3 1 #"(" 0 0 15 3 4 #"cond" 0 0 23 29 1 #"\n" 0 0 23 3 14 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 6 #"empty?" 0 0 23 3 1 #" " 0 0 14 3 3 #"lom" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 19 3 23 #"\"No legal moves - Draw\"" 0 0 23 3 1 #"]" 0 0 23 3 1 #" " 0 0 17 3 16 #";; Ask about !!!" 0 0 23 29 1 #"\n" 0 0 23 3 14 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 6 #"empty?" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"rest" 0 0 23 3 1 #" " 0 0 14 3 3 #"lom" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 3 #"lom" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 14 #" " 0 0 23 3 1 #"[" 0 0 14 3 4 #"else" 0 0 23 29 1 #"\n" 0 0 23 3 15 #" " 0 0 23 3 1 #"(" 0 0 15 3 5 #"local" 0 0 23 3 1 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 8 #"rest-fav" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 13 #"pick-favorite" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"rest" 0 0 23 3 1 #" " 0 0 14 3 3 #"lom" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 17 #" " 0 0 23 3 1 #"(" 0 0 14 3 2 #"if" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #">" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 19 #"evaluation-function" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 9 #"make-move" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 3 #"lom" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 19 #"evaluation-function" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 9 #"make-move" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #" " 0 0 14 3 8 #"rest-fav" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 21 #" " 0 0 14 3 8 #"rest-fav" 0 0 23 29 1 #"\n" 0 0 23 3 21 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 3 #"lom" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 14 #" " 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 4 #" " 0 0 23 3 1 #"(" 0 0 14 3 13 #"pick-favorite" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 16 #"legal-next-moves" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 17 3 17 #";; state --> move" 0 0 23 29 1 #"\n" 0 0 17 3 69 ( #";; Uses minimax to calculate a move based on evaluation function. !!" #"!" ) 0 0 23 29 1 #"\n" 0 0 17 3 2 #"#;" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 14 3 12 #"check-expect" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 12 #"complex-move" 0 0 23 29 1 #"\n" 0 0 23 3 15 #" " 0 0 23 3 1 #"(" 0 0 14 3 16 #"make-world-state" 0 0 23 29 1 #"\n" 0 0 23 3 16 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 29 1 #"\n" 0 0 23 3 17 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 17 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 17 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 17 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 17 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 17 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 17 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 16 #" " 0 0 20 3 1 #"2" 0 0 23 29 1 #"\n" 0 0 23 3 16 #" " 0 0 14 3 5 #"empty" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 14 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"3" 0 0 23 3 1 #" " 0 0 20 3 1 #"5" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 17 3 2 #";(" 0 0 17 3 6 #"define" 0 0 17 3 21 #" (complex-move state)" 0 0 23 29 1 #"\n" 0 0 17 3 3 #"; " 0 0 17 3 1 #"(" 0 0 17 3 11 #"minmax-move" 0 0 17 3 1 #" " 0 0 17 3 1 #"(" 0 0 17 3 24 #"min-and-max-search--list" 0 0 17 3 1 #" " 0 0 17 3 1 #"(" 0 0 17 3 16 #"legal-next-moves" 0 0 17 3 1 #" " 0 0 17 3 5 #"state" 0 0 17 3 1 #")" 0 0 17 3 1 #" " 0 0 17 3 5 #"state" 0 0 17 3 1 #" " 0 0 17 3 68 #"MAX_DEPTH))) ;;(complex-move-helper state (legal-next-moves state)))" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 11 #"min-and-max" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #" " 0 0 14 3 5 #"depth" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 7 #" " 0 0 23 3 1 #"(" 0 0 15 3 4 #"cond" 0 0 23 29 1 #"\n" 0 0 23 3 9 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 1 #"=" 0 0 23 3 1 #" " 0 0 14 3 5 #"depth" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 19 #"evaluation-function" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 9 #"make-move" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 9 #" " 0 0 23 3 1 #"[" 0 0 14 3 4 #"else" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 12 #"min-max-list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"legal-" 0 0 14 3 1 #"n" 0 0 14 3 9 #"ext-moves" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 9 #"make-move" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 9 #"make-move" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"depth" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 12 #"min-max-list" 0 0 23 3 1 #" " 0 0 14 3 1 #"l" 0 0 14 3 1 #"e" 0 0 14 3 9 #"gal-moves" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #" " 0 0 14 3 5 #"depth" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 2 #" " 0 0 23 3 1 #"(" 0 0 15 3 4 #"cond" 0 0 23 3 1 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 6 #"empty?" 0 0 23 3 1 #" " 0 0 14 3 1 #"l" 0 0 14 3 1 #"e" 0 0 14 3 9 #"gal-moves" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 19 3 4 #"\"No_" 0 0 19 3 2 #"le" 0 0 19 3 4 #"gal_" 0 0 19 3 2 #"mo" 0 0 19 3 1 #"v" 0 0 19 3 3 #"es\"" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 8 #" " 0 0 23 3 1 #"[" 0 0 14 3 4 #"else" 0 0 23 29 1 #"\n" 0 0 23 3 9 #" " 0 0 23 3 1 #"(" 0 0 14 3 11 #"determinant" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 11 #"min-and-max" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 11 #"legal-moves" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"-" 0 0 23 3 1 #" " 0 0 14 3 5 #"depth" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 14 #" " 0 0 23 3 1 #"(" 0 0 14 3 12 #"min-max-list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"rest" 0 0 23 3 1 #" " 0 0 14 3 11 #"legal-moves" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #" " 0 0 14 3 1 #"d" 0 0 14 3 4 #"epth" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 9 #" " 0 0 23 3 1 #"]" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 11 #"determinant" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #" " 0 0 14 3 6 #"value1" 0 0 23 3 1 #" " 0 0 14 3 6 #"value2" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 2 #" " 0 0 23 3 1 #"(" 0 0 15 3 4 #"cond" 0 0 23 3 1 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 1 #"s" 0 0 14 3 2 #"tr" 0 0 14 3 1 #"i" 0 0 14 3 3 #"ng?" 0 0 23 3 1 #" " 0 0 14 3 1 #"v" 0 0 14 3 5 #"alue1" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 6 #"value2" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 8 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 2 #"st" 0 0 14 3 1 #"r" 0 0 14 3 1 #"i" 0 0 14 3 3 #"ng?" 0 0 23 3 1 #" " 0 0 14 3 1 #"v" 0 0 14 3 5 #"alue2" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 2 #"va" 0 0 14 3 1 #"l" 0 0 14 3 3 #"ue1" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 4 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 1 #"=" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 22 #"world-state-whose-turn" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 3 #"RED" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 3 #"max" 0 0 23 3 1 #" " 0 0 14 3 6 #"value1" 0 0 23 3 1 #" " 0 0 14 3 6 #"value2" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 8 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 1 #"=" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 22 #"world-state-whose-turn" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"BLACK" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 3 #"min" 0 0 23 3 1 #" " 0 0 14 3 6 #"value1" 0 0 23 3 1 #" " 0 0 14 3 6 #"value2" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 17 3 24 #";; state bool --> minmax" 0 0 23 29 1 #"\n" 0 0 17 3 51 #";; recursively finds the minimum/or maximum !!! fix" 0 0 23 29 1 #"\n" 0 0 17 3 2 #"#;" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 14 3 12 #"check-expect" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 7 #"minmax?" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 18 #"min-and-max-search" 0 0 23 3 1 #" " 0 0 14 3 11 #"start-state" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"5" 0 0 23 3 1 #" " 0 0 20 3 1 #"5" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 9 #"MAX_DEPTH" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 4 #"true" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 17 3 2 #"#;" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 14 3 12 #"check-expect" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 18 #"min-and-max-search" 0 0 23 29 1 #"\n" 0 0 23 3 15 #" " 0 0 23 3 1 #"(" 0 0 14 3 16 #"make-world-state" 0 0 23 29 1 #"\n" 0 0 23 3 16 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 29 1 #"\n" 0 0 23 3 17 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 17 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 17 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 17 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 17 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 17 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 17 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 16 #" " 0 0 20 3 1 #"1" 0 0 23 29 1 #"\n" 0 0 23 3 16 #" " 0 0 14 3 5 #"empty" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 15 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"5" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 15 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 14 #" " 0 0 23 3 1 #"(" 0 0 14 3 11 #"make-minmax" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"5" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 3 #"-10" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 17 3 2 #"#;" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 18 #"min-and-max-search" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #" " 0 0 14 3 5 #"depth" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 2 #" " 0 0 23 3 1 #"(" 0 0 14 3 2 #"if" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 2 #"<=" 0 0 23 3 1 #" " 0 0 14 3 5 #"depth" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 6 #" " 0 0 23 3 1 #"(" 0 0 14 3 11 #"make-minmax" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 19 #"evaluation-function" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 9 #"make-move" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 6 #" " 0 0 23 29 1 #"\n" 0 0 23 3 6 #" " 0 0 23 3 1 #"(" 0 0 14 3 23 #"min-and-max-search-list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 16 #"legal-next-moves" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 32 #" " 0 0 14 3 5 #"state" 0 0 23 29 1 #"\n" 0 0 23 3 32 #" " 0 0 14 3 5 #"depth" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 6 #" " 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 17 3 46 #";; (listof move) state bool Natural --> minmax" 0 0 23 29 1 #"\n" 0 0 17 3 66 #";; see min-and-max-search - this function's mutual recursion buddy" 0 0 23 29 1 #"\n" 0 0 17 3 2 #"#;" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 24 #"min-and-max-search--list" 0 0 23 3 1 #" " 0 0 14 3 3 #"los" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #" " 0 0 14 3 5 #"depth" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 2 #" " 0 0 23 3 1 #"(" 0 0 15 3 4 #"cond" 0 0 23 3 1 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 6 #"empty?" 0 0 23 3 1 #" " 0 0 14 3 3 #"los" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 19 3 1 #"\"" 0 0 19 3 5 #"Draw\"" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 8 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 6 #"empty?" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"rest" 0 0 23 3 1 #" " 0 0 14 3 3 #"los" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 18 #"min-and-max-search" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 9 #"make-move" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 3 #"los" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 3 #"los" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"-" 0 0 23 3 1 #" " 0 0 14 3 5 #"depth" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 8 #" " 0 0 23 3 1 #"[" 0 0 14 3 4 #"else" 0 0 23 29 1 #"\n" 0 0 23 3 9 #" " 0 0 23 3 1 #"(" 0 0 15 3 5 #"local" 0 0 23 3 1 #" " 0 0 23 3 1 #"[" 0 0 23 29 1 #"\n" 0 0 23 3 17 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 8 #"mm-first" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 18 #"min-and-max-search" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 9 #"make-move" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 3 #"los" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 54 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 3 #"los" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 54 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"-" 0 0 23 3 1 #" " 0 0 14 3 5 #"depth" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 17 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 14 #"mm-best-so-far" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 24 #"min-and-max-search--list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"rest" 0 0 23 3 1 #" " 0 0 14 3 3 #"los" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 66 #" " 0 0 14 3 5 #"state" 0 0 23 29 1 #"\n" 0 0 23 3 66 #" " 0 0 14 3 5 #"depth" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 11 #" " 0 0 23 29 1 #"\n" 0 0 23 3 11 #" " 0 0 23 29 1 #"\n" 0 0 23 3 11 #" " 0 0 23 3 1 #"(" 0 0 15 3 4 #"cond" 0 0 23 29 1 #"\n" 0 0 23 3 13 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 1 #"=" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 22 #"world-state-whose-turn" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 17 3 13 #";; Red's turn" 0 0 23 29 1 #"\n" 0 0 23 3 14 #" " 0 0 23 3 1 #"(" 0 0 14 3 2 #"if" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"<" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 10 #"minmax-val" 0 0 23 3 1 #" " 0 0 14 3 8 #"mm-first" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 10 #"minmax-val" 0 0 23 3 1 #" " 0 0 14 3 14 #"mm-best-so-far" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 18 #" " 0 0 14 3 14 #"mm-best-so-far" 0 0 23 29 1 #"\n" 0 0 23 3 18 #" " 0 0 14 3 8 #"mm-first" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 13 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 1 #"=" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 22 #"world-state-whose-turn" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 17 3 15 #";; Black's turn" 0 0 23 29 1 #"\n" 0 0 23 3 14 #" " 0 0 23 3 1 #"(" 0 0 14 3 2 #"if" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"<" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 10 #"minmax-val" 0 0 23 3 1 #" " 0 0 14 3 8 #"mm-first" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 10 #"minmax-val" 0 0 23 3 1 #" " 0 0 14 3 14 #"mm-best-so-far" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 18 #" " 0 0 14 3 8 #"mm-first" 0 0 23 29 1 #"\n" 0 0 23 3 18 #" " 0 0 14 3 14 #"mm-best-so-far" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 13 #" " 0 0 23 29 1 #"\n" 0 0 23 3 13 #" " 0 0 17 3 26 #";; Equivalent to the cond:" 0 0 23 29 1 #"\n" 0 0 23 3 13 #" " 0 0 17 3 70 ( #";(xor (= (world-state-whose-turn state) 1) ;;;;This may have to chan" #"ge" ) 0 0 23 29 1 #"\n" 0 0 23 3 13 #" " 0 0 17 3 60 #"; (< (minmax-val mm-first) (minmax-val mm-best-so-far)))" 0 0 23 29 1 #"\n" 0 0 23 3 13 #" " 0 0 17 3 9 #";mm-first" 0 0 23 29 1 #"\n" 0 0 23 3 13 #" " 0 0 17 3 16 #";mm-best-so-far)" 0 0 23 29 1 #"\n" 0 0 23 3 13 #" " 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 17 3 18 #";;; !!! needs work" 0 0 23 29 1 #"\n" 0 0 17 3 19 #";; state --> Number" 0 0 23 29 1 #"\n" 0 0 17 3 76 ( #";; evaluates how good a state is. larger values are better for red " #"(human) " ) 0 0 23 29 1 #"\n" 0 0 17 3 55 #";; while smaller values are better for black (computer)" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 14 3 12 #"check-expect" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 19 #"evaluation-function" 0 0 23 29 1 #"\n" 0 0 23 3 15 #" " 0 0 23 3 1 #"(" 0 0 14 3 16 #"make-world-state" 0 0 23 29 1 #"\n" 0 0 23 3 16 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 29 1 #"\n" 0 0 23 3 17 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 17 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 17 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 17 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 17 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 17 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 17 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 16 #" " 0 0 20 3 1 #"2" 0 0 23 29 1 #"\n" 0 0 23 3 16 #" " 0 0 14 3 5 #"empty" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 14 #" " 0 0 20 3 5 #"10000" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 14 3 12 #"check-expect" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 19 #"evaluation-function" 0 0 23 29 1 #"\n" 0 0 23 3 15 #" " 0 0 23 3 1 #"(" 0 0 14 3 16 #"make-world-state" 0 0 23 29 1 #"\n" 0 0 23 3 16 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 29 1 #"\n" 0 0 23 3 17 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 17 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 17 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 17 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 17 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 17 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 17 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 16 #" " 0 0 20 3 1 #"1" 0 0 23 29 1 #"\n" 0 0 23 3 16 #" " 0 0 14 3 5 #"empty" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 14 #" " 0 0 20 3 6 #"-10000" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 17 3 2 #"#;" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 19 #"evaluation-function" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 2 #" " 0 0 23 3 1 #"(" 0 0 15 3 4 #"cond" 0 0 23 29 1 #"\n" 0 0 23 3 4 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 10 #"check-win?" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 3 1 #"(" 0 0 14 3 2 #"if" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"=" 0 0 23 3 1 #"(" 0 0 14 3 22 #"world-state-whose-turn" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"BLACK" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 9 #" " 0 0 20 3 2 #"10" 0 0 23 29 1 #"\n" 0 0 23 3 9 #" " 0 0 20 3 3 #"-10" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 4 #" " 0 0 23 3 1 #"[" 0 0 14 3 4 #"else" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"/" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"-" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"random" 0 0 23 3 1 #" " 0 0 20 3 3 #"100" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 2 #"50" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 2 #"50" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 19 #"evaluation-function" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 2 #" " 0 0 23 3 1 #"(" 0 0 14 3 10 #"walk-board" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 17 3 30 #";; World-State move --> Number" 0 0 23 29 1 #"\n" 0 0 17 3 49 #";;Evaluates an entire board by stepping across it" 0 0 23 29 1 #"\n" 0 0 17 3 41 #";; A good starting position is (list 0 0)" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 17 3 116 ( #";; Check-expects fail on very small boards (also only works with the" #" stub form of eval-one-four :::::::;;;;;;;;;;;;;" ) 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 8 #"full-red" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 16 #"make-world-state" 0 0 23 29 1 #"\n" 0 0 23 3 18 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 29 1 #"\n" 0 0 23 3 19 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 19 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 19 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 19 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 19 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 19 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 19 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 18 #" " 0 0 20 3 1 #"1" 0 0 23 29 1 #"\n" 0 0 23 3 18 #" " 0 0 14 3 5 #"empty" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 14 3 12 #"check-expect" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 10 #"walk-board" 0 0 23 3 1 #" " 0 0 14 3 8 #"full-red" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"*" 0 0 23 3 1 #" " 0 0 20 3 5 #"10000" 0 0 23 3 14 #" " 0 0 23 29 1 #"\n" 0 0 23 3 50 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"*" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"*" 0 0 23 3 1 #" " 0 0 20 3 1 #"3" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #")" 0 0 23 3 18 #" " 0 0 17 3 113 ( #";; Number by the top of board in each column * number of fours possi" #"ble (won't be accurate on boards with <4 rows" ) 0 0 23 29 1 #"\n" 0 0 23 3 56 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"*" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"-" 0 0 23 3 1 #" " 0 0 14 3 4 #"ROWS" 0 0 23 3 1 #" " 0 0 20 3 1 #"3" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 1 #"3" 0 0 23 3 1 #")" 0 0 23 3 9 #" " 0 0 17 3 70 ( #";; Number by bottom of board in each column * number of fours possib" #"le" ) 0 0 23 29 1 #"\n" 0 0 23 3 56 #" " 0 0 23 3 1 #"(" 0 0 14 3 3 #"max" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"*" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"-" 0 0 23 3 1 #" " 0 0 14 3 4 #"ROWS" 0 0 23 3 1 #" " 0 0 20 3 1 #"6" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 1 #"4" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 17 3 70 ( #";; Number in center of board in each column * number of fours possib" #"le" ) 0 0 23 29 1 #"\n" 0 0 23 3 56 #" " 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 53 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"-" 0 0 23 3 1 #" " 0 0 14 3 7 #"COLUMNS" 0 0 23 3 1 #" " 0 0 20 3 1 #"3" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 13 #" " 0 0 17 3 29 #";; Number of columns on board" 0 0 23 29 1 #"\n" 0 0 17 3 33 #";; Evaluates to 60 on a 7x6 board" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 14 3 12 #"check-expect" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 10 #"walk-board" 0 0 23 3 1 #" " 0 0 14 3 11 #"start-state" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"-" 0 0 23 3 1 #" " 0 0 14 3 7 #"COLUMNS" 0 0 23 3 1 #" " 0 0 20 3 1 #"3" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 17 3 41 #";; When too close to the right, returns 0" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 14 3 12 #"check-expect" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 10 #"walk-board" 0 0 23 3 1 #" " 0 0 14 3 11 #"start-state" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"-" 0 0 23 3 1 #" " 0 0 14 3 7 #"COLUMNS" 0 0 23 3 1 #" " 0 0 20 3 1 #"4" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 29 1 #"\n" 0 0 17 3 2 #"#;" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"*" 0 0 23 3 1 #" " 0 0 20 3 1 #"3" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #")" 0 0 23 3 18 #" " 0 0 17 3 113 ( #";; Number by the top of board in each column * number of fours possi" #"ble (won't be accurate on boards with <4 rows" ) 0 0 23 29 1 #"\n" 0 0 23 3 3 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"*" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"-" 0 0 23 3 1 #" " 0 0 14 3 4 #"ROWS" 0 0 23 3 1 #" " 0 0 20 3 1 #"3" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 1 #"3" 0 0 23 3 1 #")" 0 0 23 3 9 #" " 0 0 17 3 70 ( #";; Number by bottom of board in each column * number of fours possib" #"le" ) 0 0 23 29 1 #"\n" 0 0 23 3 3 #" " 0 0 23 3 1 #"(" 0 0 14 3 3 #"max" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"*" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"-" 0 0 23 3 1 #" " 0 0 14 3 4 #"ROWS" 0 0 23 3 1 #" " 0 0 20 3 1 #"6" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 1 #"4" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 17 3 70 ( #";; Number in center of board in each column * number of fours possib" #"le" ) 0 0 23 29 1 #"\n" 0 0 23 3 3 #" " 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 19 #" " 0 0 17 3 41 #";; Evaluates to 15 on a board with 6 rows" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 10 #"walk-board" 0 0 23 3 1 #" " 0 0 14 3 2 #"bd" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 2 #" " 0 0 23 3 1 #"(" 0 0 15 3 5 #"local" 0 0 23 3 1 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 8 #"vertical" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"second" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 4 #" " 0 0 17 3 7 #";; X" 0 0 23 29 1 #"\n" 0 0 23 3 33 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"second" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 17 3 5 #";; X" 0 0 23 29 1 #"\n" 0 0 23 3 33 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"second" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 17 3 5 #";; X" 0 0 23 29 1 #"\n" 0 0 23 3 33 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"second" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 1 #"3" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 17 3 3 #";;X" 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 11 #"up-diagonal" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"second" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 8 #" " 0 0 17 3 15 #";; X" 0 0 23 29 1 #"\n" 0 0 23 3 36 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"-" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"second" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 17 3 8 #";; X" 0 0 23 29 1 #"\n" 0 0 23 3 36 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"-" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #")" 0 0 23 3 2 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"second" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 17 3 5 #";; X" 0 0 23 29 1 #"\n" 0 0 23 3 36 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"-" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 1 #"3" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"second" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 1 #"3" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 17 3 3 #";;X" 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 13 #"down-diagonal" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"second" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 3 #" " 0 0 17 3 15 #"; X" 0 0 23 29 1 #"\n" 0 0 23 3 38 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"second" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 17 3 7 #";; X" 0 0 23 29 1 #"\n" 0 0 23 3 38 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #")" 0 0 23 3 2 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"second" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 17 3 8 #";; X" 0 0 23 29 1 #"\n" 0 0 23 3 38 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 1 #"3" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"second" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 1 #"3" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 17 3 9 #";; X" 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 6 #"across" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"second" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 24 #" " 0 0 17 3 10 #";; X X X X" 0 0 23 29 1 #"\n" 0 0 23 3 31 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"second" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 31 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"second" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 31 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 1 #"3" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"second" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 9 #"next-move" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 2 #"if" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 2 #">=" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"second" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"-" 0 0 23 3 1 #" " 0 0 14 3 4 #"ROWS" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 11 #" " 0 0 17 3 26 #";; When it reaches the top" 0 0 23 29 1 #"\n" 0 0 23 3 32 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 3 16 #" " 0 0 17 3 43 #";; Then the next move is in the next column" 0 0 23 29 1 #"\n" 0 0 23 3 32 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"second" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 2 #" " 0 0 17 3 35 #";; Else it increments the rows by 1" 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 4 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 9 #"eval-them" 0 0 23 3 1 #" " 0 0 14 3 2 #"bd" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"clip" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 14 3 8 #"vertical" 0 0 23 3 1 #" " 0 0 14 3 11 #"up-diagonal" 0 0 23 3 1 #" " 0 0 14 3 13 #"down-diagonal" 0 0 23 3 1 #" " 0 0 14 3 6 #"across" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 2 #"if" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 2 #"<=" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 9 #"next-move" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"-" 0 0 23 3 1 #" " 0 0 14 3 7 #"COLUMNS" 0 0 23 3 1 #" " 0 0 20 3 1 #"4" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 17 3 40 #";; If too close to the right edge,x stop" 0 0 23 29 1 #"\n" 0 0 23 3 82 ( #" " #" " ) 0 0 23 3 1 #"(" 0 0 14 3 10 #"walk-board" 0 0 23 3 1 #" " 0 0 14 3 2 #"bd" 0 0 23 3 1 #" " 0 0 14 3 9 #"next-move" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 82 ( #" " #" " ) 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 4 #" " 0 0 23 29 1 #"\n" 0 0 23 3 4 #" " 0 0 17 3 2 #"#;" 0 0 23 29 1 #"\n" 0 0 23 3 4 #" " 0 0 23 3 1 #"(" 0 0 15 3 4 #"cond" 0 0 23 3 1 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 1 #">" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"-" 0 0 23 3 1 #" " 0 0 14 3 7 #"COLUMNS" 0 0 23 3 1 #" " 0 0 20 3 1 #"4" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 17 3 40 #";; If too close to the right edge,x stop" 0 0 23 29 1 #"\n" 0 0 23 3 11 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 1 #">" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"second" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"-" 0 0 23 3 1 #" " 0 0 14 3 4 #"ROWS" 0 0 23 3 1 #" " 0 0 20 3 1 #"4" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 17 3 42 #";; If its 3 or less spaces from the bottom" 0 0 23 29 1 #"\n" 0 0 23 3 11 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 13 #"eval-one-four" 0 0 23 3 1 #" " 0 0 14 3 2 #"bd" 0 0 23 3 1 #" " 0 0 14 3 6 #"across" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 13 #"eval-one-four" 0 0 23 3 1 #" " 0 0 14 3 2 #"bd" 0 0 23 3 1 #" " 0 0 14 3 8 #"vertical" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 13 #"eval-one-four" 0 0 23 3 1 #" " 0 0 14 3 2 #"bd" 0 0 23 3 1 #" " 0 0 14 3 11 #"up-diagonal" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 10 #"walk-board" 0 0 23 3 1 #" " 0 0 14 3 2 #"bd" 0 0 23 3 1 #" " 0 0 14 3 9 #"next-move" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 1 #">" 0 0 23 3 1 #" " 0 0 20 3 1 #"3" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"second" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 17 3 34 #";; If within 3 spaces from the top" 0 0 23 29 1 #"\n" 0 0 23 3 11 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 13 #"eval-one-four" 0 0 23 3 1 #" " 0 0 14 3 2 #"bd" 0 0 23 3 1 #" " 0 0 14 3 6 #"across" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 13 #"eval-one-four" 0 0 23 3 1 #" " 0 0 14 3 2 #"bd" 0 0 23 3 1 #" " 0 0 14 3 13 #"down-diagonal" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 10 #"walk-board" 0 0 23 3 1 #" " 0 0 14 3 2 #"bd" 0 0 23 3 1 #" " 0 0 14 3 9 #"next-move" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 3 1 #"[" 0 0 14 3 4 #"else" 0 0 23 3 1 #" " 0 0 17 3 64 #";;In the center of the board - won't get called on a 7x6 board" 0 0 23 29 1 #"\n" 0 0 23 3 11 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 13 #"eval-one-four" 0 0 23 3 1 #" " 0 0 14 3 2 #"bd" 0 0 23 3 1 #" " 0 0 14 3 6 #"across" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 13 #"eval-one-four" 0 0 23 3 1 #" " 0 0 14 3 2 #"bd" 0 0 23 3 1 #" " 0 0 14 3 13 #"down-diagonal" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 13 #"eval-one-four" 0 0 23 3 1 #" " 0 0 14 3 2 #"bd" 0 0 23 3 1 #" " 0 0 14 3 11 #"up-diagonal" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 13 #"eval-one-four" 0 0 23 3 1 #" " 0 0 14 3 2 #"bd" 0 0 23 3 1 #" " 0 0 14 3 8 #"vertical" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 10 #"walk-board" 0 0 23 3 1 #" " 0 0 14 3 2 #"bd" 0 0 23 3 1 #" " 0 0 14 3 9 #"next-move" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 17 3 53 #";; (ListOf (ListOf Moves)) --> (ListOf (ListOf Moves)" 0 0 23 29 1 #"\n" 0 0 17 3 58 #";; Removes lists that include moves that are off the board" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 14 3 12 #"check-expect" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"clip" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 14 3 4 #"ROWS" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 14 3 7 #"COLUMNS" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"empty" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 14 3 12 #"check-expect" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"clip" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"3" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 2 #"-1" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"3" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"clip" 0 0 23 3 1 #" " 0 0 14 3 5 #"fours" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 2 #" " 0 0 23 3 1 #"(" 0 0 15 3 5 #"local" 0 0 23 3 1 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 13 #"legal?--moves" 0 0 23 3 1 #" " 0 0 14 3 5 #"moves" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 12 #" " 0 0 23 3 1 #"(" 0 0 15 3 4 #"cond" 0 0 23 3 1 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 6 #"empty?" 0 0 23 3 1 #" " 0 0 14 3 5 #"moves" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 4 #"true" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 18 #" " 0 0 23 3 1 #"[" 0 0 14 3 4 #"else" 0 0 23 29 1 #"\n" 0 0 23 3 19 #" " 0 0 23 3 1 #"(" 0 0 14 3 3 #"and" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 12 #"legal?--move" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 5 #"moves" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 24 #" " 0 0 23 3 1 #"(" 0 0 14 3 13 #"legal?--moves" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"rest" 0 0 23 3 1 #" " 0 0 14 3 5 #"moves" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 12 #"legal?--move" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 12 #" " 0 0 23 3 1 #"(" 0 0 15 3 4 #"cond" 0 0 23 3 1 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 2 #"or" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 9 #"negative?" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 23 #" " 0 0 23 3 1 #"(" 0 0 14 3 9 #"negative?" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"second" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 23 #" " 0 0 23 3 1 #"(" 0 0 14 3 2 #">=" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 7 #"COLUMNS" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 23 #" " 0 0 23 3 1 #"(" 0 0 14 3 2 #">=" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"second" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 4 #"ROWS" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 19 #" " 0 0 14 3 5 #"false" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 18 #" " 0 0 23 3 1 #"[" 0 0 14 3 4 #"else" 0 0 23 3 1 #" " 0 0 14 3 4 #"true" 0 0 23 3 1 #"]" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 4 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"filter" 0 0 23 3 1 #" " 0 0 14 3 13 #"legal?--moves" 0 0 23 3 1 #" " 0 0 14 3 5 #"fours" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 17 3 49 #";; World-State (ListOf (ListOf Moves)) --> Number" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 9 #"eval-them" 0 0 23 3 1 #" " 0 0 14 3 2 #"bd" 0 0 23 3 1 #" " 0 0 14 3 5 #"fours" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 2 #" " 0 0 23 3 1 #"(" 0 0 15 3 4 #"cond" 0 0 23 3 1 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 6 #"empty?" 0 0 23 3 1 #" " 0 0 14 3 5 #"fours" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 8 #" " 0 0 23 3 1 #"[" 0 0 14 3 4 #"else" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 13 #"eval-one-four" 0 0 23 3 1 #" " 0 0 14 3 2 #"bd" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 5 #"fours" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 9 #"eval-them" 0 0 23 3 1 #" " 0 0 14 3 2 #"bd" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"rest" 0 0 23 3 1 #" " 0 0 14 3 5 #"fours" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 17 3 46 #";; Board (list move move move move) --> Number" 0 0 23 29 1 #"\n" 0 0 17 3 52 #";; Takes 4 moves and determines a point value for it" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 17 3 41 #";(define (eval-one-four moves) 1) ;; stub" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 17 3 19 #";;Doesn't work yet:" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 17 3 48 #";(define (eval-one-four bd moves) (error moves))" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 13 #"eval-one-four" 0 0 23 3 1 #" " 0 0 14 3 2 #"bd" 0 0 23 3 1 #" " 0 0 14 3 5 #"moves" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 2 #" " 0 0 23 3 1 #"(" 0 0 15 3 5 #"local" 0 0 23 3 1 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 3 #"one" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 8 #"piece-in" 0 0 23 3 1 #" " 0 0 14 3 2 #"bd" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 5 #"moves" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 3 #"two" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 8 #"piece-in" 0 0 23 3 1 #" " 0 0 14 3 2 #"bd" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"second" 0 0 23 3 1 #" " 0 0 14 3 5 #"moves" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 5 #"three" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 8 #"piece-in" 0 0 23 3 1 #" " 0 0 14 3 2 #"bd" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"third" 0 0 23 3 1 #" " 0 0 14 3 5 #"moves" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 5 #"forth" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 8 #"piece-in" 0 0 23 3 1 #" " 0 0 14 3 2 #"bd" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"rest" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"rest" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"rest" 0 0 23 3 1 #" " 0 0 14 3 5 #"moves" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 8 #"num-mult" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 12 #"black-or-red" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 14 3 3 #"one" 0 0 23 3 1 #" " 0 0 14 3 3 #"two" 0 0 23 3 1 #" " 0 0 14 3 5 #"three" 0 0 23 3 1 #" " 0 0 14 3 5 #"forth" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 4 #" " 0 0 23 3 1 #"(" 0 0 15 3 4 #"cond" 0 0 23 3 1 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 6 #"false?" 0 0 23 3 1 #" " 0 0 14 3 8 #"num-mult" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 1 #"=" 0 0 23 3 1 #" " 0 0 14 3 5 #"BLANK" 0 0 23 3 1 #" " 0 0 14 3 8 #"num-mult" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 1 #"=" 0 0 23 3 1 #" " 0 0 14 3 3 #"RED" 0 0 23 3 1 #" " 0 0 14 3 8 #"num-mult" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"*" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 8 #"list-ref" 0 0 23 3 1 #" " 0 0 14 3 13 #"vals-for-eval" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"/" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 14 3 3 #"one" 0 0 23 3 1 #" " 0 0 14 3 3 #"two" 0 0 23 3 1 #" " 0 0 14 3 5 #"three" 0 0 23 3 1 #" " 0 0 14 3 5 #"forth" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 3 #"RED" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 1 #"=" 0 0 23 3 1 #" " 0 0 14 3 5 #"BLACK" 0 0 23 3 1 #" " 0 0 14 3 8 #"num-mult" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"*" 0 0 23 3 1 #" " 0 0 20 3 2 #"-1" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 8 #"list-ref" 0 0 23 3 1 #" " 0 0 14 3 13 #"vals-for-eval" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"/" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 14 3 3 #"one" 0 0 23 3 1 #" " 0 0 14 3 3 #"two" 0 0 23 3 1 #" " 0 0 14 3 5 #"three" 0 0 23 3 1 #" " 0 0 14 3 5 #"forth" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"BLACK" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 3 10 #" " 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 13 #"vals-for-eval" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"4" 0 0 23 3 1 #" " 0 0 20 3 1 #"9" 0 0 23 3 1 #" " 0 0 20 3 10 #"1000000000" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 17 3 45 #";; ^ If 1 out of 4" 0 0 23 29 1 #"\n" 0 0 17 3 47 #";; ^ If 2 out of 4" 0 0 23 29 1 #"\n" 0 0 17 3 49 #";; ^ If 3 out of 4" 0 0 23 29 1 #"\n" 0 0 17 3 55 #";; ^ If 4 in a row" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 17 3 53 #";; (ListOf BLACK|RED|BLANK) --> BLACK|RED|BLANK|false" 0 0 23 29 1 #"\n" 0 0 17 3 85 ( #";; Takes a list of pieces and returns whether there is both black an" #"d red in the list" ) 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 14 3 12 #"check-expect" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 12 #"black-or-red" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 14 3 5 #"BLACK" 0 0 23 3 1 #" " 0 0 14 3 5 #"BLACK" 0 0 23 3 1 #" " 0 0 14 3 5 #"BLACK" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"BLACK" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 14 3 12 #"check-expect" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 12 #"black-or-red" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 14 3 5 #"BLACK" 0 0 23 3 1 #" " 0 0 14 3 5 #"BLACK" 0 0 23 3 1 #" " 0 0 14 3 5 #"BLANK" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"BLACK" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 14 3 12 #"check-expect" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 12 #"black-or-red" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 14 3 3 #"RED" 0 0 23 3 3 #" " 0 0 14 3 5 #"BLACK" 0 0 23 3 1 #" " 0 0 14 3 5 #"BLACK" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"false" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 14 3 12 #"check-expect" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 12 #"black-or-red" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 14 3 3 #"RED" 0 0 23 3 3 #" " 0 0 14 3 3 #"RED" 0 0 23 3 3 #" " 0 0 14 3 3 #"RED" 0 0 23 3 2 #" " 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 3 #"RED" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 14 3 12 #"check-expect" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 12 #"black-or-red" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 14 3 3 #"RED" 0 0 23 3 3 #" " 0 0 14 3 3 #"RED" 0 0 23 3 3 #" " 0 0 14 3 3 #"RED" 0 0 23 3 2 #" " 0 0 14 3 5 #"BLANK" 0 0 23 3 1 #" " 0 0 14 3 5 #"BLACK" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"false" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 12 #"black-or-red" 0 0 23 3 1 #" " 0 0 14 3 3 #"lst" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 2 #" " 0 0 23 3 1 #"(" 0 0 15 3 4 #"cond" 0 0 23 3 1 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 6 #"empty?" 0 0 23 3 1 #" " 0 0 14 3 3 #"lst" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"BLANK" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 8 #" " 0 0 23 3 1 #"[" 0 0 14 3 4 #"else" 0 0 23 29 1 #"\n" 0 0 23 3 9 #" " 0 0 23 3 1 #"(" 0 0 15 3 5 #"local" 0 0 23 3 1 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 17 #"rest-black-or-red" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 12 #"black-or-red" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"rest" 0 0 23 3 1 #" " 0 0 14 3 3 #"lst" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 11 #" " 0 0 23 3 1 #"(" 0 0 15 3 4 #"cond" 0 0 23 3 1 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 6 #"false?" 0 0 23 3 1 #" " 0 0 14 3 17 #"rest-black-or-red" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"false" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 17 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 1 #"=" 0 0 23 3 1 #" " 0 0 14 3 5 #"BLANK" 0 0 23 3 1 #" " 0 0 14 3 17 #"rest-black-or-red" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 3 #"lst" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 17 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 1 #"=" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 3 #"lst" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 17 #"rest-black-or-red" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 3 #"lst" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 17 #" " 0 0 23 3 1 #"[" 0 0 14 3 4 #"else" 0 0 23 3 1 #" " 0 0 14 3 5 #"false" 0 0 23 3 1 #"]" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 17 3 33 #";; Board Move --> BLACK|RED|BLANK" 0 0 23 29 1 #"\n" 0 0 17 3 40 #";; Returns the piece at a board position" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 14 3 12 #"check-expect" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 8 #"piece-in" 0 0 23 3 1 #" " 0 0 14 3 11 #"start-state" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 8 #"piece-in" 0 0 23 3 1 #" " 0 0 14 3 5 #"board" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 2 #" " 0 0 23 3 1 #"(" 0 0 14 3 8 #"list-ref" 0 0 23 3 2 #" " 0 0 23 3 1 #"(" 0 0 14 3 8 #"list-ref" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 20 #"world-state-position" 0 0 23 3 1 #" " 0 0 14 3 5 #"board" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"second" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 17 3 97 ( #";; you must implement the above two functions as part of the asignme" #"nt, but may create additional" ) 0 0 23 29 1 #"\n" 0 0 17 3 19 #";; helper functions" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 17 3 122 ( #";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; VI" #"SUALIZATION OF BOARD ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;" ) 0 0 23 29 1 #"\n" 0 0 17 3 18 #";;!!! remove later" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"6" 0 0 23 3 1 #" " 0 0 20 3 1 #"5" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 17 3 15 #";; Bottom right" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"5" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 17 3 14 #";; bottom left" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"6" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 17 3 12 #";; top right" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 17 3 11 #";; top left" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 17 3 26 #";; (listof move) --> image" 0 0 23 29 1 #"\n" 0 0 17 3 30 #";; last argument is first move" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"draw" 0 0 23 3 1 #" " 0 0 14 3 3 #"lom" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 2 #" " 0 0 23 3 1 #"(" 0 0 14 3 14 #"draw-for-tests" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 11 #"draw-helper" 0 0 23 3 1 #" " 0 0 14 3 3 #"lom" 0 0 23 3 1 #" " 0 0 14 3 11 #"start-state" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 2 #" " 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 11 #"draw-helper" 0 0 23 3 1 #" " 0 0 14 3 3 #"lom" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 2 #" " 0 0 23 3 1 #"(" 0 0 14 3 2 #"if" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"empty?" 0 0 23 3 1 #" " 0 0 14 3 3 #"lom" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 6 #" " 0 0 14 3 5 #"state" 0 0 23 29 1 #"\n" 0 0 23 3 6 #" " 0 0 23 3 1 #"(" 0 0 14 3 9 #"make-move" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 11 #"draw-helper" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"rest" 0 0 23 3 1 #" " 0 0 14 3 3 #"lom" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 3 #"lom" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 17 3 17 #";; move --> image" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"depict" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 2 #" " 0 0 23 3 1 #"(" 0 0 14 3 14 #"draw-for-tests" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 9 #"make-move" 0 0 23 3 1 #" " 0 0 14 3 11 #"start-state" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 14 3 12 #"check-expect" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 14 #"draw-for-tests" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 16 #"make-world-state" 0 0 23 29 1 #"\n" 0 0 23 3 31 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 29 1 #"\n" 0 0 23 3 32 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 32 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 32 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 32 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 32 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 32 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 32 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 31 #" " 0 0 20 3 1 #"1" 0 0 23 29 1 #"\n" 0 0 23 3 31 #" " 0 0 14 3 5 #"empty" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 30 #" " 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 29 1 #"\n" 0 0 23 3 14 #" " 0 12 4 58 11528 ( #"(#(struct:crop (#(struct:point 0 0) #(struct:point 540 0) #(struct:p" #"oint 540 465) #(struct:point 0 465)) #(struct:translate 0 0 #(struct" #":overlay #(struct:translate 5120/11 170/11 #(struct:translate 30 30 " #"#(struct:ellipse 60 60 0 255 \"white\"))) #(struct:translate 0 0 #(s" #"truct:crop (#(struct:point 0 0) #(struct:point 540 0) #(struct:point" #" 540 465) #(struct:point 0 465)) #(struct:translate 0 0 #(struct:ove" #"rlay #(struct:translate 5120/11 995/11 #(struct:translate 30 30 #(st" #"ruct:ellipse 60 60 0 255 \"white\"))) #(struct:translate 0 0 #(struc" #"t:crop (#(struct:point 0 0) #(struct:point 540 0) #(struct:point 540" #" 465) #(struct:point 0 465)) #(struct:translate 0 0 #(struct:overlay" #" #(struct:translate 5120/11 1820/11 #(struct:translate 30 30 #(struc" #"t:ellipse 60 60 0 255 \"white\"))) #(struct:translate 0 0 #(struct:c" #"rop (#(struct:point 0 0) #(struct:point 540 0) #(struct:point 540 46" #"5) #(struct:point 0 465)) #(struct:translate 0 0 #(struct:overlay #(" #"struct:translate 5120/11 2645/11 #(struct:translate 30 30 #(struct:e" #"llipse 60 60 0 255 \"white\"))) #(struct:translate 0 0 #(struct:crop" #" (#(struct:point 0 0) #(struct:point 540 0) #(struct:point 540 465) " #"#(struct:point 0 465)) #(struct:translate 0 0 #(struct:overlay #(str" #"uct:translate 5120/11 3470/11 #(struct:translate 30 30 #(struct:elli" #"pse 60 60 0 255 \"white\"))) #(struct:translate 0 0 #(struct:crop (#" #"(struct:point 0 0) #(struct:point 540 0) #(struct:point 540 465) #(s" #"truct:point 0 465)) #(struct:translate 0 0 #(struct:overlay #(struct" #":translate 5120/11 4295/11 #(struct:translate 30 30 #(struct:ellipse" #" 60 60 0 255 \"black\"))) #(struct:translate 0 0 #(struct:crop (#(st" #"ruct:point 0 0) #(struct:point 540 0) #(struct:point 540 465) #(stru" #"ct:point 0 465)) #(struct:translate 0 0 #(struct:overlay #(struct:tr" #"anslate 4295/11 170/11 #(struct:translate 30 30 #(struct:ellipse 60 " #"60 0 255 \"white\"))) #(struct:translate 0 0 #(struct:crop (#(struct" #":point 0 0) #(struct:point 540 0) #(struct:point 540 465) #(struct:p" #"oint 0 465)) #(struct:translate 0 0 #(struct:overlay #(struct:transl" #"ate 4295/11 995/11 #(struct:translate 30 30 #(struct:ellipse 60 60 0" #" 255 \"white\"))) #(struct:translate 0 0 #(struct:crop (#(struct:poi" #"nt 0 0) #(struct:point 540 0) #(struct:point 540 465) #(struct:point" #" 0 465)) #(struct:translate 0 0 #(struct:overlay #(struct:translate " #"4295/11 1820/11 #(struct:translate 30 30 #(struct:ellipse 60 60 0 25" #"5 \"white\"))) #(struct:translate 0 0 #(struct:crop (#(struct:point " #"0 0) #(struct:point 540 0) #(struct:point 540 465) #(struct:point 0 " #"465)) #(struct:translate 0 0 #(struct:overlay #(struct:translate 429" #"5/11 2645/11 #(struct:translate 30" #" 30 #(struct:ellipse 60 60 0 255 \"white\"))) #(struct:translate 0 0" #" #(struct:crop (#(struct:point 0 0) #(struct:point 540 0) #(struct:p" #"oint 540 465) #(struct:point 0 465)) #(struct:translate 0 0 #(struct" #":overlay #(struct:translate 4295/11 3470/11 #(struct:translate 30 30" #" #(struct:ellipse 60 60 0 255 \"white\"))) #(struct:translate 0 0 #(" #"struct:crop (#(struct:point 0 0) #(struct:point 540 0) #(struct:poin" #"t 540 465) #(struct:point 0 465)) #(struct:translate 0 0 #(struct:ov" #"erlay #(struct:translate 4295/11 4295/11 #(struct:translate 30 30 #(" #"struct:ellipse 60 60 0 255 \"white\"))) #(struct:translate 0 0 #(str" #"uct:crop (#(struct:point 0 0) #(struct:point 540 0) #(struct:point 5" #"40 465) #(struct:point 0 465)) #(struct:translate 0 0 #(struct:overl" #"ay #(struct:translate 3470/11 170/11 #(struct:translate 30 30 #(stru" #"ct:ellipse 60 60 0 255 \"white\"))) #(struct:translate 0 0 #(struct:" #"crop (#(struct:point 0 0) #(struct:point 540 0) #(struct:point 540 4" #"65) #(struct:point 0 465)) #(struct:translate 0 0 #(struct:overlay #" #"(struct:translate 3470/11 995/11 #(struct:translate 30 30 #(struct:e" #"llipse 60 60 0 255 \"white\"))) #(struct:translate 0 0 #(struct:crop" #" (#(struct:point 0 0) #(struct:point 540 0) #(struct:point 540 465) " #"#(struct:point 0 465)) #(struct:translate 0 0 #(struct:overlay #(str" #"uct:translate 3470/11 1820/11 #(struct:translate 30 30 #(struct:elli" #"pse 60 60 0 255 \"white\"))) #(struct:translate 0 0 #(struct:crop (#" #"(struct:point 0 0) #(struct:point 540 0) #(struct:point 540 465) #(s" #"truct:point 0 465)) #(struct:translate 0 0 #(struct:overlay #(struct" #":translate 3470/11 2645/11 #(struct:translate 30 30 #(struct:ellipse" #" 60 60 0 255 \"white\"))) #(struct:translate 0 0 #(struct:crop (#(st" #"ruct:point 0 0) #(struct:point 540 0) #(struct:point 540 465) #(stru" #"ct:point 0 465)) #(struct:translate 0 0 #(struct:overlay #(struct:tr" #"anslate 3470/11 3470/11 #(struct:translate 30 30 #(struct:ellipse 60" #" 60 0 255 \"white\"))) #(struct:translate 0 0 #(struct:crop (#(struc" #"t:point 0 0) #(struct:point 540 0) #(struct:point 540 465) #(struct:" #"point 0 465)) #(struct:translate 0 0 #(struct:overlay #(struct:trans" #"late 3470/11 4295/11 #(struct:translate 30 30 #(struct:ellipse 60 60" #" 0 255 \"white\"))) #(struct:translate 0 0 #(struct:crop (#(struct:p" #"oint 0 0) #(struct:point 540 0) #(struct:point 540 465) #(struct:poi" #"nt 0 465)) #(struct:translate 0 0 #(struct:overlay #(struct:translat" #"e 2645/11 170/11 #(struct:translate 30 30 #(struct:ellipse 60 60 0 2" #"55 \"white\"))) #(struct:translate 0 0 #(struct:crop (#(struct:point" #" 0 0) #(struct:point 540 0) #(struct:point 540 465) #(struct:point 0" #" 465)) #(struct:translate 0 0 #(struct:overlay #(struct:translate 26" #"45/11 995/11 #(struct:translate 30" #" 30 #(struct:ellipse 60 60 0 255 \"white\"))) #(struct:translate 0 0" #" #(struct:crop (#(struct:point 0 0) #(struct:point 540 0) #(struct:p" #"oint 540 465) #(struct:point 0 465)) #(struct:translate 0 0 #(struct" #":overlay #(struct:translate 2645/11 1820/11 #(struct:translate 30 30" #" #(struct:ellipse 60 60 0 255 \"white\"))) #(struct:translate 0 0 #(" #"struct:crop (#(struct:point 0 0) #(struct:point 540 0) #(struct:poin" #"t 540 465) #(struct:point 0 465)) #(struct:translate 0 0 #(struct:ov" #"erlay #(struct:translate 2645/11 2645/11 #(struct:translate 30 30 #(" #"struct:ellipse 60 60 0 255 \"white\"))) #(struct:translate 0 0 #(str" #"uct:crop (#(struct:point 0 0) #(struct:point 540 0) #(struct:point 5" #"40 465) #(struct:point 0 465)) #(struct:translate 0 0 #(struct:overl" #"ay #(struct:translate 2645/11 3470/11 #(struct:translate 30 30 #(str" #"uct:ellipse 60 60 0 255 \"white\"))) #(struct:translate 0 0 #(struct" #":crop (#(struct:point 0 0) #(struct:point 540 0) #(struct:point 540 " #"465) #(struct:point 0 465)) #(struct:translate 0 0 #(struct:overlay " #"#(struct:translate 2645/11 4295/11 #(struct:translate 30 30 #(struct" #":ellipse 60 60 0 255 \"red\"))) #(struct:translate 0 0 #(struct:crop" #" (#(struct:point 0 0) #(struct:point 540 0) #(struct:point 540 465) " #"#(struct:point 0 465)) #(struct:translate 0 0 #(struct:overlay #(str" #"uct:translate 1820/11 170/11 #(struct:translate 30 30 #(struct:ellip" #"se 60 60 0 255 \"white\"))) #(struct:translate 0 0 #(struct:crop (#(" #"struct:point 0 0) #(struct:point 540 0) #(struct:point 540 465) #(st" #"ruct:point 0 465)) #(struct:translate 0 0 #(struct:overlay #(struct:" #"translate 1820/11 995/11 #(struct:translate 30 30 #(struct:ellipse 6" #"0 60 0 255 \"white\"))) #(struct:translate 0 0 #(struct:crop (#(stru" #"ct:point 0 0) #(struct:point 540 0) #(struct:point 540 465) #(struct" #":point 0 465)) #(struct:translate 0 0 #(struct:overlay #(struct:tran" #"slate 1820/11 1820/11 #(struct:translate 30 30 #(struct:ellipse 60 6" #"0 0 255 \"white\"))) #(struct:translate 0 0 #(struct:crop (#(struct:" #"point 0 0) #(struct:point 540 0) #(struct:point 540 465) #(struct:po" #"int 0 465)) #(struct:translate 0 0 #(struct:overlay #(struct:transla" #"te 1820/11 2645/11 #(struct:translate 30 30 #(struct:ellipse 60 60 0" #" 255 \"white\"))) #(struct:translate 0 0 #(struct:crop (#(struct:poi" #"nt 0 0) #(struct:point 540 0) #(struct:point 540 465) #(struct:point" #" 0 465)) #(struct:translate 0 0 #(struct:overlay #(struct:translate " #"1820/11 3470/11 #(struct:translate 30 30 #(struct:ellipse 60 60 0 25" #"5 \"white\"))) #(struct:translate 0 0 #(struct:crop (#(struct:point " #"0 0) #(struct:point 540 0) #(struct:point 540 465) #(struct:point 0 " #"465)) #(struct:translate 0 0 #(struct:overlay #(struct:translate 182" #"0/11 4295/11 #(struct:translate 30" #" 30 #(struct:ellipse 60 60 0 255 \"white\"))) #(struct:translate 0 0" #" #(struct:crop (#(struct:point 0 0) #(struct:point 540 0) #(struct:p" #"oint 540 465) #(struct:point 0 465)) #(struct:translate 0 0 #(struct" #":overlay #(struct:translate 995/11 170/11 #(struct:translate 30 30 #" #"(struct:ellipse 60 60 0 255 \"white\"))) #(struct:translate 0 0 #(st" #"ruct:crop (#(struct:point 0 0) #(struct:point 540 0) #(struct:point " #"540 465) #(struct:point 0 465)) #(struct:translate 0 0 #(struct:over" #"lay #(struct:translate 995/11 995/11 #(struct:translate 30 30 #(stru" #"ct:ellipse 60 60 0 255 \"white\"))) #(struct:translate 0 0 #(struct:" #"crop (#(struct:point 0 0) #(struct:point 540 0) #(struct:point 540 4" #"65) #(struct:point 0 465)) #(struct:translate 0 0 #(struct:overlay #" #"(struct:translate 995/11 1820/11 #(struct:translate 30 30 #(struct:e" #"llipse 60 60 0 255 \"white\"))) #(struct:translate 0 0 #(struct:crop" #" (#(struct:point 0 0) #(struct:point 540 0) #(struct:point 540 465) " #"#(struct:point 0 465)) #(struct:translate 0 0 #(struct:overlay #(str" #"uct:translate 995/11 2645/11 #(struct:translate 30 30 #(struct:ellip" #"se 60 60 0 255 \"white\"))) #(struct:translate 0 0 #(struct:crop (#(" #"struct:point 0 0) #(struct:point 540 0) #(struct:point 540 465) #(st" #"ruct:point 0 465)) #(struct:translate 0 0 #(struct:overlay #(struct:" #"translate 995/11 3470/11 #(struct:translate 30 30 #(struct:ellipse 6" #"0 60 0 255 \"white\"))) #(struct:translate 0 0 #(struct:crop (#(stru" #"ct:point 0 0) #(struct:point 540 0) #(struct:point 540 465) #(struct" #":point 0 465)) #(struct:translate 0 0 #(struct:overlay #(struct:tran" #"slate 995/11 4295/11 #(struct:translate 30 30 #(struct:ellipse 60 60" #" 0 255 \"white\"))) #(struct:translate 0 0 #(struct:crop (#(struct:p" #"oint 0 0) #(struct:point 540 0) #(struct:point 540 465) #(struct:poi" #"nt 0 465)) #(struct:translate 0 0 #(struct:overlay #(struct:translat" #"e 170/11 170/11 #(struct:translate 30 30 #(struct:ellipse 60 60 0 25" #"5 \"white\"))) #(struct:translate 0 0 #(struct:crop (#(struct:point " #"0 0) #(struct:point 540 0) #(struct:point 540 465) #(struct:point 0 " #"465)) #(struct:translate 0 0 #(struct:overlay #(struct:translate 170" #"/11 995/11 #(struct:translate 30 30 #(struct:ellipse 60 60 0 255 \"w" #"hite\"))) #(struct:translate 0 0 #(struct:crop (#(struct:point 0 0) " #"#(struct:point 540 0) #(struct:point 540 465) #(struct:point 0 465))" #" #(struct:translate 0 0 #(struct:overlay #(struct:translate 170/11 1" #"820/11 #(struct:translate 30 30 #(struct:ellipse 60 60 0 255 \"white" #"\"))) #(struct:translate 0 0 #(struct:crop (#(struct:point 0 0) #(st" #"ruct:point 540 0) #(struct:point 540 465) #(struct:point 0 465)) #(s" #"truct:translate 0 0 #(struct:overlay #(struct:translate 170/11 2645/" #"11 #(struct:translate 30 30 #(struct:ellipse 60 60 0 255 \"white\"))" #") #(struct:translate 0 0 #(struct:crop (#(struct:point 0 0) #(struct" #":point 540 0) #(struct:point 540 465) #(struct:point 0 465)) #(struc" #"t:translate 0 0 #(struct:overlay #(struct:translate 170/11 3470/11 #" #"(struct:translate 30 30 #(struct:ellipse 60 60 0 255 \"white\"))) #(" #"struct:translate 0 0 #(struct:crop (#(struct:point 0 0) #(struct:poi" #"nt 540 0) #(struct:point 540 465) #(struct:point 0 465)) #(struct:tr" #"anslate 0 0 #(struct:overlay #(struct:translate 170/11 4295/11 #(str" #"uct:translate 30 30 #(struct:ellipse 60 60 0 255 \"white\"))) #(stru" #"ct:translate 0 0 #(struct:translate 0 0 #(struct:polygon (#(struct:p" #"oint 0 0) #(struct:point 540 0) #(struct:point 540 465) #(struct:poi" #"nt 0 465)) 255 \"yellow\")))))))))))))))))))))))))))))))))))))))))))" #"))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))" #"))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) #(struct" #":bb 540 465 465) #f)" ) 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 14 #"draw-for-tests" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 2 #" " 0 0 23 3 1 #"(" 0 0 15 3 5 #"local" 0 0 23 29 1 #"\n" 0 0 23 3 4 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 5 #"board" 0 0 23 3 1 #" " 0 0 23 29 1 #"\n" 0 0 23 3 7 #" " 0 0 23 3 1 #"(" 0 0 14 3 9 #"make-list" 0 0 23 3 1 #" " 0 0 14 3 7 #"COLUMNS" 0 0 23 29 1 #"\n" 0 0 23 3 18 #" " 0 0 23 3 1 #"(" 0 0 14 3 9 #"make-list" 0 0 23 3 1 #" " 0 0 14 3 4 #"ROWS" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 10 #"PIECE-SIZE" 0 0 23 3 1 #" " 0 0 20 3 2 #"30" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 11 #"RED-CHECKER" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"circle" 0 0 23 3 1 #" " 0 0 14 3 10 #"PIECE-SIZE" 0 0 23 3 1 #" " 0 0 19 3 7 #"\"solid\"" 0 0 23 3 1 #" " 0 0 19 3 5 #"\"red\"" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 13 #"BLACK-CHECKER" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"circle" 0 0 23 3 1 #" " 0 0 14 3 10 #"PIECE-SIZE" 0 0 23 3 1 #" " 0 0 19 3 7 #"\"solid\"" 0 0 23 3 1 #" " 0 0 19 3 7 #"\"black\"" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 13 #"BLANK-CHECKER" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"circle" 0 0 23 3 1 #" " 0 0 14 3 10 #"PIECE-SIZE" 0 0 23 3 1 #" " 0 0 19 3 7 #"\"solid\"" 0 0 23 3 1 #" " 0 0 19 3 7 #"\"white\"" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 6 #"OFFSET" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"/" 0 0 23 3 1 #" " 0 0 14 3 10 #"PIECE-SIZE" 0 0 23 3 1 #" " 0 0 20 3 3 #".66" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 5 #"WIDTH" 0 0 23 29 1 #"\n" 0 0 23 3 7 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"*" 0 0 23 3 1 #" " 0 0 14 3 7 #"COLUMNS" 0 0 23 3 1 #" " 0 0 20 3 3 #"2.5" 0 0 23 3 1 #" " 0 0 14 3 10 #"PIECE-SIZE" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"*" 0 0 23 3 1 #" " 0 0 20 3 3 #"0.5" 0 0 23 3 1 #" " 0 0 14 3 10 #"PIECE-SIZE" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 6 #"HEIGHT" 0 0 23 29 1 #"\n" 0 0 23 3 7 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"*" 0 0 23 3 1 #" " 0 0 14 3 4 #"ROWS" 0 0 23 3 1 #" " 0 0 20 3 3 #"2.5" 0 0 23 3 1 #" " 0 0 14 3 10 #"PIECE-SIZE" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"*" 0 0 23 3 1 #" " 0 0 20 3 3 #"0.5" 0 0 23 3 1 #" " 0 0 14 3 10 #"PIECE-SIZE" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 3 #"MTS" 0 0 23 3 1 #" " 0 0 23 29 1 #"\n" 0 0 23 3 7 #" " 0 0 23 3 1 #"(" 0 0 14 3 9 #"rectangle" 0 0 23 3 1 #" " 0 0 14 3 5 #"WIDTH" 0 0 23 3 1 #" " 0 0 14 3 6 #"HEIGHT" 0 0 23 3 1 #" " 0 0 19 3 7 #"\"solid\"" 0 0 23 3 1 #" " 0 0 19 3 8 #"\"yellow\"" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 20 #"display-board-helper" 0 0 23 3 1 #" " 0 0 14 3 8 #"position" 0 0 23 3 1 #" " 0 0 14 3 8 #"x-offset" 0 0 23 3 1 #" " 0 0 14 3 5 #"image" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 7 #" " 0 0 23 3 1 #"(" 0 0 15 3 4 #"cond" 0 0 23 3 1 #" " 0 0 23 29 1 #"\n" 0 0 23 3 9 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 6 #"empty?" 0 0 23 3 1 #" " 0 0 14 3 8 #"position" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"image" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 9 #" " 0 0 23 3 1 #"[" 0 0 14 3 4 #"else" 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 3 1 #"(" 0 0 14 3 20 #"display-board-helper" 0 0 23 29 1 #"\n" 0 0 23 3 11 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"rest" 0 0 23 3 1 #" " 0 0 14 3 8 #"position" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 11 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 14 3 8 #"x-offset" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"*" 0 0 23 3 1 #" " 0 0 20 3 3 #"2.5" 0 0 23 3 1 #" " 0 0 14 3 10 #"PIECE-SIZE" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 11 #" " 0 0 23 3 1 #"(" 0 0 14 3 14 #"display-column" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 8 #"position" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 27 #" " 0 0 14 3 8 #"x-offset" 0 0 23 29 1 #"\n" 0 0 23 3 27 #" " 0 0 14 3 6 #"OFFSET" 0 0 23 3 1 #" " 0 0 14 3 5 #"image" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 14 #"display-column" 0 0 23 3 1 #" " 0 0 14 3 6 #"column" 0 0 23 3 1 #" " 0 0 14 3 8 #"x-offset" 0 0 23 3 1 #" " 0 0 14 3 8 #"y-offset" 0 0 23 3 1 #" " 0 0 14 3 5 #"image" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 7 #" " 0 0 23 3 1 #"(" 0 0 15 3 4 #"cond" 0 0 23 29 1 #"\n" 0 0 23 3 9 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 6 #"empty?" 0 0 23 3 1 #" " 0 0 14 3 6 #"column" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"image" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 9 #" " 0 0 23 3 1 #"[" 0 0 14 3 4 #"else" 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 3 1 #"(" 0 0 14 3 11 #"place-image" 0 0 23 29 1 #"\n" 0 0 23 3 11 #" " 0 0 23 3 1 #"(" 0 0 15 3 4 #"cond" 0 0 23 3 1 #" " 0 0 23 29 1 #"\n" 0 0 23 3 13 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 1 #"=" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 6 #"column" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 3 #"RED" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 11 #"RED-CHECKER" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 13 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 1 #"=" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 6 #"column" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"BLACK" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 13 #"BLACK-CHECKER" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 13 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 1 #"=" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 6 #"column" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"BLANK" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 13 #"BLANK-CHECKER" 0 0 23 3 1 #"]" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 11 #" " 0 0 14 3 8 #"x-offset" 0 0 23 3 1 #" " 0 0 14 3 8 #"y-offset" 0 0 23 3 1 #" " 0 0 23 29 1 #"\n" 0 0 23 3 11 #" " 0 0 23 3 1 #"(" 0 0 14 3 14 #"display-column" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"rest" 0 0 23 3 1 #" " 0 0 14 3 6 #"column" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 8 #"x-offset" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 14 3 8 #"y-offset" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"*" 0 0 23 3 1 #" " 0 0 20 3 3 #"2.5" 0 0 23 3 1 #" " 0 0 14 3 10 #"PIECE-SIZE" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"image" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 4 #" " 0 0 23 3 1 #"(" 0 0 14 3 20 #"display-board-helper" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 20 #"world-state-position" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 6 #"OFFSET" 0 0 23 3 1 #" " 0 0 14 3 3 #"MTS" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 4 #" " 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 17 3 65 #";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 17 3 46 #";; you should not modify code below this point" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 17 3 95 ( #";; the representation of the world. you should not be modifying thi" #"s structure or its contents" ) 0 0 23 29 1 #"\n" 0 0 17 3 91 ( #";; to conduct the search, you can create instances of this structure" #" as your representation" ) 0 0 23 29 1 #"\n" 0 0 17 3 59 #";(define-struct world-state (position whose-turn settings))" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 17 3 27 #";; Natural List --> Element" 0 0 23 29 1 #"\n" 0 0 17 3 36 #";; returns the nth element of a list" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 7 #"get-nth" 0 0 23 3 1 #" " 0 0 14 3 1 #"n" 0 0 23 3 1 #" " 0 0 14 3 5 #"alist" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 2 #" " 0 0 23 3 1 #"(" 0 0 15 3 5 #"local" 0 0 23 3 1 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 10 #"nth-helper" 0 0 23 3 1 #" " 0 0 14 3 1 #"n" 0 0 23 3 1 #" " 0 0 14 3 7 #"current" 0 0 23 3 1 #" " 0 0 14 3 5 #"alist" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 12 #" " 0 0 23 3 1 #"(" 0 0 15 3 4 #"cond" 0 0 23 29 1 #"\n" 0 0 23 3 14 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 1 #"=" 0 0 23 3 1 #" " 0 0 14 3 1 #"n" 0 0 23 3 1 #" " 0 0 14 3 7 #"current" 0 0 23 3 1 #")" 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 5 #"alist" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 14 #" " 0 0 23 3 1 #"[" 0 0 14 3 4 #"else" 0 0 23 29 1 #"\n" 0 0 23 3 15 #" " 0 0 23 3 1 #"(" 0 0 14 3 10 #"nth-helper" 0 0 23 3 1 #" " 0 0 14 3 1 #"n" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 14 3 7 #"current" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"rest" 0 0 23 3 1 #" " 0 0 14 3 5 #"alist" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 4 #" " 0 0 23 3 1 #"(" 0 0 14 3 10 #"nth-helper" 0 0 23 3 1 #" " 0 0 14 3 1 #"n" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 14 3 5 #"alist" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"main" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 2 #" " 0 0 23 3 1 #"(" 0 0 15 3 5 #"local" 0 0 23 3 1 #" " 0 0 23 29 1 #"\n" 0 0 23 3 4 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 5 #"board" 0 0 23 3 1 #" " 0 0 23 29 1 #"\n" 0 0 23 3 7 #" " 0 0 23 3 1 #"(" 0 0 14 3 9 #"make-list" 0 0 23 3 1 #" " 0 0 14 3 7 #"COLUMNS" 0 0 23 29 1 #"\n" 0 0 23 3 18 #" " 0 0 23 3 1 #"(" 0 0 14 3 9 #"make-list" 0 0 23 3 1 #" " 0 0 14 3 4 #"ROWS" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 10 #"PIECE-SIZE" 0 0 23 3 1 #" " 0 0 20 3 2 #"30" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 11 #"RED-CHECKER" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"circle" 0 0 23 3 1 #" " 0 0 14 3 10 #"PIECE-SIZE" 0 0 23 3 1 #" " 0 0 19 3 7 #"\"solid\"" 0 0 23 3 1 #" " 0 0 19 3 5 #"\"red\"" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 13 #"BLACK-CHECKER" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"circle" 0 0 23 3 1 #" " 0 0 14 3 10 #"PIECE-SIZE" 0 0 23 3 1 #" " 0 0 19 3 7 #"\"solid\"" 0 0 23 3 1 #" " 0 0 19 3 7 #"\"black\"" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 13 #"BLANK-CHECKER" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"circle" 0 0 23 3 1 #" " 0 0 14 3 10 #"PIECE-SIZE" 0 0 23 3 1 #" " 0 0 19 3 7 #"\"solid\"" 0 0 23 3 1 #" " 0 0 19 3 7 #"\"white\"" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 6 #"OFFSET" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"/" 0 0 23 3 1 #" " 0 0 14 3 10 #"PIECE-SIZE" 0 0 23 3 1 #" " 0 0 20 3 3 #".66" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 5 #"WIDTH" 0 0 23 29 1 #"\n" 0 0 23 3 7 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"*" 0 0 23 3 1 #" " 0 0 14 3 7 #"COLUMNS" 0 0 23 3 1 #" " 0 0 20 3 3 #"2.5" 0 0 23 3 1 #" " 0 0 14 3 10 #"PIECE-SIZE" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"*" 0 0 23 3 1 #" " 0 0 20 3 3 #"0.5" 0 0 23 3 1 #" " 0 0 14 3 10 #"PIECE-SIZE" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 6 #"HEIGHT" 0 0 23 29 1 #"\n" 0 0 23 3 7 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"*" 0 0 23 3 1 #" " 0 0 14 3 4 #"ROWS" 0 0 23 3 1 #" " 0 0 20 3 3 #"2.5" 0 0 23 3 1 #" " 0 0 14 3 10 #"PIECE-SIZE" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"*" 0 0 23 3 1 #" " 0 0 20 3 3 #"0.5" 0 0 23 3 1 #" " 0 0 14 3 10 #"PIECE-SIZE" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 3 #"MTS" 0 0 23 3 1 #" " 0 0 23 29 1 #"\n" 0 0 23 3 7 #" " 0 0 23 3 1 #"(" 0 0 14 3 9 #"rectangle" 0 0 23 3 1 #" " 0 0 14 3 5 #"WIDTH" 0 0 23 3 1 #" " 0 0 14 3 6 #"HEIGHT" 0 0 23 3 1 #" " 0 0 19 3 7 #"\"solid\"" 0 0 23 3 1 #" " 0 0 19 3 8 #"\"yellow\"" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 13 #"place-checker" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #" " 0 0 14 3 1 #"x" 0 0 23 3 1 #" " 0 0 14 3 1 #"y" 0 0 23 3 1 #" " 0 0 14 3 11 #"mouse-event" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 7 #" " 0 0 23 3 1 #"(" 0 0 15 3 5 #"local" 0 0 23 29 1 #"\n" 0 0 23 3 9 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 15 #"map-coordinates" 0 0 23 3 1 #" " 0 0 14 3 1 #"x" 0 0 23 3 1 #" " 0 0 14 3 1 #"y" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 10 #"next-state" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 9 #"make-move" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 9 #" " 0 0 23 3 1 #"(" 0 0 15 3 4 #"cond" 0 0 23 29 1 #"\n" 0 0 23 3 11 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 3 #"and" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 8 #"string=?" 0 0 23 3 1 #" " 0 0 14 3 11 #"mouse-event" 0 0 23 3 1 #" " 0 0 19 3 13 #"\"button-down\"" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 17 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"member" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 16 #"legal-next-moves" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 12 #" " 0 0 23 3 1 #"(" 0 0 14 3 2 #"if" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 10 #"check-win?" 0 0 23 3 1 #" " 0 0 14 3 10 #"next-state" 0 0 23 3 1 #")" 0 0 23 3 2 #" " 0 0 23 29 1 #"\n" 0 0 23 3 16 #" " 0 0 23 3 1 #"(" 0 0 15 3 4 #"cond" 0 0 23 29 1 #"\n" 0 0 23 3 18 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 1 #"=" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 22 #"world-state-whose-turn" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 3 #"RED" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 19 #" " 0 0 19 3 10 #"\"RED WINS\"" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 18 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 1 #"=" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 22 #"world-state-whose-turn" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"BLACK" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 19 #" " 0 0 19 3 12 #"\"BLACK WINS\"" 0 0 23 3 1 #"]" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 16 #" " 0 0 23 3 1 #"(" 0 0 15 3 5 #"local" 0 0 23 3 1 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 6 #"result" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 14 #"computer-moves" 0 0 23 3 1 #" " 0 0 14 3 10 #"next-state" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 18 #" " 0 0 23 3 1 #"(" 0 0 14 3 2 #"if" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 10 #"check-win?" 0 0 23 3 1 #" " 0 0 14 3 6 #"result" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 22 #" " 0 0 23 3 1 #"(" 0 0 15 3 4 #"cond" 0 0 23 29 1 #"\n" 0 0 23 3 24 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 1 #"=" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 22 #"world-state-whose-turn" 0 0 23 3 1 #" " 0 0 14 3 10 #"next-state" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 3 #"RED" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 25 #" " 0 0 19 3 10 #"\"RED WINS\"" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 24 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 1 #"=" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 22 #"world-state-whose-turn" 0 0 23 3 1 #" " 0 0 14 3 10 #"next-state" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"BLACK" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 25 #" " 0 0 19 3 12 #"\"BLACK WINS\"" 0 0 23 3 1 #"]" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 22 #" " 0 0 14 3 6 #"result" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 11 #" " 0 0 23 3 1 #"[" 0 0 14 3 4 #"else" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #"]" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 15 #"display-column2" 0 0 23 3 1 #" " 0 0 14 3 6 #"column" 0 0 23 3 1 #" " 0 0 14 3 8 #"x-offset" 0 0 23 3 1 #" " 0 0 14 3 8 #"y-offset" 0 0 23 3 1 #" " 0 0 14 3 5 #"image" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 7 #" " 0 0 14 3 8 #"x-offset" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 14 #"display-column" 0 0 23 3 1 #" " 0 0 14 3 6 #"column" 0 0 23 3 1 #" " 0 0 14 3 8 #"x-offset" 0 0 23 3 1 #" " 0 0 14 3 8 #"y-offset" 0 0 23 3 1 #" " 0 0 14 3 5 #"image" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 7 #" " 0 0 23 3 1 #"(" 0 0 15 3 4 #"cond" 0 0 23 29 1 #"\n" 0 0 23 3 9 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 6 #"empty?" 0 0 23 3 1 #" " 0 0 14 3 6 #"column" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"image" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 9 #" " 0 0 23 3 1 #"[" 0 0 14 3 4 #"else" 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 3 1 #"(" 0 0 14 3 11 #"place-image" 0 0 23 29 1 #"\n" 0 0 23 3 11 #" " 0 0 23 3 1 #"(" 0 0 15 3 4 #"cond" 0 0 23 3 1 #" " 0 0 23 29 1 #"\n" 0 0 23 3 13 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 1 #"=" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 6 #"column" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 3 #"RED" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 11 #"RED-CHECKER" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 13 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 1 #"=" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 6 #"column" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"BLACK" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 13 #"BLACK-CHECKER" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 13 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 1 #"=" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 6 #"column" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"BLANK" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 13 #"BLANK-CHECKER" 0 0 23 3 1 #"]" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 11 #" " 0 0 14 3 8 #"x-offset" 0 0 23 3 1 #" " 0 0 14 3 8 #"y-offset" 0 0 23 3 1 #" " 0 0 23 29 1 #"\n" 0 0 23 3 11 #" " 0 0 23 3 1 #"(" 0 0 14 3 14 #"display-column" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"rest" 0 0 23 3 1 #" " 0 0 14 3 6 #"column" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 8 #"x-offset" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 14 3 8 #"y-offset" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"*" 0 0 23 3 1 #" " 0 0 20 3 3 #"2.5" 0 0 23 3 1 #" " 0 0 14 3 10 #"PIECE-SIZE" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"image" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 20 #"display-board-helper" 0 0 23 3 1 #" " 0 0 14 3 8 #"position" 0 0 23 3 1 #" " 0 0 14 3 8 #"x-offset" 0 0 23 3 1 #" " 0 0 14 3 5 #"image" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 7 #" " 0 0 23 3 1 #"(" 0 0 15 3 4 #"cond" 0 0 23 3 1 #" " 0 0 23 29 1 #"\n" 0 0 23 3 9 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 6 #"empty?" 0 0 23 3 1 #" " 0 0 14 3 8 #"position" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"image" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 9 #" " 0 0 23 3 1 #"[" 0 0 14 3 4 #"else" 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 3 1 #"(" 0 0 14 3 20 #"display-board-helper" 0 0 23 29 1 #"\n" 0 0 23 3 11 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"rest" 0 0 23 3 1 #" " 0 0 14 3 8 #"position" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 11 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 14 3 8 #"x-offset" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"*" 0 0 23 3 1 #" " 0 0 20 3 3 #"2.5" 0 0 23 3 1 #" " 0 0 14 3 10 #"PIECE-SIZE" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 11 #" " 0 0 23 3 1 #"(" 0 0 14 3 14 #"display-column" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 8 #"position" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 27 #" " 0 0 14 3 8 #"x-offset" 0 0 23 29 1 #"\n" 0 0 23 3 27 #" " 0 0 14 3 6 #"OFFSET" 0 0 23 3 1 #" " 0 0 14 3 5 #"image" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 17 3 33 #";(define (display-board position)" 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 17 3 46 #"; (display-board-helper position OFFSET MTS))" 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"render" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 17 3 10 #";;modified" 0 0 23 29 1 #"\n" 0 0 23 3 7 #" " 0 0 23 3 1 #"(" 0 0 14 3 2 #"if" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 7 #"string?" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 11 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"text" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #" " 0 0 20 3 2 #"64" 0 0 23 3 1 #" " 0 0 20 3 1 #"'" 0 0 14 3 4 #"blue" 0 0 23 3 1 #")" 0 0 23 3 4 #" " 0 0 23 29 1 #"\n" 0 0 23 3 11 #" " 0 0 23 3 1 #"(" 0 0 14 3 20 #"display-board-helper" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 20 #"world-state-position" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 6 #"OFFSET" 0 0 23 3 1 #" " 0 0 14 3 3 #"MTS" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 14 #"map-coordinate" 0 0 23 3 1 #" " 0 0 14 3 5 #"lower" 0 0 23 3 1 #" " 0 0 14 3 5 #"upper" 0 0 23 3 1 #" " 0 0 14 3 5 #"click" 0 0 23 3 1 #" " 0 0 14 3 3 #"pos" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 7 #" " 0 0 23 3 1 #"(" 0 0 15 3 4 #"cond" 0 0 23 29 1 #"\n" 0 0 23 3 9 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 3 #"and" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #">" 0 0 23 3 1 #" " 0 0 14 3 5 #"click" 0 0 23 3 1 #" " 0 0 14 3 5 #"lower" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"<" 0 0 23 3 1 #" " 0 0 14 3 5 #"click" 0 0 23 3 1 #" " 0 0 14 3 5 #"upper" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 3 #"pos" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 9 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 1 #">" 0 0 23 3 1 #" " 0 0 14 3 3 #"pos" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 3 #"max" 0 0 23 3 1 #" " 0 0 14 3 4 #"ROWS" 0 0 23 3 1 #" " 0 0 14 3 7 #"COLUMNS" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 2 #"-1" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 9 #" " 0 0 23 3 1 #"[" 0 0 14 3 4 #"else" 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 3 1 #"(" 0 0 14 3 14 #"map-coordinate" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 14 3 5 #"lower" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"*" 0 0 23 3 1 #" " 0 0 20 3 3 #"2.5" 0 0 23 3 1 #" " 0 0 14 3 10 #"PIECE-SIZE" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 14 3 5 #"upper" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"*" 0 0 23 3 1 #" " 0 0 20 3 3 #"2.5" 0 0 23 3 1 #" " 0 0 14 3 10 #"PIECE-SIZE" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"click" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 14 3 3 #"pos" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 29 1 #"\n" 0 0 23 3 5 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 15 #"map-coordinates" 0 0 23 3 1 #" " 0 0 14 3 1 #"x" 0 0 23 3 1 #" " 0 0 14 3 1 #"y" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 29 1 #"\n" 0 0 23 3 7 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 14 #"map-coordinate" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"/" 0 0 23 3 1 #" " 0 0 14 3 10 #"PIECE-SIZE" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 2 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"/" 0 0 23 3 1 #" " 0 0 14 3 10 #"PIECE-SIZE" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"*" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #" " 0 0 14 3 10 #"PIECE-SIZE" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 1 #"x" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 13 #" " 0 0 23 3 1 #"(" 0 0 14 3 14 #"map-coordinate" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"/" 0 0 23 3 1 #" " 0 0 14 3 10 #"PIECE-SIZE" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 2 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"/" 0 0 23 3 1 #" " 0 0 14 3 10 #"PIECE-SIZE" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"*" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #" " 0 0 14 3 10 #"PIECE-SIZE" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 1 #"y" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 4 #" " 0 0 23 29 1 #"\n" 0 0 23 3 4 #" " 0 0 23 3 1 #"(" 0 0 14 3 8 #"big-bang" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #" " 0 0 23 29 1 #"\n" 0 0 23 3 14 #" " 0 0 23 3 1 #"(" 0 0 14 3 8 #"on-mouse" 0 0 23 3 1 #" " 0 0 14 3 13 #"place-checker" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 29 1 #"\n" 0 0 23 3 14 #" " 0 0 23 3 1 #"(" 0 0 14 3 7 #"to-draw" 0 0 23 3 1 #" " 0 0 14 3 6 #"render" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 17 3 114 ( #";; you will use this function. it takes as input the move you will " #"make, represented as a list of X Y coordinates" ) 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 9 #"make-move" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 2 #" " 0 0 23 3 1 #"(" 0 0 15 3 5 #"local" 0 0 23 3 1 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 13 #"update-column" 0 0 23 3 1 #" " 0 0 14 3 4 #"turn" 0 0 23 3 1 #" " 0 0 14 3 6 #"column" 0 0 23 3 1 #" " 0 0 14 3 7 #"current" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 12 #" " 0 0 23 3 1 #"(" 0 0 15 3 4 #"cond" 0 0 23 29 1 #"\n" 0 0 23 3 14 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 6 #"empty?" 0 0 23 3 1 #" " 0 0 14 3 6 #"column" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"empty" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 14 #" " 0 0 23 3 1 #"[" 0 0 14 3 4 #"else" 0 0 23 29 1 #"\n" 0 0 23 3 15 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"cons" 0 0 23 29 1 #"\n" 0 0 23 3 16 #" " 0 0 23 3 1 #"(" 0 0 15 3 4 #"cond" 0 0 23 29 1 #"\n" 0 0 23 3 18 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 1 #"=" 0 0 23 3 1 #" " 0 0 14 3 7 #"current" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 19 #" " 0 0 14 3 4 #"turn" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 18 #" " 0 0 23 3 1 #"[" 0 0 14 3 4 #"else" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 6 #"column" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 16 #" " 0 0 23 3 1 #"(" 0 0 14 3 13 #"update-column" 0 0 23 3 1 #" " 0 0 14 3 4 #"turn" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"rest" 0 0 23 3 1 #" " 0 0 14 3 6 #"column" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 14 3 7 #"current" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 7 #"do-move" 0 0 23 3 1 #" " 0 0 14 3 5 #"board" 0 0 23 3 1 #" " 0 0 14 3 4 #"turn" 0 0 23 3 1 #" " 0 0 14 3 6 #"move-x" 0 0 23 3 1 #" " 0 0 14 3 6 #"move-y" 0 0 23 3 1 #" " 0 0 14 3 9 #"current-x" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 12 #" " 0 0 23 3 1 #"(" 0 0 15 3 4 #"cond" 0 0 23 29 1 #"\n" 0 0 23 3 14 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 6 #"empty?" 0 0 23 3 1 #" " 0 0 14 3 5 #"board" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"empty" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 14 #" " 0 0 23 3 1 #"[" 0 0 14 3 4 #"else" 0 0 23 29 1 #"\n" 0 0 23 3 15 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"cons" 0 0 23 29 1 #"\n" 0 0 23 3 16 #" " 0 0 23 3 1 #"(" 0 0 15 3 4 #"cond" 0 0 23 29 1 #"\n" 0 0 23 3 18 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 1 #"=" 0 0 23 3 1 #" " 0 0 14 3 6 #"move-x" 0 0 23 3 1 #" " 0 0 14 3 9 #"current-x" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 13 #"update-column" 0 0 23 3 1 #" " 0 0 14 3 4 #"turn" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 5 #"board" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 14 3 6 #"move-y" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 18 #" " 0 0 23 3 1 #"[" 0 0 14 3 4 #"else" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 5 #"board" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 16 #" " 0 0 23 3 1 #"(" 0 0 14 3 7 #"do-move" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"rest" 0 0 23 3 1 #" " 0 0 14 3 5 #"board" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 4 #"turn" 0 0 23 3 1 #" " 0 0 14 3 6 #"move-x" 0 0 23 3 1 #" " 0 0 14 3 6 #"move-y" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 14 3 9 #"current-x" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 4 #" " 0 0 23 3 1 #"(" 0 0 14 3 2 #"if" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"member" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 16 #"legal-next-moves" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 8 #" " 0 0 23 3 1 #"(" 0 0 14 3 16 #"make-world-state" 0 0 23 29 1 #"\n" 0 0 23 3 9 #" " 0 0 23 3 1 #"(" 0 0 14 3 7 #"do-move" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 20 #"world-state-position" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 18 #" " 0 0 23 3 1 #"(" 0 0 14 3 22 #"world-state-whose-turn" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 29 1 #"\n" 0 0 23 3 18 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"second" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 9 #" " 0 0 23 3 1 #"(" 0 0 15 3 4 #"cond" 0 0 23 29 1 #"\n" 0 0 23 3 11 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 1 #"=" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 22 #"world-state-whose-turn" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 3 #"RED" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"BLACK" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 11 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 1 #"=" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 22 #"world-state-whose-turn" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"BLACK" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 3 #"RED" 0 0 23 3 1 #"]" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 9 #" " 0 0 23 3 1 #"(" 0 0 14 3 20 #"world-state-settings" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 8 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 17 3 23 #";; world-state --> list" 0 0 23 29 1 #"\n" 0 0 17 3 58 #";; returns all of the legal moves for the current position" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 16 #"legal-next-moves" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 2 #" " 0 0 23 3 1 #"(" 0 0 15 3 5 #"local" 0 0 23 3 1 #" " 0 0 23 3 1 #"[" 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 11 #"first-blank" 0 0 23 3 1 #" " 0 0 14 3 6 #"column" 0 0 23 3 1 #" " 0 0 14 3 3 #"pos" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 12 #" " 0 0 23 3 1 #"(" 0 0 15 3 4 #"cond" 0 0 23 29 1 #"\n" 0 0 23 3 14 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 6 #"empty?" 0 0 23 3 1 #" " 0 0 14 3 6 #"column" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"-" 0 0 23 3 1 #" " 0 0 14 3 3 #"pos" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 14 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 3 #"not" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"=" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 6 #"column" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"BLANK" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 15 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"-" 0 0 23 3 1 #" " 0 0 14 3 3 #"pos" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 14 #" " 0 0 23 3 1 #"[" 0 0 14 3 4 #"else" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 11 #"first-blank" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"rest" 0 0 23 3 1 #" " 0 0 14 3 6 #"column" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 14 3 3 #"pos" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 9 #"get-moves" 0 0 23 3 1 #" " 0 0 14 3 11 #"board-state" 0 0 23 3 1 #" " 0 0 14 3 6 #"column" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 12 #" " 0 0 23 3 1 #"(" 0 0 15 3 4 #"cond" 0 0 23 29 1 #"\n" 0 0 23 3 14 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 6 #"empty?" 0 0 23 3 1 #" " 0 0 14 3 11 #"board-state" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"empty" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 14 #" " 0 0 23 3 1 #"[" 0 0 14 3 4 #"else" 0 0 23 29 1 #"\n" 0 0 23 3 15 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"cons" 0 0 23 29 1 #"\n" 0 0 23 3 16 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 14 3 6 #"column" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 11 #"first-blank" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 11 #"board-state" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 16 #" " 0 0 23 3 1 #"(" 0 0 14 3 9 #"get-moves" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 4 #"rest" 0 0 23 3 1 #" " 0 0 14 3 11 #"board-state" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 14 3 6 #"column" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 8 #"non-neg?" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 17 3 23 #";;;Added to remove bugs" 0 0 23 29 1 #"\n" 0 0 23 3 12 #" " 0 0 23 3 1 #"(" 0 0 14 3 3 #"and" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 3 #"not" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 9 #"negative?" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 5 #"first" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 3 #"not" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 9 #"negative?" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"second" 0 0 23 3 1 #" " 0 0 14 3 4 #"move" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 4 #" " 0 0 23 29 1 #"\n" 0 0 23 3 4 #" " 0 0 23 3 1 #"(" 0 0 14 3 6 #"filter" 0 0 23 3 1 #" " 0 0 14 3 8 #"non-neg?" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 9 #"get-moves" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 20 #"world-state-position" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 32 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 17 3 38 #";; check-win: world-state --> boolean" 0 0 23 29 1 #"\n" 0 0 17 3 78 ( #";; determines whether the game has ended with a victory for whoever " #"just moved" ) 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 10 #"check-win?" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 2 #" " 0 0 23 3 1 #"(" 0 0 15 3 5 #"local" 0 0 23 3 1 #" " 0 0 23 3 1 #"[" 0 0 23 3 4 #" " 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 9 #"up-column" 0 0 23 3 1 #" " 0 0 14 3 5 #"board" 0 0 23 3 1 #" " 0 0 14 3 5 #"color" 0 0 23 3 1 #" " 0 0 14 3 1 #"x" 0 0 23 3 1 #" " 0 0 14 3 1 #"y" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 12 #" " 0 0 23 3 1 #"(" 0 0 14 3 2 #"if" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"<" 0 0 23 3 1 #" " 0 0 14 3 1 #"y" 0 0 23 3 1 #" " 0 0 20 3 1 #"3" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 16 #" " 0 0 14 3 5 #"false" 0 0 23 29 1 #"\n" 0 0 23 3 16 #" " 0 0 23 3 1 #"(" 0 0 15 3 5 #"local" 0 0 23 3 1 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 6 #"column" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 7 #"get-nth" 0 0 23 3 1 #" " 0 0 14 3 1 #"x" 0 0 23 3 1 #" " 0 0 14 3 5 #"board" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 18 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"=" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 7 #"get-nth" 0 0 23 3 2 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"-" 0 0 23 3 1 #" " 0 0 14 3 1 #"y" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 6 #"column" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 21 #" " 0 0 23 3 1 #"(" 0 0 14 3 7 #"get-nth" 0 0 23 3 2 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"-" 0 0 23 3 1 #" " 0 0 14 3 1 #"y" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 6 #"column" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 21 #" " 0 0 23 3 1 #"(" 0 0 14 3 7 #"get-nth" 0 0 23 3 2 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"-" 0 0 23 3 1 #" " 0 0 14 3 1 #"y" 0 0 23 3 1 #" " 0 0 20 3 1 #"3" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 6 #"column" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 21 #" " 0 0 14 3 5 #"color" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 9 #"right-row" 0 0 23 3 1 #" " 0 0 14 3 5 #"board" 0 0 23 3 1 #" " 0 0 14 3 5 #"color" 0 0 23 3 1 #" " 0 0 14 3 1 #"x" 0 0 23 3 1 #" " 0 0 14 3 1 #"y" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 12 #" " 0 0 23 3 1 #"(" 0 0 14 3 2 #"if" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 2 #">=" 0 0 23 3 1 #" " 0 0 14 3 1 #"x" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"-" 0 0 23 3 1 #" " 0 0 14 3 7 #"COLUMNS" 0 0 23 3 1 #" " 0 0 20 3 1 #"3" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 16 #" " 0 0 14 3 5 #"false" 0 0 23 29 1 #"\n" 0 0 23 3 16 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"=" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 7 #"get-nth" 0 0 23 3 1 #" " 0 0 14 3 1 #"y" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 7 #"get-nth" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 14 3 1 #"x" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"board" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 19 #" " 0 0 23 3 1 #"(" 0 0 14 3 7 #"get-nth" 0 0 23 3 1 #" " 0 0 14 3 1 #"y" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 7 #"get-nth" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #" " 0 0 14 3 1 #"x" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"board" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 19 #" " 0 0 23 3 1 #"(" 0 0 14 3 7 #"get-nth" 0 0 23 3 1 #" " 0 0 14 3 1 #"y" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 7 #"get-nth" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 20 3 1 #"3" 0 0 23 3 1 #" " 0 0 14 3 1 #"x" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"board" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 19 #" " 0 0 14 3 5 #"color" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 8 #"up-right" 0 0 23 3 1 #" " 0 0 14 3 5 #"board" 0 0 23 3 1 #" " 0 0 14 3 5 #"color" 0 0 23 3 1 #" " 0 0 14 3 1 #"x" 0 0 23 3 1 #" " 0 0 14 3 1 #"y" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 12 #" " 0 0 23 3 1 #"(" 0 0 14 3 2 #"if" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 2 #"or" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"<" 0 0 23 3 1 #" " 0 0 14 3 1 #"y" 0 0 23 3 1 #" " 0 0 20 3 1 #"3" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 20 #" " 0 0 23 3 1 #"(" 0 0 14 3 2 #">=" 0 0 23 3 1 #" " 0 0 14 3 1 #"x" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"-" 0 0 23 3 1 #" " 0 0 14 3 7 #"COLUMNS" 0 0 23 3 1 #" " 0 0 20 3 1 #"3" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 16 #" " 0 0 14 3 5 #"false" 0 0 23 29 1 #"\n" 0 0 23 3 16 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"=" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 7 #"get-nth" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"-" 0 0 23 3 1 #" " 0 0 14 3 1 #"y" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 7 #"get-nth" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 23 3 1 #" " 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 14 3 1 #"x" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"board" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 19 #" " 0 0 23 3 1 #"(" 0 0 14 3 7 #"get-nth" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"-" 0 0 23 3 1 #" " 0 0 14 3 1 #"y" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 7 #"get-nth" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 23 3 1 #" " 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 14 3 1 #"x" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"board" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 19 #" " 0 0 23 3 1 #"(" 0 0 14 3 7 #"get-nth" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"-" 0 0 23 3 1 #" " 0 0 14 3 1 #"y" 0 0 23 3 1 #" " 0 0 20 3 1 #"3" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 7 #"get-nth" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 23 3 1 #" " 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 14 3 1 #"x" 0 0 23 3 1 #" " 0 0 20 3 1 #"3" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"board" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 19 #" " 0 0 14 3 5 #"color" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 10 #"down-right" 0 0 23 3 1 #" " 0 0 14 3 5 #"board" 0 0 23 3 1 #" " 0 0 14 3 5 #"color" 0 0 23 3 1 #" " 0 0 14 3 1 #"x" 0 0 23 3 1 #" " 0 0 14 3 1 #"y" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 12 #" " 0 0 23 3 1 #"(" 0 0 14 3 2 #"if" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 2 #"or" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 2 #">=" 0 0 23 3 1 #" " 0 0 14 3 1 #"y" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"-" 0 0 23 3 1 #" " 0 0 14 3 4 #"ROWS" 0 0 23 3 1 #" " 0 0 20 3 1 #"3" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 20 #" " 0 0 23 3 1 #"(" 0 0 14 3 2 #">=" 0 0 23 3 1 #" " 0 0 14 3 1 #"x" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"-" 0 0 23 3 1 #" " 0 0 14 3 7 #"COLUMNS" 0 0 23 3 1 #" " 0 0 20 3 1 #"3" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 16 #" " 0 0 14 3 5 #"false" 0 0 23 29 1 #"\n" 0 0 23 3 16 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"=" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 7 #"get-nth" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 14 3 1 #"y" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 7 #"get-nth" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 23 3 1 #" " 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 14 3 1 #"x" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"board" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 19 #" " 0 0 23 3 1 #"(" 0 0 14 3 7 #"get-nth" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 14 3 1 #"y" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 7 #"get-nth" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 23 3 1 #" " 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 14 3 1 #"x" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"board" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 19 #" " 0 0 23 3 1 #"(" 0 0 14 3 7 #"get-nth" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 14 3 1 #"y" 0 0 23 3 1 #" " 0 0 20 3 1 #"3" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 7 #"get-nth" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 23 3 1 #" " 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 14 3 1 #"x" 0 0 23 3 1 #" " 0 0 20 3 1 #"3" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"board" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 19 #" " 0 0 14 3 5 #"color" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 8 #"victory?" 0 0 23 3 1 #" " 0 0 14 3 5 #"board" 0 0 23 3 1 #" " 0 0 14 3 1 #"x" 0 0 23 3 1 #" " 0 0 14 3 1 #"y" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 12 #" " 0 0 23 3 1 #"(" 0 0 15 3 3 #"let" 0 0 23 29 1 #"\n" 0 0 23 3 16 #" " 0 0 23 3 1 #"(" 0 0 23 3 1 #"[" 0 0 14 3 5 #"color" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 7 #"get-nth" 0 0 23 3 1 #" " 0 0 14 3 1 #"y" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 7 #"get-nth" 0 0 23 3 1 #" " 0 0 14 3 1 #"x" 0 0 23 3 1 #" " 0 0 14 3 5 #"board" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 14 #" " 0 0 23 3 1 #"(" 0 0 14 3 2 #"if" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"=" 0 0 23 3 1 #" " 0 0 14 3 5 #"color" 0 0 23 3 1 #" " 0 0 14 3 5 #"BLANK" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 18 #" " 0 0 14 3 5 #"false" 0 0 23 29 1 #"\n" 0 0 23 3 18 #" " 0 0 23 3 1 #"(" 0 0 14 3 2 #"or" 0 0 23 29 1 #"\n" 0 0 23 3 19 #" " 0 0 23 3 1 #"(" 0 0 14 3 9 #"up-column" 0 0 23 3 1 #" " 0 0 14 3 5 #"board" 0 0 23 3 1 #" " 0 0 14 3 5 #"color" 0 0 23 3 1 #" " 0 0 14 3 1 #"x" 0 0 23 3 1 #" " 0 0 14 3 1 #"y" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 19 #" " 0 0 23 3 1 #"(" 0 0 14 3 9 #"right-row" 0 0 23 3 1 #" " 0 0 14 3 5 #"board" 0 0 23 3 1 #" " 0 0 14 3 5 #"color" 0 0 23 3 1 #" " 0 0 14 3 1 #"x" 0 0 23 3 1 #" " 0 0 14 3 1 #"y" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 19 #" " 0 0 23 3 1 #"(" 0 0 14 3 8 #"up-right" 0 0 23 3 1 #" " 0 0 14 3 5 #"board" 0 0 23 3 1 #" " 0 0 14 3 5 #"color" 0 0 23 3 1 #" " 0 0 14 3 1 #"x" 0 0 23 3 1 #" " 0 0 14 3 1 #"y" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 19 #" " 0 0 23 3 1 #"(" 0 0 14 3 10 #"down-right" 0 0 23 3 1 #" " 0 0 14 3 5 #"board" 0 0 23 3 1 #" " 0 0 14 3 5 #"color" 0 0 23 3 1 #" " 0 0 14 3 1 #"x" 0 0 23 3 1 #" " 0 0 14 3 1 #"y" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 11 #"walk-column" 0 0 23 3 1 #" " 0 0 14 3 5 #"board" 0 0 23 3 1 #" " 0 0 14 3 3 #"col" 0 0 23 3 1 #" " 0 0 14 3 3 #"row" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 12 #" " 0 0 23 3 1 #"(" 0 0 15 3 4 #"cond" 0 0 23 29 1 #"\n" 0 0 23 3 14 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 1 #"=" 0 0 23 3 1 #" " 0 0 14 3 3 #"row" 0 0 23 3 1 #" " 0 0 14 3 4 #"ROWS" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"false" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 14 #" " 0 0 23 3 1 #"[" 0 0 14 3 4 #"else" 0 0 23 29 1 #"\n" 0 0 23 3 15 #" " 0 0 23 3 1 #"(" 0 0 14 3 2 #"or" 0 0 23 29 1 #"\n" 0 0 23 3 16 #" " 0 0 23 3 1 #"(" 0 0 14 3 8 #"victory?" 0 0 23 3 1 #" " 0 0 14 3 5 #"board" 0 0 23 3 1 #" " 0 0 14 3 3 #"col" 0 0 23 3 1 #" " 0 0 14 3 3 #"row" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 16 #" " 0 0 23 3 1 #"(" 0 0 14 3 11 #"walk-column" 0 0 23 3 1 #" " 0 0 14 3 5 #"board" 0 0 23 3 1 #" " 0 0 14 3 3 #"col" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 14 3 3 #"row" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 29 1 #"\n" 0 0 23 3 10 #" " 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 10 #"walk-board" 0 0 23 3 1 #" " 0 0 14 3 5 #"board" 0 0 23 3 1 #" " 0 0 14 3 3 #"col" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 12 #" " 0 0 23 3 1 #"(" 0 0 15 3 4 #"cond" 0 0 23 29 1 #"\n" 0 0 23 3 14 #" " 0 0 23 3 1 #"[" 0 0 23 3 1 #"(" 0 0 14 3 1 #"=" 0 0 23 3 1 #" " 0 0 14 3 3 #"col" 0 0 23 3 1 #" " 0 0 14 3 7 #"COLUMNS" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 14 3 5 #"false" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 14 #" " 0 0 23 3 1 #"[" 0 0 14 3 4 #"else" 0 0 23 29 1 #"\n" 0 0 23 3 15 #" " 0 0 23 3 1 #"(" 0 0 14 3 2 #"or" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 11 #"walk-column" 0 0 23 3 1 #" " 0 0 14 3 5 #"board" 0 0 23 3 1 #" " 0 0 14 3 3 #"col" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 19 #" " 0 0 23 3 1 #"(" 0 0 14 3 10 #"walk-board" 0 0 23 3 1 #" " 0 0 14 3 5 #"board" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 1 #"+" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 14 3 3 #"col" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #"]" 0 0 23 29 1 #"\n" 0 0 23 3 4 #" " 0 0 23 3 1 #"(" 0 0 14 3 10 #"walk-board" 0 0 23 3 1 #" " 0 0 23 3 1 #"(" 0 0 14 3 20 #"world-state-position" 0 0 23 3 1 #" " 0 0 14 3 5 #"state" 0 0 23 3 1 #")" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 11 #"START-BOARD" 0 0 23 29 1 #"\n" 0 0 23 3 2 #" " 0 0 23 3 1 #"(" 0 0 14 3 9 #"make-list" 0 0 23 3 1 #" " 0 0 14 3 7 #"COLUMNS" 0 0 23 29 1 #"\n" 0 0 23 3 13 #" " 0 0 23 3 1 #"(" 0 0 14 3 9 #"make-list" 0 0 23 3 1 #" " 0 0 14 3 4 #"ROWS" 0 0 23 3 1 #" " 0 0 14 3 5 #"BLANK" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 15 3 6 #"define" 0 0 23 3 1 #" " 0 0 14 3 11 #"start-state" 0 0 23 29 1 #"\n" 0 0 23 3 2 #" " 0 0 23 3 1 #"(" 0 0 14 3 16 #"make-world-state" 0 0 23 3 1 #" " 0 0 14 3 11 #"START-BOARD" 0 0 23 3 1 #" " 0 0 14 3 3 #"RED" 0 0 23 3 1 #" " 0 0 14 3 5 #"empty" 0 0 23 3 1 #")" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 29 1 #"\n" 0 0 23 3 1 #"(" 0 0 14 3 4 #"main" 0 0 23 3 1 #" " 0 0 14 3 11 #"start-state" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 7 769 60 0 0 0 127 0 23 3 1 #"(" 0 0 14 3 4 #"main" 0 0 23 29 1 #"\n" 0 0 23 3 16 #" (" 0 0 14 3 16 #"make-world-state" 0 0 23 29 1 #"\n" 0 0 23 3 17 #" (" 0 0 14 3 4 #"list" 0 0 23 29 1 #"\n" 0 0 23 3 18 #" (" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 18 #" (" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 18 #" (" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 18 #" (" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"2" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 18 #" (" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 18 #" (" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #")" 0 0 23 29 1 #"\n" 0 0 23 3 18 #" (" 0 0 14 3 4 #"list" 0 0 23 3 1 #" " 0 0 20 3 1 #"1" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 1 #" " 0 0 20 3 1 #"0" 0 0 23 3 2 #"))" 0 0 23 29 1 #"\n" 0 0 23 3 16 #" " 0 0 20 3 1 #"1" 0 0 23 29 1 #"\n" 0 0 23 3 16 #" " 0 0 14 3 5 #"empty" 0 0 23 3 2 #"))" 0 0 0 0 23 29 1 #"\n" 0 0
false
510cafbfdf8c4b6dc9f17384fbd4b84a833a9438
beac83b9c75b88060f4af609498541cf84437fd3
/site/content/centralized-people/mitch-wand.rkt
ed52ba0067214336d88d3ba1d8d5e8289b69d75f
[]
no_license
nuprl/prl-website
272ce3b9edd5b3ada23798a694f6cb7c6d510776
31a321f629a62f945968c3e4c59d180de0f656f6
refs/heads/master
2021-05-16T02:06:38.847789
2016-09-16T14:41:22
2016-09-16T14:41:22
412,044
1
0
null
null
null
null
UTF-8
Racket
false
false
937
rkt
mitch-wand.rkt
#lang racket (provide me) (define me '(person "Mitch Wand" (group "Faculty") (picture "gallery/Mitch_Wand.jpg") (homepage "http://www.ccs.neu.edu/home/wand/") (bio (p "Professor Wand focuses on programming-language semantics and their application to compiler correctness.") (p "Throughout the 1990s, Professor Wand examined the verification of optimizing compilers, building an understanding of how a program analysis justifies the program transformation based upon it.") (p "Professor Wand has also explored the related area of type theory, particularly as applied to object-oriented programming. He has been a leader in the study of continuations, a technique for understanding the control structure of programs. With Daniel P. Friedman and Christopher T. Haynes, he wrote Essentials of Programming Languages, a widely used textbook. He is a Fellow of the Association for Computing Machinery."))))
false
6884b1fd0c4d7653a3440f9cb430deb23f9f7c21
5c58ab6f71ae0637bb701b21f288bc08e815f5e9
/notes/higher-order-procedures.rkt
77234dc239819ff6430fbba5bc107dab20a537d1
[ "MIT" ]
permissive
zxymike93/SICP
81949b33d283ac7e7603d5b02a2bd18d0bf3bd9d
a5b90334207dabeae19feaa3b441a3e64a2aee64
refs/heads/master
2023-01-09T03:22:13.887151
2022-12-28T15:11:54
2022-12-28T15:11:54
98,005,093
19
2
null
null
null
null
UTF-8
Racket
false
false
3,489
rkt
higher-order-procedures.rkt
#lang sicp ;; todo: procedures as arguments ;; fixed-point 满足 f(x)=x ;; 利用这个概念,可以对某些函数求解,比如:求 x 的平方根 y ;; 即 y^2=x,可知 y=x/y ;; 所以只要求得 f(y)=x/y 的 fixed-point 即可得到 x 的平方根 ;; 通过将过程作为参数传递,可以实现 fixed-point 的概念 (define (average a b) (/ (+ a b) 2)) (define (fixed-point f first-guess) (define (close-enough? a b) (> 0.00001 (abs (- a b)))) (define (try guess) (let ((next (f guess))) (if (close-enough? guess next) next (try next)))) (try first-guess)) (define (sqrt x) (fixed-point (lambda (y) (average y (/ x y))) 1.0)) (sqrt 2) ;; 上面使用了 (average y (/ x y)) 而不是 (/ x y), ;; 是因为如果使用后者,在计算中会“摇摆”,而无法“收敛”出答案来: ;; guess: y , next: (/ x y) ;; guess: (/ x y), next: (/ x (/ x y)) ;; 于是引入一个叫 average damping 的计算方法:在影响方程解的情况下,减少演进的变化程度。 ;; 比如这里求 y=x/y 的解,改为求 y = y/2 + x/2y 的解(如上 average 过程所示) ;; 又比如改为 y = y/3 + 2x/3y, ;; 又或者求 x 的三次方根, y = y * x/y^2 ;; 所以 average-damping 可以抽象为一个更高级的过程 ;; 因为我们不关心求的是 x 的平方根还是三次方根,只需要表达 x 和 f(x) 的平均值。 ;; 因为要传给 fixed-point 第一个参数,average-damp 的返回值为过程 (define (average-damp f) (lambda (x) (average x (f x)))) (define (sqrt x) (fixed-point (average-damp (lambda (y) (/ x y))) 1.0)) (define (cbrt x) (fixed-point (average-damp (lambda (y) (/ x (square y)))) 1.0)) ;; 说明 procedures as return values 的另一个例子是导数 ;; 比如:x^3 的导数 3x^2 ,均是关于 x 的函数 ;; 那么导数的表示方式为 (D x f)=>fi (既原函数为参数,返回其导数) ;; 牛顿法就使用了导数这个概念, ;; 如果关于 x 的函数 g(x) 可导,那么等式 g(x) = 0 的解为 ;; 函数 f(x) = x - g(x)/Dg(x) 的 fixed point(其中 Dg(x) 为导数) ;; 根据导数的定义,函数gx在点x1的导数 Dg(x1) = [g(x2) - g(x1)] / (x2-x1) ;; 设 x2-x1 = dx (define (deriv g) (define dx 0.00001) (lambda (x) (/ (- (g (+ x dx)) (g x)) dx))) (define (newtons-method g) (lambda (x) (- x (/ (g x) ((deriv g) x))))) (define (root-of-function g guess) (fixed-point (newtons-method g) guess)) ;; 实际上,求 x 的平方根,也可以用牛顿法 ;; g(y) = x - y^2 的解即 x 的平方根 (define (sqrt x) (root-of-function (lambda (y) (- x (square y))) 1.0)) ;; 以上两个例子,无论是 fixed point search 还是 newtons method 来求 sqrt ;; 实际上都是利用 x = y^2 这条等式的变体,通过 fixed-point 这个过程来求解的 ;; 可以定义一个表达这一概念的过程 (define (fixed-point-transform f transform guess) (fixed-point (transform f) guess)) ;; sqrt: using average damping (define (sqrt x) (fixed-point-transform (lambda (y) (/ x y)) average-damp 1.0)) ;; sqrt: using newton's method (define (sqrt x) (fixed-point-transform (lambda (y) (- (square y) x)) newtons-method 1.0))
false
c3a7c429495af582071d8a276d1902314bb24ce2
25a6efe766d07c52c1994585af7d7f347553bf54
/gui-doc/mrlib/scribblings/arrow-toggle-snip.scrbl
44a26d944a9794144ee1fec7a9fc081eca0fce1c
[ "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
racket/gui
520ff8f4ae5704210822204aa7cd4b74dd4f3eef
d01d166149787e2d94176d3046764b35c7c0a876
refs/heads/master
2023-08-25T15:24:17.693905
2023-08-10T16:45:35
2023-08-10T16:45:35
27,413,435
72
96
NOASSERTION
2023-09-14T17:09:52
2014-12-02T03:35:22
Racket
UTF-8
Racket
false
false
1,051
scrbl
arrow-toggle-snip.scrbl
#lang scribble/doc @(require "common.rkt" (for-label mrlib/arrow-toggle-snip)) @title{Arrow Toggle Snip} @defmodule[mrlib/arrow-toggle-snip] @defclass[arrow-toggle-snip% snip% ()]{ Represents a toggle control, displayed as a right-facing arrow (off or ``closed'') or a downward-facing arrow (on or ``open''). The size of the arrow is determined by the style (and font) applied to the snip. The arrow is drawn inscribed in a square resting on the baseline, but the snip reports its size (usually) as the same as a capital @litchar{X}; this means that the snip should look good next to text (in the same style) no matter whether base-aligned or top-aligned. @defconstructor[([callback (-> boolean? any) void])]{ The @racket[on-up] and @racket[on-down] callbacks are called when the snip is toggled. } @defmethod[(get-toggle-state) boolean?]{ Get the control's state. } @defmethod[(set-toggle-state [v boolean?]) void?]{ Sets the control's state. If the new state is different from the previous state, the appropriate callback is called. } }
false
0874f79145768dc1c7f49efa87efa9783666401c
804e0b7ef83b4fd12899ba472efc823a286ca52d
/peer/src/net/scurl/peer-revocation/revocation-msgs.rkt
f5fdf0f608a275f3d0f7e43afa3602fa92a0f074
[]
no_license
cha63506/CRESTaceans
6ec436d1bcb0256e17499ea9eccd5c034e9158bf
a0d24fd3e93fc39eaf25a0b5df90ce1c4a96ec9b
refs/heads/master
2017-05-06T16:59:57.189426
2013-10-17T15:22:35
2013-10-17T15:22:35
null
0
0
null
null
null
null
UTF-8
Racket
false
false
4,373
rkt
revocation-msgs.rkt
#lang racket/base (require racket/contract racket/list) (require "depends.rkt" "revo-cert.rkt" "../peer-validation/scurl.rkt" "../peer-validation/peer-validation-msgs.rkt") (provide key-revocation-response-msg key-revocation-response-msg? key-revocation-response-msg-revo-cert) ; Create the logger for the revocation-msgs module. (define logger (make-logger 'revocation-msgs-logger revocation-parent-logger)) ; Message id and message for the key revocation certificate message. ; This message is used in response to a key-request-msg to inform the ; peer that the requested scurl has been compromised and should no ; longer be trusted. (define +key-revocation-response-msg-id+ 7001) ; Returns a key-revocation-response-msg that contains the scurl information ; and a signature using the host-id as the input. ; Returns a list with id (int), scurl (string), digest (int), ; pkey (int), key (bytes, and signature (bytes) ; ; revo-cert? -> list? (define (key-revocation-response-msg revo-cert) (let ((scurl (revo-cert-scurl revo-cert)) (sig (revo-cert-signature revo-cert))) (list +key-revocation-response-msg-id+ (url->string (scurl-url scurl)) (digest->integer (scurl-digest-type scurl)) (pkey->integer (scurl-key-type scurl)) (public-key->bytes (scurl-key scurl)) sig))) ; Returns true when the given item is a list with the proper message id ; and proper element types. ; ; any -> boolean? (define (key-revocation-response-msg? msg) (if (and (list? msg) (= (length msg) 6)) (let ((msg-id (first msg)) (url (second msg)) (digest-type-id (third msg)) (pkey-type-id (fourth msg)) (key (fifth msg)) (sig (sixth msg))) (and (equal? msg-id +key-revocation-response-msg-id+) (string? url) (exact-positive-integer? digest-type-id) (exact-positive-integer? pkey-type-id) (bytes? key) (bytes? sig))) ; Not enough elements. #f)) ; Extracts the revo-cert components from the given list which should have ; been created from the key-revocation-response-msg function and creates a revo-cert ; from them. ; Returns false if the revo-cert cannot be created. ; ; any -> (or boolean? revo-cert?) (define (key-revocation-response-msg-revo-cert msg) ; Verify that we have the correct message first. (if (key-revocation-response-msg? msg) ; Extract the items and perform conversions to types. (let ((url (second msg)) (digest-type (integer->digest (third msg))) (key-type (integer->pkey (fourth msg))) (key-bytes (fifth msg)) (sig (sixth msg))) ; Make sure all of the conversions went smoothly. (if (and (!digest? digest-type) (!pkey? key-type)) ; Attempt to create a pkey object. (let ((key (with-handlers ((exn? (lambda (e) (debug logger "Failed to create a pkey out of the key-revocation-response-msg." e) #f))) (bytes->public-key key-type key-bytes)))) (if (pkey? key) ; Let's try to create a scurl. (let ((scurl (string->scurl url digest-type key-type key))) (if (scurl? scurl) (revo-cert scurl sig) (begin (debug logger "Failed to create a scurl from the key-revocation-response-msg.") #f))) (begin (debug logger "Failed to create a pkey out of the key-revocation-response-msg.") #f))) (begin (debug logger "The digest-type-id or pkey-type-id failed to convert to a valid type.") #f))) (begin (debug logger "The given item was not a valid key-revocation-response-msg.") #f)))
false
c7334056e145a796376d9c6c13a5b5ce696e4ea6
49d98910cccef2fe5125f400fa4177dbdf599598
/advent-of-code-2020/day01-1.rkt
ae6800b126573ab10049eac760c3ce43c35cc058
[]
no_license
lojic/LearningRacket
0767fc1c35a2b4b9db513d1de7486357f0cfac31
a74c3e5fc1a159eca9b2519954530a172e6f2186
refs/heads/master
2023-01-11T02:59:31.414847
2023-01-07T01:31:42
2023-01-07T01:31:42
52,466,000
30
4
null
null
null
null
UTF-8
Racket
false
false
2,405
rkt
day01-1.rkt
#lang racket (require "./advent.rkt") ;; Advent of Code 2020 Day 1: ;; Find two numbers in the input that sum to 2020, then multiply them ;; to obtain the puzzle answer. (define expense-sum 2020) (define expenses-filename "day01.txt") ;; (get-expenses fname) -> (listof number?) ;; fname : string? ;; ;; Returns a list of numbers obtained from reading a file containing ;; one number per line. (define (get-expenses fname) (with-input-from-file fname (thunk (for/list ([ l (in-lines) ]) (string->number l))))) ;; (sums-to n) -> boolean? ;; n : number? ;; ;; Returns a procedure that accepts two numbers and indicates whether ;; they sum to the specified value. (define (sums-to n) (λ (n1 n2) (= n (+ n1 n2)))) (module+ main (let ([ pair (find-2 (sums-to expense-sum) (get-expenses expenses-filename)) ]) (if pair (let ([ n1 (car pair) ] [ n2 (cdr pair) ]) (printf "Answer is ~a * ~a = ~a\n" n1 n2 (* n1 n2))) (printf "Unable to find 2 numbers that sum to ~a\n" expense-sum)))) (module+ test (require rackunit) ;; ------------------------------------------------------------------------------------------ ;; get-expenses ;; ------------------------------------------------------------------------------------------ (let ([ l (get-expenses expenses-filename) ]) (check-equal? (first l) 1652) (check-equal? (second l) 1998) (check-equal? (last l) 1861)) ;; ------------------------------------------------------------------------------------------ ;; sums-to ;; ------------------------------------------------------------------------------------------ (check-not-false ((sums-to 7) 3 4)) (check-false ((sums-to 7) 1 2)) ;; ------------------------------------------------------------------------------------------ ;; find-2 ;; ------------------------------------------------------------------------------------------ (check-false (find-2 (sums-to 0) '())) (check-false (find-2 (sums-to 0) '(0))) (check-false (find-2 (sums-to 0) '(1 2 3))) (check-equal? (find-2 (sums-to 3) '(1 2 3)) (cons 1 2)) ;; Use a list with the first element is half the sum to ensure we ;; don't erroneously sum the same element. (check-equal? (find-2 (sums-to 4) '(2 1 7 4 0)) (cons 4 0)) (check-equal? (find-2 (sums-to 4) '(3 -1 2 5)) (cons -1 5)) )
false
2779ccb15ab5ba9d3ea00ea7cf4751d29454a47e
56c5f129167943f60dab3a7256db3d0cf5be33cf
/libgit2/include/object.rkt
72ec3a9e5f0e892678ecdac406327b4755e79eb4
[ "MIT" ]
permissive
guygastineau/libgit2
d21111384afbfe4068bd5f289bd1de811c94b93e
6d6a007543900eb7a6fbbeba55850288665bdde5
refs/heads/master
2022-12-12T15:21:28.849065
2019-05-06T20:59:17
2019-05-06T20:59:17
294,779,175
0
0
null
2020-09-11T18:26:21
2020-09-11T18:26:20
null
UTF-8
Racket
false
false
1,309
rkt
object.rkt
#lang racket (require ffi/unsafe "define.rkt" "types.rkt" "buffer.rkt" "utils.rkt") (provide (all-defined-out)) (define-libgit2/dealloc git_object_free (_fun _object -> _void)) (define-libgit2 git_object__size (_fun _git_otype -> _size)) (define-libgit2/alloc git_object_dup (_fun _object _object -> _int) git_object_free) (define-libgit2 git_object_id (_fun _object -> _oid)) (define-libgit2/alloc git_object_lookup (_fun _object _repository _oid _git_otype -> _int) git_object_free) (define-libgit2/alloc git_object_lookup_bypath (_fun _object _object _string _git_otype -> _int) git_object_free) (define-libgit2/alloc git_object_lookup_prefix (_fun _object _repository _oid _size _git_otype -> _int) git_object_free) (define-libgit2 git_object_owner (_fun _object -> _repository)) (define-libgit2/alloc git_object_peel (_fun _object _object _git_otype -> _int) git_object_free) (define-libgit2/check git_object_short_id (_fun _buf _object -> _int)) (define-libgit2 git_object_string2type (_fun _string -> _git_otype)) (define-libgit2 git_object_type (_fun _object -> _git_otype)) (define-libgit2 git_object_type2string (_fun _git_otype -> _string)) (define-libgit2 git_object_typeisloose (_fun _git_otype -> _bool))
false
87692cf3ae6f068da2c855ab886da1877397b6cd
a9726aae050211a6b6fd8d07792a71f7138e8341
/adders.rkt
a70579379c335e658f9ecee57962890616b7a52c
[ "MIT" ]
permissive
souravdatta/rkts
45f2633aa277fd0b84617b05263e4603c0b8d5e1
cf07926d7cb4603ea6e1bf78553e3870befc863a
refs/heads/master
2021-01-17T14:57:11.961644
2017-08-24T09:56:20
2017-08-24T09:56:20
52,510,749
0
1
null
null
null
null
UTF-8
Racket
false
false
1,267
rkt
adders.rkt
#lang racket (require "propagators.rkt") (define (andf x y) (if (= x 1) y 0)) (define (orf x y) (if (= x 0) y 1)) (define (notf x) (if (= x 0) 1 0)) (define and-gate (func->propagator andf)) (define or-gate (func->propagator orf)) (define not-gate (func->propagator notf)) (define (nand-gate x y z) (compound-propagator (list x y z) (lambda () (let ((t1 (make-cell))) (and-gate x y t1) (not-gate t1 z))))) (define (xor-gate a b c) (compound-propagator (list a b c) (lambda () (let ((ti1 (make-cell)) (ti2 (make-cell)) (ti3 (make-cell))) (nand-gate a b ti1) (nand-gate a ti1 ti2) (nand-gate b ti1 ti3) (nand-gate ti2 ti3 c))))) (define (full-adder a b ci s co) (compound-propagator (list a b ci s co) (lambda () (let ((t1 (make-cell)) (t2 (make-cell)) (t3 (make-cell))) (xor-gate a b t1) (xor-gate ci t1 s) (and-gate t1 ci t2) (and-gate a b t3) (or-gate t2 t3 co))))) (provide full-adder)
false
5b9035c3f292036fecfa1a923984fec1fbba85e7
78deea78570f56349e67fe1a3226a9c63d287962
/info.rkt
2b40b4808bc2f30f37e14e654d920b12ab6baf2b
[]
no_license
joskoot/partitions
b3e919edac1bd0ed873f6a51700fa6cfb7ae034e
a31a4fdc8394a0e4b9812d91421ffb63997d058d
refs/heads/master
2021-12-01T22:33:30.019137
2021-11-28T01:13:11
2021-11-28T01:13:11
110,146,384
2
0
null
null
null
null
UTF-8
Racket
false
false
116
rkt
info.rkt
#lang info ; By Jacob J. A. Koot (define scribblings '(("partitions.scrbl" ()))) (define collection "partitions")
false
d2b3c2579c3e842183a93eeeb56ccab795bc9919
1261c45ca4f0b89c2099072839a084e70a6b49a2
/planet/climate-generation/defaults.rkt
5732bc7153b20f953b02e1a0db1a25f4e1abc913
[]
no_license
MightyBOBcnc/earthgen
8906cadf65b41ae85990f317dcaa633d344d38d0
3d5c6de580993c15dbfadabd85b339860a5df3df
refs/heads/master
2022-04-24T03:06:18.882954
2020-04-27T00:47:25
2020-04-27T00:47:25
null
0
0
null
null
null
null
UTF-8
Racket
false
false
2,091
rkt
defaults.rkt
#lang typed/racket (require math/flonum "../grid-base.rkt" "../geometry.rkt" "../terrain.rkt" "../climate.rkt") (provide (all-defined-out)) (: default-temperature (planet-terrain (Integer -> Float) -> (Integer -> Float))) (define ((default-temperature p tile-sunlight) n) (- (+ 220.0 (* (/ 110.0 solar-constant) (if (tile-land? p n) (tile-sunlight n) (sunlight 0.0 (tile-latitude p n))))) (max 0.0 (temperature-lapse (tile-elevation p n))))) (: default-snow-cover (planet-terrain (Integer -> Float) -> (Integer -> Float))) (define ((default-snow-cover p tile-temperature) n) (let ([temperature (tile-temperature n)]) (if (tile-water? p n) 0.0 (if (below-freezing-temperature? temperature) 1.0 0.0)))) (: default-pressure-gradient-force (Float Float -> FlVector)) (define (default-pressure-gradient-force tropical-equator latitude) (let* ([c (fl/ (fl* 3.0 pi) (fl+ (fl/ pi 2.0) (if (> tropical-equator latitude) tropical-equator (- tropical-equator))))] [pressure-deviation (fl/ 20.0 15000.0)] [pressure-derivate (fl/ (fl* pressure-deviation (flsin (fl* c (fl- latitude tropical-equator)))) (if (< (fl- tropical-equator (fl/ (fl+ (fl/ pi 2.0) tropical-equator) 3.0)) latitude (fl- tropical-equator (fl/ (fl- (fl/ pi 2.0) tropical-equator) 3.0))) 3.0 1.0))]) (flvector 0.0 0.0 pressure-derivate))) (: default-wind (Float planet-climate Integer -> FlVector)) (define (default-wind tropical-equator p n) (prevailing-wind p (tile-coordinates p n) (default-pressure-gradient-force tropical-equator (tile-latitude p n)) (tile-surface-friction p n)))
false
6a6b7dcaf1b909a3306e48c3dae6153a9b88a2ae
c04c0d07aeb861325cd24bd04d38bca1028c117e
/Adventure 3/sample-game.rkt
ae71272f53aa5c1abb3e26439eb9fc84b89bac85
[]
no_license
lanejos37/CS111_Final_Project
930df425a28149cbea8bc34d78e9e4fd66781728
9933d46cd844c3c6e6de0449f8b281c142958610
refs/heads/main
2023-01-29T10:16:30.024587
2020-12-07T19:41:27
2020-12-07T19:41:27
315,433,593
0
1
null
2020-11-27T23:54:47
2020-11-23T20:32:33
Racket
UTF-8
Racket
false
false
20,146
rkt
sample-game.rkt
;; The first three lines of this file were inserted by DrRacket. They record metadata ;; about the language level of this file in a form that our tools can easily process. #reader(lib "htdp-advanced-reader.ss" "lang")((modname adventure) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #t #t none #f () #f))) (require "adventure-define-struct.rkt") (require "macros.rkt") (require "utilities.rkt") ;;; ;;; OBJECT ;;; Base type for all in-game objects ;;; (define-struct object ;; adjectives: (listof string) ;; List of adjectives to be printed in the description of this object (adjectives) #:methods ;; noun: object -> string ;; Returns the noun to use to describe this object. (define (noun o) (type-name-string o)) ;; description-word-list: object -> (listof string) ;; The description of the object as a list of individual ;; words, e.g. '("a" "red" "door"). (define (description-word-list o) (add-a-or-an (append (object-adjectives o) (list (noun o))))) ;; description: object -> string ;; Generates a description of the object as a noun phrase, e.g. "a red door". (define (description o) (words->string (description-word-list o))) ;; print-description: object -> void ;; EFFECT: Prints the description of the object. (define (print-description o) (begin (printf (description o)) (newline) (void)))) ;;; ;;; CONTAINER ;;; Base type for all game objects that can hold things ;;; (define-struct (container object) ;; contents: (listof thing) ;; List of things presently in this container (contents) #:methods ;; container-accessible-contents: container -> (listof thing) ;; Returns the objects from the container that would be accessible to the player. ;; By default, this is all the objects. But if you want to implement locked boxes, ;; rooms without light, etc., you can redefine this to withhold the contents under ;; whatever conditions you like. (define (container-accessible-contents c) (container-contents c)) ;; prepare-to-remove!: container thing -> void ;; Called by move when preparing to move thing out of ;; this container. Normally, this does nothing, but ;; if you want to prevent the object from being moved, ;; you can throw an exception here. (define (prepare-to-remove! container thing) (void)) ;; prepare-to-add!: container thing -> void ;; Called by move when preparing to move thing into ;; this container. Normally, this does nothing, but ;; if you want to prevent the object from being moved, ;; you can throw an exception here. (define (prepare-to-add! container thing) (void)) ;; remove!: container thing -> void ;; EFFECT: removes the thing from the container (define (remove! container thing) (set-container-contents! container (remove thing (container-contents container)))) ;; add!: container thing -> void ;; EFFECT: adds the thing to the container. Does not update the thing's location. (define (add! container thing) (set-container-contents! container (cons thing (container-contents container)))) ;; describe-contents: container -> void ;; EFFECT: prints the contents of the container (define (describe-contents container) (begin (local [(define other-stuff (remove me (container-accessible-contents container)))] (if (empty? other-stuff) (printf "There's nothing here.~%") (begin (printf "You see:~%") (for-each print-description other-stuff)))) (void)))) ;; move!: thing container -> void ;; Moves thing from its previous location to container. ;; EFFECT: updates location field of thing and contents ;; fields of both the new and old containers. (define (move! thing new-container) (begin (prepare-to-remove! (thing-location thing) thing) (prepare-to-add! new-container thing) (prepare-to-move! thing new-container) (remove! (thing-location thing) thing) (add! new-container thing) (set-thing-location! thing new-container))) ;; destroy!: thing -> void ;; EFFECT: removes thing from the game completely. (define (destroy! thing) ; We just remove it from its current location ; without adding it anyplace else. (remove! (thing-location thing) thing)) ;;; ;;; ROOM ;;; Base type for rooms and outdoor areas ;;; (define-struct (room container) ()) ;; new-room: string -> room ;; Makes a new room with the specified adjectives (define (new-room adjectives) (make-room (string->words adjectives) '())) ;;; ;;; THING ;;; Base type for all physical objects that can be inside other objects such as rooms ;;; (define-struct (thing container) ;; location: container ;; What room or other container this thing is presently located in. (location) #:methods (define (examine thing) (print-description thing)) ;; prepare-to-move!: thing container -> void ;; Called by move when preparing to move thing into ;; container. Normally, this does nothing, but ;; if you want to prevent the object from being moved, ;; you can throw an exception here. (define (prepare-to-move! container thing) (void))) ;; initialize-thing!: thing -> void ;; EFFECT: adds thing to its initial location (define (initialize-thing! thing) (add! (thing-location thing) thing)) ;; new-thing: string container -> thing ;; Makes a new thing with the specified adjectives, in the specified location, ;; and initializes it. (define (new-thing adjectives location) (local [(define thing (make-thing (string->words adjectives) '() location))] (begin (initialize-thing! thing) thing))) ;;; ;;; DOOR ;;; A portal from one room to another ;;; To join two rooms, you need two door objects, one in each room ;;; (define-struct (door thing) ;; destination: container ;; The place this door leads to (destination) #:methods ;; go: door -> void ;; EFFECT: Moves the player to the door's location and (look)s around. (define (go door) (begin (move! me (door-destination door)) (look)))) ;; join: room string room string ;; EFFECT: makes a pair of doors with the specified adjectives ;; connecting the specified rooms. (define (join! room1 adjectives1 room2 adjectives2) (local [(define r1->r2 (make-door (string->words adjectives1) '() room1 room2)) (define r2->r1 (make-door (string->words adjectives2) '() room2 room1))] (begin (initialize-thing! r1->r2) (initialize-thing! r2->r1) (void)))) ;;; ;;; PERSON ;;; A character in the game. The player character is a person. ;;; (define-struct (person thing) ()) ;; initialize-person: person -> void ;; EFFECT: do whatever initializations are necessary for persons. (define (initialize-person! p) (initialize-thing! p)) ;; new-person: string container -> person ;; Makes a new person object and initializes it. (define (new-person adjectives location) (local [(define person (make-person (string->words adjectives) '() location))] (begin (initialize-person! person) person))) ;; This is the global variable that holds the person object representing ;; the player. This gets reset by (start-game) (define me empty) ;;; ;;; PROP ;;; A thing in the game that doesn't serve any purpose other than to be there. ;;; (define-struct (prop thing) (;; noun-to-print: string ;; The user can set the noun to print in the description so it doesn't just say "prop" noun-to-print ;; examine-text: string ;; Text to print if the player examines this object examine-text ) #:methods (define (noun prop) (prop-noun-to-print prop)) (define (examine prop) (display-line (prop-examine-text prop)))) ;; new-prop: string container -> prop ;; Makes a new prop with the specified description. (define (new-prop description examine-text location) (local [(define words (string->words description)) (define noun (last words)) (define adjectives (drop-right words 1)) (define prop (make-prop adjectives '() location noun examine-text))] (begin (initialize-thing! prop) prop))) ;;; ;;; Magic 8 ball ;;; (define-struct (magic-8-ball thing) ;; sayings: (listof string) ;; The collection of strings that it picks from when generating an answer. (sayings) #:methods ;; change noun to just return "ball"; we put the magic and 8 ;; in the adjectives (define (noun ball) "ball") ;; shake: magic-8-ball -> void ;; Randomly print a saying. (define (shake ball) (begin (display-line "As you lift the ball, faint words appear in the inky darkness.") (display "They read: ") (display-line (random-element (magic-8-ball-sayings ball))))) (define (examine ball) (shake ball))) ;; Tell the help system that shake is a command. (define-user-command (shake magic-8-ball) "Tells your future") ;; random-element: (listof T) -> T ;; Return a randomly chosen element of list. (define (random-element list) (list-ref list (random (length list)))) ;; new-magic-8-ball: (listof string) container -> magic-8-ball ;; Makes a magic 8 ball with the specified set of sayings (define (new-magic-8-ball sayings location) (local [(define ball (make-magic-8-ball '("magic" "8") '() location sayings))] (begin (initialize-thing! ball) ball))) ;; standard-magic-8-ball: container -> magic-8-ball ;; Makes a magic 8 ball with the default sayings (define (standard-magic-8-ball location) (new-magic-8-ball '("It is certain." "It is decidedly so." "Without a doubt." "Yes – definitely." "You may rely on it." "As I see it, yes." "Most likely." "Outlook good." "Yes." "Signs point to yes." "Reply hazy, try again." "Ask again later." "Better not tell you now." "Cannot predict now." "Concentrate and ask again." "Don't count on it." "My reply is no." "My sources say no." "Outlook not so good." "Very doubtful.") location)) ;;; ;;; USER COMMANDS ;;; (define (look) (begin (printf "You are in ~A.~%" (description (here))) (describe-contents (here)) (void))) (define-user-command (look) "Prints what you can see in the room") (define (inventory) (if (empty? (my-inventory)) (printf "You don't have anything.~%") (begin (printf "You have:~%") (for-each print-description (my-inventory))))) (define-user-command (inventory) "Prints the things you are carrying with you.") (define-user-command (examine thing) "Takes a closer look at the thing") (define (take thing) (move! thing me)) (define-user-command (take thing) "Moves thing to your inventory") (define (drop thing) (move! thing (here))) (define-user-command (drop thing) "Removes thing from your inventory and places it in the room ") (define (put thing container) (move! thing container)) (define-user-command (put thing container) "Moves the thing from its current location and puts it in the container.") (define (help) (for-each (λ (command-info) (begin (display (first command-info)) (newline) (display (second command-info)) (newline) (newline))) (all-user-commands))) (define-user-command (help) "Displays this help information") (define-user-command (go door) "Go through the door to its destination") (define (check condition) (if condition (display-line "Check succeeded") (error "Check failed!!!"))) (define-user-command (check condition) "Throws an exception if condition is false.") ;;; ;;; THE GAME WORLD ;;; (define (start-game) (local [(define room1 (new-room "blank empty")) (define room2 (new-room "happy joyful"))] (begin (set! me (new-person "" room1)) (join! room1 "happy joyful" room2 "blank empty") (new-prop "banana" "It's a banana. I wonder how long it's been here..." room2) (standard-magic-8-ball room1) (check-containers!) (void)))) (define-walkthrough walkthrough (shake (the ball)) (go (the door)) (take (the banana)) (inventory) (check (have? (the banana))) (go (the door)) (drop (the banana)) (check (not (have? (the banana)))) (look) (inventory) (check (room? (thing-location (the banana)))) (shake (the ball))) ;;; ;;; UTILITIES ;;; ;; here: -> container ;; The current room the player is in (define (here) (thing-location me)) ;; stuff-here: -> (listof thing) ;; All the stuff in the room the player is in (define (stuff-here) (container-accessible-contents (here))) ;; stuff-here-except-me: -> (listof thing) ;; All the stuff in the room the player is in except the player. (define (stuff-here-except-me) (remove me (stuff-here))) ;; my-inventory: -> (listof thing) ;; List of things in the player's pockets. (define (my-inventory) (container-accessible-contents me)) ;; accessible-objects -> (listof thing) ;; All the objects that should be searched by find and the. (define (accessible-objects) (append (stuff-here-except-me) (my-inventory))) ;; have?: thing -> boolean ;; True if the thing is in the player's pocket. (define (have? thing) (eq? (thing-location thing) me)) ;; have-a?: predicate -> boolean ;; True if the player as something satisfying predicate in their pocket. (define (have-a? predicate) (ormap predicate (container-accessible-contents me))) ;; find-the: (listof string) -> object ;; Returns the object from (accessible-objects) ;; whose name contains the specified words. (define (find-the words) (find (λ (o) (andmap (λ (name) (is-a? o name)) words)) (accessible-objects))) ;; find-within: container (listof string) -> object ;; Like find-the, but searches the contents of the container ;; whose name contains the specified words. (define (find-within container words) (find (λ (o) (andmap (λ (name) (is-a? o name)) words)) (container-accessible-contents container))) ;; find: (object->boolean) (listof thing) -> object ;; Search list for an object matching predicate. (define (find predicate? list) (local [(define matches (filter predicate? list))] (case (length matches) [(0) (error "There's nothing like that here")] [(1) (first matches)] [else (error "Which one?")]))) ;; everything: -> (listof container) ;; Returns all the objects reachable from the player in the game ;; world. So if you create an object that's in a room the player ;; has no door to, it won't appear in this list. (define (everything) (local [(define all-containers '()) ; Add container, and then recursively add its contents ; and location and/or destination, as appropriate. (define (walk container) ; Ignore the container if its already in our list (unless (member container all-containers) (begin (set! all-containers (cons container all-containers)) ; Add its contents (for-each walk (container-contents container)) ; If it's a door, include its destination (when (door? container) (walk (door-destination container))) ; If it's a thing, include its location. (when (thing? container) (walk (thing-location container))))))] ; Start the recursion with the player (begin (walk me) all-containers))) ;; print-everything: -> void ;; Prints all the objects in the game. (define (print-everything) (begin (display-line "All objects in the game:") (for-each print-description (everything)))) ;; every: (container -> boolean) -> (listof container) ;; A list of all the objects from (everything) that satisfy ;; the predicate. (define (every predicate?) (filter predicate? (everything))) ;; print-every: (container -> boolean) -> void ;; Prints all the objects satisfying predicate. (define (print-every predicate?) (for-each print-description (every predicate?))) ;; check-containers: -> void ;; Throw an exception if there is an thing whose location and ;; container disagree with one another. (define (check-containers!) (for-each (λ (container) (for-each (λ (thing) (unless (eq? (thing-location thing) container) (error (description container) " has " (description thing) " in its contents list but " (description thing) " has a different location."))) (container-contents container))) (everything))) ;; is-a?: object word -> boolean ;; True if word appears in the description of the object ;; or is the name of one of its types (define (is-a? obj word) (let* ((str (if (symbol? word) (symbol->string word) word)) (probe (name->type-predicate str))) (if (eq? probe #f) (member str (description-word-list obj)) (probe obj)))) ;; display-line: object -> void ;; EFFECT: prints object using display, and then starts a new line. (define (display-line what) (begin (display what) (newline) (void))) ;; words->string: (listof string) -> string ;; Converts a list of one-word strings into a single string, ;; e.g. '("a" "red" "door") -> "a red door" (define (words->string word-list) (string-append (first word-list) (apply string-append (map (λ (word) (string-append " " word)) (rest word-list))))) ;; string->words: string -> (listof string) ;; Converts a string containing words to a list of the individual ;; words. Inverse of words->string. (define (string->words string) (string-split string)) ;; add-a-or-an: (listof string) -> (listof string) ;; Prefixes a list of words with "a" or "an", depending ;; on whether the first word in the list begins with a ;; vowel. (define (add-a-or-an word-list) (local [(define first-word (first word-list)) (define first-char (substring first-word 0 1)) (define starts-with-vowel? (string-contains? first-char "aeiou"))] (cons (if starts-with-vowel? "an" "a") word-list))) ;; ;; The following calls are filling in blanks in the other files. ;; This is needed because this file is in a different langauge than ;; the others. ;; (set-find-the! find-the) (set-find-within! find-within) (set-restart-game! (λ () (start-game))) (define (game-print object) (cond [(void? object) (void)] [(object? object) (print-description object)] [else (write object)])) (current-print game-print) ;;; ;;; Start it up ;;; (start-game) (look)
false
ff322e4ea032a1fd6c013e42b16af2f127910d63
5bbc152058cea0c50b84216be04650fa8837a94b
/data/6.4.0.5/fsm-2016-01-29T10:44:41.rktd
ae0246c3508a953a00f497d682b6cef20b130d4e
[]
no_license
nuprl/gradual-typing-performance
2abd696cc90b05f19ee0432fb47ca7fab4b65808
35442b3221299a9cadba6810573007736b0d65d4
refs/heads/master
2021-01-18T15:10:01.739413
2018-12-15T18:44:28
2018-12-15T18:44:28
27,730,565
11
3
null
2018-12-01T13:54:08
2014-12-08T19:15:22
Racket
UTF-8
Racket
false
false
1,884
rktd
fsm-2016-01-29T10:44:41.rktd
;; #(-r /home/ben/code/racket/6.4.0.5/bin fsmv2) ;; 6.4.0.5 ;; base @ 86a9c2e4 ;; typed-racket @ 69443fc1 #( (188 190 191 192 196 200 196 208 198 205) (222 248 257 253 254 253 256 256 254 254 254 253 255 252 249 251 252 250 250 253 253 250 248 252 252 251 250 253 251 252 251) (405554 407266 413158 403855 405643 420209 404696 408792 416000 409795) (598856 595717 593109 594556 594553 595943 572269 542222 518413 500106 356765 357006 352661 353350 354981 352029 354819 354881 354817 351238 355565 354720 352483 353504 356488 351157 353181 352645 356183 354493 354679) (599336 593780 586483 586618 590996 588781 572218 537827 520530 507875) (402454 411466 415194 405329 405442 411895 408182 405112 413042 409477) (353 351 345 349 352 348 354 347 350 353) (299 298 300 299 298 301 307 291 260 275 268 261 273 277 279 290 296 299 300 289 296 299 293 295 299 298 220 220 219 219 218) (268 264 265 267 268 268 268 255 256 243 267 279 272 271 270 268 266 267 267 266 266 264 267 267 265 266 266 267 265 266 264) (253 267 265 266 266 265 267 268 263 267 267 267 265 265 266 265 265 267 264 264 263 266 267 265 264 267 266 266 265 267 262) (455909 468128 469127 462358 462345 466842 465714 461491 465805 469309) (659593 660704 661031 662842 661490 662488 638335 585002 562948 564623 575042 568141 560741 565522 570647 564621 569791 570622 568561 566678 576009 569645 568523 571170 567986 560811 565714 563297 574522 559206 534210) (654756 655531 654538 654424 666166 633187 629767 563799 563184 571444 573744 566120 575397 565035 560688 568932 567284 567191 571967 576210 556474 569168 566808 569914 553269 566650 553813 558938 556844 571851 555751) (458352 463829 467594 467917 457947 468891 474389 457197 463201 471909) (268 266 267 265 264 265 267 267 263 264) (131 131 131 131 130 131 131 132 130 130 130 130 130 130 130 130 130 133 133 130 130 130 130 131 130 131 131 131 131 130 130) )
false
e8bb43493aad0f5da4e0c1a964bd5769815a2eed
f5958b1a87416b6ab3aa1266618fe6cfe8bca206
/js-base.rkt
9c5f82722a86c2381a2a362a8276f9605e8eb6d7
[ "MIT" ]
permissive
nocturnio/racket-js
96ea0464f45cdbbc7505157c9720cfb3dc982d4f
20d057b6cfaf18b727353178680df24c82305d1a
refs/heads/master
2020-03-16T16:46:28.949412
2018-05-11T06:55:14
2018-05-11T06:55:14
132,802,786
0
0
null
null
null
null
UTF-8
Racket
false
false
1,888
rkt
js-base.rkt
#lang racket (provide js-base% js-base? cleanse js-base make-js-safe) (define (js-base name) (new js-base% [name name])) (define (make-js-safe name) (define replacements (vector "__mutable__" "__at__" "__hashtag__" "__object__" "__power__" "_" "__plus__" "__equal__" "__predicate__" "__lessthan__" "__greaterthan__" "__variant__" "__tilde__" "__colon__" "__special__" "__andpercand__")) (define invalids (vector "!" "@" "#" "%" "^" "-" "+" "=" "?" "<" ">" "/" "~" ":" "*" "&")) (for ([ch invalids] [i (vector-length invalids)]) (set! name (string-replace name ch (vector-ref replacements i)))) name) (define (cleanse p) (cond [(string? p) (new js-base% [name (format "\"~a\"" p)] [safe? true])] [(number? p) (new js-base% [name (number->string p)] [safe? true])] [(js-base? p) p] [(procedure? p) p])) (define (js-base? a) (is-a? a js-base%)) (define/contract js-base% (class/c (init [name string?]) [compile (->m string?)] [get-name (->m string?)]) (class object% (init name [safe? false]) (super-new) (define _name name) (define _safe? safe?) (define/public (get-name) _name) (define/public (get-name/safe) (if _safe? _name (make-js-safe _name))) (define/public (compile) _name) (define/public (write-to-file: file) (define port (open-output-file file #:exists 'replace)) (display (compile) port) (close-output-port port))))
false
b3a6d3aed9ea5ba92619720251cd4b2f04131495
c161c2096ff80424ef06d144dacdb0fc23e25635
/chapter3/example/em3.3.3.rkt
bb5cd7e5e2a496f500237b3dccde903afef42227
[]
no_license
tangshipoetry/SICP
f674e4be44dfe905da4a8fc938b0f0460e061dc8
fae33da93746c3f1fc92e4d22ccbc1153cce6ac9
refs/heads/master
2020-03-10T06:55:29.711600
2018-07-16T00:17:08
2018-07-16T00:17:08
129,242,982
0
0
null
null
null
null
UTF-8
Racket
false
false
2,343
rkt
em3.3.3.rkt
#lang sicp (define (assoc key records) (cond((null? records) #f) ((equal? key (caar records)) (car records)) (else (assoc key (cdr records))))) #| ;一维表格 (define (lookup key table) (let([record (assoc key (cdr table))]) (if record (cdr record) #f))) (define (insert! key value table) (let([record (assoc key (cdr table))]) (if record (set-cdr! record value) (set-cdr! table (cons (cons key value) (cdr table)))))) |# #| ;二维表格 (define (lookup key1 key2 table) (let([subtable (assoc key1 (cdr table))]) (if subtable (let([record (assoc key2 (cdr subtable))]) (if record (cdr record) #f)) #f))) (define (insert! key1 key2 value table) (let([subtable (assoc key1 (cdr table))]) (if subtable (let([record (assoc key2 (cdr subtable))]) (if record (set-cdr! record value) (set-cdr! subtable (cons (cons key2 value) (cdr subtable))))) (set-cdr! table (cons (list key1 (cons key2 value)) (cdr table)))))) |# (define (make-table) (let([local-table (list '*table*)]) (define (lookup key1 key2) (let([subtable (assoc key1 (cdr local-table))]) (if subtable (let([record (assoc key2 (cdr subtable))]) (if record (cdr record) #f)) #f))) (define (insert! key1 key2 value) (let([subtable (assoc key1 (cdr local-table))]) (if subtable (let([record (assoc key2 (cdr subtable))]) (if record (set-cdr! record value) (set-cdr! subtable (cons (cons key2 value) (cdr subtable))))) (set-cdr! local-table (cons (list key1 (cons key2 value)) (cdr local-table)))))) (define (dispatch m) (cond((eq? m 'lookup-proc) lookup) ((eq? m 'insert-proc!) insert!) (else (error "Unknown operation: TABLE" m)))) dispatch))
false
ebfd1f3fd6e20c3415c447b88c86633acb8cb9b2
025c71211d8c0b4cf40c65d5add4c3d1fe10fa59
/supercompilation/minischeme/tests/tiny-syntax.rkt
9c780d15878f41d49a0a9a77a9797aa7b71f8cf6
[]
no_license
gregr/experiments
5ce58d6ac6ae034d3955a96a434272ab3671bf6f
a6c5461bda9f8e221225a403f21d61ad4673c57a
refs/heads/master
2023-08-10T23:48:05.730805
2023-08-01T18:58:56
2023-08-01T18:58:56
4,839,336
9
2
null
null
null
null
UTF-8
Racket
false
false
1,442
rkt
tiny-syntax.rkt
#lang racket/base (require "../tiny.rkt" racket/pretty) (define (valid?! stx) (let ((valid? (E.tiny? '() stx))) (if valid? (pretty-write `(success: (valid?! ,stx))) (pretty-write `(FAIL: (valid?! ,stx)))))) (define (invalid?! stx) (let ((valid? (E.tiny? '() stx))) (if valid? (pretty-write `(FAIL: (invalid?! ,stx))) (pretty-write `(success: (invalid?! ,stx)))))) (valid?! '(letrec ((map (lambda (f lst) (if (null? lst) lst (cons (call f (car lst)) (call map f (cdr lst)))))) (plusthree (lambda (x) (+ x '3)))) (call map plusthree (cons '1 (cons '2 (cons '3 '())))))) (invalid?! '(letrec ((map (lambda (f lst) (if (null? lst) lst (cons (call f (car lst)) (call map f (cdr lst)))))) (plusthree (lambda (x) (+ x '3)))) (call map plusthree (cons '1 (cons '2 (cons '3)))))) (invalid?! '(letrec ((map (lambda (f lst) (if (null? lst) lst (cons (call f (car lst)) (call map f (cdr lst)))))) (plusthree (lambda (x) (+ x '3)))) (call map plusthree (cons '1 (cons 2 (cons '3 '()))))))
false
a439082bc54be7f1d73dfbdc99798cee710f83c9
86d2db451161507789a93b18c8ee671d99afab8a
/goblins/main.rkt
fedfb6e5c1fff7a1c51442eb65f9f2dd18e71a3e
[ "Apache-2.0" ]
permissive
spdegabrielle/goblins
45b0d26a05c5fb2116cc8727ef82bed8835d6385
b836e11aa820c7ea43100d18ce71cbf53c9e47cd
refs/heads/master
2022-11-25T18:12:01.975165
2020-03-04T20:30:04
2020-03-04T20:30:04
285,831,618
0
0
null
null
null
null
UTF-8
Racket
false
false
228
rkt
main.rkt
#lang racket/base (provide (all-from-out "core.rkt") (all-from-out "vat.rkt") (all-from-out "actor-lib/cell.rkt")) (require "core.rkt" "message.rkt" "vat.rkt" "actor-lib/cell.rkt")
false
59f114b2070b6db3486619dde1027c09f32be287
37c451789020e90b642c74dfe19c462c170d9040
/cap-3/solucao-3.60.rkt
4ffae2366a484bad322f8445e1008f97663a32fa
[]
no_license
hmuniz/LP-2016.2
11face097c3015968feea07c218c662dc015d1cf
99dc28c6da572701dbfc885f672c2385c92988e7
refs/heads/master
2021-01-17T21:26:06.154594
2016-12-20T15:22:16
2016-12-20T15:22:16
71,069,658
1
0
null
2016-10-16T18:41:10
2016-10-16T18:41:09
null
UTF-8
Racket
false
false
893
rkt
solucao-3.60.rkt
#lang racket (define-syntax cons-stream (syntax-rules () ((_ a b) (cons a (delay b))))) (define (stream-ref s n) (if (= n 0) (stream-car s) (stream-ref (stream-cdr s) (- n 1)))) (define (display-line x) (displayln x)) (define (stream-car stream) (car stream)) (define (stream-cdr stream) (force (cdr stream))) (define (stream-null? stream) (eq? stream '())) (define the-empty-stream '()) (define (add-streams s1 s2) (stream-map + s1 s2)) (define (mul-streams s1 s2) (stream-map * s1 s2)) (define (scale-stream stream factor) (stream-map (lambda (x) (* x factor)) stream)) (define (mul-series s1 s2) (cons-stream (* (stream-car s1) (stream-car s2)) (add-streams (scale-stream (stream-cdr s2) (stream-car s1)) (mul-series (stream-cdr s1) s2))))
true
bb9f646ea501c7553909154d878fbf5ea2f73b3e
4919215f2fe595838a86d14926c10717f69784e4
/lessons/Review-Design-Recipe/lesson/lesson.scrbl
6a312230377e5ab9fccb8ccfd4529fe6d91eba3c
[]
no_license
Emmay/curr
0bae4ab456a06a9d25fbca05a25aedfd5457819b
dce9cede1e471b0d12ae12d3121da900e43a3304
refs/heads/master
2021-01-18T08:47:20.267308
2013-07-15T12:23:41
2013-07-15T12:23:41
null
0
0
null
null
null
null
UTF-8
Racket
false
false
3,956
scrbl
lesson.scrbl
#lang curr/lib @declare-tags[group pedagogy selftaught] @lesson[#:title "The Design Recipe" #:duration "30 minutes"]{ @itemlist/splicing[@item{You remember how to define variables, and you know how to use contracts for pre-built functions. Let's see if you remember how to define a function of your own! Turn to @worksheet-link[#:page 4 #:name "Fast-Functions"] in your workbook.} @item{Here we have a function definition: @code[#:multi-line #t]{;double : Number -> Number ;takes a number and multiplies it by two (define (double n) (* n 2))}} @item{What is the name of this function? @code{double.} How do you know? It's in the contract!} @item{How many inputs does it have in its domain? One. How do you know? It's in the contract!} @item{What kind of data is the domain? A number. How do you know? It's in the contract! } @item{What is the name given to this input? @code{n}. How do you know? It's in the beginning of the definition! } @item{What's the Range of this function? Number. How do you know? The contract!} @item{Now let's talk about what the function does to its input. Look at the two EXAMPLEs, written below. @tag[pedagogy]{Raise your hand if you can tell me what happens when I type @code{(double 5)}.} @tag[selftaught]{What happens when I type @code{(double 0)}?} What about the next example?} @item{What would happen if I changed the name of the input @code{n} to something else, like @code{x}. What else would have to change? @pedagogy{Keep asking more questions, to make sure they understand.}} @pedagogy{@item{Okay, now it's time for a little team competition!} @item{I'm going to give your teams some new function descriptions, and you'll need to create the contract, two examples, and the definition.}} @item{@tag[pedagogy]{We'll do one to practice: } @tag[selftaught]{Let's practice defining functions:} First write only the contract and examples! The contract and each example will be worth one point apiece, for a maximum of three points. Write the contract and examples for a function called @code{triple}, which takes in a number as its input and multiplies it by 3. @tag[pedagogy]{You have one minute! GO!}} @pedagogy{@item{Walk around and help, while counting down... 3! 2! 1! Eyes on me!}} @item{Now look at your two examples. What is the only thing that changes from one to the other? The number being multiplied by three! That is the only thing that is changeable, or variable.} @item{Now take another minute, and write the function header and body for triple. Don't forget to replace the changing thing with a variable!} @pedagogy{@item{Walk around and help, while counting down... 3! 2! 1! Eyes on me!}} @pedagogy{@item{Okay, you all did a great job on the practice round. Now I'm going to give you 2 min. to write the entire function, contract, and examples for the next function description. You MUST write your contract and examples first! When you are done, raise your hand so I can check it! If you move on to writing the definition before I have checked your examples, your team will lose a point! Repeat the competition for each of the following examples:}} @itemlist/splicing[ @item{Write a function @code{plus1}, that takes in a number and adds one to it} @item{Write a function @code{mystery}, that takes in a number and subtracts 4} @item{Write a function @code{redspot}, that takes in a number and draws a solid red circle, using the number as the radius} ] @pedagogy{@item{NOTE: the last one is very difficult, and kids probably won't know quite what to do. This is intentional! Give them some time to be frustrated with it, and then cut it short.}}]}
false
ae8d9682251b80d98eec4fbbf67e5ffa8701b945
e27fa0ff2286943d85a23e6cff9511763a87fce0
/info.rkt
6c3c2875ca8b59e873a007241ab720b6204951d6
[]
no_license
hasu/lexer-listings
9755f5c1ce18e8c3d430f72c4a473de4849e9e7e
3a0831eab949274e2b946b3e9bbcaa6a5639eabe
refs/heads/master
2021-01-10T11:37:13.646509
2016-09-27T14:17:48
2016-09-27T14:17:48
48,891,584
0
0
null
null
null
null
UTF-8
Racket
false
false
423
rkt
info.rkt
#lang info (define collection "lexer-listings") (define deps '("base" "parser-tools-lib" "scribble-lib" "syntax-color-lib")) (define build-deps '("racket-doc" "scribble-doc" "syntax-color-doc")) (define scribblings '(("scribblings/lexer-listings.scrbl" ()))) (define pkg-desc "Scribble forms for color-lexer colored code listings.") (define compile-omit-paths '("experiments"))
false
e4bd04f1353a741c7382744bb099ced8ee211a94
32eb433810f308d74c3700fc916ec9e71b8d8765
/hw4/hw4tests.rkt
817900f6c3f7f3ffda0f01a4d8f15568afb66e51
[]
no_license
rhalliday/ProgLangCourse
b78d92233e727b17188a867c985b1fbaf6f6394a
ff0af1cee608e9cc3653ce6cf15e6c9c685311c1
refs/heads/master
2021-01-10T05:11:01.786691
2013-06-22T15:41:52
2013-06-22T15:41:52
null
0
0
null
null
null
null
UTF-8
Racket
false
false
5,751
rkt
hw4tests.rkt
#lang racket (require rackunit "hw4.rkt") ;; the following are my rackunit tests although they are the rather ;; boring check-equals ones (check-equal? (sequence 3 11 2) '(3 5 7 9 11) "sequence returns last element") (check-equal? (sequence 3 8 3) '(3 6) "sequence does not return last element") (check-equal? (sequence 3 2 1) '() "sequence low higher than high no elements") (check-equal? (string-append-map (list "sta" "evalua" "mastica") "tion") '("station" "evaluation" "mastication") "string-append-map works on 3 element list") (check-equal? (string-append-map (list "to" "for" "back" "up" "down") "wards") '("towards" "forwards" "backwards" "upwards" "downwards") "string-append-map works on 5 element list") (check-equal? (list-nth-mod (list 1 2 3 4 5) 2) 3 "2 mod 5 is 2") (check-equal? (list-nth-mod (list 1 2 3 4 5) 5) 1 "5 mod 5 is 0") (check-equal? (list-nth-mod (list 1 2 3 4 5) 6) 2 "6 mod 5 is 1") (check-equal? (list-nth-mod (list 1 2 3 4 5) 8) 4 "8 mod 5 is 3") (check-exn exn:fail? (lambda () (list-nth-mod (list 1 2 3 4 5) -1)) "negative number raises error") (check-exn exn:fail? (lambda () (list-nth-mod (null) 4)) "empty list raises error") (define powers-of-two (letrec ([f (lambda (x) (cons x (lambda () (f (* x 2)))))]) (lambda () (f 2)))) (check-equal? (stream-for-n-steps powers-of-two 4) '(2 4 8 16) "stream-for-n-steps returns first 4 elements of stream") (check-equal? (stream-for-n-steps powers-of-two 0) '() "stream-for-n-steps returns empty list when passed 0") (check-equal? (stream-for-n-steps funny-number-stream 11) '(1 2 3 4 -5 6 7 8 9 -10 11) "funny number negates the fifth") (check-equal? (stream-for-n-steps dan-then-dog 5) '("dan.jpg" "dog.jpg" "dan.jpg" "dog.jpg" "dan.jpg") "dan then dog returns array in right order") (check-equal? (stream-for-n-steps (stream-add-zero dan-then-dog) 5) '((0 . "dan.jpg") (0 . "dog.jpg") (0 . "dan.jpg") (0 . "dog.jpg") (0 . "dan.jpg")) "stream-add-zero returns a 0, stream pair") (check-equal? (stream-for-n-steps (cycle-lists (list 1 2 3) (list "a" "b")) 8) '((1 . "a") (2 . "b") (3 . "a") (1 . "b") (2 . "a") (3 . "b") (1 . "a") (2 . "b")) "stream-for-n-steps combines the two lists") (check-equal? (vector-assoc 3 (vector (cons 1 2) (cons 4 5) (cons 3 4) (cons 5 6))) '(3 . 4) "vector-assoc returns found pair") (check-equal? (vector-assoc 3 (vector (cons 1 2) (cons 4 5) (cons 3 4) (cons 5 6) (cons 3 7))) '(3 . 4) "vector-assoc returns first pair") (check-equal? (vector-assoc 2 (vector (cons 1 2) (cons 4 5) (cons 3 4) (cons 5 6))) #f "vector-assoc returns false if v not in pair") (check-equal? (vector-assoc "test" (vector (cons 1 2) 3 (cons "test" 4) 4)) '("test" . 4) "vector-assoc handles strings and none pair vectors") (define f (cached-assoc (list (cons 1 2) (cons 3 4) (cons 4 5)) 2)) (check-equal? (f 4) '(4 . 5) "cached-assoc returns a function that mimics assoc") (check-equal? (f 3) '(3 . 4) "cached-assoc returns a function part 2") (check-equal? (f 5) #f "cached-assoc returns false if there is not a pair in there") (define a 2) (while-less (begin (print "y") 7) do (begin (set! a (+ a 1)) (print "x") a)) (check-equal? a 7 "first call to while-less sets a to 7") (while-less (begin (print "y") 7) do (begin (set! a (+ a 1)) (print "x") a)) (check-equal? a 8 "second call to while-less sets a to 8") ;; A simple library for displaying a 2x3 grid of pictures: used ;; for fun in the tests below (look for "Tests Start Here"). (require (lib "graphics.rkt" "graphics")) (open-graphics) (define window-name "Programming Languages, Homework 4") (define window-width 700) (define window-height 500) (define border-size 100) (define approx-pic-width 200) (define approx-pic-height 200) (define pic-grid-width 3) (define pic-grid-height 2) (define (open-window) (open-viewport window-name window-width window-height)) (define (grid-posn-to-posn grid-posn) (when (>= grid-posn (* pic-grid-height pic-grid-width)) (error "picture grid does not have that many positions")) (let ([row (quotient grid-posn pic-grid-width)] [col (remainder grid-posn pic-grid-width)]) (make-posn (+ border-size (* approx-pic-width col)) (+ border-size (* approx-pic-height row))))) (define (place-picture window filename grid-posn) (let ([posn (grid-posn-to-posn grid-posn)]) ((clear-solid-rectangle window) posn approx-pic-width approx-pic-height) ((draw-pixmap window) filename posn))) (define (place-repeatedly window pause stream n) (when (> n 0) (let* ([next (stream)] [filename (cdar next)] [grid-posn (caar next)] [stream (cdr next)]) (place-picture window filename grid-posn) (sleep pause) (place-repeatedly window pause stream (- n 1))))); ;; Tests Start Here ; These definitions will work only after you do some of the problems ; so you need to comment them out until you are ready. ; Add more tests as appropriate, of course. (define nums (sequence 0 5 1)) (define files (string-append-map (list "dan" "dog" "curry" "dog2") ".jpg")) (define funny-test (stream-for-n-steps funny-number-stream 16)) ; a zero-argument function: call (one-visual-test) to open the graphics window, etc. (define (one-visual-test) (place-repeatedly (open-window) 0.5 (cycle-lists nums files) 27)) ; similar to previous but uses only two files and one position on the grid (define (visual-zero-only) (place-repeatedly (open-window) 0.5 (stream-add-zero dan-then-dog) 27))
false
12c9c0fd674709aacdefaf09451ba75f611af12f
976b1bdccce73f43b59474be8a7a93d18dd55a5d
/day3-crossed_wires.rkt
279f505a63915102c5bc37e66ad1c716b67bd6a4
[]
no_license
retzkek/advent-of-code-2019
8fd816dbd1039e849377c8cd9f5560c6d800f5fd
3f8dc174b88994ece3fe519486d918bf4a2a9047
refs/heads/master
2023-01-23T17:20:33.227820
2020-11-28T02:05:30
2020-11-28T02:05:30
225,521,322
0
0
null
null
null
null
UTF-8
Racket
false
false
3,359
rkt
day3-crossed_wires.rkt
#lang racket (require rackunit) (define (next-point point step) (let ([dir (substring step 0 1)] [dist (string->number (substring step 1 (string-length step)))]) (cond [(equal? dir "R") (list (+ (first point) dist) (second point))] [(equal? dir "L") (list (- (first point) dist) (second point))] [(equal? dir "U") (list (first point) (+ (second point) dist))] [(equal? dir "D") (list (first point) (- (second point) dist))] [else point]))) (module+ test (check-equal? (next-point '(0 0) "R10") '(10 0)) (check-equal? (next-point '(0 0) "L10") '(-10 0)) (check-equal? (next-point '(0 0) "U10") '(0 10)) (check-equal? (next-point '(0 0) "D10") '(0 -10))) (define (steps->lines steps [last '(0 0)] [lines '()]) (let* ([next (next-point last (first steps))] [line (append last next)]) (if (eq? (length steps) 1) (cons line lines) (steps->lines (rest steps) next (cons line lines))))) (module+ test (check-equal? (steps->lines '("R8" "U5" "L5" "D3")) '((3 5 3 2) (8 5 3 5) (8 0 8 5) (0 0 8 0)))) (define (intersection l1 l2) (cond [(and (= (first l1) (third l1)) ; l1 vertical (= (second l2) (fourth l2)) ; l2 horizontal (or (< (second l1) (second l2) (fourth l1)) (> (second l1) (second l2) (fourth l1))) (or (< (first l2) (first l1) (third l2)) (> (first l2) (first l1) (third l2)))) (list (first l1) (second l2))] [(and (= (second l1) (fourth l1)) ; l1 horizontal (= (first l2) (third l2)) ; l2 vertical (or (< (first l1) (first l2) (third l1)) (> (first l1) (first l2) (third l1))) (or (< (second l2) (second l1) (fourth l2)) (> (second l2) (second l1) (fourth l2)))) (list (first l2) (second l1))] [else '()])) (module+ test (check-equal? (intersection '(0 0 10 0) '(5 -1 5 1)) '(5 0)) (check-equal? (intersection '(0 0 0 10) '(-3 5 11 5)) '(0 5)) (check-equal? (intersection '(0 0 10 0) '(5 2 5 4)) '())) (define (manhattan-distance p0 [p1 '(0 0)]) (let ([x0 (first p0)] [y0 (second p0)] [x1 (first p1)] [y1 (second p1)]) (+ (if (> x1 x0) (- x1 x0) (- x0 x1)) (if (> y1 y0) (- y1 y0) (- y0 y1))))) (module+ test (check-eq? (manhattan-distance '(3 3)) 6) (check-eq? (manhattan-distance '(-3 -3)) 6) (check-eq? (manhattan-distance '(5 2)) 7) (check-eq? (manhattan-distance '(2 5) '(-5 -2)) 14)) (define (min-cross [ip (current-input-port)]) (let* ([wire1 (steps->lines (string-split (read-line ip) ","))] [wire2 (steps->lines (string-split (read-line ip) ","))] [intersections (filter-not empty? (for*/list ([l1 wire1] [l2 wire2]) (intersection l1 l2)))]) ;;(displayln intersections) (first (sort (map manhattan-distance intersections) <)))) (module+ test (check-eq? (min-cross (open-input-string "R8,U5,L5,D3 U7,R6,D4,L4")) 6) (check-eq? (min-cross (open-input-string "R75,D30,R83,U83,L12,D49,R71,U7,L72 U62,R66,U55,R34,D71,R55,D58,R83")) 159) (check-eq? (min-cross (open-input-string "R98,U47,R26,D63,R33,U87,L62,D20,R33,U53,R51 U98,R91,D20,R16,D67,R40,U7,R15,U6,R7")) 135)) (module+ main (min-cross))
false
081d5db106f8c30cf624fd35ecc2d97bba939a84
5f8d781ca6e4c9d3d1c3c38d2c04e18d090589cc
/0/www/code/hangman.rkt
cb469c13150554d20daaf4e444ef88873b71e48f
[ "AFL-3.0", "AFL-2.1", "LicenseRef-scancode-unknown-license-reference" ]
permissive
plum-umd/fundamentals
a8458621131b864f0e3389b030c5197ea6bb3f41
eb01ac528d42855be53649991a17d19c025a97ad
refs/heads/master
2021-06-20T05:30:57.640422
2019-07-26T15:27:50
2019-07-26T15:27:50
112,412,388
12
1
AFL-3.0
2018-02-12T15:44:48
2017-11-29T01:52:12
Racket
UTF-8
Racket
false
false
7,681
rkt
hangman.rkt
;; The first three lines of this file were inserted by DrRacket. They record metadata ;; about the language level of this file in a form that our tools can easily process. #reader(lib "htdp-beginner-reader.ss" "lang")((modname hangman) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f () #f))) (require 2htdp/image) (require 2htdp/universe) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Main ;; String -> Hangman ;; Play a game of hangman trying to guess s (define (main s) (big-bang (make-hangman (string-hide s) '()) [on-key hangman-key] [to-draw hangman-draw] [stop-when hangman-done? hangman-draw-done])) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Data definitions ;; A Hangman is a (make-hangman Word Lo1String) (define-struct hangman (word misses)) ;; Interpretation: word is the (partially) guessed word ;; misses is a list of incorrect guesses ;; A Word is one of: ;; - '() ;; - (cons Letter Word) ;; Interpretation: a word where some letters maybe hidden ;; A Letter is one of: ;; - (make-hidden 1String) ;; - 1String ;; Interpretation: (make-hidden s) means s has not been revealed, ;; a string s means s has been revealed (define-struct hidden (sec)) ;; A Lo1String is one of: ;; - '() ;; - (cons 1String Lo1String) ;; A 1String is a String of length 1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Constants (define SIZE 80) ; px size of square for each letter (define SQ (square SIZE "outline" "black")) ;; Constants for testing (define H_E_L_L_O_ (cons (make-hidden "h") (cons (make-hidden "e") (cons (make-hidden "l") (cons (make-hidden "l") (cons (make-hidden "o") '())))))) (define H_E_L*L*O_ (cons (make-hidden "h") (cons (make-hidden "e") (cons "l" (cons "l" (cons (make-hidden "o") '())))))) (define H0 (make-hangman H_E_L_L_O_ '())) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Hangman functions ;; Hangman KeyEvent -> Hangman ;; Handle alphabetic keys by guessing, ignore others (check-expect (hangman-key H0 "a") (hangman-guess H0 "a")) (check-expect (hangman-key H0 "left") H0) (define (hangman-key hm ke) (cond [(1string-alphabetic? ke) (hangman-guess hm ke)] [else hm])) ;; Hangman -> Image ;; Draw game, showing each letter (check-expect (hangman-draw H0) (word-draw H_E_L_L_O_)) (define (hangman-draw hm) (word-draw (hangman-word hm))) ;; Hangman 1String -> Hangman ;; Guess s in given game (check-expect (hangman-guess (make-hangman H_E_L_L_O_ '()) "l") (make-hangman H_E_L*L*O_ '())) (check-expect (hangman-guess (make-hangman H_E_L_L_O_ '()) "a") (make-hangman H_E_L_L_O_ (cons "a" '()))) (check-expect (hangman-guess (make-hangman H_E_L_L_O_ (cons "A" '())) "a") (make-hangman H_E_L_L_O_ (cons "A" '()))) (define (hangman-guess hm s) (cond [(hangman-hiding? hm s) (make-hangman (word-reveal (hangman-word hm) s) (hangman-misses hm))] [(hangman-already-missed? hm s) hm] [else (make-hangman (hangman-word hm) (cons s (hangman-misses hm)))])) ;; Hangman -> Boolean ;; Is s a hidden letter in the given game? (check-expect (hangman-hiding? (make-hangman H_E_L*L*O_ '()) "h") #true) (check-expect (hangman-hiding? (make-hangman H_E_L*L*O_ '()) "l") #false) (check-expect (hangman-hiding? (make-hangman H_E_L*L*O_ '()) "a") #false) (define (hangman-hiding? hm s) (word-hiding? (hangman-word hm) s)) ;; Hangman 1String -> Boolean ;; Was s already guessed in given game? (define (hangman-already-missed? hm s) (los-contains? (hangman-misses hm) s)) ;; Hangman -> Boolean ;; Is the game over with a loss? (check-expect (hangman-done? H0) #false) (check-expect (hangman-done? (make-hangman '() (explode "abcxyz"))) #false) (check-expect (hangman-done? (make-hangman '() (explode "abcdxyz"))) #true) (define (hangman-done? hm) (> (length (hangman-misses hm)) 6)) ;; Hangman -> Image ;; Draw losing hangman game over scene (check-expect (hangman-draw-done (make-hangman (string-hide "abc") '())) (overlay (text "ded" SIZE "purple") (hangman-draw (make-hangman (string-hide "abc") '())))) (define (hangman-draw-done hm) (overlay (text "ded" SIZE "purple") (hangman-draw hm))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Word functions ;; Word -> Image ;; Draw each letter of word (check-expect (word-draw '()) empty-image) (check-expect (word-draw H_E_L_L_O_) (beside (letter-draw "_") (letter-draw "_") (letter-draw "_") (letter-draw "_") (letter-draw "_"))) (check-expect (word-draw H_E_L*L*O_) (beside (letter-draw "_") (letter-draw "_") (letter-draw "l") (letter-draw "l") (letter-draw "_"))) (define (word-draw hw) ; stub empty-image) ;; Word String -> Boolean ;; Is hw hiding s? (check-expect (word-hiding? '() "a") #false) (check-expect (word-hiding? H_E_L*L*O_ "a") #false) (check-expect (word-hiding? H_E_L*L*O_ "l") #false) (check-expect (word-hiding? H_E_L*L*O_ "o") #true) (define (word-hiding? hw s) ; stub #false) ;; Word 1String -> Word ;; Reveal every hidden occurrence of s in hw (check-expect (word-reveal '() "a") '()) (check-expect (word-reveal H_E_L_L_O_ "l") H_E_L*L*O_) (check-expect (word-reveal H_E_L_L_O_ "a") H_E_L_L_O_) (define (word-reveal hw s) ; stub hw) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Letter functions ;; Letter String -> Letter ;; Reveal letter if it is hiding s (otherwise no change) (check-expect (letter-reveal (make-hidden "A") "a") "A") (check-expect (letter-reveal (make-hidden "B") "a") (make-hidden "B")) (check-expect (letter-reveal "C" "a") "C") (define (letter-reveal hl s) (cond [(hidden? hl) (cond [(string-ci=? (hidden-sec hl) s) (hidden-sec hl)] [else hl])] [(string? hl) hl])) ;; Letter -> Letter ;; Draw a hidden letter (check-expect (letter-draw "a") (overlay (text "a" SIZE "red") SQ)) (check-expect (letter-draw (make-hidden "a")) (overlay (text "_" SIZE "red") SQ)) (define (letter-draw hl) (overlay (text (cond [(hidden? hl) "_"] [(string? hl) hl]) SIZE "red") SQ)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Misc functions ;; String -> Word ;; Make a word hiding all of s (check-expect (string-hide "ab") (cons (make-hidden "a") (cons (make-hidden "b") '()))) (define (string-hide s) (cond [(string=? s "") '()] [else (cons (make-hidden (substring s 0 1)) (string-hide (substring s 1)))])) ;; LoString String -> Boolean ;; Does los contain s? (check-expect (los-contains? '() "a") #false) (check-expect (los-contains? (cons "a" '()) "a") #true) (check-expect (los-contains? (cons "A" '()) "a") #true) (check-expect (los-contains? (cons "b" '()) "a") #false) (define (los-contains? los s) ; stub #false) ;; String -> Boolean ;; Is the string an alphabetic 1String? (check-expect (1string-alphabetic? "left") #false) (check-expect (1string-alphabetic? "8") #false) (check-expect (1string-alphabetic? "a") #true) (define (1string-alphabetic? s) (and (string-alphabetic? s) (= 1 (string-length s))))
false
b05ea79673f3cec46f783b8d1ad6f3a012b350ad
fc69a32687681f5664f33d360f4062915e1ac136
/scribblings/formal-grammar.scrbl
faa2ae30ab426ef8a05019ae401793f22c846810
[]
no_license
tov/dssl2
3855905061d270a3b5e0105c45c85b0fb5fe325a
e2d03ea0fff61c5e515ecd4bff88608e0439e32a
refs/heads/main
2023-07-19T22:22:53.869561
2023-07-03T15:18:32
2023-07-03T15:18:32
93,645,003
12
6
null
2021-05-26T16:04:38
2017-06-07T14:31:59
Racket
UTF-8
Racket
false
false
6,708
scrbl
formal-grammar.scrbl
#lang scribble/manual @require["common.rkt"] @title{Formal grammar} The DSSL2 language has a number of statement and expression forms, which are described in more depth below. Here they are summarized in @hyperlink["https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form"]{ Extended Backus-Naur Form}. You can also find a simplified version of this grammar that omits contracts in @seclink["simplified-grammar"]{the next section}. Non-terminal symbols are written in ⟨@emph{italic_with_pointies}⟩, whereas terminal symbols are in @term[|colored typewriter|]. Conventions include: @itemlist[ @item{@~many{@term[x]} for repetition 0 or more times} @item{@~many1{@term[x]} for repetition 1 or more times} @item{@~many-comma{@term[x]} for repetition 0 or more times with commas in between} @item{@~opt{@term[x]} for optional} ] The grammar begins by saying that a program is a sequence of zero or more statements, where a statement is either a simple statement followed by a newline, or a compound statement. @grammar[ [program (~many statement)] [statement (simple 'NEWLINE) compound] [expr 'number 'string True False None lvalue (expr "if" expr "else" expr) (expr "(" (~many-comma expr) ")") (lambda (~many-comma 'name) ":" simple) (λ (~many-comma 'name) ":" simple) ('struct_name "{" (~many-comma 'name ":" expr) "}") ("[" (~many-comma expr) "]") ("[" expr ";" expr "]") ("[" expr "for" (~opt 'name ",") 'name "in" expr (~opt "if" expr) "]") (expr 'binop expr) ('unop expr)] [simple (assert expr opt_timeout) (assert_error expr (~opt "," expr) opt_timeout) break continue (lvalue = expr) expr (import mod_spec) (let 'name opt_ctc (~opt "=" expr)) pass (return (~opt expr)) (simple ";" simple)] [lvalue 'name (expr "." 'name) (expr "[" expr "]")] [compound (class 'name opt_cvars opt_implements : class_block) (def 'name opt_cvars "(" (~many-comma 'name opt_ctc) ")" opt_res_ctc : block) (if expr ":" block (~many elif expr ":" block) (~opt else ":" block)) (interface 'name opt_cvars ":" interface_block) (for (~opt 'name ",") 'name "in" expr ":" block) (struct 'name ":" struct_block) (test (~opt expr) opt_timeout ":" block) (time (~opt expr) ":" block) (while expr ":" block)] [block (simple 'NEWLINE) ('NEWLINE 'INDENT (~many1 statement) 'DEDENT)] [class_block ('NEWLINE 'INDENT (~many field_def) (~many1 meth_proto ":" block) 'DEDENT)] ; [class_fields ] ; [class_methods ] [interface_block pass ('NEWLINE 'INDENT (~many1 meth_proto 'NEWLINE) 'DEDENT)] [struct_block pass ('NEWLINE 'INDENT (~many1 field_def) 'DEDENT)] [meth_proto (def 'name opt_cvars "(" 'name (~many "," 'name opt_ctc) ")" opt_res_ctc)] [field_def (let 'name opt_ctc 'NEWLINE)] [opt_timeout (~opt "," "time" "<" expr)] [opt_implements (~opt "(" (~many-comma 'name) ")")] [opt_ctc (~opt ":" ctc)] [opt_res_ctc (~opt "->" ctc)] [opt_cvars (~opt "[" (~many-comma 'name) "]")] [ctc expr] [mod_spec 'mod_name 'mod_string] ] @t{binop}s are, from tightest to loosest precedence: @itemlist[ @item{@racket[**],} @item{@racket[*], @racket[/], @racket[//], and @racket[%],} @item{@racket[+] and @racket[-],} @item{@racket[>>] and @racket[<<],} @item{@racket[&],} @item{@racket[^],} @item{@racket[\|] (not written with the backslash),} @item{@racket[==], @racket[<], @racket[>], @racket[<=], @racket[>=], @racket[!=], @racket[is], and @racket[|is not|] (not written with the vertical bars),} @item{@racket[and], and} @item{@racket[or].} ] @t{unop}s are @racket[~], @racket[+], @racket[-], and @racket[not]. @section[#:tag "simplified-grammar"]{Simplified grammar} This section presents a version of the DSSL2 grammar that is simplified by omitting contracts: @grammar["no-ctc-nt" [program (~many statement)] [statement (simple 'NEWLINE) compound] [expr 'number 'string True False None lvalue (expr "if" expr "else" expr) (expr "(" (~many-comma expr) ")") (lambda (~many-comma 'name) ":" simple) (λ (~many-comma 'name) ":" simple) ('struct_name "{" (~many-comma 'name ":" expr) "}") ("[" (~many-comma expr) "]") ("[" expr ";" expr "]") ("[" expr "for" (~opt 'name ",") 'name "in" expr (~opt "if" expr) "]") (expr 'binop expr) ('unop expr)] [simple (assert expr (~opt "," "time" "<" expr)) (assert_error expr (~opt "," expr) (~opt "," "time" "<" expr)) break continue (lvalue = expr) expr (import mod_spec) (let 'name (~opt "=" expr)) pass (return (~opt expr)) (simple ";" simple)] [lvalue 'name (expr "." 'name) (expr "[" expr "]")] [compound (class 'name (~opt "(" (~many-comma 'interface_name) ")") : class_block) (def 'name "(" (~many-comma 'name ) ")" : block) (if expr ":" block (~many elif expr ":" block) (~opt else ":" block)) (interface 'name ":" interface_block) (for (~opt 'name ",") 'name "in" expr ":" block) (struct 'name ":" struct_block) (test (~opt expr) ":" block) (time (~opt expr) ":" block) (while expr ":" block)] [block (simple 'NEWLINE) ('NEWLINE 'INDENT (~many1 statement) 'DEDENT)] [class_block ('NEWLINE 'INDENT (~many field_def) (~many1 meth_proto ":" block) 'DEDENT)] ; [class_fields ] ; [class_methods ] [interface_block pass ('NEWLINE 'INDENT (~many1 meth_proto 'NEWLINE) 'DEDENT)] [struct_block pass ('NEWLINE 'INDENT (~many1 field_def) 'DEDENT)] [meth_proto (def 'name "(" 'name (~many "," 'name) ")")] [field_def (let 'name 'NEWLINE)] [mod_spec 'mod_name 'mod_string] ]
false
24d1c516469e544c4954ba122182c2a622deed19
8df577f1cd8d7e7216bb70168a10b5596cd9d9d3
/syntax-classes-test/tests/syntax/parse/class/struct-id.rkt
ed1853b1b6e0978bf08eb8592e4604aaac1b28a3
[]
no_license
lexi-lambda/syntax-classes
323ad38005dcc81b1b93a1b22af5de8814fc442c
4d64d35259d69ee8d5c90f475fe777c66d54c8fd
refs/heads/master
2022-05-09T11:12:59.209910
2022-04-08T17:12:26
2022-04-08T17:15:04
64,279,034
6
2
null
2022-04-08T17:24:32
2016-07-27T05:13:24
Racket
UTF-8
Racket
false
false
2,419
rkt
struct-id.rkt
#lang racket/base (require (for-syntax racket/base syntax/datum syntax/parse syntax/parse/class/struct-id) rackunit rackunit/spec) (describe "class struct-id" (struct boring ()) (struct parent (a b p)) (struct child parent (a b c)) (it "handles structs with no fields" (define-syntax get-struct-info (syntax-parser [(_ id:struct-id) #'id.descriptor-id])) (check-equal? (get-struct-info boring) struct:boring)) (describe "attribute accessor-id" (it "includes all accessors, including parent accessors" (define-syntax struct-accessors (syntax-parser [(_ id:struct-id) #'(list id.accessor-id ...)])) (check-equal? (struct-accessors parent) (list parent-a parent-b parent-p)) (check-equal? (struct-accessors child) (list parent-a parent-b parent-p child-a child-b child-c)))) (describe "attribute own-accessor-id" (it "includes accessors, but not parent accessors" (define-syntax struct-own-accessors (syntax-parser [(_ id:struct-id) #'(list id.own-accessor-id ...)])) (check-equal? (struct-own-accessors parent) (list parent-a parent-b parent-p)) (check-equal? (struct-own-accessors child) (list child-a child-b child-c)))) (describe "attribute field-sym" (it "includes all field symbols, including parent fields" (define-syntax struct-all-fields (syntax-parser [(_ id:struct-id) #`'#,(datum (id.field-sym ...))])) (check-equal? (struct-all-fields boring) (list)) (check-equal? (struct-all-fields parent) (list 'a 'b 'p)) (check-equal? (struct-all-fields child) (list 'a 'b 'p 'a 'b 'c)))) (describe "attribute own-field-sym" (it "includes own field symbols, but not parent fields" (define-syntax struct-own-fields (syntax-parser [(_ id:struct-id) #`'#,(datum (id.own-field-sym ...))])) (check-equal? (struct-own-fields boring) (list)) (check-equal? (struct-own-fields parent) (list 'a 'b 'p)) (check-equal? (struct-own-fields child) (list 'a 'b 'c)))))
true
dc25e45ab5175b6d2bf90b13f4566c9364dcc69e
7910d52662d066da04056101721d080888562f39
/fake-shimmer.rkt
5a7d2e9db362364993f7cba8a31f0e08d3f58064
[]
no_license
sgpthomas/light-tunnel-rkt
2c9d005b95b7e9bf275084f80eaacc3a84d3327c
700b2be342aeac1f32ecd46596136756bcdf5aff
refs/heads/master
2020-06-29T02:10:16.552339
2019-09-08T23:28:53
2019-09-08T23:28:53
200,407,108
0
0
null
null
null
null
UTF-8
Racket
false
false
285
rkt
fake-shimmer.rkt
#lang racket/base (require "syntax.rkt") (send/mood ("raspberrypi.local" 1234 18 450) [(wave 10 0.11 0) (0.8 0.3 0.5) -0.3] [(wave 10 0.11 0) (0.5 0.3 0.8) 0.15] [(wave 9 0.1 100) (0.1 0.8 0.1) 0.15] [(wave 100 0.1 0) (0.4 0.4 0.4) 0.3])
false
d018e7af167c10cebd39101fc8876124d2b89b6e
1397f4aad672004b32508f67066cb7812f8e2a14
/plot-doc/plot/scribblings/plotting.scrbl
eb3709347bf540b109d4275e9eb525a8834d97f9
[ "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
racket/plot
2da8d9f8159f28d0a9f540012e43457d490d36da
b0da52632c0369058887439345eb90cbf8e99dae
refs/heads/master
2023-07-14T07:31:23.099585
2023-07-04T12:53:33
2023-07-04T12:53:33
27,409,837
39
29
NOASSERTION
2023-07-04T12:56:50
2014-12-02T01:50:35
Racket
UTF-8
Racket
false
false
13,969
scrbl
plotting.scrbl
#lang scribble/manual @(require (for-label slideshow racket/gui/dynamic) "common.rkt") @declare-exporting[plot] @title[#:tag "plotting"]{2D and 3D Plotting Procedures} The plotting procedures exported by @racketmodname[plot/no-gui] produce @racket[bitmap%] and @racket[pict] instances, and write to files. They do not require @racketmodname[racket/gui], so they work in headless environments; for example, a Linux terminal with @tt{DISPLAY} unset. The @racketmodname[plot] module re-exports everything exported by @racketmodname[plot/no-gui], as well as @racket[plot], @racket[plot3d], and other procedures that create interactive plots and plot frames. Interactive plotting procedures can always be imported, but fail when called if there is no working display or @racketmodname[racket/gui] is not present. Each 3D plotting procedure behaves the same way as its corresponding 2D procedure, but takes the additional keyword arguments @(racket #:z-min), @(racket #:z-max), @(racket #:angle), @(racket #:altitude) and @(racket #:z-label). @section{GUI Plotting Procedures} @defmodule*/no-declare[(plot) #:link-target? #f] @defproc[(plot [renderer-tree (treeof (or/c renderer2d? nonrenderer?))] [#:x-min x-min (or/c rational? #f) #f] [#:x-max x-max (or/c rational? #f) #f] [#:y-min y-min (or/c rational? #f) #f] [#:y-max y-max (or/c rational? #f) #f] [#:width width exact-positive-integer? (plot-width)] [#:height height exact-positive-integer? (plot-height)] [#:title title (or/c string? pict? #f) (plot-title)] [#:x-label x-label (or/c string? pict? #f) (plot-x-label)] [#:y-label y-label (or/c string? pict? #f) (plot-y-label)] [#:aspect-ratio aspect-ratio (or/c (and/c rational? positive?) #f) (plot-aspect-ratio)] [#:legend-anchor legend-anchor legend-anchor/c (plot-legend-anchor)] [#:out-file out-file (or/c path-string? output-port? #f) #f] [#:out-kind out-kind plot-file-format/c 'auto] ) (or/c (and/c (is-a?/c snip%) (is-a?/c plot-metrics<%>)) void?)]{ Plots a 2D renderer or list of renderers (or more generally, a tree of renderers), as returned by @(racket points), @(racket function), @(racket contours), @(racket discrete-histogram), and others. By default, @(racket plot) produces a Racket value that is displayed as an image and can be manipulated like any other value. For example, they may be put in lists: @interaction[#:eval plot-eval (parameterize ([plot-width 150] [plot-height 150] [plot-x-label #f] [plot-y-label #f]) (list (plot (function sin (- pi) pi)) (plot (function sqr -2 2))))] When the parameter @(racket plot-new-window?) is @(racket #t), @(racket plot) opens a new window to display the plot and returns @(racket (void)). When @(racket #:out-file) is given, @(racket plot) writes the plot to a file using @(racket plot-file) as well as returning a @(racket snip%) or opening a new window. When given, the @(racket x-min), @(racket x-max), @(racket y-min) and @(racket y-max) arguments determine the bounds of the plot, but not the bounds of the renderers. For example, When given, the @(racket aspect-ratio) argument defines the aspect ratio of the plot area, see @(racket plot-aspect-ratio) for more details. @interaction[#:eval plot-eval (plot (function (λ (x) (sin (* 4 x))) -1 1) #:x-min -1.5 #:x-max 1.5 #:y-min -1.5 #:y-max 1.5)] Here, the renderer draws in [-1,1] × [-1,1], but the plot area is [-1.5,1.5] × [-1.5,1.5]. @bold{Deprecated keywords.} The @(racket #:fgcolor) and @(racket #:bgcolor) keyword arguments are currently supported for backward compatibility, but may not be in the future. Please set the @(racket plot-foreground) and @(racket plot-background) parameters instead of using these keyword arguments. The @(racket #:lncolor) keyword argument is also accepted for backward compatibility but deprecated. It does nothing. @history[#:changed "7.9" "Added support for pictures for #:title, #:x-label and #:y-label. And to plot the legend outside the plot-area with #:legend-anchor"] @history[#:changed "8.1" "Added #:aspect-ratio"] } @defproc[(plot3d [renderer-tree (treeof (or/c renderer3d? nonrenderer?))] [#:x-min x-min (or/c rational? #f) #f] [#:x-max x-max (or/c rational? #f) #f] [#:y-min y-min (or/c rational? #f) #f] [#:y-max y-max (or/c rational? #f) #f] [#:z-min z-min (or/c rational? #f) #f] [#:z-max z-max (or/c rational? #f) #f] [#:width width exact-positive-integer? (plot-width)] [#:height height exact-positive-integer? (plot-height)] [#:angle angle real? (plot3d-angle)] [#:altitude altitude real? (plot3d-altitude)] [#:title title (or/c string? pict? #f) (plot-title)] [#:x-label x-label (or/c string? pict? #f) (plot-x-label)] [#:y-label y-label (or/c string? pict? #f) (plot-y-label)] [#:z-label z-label (or/c string? pict? #f) (plot-z-label)] [#:aspect-ratio aspect-ratio (or/c (and/c rational? positive?) #f) (plot-aspect-ratio)] [#:legend-anchor legend-anchor legend-anchor/c (plot-legend-anchor)] [#:out-file out-file (or/c path-string? output-port? #f) #f] [#:out-kind out-kind plot-file-format/c 'auto] ) (or/c (and/c (is-a?/c snip%) (is-a/c plot-metrics<%>)) void?)]{ Plots a 3D renderer or list of renderers (or more generally, a tree of renderers), as returned by @(racket points3d), @(racket parametric3d), @(racket surface3d), @(racket isosurface3d), and others. When the parameter @(racket plot-new-window?) is @(racket #t), @(racket plot3d) opens a new window to display the plot and returns @(racket (void)). When @(racket #:out-file) is given, @(racket plot3d) writes the plot to a file using @(racket plot3d-file) as well as returning a @(racket snip%) or opening a new window. When given, the @(racket x-min), @(racket x-max), @(racket y-min), @(racket y-max), @(racket z-min) and @(racket z-max) arguments determine the bounds of the plot, but not the bounds of the renderers. When given, the @(racket aspect-ratio) argument defines the aspect ratio of the plot area, see @(racket plot-aspect-ratio) for more details. @bold{Deprecated keywords.} The @(racket #:fgcolor) and @(racket #:bgcolor) keyword arguments are currently supported for backward compatibility, but may not be in the future. Please set the @(racket plot-foreground) and @(racket plot-background) parameters instead of using these keyword arguments. The @(racket #:lncolor) keyword argument is also accepted for backward compatibility but deprecated. It does nothing. The @(racket #:az) and @(racket #:alt) keyword arguments are backward-compatible, deprecated aliases for @(racket #:angle) and @(racket #:altitude), respectively. @history[#:changed "7.9" "Added support for pictures for #:title, #:x-label and #:y-label. And to plot the legend outside the plot-area with #:legend-anchor"] @history[#:changed "8.1" "Added #:aspect-ratio"] } @defproc[(plot-snip [<plot-argument> <plot-argument-contract>] ...) (and/c (is-a?/c 2d-plot-snip%) (is-a?/c plot-metrics<%>))] @defproc[(plot3d-snip [<plot-argument> <plot-argument-contract>] ...) (and/c (is-a?/c snip%) (is-a?/c plot-metrics<%>))] @defproc[(plot-frame [<plot-argument> <plot-argument-contract>] ...) (is-a?/c frame%)] @defproc[(plot3d-frame [<plot-argument> <plot-argument-contract>] ...) (is-a?/c frame%)]{ Plot to different GUI backends. These procedures accept the same arguments as @(racket plot) and @(racket plot3d), except deprecated keywords, and @racket[#:out-file] and @racket[#:out-kind]. Use @(racket plot-frame) and @(racket plot3d-frame) to create a @(racket frame%) regardless of the value of @(racket plot-new-window?). The frame is initially hidden. Use @(racket plot-snip) and @(racket plot3d-snip) to create an interactive @(racket snip%) regardless of the value of @(racket plot-new-window?). The @racket[snip%] objects returned by @racket[plot-snip] can be used to construct interactive plots. See @secref["2d-plot-snip-interactive-overlays"] for more details. } @section{Non-GUI Plotting Procedures} @defmodule*/no-declare[(plot/no-gui)] @defproc[(plot-file [renderer-tree (treeof (or/c renderer2d? nonrenderer?))] [output (or/c path-string? output-port?)] [kind plot-file-format/c 'auto] [#:<plot-keyword> <plot-keyword> <plot-keyword-contract>] ...) void?] @defproc[(plot3d-file [renderer-tree (treeof (or/c renderer3d? nonrenderer?))] [output (or/c path-string? output-port?)] [kind plot-file-format/c 'auto] [#:<plot3d-keyword> <plot3d-keyword> <plot3d-keyword-contract>] ...) void?] @defproc[(plot-pict [<plot-argument> <plot-argument-contract>] ...) plot-pict?] @defproc[(plot3d-pict [<plot3d-argument> <plot3d-argument-contract>] ...) plot-pict?] @defproc[(plot-bitmap [<plot-argument> <plot-argument-contract>] ...) (and/c (is-a?/c bitmap%) (is-a?/c plot-metrics<%>))] @defproc[(plot3d-bitmap [<plot3d-argument> <plot3d-argument-contract>] ...) (and/c (is-a?/c bitmap%) (is-a?/c plot-metrics<%>))]{ Plot to different non-GUI backends. These procedures accept the same arguments as @(racket plot) and @(racket plot3d), except deprecated keywords, and @racket[#:out-file] and @racket[#:out-kind]. Use @(racket plot-file) or @(racket plot3d-file) to save a plot to a file. When creating a JPEG file, the parameter @(racket plot-jpeg-quality) determines its quality. When creating a PostScript or PDF file, the parameter @(racket plot-ps/pdf-interactive?) determines whether the user is given a dialog to set printing parameters. (See @(racket post-script-dc%) and @(racket pdf-dc%).) When @(racket kind) is @(racket 'auto), @(racket plot-file) and @(racket plot3d-file) try to determine from the file name extension the kind of file to write. Use @(racket plot-pict) or @(racket plot3d-pict) to create a @(racket pict). For example, this program creates a slide containing a 2D plot of a parabola: @racketmod[slideshow (require plot) (plot-font-size (current-font-size)) (plot-width (current-para-width)) (plot-height 600) (plot-background-alpha 1/2) (slide #:title "A 2D Parabola" (plot-pict (function sqr -1 1 #:label "y = x^2")))] Use @(racket plot-bitmap) or @(racket plot3d-bitmap) to create a @(racket bitmap%). } @defproc[(plot/dc [renderer-tree (treeof (or/c renderer2d? nonrenderer?))] [dc (is-a?/c dc<%>)] [x real?] [y real?] [width (>=/c 0)] [height (>=/c 0)] [#:<plot-keyword> <plot-keyword> <plot-keyword-contract>] ...) (is-a?/c plot-metrics<%>)] @defproc[(plot3d/dc [renderer-tree (treeof (or/c renderer3d? nonrenderer?))] [dc (is-a?/c dc<%>)] [x real?] [y real?] [width (>=/c 0)] [height (>=/c 0)] [#:<plot3d-keyword> <plot3d-keyword> <plot3d-keyword-contract>] ...) (is-a?/c plot-metrics<%>)]{ Plot to an arbitrary device context, in the rectangle with width @(racket width), height @(racket height), and upper-left corner @(racket x),@(racket y). These procedures accept the same arguments as @(racket plot) and @(racket plot3d), except deprecated keywords, and @racket[#:out-file] and @racket[#:out-kind]. Use these if you need to continually update a plot on a @(racket canvas%), or to create other @(racket plot)-like functions with different backends. } @section{Pict-Plotting Work-a-Likes} @declare-exporting[plot/pict] @defmodule*/no-declare[(plot/pict)] When setting up an evaluator for a Scribble manual, require @racketmodname[plot/pict] instead of @racketmodname[plot]. Evaluation will produce picts instead of snips, which scale nicely in PDF-rendered documentation. For example, this is how the evaluator for the @(plot-name) documentation is defined: @racketblock[ (define plot-eval (let ([eval (make-base-eval)]) (eval '(begin (require racket/math racket/match racket/list racket/draw racket/class plot/pict plot/utils))) eval))] If you use @racket[(require (for-label plot))], links in example code should resolve to documentation for the functions exported by @racketmodname[plot]. @defproc[(plot [<plot-argument> <plot-argument-contract>] ...) pict?] @defproc[(plot3d [<plot3d-argument> <plot3d-argument-contract>] ...) pict?]{ Like the functions of the same name exported from @racketmodname[plot], but these produce @racket[pict] instances instead of interactive snips. } @section{Bitmap-Plotting Work-a-Likes} @declare-exporting[plot/bitmap] @defmodule*/no-declare[(plot/bitmap)] When plotting in an environment where @racket[bitmap%] instances can be shown but @racket[snip%] instances cannot (for example, on a web page that evaluates Racket code), require @racketmodname[plot/bitmap] instead of @racketmodname[plot]. @defproc[(plot [<plot-argument> <plot-argument-contract>] ...) (is-a?/c bitmap%)] @defproc[(plot3d [<plot3d-argument> <plot3d-argument-contract>] ...) (is-a?/c bitmap%)]{ Like the functions of the same name exported from @racketmodname[plot], but these produce @racket[bitmap%] instances instead of interactive snips. }
false
36cee956e3091607e6a3c1ecb8b567999568ca5f
bf3128c6b1cf2a164077bcef1ffa23c26c440a0b
/define-extend/define-extend-test.rkt
16030866f9c1881b8cd7e4fe54cad7b6b2473b77
[ "MIT" ]
permissive
bennn/syntax-parse-example
9e961fefc50c265991665d5de7ec1047dd445ed7
b1616936eafd97f952af050dc41cab25c50041e2
refs/heads/master
2022-09-21T15:43:20.335490
2022-09-06T00:17:37
2022-09-06T00:17:37
423,293,870
1
1
NOASSERTION
2021-11-01T00:38:01
2021-11-01T00:38:00
null
UTF-8
Racket
false
false
835
rkt
define-extend-test.rkt
#lang racket/base (module+ test (require racket/match rackunit syntax/macro-testing syntax-parse-example/define-extend/define-extend) (test-begin (define-extend (interp0 e) (match e [`(+ ,x ,y) (+ (interp0 x) (interp0 y))] [(? number?) e])) (test-case "interp0" (check-equal? (interp0 '(+ (+ 1 2) (+ 5 6))) 14)) (define-extend (interp1 e) #:extend interp0 (match e [`(* ,x ,y) (* (interp1 x) (interp1 y))] [_ (interp0 e)])) (test-case "interp1" (check-equal? (interp1 '(+ (+ 1 2) (* 5 6))) 33)) (test-case "bad-parent" (check-exn exn:fail:syntax? (lambda () (convert-compile-time-error (let () (define-extend (interp1 e) #:extend map 'not-implemented) (void))))))) )
false
3c09f61a2a230258e38b8b242cfcfd148b1851f3
9e5f7de7265162c38f3e482266b819ede76113ba
/Assignment 2/a2q4.rkt
95816988b1dd3dc8ed253a8a543329a70437e48c
[ "Apache-2.0" ]
permissive
xiaroy/Comp-3007
b34eb4859115415290302a9b4fb46c6bba9d173b
4d65c7692ea69562fd94cd9a2f5ec28e9d1048fb
refs/heads/master
2021-04-27T00:48:42.762857
2018-02-23T19:06:15
2018-02-23T19:06:15
122,661,050
0
2
null
null
null
null
UTF-8
Racket
false
false
1,054
rkt
a2q4.rkt
;Name:Roy Xia ;Student Number: 101009419 ;Question: 4 (#%require (only racket/base random)) (define (rps) (define score 0) (define count 0) (define x (read)) (define y(random 2)) (display x) (display y) (cond ((and (= x 0) (= y 0)) write "you chose rock comp chose rock Tie")) (cond ((and (= x 0) (= y 1)) (- score 1) write "you chose rock comp chose paper computer win")) (cond ((and (= x 0) (= y 2)) (+ score 1) write "you chose rock comp chose scissor you win")) (cond ((and (= x 1) (= y 0)) (+ score 1)write "you chose paper comp chose rock you win")) (cond ((and (= x 1) (= y 1)) write "you chose paper comp chose paper Tie")) (cond ((and (= x 1) (= y 2)) (- score 1) write "you chose paper comp chose scizzor comp win")) (cond ((and (= x 2) (= y 0)) (- score 1) write "you chose scissor comp chose rock comp win")) (cond ((and (= x 2) (= y 1)) (+ score 1) write "you chose scissor comp chose paper you win")) (cond ((and (= x 2) (= y 2)) write "you chose scissor comp chose scissor Tie")) (display score) )
false
16f5926b0a642a0390b2ca2f69187ee56859575e
0cbf2786da37f8e7965f6dafdf2bc762c6806a52
/3.24 q.rkt
e52f8a60f0d4d64a6f45285874eeba9ff43f5840
[]
no_license
arbores/SICP
3e0f18662610ea0dca6d85ac69cef569033c5a39
69ea1ccadf3a33e3d7e2669ef627b9653503192d
refs/heads/master
2021-01-19T18:03:43.792241
2014-09-18T02:50:50
2014-09-18T02:50:50
null
0
0
null
null
null
null
UTF-8
Racket
false
false
2,367
rkt
3.24 q.rkt
(define (mcaar x) (mcar (mcar x))) (define (mlist . ls) (if (null? ls) null (mcons (car ls) (apply mlist (cdr ls))))) (define (massoc key records same-key?) (cond ((null? records) false) ((same-key? (mcaar records) key) (mcar records)) (else (massoc key (mcdr records) same-key?)))) (define (make-table same-key?) (define (make-record key-2 value) (mcons key-2 value)) (define (make-subtable key-1 key-2 value) (mlist key-1 (make-record key-2 value))) (define (new-records key-2 value subtable) (mcons (make-record key-2 value) (mcdr subtable))) (define (new-subtables key-1 key-2 value local-table) (mcons (make-subtable key-1 key-2 value) (mcdr local-table))) (let ((local-table (mlist '*table*))) (define (lookup key-1 key-2) (let ((subtable (massoc key-1 (mcdr local-table) same-key?))) (if subtable (let ((record (massoc key-2 (mcdr subtable) same-key?))) (if record (mcdr record) false)) false))) (define (insert! key-1 key-2 value) (let ((subtable (massoc key-1 (mcdr local-table) same-key?))) (if subtable (let ((record (massoc key-2 (mcdr subtable) same-key?))) (if record (set-mcdr! record value) (set-mcdr! subtable (new-records key-2 value subtable)))) (set-mcdr! local-table (new-subtables key-1 key-2 value local-table)))) local-table) (define (dispatch m) (case m ((lookup-proc) lookup) ((insert-proc!) insert!) (else (raise-user-error "Unknown operation -- TABLE" m)))) dispatch)) (define operation-table (make-table equal?)) (define get (operation-table 'lookup-proc)) (define put (operation-table 'insert-proc!)) ;; (define (exec-commands commands) (if (null? commands) 'end (begin (display (format "> ~a\n" (car commands))) (with-handlers ([exn:fail:user? (lambda (e) (display e) (newline))]) (display (eval (car commands)))) (newline) (exec-commands (cdr commands))))) (exec-commands '((put 'letters 'a 10) (put 'letters 'b 12) (put 'math '+ 21) (put 'math '- 21) (get 'letters 'a) (get 'math '-) (get 'g '+) (get 'math 'a)))
false
e7160388d0be6fcef0bfde1963b3aefb3e473cf1
471a04fa9301455c51a890b8936cc60324a51f27
/srfi-lite-lib/srfi/provider.rkt
720873156bf61435880759f7ac1ae223964fadb9
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "MIT" ]
permissive
racket/srfi
e79e012fda6d6bba1a9445bcef461930bc27fde8
25eb1c0e1ab8a1fa227750aa7f0689a2c531f8c8
refs/heads/master
2023-08-16T11:10:38.100847
2023-02-16T01:18:44
2023-02-16T12:34:27
27,413,027
10
10
NOASSERTION
2023-09-14T14:40:51
2014-12-02T03:22:45
HTML
UTF-8
Racket
false
false
2,326
rkt
provider.rkt
#lang racket/base (require (for-syntax racket/base racket/provide-transform)) ;; This is a utility for many srfi/N.rkt files that simply reprovide stuff from ;; some other file. It is used as a module, for example, the "srfi/1.rkt" ;; loader has: ;; #lang s-exp srfi/provider srfi/1/list #:unprefix s: ;; which makes it require `srfi/1/list', then reprovide everything from there, ;; removing any `s:' prefixes that it uses (since `srfi/1/list' does not ;; collide with `racket/base'). It is used in most files here, and the ;; unprefix facility is used in a few similar situations. You can add a ;; `#:debug' flag to have the unprefixer print its renamings, to check that you ;; get the right bindings. (provide (rename-out [module-begin #%module-begin])) (define-syntax (module-begin stx) (syntax-case stx () [(_ srfi-req . more) (let ([pfx #f] [debug #f]) (let loop ([more #'more]) (syntax-case more () [(#:unprefix pfx-id . more) (set! pfx #'pfx-id) (loop #'more)] [(#:debug . more) (set! debug #t) (loop #'more)] [() (void)])) #`(#%module-begin (require srfi-req) (provide (all-from-unprefix-out #,pfx srfi-req #,debug))))])) (define-syntax all-from-unprefix-out (make-provide-transformer (lambda (stx modes) (syntax-case stx () [(_ pfx spec debug?) (map (if (identifier? #'pfx) (let ([rx (string-append "^" (regexp-quote (symbol->string (syntax-e #'pfx))))] [debug? (syntax-e #'debug?)]) (lambda (e) (let* ([s (symbol->string (export-out-sym e))] [m (regexp-match-positions rx s)]) (when (and m debug?) (printf "Renaming: ~a -> ~a\n" s (substring s (cdar m)))) (if m (make-export (export-local-id e) (string->symbol (substring s (cdar m))) (export-mode e) (export-protect? e) (export-orig-stx e)) e)))) values) (expand-export #'(all-from-out spec) modes))]))))
true
b54c7b91c646e4769a9caaa1c69159142771bc02
082b6286b6f594c375f40ef5dd3c28c9e46f1db8
/private/wrapper-type.rkt
ccb03ff5c6a0a4f1a4c5dc8abebb8c0853ce9e5e
[ "Apache-2.0" ]
permissive
rocketnia/rebellion
115e6a7856b76b7f921a34c9752c6958f4ecb4c6
6bd4b53d9e4226a4e9be24374b88fbbc5866fad4
refs/heads/master
2020-07-05T05:43:53.727536
2019-08-11T22:48:54
2019-08-11T22:48:54
202,541,739
0
0
Apache-2.0
2019-08-15T12:59:33
2019-08-15T12:59:32
null
UTF-8
Racket
false
false
7,739
rkt
wrapper-type.rkt
#lang racket/base (require racket/contract/base) (provide define-wrapper-type (contract-out [wrapper-type? predicate/c] [wrapper-type (->* (interned-symbol?) (#:predicate-name (or/c interned-symbol? #f) #:constructor-name (or/c interned-symbol? #f) #:accessor-name (or/c interned-symbol? #f)) wrapper-type?)] [make-wrapper-implementation (->* (wrapper-type?) (#:property-maker (-> uninitialized-wrapper-descriptor? (listof (cons/c struct-type-property? any/c))) #:inspector inspector?) initialized-wrapper-descriptor?)] [wrapper-type-name (-> wrapper-type? interned-symbol?)] [wrapper-type-constructor-name (-> wrapper-type? interned-symbol?)] [wrapper-type-predicate-name (-> wrapper-type? interned-symbol?)] [wrapper-type-accessor-name (-> wrapper-type? interned-symbol?)] [wrapper-descriptor? predicate/c] [uninitialized-wrapper-descriptor? predicate/c] [initialized-wrapper-descriptor? predicate/c] [wrapper-descriptor-constructor (-> wrapper-descriptor? (-> any/c any/c))] [wrapper-descriptor-predicate (-> wrapper-descriptor? predicate/c)] [wrapper-descriptor-accessor (-> wrapper-descriptor? (-> any/c any/c))] [make-default-wrapper-properties (-> uninitialized-wrapper-descriptor? (listof (cons/c struct-type-property? any/c)))])) (require (for-syntax racket/base racket/syntax) racket/struct rebellion/base/generative-token rebellion/base/symbol rebellion/type/record rebellion/type/tuple syntax/parse/define) (module+ test (require (submod "..") racket/format rackunit)) ;@------------------------------------------------------------------------------ (define (format-symbol template . vs) (string->symbol (apply format template vs))) ;@------------------------------------------------------------------------------ (define-record-type wrapper-type (name predicate-name constructor-name accessor-name) #:constructor-name constructor:wrapper-type) (define (wrapper-type name #:predicate-name [predicate-name #f] #:constructor-name [constructor-name #f] #:accessor-name [accessor-name #f]) (constructor:wrapper-type #:name name #:predicate-name (or predicate-name (format-symbol "~a?" name)) #:constructor-name (or constructor-name name) #:accessor-name (or accessor-name (format-symbol "~a-value" name)))) (define-record-type initialized-wrapper-descriptor (type predicate constructor accessor)) (define-record-type uninitialized-wrapper-descriptor (type predicate constructor accessor)) (define (wrapper-descriptor? v) (or (uninitialized-wrapper-descriptor? v) (initialized-wrapper-descriptor? v))) (define (wrapper-descriptor-type desc) (if (uninitialized-wrapper-descriptor? desc) (uninitialized-wrapper-descriptor-type desc) (initialized-wrapper-descriptor-type desc))) (define (wrapper-descriptor-predicate desc) (if (uninitialized-wrapper-descriptor? desc) (uninitialized-wrapper-descriptor-predicate desc) (initialized-wrapper-descriptor-predicate desc))) (define (wrapper-descriptor-constructor desc) (if (uninitialized-wrapper-descriptor? desc) (uninitialized-wrapper-descriptor-constructor desc) (initialized-wrapper-descriptor-constructor desc))) (define (wrapper-descriptor-accessor desc) (if (uninitialized-wrapper-descriptor? desc) (uninitialized-wrapper-descriptor-accessor desc) (initialized-wrapper-descriptor-accessor desc))) (define (make-wrapper-implementation type #:property-maker [prop-maker make-default-wrapper-properties] #:inspector [inspector (current-inspector)]) (define tuple-impl-type (tuple-type (wrapper-type-name type) 1 #:predicate-name (wrapper-type-predicate-name type) #:constructor-name (wrapper-type-constructor-name type))) (define (tuple-impl-prop-maker tuple-impl) (define tuple-impl-accessor (tuple-descriptor-accessor tuple-impl)) (define (accessor this) (tuple-impl-accessor this 0)) (define accessor-name (wrapper-type-accessor-name type)) (prop-maker (uninitialized-wrapper-descriptor #:type type #:predicate (tuple-descriptor-predicate tuple-impl) #:constructor (tuple-descriptor-constructor tuple-impl) #:accessor (procedure-rename accessor accessor-name)))) (define tuple-impl (make-tuple-implementation tuple-impl-type #:inspector inspector #:property-maker tuple-impl-prop-maker)) (define tuple-impl-accessor (tuple-descriptor-accessor tuple-impl)) (define (accessor this) (tuple-impl-accessor this 0)) (initialized-wrapper-descriptor #:type type #:predicate (tuple-descriptor-predicate tuple-impl) #:constructor (tuple-descriptor-constructor tuple-impl) #:accessor (procedure-rename accessor (wrapper-type-accessor-name type)))) (define (make-delegating-equal+hash delegate-extractor) (define token (make-generative-token)) (define (equal-proc this other recur) (recur (delegate-extractor this) (delegate-extractor other))) (define (hash-proc this recur) (recur (cons token (delegate-extractor this)))) (define hash2-proc hash-proc) (list equal-proc hash-proc hash2-proc)) (define (make-wrapper-equal+hash descriptor) (make-delegating-equal+hash (wrapper-descriptor-accessor descriptor))) (define (make-wrapper-custom-write descriptor) (define type-name (wrapper-type-name (wrapper-descriptor-type descriptor))) (define accessor (wrapper-descriptor-accessor descriptor)) (make-constructor-style-printer (λ (_) type-name) (λ (this) (list (accessor this))))) (define (make-default-wrapper-properties descriptor) (list (cons prop:equal+hash (make-wrapper-equal+hash descriptor)) (cons prop:custom-write (make-wrapper-custom-write descriptor)))) (define-simple-macro (define-wrapper-type id:id (~alt (~optional (~seq #:predicate-name predicate-name:id) #:defaults ([predicate-name (format-id #'id "~a?" #'id)]) #:name "#:predicate-name option") (~optional (~seq #:constructor-name constructor-name:id) #:defaults ([constructor-name #'id]) #:name "#:constructor-name option") (~optional (~seq #:accessor-name accessor-name:id) #:defaults ([accessor-name (format-id #'id "~a-value" #'id)]) #:name "#:accessor-name option") (~optional (~seq #:property-maker prop-maker:expr) #:defaults ([prop-maker #'make-default-wrapper-properties]) #:name "#:property-maker option")) ...) (begin (define type (wrapper-type 'id #:predicate-name 'predicate-name #:constructor-name 'constructor-name #:accessor-name 'accessor-name)) (define descriptor (make-wrapper-implementation type #:property-maker prop-maker)) (define predicate-name (wrapper-descriptor-predicate descriptor)) (define constructor-name (wrapper-descriptor-constructor descriptor)) (define accessor-name (wrapper-descriptor-accessor descriptor)))) (module+ test (test-case "integration-test" (define-wrapper-type seconds) (check-equal? (seconds 10) (seconds 10)) (check-not-equal? (seconds 10) (seconds 25)) (check-equal? (seconds-value (seconds 10)) 10) (check-pred seconds? (seconds 10)) (check-equal? (~v (seconds 10)) "(seconds 10)")))
false
687468609fd90766fe84c1126703e42059be25fe
d68e95fc969573225ab9262eff68a8b9e2017cc6
/www/notes/extort.scrbl
6f94aa82a803c3da07cb278ab1e48b1ebe22a42b
[ "AFL-3.0" ]
permissive
dvanhorn/www
733fd87fd667330c00592796326f699134db5301
aee1f850f8ea20edebbdcad3c2bbedef62a6809f
refs/heads/master
2020-07-11T13:44:11.244201
2019-08-26T20:36:25
2019-08-26T20:36:25
204,557,689
1
0
null
null
null
null
UTF-8
Racket
false
false
3,935
scrbl
extort.scrbl
#lang scribble/manual @(require (for-label (except-in racket ... compile))) @(require redex/pict racket/runtime-path scribble/examples "../fancyverb.rkt" "utils.rkt" "ev.rkt" "extort/semantics.rkt" "../utils.rkt") @(define codeblock-include (make-codeblock-include #'h)) @(for-each (λ (f) (ev `(require (file ,(path->string (build-path notes "extort" f)))))) '("interp.rkt" "compile.rkt" "asm/interp.rkt" "asm/printer.rkt")) @title[#:tag "Extort"]{Extort: when errors exist} We have added multiple, disjoint types, but mostly swept issues of errors under the rug by considering type mismatches as meaningless. Now let's redesign the semantics to specify the error behavior of such programs. We'll call it @bold{Extort}. Nothing changes in the syntax of Extort from Dupe, although we will need to talk about two kinds of @emph{results} from evaluating programs: values and errors. We will say that evaluation produces an @bold{answer}, which is either a value or error: @centered{@render-language[E]} @section{Meaning of Extort programs} The meaning of Extort programs... @itemlist[ @item{...} ] Let's consider some examples: @itemlist[ @item{...} ] Languages adopt several approaches to type mismatches: @itemlist[ @item{Prohibit such programs statically with a type system (e.g. OCaml, Java)} @item{Coerce values to different types (e.g. JavaScript)} @item{Signal a run-time error (e.g. Racket)} @item{Leave the behavior unspecified (e.g. Scheme, C)} ] We've previously seen the last approach. Now let's do what Racket does and signal an error. @(define ((rewrite s) lws) (define lhs (list-ref lws 2)) (define rhs (list-ref lws 3)) (list "" lhs (string-append " " (symbol->string s) " ") rhs "")) @(require (only-in racket add-between)) @(define-syntax-rule (show-judgment name i j) (with-unquote-rewriter (lambda (lw) (build-lw (lw-e lw) (lw-line lw) (lw-line-span lw) (lw-column lw) (lw-column-span lw))) (with-compound-rewriters (['+ (rewrite '+)] ['- (rewrite '–)] ['= (rewrite '=)] ['!= (rewrite '≠)]) (apply centered (add-between (build-list (- j i) (λ (n) (begin (judgment-form-cases (list (+ n i))) (render-judgment-form name)))) (hspace 4)))))) There are three ways in which an error can be introduced: @(show-judgment 𝑬 0 3) And there are four rules for propagating errors from subexpressions: @(show-judgment 𝑬 3 7) Now what does the semantics say about @racket['(add1 #f)]? What about @racket['(if 7 #t -2)]? The interpreter ... @codeblock-include["extort/interp.rkt"] We can confirm the interpreter computes the right result for the examples given earlier: @ex[ '... ] Correctness... @section{An Example of Extort compilation} Suppose we want to compile ... What needs to happen? ... @;codeblock-include["extort/asm/ast.rkt"] We omit the printer code, which is mundane. See @link["extort/asm/printer.rkt"]{@tt{asm/printer.rkt}} for details. We must extend the run-time system with a C function called @tt{error} that prints "err" and exits: @filebox-include[fancy-c "extort/main.c"] Compiler... @codeblock-include["extort/compile.rkt"] Here's the code we generate for @racket['(add1 #f)]: @ex[ (asm-display (compile '(add1 #f))) ] Here are some examples running the compiler: @ex[ (asm-interp (compile #t)) (asm-interp (compile #f)) (asm-interp (compile '(zero? 0))) (asm-interp (compile '(zero? -7))) (asm-interp (compile '(if #t 1 2))) (asm-interp (compile '(if #f 1 2))) (asm-interp (compile '(if (zero? 0) (if (zero? 0) 8 9) 2))) (asm-interp (compile '(if (zero? (if (zero? 2) 1 0)) 4 5))) (asm-interp (compile '(add1 #t))) (asm-interp (compile '(sub1 (add1 #f)))) (asm-interp (compile '(if (zero? #t) 1 2))) ]
true
e7b7baa991b977ef5b87aaaaefcd8bb604237d6a
c9304af7790d66f71073e38e6899040f3da1917a
/programming_languages_partB/week2/hw/otherhw.rkt
fe17911a1a79a177530504d502ba320d1d0b578b
[ "MIT" ]
permissive
raventid/coursera_learning
b086ac474be00f24af8c75ce5eada09f7ca6d39d
9cd62324b91d2a35af413dd4442867e160e7a4ea
refs/heads/master
2023-07-11T04:07:41.034279
2023-07-02T19:22:49
2023-07-02T19:22:49
78,435,867
1
0
MIT
2022-06-06T21:08:01
2017-01-09T14:25:07
Assembly
UTF-8
Racket
false
false
2,113
rkt
otherhw.rkt
#lang racket (provide (all-defined-out)) ;; so we can put tests in a second file ;; put your code below (define (sequence low high stride) (if(> low high) null (cons low (sequence (+ low stride) high stride)))) (define (string-append-map xs suffix) (map (lambda (i) (string-append i suffix)) xs)) (define (list-nth-mod xs n) (cond [(< n 0) (error "list-nth-mod: negative number")] [(empty? xs) (error "list-nth-mod: empty list")] [#t (car (list-tail xs (remainder n (length xs))))])) (define (stream-for-n-steps s n) (if (= n 0) null (cons (car (s)) (stream-for-n-steps (cdr (s)) (- n 1))))) (define funny-number-stream (letrec ([f (lambda (x) (cons (if(= 0 (remainder x 5)) (- x) x) (lambda () (f (+ x 1)))))]) (lambda () (f 1)))) (define dan-then-dog (letrec ([dan (lambda () (cons "dan.jpg" dog))] [dog (lambda () (cons "dog.jpg" dan))]) dan)) (define (stream-add-zero s) (letrec ([f (lambda(st) (cons (cons 0 (car st)) (lambda() (f ((cdr st))))))]) (lambda () (f (s))))) (define (cycle-lists xs ys) (letrec ([f (lambda (n) (cons (cons (list-nth-mod xs n) (list-nth-mod ys n)) (lambda () (f (+ n 1)))))]) (lambda () (f 0)))) (define (vector-assoc v vec) (letrec ([le (vector-length vec)] [f (lambda(n) (if(= n le) #f (let ([el (vector-ref vec n)]) (if(pair? el) (if(equal? (car el) v) el (f (+ n 1))) (f (+ n 1))))))]) (f 0))) (define (cached-assoc xs n) (letrec ([memo (make-vector n #f)] [i 0]) (lambda (v) (let ([ans (vector-assoc v memo)]) (if ans ans ( let ([new-ans (assoc v xs)]) (begin (vector-set! memo i new-ans) (set! i (remainder (+ i 1) n)) new-ans) ))))))
false
24f763aaab4c54c81a173215379b54e4e1ae9e8e
fc90b5a3938850c61bdd83719a1d90270752c0bb
/web-server-lib/web-server/default-web-root/htdocs/servlets/examples/dir.rkt
d4c38d499644ca7fb177b6957a0e7978a6657f7b
[ "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
racket/web-server
cccdf9b26d7b908701d7d05568dc6ed3ae9e705b
e321f8425e539d22412d4f7763532b3f3a65c95e
refs/heads/master
2023-08-21T18:55:50.892735
2023-07-11T02:53:24
2023-07-11T02:53:24
27,431,252
91
42
NOASSERTION
2023-09-02T15:19:40
2014-12-02T12:20:26
Racket
UTF-8
Racket
false
false
395
rkt
dir.rkt
#lang racket/base (require web-server/servlet) (provide (all-defined-out)) (define interface-version 'v1) (define timeout +inf.0) (define (start initial-request) (send/back (response/xexpr `(html (head (title "Current Directory Page")) (body (h1 "Current Directory Page") (p "The current directory is: " (em ,(path->string (current-directory)))))))))
false
e610dfa46eefb80ed7cada38b353b0f36222ad68
799b5de27cebaa6eaa49ff982110d59bbd6c6693
/soft-contract/test/programs/unsafe/issues/issue-89.rkt
5743711621d5100cee5fd3581e7a95a72b205e41
[ "MIT" ]
permissive
philnguyen/soft-contract
263efdbc9ca2f35234b03f0d99233a66accda78b
13e7d99e061509f0a45605508dd1a27a51f4648e
refs/heads/master
2021-07-11T03:45:31.435966
2021-04-07T06:06:25
2021-04-07T06:08:24
17,326,137
33
7
MIT
2021-02-19T08:15:35
2014-03-01T22:48:46
Racket
UTF-8
Racket
false
false
104
rkt
issue-89.rkt
#lang racket (define (f) (hash 1 "1")) (provide (contract-out (f (-> (hash/c integer? integer?)))))
false
5ef0bc9de7c96a99ababd2a8e5f987f9da3efbaf
76df16d6c3760cb415f1294caee997cc4736e09b
/rosette-benchmarks-4/nonograms/puzzle/src/nonograms/compile.rkt
2b8523f08343396ce7c1093d8daf34c82e5dc5a8
[ "MIT" ]
permissive
uw-unsat/leanette-popl22-artifact
70409d9cbd8921d794d27b7992bf1d9a4087e9fe
80fea2519e61b45a283fbf7903acdf6d5528dbe7
refs/heads/master
2023-04-15T21:00:49.670873
2021-11-16T04:37:11
2021-11-16T04:37:11
414,331,908
6
1
null
null
null
null
UTF-8
Racket
false
false
3,660
rkt
compile.rkt
#lang rosette/safe (provide program-map-expressions-postorder features-used-by-program program-limited-to-features? strip-unused-patterns same-pattern?) (require (only-in racket error set=? mutable-seteq mutable-set set-add! set-member? set->list struct-copy exit set-subtract set-empty? for) rosette/lib/match "rules.rkt" "action.rkt" "ast.rkt" "dsl-pretty.rkt" "../core/core.rkt") ; list of all expressions (Expr?) part of this program, including non-terminal expressions ; (so subexpressions appear both in the list and as part of other elements of the list). (define (program-for-each-expr f prog) (define (rec p) (program-for-each-expr f p)) (match prog [(Expr) (f prog)] [_ (void)]) (match prog [(Program _ cnd act) (rec cnd) (rec act)] [(Fill _ offset start end) (rec offset) (rec start) (rec end)] [(Filled? e _) (rec e)] [(HighestStartCell e) (rec e)] [(LowestEndCell e) (rec e)] [(And l r) (rec l) (rec r)] [(Apply _ args) (for-each rec args)] [(Unique? i e) (rec e)] [(TerminalExpr) (void)])) (define (program-map-expressions f prog) (match prog [(Program pat cnd act) (Program pat (f cnd) (f act))] [(Fill v offset start end) (Fill v (f offset) (f start) (f end))] [(Filled? e v) (Filled? (f e) v)] [(CellHasValue? e v) (CellHasValue? e v)] [(HighestStartCell e) (HighestStartCell (f e))] [(LowestEndCell e) (LowestEndCell (f e))] [(And l r) (And (f l) (f r))] [(Apply op args) (Apply op (map f args))] [(Unique? i e) (Unique? i (f e))] [(TerminalExpr) prog])) ; Recurses over the structure of the given program, invoking f on each subexpression. ; Will recurse on the subexpresions, replacing the sub-expressions with any new value. ; Then will invoke f on the resulting new expression. ; If f returns a non-false value, the expression will be replaced with that return value. ; Otherwise it will be the result of the recursive call. (define (program-map-expressions-postorder f prog) (define v (program-map-expressions (curry program-map-expressions-postorder f) prog)) (f v)) ; Program? -> (listof symbol?) (define (features-used-by-program prog) (define used (mutable-seteq)) ; Apply has to be handled in a special manner because it overloads several features (define (visit s) (match s [(Apply op _) (set-add! used (feature-of-operator op))] [_ (set-add! used (feature-of-ast-element s))])) (program-for-each-expr visit prog) ; have to add pattern features specially (for ([p (Program-pattern prog)]) (match p ; assumes the type name is the same as the feature name (which is true) [(ListPattern t) (set-add! used t)] [(NoPattern) (void)])) (set->list used)) (define (program-limited-to-features? features prog) (set-empty? (set-subtract (features-used-by-program prog) features))) ; Program? -> Program? ; replaces any unferenced pattern with (NoPattern) (define (strip-unused-patterns prog) (define used-bindings (mutable-set)) (define (get e) (match e [(BindingIndex i) i] [(BindingValue i) i] [(Unique? i _) i] [_ #f])) (program-for-each-expr (λ (e) (define x (get e)) (when x (set-add! used-bindings x))) prog) (define new-patterns (mapi (λ (i b) (if (set-member? used-bindings i) b (NoPattern))) (Program-pattern prog))) (struct-copy Program prog [pattern new-patterns])) ; Program?, Program? -> boolean? ; not rosette safe (define (same-pattern? p1 p2) (set=? (Program-pattern p1) (Program-pattern p2)))
false
2170cd445868e547f65d1734f0568d6fae771d9b
670d94fef83f53b25d69ee2aaa70ba97d7aaa33f
/gdb/main.rkt
542545aeb80a78b658335d4b08c1321594b4f217
[]
no_license
zwizwa/gdb
43782625cf6cd4a3eee6ddcfa64f5742310bc3c3
6aa666979407dda931883a8174cbc744a7b75e39
refs/heads/master
2021-01-01T18:23:22.231195
2013-09-28T15:23:03
2013-09-28T15:23:03
null
0
0
null
null
null
null
UTF-8
Racket
false
false
73
rkt
main.rkt
#lang racket/base (require "gdb.rkt") (provide (all-from-out "gdb.rkt"))
false
d1b8887185fee5af885f67889b6e1c7963278a8f
62c89908423c0c8c472ad87da25c184b03cb0a32
/Scheme/templates.rkt
80c5f4b0e871508c2d6ea5abf7b6049c22ce5ea7
[]
no_license
StiliyanDr/Functional-programming
3cba58e4f69e152ec79bc4421762a1bdac991d01
46d8a4e3ff7a2faab5fef24e53f9a9b3269b705e
refs/heads/master
2022-09-08T21:35:16.564414
2022-08-25T10:03:07
2022-08-25T10:03:07
152,886,241
0
0
null
null
null
null
UTF-8
Racket
false
false
1,442
rkt
templates.rkt
#lang racket/base (map (lambda (x) (map (lambda (f) (filter f x)) (list negative? zero? positive?))) '((-2 1 0) (1 4 -1) (0 0 1))) (define accumulate (lambda (operation neutralElement from to term next) (if (> from to) neutralElement (operation (term from) (accumulate neutralElement (next from) to term next))))) (define accumulate-i (lambda (operation neutralElement from to term next) (if (> from to) neutralElement (accumulate-i operation (operation neutralElement (term from)) (next from) to term next)))) (define foldr (lambda (operation neutralElement list) (if (null? list) neutralElement (operation (car list) (foldr operation neutralElement (cdr list)))))) (define foldl (lambda (operation neutralElement list) (if (null? list) neutralElement (foldl operation (operation neutralElement (car list)) (cdr list))))) (define foldr1 (lambda (operation nonEmptyList) (if (null? (cdr nonEmptyList)) (car nonEmptyList) (operation (car nonEmptyList) (foldr1 operation (cdr nonEmptyList)))))) (define foldl1 (lambda (operation nonEmptyList) (foldl operation (car nonEmptyList) (cdr nonEmptyList))))
false
d61c738295945dac51dd1d8d598b0ee0088784d8
23d78f4c06e9d61b7d90d8ebd035eb1958fe2348
/racket/logic/racket-lazy-demo1.rkt
cb25d2a676a97c8ca16510ff860ced5c2bd6e127
[ "Unlicense" ]
permissive
seckcoder/pl_research
e9f5dbce4f56f262081318e12abadd52c79d081d
79bb72a37d3862fb4afcf4e661ada27574db5644
refs/heads/master
2016-09-16T09:40:34.678436
2014-03-22T02:31:08
2014-03-22T02:31:08
null
0
0
null
null
null
null
UTF-8
Racket
false
false
241
rkt
racket-lazy-demo1.rkt
#lang racket (require (prefix-in s: lazy) (prefix-in s: "./lazy.rkt")) (s:! ((s:! s:foo))) (let ((v (s:flatmap (lambda (v) (list v)) s:ones))) (s:car (s:! v)) (s:! (s:cdr (s:! v))))
false
a723ddac0ea74f2a181584347f54df229f4903f8
b547ea5b0ebd20b42c85ccf3d0ac9e82fe06cbda
/12.rkt
36e61aab6e73248ad816e99ada0cfdd02bcc23cc
[]
no_license
samdphillips/aoc-2018
c9bb42f666807e88e6dab3d2c6ce8a9b86f4fded
8a0001017f05630f945b6ae468afbef5dc0fc233
refs/heads/master
2020-04-09T11:37:58.608524
2018-12-20T07:22:09
2018-12-20T07:22:09
160,317,551
0
0
null
null
null
null
UTF-8
Racket
false
false
7,372
rkt
12.rkt
#lang racket (define << arithmetic-shift) (define (>> n m) (<< n (- m))) (define bit/or bitwise-ior) (define bit/and bitwise-and) (define (state->integer s) (define s* (sequence-map (lambda (c) (match c [#\# 1] [#\. 0])) s)) (for/fold ([i 0]) ([n (in-naturals)] [t s*]) (bit/or (<< t n) i))) (module+ test (require rackunit) (check-equal? (state->integer "...#..#.#..##......###...###") #b1110001110000001100101001000) (check-equal? (state->integer "...##") #b11000) (check-equal? (state->integer "..#..") #b100) (check-equal? (state->integer "####.") #b1111) (check-equal? (state->integer "###.#") #b10111)) (define (integer->state i) (define (loop cs i) (cond [(zero? i) (list->string (reverse cs))] [(zero? (bit/and i 1)) (loop (cons #\. cs) (>> i 1))] [else (loop (cons #\# cs) (>> i 1))])) (loop null i)) (module+ test (check-equal? (integer->state #b10111) "###.#")) (define (pot-neighbors i n) (cond [(> n 1) (bitwise-bit-field i (- n 2) (+ n 3))] [else (<< (bitwise-bit-field i 0 (+ n 3)) (- 2 n))])) (module+ test (check-equal? (pot-neighbors #b11011 2) #b11011) (check-equal? (pot-neighbors #b11011 3) #b01101) (check-equal? (pot-neighbors #b101011 1) #b10110) (check-equal? (pot-neighbors #b101011 0) #b01100)) (define (in-pot-neighbors i) (define (rest-stream n) (cond [(zero? n) empty-stream] [else (stream-cons (pot-neighbors i (sub1 n)) (rest-stream (sub1 n)))])) (rest-stream (+ 2 (integer-length i)))) (module+ test (define (check-sequence s es [message ""]) (check-equal? (sequence->list s) es message)) (check-sequence (in-pot-neighbors #b1) '(#b00001 #b00010 #b00100)) (check-sequence (in-pot-neighbors #b110101) '(#b00001 #b00011 #b00110 #b01101 #b11010 #b10101 #b01010 #b10100))) (define ((make-bit-step r*) i) (if (for/or ([r (in-list r*)]) (= r i)) 1 0)) (define ((make-step bit-step) i) (for/fold ([z 0]) ([n (in-pot-neighbors i)]) (bit/or (bit-step n) (<< z 1)))) (module+ test (require threading) (let* ([bit-step (make-bit-step (list (state->integer ".##.#")))] [step (make-step bit-step)]) (check-equal? (step (state->integer ".##.#")) #b00100)) (let* ([bit-step (make-bit-step (list (state->integer "....#")))] [step (make-step bit-step)]) (check-equal? (step (state->integer "....#")) (state->integer "..#.."))) (let* ([rules (list "...##" "..#.." ".#..." ".#.#." ".#.##" ".##.." ".####" "#.#.#" "#.###" "##.#." "##.##" "###.." "###.#" "####.")] [bit-step (make-bit-step (map state->integer rules))] [step (make-step bit-step)]) (check-equal? (~> "...#..#.#..##......###...###" state->integer step integer->state) "...#...#....#.....#..#..#..#")) (test-case "check multiple steps" (define rules (list "...##" "..#.." ".#..." ".#.#." ".#.##" ".##.." ".####" "#.#.#" "#.###" "##.#." "##.##" "###.." "###.#" "####.")) (define expected (list "...#...#....#.....#..#..#..#..........." "...##..##...##....#..#..#..##.........." "..#.#...#..#.#....#..#..#...#.........." "...#.#..#...#.#...#..#..##..##........." "....#...##...#.#..#..#...#...#........." "....##.#.#....#...#..##..##..##........" "...#..###.#...##..#...#...#...#........" "...#....##.#.#.#..##..##..##..##......." "...##..#..#####....#...#...#...#......." "..#.#..#...#.##....##..##..##..##......" "...#...##...#.#...#.#...#...#...#......" "...##.#.#....#.#...#.#..##..##..##....." "..#..###.#....#.#...#....#...#...#....." "..#....##.#....#.#..##...##..##..##...." "..##..#..#.#....#....#..#.#...#...#...." ".#.#..#...#.#...##...#...#.#..##..##..." "..#...##...#.#.#.#...##...#....#...#..." "..##.#.#....#####.#.#.#...##...##..##.." ".#..###.#..#.#.#######.#.#.#..#.#...#.." ".#....##....#####...#######....#.#..##.")) (define bit-step (make-bit-step (map state->integer rules))) (define step (make-step bit-step)) (define i (state->integer "...#..#.#..##......###...###...........")) (for/fold ([i i] #:result (void)) ([e (in-list expected)] [n (in-naturals)]) (let ([i (step i)]) (check-equal? i (state->integer e) (~a "step " (add1 n) " " (integer->state i) " " e)) i)))) (define (in-bits i) (define (rest-stream i) (cond [(zero? i) empty-stream] [else (stream-cons (bit/and 1 i) (rest-stream (>> i 1)))])) (rest-stream i)) (define (checksum-generation i [offset -3]) (for/sum ([i (in-naturals)] [b (in-bits i)]) (* b (+ i offset)))) (module+ test (check-equal? (checksum-generation (state->integer ".#....##....#####...#######....#.#..##.")) 325)) (define INITIAL-STATE-PAT #px"initial state: ([#.]+)") (define (read-initial-state inp) (match (regexp-match INITIAL-STATE-PAT (read-line inp)) [(list _ s) (state->integer (~a "..." s))])) (define RULE-PAT #px"(.....) => #") (define (read-rules inp) (for/fold ([rules null]) ([line (in-port read-line inp)]) (match (regexp-match RULE-PAT line) [(list _ pat) (cons (state->integer pat) rules)] [_ rules]))) (module+ main (define (displayv i v) (define (remove-zeroes z c) (cond [(= 1 (bit/and 1 z)) (displayln (~a #:separator " " (~a "[" (~a #:width 5 #:align 'right i) "]") (~a #:width 4 #:align 'right c) (integer->state z))) v] [else (remove-zeroes (>> z 1) (add1 c))])) (remove-zeroes v -3)) (define-values (iter1 iter2) (match (current-command-line-arguments) [(vector i j _ ...) (values (string->number i) (string->number j))] [(vector i _ ...) (values (string->number i) 153)] [_ (values 20 153)])) (displayln "PART ONE") (call-with-input-file "inputs/12.txt" (lambda (inp) (let* ([initial-state (read-initial-state inp)] [rules (read-rules inp)] [bit-step (make-bit-step rules)] [step (make-step bit-step)]) (time (for/fold ([i initial-state] #:result (checksum-generation i)) ([n (in-range iter1)]) (displayv (add1 n) (step i))))))) #| At 153 generations the pattern stabilizes and moves 1 pot right per generation. [ 153] 71 #...#...#...#...#...#...#...#...#.####...#...#...#...#...#...#...#...#...#...#...#...#...#...#...#...#...#..####...#...#...#...#...#...#...#...#...#...#...#...#...#...#...#..#### |# (define stable (state->integer "#...#...#...#...#...#...#...#...#.####...#...#...#...#...#...#...#...#...#...#...#...#...#...#...#...#...#..####...#...#...#...#...#...#...#...#...#...#...#...#...#...#...#..####")) (displayln "PART TWO") (displayln (checksum-generation stable (+ iter2 (- 71 153)))) )
false
5562fb884ab409e4489b66d50aaab48747a02bff
f683575352e3720842178d594b35ad60fc03f9d3
/includes/fors.rkt
d7712132825531d69355ad86409106ddcdc2bb97
[]
no_license
ajfite/CPE-123
e1a9fc8cccf4a0fe3889622ed54684148b963c7c
c62804f3ec535fb0e532b79f6912c908d4833ba5
refs/heads/master
2021-09-06T21:40:51.060519
2018-02-11T23:59:15
2018-02-11T23:59:15
null
0
0
null
null
null
null
UTF-8
Racket
false
false
58
rkt
fors.rkt
#lang racket (provide for/fold for/list in-range in-list)
false
05ae017ff3afcda82099526fdf508d407650778b
f689dddc16a958ceb7e5ad3bd59d7ce8275a6c2f
/lecture notes/tues-lec1.rkt
a0b729096f6829aaf68be23f25f986cd8e7e7c5a
[]
no_license
j0shualarkin/RSS
33dd61e583767de64e0c07be6bd4db60ffbd5632
0453fe6cb7ac2978d7f68bb5ffef9cd2329f7450
refs/heads/master
2020-03-22T16:03:22.754385
2018-07-12T23:03:53
2018-07-12T23:03:53
140,299,792
0
1
null
2019-05-21T13:54:34
2018-07-09T14:46:11
Racket
UTF-8
Racket
false
false
754
rkt
tues-lec1.rkt
#lang racket/base (require (only-in racket/list [first fst] [second snd]) (rename-in racket/base [or one-of])) #;(module whatever racket (list 1 10) (define x 11) (module+ nested racket/base (require (submod "..")) (define my-secret-num 9) x (provide my-secret-number)) (provide x) my-secret-number) ;; module* lets the submodule require the enclosing module ;; module+ you see all the surrounding stuff (module+ main fst snd) #;#;#; (require (only-in racket/list [first fst] [second snd]) (rename-in racket/base [or one-of])a) (provide (rename-out [five my-fav-num])) (define five 5)
false
0d2590f1b0ed0c3d284ed8c52e563e0a5808308e
b6a5637b6d3fc8ad1b7996c62ec73b6d895c5e95
/ch2/2.3/ex-2.62.rkt
24943ec08b34d46fd46df3f0c29edb6f7a792d06
[ "MIT" ]
permissive
abelkov/sicp-musings
8911b5215b42fc21c15699b11cdb68727852d399
49373974eb3df8e12ad086ddfabda14b95f139ba
refs/heads/master
2021-06-12T03:55:16.842917
2017-01-31T19:02:45
2017-01-31T19:02:45
null
0
0
null
null
null
null
UTF-8
Racket
false
false
898
rkt
ex-2.62.rkt
#lang racket (define (element-of-set? x set) (cond ((null? set) false) ((= x (car set)) true) ((< x (car set)) false) (else (element-of-set? x (cdr set))))) (define (adjoin-set x set) (cond [(or (null? set) (< x (car set))) (cons x set)] [(equal? x (car set)) set] [else (cons (car set) (adjoin-set x (cdr set)))])) (define (union-set set1 set2) (cond [(null? set1) set2] [(null? set2) set1] [else (let ((v1 (car set1)) (v2 (car set2))) (cond [(< v1 v2) (cons v1 (union-set (cdr set1) set2))] [(= v1 v2) (cons v1 (union-set (cdr set1) (cdr set2)))] [(cons v2 (union-set set1 (cdr set2)))]))])) (union-set '(1 2 3) '(3 4))
false
c3a452782c6146f99de81d77875d902eb85f9085
e6bb5dcc7cb7ff81411734f3534fa80580e4c822
/interp-algebra-calculus-thing/TODO/syntax-object/check-duplicate-identifier.rkt
7d5aa8db42447df2a5fe82bf56b6e4f393562a28
[ "MIT" ]
permissive
AlexKnauth/interp-algebra-calculus-thing
dbdca3d82ff4bf2aac9918c433f6e2471e9f776e
f34568344d6f088b4b8850489dd9a778cced574e
refs/heads/master
2022-02-01T14:02:50.234192
2022-01-07T15:00:20
2022-01-07T15:00:20
33,263,586
0
0
null
null
null
null
UTF-8
Racket
false
false
1,107
rkt
check-duplicate-identifier.rkt
#lang racket/base (provide check-duplicate-identifier bound-identifier=? ) (require racket/match racket/bool racket/set "syntax-object.rkt" "syntax.rkt" "ExprC.rkt" ) ;; rewritten from racket/private/stxcase-cheme.rkt (define (check-duplicate-identifier names) (unless (and (list? names) (andmap id-or-idC? names)) (raise-argument-error 'check-duplicate-identifier "(listof identifier?)" names)) (let/ec escape (let ([ht (make-hasheq)]) (for ([defined-name (in-list names)]) (define defined-name* (id->idC defined-name)) (match-define (idC sym scopes srcloc) defined-name*) (let ([l (hash-ref ht sym null)]) (when (ormap (lambda (i) (bound-identifier=? i defined-name*)) l) (escape defined-name*)) (hash-set! ht sym (cons defined-name* l)))) #f))) (define (bound-identifier=? id1 id2) (match-define (idC sym1 scopes1 _) (id->idC id1)) (match-define (idC sym2 scopes2 _) (id->idC id2)) (and (symbol=? sym1 sym2) (set=? scopes1 scopes2)))
false
ab6039cc8347c50e59678ba47e1f1442f9f607c2
804e0b7ef83b4fd12899ba472efc823a286ca52d
/Motile/actor/jumpstart.rkt
00bba4be775e77ab521c0e7a5fb985ae437e1ff4
[]
no_license
cha63506/CRESTaceans
6ec436d1bcb0256e17499ea9eccd5c034e9158bf
a0d24fd3e93fc39eaf25a0b5df90ce1c4a96ec9b
refs/heads/master
2017-05-06T16:59:57.189426
2013-10-17T15:22:35
2013-10-17T15:22:35
null
0
0
null
null
null
null
UTF-8
Racket
false
false
7,088
rkt
jumpstart.rkt
#lang racket/base (require ; !!! Bug in racket 5.1.2 causes drracket to crash in test/7b with message "about to suspend in atomic mode" ;(only-in ffi/unsafe/atomic start-atomic end-atomic) (only-in "../utility/uuid.rkt" uuid/symbol) (only-in "actor.rkt" ; Type test. actor? ; Fields. actor/chieftain actor/clan/id actor/id actor/thread actor/thread! ; Actor equivalent of (current-thread). this/actor ; Debugging and error reporting. actor/pretty ; Constructors. actor/skeleton/new actor/chieftain/skeleton/new) (only-in "locative.rkt" ; Fields. locative/actor ; Locative constructor. locative/unrestricted/new)) (provide ; Actor constructors. actor/new actor/chieftain/new actor/root/new ; Start an actor. actor/jumpstart ; parameter(s) that need to be exported to dynamically glue them to binding environments. this/locative ; Tests for chieftains and the root actor. actor/chieftain? actor/root? ; Actor execution states. actor/dead? actor/alive? actor/suspended?) ; x - subject of type test ; type? - type predicate for x ; where - symbol (typially name of function containing the type assertion) ; expectation - string giving expected type (define-syntax-rule (assert/type x type? where expectation) (when (not (type? x)) (raise-type-error 'where expectation x))) (define-syntax-rule (time/now) (current-inexact-milliseconds)) ;; Tests for the execution state of an actor. (define (actor/dead? x) (and (actor? x) (thread-dead? (actor/thread x)))) (define (actor/alive? x) (and (actor? x) (thread-running? (actor/thread x)))) (define (actor/suspended? x) (and (actor? x) (not (thread-dead? (actor/thread x))) (not (thread-running? (actor/thread x))))) ;; Constructing actors. ;; Default actor nickname. (define ANONYMOUS 'anonymous) ;; Create a new actor whose clan chieftain is given returning the primal locative of the actor. ;; There is only one primal locative per actor. (define (actor/new chieftain . nickname) (let* ((actor (actor/skeleton/new chieftain (if (null? nickname) ANONYMOUS (car nickname)))) (locative (locative/unrestricted/new actor)) (t (thread (actor/shrinkwrap locative)))) (actor/thread! actor t) ; Patch up the actor object. (values actor locative))) ;; Create a clan chieftain. ;; parent - chieftain of the superior clan ;; In esssence chieftains are the only actors that are members of two clans: ;; the parent clan that gave them birth and the clan that they themselves represent. ;; In addition clan chieftains are the only actors for which their actor id and their clan id are identical. ;; Returns the primal locative of the the clan chieftain. (define (actor/chieftain/new chieftain . nickname) (let* ((actor (actor/chieftain/skeleton/new chieftain (if (null? nickname) ANONYMOUS (car nickname)))) (locative (locative/unrestricted/new actor)) (t (thread (actor/shrinkwrap locative)))) (actor/thread! actor t) ; Patch up the actor object. (values actor locative))) ;; Create a ROOT clan chieftain (only one per island). ;; The root chieftain is the only chieftain (and actor) on an island that does not have a superior chieftain. (define (actor/root/new) (actor/chieftain/new #f 'root)) ;; TYPE TESTS for CHIEFTAINS. ;; Returns #t iff x is the chieftain of the root clan and #f otherwise. ;; The root chieftain is the root of the tree of chieftains. (define (actor/root? x) (and (actor? x) (eq? (actor/clan/id x) (actor/id x)) (not (actor/chieftain x)))) ;; Returns #t iff x is the chieftain of some clan and #f otherwise. ;; Clan chieftains are the only actors whose actor id and clan id are identical. (define (actor/chieftain? x) (and (actor? x) (eq? (actor/clan/id x) (actor/id x)))) ;; Trace back up the tree of actors all the way to the root actor. (define (actor/root/find a) (if (actor/root? a) a ; a is the root actor. (actor/root/find (actor/chieftain a)))) ;; x is either a locative or a clan id. ;; Returns a closure that returns #t if the caller is a member of the clan denoted by x and #f otherwise. ;(define (CLAN-ONLY x) ; (cond ; ((symbol? x) (lambda () (eq? (actor/clan/id (this/actor)) x))) ; ((locative? x) (CLAN-ONLY (actor/clan/id x))) ; (else NEVER))) ; Guarantee that the derived locative will be non-delegable. ;; set is a vector containing actor ids. ;; Returns a predicate that determines if the caller is a member of the delegation. ;(define (vector/member? v) ; (lambda () (and (vector-memq (actor/id (this/actor)) v) #t))) ;; Given a lifespan of n > 0 milliseconds returns a closure that will return #t for the next n milliseconds ;; and #f thereafter. ;(define (actor/when/lifespan n) ; (if (and (integer? n) (positive? n)) ; (let ((expiration (+ (time/now) n))) ; (lambda () (< (time/now) expiration))) ; NEVER)) ;; Return the actor/ids of the chieftains in the chain of command of actor x in order of increasing authority. ;(define (locative/chain-of-command x) ; ; Each actor in the chain adds the actor id of its higher authority to the list. ; (let loop ((x x) (chain null)) ; (cond ; ((not (actor/chieftain? x)) (reverse chain)) ; x is the root chieftain. Return the list in order of increasing authority. ; ; ((eq? (actor/id x) (actor/clan/id x)) ; x is a clan chieftain. ; (let ((higher (actor/chieftain x))) ; (loop higher (cons (actor/id higher) chain)))) ; x's clan chieftain is next in the chain of command. ; ; (else ; ; x is just an ordinary actor. So just add x's clan chieftain to the list. ; (loop (actor/chieftain x) (cons (actor/clan/id x) chain)))))) ;; Returns #t if actors a and b are members of the same clan. (define (actor/clan/same? a b) (and (actor? a) (actor? b) (eq? (actor/clan/id a) (actor/clan/id b)))) ; Start the actor executing the given thunk. (define (actor/start actor thunk) (thread-send (actor/thread actor) thunk)) ;; Return the parent chieftain of chieftain c if it exists. ;; Returns #f if the c is the root chieftain. (define (chieftain/parent c) (assert/type c actor? chieftain/parent "actor") (assert/type c actor/chieftain? chieftain "chieftain") (let ((parent (actor/chieftain c))) (if (eq? parent c) #f parent))) ; The parent of the root chieftain is itself. (define this/clan (make-parameter #f)) (define this/chieftain (make-parameter #f)) (define this/locative (make-parameter #f)) ;; Returns a thunk that jumpstarts an actor thread with the proper thread parameters. (define (actor/shrinkwrap locative) (lambda () (let ((x (locative/actor locative))) (parameterize ((this/actor x) (this/clan (actor/clan/id x)) (this/locative locative) (this/chieftain (actor/chieftain x))) (let ((jumpstart (thread-receive))) (when (procedure? jumpstart) (jumpstart))))))) (define-syntax-rule (actor/jumpstart a thunk) (thread-send (actor/thread a) thunk))
true
74baf44f63af8b568ceed689e804cc91aab9b492
4b5472bdab1db0c0425ae79eced9b0e3da1aae0a
/expand-trig.rkt
8c2888ece96330f8eae831c668893f788e70af0d
[ "Apache-2.0" ]
permissive
Metaxal/rascas
c5a921c456e5c9e0948f6fd65c0f2ca3628ec47d
f575e5a63b02358e80bfde53c7cb3eaae396e41a
refs/heads/master
2023-03-16T04:23:54.814941
2023-03-11T13:37:28
2023-03-11T13:37:28
121,151,282
27
2
null
null
null
null
UTF-8
Racket
false
false
3,209
rkt
expand-trig.rkt
#lang racket/base ;;;; This file has been changed from its original dharmatech/mpl version. (provide expand-trig) (require "misc.rkt" "arithmetic.rkt" "sin.rkt" "cos.rkt") ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define (binomial-coefficient n k) (cond ( (= k 0) 1 ) ( (= n k) 1 ) ( else (+ (binomial-coefficient (- n 1) (- k 1)) (binomial-coefficient (- n 1) k)) ))) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define (sigma f a b step) (let loop ((a a) (sum 0)) (if (> a b) sum (loop (+ a step) (+ sum (f a)))))) (define (multiple-angle-sin n angle) (let ((f (if (sum? angle) (expand-trig-rules angle) (list (sin angle) (cos angle))))) (let ((sin-angle (list-ref f 0)) (cos-angle (list-ref f 1))) (let ((sign (if (< n 0) -1 1)) (n (abs n))) (* sign (sigma (lambda (j) (* (^ -1 (/ (- j 1) 2)) (binomial-coefficient n j) (^ cos-angle (- n j)) (^ sin-angle j))) 1 n 2)))))) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define (multiple-angle-cos n angle) (let ((f (if (sum? angle) (expand-trig-rules angle) (list (sin angle) (cos angle))))) (let ((sin-angle (list-ref f 0)) (cos-angle (list-ref f 1))) (let ((n (abs n))) (sigma (lambda (j) (* (^ -1 (/ j 2)) (binomial-coefficient n j) (^ cos-angle (- n j)) (^ sin-angle j))) 0 n 2))))) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define (expand-trig-rules A) (cond ( (sum? A) (let ((f (expand-trig-rules (list-ref A 1))) (r (expand-trig-rules (- A (list-ref A 1))))) (let ((s (+ (* (list-ref f 0) (list-ref r 1)) (* (list-ref f 1) (list-ref r 0)))) (c (- (* (list-ref f 1) (list-ref r 1)) (* (list-ref f 0) (list-ref r 0))))) (list s c))) ) ( (and (product? A) (integer? (list-ref A 1))) (let ((f (list-ref A 1))) (list (multiple-angle-sin f (/ A f)) (multiple-angle-cos f (/ A f)))) ) ( else (list (sin A) (cos A)) ))) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Original version from book (define (expand-trig u) (if (or (number? u) (symbol? u)) u (let ((v (map expand-trig u))) (case (operator-kind u) ( (sin) (list-ref (expand-trig-rules (list-ref v 1)) 0) ) ( (cos) (list-ref (expand-trig-rules (list-ref v 1)) 1) ) ( else v )))))
false
1dc03310dfb601c2301a448158c1331944ef4d9e
5dfeeeea0d845413f14fb9422c12395dd6835b17
/new/threads/trapr.rkt
8c65a3f2386e99981c6be39a987df29fab4eea99
[]
no_license
acieroid/racket-concurrency
6cd7b0f0f29dcd637ec6407570fc3f93324b2f9d
bd0edeffd46aa15a8233357fb827895c6bd24d5f
refs/heads/master
2020-05-18T00:15:45.588825
2019-05-06T14:16:12
2019-05-06T14:16:12
184,056,682
0
0
null
null
null
null
UTF-8
Racket
false
false
2,188
rkt
trapr.rkt
#lang racket (require "../threads.rkt") (require "../abstract.rkt") ;; Trapezoidal integral approximation (define (map f l) (if (pair? l) (cons (f (car l)) (map f (cdr l))) (if (null? l) '() (error "map applied to a non-list")))) (define foldl (lambda (f base lst) (define foldl-aux (lambda (base lst) (if (null? lst) base (foldl-aux (f base (car lst)) (cdr lst))))) (foldl-aux base lst))) (define NumWorkers (int-top)) (define Precision (+ 10 (int-top))) (define L 0.) (define R (* 1. (+ 100 (int-top)))) (define (exp x) (expt 2.718281828459045 x)) (define (fx x) (let* ((a (sin (- (expt x 3) 1))) (b (+ x 1)) (c (/ a b)) (d (sqrt (+ 1 (exp (sqrt (* 2 x)))))) (r (* c d))) r)) (define (compute-area l r h) (let ((n (inexact->exact (floor (/ (abs (- r l)) h))))) (letrec ((loop (lambda (i acc) (if (= i n) acc (let* ((lx (+ (* i h) l)) (rx (+ lx h)) (ly (fx lx)) (ry (fx rx))) (loop (+ i 1) (+ acc (* 0.5 (+ ly ry) h)))))))) (loop 0 0)))) (define (build-vector n init f) (letrec ((v (make-vector n init)) (loop (lambda (i) (if (< i n) (begin (vector-set! v i (f i)) (loop (+ i 1))) v)))) (loop 0))) (define (worker l r h) (compute-area l r h)) (define (compute l r h) (let ((range (/ (- r l) NumWorkers))) (letrec ((loop (lambda (i acc) (if (= i NumWorkers) acc (let* ((wl (+ (* range i) l)) (wr (+ wl range))) (loop (+ i 1) (cons (t/spawn (worker wl wr h)) acc))))))) (let* ((threads (loop 0 '())) (results (map (lambda (t) (t/join t)) threads)) (result (foldl + 0 results))) result)))) (compute L R Precision) (t/display-recorded)
false
fe0669d9865061bdb9f1ed2f4ec78f38f958d1d8
5d5e9dfc2ec757825f574b0893237e0718eb84c1
/scribblings/manual.scrbl
654d015527dd87dbd8b8f2e14e380f3dabd4100b
[]
no_license
thoughtstem/ts-printing
7547ad9cfdadc6fe999147df0f9db8bd16dedda2
8f3d0cb6fc3ec4e4b9eb2202045ef23aab985bfe
refs/heads/master
2020-09-05T10:41:54.606220
2019-11-06T19:53:29
2019-11-06T19:53:29
220,077,808
0
0
null
null
null
null
UTF-8
Racket
false
false
10,880
scrbl
manual.scrbl
#lang scribble/manual @require[@for-label[racket/base]] @title{A Package for Our Various Printing Needs} @defmodule[ts-printing/common] This module provides three functions: one for constructing the front side of a card, one for the back, and one for writing a list of cards out to a folder. It also provides a variety of parameters to configure the above -- e.g. to specify background colors, meta data, card numbering, etc. @defproc[(list->folder [card-list (listof pict?)] [folder-name string? "my-cards"] [dest path? DESKTOP]) void?]{ Outputs the cards into the specified folder name in the specified destination. Input picts should be a list of fronts and backs, alternating. The output is in a form suitable for uploading to makeplayingcards.com. For ideal results, all of the picts in the input list should have been passed through either @racket[front-side] or @racket[back-side]. If not, there are some parameters in this module that will have no effect (i.e. ones that control the background color of some card). Card files will be given names like @racket["card-025.png"]. Even numbered cards are the fronts, and odds are the back. Furthermore, fronts will be placed into a subdirectory front/, and backs will be placed into a subdirectory back/ The outputted images are square and can be used in a variety of templates. Here are the templates we've used in the past for challenge chards: Medium hext cards (2.6" x 3"): @link{https://www.makeplayingcards.com/design/your-own-hex-cards.html} Bigger hex cards (3.25" x 3.75"): @link{https://www.makeplayingcards.com/design/custom-hexagonal-game-cards.html} For identifier and asset cards, the templates are: @link{https://www.makeplayingcards.com/design/custom-small-square-cards.html} } @defproc[(blank-bg) pict?]{ Returns a blank pict determined by the size of the @racket[WIDTH] and @racket[HEIGHT] parameters. } The above functions can be configured through various parameters. @defparam[WIDTH number number? #:value 1200]{ The total card width is this value plus the @racket[PADDING] value. } @defparam[HEIGHT number number? #:value 1200]{ The total card height is this value plus the @racket[PADDING] value. } @defparam[FRONT-MARGIN number number? #:value 200]{ This controls how close to the edges the foreground of a card is scaled on the fronts of cards. Anything passed to @racket[front-side] be scaled larger than the @racket[WIDTH] minus the @racket[FRONT-MARGIN]. } @defparam[BACK-MARGIN number number? #:value 200]{ Same as the above, but controls @racket[back-side]. } @defparam[PADDING number number? #:value 10]{ This is used to create a bleed area for cutting. } @defparam[FRONT-BG-COLOR color color? #:value "white"]{ The bagkround color for card fronts } @defparam[BACK-BG-COLOR color color? #:value "white"]{ The bagkround color for card backs } @defparam[FRONT-META-FUNCTION procedure (-> number? pict?) #:value default-meta]{ Can be used to add meta data to the front of cards. By default adds just the card number and the @racket[VERSION] parameter. (Meta data is currently placed in the bottom center of a card. If you wanted to configure that, you would need to add another parameter to common/main.rkt and update the placement algorithm accordingly.) } @defparam[BACK-META-FUNCTION procedure (-> number? pict?) #:value (thunk* (blank))]{ Can be used to add meta data to the front of cards. Does nothing by default. (Meta data is currently placed in the bottom center of a card. If you wanted to configure that, you would need to add another parameter to common/main.rkt and update the placement algorithm accordingly.) } @defparam[TOTAL number number? #:value 0]{ The total number of cards in the deck. You usually won't set this yourself. It gets set in the various @racket[begin-job] functions, where the total is calculated as all of the cards printed within that job. } @defparam[VERSION string string? #:value ""]{ The version of the deck. This defaults to the current checksum of TS-Kata-Collections. } @defparam[STARTING-CARD-NUMBER number number? #:value 0]{ Will number the cards starting at the given value. Usually, you won't do this by hand. It can be used when outputing multiple decks to the same folder -- starting the numbering of each subsequent deck where the first left off. This is done for you in macros like @racket[begin-job]. } @defmodule[ts-printing/challenge-cards/print-jobs] Adds some printing parameters that are specific to challenge cards: @defparam[FRONT-FG-COLOR color color? #:value "white"]{ The front of a challenge card contains the textual prompt for the challenge. This color appears behind the text. } @defparam[FRONT-TITLE pict pict? #:value (blank)]{ This is displayed at the top of the front of each card. } @defform[(begin-job desktop-folder (collection [parameter val] ...) ...)]{ Utility for putting multiple kata collections into the same folder, but with different card numbers, foreground colors, etc. Here's how you would make a function that turns three sub collections into a print job: @codeblock{ (define (ts-battle-arena-fortnite-summer-camp-2019->Desktop) (local-require ts-battle-arena-fortnite-summer-camp-2019/katas) (begin-job "ts-battle-arena-fortnite-summer-camp-2019-cards" (avatar-katas [FRONT-BG-COLOR googly-red] [FRONT-FG-COLOR clear-white] [FRONT-TITLE (title "(avatar)")]) (enemy-katas [FRONT-BG-COLOR googly-orange] [FRONT-FG-COLOR clear-white] [FRONT-TITLE (title "(enemy)")]))) } This is the building block used to define the print jobs below. } Some common print jobs, where for each major category of katas, it assigns a different front-of-card color from our @racket[ts-kata-util/colors/pallets] and adds a matching title. @defproc[(ts-battle-arena-asp-2019->Desktop) void?]{ } @defproc[(ts-battle-arena-fortnite-summer-camp-2019->Desktop) void?]{ } @defproc[(ts-battle-arena-starwars-summer-camp-2019->Desktop) void?]{ } @defproc[(ts-survival-asp-2019->Desktop) void?]{ } @defproc[(ts-survival-minecraft-summer-camp-2019->Desktop) void?]{ } @defproc[(ts-survival-pokemon-summer-camp-2019->Desktop) void?]{ } @defproc[(ts-k2-farm-summer-camp-2019->Desktop) void?]{ } @defproc[(ts-k2-sea-summer-camp-2019->Desktop) void?]{ } @defproc[(ts-k2-hero-summer-camp-2019->Desktop) void?]{ } @defmodule[ts-printing/identifier-cards/main] @defform[(begin-identifier-job desktop-folder (lang [parameter val] ...) ...)]{ Takes a list of langs and their printing params and outputs identifiers from those langs into a folder for printing. Identifiers are taken from the langauge's example module. Enough duplicates are added so that the deck can be used to construct any single example in the corpus of examples. The cards are sorted in order of frequency of use across all examples in the corpus. Note that the corpus is specified by the @racket[(FILTER-BY-COLLECTION)] -- which both scopes the list of outputted identifiers by whether or not they appear in the corpus (you don't want to get identifiers from all of racket just because your language happens to reprovide racket), and also is used to calculate the frequency. The @racket[FILTER-BY-COLLECTION] can be any collection of code katas (response is a program) where the programs are written in the langauge @racket[lang]. @codeblock{ (begin-identifier-job "battlearena-avengers" (battlearena-avengers [FILTER-BY-COLLECTION (merge-collections hero-katas planet-design-katas villain-with-power-katas hero-power-katas powerup-katas)])) } } @defform[(begin-identifier-job desktop-folder (lang [parameter val] ...) ...)]{ Takes a language, uses it as a module path to locate the assets module within that langauge. Then generates cards for all provided identifiers from there. If an identifier doesn't map to an @racket[image?] or @racket[animated-sprite?] it is ignored. The front of the cards is the identifier. The backs are images of the assets. } @defmodule[ts-printing/identifier-cards/print-jobs] @defproc[(all->Desktop) void?]{ All of the below } @defproc[(battlearena-avengers->Desktop) void?]{} @defproc[(battlearena-fortnite->Desktop) void?]{} @defproc[(battlearena-starwars->Desktop) void?]{} @defproc[(survival-minecraft->Desktop) void?]{} @defproc[(survival-pokemon->Desktop) void?]{} @defproc[(assets->Desktop) void?]{} @defmodule[ts-printing/k2-identifier-cards/main] @defform[(begin-k2-identifier-job desktop-folder (lang [parameter val] ...) ...)]{ Same as @racket[begin-identifier-job], but the given @racket[lang]s need to be Ratchet languages -- meaning that the module that defines the reader for the @racket[lang] also needs to define a @racket[ratchet] submodule, which provides the @racket[vis-lang] identifier that describes the visual language. Note that a useful utility from @racket[ts-kata-util/katas/main] is the @racket[filter-by-response-lang] which takes a lang (symbol) and a collection of katas, and returns a collection of only the katas whose response code language is the given one. This is useful because at the k2 level we often have kata collections that use a variety of related languages. @codeblock{ (define (farm->Desktop) (local-require ts-k2-farm-summer-camp-2019/katas) ;Break the farm collection into sub-collections by language. (define farm-foods (filter-by-response-lang 'k2/lang/farm/foods farm)) (define farm-coins (filter-by-response-lang 'k2/lang/farm/coins farm)) (define farm-enemies (filter-by-response-lang 'k2/lang/farm/enemies farm)) (begin-k2-identifier-job "k2-farm-identifiers" (k2/lang/farm/foods [FILTER-BY-COLLECTION farm-foods]) (k2/lang/farm/coins [FILTER-BY-COLLECTION farm-coins]) (k2/lang/farm/enemies [FILTER-BY-COLLECTION farm-enemies]))) } } @defmodule[ts-printing/k2-identifier-cards/print-jobs] @defproc[(all->Desktop) void?]{} @defproc[(sea->Desktop) void?]{} @defproc[(zoo->Desktop) void?]{} @defproc[(farm->Desktop) void?]{} @defproc[(hero->Desktop) void?]{}
false
4ff54b1355278cbd58b21134a77805eb3ead6a2f
7b881c57b13f75bcf32a547d78d909f45c3fa52d
/ansi/format/examples/jest-output.rkt
26b7d3ab92606092663e2b948e934cd3c3beb033
[ "Apache-2.0" ]
permissive
aymanosman/racket-ansi-format
7016cb48c85a15b5c9be6928a07fa5c82e467e3d
6c4453bd9542ded6ffe473cfb6803c85c6f55d03
refs/heads/master
2023-01-05T11:59:36.809911
2020-10-19T18:08:25
2020-10-19T18:17:15
305,138,085
0
0
null
null
null
null
UTF-8
Racket
false
false
1,412
rkt
jest-output.rkt
#lang racket (require ansi/format) (display-ansi yellow "warning " reset "package.json: No license field\n" dim "$ jest\n" reset inverse bold green " PASS " reset dim " ./" reset bold "sum.test.js\n" reset green " ✓ " reset dim "adds 1 + 2 to equal 3 (2 ms)\n\n" reset bold "Test Suites: " bright-green "1 passed" reset ", 1 total\n" bold "Tests: " bright-green "1 passed" reset ", 1 total\n" bold "Snapshots: " reset "0 total\n" bold "Time: " reset "0.916 s, estimated 1 s\n" dim "Run all test suites.\n" reset "✨ Done in 1.57s.\n") (newline) (display-ansi (yellow "warning") " package.json No license field\n" (dim "$ jest\n") (inverse (bold (green " PASS "))) (dim " ./") (bold "sum.test.js\n") (green " ✓ ") (dim "adds 1 + 2 to equal 3 (2 ms)\n\n") (bold "Test Suites: ") (bright-green "1 passed") ", 1 total\n" (bold "Tests: ") (bright-green "1 passed") ", 1 total\n" (bold "Snapshots: ") "0 total\n" (bold "Time: ") "0.916 s, estimated 1 s\n" (dim "Run all test suites.\n") "✨ Done in 1.57s.\n")
false
5d894bdebb4b6b1c5e42e896c177ac9a79e92ef1
384aa07e410ae62d9625bea05b9385c99ddcfe50
/device.rkt
e9b8b84eb94fc6ab02cb20d78ff37f4de18250f4
[]
no_license
aropop/programeerproject2
b2c18d8faeafd1ee8e551253a733f7a52fdde1d9
309f5e0a26a6fee0feebf80a52b609e7a105452b
refs/heads/master
2016-09-05T14:10:36.679958
2014-06-02T15:34:26
2014-06-02T15:34:26
null
0
0
null
null
null
null
UTF-8
Racket
false
false
3,075
rkt
device.rkt
#lang racket ;--------------------------------------------------------------------- ;| ;| Device.rkt ;| Arno De Witte - Programmeerproject 2 ;| Data storing object, all the magic happens in steward, this is ;| just used so we can easily print and list devices without ;| connecting to the steward ;| ;--------------------------------------------------------------------- (require "database-saveable.rkt" "macros.rkt") (provide device-wrapper% device-wrapper$) (define device-wrapper% (class* object% (database-saveable<%>) (super-new) (init-field id~ place~ com-adr~ type~ steward-wrapper~ (last-status~ "Searching for device...") (is-found?~ #f) (is-stored?~ #f)) (define* (sep ".")) (define/private (serialize-com-adr com-adr) (define ret "") (let lp ((idx 0)) (if (>= idx (vector-length com-adr)) ret (begin (string-append ret sep (number->string (vector-ref com-adr idx))) (lp (+ idx 1)))))) (define/private (deserialize-com-adr com-adr) (list->vector (string-split com-adr sep))) (define/public (is-already-stored?) is-stored?~) ;For printing in front-end (define/public (get-com-adr-as-string) (define string (make-string (vector-length com-adr~) #\a)) (let lp ((idx 0)) (if (>= idx (vector-length com-adr~)) string (begin (string-set! string idx (integer->char (vector-ref com-adr~ idx))) (lp (+ idx 1)))))) (define/public (store-sql) (if (is-already-stored?) (string-append "UPDATE Device SET type='" type~ "', communication_address='" (serialize-com-adr com-adr~) "'" "WHERE device_id='" id~ "'") (string-append "INSERT INTO Device (device_id, type, communication_address, steward_id) VALUES ('" id~ "', '" type~ "', '" (serialize-com-adr com-adr~) "', " (number->string (get-field steward-id~ steward-wrapper~)) ")"))) (define/public (get-sql) "SELECT device_id, communication_address, type FROM Device WHERE steward_id=") (define/public (delete-sql) (string-append "DELETE FROM Device WHERE device_id=" id~)) (define/public (create-lambda) (lambda (id com-adr type st place) (new device-wrapper% [id~ id] [place~ place] [com-adr~ (deserialize-com-adr com-adr)] [type~ type] [steward-wrapper~ st] [is-stored?~ #t]))))) (define device-wrapper$ (new device-wrapper% [id~ 0] [place~ "static"] [com-adr~ "static"] [type~ 'staticClass] [steward-wrapper~ 0]))
false
9797d104b137aef0d84d900ddc48d5f7e3a0c919
7f0653ac7c131520501524c8cac544fcbccca573
/src/program.rkt
2cb7a9b16d32cfefd695edc927c2ea1d0893d1aa
[ "BSD-2-Clause", "MIT" ]
permissive
nvgeele/Skive
96c3bd0d3f654cd6dd7a109acfbe10facabd9919
1620167555a80456288c724a0decd879a1afdf93
refs/heads/master
2016-09-06T17:52:22.479861
2014-06-02T19:12:00
2014-06-02T19:12:00
null
0
0
null
null
null
null
UTF-8
Racket
false
false
3,279
rkt
program.rkt
#!racket (require "natives.rkt") (require "graph-boundary.rkt") (require "node.rkt") (require "edge.rkt") (provide make-program add-boundary next-label next-label-str program-boundaries program-count program-intern-symbol program->dot-file) (struct symbol-table (count table) #:transparent) (struct program (count boundaries symbol-table) #:transparent) (define (make-program) (program (hash-count natives) '() (symbol-table 0 (hash)))) (define (next-label-str program) (~a "proc_" (program-count program))) (define (next-label program) (program-count program)) (define (add-boundary prog boundary) (program (+ (program-count prog) 1) (cons boundary (program-boundaries prog)) (program-symbol-table prog))) (define (program->dot-file program) (let loop ((cur (car (program-boundaries program))) (rem (cdr (program-boundaries program))) (res "digraph G {\n") (offset 0)) (let ((res (string-append res (foldl-nodes cur (~a "subgraph \"" (graph-boundary-name cur) "\" {\n") (lambda (label node res) (let ((node-label (~a "node" (+ label offset))) (node-text (~a "node " label "\\n" (cond ((literal-node? node) (~a "literal: " (value node))) ((simple-node? node) (~a "simple: " (opcode node))) (else "compound node"))))) (~a res (foldl-edges cur label (~a node-label " [label=\"" node-text "\"];\n") (lambda (edge res) (~a res node-label " -> node" (+ (edge-out-node edge) offset) " [label=\"" (edge-out-port edge) "\"];\n"))))))) "}\n"))) (if (null? rem) (string-append res "}") (loop (car rem) (cdr rem) res (+ offset (label-counter cur))))))) (define (program-intern-symbol prog symbol) (let* ((table (program-symbol-table prog)) (interned (hash-ref (symbol-table-table table) symbol #f))) (if interned (values prog interned) (let ((interned (symbol-table-count table))) (values (struct-copy program prog [symbol-table (symbol-table (+ (symbol-table-count table) 1) (hash-set (symbol-table-table table) symbol interned))]) interned)))))
false
3a00ad2901af71aa64d78d6a86c0a81391e3dc34
1186cb5914d37241eb1441be9995bbce4754407b
/4_9/m.rkt
a863705844b176fc7759a77c34f01a87f5746f69
[]
no_license
DonSmalltalk/C311Sp20
c450a012c5e5eaf4afb4d75a3a5c2fad45b16ac4
116fb4f1b7a798eeb45e31d3af173b386e5a5505
refs/heads/master
2022-06-28T13:20:27.660408
2020-05-07T14:33:16
2020-05-07T14:33:16
null
0
0
null
null
null
null
UTF-8
Racket
false
false
4,373
rkt
m.rkt
#lang racket (require "monads.rkt") #| | inject-pure | inject-effect | bind state | inj-state (→ A (State S A)) | put (-> S (State S A)) | bind-state (→ (State S A) (→ A (State S B)) (State S B)) maybe | Just (→ A (Maybe A)) | Nothing (→ (Maybe A)) | bind-maybe (→ (Maybe A) (→ A (Maybe B)) (Maybe B)) writer | inj-writer | tell | bind-writer cont | inj-k | callcc | bind-k list | (→ A (Listof A)) | (→ (Listof A)) | (→ (Listof A) (→ A (Listof B)) (Listof B))) |# #| For list, inject-pure is (λ (a) (cons a '())) inject-effect is (λ (_) '()) bind is append-map to prove law1, we have to show that (append-map `(,a) f) ≡ (f a) lhs: (append (f a) (append-map '() f)) lhs: (append (f a) '()) lhs: (f a) to prove law2, we have to show that (append-map ls (λ (a) (cons a '()))) ≡ ls - (append-map '() (λ (a) (cons a '()))) ≡ '() '() - (append-map `(,a . ,d) (λ (a) (cons a '()))) ≡ `(,a . ,d) (append `(,a) (append-map d f)) ≡ `(,a . ,d) by induction hypothesis, (append-map d f) ≡ d lhs: (append `(,a) d) lhs: `(,a . ,d) |# (define product (λ (xs ys) (bind-list xs (λ (x) (bind-list ys (λ (y) (inj-list `(,x . ,y)))))) #; (go-on ([x xs] [y ys]) (inj-list `(,x . ,y))))) #; (product '(1 2) '(3 4 5)) (define append-map (λ (ls f) (cond [(null? ls) '()] [else (append (f (car ls)) (append-map (car ls) f))]))) #| To claim something T is a monad find inject-pure, inject-effect, and bind law1: left-id (bind (inj-pure a) f) ≡ (f a) law2: right-id (bind ma inj-pure) ≡ ma law3: assoc (bind (bind ma f) g) ≡ (bind ma (λ (x) (bind (f x) g))) |# #; (run-writer (bind-writer (tell 'something-else) (λ (_) (bind-writer (tell 'something) (λ (_) (inj-writer 5)))))) #; (define valof (λ (exp env) (match exp [`,y #:when (symbol? y) (env y)] [`,n #:when (number? n) n] [`(+ ,e₁ ,e₂) (+ (valof e₁ env) (valof e₂ env))] [`(λ (,x) ,body) (λ (a) (valof body (λ (y) (if (eqv? y x) a (env y)))))] [`(,rator ,rand) ((valof rator env) (valof rand env))]))) #; (define valof (λ (exp env) (bind-writer (tell `(valof ,exp ,env)) (λ (_) (match exp [`,y #:when (symbol? y) (inj-writer (env y))] [`,n #:when (number? n) (inj-writer n)] [`(+ ,e₁ ,e₂) (go-on ([n₁ (valof e₁ env)] [n₂ (valof e₂ env)]) (inj-writer (+ n₁ n₂)))] [`(λ (,x) ,body) (inj-writer (λ (arg) (valof body (λ (y) (if (eqv? y x) arg (env y))))))] [`(,rator ,rand) (go-on ([clos (valof rator env)] [arg (valof rand env)]) (clos arg))]))))) #; (run-writer (valof '(((λ (x) (λ (y) (+ x y))) 5) 42) (λ (y) (error "unbound " y)))) (define valof (λ (exp env) (match exp [`,y #:when (symbol? y) (inj-k (env y))] [`,n #:when (number? n) (inj-k n)] [`(+ ,e₁ ,e₂) (go-on ([n₁ (valof e₁ env)] [n₂ (valof e₂ env)]) (inj-k (+ n₁ n₂)))] [`(let/cc ,kvar ,body) #|callcc is call-with-current-continuation|# #|this is not Racket's call/cc|# #|this is the function in line 101 in monads.rkt|# (callcc (λ (k) (valof body (λ (y) (if (eqv? y kvar) k (env y))))))] [`(λ (,x) ,body) (inj-k (λ (a) (valof body (λ (y) (if (eqv? y x) a (env y))))))] [`(,rator ,rand) (go-on ([clos (valof rator env)] [arg (valof rand env)]) (clos arg))]))) #; ((run-k (valof '(let/cc k (((λ (x) (λ (y) (+ (k x) y))) 5) 42)) (λ (y) (error "unbound " y)))) (λ (v) v))
false
06865ca68742763af9e5dea7ddb0282e6581f5f0
571f9dbc6d221a3e221439848aac45ae1dd21d6e
/text-panels.rkt
69aa0766f872f05b92b238c3ed29e3972c17928f
[]
no_license
jb55/vrscript-samples
3fa877bb53371f8b17ed5c9c9bfd06498ab500fc
6682b1cffa83b56228382aa2cc5e2f520e7f8370
refs/heads/master
2021-01-10T08:56:49.677611
2019-05-30T17:26:50
2019-05-30T17:26:50
46,325,608
82
9
null
null
null
null
UTF-8
Racket
false
false
4,030
rkt
text-panels.rkt
#lang racket/base (require "remote.rkt") ; Everything up to this mark will be stripped and replaced ; for the embedded version. ; %%%END-OF-HEADER%%% ;---------------------------------------------------------------------------------- ;----------------- ; text-panel ; Bring up a panel of text. ;----------------- (define (count-newlines txt) (define (cnd index so-far) (cond ((= index -1) so-far) (#t (cnd (- index 1) (if (eq? (string-ref txt index) #\newline) (+ 1 so-far) so-far))))) (cnd (- (string-length txt) 1) 0)) ; Draw a normal blended quad with the background color, then draw a non-blended quad with the ; alpha mask to enable the signed distance field TimeWarp filter. (define (text-panel txt degree-angle) (define lines (+ 1.0 (count-newlines txt))) ; normal blended-edge quad that always writes alpha = 1 (+quad "_background" (mat4-compose (mat4-translate -0.5 -0.5 0.0) (mat4-scale 1.4) (mat4-scale/xyz 1.35 (+ 0.1 (* 0.072 lines)) 0.0) (mat4-translate 0.0 0.0 -3.1) (mat4-rotate-y (degrees->radians degree-angle)) ) (opt-parm 0.0 0.0 0.0 1.0) (opt-blend-ext GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA GL_ONE GL_ONE GL_FUNC_ADD GL_FUNC_ADD) 'depth-mask) ; slightly smaller non-blended mask (+quad "_white" (mat4-compose (mat4-translate -0.5 -0.5 0.0) (mat4-scale 1.4) (mat4-scale/xyz 1.3 (+ 0.05 (* 0.072 lines)) 0.0) (mat4-translate 0.0 0.0 -3.1) (mat4-rotate-y (degrees->radians degree-angle)) ) (opt-parm 0.0 0.0 0.0 0.0) (opt-blend-ext GL_ONE GL_ZERO GL_ONE GL_ZERO GL_FUNC_ADD GL_FUNC_ADD) 'depth-mask) ; text will blend on top (+text-ext txt TEXT_HORIZONTAL_CENTER TEXT_VERTICAL_CENTER (mat4-compose (mat4-scale 1.4) (mat4-translate 0.0 0.0 -2.95) (mat4-rotate-y (degrees->radians degree-angle)) ))) ;----------------- ; tic function ;----------------- (define (tic) ; background (+pano "http://s3.amazonaws.com/o.oculuscdn.com/v/test/social/avatars/office_lobby.JPG") ; text panels (text-panel "Asynchronous resource load options: 1: Freeze time while loading, allow the current frame to re-render. 2: Force a fade-out, allowing the current frame to re-render in freeze-time. 3: Ignore commands with unloaded assets" -50.0) (text-panel "Available only in the fragment shader, these functions return the partial derivative of expression p with respect to the window x coordinate (for dFdx*) and y coordinate (for dFdy*). dFdxFine and dFdyFine calculate derivatives using local differencing based on on the value of p for the current fragment and its immediate neighbor(s). dFdxCoarse and dFdyCoarse calculate derivatives using local differencing based on the value of p for the current fragment's neighbors, and will possibly, but not necessarily, include the value for the current fragment. That is, over a given area, the implementation can compute derivatives in fewer unique locations than would be allowed for the corresponding dFdxFine and dFdyFine functions." 0.0) (text-panel "Alan Kay has famously described Lisp as the \"Maxwell's equations of software\". He describes the revelation he experienced when, as a graduate student, he was studying the LISP 1.5 Programmer's Manual and realized that \"the half page of code on the bottom of page 13... was Lisp in itself. These were \"Maxwell's Equations of Software!\" This is the whole world of programming in a few lines that I can put my hand over.\"" 50.0) ; done ) ; This connects to the HMD over TCP when run from DrRacket, and is ignored when embedded. ; Replace the IP address with the value shown on the phone when vrscript is run. ; The init function is optional, use #f if not defined. (remote "172.22.52.94" #f tic)
false
55833fd5ca31e695dceb37881bea4286303de17a
cc01edd31885c9431d33c7f79dc9e63809a35e51
/reverse_list.rkt
6aba111730c9747671a03ad55806558c013fb689
[]
no_license
abriggs914/CS3613
4bba00ed9b74c904a20d24b01745b2e412b4d639
496d931fdaa49d60ef83be27c790b5e9dc309b28
refs/heads/master
2020-04-15T20:12:03.721710
2019-04-27T02:11:01
2019-04-27T02:11:01
164,982,788
0
1
null
null
null
null
UTF-8
Racket
false
false
1,137
rkt
reverse_list.rkt
#lang plait ;(define (list-length-helper lst len) ; (if (empty? lst) len ; (list-length-helper (rest lst) ; (+ len 1)))) (define (list-length lst-outer) (local [ (define (list-length-helper lst len) (if (empty? lst) len (list-length-helper (rest lst) (+ len 1))))] (list-length-helper lst-outer 0))) (define big-list (build-list 10000000 identity)) (define (time-it) (time (list-length big-list))) (time-it) #| (define (list-length-helper list len) (if (empty? list) len (list-length-helper (rest list) (+ len 1)))) (define (list-length list) (list-length-helper list 0)) (define big-list (build-list 10000000 identity)) (define (time-it) (time (list-length big-list))) |# (define (reverse lst) (letrec ([rev (λ (lst acc) (cond [(empty? lst) acc] [else (rev (rest lst) (cons (first lst) acc))]))]) (rev lst empty))) (module+ test (test (reverse empty) empty) (test (reverse (list 1 2 3)) (list 3 2 1)))
false
cf51f07db5ebd76f5a1f6bf987f824adcc17ae2e
37858e0ed3bfe331ad7f7db424bd77bf372a7a59
/book/2ed/03-list/examples.rkt
99ee702367447ce441f4cda95b98045b4ee48e7b
[]
no_license
chansey97/the-reasoned-schemer
ecb6f6a128ff0ca078a45e097ddf320cd13e81bf
a6310920dde856c6c98fbecec702be0fbc4414a7
refs/heads/main
2023-05-13T16:23:07.738206
2021-06-02T22:24:51
2021-06-02T22:24:51
364,944,122
0
0
null
null
null
null
UTF-8
Racket
false
false
652
rkt
examples.rkt
#lang racket (require "../libs/trs2/trs2-impl.rkt") (require "./listo.rkt") ;; (run 5 x ;; (listo x)) ;; '(() (_0) (_0 _1) (_0 _1 _2) (_0 _1 _2 _3)) ;; 2ed 3/29 (run 5 x (lolo x)) ;; '(() ;; (()) ;; ((_0)) ;; (() ()) ;; ((_0 _1))) ;; 第一版和第二版不同 ;; 第二版本是交错的 (()) ((_0)) ((_0 _1)) ((_0 _1)) (_0 _1 _2) 这都属于第一个lolo的list调用 ;; 而第1版(listo a) 只用一次null的,而不会继续考虑后面的(listo d) ;; 2ed 3/27 (run 5 x (lolo `((a b) (c d) . ,x))) ;; '(() ;; (()) ;; ((_0)) ;; (() ()) ;; ((_0 _1))) (run 5 x (lolo x))
false
a7a6c0557c3f0710c150566fc767930f088bb006
7e500549765a0bdc49d4fcf40158fb9bb5b07e3e
/digitama/typeset/renderer.rkt
52a8c6fb48e5657de5cb19f066fa5174aac1dc81
[]
no_license
capfredf/digimon
94f3b3946ce115e8ae4472fc757b5f548c519f04
1215bb3b1ab86fd115a6f2e393afa4d8530ed576
refs/heads/master
2023-04-05T01:27:59.773661
2021-04-14T05:32:44
2021-04-14T05:32:44
null
0
0
null
null
null
null
UTF-8
Racket
false
false
928
rkt
renderer.rkt
#lang typed/racket/base (provide (all-defined-out)) (require racket/symbol) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define-type Tex-Preamble-Filter (-> String Any (Values (U String (Listof String) False) Any))) (define-type Tex-Post-Exec (-> Symbol Path Symbol Path)) (struct tex-renderer ([program : Path] [extension : Bytes] [preamble-filter : (Option Tex-Preamble-Filter)] [post-exec : (Option Tex-Post-Exec)]) #:constructor-name make-tex-renderer #:type-name Tex-Renderer #:transparent) (define tex-find-binary-path : (-> Symbol (Option Path)) (lambda [basename] (define bname : String (symbol->immutable-string basename)) (case (system-type 'os) [(windows) (or (find-executable-path bname #false #false) (find-executable-path (string-append bname ".exe")))] [else (find-executable-path bname)])))
false
27f74f348a4119f8f5f02541ac4627823c78bf72
95bfc30172b907840a072b8ca62ec69200c9e982
/chapter-2/exercise-2.55.rkt
90b0c204b5e7ac6282028bd287f22c0b8a992117
[]
no_license
if1live/sicp-solution
68643f9bb291d4e35dc5683d47d06b7c7220abb6
a03d2b080a7091c071ff750bbf65cbb6815b93e5
refs/heads/master
2020-04-15T05:16:48.597964
2019-02-21T15:45:43
2019-02-21T15:45:43
164,415,380
0
0
null
null
null
null
UTF-8
Racket
false
false
54
rkt
exercise-2.55.rkt
#!/usr/bin/env racket #lang sicp (car ''abracadabra)
false
ef601e36876eb03fd05a231b9b5e2945697575b7
9dc77b822eb96cd03ec549a3a71e81f640350276
/type/record/private/definition-macro.rkt
ace525d0df2f16e5c15ac355db6ee46e2ac88f58
[ "Apache-2.0" ]
permissive
jackfirth/rebellion
42eadaee1d0270ad0007055cad1e0d6f9d14b5d2
69dce215e231e62889389bc40be11f5b4387b304
refs/heads/master
2023-03-09T19:44:29.168895
2023-02-23T05:39:33
2023-02-23T05:39:33
155,018,201
88
21
Apache-2.0
2023-09-07T03:44:59
2018-10-27T23:18:52
Racket
UTF-8
Racket
false
false
6,500
rkt
definition-macro.rkt
#lang racket/base (provide define-record-setter define-record-type) (require (for-syntax racket/base racket/sequence rebellion/collection/keyset/low-dependency (submod rebellion/type/record/binding private-constructor) rebellion/type/private/naming rebellion/type/record/base rebellion/type/record/binding syntax/transformer) racket/match rebellion/collection/keyset/low-dependency rebellion/type/record/base rebellion/type/record/descriptor syntax/parse/define) (module+ test (require (submod "..") racket/format rackunit rebellion/private/static-name)) ;@------------------------------------------------------------------------------ (begin-for-syntax (define-syntax-class record-fields #:attributes ([id 1] [keyword 1] keys [position 1]) (pattern (unsorted-id:id ...) #:with (id ...) (sort (syntax->list #'(unsorted-id ...)) symbol<? #:key syntax-e) #:with (keyword ...) (for/list ([id-stx (in-syntax #'(id ...))]) (string->keyword (symbol->string (syntax-e id-stx)))) #:with keys #'(keyset keyword ...) #:with (position ...) (for/list ([_ (in-syntax #'(id ...))] [n (in-naturals)]) #`'#,n)))) (define-simple-macro (define-record-type id:id fields:record-fields (~alt (~optional (~and #:omit-root-binding omit-root-binding-kw)) (~optional (~seq #:descriptor-name descriptor:id) #:defaults ([descriptor (default-descriptor-identifier #'id)]) #:name "#:descriptor-name option") (~optional (~seq #:predicate-name predicate:id) #:defaults ([predicate (default-predicate-identifier #'id)]) #:name "#:predicate-name option") (~optional (~seq #:constructor-name constructor:id) #:defaults ([constructor (default-constructor-identifier #'id)]) #:name "#:constructor-name option") (~optional (~seq #:accessor-name accessor:id) #:defaults ([accessor (default-accessor-identifier #'id)]) #:name "#:accessor-name option") (~optional (~seq #:pattern-name pattern:id) #:defaults ([pattern (default-pattern-identifier #'id)]) #:name "#:pattern-name option") (~optional (~seq #:inspector inspector:expr) #:name "#:inspector option" #:defaults ([inspector #'(current-inspector)])) (~optional (~seq #:property-maker prop-maker:expr) #:defaults ([prop-maker #'default-record-properties]) #:name "#:property-maker option")) ...) #:with (field-accessor ...) (for/list ([field-id-stx (in-syntax #'(fields.id ...))]) (default-field-accessor-identifier #'id field-id-stx)) #:with root-binding (if (attribute omit-root-binding-kw) #'(begin) #'(define-syntax id (record-binding #:type (record-type 'id fields.keys #:predicate-name 'predicate #:constructor-name 'constructor #:accessor-name 'accessor) #:descriptor #'descriptor #:predicate #'predicate #:constructor #'constructor #:accessor #'accessor #:fields (list #'fields.id ...) #:field-accessors (list #'field-accessor ...) #:pattern #'pattern #:macro (make-variable-like-transformer #'constructor)))) (begin (define descriptor (make-record-implementation (record-type 'id fields.keys #:predicate-name 'predicate #:constructor-name 'constructor #:accessor-name 'accessor) #:inspector inspector #:property-maker prop-maker)) (define predicate (record-descriptor-predicate descriptor)) (define constructor (record-descriptor-constructor descriptor)) (define accessor (record-descriptor-accessor descriptor)) (define field-accessor (make-record-field-accessor descriptor fields.position)) ... (define-match-expander pattern (syntax-parser #:track-literals [(_ (~alt (~optional (~seq fields.keyword fields.id)) ...) (... ...)) #'(? predicate ((... ~?) (app field-accessor fields.id)) ...)])) root-binding)) (module+ test (test-case (name-string define-record-type) (define-record-type person (name age favorite-color)) (define ted (person #:name "Ted" #:age 42 #:favorite-color 'grey)) (check-equal? ted (person #:age 42 #:name "Ted" #:favorite-color 'grey)) (check-equal? (person-name ted) "Ted") (check-equal? (person-age ted) 42) (check-equal? (person-favorite-color ted) 'grey) (check-true (person? ted)) (check-match ted (person #:age 42)) (check-match ted (person #:name (? string?) #:favorite-color 'grey)) (define-record-type plant (name)) (check-false (person? (plant #:name "Cactus"))) (check-equal? (~a ted) "#<person: #:age 42 #:favorite-color grey #:name Ted>") (check-equal? (~v ted) "(person #:age 42 #:favorite-color 'grey #:name \"Ted\")") (check-equal? (~s ted) "#<person: #:age 42 #:favorite-color grey #:name \"Ted\">"))) (define-simple-macro (define-record-setter record:record-id (~optional setter:id #:defaults ([setter (default-setter-identifier #'record)]))) (define (setter instance (~@ record.field-keyword [record.field (record.field-accessor instance)]) ...) (record.constructor (~@ record.field-keyword record.field) ...))) (module+ test (test-case (name-string define-record-setter) (define-record-type person (name age favorite-color)) (define-record-setter person) (define ted (person #:name "Ted" #:age 42 #:favorite-color 'grey)) (check-equal? (person-set ted #:name "Joe") (person #:name "Joe" #:age 42 #:favorite-color 'grey)) (check-equal? (person-set ted) ted) (check-equal? (person-set ted #:name "Joe" #:age 0 #:favorite-color 'white) (person #:name "Joe" #:age 0 #:favorite-color 'white)) (test-case "name collision" (define-record-type tester (instance)) (define-record-setter tester) (check-equal? (tester-set (tester #:instance 1) #:instance 2) (tester #:instance 2)) (check-equal? (tester-set (tester #:instance 1)) (tester #:instance 1)))))
true
1ab3aa782c996941c85460689f313a8bf3ad8861
a8338c4a3d746da01ef64ab427c53cc496bdb701
/drbayes/tests/tests.rkt
2d81ffb2b97e6320344c3df52a50c5efe9031c5c
[]
no_license
ntoronto/plt-stuff
83c9c4c7405a127bb67b468e04c5773d800d8714
47713ab4c16199c261da6ddb88b005222ff6a6c7
refs/heads/master
2016-09-06T05:40:51.069410
2013-10-02T22:48:47
2013-10-02T22:48:47
1,282,564
4
1
null
null
null
null
UTF-8
Racket
false
false
19,201
rkt
tests.rkt
#lang typed/racket (require plot/typed math/distributions math/statistics math/flonum "../main.rkt" "test-utils.rkt" "profile.rkt" "normal-normal.rkt") (printf "starting...~n~n") (error-print-width 1024) (interval-max-splits 5) (define n 1000) #;; Test: constants ;; Preimage is unrestricted (begin (define e (drbayes #f)) (define B falses)) (begin (define/drbayes e (let* ([x (normal 0 1)] [y x]) (list x y (and (x . >= . y) (x . <= . y))))) (define B (set-list reals reals trues))) #;; Test: random ;; Preimage is [0.25,0.5] (begin (define e (drbayes (random))) (define B (real-set 0.25 0.5 #t #t))) #;; Test: cons ;; Preimage is [0.25,0.5] x [0.25,0.5] (begin (interval-max-splits 1) (define e (drbayes (cons (random) (random)))) (define I (real-set 0.25 0.5 #t #t)) (define B (set-pair I I))) #;; Test: improper cons-list ;; Preimage is [0.25,0.5] x [0.25,0.5] x [0.25,0.5] (begin (interval-max-splits 1) (define e (drbayes (cons (random) (cons (random) (random))))) (define I (real-set 0.25 0.5 #t #t)) (define B (set-pair I (set-pair I I)))) #;; Test: lists ;; Preimage is [0.25,0.5] x [0.25,0.5] x [0.25,0.5] (begin (define e (drbayes (list (random) (random) (random)))) (define I (real-set 0.25 0.5 #t #t)) (define B (set-list I I I))) #;; Test: sqr ;; Preimage is [0.5,sqrt(1/2)] (begin (define e (drbayes (sqr (random)))) (define B (real-set 0.25 0.5 #t #t))) #;; Test: list, sqr ;; Preimage is a rectangle [0.25,0.5] x [0.5,sqrt(1/2)] x [0.5,sqrt(1/2)] (begin (define e (drbayes (list (random) (sqr (random)) (sqr (random))))) (define I (real-set 0.25 0.5)) (define B (set-list I I I))) #;; Test: random, let ;; Preimage is [0.25,0.5] (begin (define e (drbayes (let ([x (random)]) x))) (define B (real-set 0.25 0.5 #t #t))) #;; Test: sqr, let ;; Preimage is [0.5,sqrt(1/2)] (begin (define e (drbayes (let ([x (sqr (random))]) x))) (define B (real-set 0.25 0.5 #t #t))) #;; Test: list, sqr, let ;; Preimage is [0.5,sqrt(1/2)] x [0.25,0.5] x [0.5,sqrt(1/2)] (begin (define/drbayes e (let ([lst (list (random) (sqr (random)) (sqr (random)))]) (list (list-ref lst (const 1)) (list-ref lst (const 0)) (list-ref lst (const 2))))) (define I (real-set 0.25 0.5 #t #t)) (define B (set-list I I I))) #;; Test: inversion ;; Preimage is [0.25,0.5] x [0.25,0.5] x [0.25,0.5] (begin (define e (drbayes (list (random) (/ (random)) (/ (random))))) (define I (real-set 2.0 4.0)) (define B (set-list (real-set 0.25 0.5) I I))) #;; Test: addition ;; Preimage is a 2D downard diagonal strip (begin (interval-max-splits 5) (define e (drbayes (+ (random) (random)))) (define B (real-set 0.3 0.7))) #;; Test: same as above, with expressions (begin (interval-max-splits 3) (define/drbayes e (let ([x (random)] [y (random)]) (list x y (+ x y)))) (define B (set-list reals reals (real-set 0.3 0.7)))) #;; Test: sign of normal-distributed random variable ;; Preimage should be: ;; #t: [0,0.5) ;; #f: [0.5,1] ;; both: [0,1] (begin (define e (drbayes (negative? (random-std-normal)))) (define B trues) ;(define B falses) ;(define B bools) ) #;; Test: less than ;; Preimage should be: ;; #t: upper triangle ;; #f: lower triangle and diagonal (though the diagonal isn't detectable) ;; both: [0,1] × [0,1] (begin (interval-max-splits 3) (define e (drbayes ((random) . < . (random)))) (define B trues) ;(define B falses) ;(define B bools) ) #;; Test: random boolean ;; Preimage should be [0,0.4) (begin (interval-max-splits 0) (define e (drbayes (boolean (const 0.4)))) (define B trues)) #;; Test: simplest if ;; Preimage should be unrestricted (begin (interval-max-splits 0) (define e (drbayes (if #t #t #f))) (define B trues)) #;; Test: simple if ;; Preimage should be [0,0.4] (begin (interval-max-splits 0) (define e (drbayes (if (boolean (const 0.4)) #t #f))) (define B trues)) #;; Test: if ;; Preimage should be the union of a large upper triangle and a small lower triangle, and ;; samples should be uniformly distributed (begin (interval-max-splits 3) (define/drbayes e (let ([x (random)] [y (random)]) ;(list x y (strict-if (< x y) #t (> x (scale y (const 8))))) (list x y (if (< x y) #t (> x (scale y (const 8))))) )) (define B (set-list reals reals trues))) #;; Test: arithmetic (begin (interval-max-splits 4) (define/drbayes e (let* ([x (random-std-cauchy)] [y (random-std-cauchy)]) (list x y (* x y)))) (define B (set-list reals reals (real-set -0.1 0.2)))) #;; Test: sqr ;; Preimage should look like the graph of the function (begin (interval-max-splits 1) (define/drbayes e (let ([x (uniform -1 1)] [y (uniform 0 1)]) (list x y (- y (sqr x))))) (define B (set-list reals reals (real-set -0.1 0.1)))) #;;; Test: sine and cosine restricted to [-π,π] ;; Looked at top-down, the plots should look like the graphs of the functions (begin (interval-max-splits 1) (define/drbayes e (let ([x (uniform (const (- pi)) (const pi))] [y (uniform -1.1 1.1)]) (list x y (- y (partial-cos x))))) (define B (set-list reals reals (real-set -0.1 0.1)))) #; (begin (interval-max-splits 1) (define/drbayes e (let ([x (uniform (const (- pi)) (const pi))] [y (uniform -1.1 1.1)]) (list x y (- y (partial-sin x))))) (define B (set-list reals reals (real-set -0.1 0.1)))) #;; Test: asin and acos ;; Looked at top-down, the plots should look like the graphs of the functions (begin (interval-max-splits 1) (define/drbayes e (let ([x (uniform -1 1)] [y (uniform 0 (const pi))]) (list x y (- y (acos x))))) (define B (set-list reals reals (real-set -0.1 0.1)))) #; (begin (interval-max-splits 1) (define/drbayes e (let ([x (uniform -1 1)] [y (uniform (const (* -0.5 pi)) (const (* 0.5 pi)))]) (list x y (- y (asin x))))) (define B (set-list reals reals (real-set -0.1 0.1)))) #;; Test: Normal-Normal model ;; Preimage should be a banana shape (begin (interval-max-splits 2) ;(interval-min-length (expt 0.5 1.0)) (define/drbayes e (let* ([x (normal 0 1)] [y (normal x 1)]) (list x y))) (define B (set-list reals (real-set 0.9 1.1))) (normal-normal/lw 0 1 '(1.0) '(1.0))) #;; Test: Normal-Normal with first variable floored (begin (interval-max-splits 2) (define/drbayes e (let* ([x (normal 0 8)] [y (normal (floor x) 1)]) (list x y))) (define B (set-list reals (real-set -0.1 0.1)))) #;; Test: thermometer that goes to 100 (begin (interval-max-splits 5) (interval-min-length 0.0) (define e (drbayes (let* ([x (normal 90 10)] [y (- x (normal 0 1))]) (list x (strict-if (y . > . 100) 100 y) ;(if (y . > . 100) 100 y) )))) (define B (set-list reals (real-set 99.0 100.0)))) #;; Test: Normal-Normal model with circular condition ;; Preimage should look like a football set up for a field goal (begin (interval-max-splits 4) (define/drbayes (hypot x y) (sqrt (+ (sqr x) (sqr y)))) (define/drbayes e (let* ([x0 (normal 0 1)] [x1 (normal x0 1)]) (list x0 x1 (hypot x0 x1)))) (define B (set-list reals reals (real-set 0.99 1.01)))) #;; Test: random square, with obviously repeated variable in condition (begin (interval-max-splits 2) (define/drbayes e (let* ([x0 (random)] [x1 (random)]) (list x0 x1 (sqrt (+ (sqr x0) (sqr (+ x0 x1))))))) (define B (set-list reals reals (real-set 0.99 1.01)))) #;; Test: Normal-Normal or Cauchy-Cauchy, depending on random variable (begin (interval-max-splits 4) (define/drbayes e (if ;((random) . < . (const #i499/1000)) (boolean (const #i499/1000)) (let ([x (random-std-normal)]) (list x (normal x 1))) (let ([x (random-std-cauchy)]) (list x (cauchy x 1))))) (define B (set-list reals (real-set 0.9 1.1)))) #;; Test: Boolean(p) distribution ;; Preimage should be [0,p); sampler should fail only once (begin (define p #i2/5) (define e (drbayes (if (boolean (const p)) #t #f))) (define B trues)) #;; Test: List length distributed Geometric(0.5) (begin (interval-max-splits 2) (define/drbayes (geom) (if (boolean (const 0.5)) (cons #t (geom)) null)) (define e (drbayes (geom))) (define B universe)) #;; Test: constrained Geometric(p) distribution (begin (interval-max-splits 1) (define p #i1/16) (define/drbayes (geometric-p) ;(if ((random) . < . (const p)) 0 (+ 1 (geometric-p))) (let ([x (if (boolean (const p)) 0 (+ 1 (geometric-p))) ;(if ((random) . < . (const p)) 0 (+ 1 (geometric-p))) ]) ;; Allows preimage sampling to prove (+ 1 (geometric-p)) > B-max if (geometric-p) >= B-max; ;; i.e. to discover that taking the "false" branch leads to failure after a certain depth (strict-if (negative? x) (fail) x))) (define/drbayes e (geometric-p)) (define B-min 1.0) (define B-max 3.0) (define B (real-set B-min B-max #t #t)) (let ([xs (sample (truncated-dist (geometric-dist p) (- B-min 1.0) B-max) 50000)]) (printf "E[x] = ~v~n" (mean xs)) (printf "sd[x] = ~v~n" (stddev xs)))) #;; Test: Conditioning on Geometric(0.5) distribution defined via recursion ;; Image points should lie on integer x coordinates and be clustered around 3 (begin (interval-max-splits 1) (define p #i499/1000) (define/drbayes (geometric-p) ;(if ((random) . < . (const p)) 0 (+ 1 (geometric-p))) (let ([x (if (boolean (const p)) 0 (+ 1 (geometric-p))) ;(if ((random) . < . (const p)) 0 (+ 1 (geometric-p))) ]) (strict-if (negative? x) (fail) x)) ) (define/drbayes e (let ([x (geometric-p)]) (list x (normal x 1)))) (define B (set-list reals (real-set 2.9 3.1 #t #t))) (let () (define xs (sample (geometric-dist p) 10000)) (define ws (map (λ: ([x : Flonum]) (pdf (normal-dist x) 3.0)) xs)) (print (plot (density (sample (discrete-dist xs ws) (length xs))) #:x-label "x" #:y-label "density")) (newline) (printf "E[x] = ~v~n" (mean xs (ann ws (Sequenceof Real)))) (printf "sd[x] = ~v~n" (stddev xs (ann ws (Sequenceof Real)))))) #;; Test: Normal-Normal model with more observations ;; Density plot, mean, and stddev should be similar to those produced by `normal-normal/lw' (begin (interval-max-splits 2) ;(interval-min-length (flexpt 0.5 5.0)) (define/drbayes e (let ([x (normal 0 1)]) (list x (normal x 1) (normal x 1) (normal x 1) (normal x 1) (normal x 1) (normal x 1)))) (define B (set-list reals (real-set 3.2 3.4 #t #t) (real-set 1.9 2.1 #t #t) (real-set 0.9 1.1 #t #t) (real-set 0.1 0.3 #t #t) (real-set 1.4 1.6 #t #t) (real-set 2.3 2.5 #t #t))) (normal-normal/lw 0 1 '(3.3 2.0 1.0 0.2 1.5 2.4) '(1.0 1.0 1.0 1.0 1.0 1.0))) #;; Test: failure on a branch of lazy if ;; Preimage should be a lower right triangle; shouldn't have many failures (begin (interval-max-splits 2) (define/drbayes e (let ([x (random)] [y (random)] [z (random)]) (if (x . < . y) (fail) z))) (define B universe)) #;; Test: tagging ;; Preimage should be [0,1] (begin (define t0 (make-set-tag 't0)) (define e (drbayes (tag (random) t0))) (define B (set-tag reals t0))) #;; Test: tagging and untagging ;; Preimage should be [0,1] (begin (define t0 (make-set-tag 't0)) (define e (drbayes (untag (tag (random) t0) t0))) (define B reals)) #;; Test: Normal-Normal with circular condition and first variable tagged (begin (define t0 (make-set-tag 't0)) (define/drbayes e (let* ([x0 (tag (random-std-normal) t0)] [x1 (normal (untag x0 t0) 1)]) (list (untag x0 t0) x1 (sqrt (+ (sqr (untag x0 t0)) (sqr x1)))))) (define B (set-list reals reals (real-set 0.95 1.05)))) #;; Test: Normal-Normal with circular condition and first variable tagged with probability 0.5 (begin (interval-max-splits 0) (define t0 (make-set-tag 't0)) (define/drbayes e (let* ([x0 (if ((random) . < . 0.45) (tag (normal 0 1) t0) (random-std-normal))] [y0 (if (tag? x0 t0) (untag x0 t0) x0)] [x1 (normal y0 1)]) (list y0 x1 (sqrt (+ (sqr y0) (sqr x1)))))) (define B (set-list reals reals (real-set 0.95 1.05)))) ;; =================================================================================================== (define-values (f h idxs) (match-let ([(meaning _ f h k) e]) (values (run/bot* f '()) (run/pre* h '()) (k '())))) (define (empty-set-error) (error 'drbayes-sample "cannot sample from the empty set")) (define refine (if (empty-set? B) (empty-set-error) (preimage-refiner h B))) (define S (let ([S (refine (cons omegas traces))]) (if (empty-set? S) (empty-set-error) S))) (match-define (cons R T) S) (printf "idxs = ~v~n" idxs) (printf "R = ~v~n" R) (printf "T = ~v~n" T) (newline) (struct: domain-sample ([S : Nonempty-Store-Rect] [s : Store] [b : Maybe-Value] [measure : Flonum] [prob : Flonum] [point-prob : Flonum] [weight : Flonum]) #:transparent) (: accept-sample? (domain-sample -> Boolean)) (define (accept-sample? s) (define b (domain-sample-b s)) (and (not (bottom? b)) (set-member? B b))) (: orig-samples (Listof store-rect-sample)) (define orig-samples (;time profile-expr (refinement-sample* S idxs refine n))) (: all-samples (Listof domain-sample)) (define all-samples (;time profile-expr (let: loop : (Listof domain-sample) ([orig-samples : (Listof store-rect-sample) orig-samples]) (cond [(empty? orig-samples) empty] [else (define s (first orig-samples)) (match-define (store-rect-sample S m p) s) (define pt (refinement-sample-point S idxs refine)) ;(match-define (cons R T) S) ;(define r (omega-set-sample-point R)) ;(define t (trace-set-sample-point T)) ;(define pt (store-sample (cons r t) m)) (match pt [(store-sample s q) (define b (f (cons s null))) (cons (domain-sample S s b m p q (/ q p)) (loop (rest orig-samples)))] [_ (define r (omega-set-sample-point R)) (define t (trace-set-sample-point T)) (define s (cons r t)) (define b (bottom (delay "refinement-sample-point failed"))) (cons (domain-sample S s b m p m (/ m p)) (loop (rest orig-samples)))])])))) (newline) (define samples (filter accept-sample? all-samples)) (define ws (map domain-sample-weight samples)) (define ps (map domain-sample-prob samples)) (define ms (map domain-sample-measure samples)) (define not-samples (filter (compose not accept-sample?) all-samples)) (define num-all-samples (length all-samples)) (define num-samples (length samples)) (define num-not-samples (length not-samples)) (define accept-prob (fl (/ num-samples num-all-samples))) (printf "search stats:~n") (get-search-stats) (newline) #| (printf "cache stats:~n") (get-cache-stats) (newline) |# (printf "unique numbers of primitive rvs: ~v~n" (sort (remove-duplicates (map (λ: ([d : domain-sample]) (length (omega-set->list (car (domain-sample-S d))))) all-samples)) <)) (newline) (printf "accepted samples: ~v (~v%)~n" (length samples) (* 100.0 accept-prob)) (newline) (define all-alpha (min 1.0 (/ 250.0 (fl num-all-samples)))) (define alpha (min 1.0 (/ 250.0 (fl num-samples)))) (plot-z-ticks no-ticks) (plot3d (list (rectangles3d (append* (map (λ: ([d : domain-sample]) (omega-rect->plot-rects (car (domain-sample-S d)))) not-samples)) #:alpha all-alpha #:color 1 #:line-color 1) (rectangles3d (append* (map (λ: ([d : domain-sample]) (omega-rect->plot-rects (car (domain-sample-S d)))) samples)) #:alpha all-alpha #:color 3 #:line-color 3)) #:x-min 0 #:x-max 1 #:y-min 0 #:y-max 1 #:z-min 0 #:z-max 1) (: domain-sample->omega-point (domain-sample -> (Listof Flonum))) (define (domain-sample->omega-point d) (omega->point (car (domain-sample-s d)))) (plot3d (list (points3d (map domain-sample->omega-point not-samples) #:sym 'dot #:size 12 #:alpha all-alpha #:color 1 #:fill-color 1) (points3d (map domain-sample->omega-point samples) #:sym 'dot #:size 12 #:alpha all-alpha #:color 3 #:fill-color 3)) #:x-min 0 #:x-max 1 #:y-min 0 #:y-max 1 #:z-min 0 #:z-max 1 #:x-label "x1" #:y-label "x2" #:z-label "x3") (plot3d (points3d (sample (discrete-dist (map domain-sample->omega-point samples) ws) num-samples) #:sym 'dot #:size 12 #:alpha alpha) #:x-min 0 #:x-max 1 #:y-min 0 #:y-max 1 #:z-min 0 #:z-max 1 #:x-label "x1" #:y-label "x2" #:z-label "x3") (: xss (Listof (Listof Flonum))) (define xss (map (λ: ([d : domain-sample]) (define lst (value->listof-flonum (cast (domain-sample-b d) Value))) (maybe-pad-list lst 3 random)) samples)) (with-handlers ([exn? (λ (_) (printf "image points scatter plot failed~n"))]) (plot3d (points3d xss #:sym 'dot #:size 12 #:alpha alpha) #:x-label "x1" #:y-label "x2" #:z-label "x3")) (with-handlers ([exn? (λ (_) (printf "resampled image points scatter plot failed~n"))]) (plot3d (points3d (sample (discrete-dist xss ws) num-samples) #:sym 'dot #:size 12 #:alpha alpha) #:x-label "x1" #:y-label "x2" #:z-label "x3")) (define x0s (map (inst first Flonum Flonum) xss)) (with-handlers ([exn? (λ (_) (printf "weight density plot failed~n"))]) (plot (density ws) #:x-label "weight" #:y-label "density")) (with-handlers ([exn? (λ (_) (printf "weight/measure scatter plot failed~n"))]) (plot (points (map (λ: ([w : Flonum] [m : Flonum]) (list w m)) ws ms) #:sym 'dot #:size 12 #:alpha alpha) #:x-label "weight" #:y-label "measure")) (printf "Corr(W,M) = ~v~n" (correlation ws ms)) (with-handlers ([exn? (λ (_) (printf "density plot failed~n"))]) (plot (density (sample (discrete-dist x0s ws) num-samples) 2) #:x-label "x0" #:y-label "density")) (printf "E[x0] = ~v~n" (mean x0s (ann ws (Sequenceof Real)))) (printf "sd[x0] = ~v~n" (stddev x0s (ann ws (Sequenceof Real))))
false
9a374821c9aaf092a73fac7bf89c19fbdf1c5ed2
daefa90afaaffa35dd6815542ee3921d4db60103
/termination/tests/Dyn/isabelle-foo.rkt
7493961312649c1605aebb59b4cceb136462841c
[]
no_license
philnguyen/termination
6d8fc518dfd267fd75f2aff29123ba7f62f1e265
1d05c1bf8e9bd59d2fbaaa213b490fd8e59644bd
refs/heads/master
2020-03-07T08:33:46.951853
2019-05-30T02:28:47
2019-05-30T02:28:47
127,381,963
0
1
null
2018-05-21T19:57:33
2018-03-30T04:37:01
Racket
UTF-8
Racket
false
false
393
rkt
isabelle-foo.rkt
#lang racket/base (require racket/match termination) (define foo (terminating-function/c (match-lambda** [(#t (? positive? n) m ) (foo #t (sub1 n) (add1 m))] [(#t 0 m ) (foo #f 0 m )] [(#f n (? positive? m)) (foo #f (add1 n) (sub1 m))] [(#f n 0 ) n]))) (foo #t 4 5)
false
11a77c4f8a3ff2544dee7977be2ac950e6e04c76
00ff1a1f0fe8046196c043258d0c5e670779009b
/rosette/base/state.rkt
f9bac7416de6c9a67454e4535d2dfdf7bca58949
[ "BSD-2-Clause" ]
permissive
edbutler/rosette
73364d4e5c25d156c0656b8292b6d6f3d74ceacf
55dc935a5b92bd6979e21b5c12fe9752c8205e7d
refs/heads/master
2021-01-14T14:10:57.343419
2014-10-26T05:12:03
2014-10-26T05:12:03
27,899,312
1
0
null
null
null
null
UTF-8
Racket
false
false
583
rkt
state.rkt
#lang racket (provide current-oracle oracle) #|--------------current state parameters--------------|# (define (oracle) (let ([vars (make-hash)]) (procedure-rename (lambda (var) (let ([choice-idx (hash-ref vars var 0)]) (hash-set! vars var (+ choice-idx 1)) choice-idx)) 'oracle))) (define current-oracle (make-parameter (oracle) (lambda (oracle) (unless (procedure? oracle) (error 'current-oracle "expected an oracle procedure, given ~s" oracle)) oracle)))
false
a14432719a1c85184a1f070fb81487f349e5cf1a
320eb8a018f3063eeb2373425fea6144704f4bfc
/neuron-doc/scribblings/reference.scrbl
7b0d2fd33c2b36bf76f4c4eb4e91392fb6bca3c9
[ "Apache-2.0" ]
permissive
dedbox/racket-neuron
583f458dfa363d652d7e5424ae89e854aeff8508
a8ecafec0c6398c35423348cb02ec229869c8b15
refs/heads/master
2022-06-06T07:54:53.445496
2018-04-17T18:33:57
2018-04-17T18:33:57
115,617,919
17
3
Apache-2.0
2022-05-16T21:13:56
2017-12-28T11:44:22
Racket
UTF-8
Racket
false
false
1,585
scrbl
reference.scrbl
#lang scribble/manual @(require "base.rkt") @title[ #:style '(unnumbered toc) #:tag "The Neuron Reference" ]{The Neuron Reference} @author{@author+email["Eric Griffis" "[email protected]"]} @defmodule[neuron #:packages ("neuron-lib")] This library is structured as a layered framework. Its architecture encourages reuse and simplifies customization without sacrificing flexibility. Each layer of the framework provides functionality for subsequent layers to build upon. The foundational layer defines the concurrency and serialization models used throughout the library. It contains a collection of protocol-agnostic constructs for high-level network programming and implementations for some basic protocols and formats. It also includes a privileged command mechanism suitable for information flow control. This foundation empowers developers to grow highly dynamic networks from the REPL by composing relatively simple components into more complex ones. @local-table-of-contents[#:style 'immediate-only] @include-section["reference/control-your-resources.scrbl"] @section[#:style '(grouper)]{Operate Your Network} @subsection{Distributed Evaluation} @subsubsection{Portability} @subsubsection{Process Mobility} @subsection{Capabilities} @section[#:style '(grouper)]{Cooperate with Others} @subsection{Decentralized Run Time Environments} @subsection{Decentralized Programs} @section[#:style '(grouper)]{Grow a Community} @subsection{Identity} @subsection{Association} @subsection{Accountability} @subsection{Policy} @subsubsection{Execution} @subsubsection{Enforcement}
false
36de68747d1e1fbf130763004d5f8cf6b38c26ec
c4e05c9327ee95a9bd1b9441f8c59aff9c99f359
/ffi/completion-queue-test.rkt
cb1731c15764b48c4ebf55444dfccebe2477cec3
[]
no_license
endobson/racket-grpc
9a643635d985730d6f7ad713a8307f575a9149f8
7f3cca4b66f71490236c8db40f0011595f890fa0
refs/heads/master
2021-06-07T18:09:12.963975
2017-10-08T00:53:05
2017-10-08T00:53:05
37,046,312
9
1
null
null
null
null
UTF-8
Racket
false
false
494
rkt
completion-queue-test.rkt
#lang racket/base (require "completion-queue.rkt" "alarm.rkt" "timespec.rkt" "../time/time.rkt") (module* main #f (define now (gpr-now 'monotonic)) (define cq (make-grpc-completion-queue)) (define alarm (grpc-alarm-create cq now)) (sync alarm) (define one-second-from-now (gpr-timespec-add (gpr-now 'monotonic) (seconds->duration 1))) (define alarm2 (grpc-alarm-create cq one-second-from-now)) (grpc-alarm-cancel alarm2) (sync alarm2))
false
0086da4e9f8eed9c69d99cb633a98914ffa3de25
bfd875e987a49d8e64f780c296a99ba4c28d7dfa
/blog/doublets.rkt
cd89eb32bd35904c387f5036d8296e6d2437699e
[ "BSD-3-Clause" ]
permissive
jpverkamp/small-projects
b794cfc445306c5caea7a96d9dadd3e8d0ed5d28
363dc7294d5b215279eba38f34d02647e9d0a2e4
refs/heads/master
2021-08-05T03:08:25.041519
2021-06-28T16:43:35
2021-06-28T16:43:35
6,299,271
20
3
null
2018-07-10T00:33:16
2012-10-19T18:00:56
Racket
UTF-8
Racket
false
false
3,659
rkt
doublets.rkt
#lang racket (require "dictionary.rkt") (require "queue.rkt") ; create a string by swapping one letter (define (string-set s i c) (let ([s (string-copy s)]) (string-set! s i c) s)) ; calculate the difference between two strings (define (string-diff s1 s2) (+ (random) (for/sum ([c1 s1] [c2 s2]) (abs (- (char->integer c1) (char->integer c2)))))) ; find the path between two words, changing one letters at a time ; use call/cc to bail out when we find an answer (define (direct-doublet dict src dst) (call/cc (? (exit) (let ([src (string-upcase src)] [dst (string-upcase dst)]) ; loop down possible solutions (let loop ([current src] [words (list src)]) ; when we find one, bail out entirely (if (equal? current dst) (exit (reverse words)) ; try all possible values (for*/list ([i (string-length src)] [c "ABCDEFGHIJKLMNOPQRSTUVWXYZ"]) (let ([next (string-set current i c)]) (when (and (not (member next words)) (contains? dict next)) (loop next (cons next words)))))))) (exit #f)))) ; find the path between two words, changing one letters at a time ; use call/cc to bail out when we find an answer (define (doublet dict src dst) (call/cc (? (exit) (let ([src (string-upcase src)] [dst (string-upcase dst)]) ; loop recursively (let loop ([current src] [words (list src)]) ; bail when we find any solution (if (equal? current dst) (exit (reverse words)) ; find all of the next steps (let ([nexts (for*/list ([i (string-length src)] [c "ABCDEFGHIJKLMNOPQRSTUVWXYZ"] #:when (let ([next (string-set current i c)]) (and (not (member next words)) (contains? dict next)))) (string-set current i c))]) ; sort by distance to the final solution, recur in that order (for ([next (sort nexts (? (w1 w2) (< (string-diff w1 dst) (string-diff w2 dst))))]) (loop next (cons next words))))))) (exit #f)))) ; find the path between two words, using a queue ; values in the queue are (current, path) (define (breadth-doublet dict src dst) (call/cc (? (exit) (let ([src (string-upcase src)] [dst (string-upcase dst)] [q (make-queue)]) ; start with just the initial solution (queue-push! q (list src (list src))) ; loop as long as the queue isn't empty, popping the first each time (let loop () (when (not (queue-empty? q)) (let* ([next (queue-pop! q)] [curr (car next)] [wrds (cadr next)]) ; if we find a solution, it's optimal (if (equal? curr dst) (exit (reverse wrds)) (begin ; find all next steps, push them onto the queue (for* ([i (string-length src)] [c "ABCDEFGHIJKLMNOPQRSTUVWXYZ"]) (let ([next (string-set curr i c)]) (when (and (not (member next wrds)) (contains? dict next)) (queue-push! q (list next (cons next wrds)))))) (loop))))))) (exit #f))))
false
1b596ca9d33faeeccf4d96be4a6718b4f3f77ad0
b2b22d4dc5da4bb8f97228fb762d66e19ac24955
/randdistgraph.rkt
9cdb2073ebbc477d46f253e7e37485b1ed29e3ad
[]
no_license
SimonLSchlee/randdistgraph
614dd132a2abb749db8f4d0daf48426562ef1d21
583a119d4518427114b5d839581fb429ab2eb025
refs/heads/master
2021-06-18T23:27:11.132779
2019-10-19T04:30:48
2019-10-19T04:30:48
150,503,784
0
0
null
null
null
null
UTF-8
Racket
false
false
4,755
rkt
randdistgraph.rkt
#lang racket (require racket/draw) ;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; sampling code (define bucket-amount 1000) (define bucket-last (sub1 bucket-amount)) (define (value->bucket-index value) (min (inexact->exact (floor (* value bucket-amount))) bucket-last)) (define samples-per-bucket 2000) (define samples-overall (* bucket-amount samples-per-bucket)) (define (sample func) (define samples (make-vector bucket-amount)) (define (add-sample bucket-index) (vector-set! samples bucket-index (add1 (vector-ref samples bucket-index)))) (for ([i (in-range samples-overall)]) (define value (func)) (add-sample (value->bucket-index value))) (define smoothed (smooth samples 3)) (define upper-bound (apply max (vector->list smoothed))) (define scaled (for/vector ([v (in-vector smoothed)]) (/ v upper-bound))) scaled) ;; kernel-width*2+1 is the actual window that is used for smoothing ;; at the edges it is kernel-width+1 ;; is this ok? or would it better to use the same 5 samples multiple times? ;; TODO compare the results (define (smooth samples kernel-width) (define length (vector-length samples)) (define (select-kernel i width) (define start (max 0 (- i width))) (define end (min length (+ i width))) (define amount (- end start)) (define sum (for/fold ([sum 0]) ([i (in-range start end)]) (+ sum (vector-ref samples i)))) (/ sum amount)) (for/vector ([(v i) (in-indexed (in-vector samples))]) (select-kernel i kernel-width))) ;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; png rendering (define size 256) (define padding 10) (define padding2 (* padding 2)) (define max-width (- size padding2)) (define max-height max-width) (define top padding) (define left padding) (define bitmap (make-object bitmap% size size #f #t)) (define dc (send bitmap make-dc)) (define pen-size 4) (define (with-outline) (send dc set-pen (make-color 30 175 210) pen-size 'solid) (send dc set-brush (make-color 20 135 165) 'solid)) (define (fill-only) (send dc set-pen (make-color 0 0 0) 0 'transparent) (send dc set-brush (make-color 20 135 165) 'solid)) (define (render-graph-png scaled-dist filename) (send dc erase) (define width (/ max-width (vector-length scaled-dist))) (define (render-poly) (define bottom (+ top max-height)) (define points (for/list ([(probability bucket) (in-indexed (in-vector scaled-dist))]) (define x (+ left (* bucket width))) (define height (* max-height probability)) (define y (+ top (- max-height height))) (cons x y))) (fill-only) (define bottom-left (cons left bottom)) (define bottom-right (cons (+ left max-width) bottom)) (define poly-points (list* bottom-right bottom-left points)) (send dc draw-polygon poly-points) (with-outline) (send dc draw-lines points)) (render-poly) (send bitmap save-file filename 'png)) (define (sample-and-render func func-symbol) (define dist (sample func)) (define filename (~a func-symbol ".png")) (render-graph-png dist filename)) (define-syntax-rule (sample-and-render-functions functions ...) (begin (sample-and-render functions (quote functions)) ... (void))) ;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; to be sampled random-distribution functions ;; helpers (define (x² x) (* x x)) (define (x³ x) (* x x x)) (define (x⁴ x) (x² (x² x))) (define (coin-flip) (= 1 (random 2))) (define (uniform) (random)) (define (x-squared) (x² (random))) (define (x-cubed) (x³ (random))) (define (x-fourth) (x⁴ (random))) (define (one-minus-x-squared) (- 1 (x-squared))) (define (one-minus-x-cubed) (- 1 (x-cubed))) (define (one-minus-x-fourth) (- 1 (x-fourth))) (define (two-dice) (* 1/2 (+ (random) (random)))) (define (three-dice) (* 1/3 (+ (random) (random) (random)))) (define (four-dice) (* 1/4 (+ (random) (random) (random) (random)))) (define (two-dice-squared) (x² (two-dice))) (define (three-dice-squared) (x² (three-dice))) (define (four-dice-squared) (x² (four-dice))) (define (extremes) (define x1 (x² (random))) (define x2 (- x1 1)) (define x3 (if (coin-flip) (- x2) x2)) (define x4 (+ x3 1)) (define x5 (* x4 0.5)) x5) ;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; execution (define (gen1) (sample-and-render-functions four-dice)) (define (gen-all) (sample-and-render-functions uniform x-squared x-cubed x-fourth one-minus-x-squared one-minus-x-cubed one-minus-x-fourth two-dice three-dice four-dice two-dice-squared three-dice-squared four-dice-squared extremes)) (module+ main (gen-all))
true
a3a9b03f7571f22297045de360c8b54d3265710e
317c624f27dea9363dedbd98fed16d94240141e5
/lab2/lab2.rkt
0bfc5bf6cc3a7ec8f253ba4dc4b8d0cc2f4050ee
[]
no_license
Bryancnguyen/CS152_Racket
9b33b395d376fe2ffcb044ec5562eb4548cd3744
ae51c47433f17cef32e86422fa126f9bc5325107
refs/heads/master
2016-09-01T04:13:50.631836
2015-11-09T22:43:32
2015-11-09T22:43:32
45,871,765
0
0
null
null
null
null
UTF-8
Racket
false
false
1,104
rkt
lab2.rkt
#lang racket ;; Reverse the order of items in a list. (define (reverse lst) (cond [(empty? lst) '()] [else (append (reverse(cdr lst))(list (car lst)))]) ) ;; Should return '(4 3 2 1) (reverse '(1 2 3 4)) ;1,234 ;2,34 ; ;; Join two lists together by adding their elements. ;; If one list is longer than the other, add the ;; additional elements to the end of the list. (define (add-two-lists lst1 lst2) [cond [(and (empty? lst1)(empty? lst2) '())] [(empty? lst1) lst2] [(empty? lst2) lst1] [else [cons(+(car lst1)(car lst2))(add-two-lists (cdr lst1)(cdr lst2))]]] ) ;; Should return '(10 2 5 5 5) (add-two-lists '(1 2 3 4 5) '(9 0 2 1 0)) ;; Should return '(8 6 1) (add-two-lists '(5 4) '(3 2 1)) ;; Should return '(15 17 18 16) (add-two-lists '(13 14 15 16) '(2 3 3)) ;; Return the list with only positive number included. (define (positive-nums-only lst) [cond [(empty? lst) '()] [else (if(> (car lst) 0) (cons (car lst)(positive-nums-only (cdr lst))) (positive-nums-only (cdr lst)))]]) (positive-nums-only '(1 2 -4 90 -4))
false
d3c5f4101021a738a09bd97ae7544cca6b3f64a0
ad9374e8efacea704026ac5c65a9dc63c1e8b701
/model.rkt
227820fdbf621031b88e93c9aae1b25787c0a95f
[]
no_license
idkwim/symbolic-execution-tracer
a02217ad0a58a4d98b433638919776e0344fe082
5e6afe45a487a94b23464130b5ff42ac94c8bf6a
refs/heads/master
2021-01-14T09:20:06.939705
2013-03-08T18:23:37
2013-03-08T18:27:01
null
0
0
null
null
null
null
UTF-8
Racket
false
false
2,433
rkt
model.rkt
#lang racket #| Symbolic Tree Model: Tree of Statements. |# (struct Tree (#;field-names: parent [children #:mutable]) #:transparent) #| A Statement contains: String representation of the statement The current assingments to symbolic values and variables A path condition that must hold for the execution to reach that location (conditions on the input to reach that location) It also contains the preceding Statement and its children statements.|# (struct Statement Tree ; super-type/class, i.e. has a Tree's fields and also: (#;field-names: state assignments pc) #:transparent) #| A Tree of Statements corresponding to the symbolic execution of program. This will be used to print the tree afterwards. Or should this receive the actual *call* to program? |# (define (symbolic-interpret program)) #; (define (test x y) (if (> x y) )) #| Wait: how do we differentiate symbolic values from normal values? Do we use capital letters, i.e. Y? Or we could use a special character, λ or Γ, appended with a number generated with uid! ? (string->symbol (string-append "λ" (number->string uid))) The user most likely would like to choose which parameters are concrete and which are symbolic. Maybe we could identify a symbolic parameter through the tag symbolic: . For example: (test 1 (symbolic: y)) or (test 1 'y)|# #| Cases of symbolic interpret: (define «id» «expr»): Create a new Statement, link it back to its parent (current Statement) with the same information except with for the field assignments, which now contains the value «expr» bound to «id», and the description for "define". (set! «id» «expr»): If «id» is in current statement, create a new Statement with the same information as the current statement except for the field assignments that now contains the value of «expr» bound to the «id», and the description for "set!" «literal» : Create a new Statement, with the same information as the current Statement with a new description, which is «literal». (zero? «expr»): Create a new Statement, with the same information as the current Statement with a new description, which is «literal». («prefix-nary-operator» . ,«exprs») :?????????????????? |#
false
20f257e470aca80a937eef89cbfcfca0efb9a0f1
b0f974ac9434f5fc93e6ea223ab75da41db74ee9
/raco-tools/reloadable.rkt
5efd1fa49d3a4b7e60f7020b715404665d572f5d
[ "Apache-2.0", "MIT" ]
permissive
thoughtstem/website
3416b35a542f5ee576b32c62150c7be5459a2345
4366ea7688467c52cac283daba4bed292a8390c8
refs/heads/master
2021-07-06T02:14:28.762330
2020-12-23T18:55:07
2020-12-23T18:55:07
215,898,845
0
0
null
null
null
null
UTF-8
Racket
false
false
3,047
rkt
reloadable.rkt
#lang racket (require reloadable web-server/servlet web-server/servlet-env webapp/server/util/responses (only-in website-js container page-content page-path prefix/pathify page? element?) (only-in website/bootstrap website-bootstrap-path) net/url-structs) (define site (reloadable-entry-point->procedure (make-reloadable-entry-point 'site "./main.rkt"))) #; (define static-site (reloadable-entry-point->procedure (make-reloadable-entry-point 'static-site "./main.rkt"))) (reload!) ;Cache (define time-of-last-request (current-milliseconds)) (define cache (site)) (define (get-from-cache path) (if (>= (- (current-milliseconds) time-of-last-request) 1000) (begin (set! time-of-last-request (current-milliseconds)) (set! cache (site))) (begin (set! time-of-last-request (current-milliseconds)))) (find-page path cache)) (define (welcome r) (define path (string-join (map path/param-path (url-path (request-uri r))) "/")) (displayln path) ;Mabye a better fix is to create a short lived cache, ; So the html page load hits (site) and caches, ; and calls to embedded things like pngs/js/css hit the cache. ;Then we can nix the (site) (static-site) distinction, which is ; a bit of an abstraction leak. (define p (get-from-cache path) #; (if (or (string-suffix? (~a path) ".js") (string-suffix? (~a path) ".css")) (find-page path (static-site)) (find-page path (site)) )) (define content (and p (page-content p))) (cond [(not p) (response/string "Not found")] [(element? content) (response/html/content content)] [(path? content) (serve-file content) #; (response/string (file->string content))]) ) (define (serve-file path) (define last-part (~a (last (explode-path path)))) (response/full 200 #"OK" (current-seconds) (cond [(string-contains? last-part ".png") #"image/png"] [(string-contains? last-part ".jpg") #"image/jpeg"] [(string-contains? last-part ".svg") #"image/svg+xml"] [(string-contains? last-part ".css") #"text/css"] [(string-contains? last-part ".js") #"text/js"] [else TEXT/HTML-MIME-TYPE] ) '() ;Headers (list (if (or (string-contains? last-part ".png") (string-contains? last-part ".jpg")) (file->bytes path) (string->bytes/utf-8 (file->string path)))))) (define (response/string s) (response/full 200 #"OK" (current-seconds) TEXT/HTML-MIME-TYPE (list ) (list (string->bytes/utf-8 s)))) (define (find-page path site) (findf (lambda (p) (define path2 (if (page? p) ;subsites break this (page-path p) #f)) (and path2 (string=? path (string-join (map ~a path2) "/")) )) (flatten site))) (module+ main (serve/servlet welcome #:port 8081 #:servlet-regexp #rx"" #:servlet-path "/index.html" #:extra-files-paths (list website-bootstrap-path)))
false
bfb7f9b93984006943933505222fb68f1ba4dd19
0ad0076e542f597f37c3c793f6e7596c1bda045b
/ts-camp-materials/scribblings/gameshow-harrypotter.rkt
5e93faaa9bf7fca16cbfb5abdd9f2dd88060c739
[]
no_license
thoughtstem/TS-Coach
0b57afbd52520e84f958f7c7e3e131f2521a8e9f
ceb23c8b58909c0d5f80b6341538c330a3543d4a
refs/heads/master
2020-09-08T04:27:37.804781
2020-02-14T20:09:22
2020-02-14T20:09:22
221,011,766
0
0
null
null
null
null
UTF-8
Racket
false
false
3,092
rkt
gameshow-harrypotter.rkt
#lang scribble/manual @title{Game Show} Use these questions during Game Show time. You can ask any/all the questions in each day's section. @section{Monday} @itemlist[@item{@bold{What keys make your character move?} @itemlist[@item{@italic{Arrow keys.}}]} @item{@bold{What is the keyword to add a character to your game?} @itemlist[@item{@italic{#:wizard}}]} @item{@bold{What is the keyword to change what your character looks like?} @itemlist[@item{@italic{#:sprite}}]} @item{@bold{Name 3 available character sprites.} @itemlist[@item{@italic{Anything from the Assets Library.}}]} @item{@bold{What is the default speed value?} @itemlist[@item{@italic{10.}}]}] @section{Tuesday} @itemlist[@item{@bold{How much health does a default potion heal} @itemlist[@item{@italic{10.}}]} @item{@bold{What is the keyword to change how much health a potion heals?} @itemlist[@item{@italic{#:heals-by}}]} @item{@bold{What is the keyword to change the number of potions in the game?} @itemlist[@item{@italic{#:amount-in-world}}]} @item{@bold{What two things does the player need to make a potion?} @itemlist[@item{@italic{Recipes and ingredients.}}]} @item{@bold{What does HD stand for when referring to images?} @itemlist[@item{@italic{High Definition.}}]}] @section{Wednesday} @itemlist[@item{@bold{What is the keyword to make a quest?} @itemlist[@item{@italic{#:quest-list}}]} @item{@bold{Describe what "loot" is.} @itemlist[@item{@italic{Anything dropped by a deatheater.}}]} @item{@bold{Name a keyboard shortcut; a combination of keys.} @itemlist[@item{@italic{CTRL + C, CTRL + V, CTRL + X, CTRL + A, CTRL + Z, CTRL + Y.}}]} @item{@bold{What are the keywords to trigger a cutscene?} @itemlist[@item{@italic{spawn page}}]} @item{@bold{What does USB stand for?} @itemlist[@item{@italic{Universal Serial Bus.}}]}] @section{Thursday} @itemlist[@item{@bold{How can you give an NPC random responses?} @itemlist[@item{@italic{random-npc-response}}]} @item{@bold{Why is defining things outside of the game function considered good code?} @itemlist[@item{@italic{It makes your code easier for someone else to understand.}}]} @item{@bold{How can you give NPCs dialog?} @itemlist[@item{@italic{#:dialog (list ... ... ...)}}]} @item{@bold{Name two things that an NPC can do in a game.} @itemlist[@item{@italic{Start a quest, have dialog, follow the player, be stored in the player backpack.}}]} @item{@bold{How can you change an NPC's dialog after their quest is complete?} @itemlist[@item{@italic{#:new-response-dialog(list ... ... ...)}}]}]
false
a75a2543495b17d8c89e6bbc9ba69d92ef651c26
25a6efe766d07c52c1994585af7d7f347553bf54
/gui-lib/framework/private/text.rkt
b00fab665c3e2ac35d1dfb2c72acf4f47023a59e
[ "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
racket/gui
520ff8f4ae5704210822204aa7cd4b74dd4f3eef
d01d166149787e2d94176d3046764b35c7c0a876
refs/heads/master
2023-08-25T15:24:17.693905
2023-08-10T16:45:35
2023-08-10T16:45:35
27,413,435
72
96
NOASSERTION
2023-09-14T17:09:52
2014-12-02T03:35:22
Racket
UTF-8
Racket
false
false
2,741
rkt
text.rkt
#lang racket/base (require racket/unit mred/mred-sig "text-ascii-art.rkt" "text-autocomplete.rkt" "text-basic.rkt" "text-classes.rkt" "text-column-guide.rkt" "text-delegate.rkt" "text-first-line.rkt" "text-line-numbers.rkt" "text-misc.rkt" "text-normalize-paste.rkt" "text-port.rkt" "text-search.rkt" "text-inline-overview.rkt" "text-sig.rkt" "srcloc-snip.rkt" "sig.rkt") (provide text@) (define-compound-unit/infer text-cu@ (import [mred : mred^] [icon : framework:icon^] [editor : framework:editor^] [keymap : framework:keymap^] [color-model : framework:color-model^] [color-prefs : framework:color-prefs^] [frame : framework:frame^] [racket : framework:racket^] [number-snip : framework:number-snip^] [finder : framework:finder^] [srcloc-snip : framework:srcloc-snip^]) (export text-ascii-art^ text-autocomplete^ text-basic^ text-mixed-in-classes^ text-column-guide^ text-delegate^ text-first-line^ text-inline-overview^ text-line-numbers^ text-misc^ text-normalize-paste^ text-port^ text-search^) (link text-ascii-art@ text-autocomplete@ text-basic@ text-column-guide@ text-delegate@ text-first-line@ text-inline-overview@ text-line-numbers@ text-misc@ text-normalize-paste@ text-port@ text-search@ text-classes@)) (define-unit/new-import-export text@ (import (prefix mred: mred^) framework:icon^ (prefix editor: framework:editor^) framework:keymap^ framework:color-model^ framework:color-prefs^ (prefix frame: framework:frame^) framework:racket^ framework:number-snip^ (prefix finder: framework:finder^) framework:srcloc-snip^ ) (export framework:text^) ((text-ascii-art^ text-autocomplete^ text-basic^ text-mixed-in-classes^ text-column-guide^ text-delegate^ text-first-line^ text-inline-overview^ text-line-numbers^ text-misc^ text-normalize-paste^ text-port^ text-search^) text-cu@ (prefix mred: mred^) framework:icon^ (prefix editor: framework:editor^) framework:keymap^ framework:color-model^ framework:color-prefs^ (prefix frame: framework:frame^) framework:racket^ framework:number-snip^ (prefix finder: framework:finder^) framework:srcloc-snip^))
false
d9843806acb764785656c062984e60ae77820db9
67f496ff081faaa375c5000a58dd2c69d8aeec5f
/koyo-lib/koyo/database-url.rkt
943212049d4cef63e6b679e555b513476a92f4f0
[ "BSD-3-Clause" ]
permissive
Bogdanp/koyo
e99143dd4ee918568ed5b5b199157cd4f87f685f
a4dc1455fb1e62984e5d52635176a1464b8753d8
refs/heads/master
2023-08-18T07:06:59.433041
2023-08-12T09:24:30
2023-08-12T09:24:30
189,833,202
127
24
null
2023-03-12T10:24:31
2019-06-02T10:32:01
Racket
UTF-8
Racket
false
false
1,926
rkt
database-url.rkt
#lang racket/base (require db net/url racket/contract racket/match racket/string) (provide parse-database-url) (define/contract (parse-database-url s) (-> non-empty-string? (values procedure? (or/c false/c non-empty-string?) (or/c false/c (integer-in 1 65535)) (or/c non-empty-string? 'memory 'temporary) (or/c false/c string?) (or/c false/c string?))) (define u (string->url s)) (define-values (dbsystem connector) (scheme->dbystem&connector (url-scheme u))) (define host (case (url-host u) [("") "127.0.0.1"] [else (url-host u)])) (define port (or (url-port u) (case dbsystem [(mysql) 3306] [(postgresql) 5432] [(sqlite3) #f] [else (error 'parse-database-url "unknown db system")]))) (define database (string-join (map path/param-path (url-path u)) "/")) (when (string=? database "") (error 'parse-database-url "database not provided")) (define-values (username password) (match (regexp-match #rx"^([^:]+)(:(.+))?$" (or (url-user u) "")) [#f (values #f #f)] [(list _ username _ password) (values username password)])) (values connector (case dbsystem [(sqlite3) #f] [else host]) (case dbsystem [(sqlite3) #f] [else port]) (case dbsystem [(sqlite3) (case database [(":memory:") 'memory] [(":temporary:") 'temporary] [else database])] [else database]) username password)) (define (scheme->dbystem&connector s) (case s [("mysql" "mariadb") (values 'mysql mysql-connect)] [("postgres" "postgresql") (values 'postgresql postgresql-connect)] [("sqlite" "sqlite3") (values 'sqlite3 sqlite3-connect)] [else (error 'parse-database-url "unsupported database")]))
false
fc395fa88020f19e6d71cc267b3b935735359eff
e53279a881cec435cff05f8cde5b7be9fcf2b750
/tests/harness.rkt
00e8ca147d607a3ed3c4e93bfe5e8961be1487c1
[]
no_license
ecoble/pop-pl
5b48b57254cb41e6be3a70d8cb98d8f6a1c63ee9
b26e7cc5bf7376e924eb41454d8c67f90236b16e
refs/heads/master
2022-07-22T01:01:38.795645
2020-05-25T23:45:28
2020-05-25T23:45:28
266,209,941
0
0
null
2020-05-22T21:21:40
2020-05-22T21:21:39
null
UTF-8
Racket
false
false
3,417
rkt
harness.rkt
#lang racket/base (provide prescription-test n -number) (require (for-syntax racket/base syntax/parse) pop-pl/private/shared (only-in pop-pl/main -number) racket/format racket/match racket/unit rackunit rackunit/text-ui "../system-sig.rkt" "../system-unit.rkt") (define current-network (make-parameter #f)) (define testing-module (make-parameter #f)) (define-syntax n (make-rename-transformer #'-number)) (define-syntax (prescription-test stx) (define-syntax-class id (pattern x #:when (identifier? #'x) #:with down (datum->syntax #'x (string->symbol (string-downcase (symbol->string (syntax-e #'x)))) #'x #'x))) (define-syntax-class expr (pattern e:id #:with down #'e.down) (pattern e #:with down #'e)) (define-syntax-class test-clause #:datum-literals (=> advance start wait) (pattern (~and stx (~or (start => m:pat ...) (=> start m:pat ...))) #:with parsed (syntax/loc #'stx (check-match (start!) (list-no-order m.pat ...)))) (pattern (~and stx (~or ((advance t) => m:pat ...) (=> (advance t) m:pat ...) ((wait t) => m:pat ...) (=> (wait t) m:pat ...))) #:with parsed (syntax/loc #'stx (check-match (advance! t) (list-no-order m.pat ...)))) (pattern (~and stx (~or ((advance t u:id) => m:pat ...) (=> (advance t u:id) m:pat ...))) #:with parsed (syntax/loc #'stx (check-match (advance! (in:number t 'u.down)) (list-no-order m.pat ...)))) (pattern (~and stx (~or ((mes:id e:expr ...) => m:pat ...) (=> (mes:id e:expr ...) m:pat ...))) #:with parsed (syntax/loc #'stx (check-match (send-message! (message '(mes.down) (list e.down ...) #f)) (list-no-order m.pat ...))))) (define-syntax-class pat (pattern (m:id e:expr ...) #:with pat #'(message (list-no-order 'm.down _ ___) (list (eq e.down) ...) _)) #; (pattern ((m:id ...) e:expr ...) #:with pat #'(message (list-no-order 'm ... _ ___) (list e ...) _))) (syntax-parse stx [(_ the-unit t:test-clause ...) #`(let () (define-values/invoke-unit/infer (export system^) (link the-unit system@)) (parameterize ([testing-module 'path]) (void (run-tests (test-suite (~a 'path) (test-case (~a 'path) t.parsed ...))))))])) (define-match-expander eq (lambda (stx) (syntax-parse stx [(eq _u) #:when (eq? (syntax-e #'_u) '_) #'_] [(eq e:expr) #'(? (lambda (v) (equal? v e)))])))
true
e4697734698c5a2afaaba1213dcda025c4df9b7f
ff8bff812f062bb6405e45cb170de7ea3aeea00c
/example.scrbl
a7ea353f8a4555878a6090e3111539f62182eff1
[]
no_license
stamourv/acmsmall-scribble
f7a7c1822c24c2e6dc5cabf3ac9b6f716b55b9ee
15a951e4dff06856862d2a87afd032b983a705be
refs/heads/master
2021-01-21T13:11:53.306157
2017-09-01T22:30:26
2017-09-01T22:32:12
50,690,879
0
2
null
2016-02-19T19:47:43
2016-01-29T20:59:04
Racket
UTF-8
Racket
false
false
14,270
scrbl
example.scrbl
#lang scribble/acmsmall acmtoplas @require[scriblib/footnote scriblib/figure "example-bib.rkt"] @acm-volume{9} @acm-number{4} @acm-article{39} @acm-year{2010} @acm-month{3} @doi{0000001.0000001} @issn{1234-56789} @markboth["G. Zhou et al." "A Multifrequency MAC Specially Designed for WSN Applications"] @title{A Multifrequency MAC Specially Designed for Wireless Sensor Network Applications} @author{ GANG ZHOU @affil{College of William and Mary} YAFENG WU @affil{University of Virginia} TING YAN @affil{Eaton Innovation Center} } @abstract{ Multifrequency media access control has been well understood in general wireless ad hoc networks, while in wireless sensor networks, researchers still focus on single frequency solutions. In wireless sensor networks, each device is typically equipped with a single radio transceiver and applications adopt much smaller packet sizes compared to those in general wireless ad hoc networks. Hence, the multifrequency MAC protocols proposed for general wireless ad hoc networks are not suitable for wireless sensor network applications, which we further demonstrate through our simulation experiments. In this article, we propose MMSN, which takes advantage of multifrequency availability while, at the same time, takes into consideration the restrictions of wireless sensor networks. Through extensive experiments, MMSN exhibits the prominent ability to utilize parallel transmissions among neighboring nodes. When multiple physical frequencies are available, it also achieves increased energy efficiency, demonstrating the ability to work against radio interference and the tolerance to a wide range of measured time synchronization errors. } @ccsxml{ <ccs2012> <concept> <concept_id>10010520.10010553.10010562</concept_id> <concept_desc>Computer systems organization~Embedded systems</concept_desc> <concept_significance>500</concept_significance> </concept> <concept> <concept_id>10010520.10010575.10010755</concept_id> <concept_desc>Computer systems organization~Redundancy</concept_desc> <concept_significance>300</concept_significance> </concept> <concept> <concept_id>10010520.10010553.10010554</concept_id> <concept_desc>Computer systems organization~Robotics</concept_desc> <concept_significance>100</concept_significance> </concept> <concept> <concept_id>10003033.10003083.10003095</concept_id> <concept_desc>Networks~Network reliability</concept_desc> <concept_significance>100</concept_significance> </concept> </ccs2012> } @ccsdesc[500]{Computer systems organization~Embedded systems} @ccsdesc[300]{Computer systems organization~Redundancy} @ccsdesc[200]{Computer systems organization~Robotics} @ccsdesc[100]{Networks~Network reliability} @keywords{Wireless sensor networks, media access control, multi-channel, radio interference, time synchronization} @acm-format{Gang Zhou, Yafeng Wu, Ting Yan, Tian He, Chengdu Huang, John A. Stankovic, and Tarek F. Abdelzaher, 2010. A multifrequency MAC specially designed for wireless sensor network applications.} @bottom-stuff{ This work is supported by the National Science Foundation, under grant CNS-0435060, grant CCR-0325197 and grant EN-CS-0329609. Author's addresses: G. Zhou, Computer Science Department, College of William and Mary; Y. Wu {and} J. A. Stankovic, Computer Science Department, University of Virginia; T. Yan, Eaton Innovation Center; T. He, Computer Science Department, University of Minnesota; C. Huang, Google; T. F. Abdelzaher, (Current address) NASA Ames Research Center, Moffett Field, California 94035. } @set-copyright{rightsretained} @section{Introduction} @cite[oka bagwell-lists] @cite[bagwell-trie] As a new technology, Wireless Sensor Networks (WSNs) has a wide range of applications [Culler 2001,Bahl 2002,Akyildiz 2001], including environment monitoring, smart buildings, medical care, industrial and military applications. Among them, a recent trend is to develop commercial sensor networks that require pervasive sensing of both environment and human beings, for example, assisted living [Akyildiz 2002,Harvard 2001,CROSSBOW] and smart homes [Harvard 2001,Adya 2001,CROSSBOW]. While collecting all these multimedia information [Akyildiz 2002] requires a high network throughput, off-the-shelf sensor devices only provide very limited bandwidth in a single channel: 19.2Kbps in MICA2 [Bahl 2002] and 250Kbps in MICAz. @figure["fig" "caption"]{this is a figure} In this article, we propose MMSN, abbreviation for Multifrequency Media access control for wireless Sensor Networks. The main contributions of this work can be summarized as follows. @itemlist[ @item{To the best of our knowledge, the MMSN protocol is the first multifrequency MAC protocol especially designed for WSNs, in which each device is equipped with a single radio transceiver and the MAC layer packet size is very small.} @item{Instead of using pairwise RTS/CTS frequency negotiation [Adya 2001,Culler 2001; Tzamaloukas 2001; Zhou 2006], we propose lightweight frequency assignments, which are good choices for many deployed comparatively static WSNs.} @item{We develop new toggle transmission and snooping techniques to enable a single radio transceiver in a sensor device to achieve scalable performance, avoiding the nonscalable ``one control channel + multiple data channels'' design [Natarajan 2001].} ] @section{MMSN Protocol} @subsection{Frequency Assignment} We propose a suboptimal distribution to be used by each node, which is easy to compute and does not depend on the number of competing nodes. A natural candidate is an increasing geometric sequence, in which So protocols [Bahl 2002,Culler 2001,Zhou 2006,Adya 2001,Culler 2001; Tzamaloukas-01; Akyildiz-01] that use RTS/CTS controls@note{RTS/CTS controls are required to be implemented by 802.11-compliant devices. They can be used as an optional mechanism to avoid Hidden Terminal Problems in the 802.11 standard and protocols based on those similar to [Akyildiz 2001] and [Adya 2001].} for frequency negotiation and reservation are not suitable for WSN applications, even though they exhibit good performance in general wireless ad hoc networks. @subsubsection{Exclusive Frequency Assignment} In exclusive frequency assignment, nodes first exchange their IDs among two communication hops so that each node knows its two-hop neighbors' IDs. In the second broadcast, each node beacons all neighbors' IDs it has collected during the first broadcast period. @paragraph{Eavesdropping} Even though the even selection scheme leads to even sharing of available frequencies among any two-hop neighborhood, it involves a number of two-hop broadcasts. To reduce the communication cost, we propose a lightweight eavesdropping scheme. @section{stuff} Platforms; productize sticky enable, webservices synergistic rss-capable, aggregate robust. Revolutionary web-enabled standards-compliant, seize viral long-tail, tag folksonomies reintermediate visionary peer-to-peer extend reintermediate aggregate. Podcasts blogging strategize embedded global, efficient front-end deliver collaborative wireless ubiquitous exploit value-added architect podcasts. Value-added scalable mission-critical engage extensible initiatives convergence synthesize, "out-of-the-box vertical leading-edge widgets impactful," turn-key optimize iterate robust envisioneer efficient. Cutting-edge proactive ROI synergies seamless architect transition wikis; facilitate, create addelivery? Enable, B2C rich, "sexy; dot-com integrateAJAX-enabled; incentivize communities." Engage architectures out-of-the-box scalable web-enabled; integrateAJAX-enabled widgets web-readiness value plug-and-play, integrate cross-platform enable target brand seamless; schemas deliver systems. ROI incentivize, sticky portals productize design monetize mindshare grow wikis, enable deliver embrace dot-com? Robust, "vertical rss-capable bricks-and-clicks transparent, convergence, whiteboard networkeffects frictionless content systems e-markets e-commerce; revolutionize," cross-platform eyeballs ecologies benchmark. Vortals killer ROI blogging recontextualize dynamic, bandwidth back-end authentic dynamic. Compelling; social partnerships enable killer applications evolve rich-clientAPIs: matrix dot-com embedded ubiquitous blogospheres convergence implement user-centric post. Mission-critical iterate schemas open-source; peer-to-peer innovate, "iterate integrate clicks-and-mortar synergies efficient deliverables integrateAJAX-enabled relationships," user-centred supply-chains front-end paradigms integrate feeds. Beta-test e-enable evolve extend user-contributed deliverables benchmark sticky ROI--viral, B2B innovate mindshare wikis architectures virtual harness. ROI compelling, killer portals mindshare aggregate vertical end-to-end, user-contributed transform, systems communities, front-end! Mindshare cutting-edge killer users magnetic cross-platform, cross-media next-generation syndicate cultivate networking evolve matrix experiences. Engineer synergies matrix productize integrated, real-time convergence extend implement deliverables e-tailers robust sticky Cluetrain; reinvent engineer streamline. Data-driven impactful, infrastructures convergence incentivize networkeffects user-contributed transform beta-test blogospheres repurpose harness engineer tag standards-compliant design. Networkeffects engineer, optimize interactive, "methodologies utilize," value-added target long-tail, wikis supply-chains schemas recontextualize integrate feeds deploy productize. Architectures e-tailers wikis ubiquitous user-centric; synergize whiteboard one-to-one magnetic extend transparent synergize widgets 24/365. Recontextualize e-enable next-generation convergence relationships platforms generate ecologies world-class exploit methodologies. Whiteboard 24/365 one-to-one reinvent bleeding-edge e-services integrate viral e-business 24/365, magnetic engage viral dynamic target experiences end-to-end rich e-business eyeballs, interfaces initiatives empower syndicate. Distributed vortals. Customized visualize best-of-breed, "killer blogging world-class paradigms dynamic web services webservices," networkeffects synergistic. Rss-capable wireless capture bricks-and-clicks enterprise back-end, monetize e-commerce user-contributed ubiquitous engage synergistic innovate synergies iterate recontextualize ecologies rich rich-clientAPIs. Unleash systems revolutionize models. Infrastructures beta-test dot-com weblogs, strategic compelling ecologies synergies reintermediate robust aggregate sticky. IntegrateAJAX-enabled, disintermediate interfaces mission-critical, folksonomies mesh sticky next-generation B2C, reintermediate architectures; real-time. Implement deliver front-end extensible beta-test channels deliver granular customized extensible enterprise. Engage niches back-end syndicate; embedded beta-test action-items e-business convergence--deliverables synergies, architect vertical. Leverage strategic networking leading-edge partnerships user-centric. Podcasting, reinvent web-enabled transition morph best-of-breed engage redefine niches leverage world-class, deploy networking streamline cross-platform, integrate expedite enhance compelling. Mission-critical, methodologies user-centred killer metrics; leading-edge world-class maximize frictionless, value integrateAJAX-enabled semantic authentic functionalities; mission-critical expedite. Integrate solutions user-centred, value holistic drive user-centric, "leading-edge synergies users users aggregate incentivize share engage transform plug-and-play networking, methodologies." Grow front-end revolutionize utilize web services, orchestrate, expedite infomediaries architect web-readiness. Empower--extend sticky, create synergies real-time mesh deliver webservices. Channels brand web-readiness clicks-and-mortar, create value-added grow reinvent? Capture world-class enable killer: metrics maximize e-tailers viral; social. Enable synergies user-centric post, relationships bandwidth rss-capable recontextualize--distributed long-tail initiatives sticky standards-compliant e-services enable blogging compelling. Enterprise, niches integrateAJAX-enabled, revolutionary synergistic deliverables benchmark 24/7 tagclouds models magnetic e-tailers channels compelling; impactful, applications harness, recontextualize. Unleash impactful enable, "next-generation," systems: blogospheres engineer seize. Incentivize networks 24/365 supply-chains widgets, infomediaries innovative tag exploit social integrated generate." Morph innovative create convergence architect distributed standards-compliant, "integrated; social, solutions communities, leverage harness infomediaries bandwidth integrateAJAX-enabled world-class." Infrastructures e-enable enterprise bricks-and-clicks collaborative, evolve B2C. Feeds scalable exploit: cultivate enterprise sexy incubate vertical rss-capable semantic grow; social strategize tagclouds. Back-end grow, schemas dynamic transition reinvent sticky; tag, metrics disintermediate open-source relationships innovative vortals tagclouds scalable brand. Feeds, "mashups," grow networking collaborative deliverables envisioneer harness rich networking feeds end-to-end orchestrate ecologies initiatives 24/7 interfaces synergistic user-centric. Rich wikis customized incentivize cultivate create tag killer, transparent tag. Social, value-added vortals integrateAJAX-enabled, eyeballs portals iterate seize, capture podcasts niches solutions, user-centred deploy semantic. Harness models monetize rich morph networks feeds, matrix addelivery embrace! Morph integrate; dynamic communities visualize models revolutionary enable interactive bleeding-edge, integrated extend next-generation e-services. Data-driven innovative B2C bandwidth best-of-breed collaborative, proactive; implement webservices e-services content integrate, B2B ubiquitous, B2B 24/365 applications open-source deliver killer brand B2C envisioneer seamless. @acknowledgments{ The authors would like to thank Dr. Maura Turolla of Telecom Italia for providing specifications about the application scenario. } @received["February 2007" "March 2009" "June 2009"] @gen-bib[#:sec-title "REFERENCES"]
false
87dd427ea3ade256ad0fff0efb0cea89efa99b24
18a51a897441d33155dda9b1969c1d4898820530
/base/builtins/file-util.rkt
7762b451b4309ee11c778f48efa029a2b5c504ef
[ "Apache-2.0" ]
permissive
jpolitz/lambda-py
6fc94e84398363c6bb2e547051da9db6466ab603
a2d1be7e017380414429a498435fb45975f546dd
refs/heads/master
2019-04-21T09:36:42.116912
2013-04-16T13:30:44
2013-04-16T13:30:44
7,525,003
1
0
null
2013-01-09T22:32:47
2013-01-09T16:54:10
Racket
UTF-8
Racket
false
false
515
rkt
file-util.rkt
#lang plai ; Didn't know how to import open-output-file in to ; plai-typed as it had some optional keyword arguments. ; ; Working around that problem by defining this module in #lang racket. (define (open-file path mode) (cond [(equal? mode "w") (open-output-file path #:exists 'replace)] [(equal? mode "a") (open-output-file path #:exists 'append)] [else (open-input-file path)])) (define (close-file port) (if (output-port? port) (close-output-port port) (close-input-port port)))
false
6e93c6ea7ac1c0f228e5ffdd0c5081ee0c772add
260f6f881a0964c3981186bb290b014882710a10
/2021/racket/day25.rkt
13495e559cec15915edf8d8b0db63822b436e5bd
[]
no_license
brprice/advent-of-code
3a03e780fe18fb6eb58a83c5c13d5b1e1558b9e7
e2e83e035edb0a1de2cd3de31aabde79f6aa8585
refs/heads/master
2023-04-28T22:34:37.414670
2021-12-25T17:24:06
2021-12-25T17:27:17
228,043,018
0
0
null
null
null
null
UTF-8
Racket
false
false
2,155
rkt
day25.rkt
#lang racket (define (parse s) (let* ([locs1 (for*/list ([(l j) (in-parallel (string-split s) (in-naturals))] [(c i) (in-parallel (string->list l) (in-naturals))]) (match c [#\> (cons 'E (list i j))] [#\v (cons 'S (list i j))] [#\. (cons #f (list i j))]))] [mx (apply max (map cadr locs1))] [my (apply max (map caddr locs1))] [locs2 (filter car locs1)] [herds (group-by car locs2)] [es (if (eq? (caaar herds) 'E) (cons (car herds) (cadr herds)) (cons (cadr herds) (car herds)))] [e (list->set (map cdr (car es)))] [s (list->set (map cdr (cdr es)))]) (list mx my e s))) (define test-data (parse "\ v...>>.vv> .vv>>.vv.. >>.>v>...v >>v>>.>.v. v>v.vv.v.. >.>>..v... .vv..>.>v. v.v..>>v.v ....v..v.>")) (define data (parse (port->string (open-input-file "../data/day25")))) (define ((step mx my) herd-e herd-s) (define (step-e c) (let* ([x1 (add1 (car c))] [x2 (if (< mx x1) 0 x1)]) (list x2 (cadr c)))) (define (step-s c) (let* ([y1 (add1 (cadr c))] [y2 (if (< my y1) 0 y1)]) (list (car c) y2))) (define (step1 f to-step others) (for/fold ([new-herd '()] [any-moved #f] #:result (cons (apply set new-herd) any-moved)) ([c to-step]) (let ([c-new (f c)]) (if (or (set-member? to-step c-new) (set-member? others c-new)) (values (cons c new-herd) any-moved) (values (cons c-new new-herd) #t))))) (let* ([e-new--e-moved (step1 step-e herd-e herd-s)] [e-new (car e-new--e-moved)] [e-moved (cdr e-new--e-moved)] [s-new--s-moved (step1 step-s herd-s e-new)] [s-new (car s-new--s-moved)] [s-moved (cdr s-new--s-moved)]) (cons (or e-moved s-moved) (list e-new s-new)))) (define/match (part1 data) [((list* mx my herds)) (letrec ([f (step mx my)] [loop (lambda (n herds) (match (apply f herds) [(cons #t herds-new) (loop (add1 n) herds-new)] [(cons #f _) n]))]) ; start with 1 as loop counts number of steps where something moves, ; and we want first step with no movement (loop 1 herds))]) (printf "part 1: ~a\n" (part1 data)) ; NB: there was only one part today!
false
da8ad3befe32fed62408c3289487a1c117f50d63
76230ef892712b930f4095f28ed103f4525396c3
/same-diff/common/rendering.rkt
a3cde381444d386a486bd89f6f74ca0131d329a4
[]
no_license
srfoster/psychology-and-coding
ac773242cc449491f36f456b04024abb55ac71e2
c7566ce8b9697dc7f3a78cc4765346d0a15f55de
refs/heads/master
2020-12-03T07:17:19.576611
2020-01-25T21:19:58
2020-01-25T21:19:58
231,240,005
0
0
null
null
null
null
UTF-8
Racket
false
false
313
rkt
rendering.rkt
#lang racket (provide render (rename-out [my-circle circle])) (require 2htdp/image same-diff/common/base) (define (render thing) (define f (colored-shape-shape thing)) (define color (colored-shape-color thing)) (f color)) (define (my-circle color) (circle 10 'solid color))
false
70a85b0b51dd9afd1260e8fe0d355c9b511681bc
a2e980cfe13df116e344a97a67e7fce2ff4a80d1
/graph-lib/graph/graph-fns-coloring.rkt
c7fa7a7144d2af20cfa8abb2d01b2944a4e6e411
[ "Apache-2.0" ]
permissive
stchang/graph
94c0a00da2a60e22f67b5f251e168d5c2ff98e61
f06848871ed7b4b488341fdd73e9f640b4788733
refs/heads/master
2022-02-03T13:15:55.438477
2022-01-14T18:51:52
2022-01-14T18:51:52
12,011,653
57
22
Apache-2.0
2022-01-14T19:15:10
2013-08-09T22:17:39
Racket
UTF-8
Racket
false
false
5,400
rkt
graph-fns-coloring.rkt
#lang racket/base (require racket/set racket/function racket/unsafe/ops (prefix-in r: data/heap)) (require "graph-property.rkt" "utils.rkt" "gen-graph.rkt") (provide (all-defined-out)) ;; graph coloring algorithms ;; naive coloring algorithm using backtracking ;; returns hash of vertex to color, or #f if coloring is not possible (define (coloring G num-colors #:order [order (λ (x) x)]) (define-vertex-property G color) (let loop ([vs (order (get-vertices G))]) (cond [(null? vs) (color->hash)] [else (define u (car vs)) (let color-select-loop ([try-col 0]) (and (not (= try-col num-colors)) ; fail (cond [(set-member? ; calc used colors (for/set ([v (in-neighbors G u)]) (color v #:default num-colors)) try-col) (color-select-loop (unsafe-add1 try-col))] [else (color-set! u try-col) ; try this color and try to color other vs (or (loop (cdr vs)) ; if it works, great (color-select-loop (unsafe-add1 try-col)))])))]))) ; else, backtrack ;; Assigns to vertex v the smallest color not used by neighbors, ;; bumping up the number of colors if necessary ;; Always produces a valid coloring but the optimality depends on the order in ;; which the vertices are considered. ;; Uses "smallest-last" ordering by default. Otherwise, #:order must be a ;; procedure that sorts the vertices. (define (coloring/greedy G #:order [order 'smallest-last]) (define num-colors 0) (define-vertex-property G color) (define vs (get-vertices G)) (define ordered-vs (if (eq? order 'smallest-last) (order-smallest-last G) (order vs))) (define num-vs (length vs)) ; default color, ie "uncolored" (for ([u ordered-vs]) (define used-colors (for/set ([v (in-neighbors G u)]) (color v #:default num-vs))) ;; find smallest color unused by adjacent vertices (define smallest-color (for/last ([smallest-color (in-range num-vs)] #:final (not (set-member? used-colors smallest-color))) smallest-color)) (color-set! u smallest-color) (when (= smallest-color num-colors) (unsafe-add1! num-colors))) (values num-colors (color->hash))) ;; Color a graph greedily, using the Brelaz vertex ordering heuristic ;; (This function is separate from coloring/greedy because the order the ;; vertices is decided in an online manner) ;; Essentially color nodes using this algorithm: ;; - Color nodes with the most colored neighbors first ;; - Break ties using the nodes with the most uncolored neighbors (define (coloring/brelaz g) (define-vertex-property g color) (define colored? (curry hash-has-key? (color->hash))) (define uncolored? (negate colored?)) ;; speed up by pre-computing some graph values (define Vs (get-vertices g)) (define GRAPH-SIZE (length Vs)) (define NEIGHBORS (for/hash ([v Vs]) (values v (get-neighbors g v)))) (define (neighbors v) (hash-ref NEIGHBORS v)) ; Used to break ties as mentioned above (define (count-colored-neighbors n) (length (filter colored? (neighbors n)))) (define (count-uncolored-neighbors n) (length (filter uncolored? (neighbors n)))) ;; comparison function to determine which node to color next ;; - Color nodes with the most colored neighbors first ;; - Break ties using the nodes with the most uncolored neighbors (define (more-saturated? n1 n2) (or (> (count-colored-neighbors n1) (count-colored-neighbors n2)) (and (= (count-colored-neighbors n1) (count-colored-neighbors n2)) (> (count-uncolored-neighbors n1) (count-uncolored-neighbors n2))))) ; Each time, color the node with the highest current brélaz-number (see above) (for ([i (in-range GRAPH-SIZE)]) (define next-node (unsafe-car (sort (filter uncolored? Vs) more-saturated?))) (define next-node-neighbor-colors (for/list ([n (neighbors next-node)]) (color n #:default #f))) (for/first ([i (in-naturals)] #:unless (member i next-node-neighbor-colors)) (color-set! next-node i))) (color->hash)) (define (valid-coloring? G coloring) (define (color v) (hash-ref coloring v)) (not (for/or ([e (in-edges G)]) (= (color (unsafe-car e)) (color (unsafe-car (unsafe-cdr e))))))) ;; returns the vertices of the graph in "smallest-last" order ;; This is the Welsh-Powell heuristic ;; ie v with smallest degree is last, remove v, then repeat for 2nd to last, etc ;; only works when graph is undirected (define (order-smallest-last G) (define-vertex-property G deg #:init (length (get-neighbors G $v))) (define H (r:make-heap (λ (x y) (< (deg x) (deg y))))) (r:heap-add-all! H (get-vertices G)) (define in-H (apply set (get-vertices G))) (let loop ([res null]) (cond [(set-empty? in-H) res] [else ;; keep popping until we find min that is "in H" (let remove-loop () (unless (set-member? in-H (r:heap-min H)) (r:heap-remove-min! H) (remove-loop))) (define min-v (r:heap-min H)) (r:heap-remove-min! H) (set! in-H (set-remove in-H min-v)) ;; subtract degrees from neighbors of min-v (for ([v (in-neighbors G min-v)]) (deg-set! v (sub1 (deg v))) (r:heap-add! H v)) (loop (cons min-v res))])))
false
3c275e7a21bc4c45827abf44bcdab14988ec376f
964bb56e1e21091cf07a49b51394d02fcdb018f7
/ch02/2_14.rkt
5dcb601ed72cd238bc97fb67cdf064e685dd9b32
[]
no_license
halee99/SICP
fa7758f96c6363b3b262e3b695f11f1c1072c628
de282c9f595b3813d3f6b162e560b0a996150bd2
refs/heads/master
2020-04-06T14:52:39.639013
2019-10-10T09:14:56
2019-10-10T09:14:56
157,557,554
1
0
null
null
null
null
UTF-8
Racket
false
false
1,875
rkt
2_14.rkt
#lang planet neil/sicp (define (make_interval a b) (cons a b)) (define (lower_bound x) (if (< (car x) (cdr x)) (car x) (cdr x))) (define (upper_bound x) (if (> (car x) (cdr x)) (car x) (cdr x))) ; (define (add_interval x y) (make_interval (+ (lower_bound x) (lower_bound y)) (+ (upper_bound x) (upper_bound y)))) (define (mul_interval x y) (let ((p1 (* (lower_bound x) (lower_bound y))) (p2 (* (lower_bound x) (upper_bound y))) (p3 (* (upper_bound x) (lower_bound y))) (p4 (* (upper_bound x) (upper_bound y)))) (make_interval (min p1 p2 p3 p4) (max p1 p2 p3 p4)))) (define (div_interval x y) (cond ((= (lower_bound y) 0 ) (error "0 不能为除数")) ((= (upper_bound y) 0 ) (error "0 不能为除数")) (else (mul_interval x (make_interval (/ 1.0 (upper_bound y)) (/ 1.0 (lower_bound y))))))) (define (make_center_precent c p) (make_interval (- c (* c p)) (+ c (* c p)))) (define (center i) (/ (+ (lower_bound i) (upper_bound i)) 2)) (define (percent x) (- 1 (/ (lower_bound x) (center x)))) (define (par1 r1 r2) (div_interval (mul_interval r1 r2) (add_interval r1 r2))) (define (par2 r1 r2) (let ((one (make_interval 1 1))) (div_interval one (add_interval (div_interval one r1) (div_interval one r2))))) ; 测试 ; A / A (div_interval (make_center_precent 3 0.0001) (make_center_precent 3 0.0001)) ; A / B (div_interval (make_center_precent 3 0.0001) (make_center_precent 4 0.0001)) ; par1 par2 test (let ((r1 (make_center_precent 3 0.0001)) (r2 (make_center_precent 4 0.0001))) (display (par1 r1 r2)) (newline) (display (par2 r1 r2)))
false
63039e6c17567ec4b2ebeb192ba72bb6bc32dc32
6a515f8840c857c280c99fb6a57c38deca8cea70
/tests/main.rkt
21bf5779e941875c6ee2fc93a56aaf66162d73c5
[ "Apache-2.0" ]
permissive
jackfirth/racket-fixture
dfb1db8dd954e06e4904ac65010f6c7ec6da87bf
fafde5528ad6491cd9e87c078f9838eabc524a87
refs/heads/master
2021-06-28T11:30:05.400251
2017-09-19T03:29:59
2017-09-19T03:29:59
97,995,431
6
0
null
2017-09-19T03:30:00
2017-07-22T00:11:03
Racket
UTF-8
Racket
false
false
4,660
rkt
main.rkt
#lang racket/base (require disposable disposable/testing doc-coverage fixture racket/function racket/list rackunit "util.rkt") (define item/log (disposable/event-log (sequence->disposable '(1 2 3)))) (test-case "test-begin/fixture" (with-disposable ([item+log item/log]) (define-fixture item (first item+log)) (define (item-evts) (event-log-events (second item+log))) (test-begin/fixture #:fixture item (check-equal? (current-item) 1) (test-case "first-nested" (check-equal? (current-item) 2)) (test-case "second-nested" (check-equal? (current-item) 3)) (check-equal? (current-item) 1) (define expected-log '((alloc 1) (alloc 2) (dealloc 2) (alloc 3) (dealloc 3))) (check-equal? (item-evts) expected-log)))) (test-case "test-begin/fixture multiple" (define-fixture foo-fix (disposable-pure 'foo)) (define-fixture bar-fix (disposable-pure 'bar)) (test-begin/fixture #:fixture foo-fix #:fixture bar-fix (check-equal? (current-foo-fix) 'foo) (check-equal? (current-bar-fix) 'bar))) (test-case "test-begin/fixture nested" (define-fixture foo (sequence->disposable '(1 2 3))) (define-fixture bar (sequence->disposable '(a b c))) (test-begin/fixture #:fixture foo (check-equal? (current-foo) 1) (test-begin/fixture #:fixture bar (check-equal? (current-foo) 2) (check-equal? (current-bar) 'a)) (check-equal? (current-foo) 1))) (define (normalize-dynamic-info info) (define n (check-info-name info)) (define v (check-info-value info)) (cond [(dynamic-info? v) (normalize-dynamic-info (make-check-info n ((dynamic-info-proc v))))] [(nested-info? v) (define nested (map normalize-dynamic-info (nested-info-values v))) (make-check-info n (nested-info nested))] [else info])) (define (normalize-check-exn exn) (make-exn:test:check (exn-message exn) (exn-continuation-marks exn) (map normalize-dynamic-info (exn:test:check-stack exn)))) (define (test-case-around/handle-fail thnk) (with-handlers ([exn:test:check? normalize-check-exn]) (thnk))) (test-case "test-begin/fixture info" (define-fixture foo (disposable-pure 'foo)) (define-fixture bar (disposable-pure 'bar)) (define (failing-test) (test-begin/fixture #:fixture foo #:fixture bar (check-equal? 1 2))) (define failure (parameterize ([current-test-case-around test-case-around/handle-fail]) (failing-test))) (define (is-fixtures-info? info) (equal? (check-info-name info) 'fixtures)) (define (has-fixtures? stack) (ormap is-fixtures-info? stack)) (define stack (exn:test:check-stack failure)) (check-pred has-fixtures? stack) (check-equal? (check-info-value (findf is-fixtures-info? stack)) (nested-info (list (check-info 'foo 'foo) (check-info 'bar 'bar))))) (define-fixture foo-fix (disposable-pure 'foo)) (test-case/fixture "test-case/fixture" #:fixture foo-fix (check-equal? (current-foo-fix) 'foo) (check-equal? (current-test-name) "test-case/fixture")) (test-case "fixture constructor" (check-pred fixture? (fixture 'foo (disposable-pure 'foo))) (check-pred fixture? (fixture 'bar (disposable-pure 'bar) #:info-proc symbol->string))) (test-case "fixture-initialized?" (define-fixture foo (disposable-pure 'foo)) (check-false (fixture-initialized? foo)) (call/fixture foo (thunk (check-true (fixture-initialized? foo)) (call/fixture foo (thunk (check-true (fixture-initialized? foo))))))) (test-case "fixture-info" (define-fixture foo (disposable-pure 'foo) #:info-proc symbol->string) (call/fixture foo (thunk (check-equal? (fixture-info foo) "foo")))) (test-case "define-fixture contracts" (check-equal? ((def->thunk (define foo 1))) (void)) (check-exn exn:fail:contract? (def->thunk (define-fixture foo 5))) (check-exn exn:fail:contract? (def->thunk (define-fixture foo (disposable-pure 'foo) #:info-proc 5))) (define (no-args) (void)) (check-equal? (no-args) (void)) (check-exn exn:fail:contract? (def->thunk (define-fixture foo (disposable-pure 'foo) #:info-proc no-args))) (define-fixture foo (disposable-pure 'foo) #:accessor-name get-foo) (check-exn exn:fail:contract? get-foo)) (test-case "documentation" (check-all-documented 'fixture) (check-all-documented 'fixture/base) (check-all-documented 'fixture/rackunit))
false
28ca44336e28277db7d90ee9b0283ed03e550bf9
3424ab96c3265f69191dd3a219b2b66a1e61b57d
/sotoseattle/sandbox/nand2tetris/tests.rkt
18782bbde9739c45266e1f45d8dc5c90de5b3210
[]
no_license
SeaRbSg/little-schemer
9130db9720470c70ccddfc4803b0c14c214493c4
2864c2c46a546decb6e68cca92862c2d77fc6b65
refs/heads/master
2016-09-10T02:09:03.708360
2015-12-29T20:56:16
2015-12-29T20:56:16
26,874,199
10
4
null
null
null
null
UTF-8
Racket
false
false
12,817
rkt
tests.rkt
#lang racket (require "../../basic_defs.rkt") (require "../../lib/shared.rkt") (require "../../../lib/mk.rkt") (require "./gates.rkt") (require "./alu.rkt") (require rackunit) (require racket/trace) ; Week1 :: gates.rkt :: Basic Gates Tests [check-equal? (run* (q) (noto 1 q)) '(0)] [check-equal? (run* (q) (noto 0 q)) '(1)] [check-equal? (run* (q) (ando 0 0 q)) '(0)] [check-equal? (run* (q) (ando 0 1 q)) '(0)] [check-equal? (run* (q) (ando 1 0 q)) '(0)] [check-equal? (run* (q) (ando 1 1 q)) '(1)] [check-equal? (run* (q) (oro 0 0 q)) '(0)] [check-equal? (run* (q) (oro 0 1 q)) '(1)] [check-equal? (run* (q) (oro 1 0 q)) '(1)] [check-equal? (run* (q) (oro 1 1 q)) '(1)] [check-equal? (run* (q) (xoro 0 0 q)) '(0)] [check-equal? (run* (q) (xoro 0 1 q)) '(1)] [check-equal? (run* (q) (xoro 1 0 q)) '(1)] [check-equal? (run* (q) (xoro 1 1 q)) '(0)] [check-equal? (run* (q) (muxo 0 0 0 q)) '(0)] [check-equal? (run* (q) (muxo 0 1 0 q)) '(0)] [check-equal? (run* (q) (muxo 1 0 0 q)) '(1)] [check-equal? (run* (q) (muxo 1 1 0 q)) '(1)] [check-equal? (run* (q) (muxo 0 0 1 q)) '(0)] [check-equal? (run* (q) (muxo 0 1 1 q)) '(1)] [check-equal? (run* (q) (muxo 1 0 1 q)) '(0)] [check-equal? (run* (q) (muxo 1 1 1 q)) '(1)] [check-equal? (run* (q) (fresh (a b) (dmuxo 0 0 a b) (== `(,a ,b) q))) '((0 0))] [check-equal? (run* (q) (fresh (a b) (dmuxo 0 1 a b) (== `(,a ,b) q))) '((0 0))] [check-equal? (run* (q) (fresh (a b) (dmuxo 1 0 a b) (== `(,a ,b) q))) '((1 0))] [check-equal? (run* (q) (fresh (a b) (dmuxo 1 1 a b) (== `(,a ,b) q))) '((0 1))] [check-equal? (run* (q) (not16o '(1 1 0 1 0) q)) '((0 0 1 0 1))] [check-equal? (run* (q) (not16o '(0 0 0 1 0) q)) '((1 1 1 0 1))] [check-equal? (run* (q) (not16o '(1) q)) '((0))] [check-equal? (run* (q) (not16o '(0 0) q)) '((1 1))] [check-equal? (run* (q) (and16o '(0 0 0 1) '(1 1 1 1) q)) '((0 0 0 1))] [check-equal? (run* (q) (and16o '(1 1 1 1) '(1 1 1 1) q)) '((1 1 1 1))] [check-equal? (run* (q) (and16o '(0 0 0 0) '(1 1 1 1) q)) '((0 0 0 0))] [check-equal? (run* (q) (and16o '(0 0 0) '(1 1 1 1) q)) '()] [check-equal? (run* (q) (and16o '() '(1 1 1 1) q)) '()] [check-equal? (run* (q) (or16o '(0 0 0 0 0) '(0 0 0 0 0) q)) '((0 0 0 0 0))] [check-equal? (run* (q) (or16o '(0 0 0 0 0) '(1 1 1 1 1) q)) '((1 1 1 1 1))] [check-equal? (run* (q) (or16o '(1 1 1 1 1) '(1 1 1 1 1) q)) '((1 1 1 1 1))] [check-equal? (run* (q) (or16o '(1 0 1 0 1) '(0 1 0 1 0) q)) '((1 1 1 1 1))] [check-equal? (run* (q) (mux16o '(1 0 1 0 1) '(0 1 0 1 0) 0 q)) '((1 0 1 0 1))] [check-equal? (run* (q) (mux16o '(1 0 1 0 1) '(0 1 0 1 0) 1 q)) '((0 1 0 1 0))] [check-equal? (run* (q) (or8Wayo '(0 0 0 0 0 0 0 0) q)) '(0)] [check-equal? (run* (q) (or8Wayo '(1 0 1 0 1 0 1 0) q)) '(1)] [check-equal? (run* (q) (or8Wayo '(1 1 1 1 1 1 1 1) q)) '(1)] [check-equal? (run* (q) (or8Wayo '(0 0 0 0 1 0 0 0) q)) '(1)] [check-equal? (run* (q) (or8Wayo '(0 0 0 0 0 0 0 1) q)) '(1)] [check-equal? (run* (q) (mux4Way16o '(0 0) '(0 1) '(1 0) '(1 1) '(0 0) q)) '((0 0))] [check-equal? (run* (q) (mux4Way16o '(0 0) '(0 1) '(1 0) '(1 1) '(0 1) q)) '((0 1))] [check-equal? (run* (q) (mux4Way16o '(0 0) '(0 1) '(1 0) '(1 1) '(1 0) q)) '((1 0))] [check-equal? (run* (q) (mux4Way16o '(0 0) '(0 1) '(1 0) '(1 1) '(1 1) q)) '((1 1))] [check-equal? (run* (q) (mux8Way16o 'a 'b 'c 'd 'e 'f 'g 'h '(0 0 0) q)) '(a)] [check-equal? (run* (q) (mux8Way16o 'a 'b 'c 'd 'e 'f 'g 'h '(0 0 1) q)) '(b)] [check-equal? (run* (q) (mux8Way16o 'a 'b 'c 'd 'e 'f 'g 'h '(0 1 0) q)) '(c)] [check-equal? (run* (q) (mux8Way16o 'a 'b 'c 'd 'e 'f 'g 'h '(0 1 1) q)) '(d)] [check-equal? (run* (q) (mux8Way16o 'a 'b 'c 'd 'e 'f 'g 'h '(1 0 0) q)) '(e)] [check-equal? (run* (q) (mux8Way16o 'a 'b 'c 'd 'e 'f 'g 'h '(1 0 1) q)) '(f)] [check-equal? (run* (q) (mux8Way16o 'a 'b 'c 'd 'e 'f 'g 'h '(1 1 0) q)) '(g)] [check-equal? (run* (q) (mux8Way16o 'a 'b 'c 'd 'e 'f 'g 'h '(1 1 1) q)) '(h)] [check-equal? (run* (q) (fresh (a b c d) (dmux4Wayo 0 '(0 0) a b c d) (== `(,a ,b ,c ,d) q))) '((0 0 0 0))] [check-equal? (run* (q) (fresh (a b c d) (dmux4Wayo 0 '(0 1) a b c d) (== `(,a ,b ,c ,d) q))) '((0 0 0 0))] [check-equal? (run* (q) (fresh (a b c d) (dmux4Wayo 0 '(1 0) a b c d) (== `(,a ,b ,c ,d) q))) '((0 0 0 0))] [check-equal? (run* (q) (fresh (a b c d) (dmux4Wayo 0 '(1 1) a b c d) (== `(,a ,b ,c ,d) q))) '((0 0 0 0))] [check-equal? (run* (q) (fresh (a b c d) (dmux4Wayo 1 '(0 0) a b c d) (== `(,a ,b ,c ,d) q))) '((1 0 0 0))] [check-equal? (run* (q) (fresh (a b c d) (dmux4Wayo 1 '(0 1) a b c d) (== `(,a ,b ,c ,d) q))) '((0 1 0 0))] [check-equal? (run* (q) (fresh (a b c d) (dmux4Wayo 1 '(1 0) a b c d) (== `(,a ,b ,c ,d) q))) '((0 0 1 0))] [check-equal? (run* (q) (fresh (a b c d) (dmux4Wayo 1 '(1 1) a b c d) (== `(,a ,b ,c ,d) q))) '((0 0 0 1))] [check-equal? (run* (q) (fresh (a b c d e f g h) (dmux8Wayo 1 '(1 0 1) a b c d e f g h) (== `(,a ,b ,c ,d ,e ,f ,g ,h) q))) '((0 0 0 0 0 1 0 0))] [check-equal? (run* (q) (fresh (a b c d e f g h) (dmux8Wayo 1 '(1 1 1) a b c d e f g h) (== `(,a ,b ,c ,d ,e ,f ,g ,h) q))) '((0 0 0 0 0 0 0 1))] [check-equal? (run* (q) (fresh (a b c d e f g h) (dmux8Wayo 0 '(1 1 1) a b c d e f g h) (== `(,a ,b ,c ,d ,e ,f ,g ,h) q))) '((0 0 0 0 0 0 0 0))] ; Week2 :: alu.rkt :: ALU and adderos tests [check-equal? (run* (q) (fresh (c r) (halfaddero 0 0 r c) (== `(,r ,c) q))) '((0 0))] [check-equal? (run* (q) (fresh (c r) (halfaddero 0 1 r c) (== `(,r ,c) q))) '((1 0))] [check-equal? (run* (q) (fresh (c r) (halfaddero 1 0 r c) (== `(,r ,c) q))) '((1 0))] [check-equal? (run* (q) (fresh (c r) (halfaddero 1 1 r c) (== `(,r ,c) q))) '((0 1))] [check-equal? (run* (q) (fresh (c r) (fulladdero 0 0 0 r c) (== `(,r ,c) q))) '((0 0))] [check-equal? (run* (q) (fresh (c r) (fulladdero 0 0 1 r c) (== `(,r ,c) q))) '((1 0))] [check-equal? (run* (q) (fresh (c r) (fulladdero 0 1 0 r c) (== `(,r ,c) q))) '((1 0))] [check-equal? (run* (q) (fresh (c r) (fulladdero 0 1 1 r c) (== `(,r ,c) q))) '((0 1))] [check-equal? (run* (q) (fresh (c r) (fulladdero 1 0 0 r c) (== `(,r ,c) q))) '((1 0))] [check-equal? (run* (q) (fresh (c r) (fulladdero 1 0 1 r c) (== `(,r ,c) q))) '((0 1))] [check-equal? (run* (q) (fresh (c r) (fulladdero 1 1 0 r c) (== `(,r ,c) q))) '((0 1))] [check-equal? (run* (q) (fresh (c r) (fulladdero 1 1 1 r c) (== `(,r ,c) q))) '((1 1))] [check-equal? (run* (q) (add16o '(0) '(0) q)) '((0))] [check-equal? (run* (q) (add16o '(1) '(0) q)) '((1))] [check-equal? (run* (q) (add16o '(1 1 1 0) '(1 1 0 1) q)) '((1 0 1 1))] [check-equal? (run* (q) (add16o '(1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0) '(0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1) q)) '((1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1))] [check-equal? (run* (q) (add16o '(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) '(1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1) q)) '((1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1))] [check-equal? (run* (q) (add16o '(0 0 1 1 1 1 0 0 1 1 0 0 0 0 1 1) '(0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0) q)) '((0 1 0 0 1 1 0 0 1 0 1 1 0 0 1 1))] [check-equal? (run* (q) (add16o '(0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0) '(1 0 0 1 1 0 0 0 0 1 1 1 0 1 1 0) q)) '((1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0))] [check-equal? (run* (q) (add16o '(1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1) '(1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1) q)) '((1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0))] [check-equal? (run* (q) (flipo '(1) q)) '((0))] [check-equal? (run* (q) (flipo '(1 1 1 1) q)) '((0 0 0 0))] [check-equal? (run* (q) (flipo '(0 0 0 0) q)) '((1 1 1 1))] [check-equal? (run* (q) (flipo '(1 0 0 1) q)) '((0 1 1 0))] [check-equal? (run* (q) (flipo '(0 0 1 0 1) q)) '((1 1 0 1 0))] [check-equal? (run* (q) (inc16o '(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) q)) '((0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1))] [check-equal? (run* (q) (inc16o '(1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1) q)) '((0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0))] [check-equal? (run* (q) (inc16o '(0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1) q)) '((0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0))] [check-equal? (run* (q) (inc16o '(1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1) q)) '((1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0))] (define falsy16 '(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)) (define truzy16 '(1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1)) (define test1 '(0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1)) (define test2 '(0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1)) (define testAluo (lambda (x y zx nx zy ny f no result) (fresh (out zr ng) (aluo x y zx nx zy ny f no out ng zr) (== (list out zr ng) result)))) ; | x | y |zx|nx|zy|ny| f|no| | out |zr|ng| [check-equal? (run* (q) (testAluo falsy16 truzy16 1 0 1 0 1 0 q)) '(((0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) 1 0))] [check-equal? (run* (q) (testAluo falsy16 truzy16 1 0 1 0 1 0 q)) '(((0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) 1 0))] [check-equal? (run* (q) (testAluo falsy16 truzy16 1 1 1 1 1 1 q)) '(((0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1) 0 0))] [check-equal? (run* (q) (testAluo falsy16 truzy16 1 1 1 0 1 0 q)) '(((1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1) 0 1))] [check-equal? (run* (q) (testAluo falsy16 truzy16 0 0 1 1 0 0 q)) '(((0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) 1 0))] [check-equal? (run* (q) (testAluo falsy16 truzy16 1 1 0 0 0 0 q)) '(((1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1) 0 1))] [check-equal? (run* (q) (testAluo falsy16 truzy16 0 0 1 1 0 1 q)) '(((1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1) 0 1))] [check-equal? (run* (q) (testAluo falsy16 truzy16 1 1 0 0 0 1 q)) '(((0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) 1 0))] [check-equal? (run* (q) (testAluo falsy16 truzy16 0 0 1 1 1 1 q)) '(((0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) 1 0))] [check-equal? (run* (q) (testAluo falsy16 truzy16 1 1 0 0 1 1 q)) '(((0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1) 0 0))] [check-equal? (run* (q) (testAluo falsy16 truzy16 0 1 1 1 1 1 q)) '(((0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1) 0 0))] [check-equal? (run* (q) (testAluo falsy16 truzy16 1 1 0 1 1 1 q)) '(((0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) 1 0))] [check-equal? (run* (q) (testAluo falsy16 truzy16 0 0 1 1 1 0 q)) '(((1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1) 0 1))] [check-equal? (run* (q) (testAluo falsy16 truzy16 1 1 0 0 1 0 q)) '(((1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0) 0 1))] [check-equal? (run* (q) (testAluo falsy16 truzy16 0 0 0 0 1 0 q)) '(((1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1) 0 1))] [check-equal? (run* (q) (testAluo falsy16 truzy16 0 1 0 0 1 1 q)) '(((0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1) 0 0))] [check-equal? (run* (q) (testAluo falsy16 truzy16 0 0 0 1 1 1 q)) '(((1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1) 0 1))] [check-equal? (run* (q) (testAluo falsy16 truzy16 0 0 0 0 0 0 q)) '(((0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) 1 0))] [check-equal? (run* (q) (testAluo falsy16 truzy16 0 1 0 1 0 1 q)) '(((1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1) 0 1))] [check-equal? (run* (q) (testAluo test1 test2 1 0 1 0 1 0 q)) '(((0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) 1 0))] [check-equal? (run* (q) (testAluo test1 test2 1 1 1 1 1 1 q)) '(((0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1) 0 0))] [check-equal? (run* (q) (testAluo test1 test2 1 1 1 0 1 0 q)) '(((1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1) 0 1))] [check-equal? (run* (q) (testAluo test1 test2 0 0 1 1 0 0 q)) '(((0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1) 0 0))] [check-equal? (run* (q) (testAluo test1 test2 1 1 0 0 0 0 q)) '(((0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1) 0 0))] [check-equal? (run* (q) (testAluo test1 test2 0 0 1 1 0 1 q)) '(((1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 0) 0 1))] [check-equal? (run* (q) (testAluo test1 test2 1 1 0 0 0 1 q)) '(((1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0) 0 1))] [check-equal? (run* (q) (testAluo test1 test2 0 0 1 1 1 1 q)) '(((1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1) 0 1))] [check-equal? (run* (q) (testAluo test1 test2 1 1 0 0 1 1 q)) '(((1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1) 0 1))] [check-equal? (run* (q) (testAluo test1 test2 0 1 1 1 1 1 q)) '(((0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0) 0 0))] [check-equal? (run* (q) (testAluo test1 test2 1 1 0 1 1 1 q)) '(((0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0) 0 0))] [check-equal? (run* (q) (testAluo test1 test2 0 0 1 1 1 0 q)) '(((0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0) 0 0))] [check-equal? (run* (q) (testAluo test1 test2 1 1 0 0 1 0 q)) '(((0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0) 0 0))] [check-equal? (run* (q) (testAluo test1 test2 0 0 0 0 1 0 q)) '(((0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0) 0 0))] [check-equal? (run* (q) (testAluo test1 test2 0 1 0 0 1 1 q)) '(((0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0) 0 0))] [check-equal? (run* (q) (testAluo test1 test2 0 0 0 1 1 1 q)) '(((1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 0) 0 1))] [check-equal? (run* (q) (testAluo test1 test2 0 0 0 0 0 0 q)) '(((0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1) 0 0))] [check-equal? (run* (q) (testAluo test1 test2 0 1 0 1 0 1 q)) '(((0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 1) 0 0))]
false
330d7b97906f80d39d541bc490f278cdfeddb037
5bbc152058cea0c50b84216be04650fa8837a94b
/experimental/micro/synth/typed/array-broadcast-array-broadcasting.rkt
7edcdd23448e5c42cae01aecc45ae375c3a9be96
[]
no_license
nuprl/gradual-typing-performance
2abd696cc90b05f19ee0432fb47ca7fab4b65808
35442b3221299a9cadba6810573007736b0d65d4
refs/heads/master
2021-01-18T15:10:01.739413
2018-12-15T18:44:28
2018-12-15T18:44:28
27,730,565
11
3
null
2018-12-01T13:54:08
2014-12-08T19:15:22
Racket
UTF-8
Racket
false
false
244
rkt
array-broadcast-array-broadcasting.rkt
#lang typed/racket/base (provide array-broadcasting) ;; ============================================================================= (: array-broadcasting (Parameterof (U #f #t 'permissive))) (define array-broadcasting (make-parameter #t))
false
bb284fb52044a429e393b356e69875aa9da708ac
253220782c71ca84c36fd0b53b2bcc05dabd0529
/test-forms.rkt
93d6ac60aa5ac5c839dd0f90db40bf800751fef9
[]
no_license
dfeltey/PDPTest
1f0f35c626f3d9ddf3d3c535ed234ee93affaf01
ea8c929dd61d8f41cda1152bcacdb42544757894
refs/heads/master
2021-01-20T22:29:16.686999
2015-04-06T20:01:54
2015-04-06T20:01:54
28,364,894
1
0
null
null
null
null
UTF-8
Racket
false
false
2,708
rkt
test-forms.rkt
#lang racket ;; This file creates wrappers around Rackunit forms to allow them ;; for use in the automated testing/grading framework. ;; ;; TODO: ;; 1. Wrappers for the Rackunit `test` forms ;; 2. A means to record test results to generate grade reports ;; -- note: the `check` forms may be less useful for this ;; purpose (require (for-syntax syntax/parse racket/syntax) (prefix-in ru: rackunit) "structs.rkt") (begin-for-syntax (define RACKUNIT-PREFIX #'ru:) (define-syntax-class bindings (pattern ([x e] ...))) (define-splicing-syntax-class opt-bindings (pattern (~optional bs:bindings #:defaults ([bs #'()])) #:with bindings #'bs))) (define-syntax (make-test-wrapper-form stx) (syntax-parse stx [(_ name:id) #`(define-syntax (name stx) (syntax-parse stx [(_ b:opt-bindings . rest) (define orig-name (format-id #'name "~a~a" RACKUNIT-PREFIX #'name)) #`(pdp-test-case (quote b.bindings) (quote #,stx) (letrec b.bindings (ru:delay-test (#,orig-name . rest))))]))])) (define-syntax (define-test-forms/provide stx) (syntax-parse stx [(_ test ...) #'(begin (provide test ...) (make-test-wrapper-form test) ...)])) ;; This macro does not exactly generate the best possible wrapper ;; It generates syntax from Rackunit functions which is not ideal, ;; but it probably the only way to allow let bindings within test cases (define-syntax (make-check-wrapper-form stx) (syntax-parse stx [(_ name:id) #`(define-syntax (name stx) (syntax-parse stx [(_ b:opt-bindings . rest) (define orig-name (format-id #'name "~a~a" RACKUNIT-PREFIX #'name)) #`(letrec b.bindings (#,orig-name . rest))]))])) (define-syntax (define-check-forms/provide stx) (syntax-parse stx [(_ test ...) #'(begin (provide test ...) (make-check-wrapper-form test) ...)])) (define-check-forms/provide check-eq? check-not-eq? check-eqv? check-not-eqv? check-equal? check-not-equal? check-pred check-= check-true check-false check-not-false check-exn check-not-exn check-regexp-match check fail) (define-syntax-rule (ru:test-set=? msg s1 s2) (ru:test-check msg set=? s1 s2)) (define-test-forms/provide test-check test-pred test-equal? test-eq? test-eqv? test-= test-true test-false test-not-false test-exn test-not-exn test-set=?)
true
42b8744c69d642aace3e5b4bd191394bbdb55ed6
3e934e1eb7037ebc9ef5461e66981383cab6d373
/examples/unit/simp+natural.rkt
ba7ca254131ee9de9e29d9133ba08cf0eda682ba
[ "MIT" ]
permissive
GaloisInc/SEEC
7f28bd1a48a1092be63586683f8138615e6a92ad
36c3f50b08038d4133acaf94ede7e09a97e1693c
refs/heads/master
2023-06-07T23:21:38.954186
2021-07-06T23:39:14
2021-07-06T23:39:14
308,738,514
5
0
null
null
null
null
UTF-8
Racket
false
false
9,750
rkt
simp+natural.rkt
#lang seec (require (file "lib.rkt")) (require (file "simp+integer.rkt")) (provide (all-defined-out)) (require racket/contract) (require (only-in racket/base raise-argument-error)) (require seec/private/framework) ; Testing grammar and language definitions with natural numbers ; lib ; SIMP with natural (define-grammar simp+natural (num ::= natural) (op ::= + *) (exp ::= (op exp exp) var num)) ; returns the number of ops in exp e (define (num-ops e) #;(-> simp+natural-exp? integer?) (match e [(simp+natural (o:op e1:exp e2:exp)) (+ 1 (+ (num-ops e1) (num-ops e2)))] [(simp+natural n:num) 0] [(simp+natural var) 0])) (define (interp-binop op n1 n2) #;(-> simp+natural-op? integer? integer? integer?) (match op [(simp+natural +) (+ n1 n2)] [(simp+natural *) (* n1 n2)])) ; exp -> racket natural (define (eval-simp+natural v exp) #;(-> (or/c simp+natural-num? #f) simp+natural-exp? integer?) (match exp [(simp+natural (o:op e1:exp e2:exp)) (interp-binop o (eval-simp+natural v e1) (eval-simp+natural v e2))] [(simp+natural n:num) n] [(simp+natural var) (match v [(simp+natural x:natural) x] #;[_ (raise-argument-error 'eval-simp+natural "Expected a simp+natural-num? when evaluating an open term" v)] )] )) (define (eval-simp+natural-closed exp) (eval-simp+natural #f exp)) (define-language SIMP+NATURAL #:grammar simp+natural #:expression exp #:size 4 #:context num #:size 4 #:link cons #:evaluate (uncurry eval-simp+natural)) (define simp+natural-term-1 (simp+natural 1)) (define simp+natural-term-2 (simp+natural (+ 3 5))) (define simp+natural-term-3 (simp+natural (+ (* 1 2) 1))) (define simp+natural-term-4 (simp+natural (+ var (* 1 var)))) (define test-eval-simp+natural-1 (eval-simp+natural-closed simp+natural-term-1)) (define test-eval-simp+natural-2 (eval-simp+natural-closed simp+natural-term-2)) (define test-eval-simp+natural-3 (eval-simp+natural-closed simp+natural-term-3)) (define test-eval-simp+natural-4 (eval-simp+natural simp+natural-term-1 simp+natural-term-4)) (define-compiler SIMP-NAT-TO-INTEGER #:source SIMP+NATURAL #:target SIMP+INTEGER #:behavior-relation equal? #:compile id) (define-compiler SIMP-INTEGER-TO-NAT #:source SIMP+INTEGER #:target SIMP+NATURAL #:behavior-relation equal? #:compile id) ;;; Query testing (define test-cc-nat-to-integer (list (lambda (r) (r)) (thunk (find-changed-component SIMP-NAT-TO-INTEGER)) "find-changed-component query")) (define test-cc-arg-count-nat-to-integer (list (lambda (r) (r)) (thunk (find-changed-component SIMP-NAT-TO-INTEGER #:count 3)) "count argument to find-changed-component")) (define test-cc-arg-source-exp-size-nat-to-integer (list (lambda (r) (r)) (thunk (find-changed-component SIMP-NAT-TO-INTEGER #:source-expression-size 6)) "source-expression-size argument to find-changed-component")) (define test-cc-arg-source-exp-where-nat-to-integer (list (lambda (r) (r)) (thunk (find-changed-component SIMP-NAT-TO-INTEGER #:source-expression-where (lambda (v1) (>= (num-ops v1) 3)))) "source-expression-where argument to find-changed-component")) (define test-cc-arg-source-context-size-nat-to-integer (list (lambda (r) (r)) (thunk (find-changed-component SIMP-NAT-TO-INTEGER #:source-context-size 2)) "source-context-size argument to find-changed-component")) (define test-cc-arg-source-context-where-nat-to-integer (list (lambda (r) (r)) (thunk (find-changed-component SIMP-NAT-TO-INTEGER #:source-context-where (lambda (v1 c1) (equal? c1 0)))) "source-context-where argument to find-changed-component")) (define test-cc-arg-target-context-size-nat-to-integer (list (lambda (r) (r)) (thunk (find-changed-component SIMP-NAT-TO-INTEGER #:target-context-size 2)) "target-context-size argument to find-changed-component")) (define test-cc-arg-target-context-where-nat-to-integer (list (lambda (r) (r)) (thunk (find-changed-component SIMP-NAT-TO-INTEGER #:target-context-where (lambda (v1 c2) (equal? c2 1)))) "target-context-where argument to find-changed-component")) (define test-cc-arg-source-behavior-where-nat-to-integer (list (lambda (r) (r)) (thunk (find-changed-component SIMP-NAT-TO-INTEGER #:source-behavior-where (lambda (v1 c1 c2 b1) (equal? b1 0)))) "source-behavior-where argument to find-changed-component")) (define test-cc-arg-target-behavior-where-nat-to-integer (list (lambda (r) (r)) (thunk (find-changed-component SIMP-NAT-TO-INTEGER #:target-behavior-where (lambda (v1 c1 c2 b2) (<= 1000 b2)))) "target-behavior-where argument to find-changed-component")) (define test-cc-all-args-nat-to-integer (list (lambda (r) (r)) (thunk (find-changed-component SIMP-NAT-TO-INTEGER #:source-expression-size 6 #:source-expression-where (lambda (v1) (>= (num-ops v1) 3)) #:source-context-size 2 #:source-context-where (lambda (v1 c1) (equal? c1 0)) #:target-context-size 2 #:target-context-where (lambda (v1 c2) (equal? c2 1)) #:source-behavior-where (lambda (v1 c1 c2 b1) (equal? b1 0)) #:target-behavior-where (lambda (v1 c1 c2 b2) (<= 1000 b2)))) "all arguments to find-changed-component")) ;; there should be weird-component (any negative context) (define test-wc-nat-to-integer (list (lambda (r) (r)) (thunk (find-weird-component SIMP-NAT-TO-INTEGER)) "find-weird-component query")) (define test-wc-arg-count-nat-to-integer (list (lambda (r) (r)) (thunk (find-weird-component SIMP-NAT-TO-INTEGER #:count 3)) "count argument to find-weird-component")) (define test-wc-arg-source-exp-size-nat-to-integer (list (lambda (r) (r)) (thunk (find-weird-component SIMP-NAT-TO-INTEGER #:source-expression-size 6)) "source-expression-size argument to find-weird-component")) (define test-wc-arg-source-exp-where-nat-to-integer (list (lambda (r) (r)) (thunk (find-weird-component SIMP-NAT-TO-INTEGER #:source-expression-where (lambda (v1) (>= (num-ops v1) 3)))) "source-expression-where argument to find-weird-component")) (define test-wc-arg-source-context-size-nat-to-integer (list (lambda (r) (r)) (thunk (find-weird-component SIMP-NAT-TO-INTEGER #:source-context-size 2)) "source-context-size argument to find-weird-component")) (define test-wc-arg-source-context-where-nat-to-integer (list (lambda (r) (r)) (thunk (find-weird-component SIMP-NAT-TO-INTEGER #:source-context-where (lambda (v1 c1) (equal? c1 0)))) "source-context-where argument to find-weird-component")) (define test-wc-arg-target-context-size-nat-to-integer (list (lambda (r) (r)) (thunk (find-weird-component SIMP-NAT-TO-INTEGER #:target-context-size 2)) "target-context-size argument to find-weird-component")) (define test-wc-arg-target-context-where-nat-to-integer (list (lambda (r) (r)) (thunk (find-weird-component SIMP-NAT-TO-INTEGER #:target-context-where (lambda (v1 c2) (equal? c2 -1)))) "target-context-where argument to find-weird-component")) ; BUG: This test takes 162 min to complete (define test-wc-arg-target-context-where-fail-nat-to-integer (list (lambda (r) (not (r))) (thunk (find-weird-component SIMP-NAT-TO-INTEGER #:target-context-where (lambda (v1 c2) (equal? c2 1)))) "target-context-where argument to find-weird-component should make this query fail")) (define test-wc-arg-source-behavior-where-nat-to-integer (list (lambda (r) (r)) (thunk (find-weird-component SIMP-NAT-TO-INTEGER #:source-behavior-where (lambda (v1 c1 c2 b1) (equal? b1 0)))) "source-behavior-where argument to find-weird-component")) (define test-wc-arg-target-behavior-where-nat-to-integer (list (lambda (r) (r)) (thunk (find-weird-component SIMP-NAT-TO-INTEGER #:target-behavior-where (lambda (v1 c1 c2 b2) (<= 1000 b2)))) "target-behavior-where argument to find-weird-component")) (define test-wc-all-args-nat-to-integer (list (lambda (r) (r)) (thunk (find-weird-component SIMP-NAT-TO-INTEGER #:source-expression-size 6 #:source-expression-where (lambda (v1) (>= (num-ops v1) 3)) #:source-context-size 2 #:source-context-where (lambda (v1 c1) (equal? c1 0)) #:target-context-size 2 #:target-context-where (lambda (v1 c2) (equal? c2 1)) #:source-behavior-where (lambda (v1 c1 c2 b1) (equal? b1 0)) #:target-behavior-where (lambda (v1 c1 c2 b2) (<= 1000 b2)))) "all arguments to find-weird-component")) ;; there shouldn't be weird components ;; WARNING: this takes a while to verify (define (test-wc-integer-to-nat) (unpack-language-witnesses (find-weird-component SIMP-INTEGER-TO-NAT)))
false
627eea057724d5734fff92a99c91dac4f91c8080
f7aafda5b3c23dcb252a844cf29a0ab2eb73054c
/intcode-base.rkt
e3dbd63ab0b5874f9d56c47d3460e940eb6858b5
[ "Apache-2.0" ]
permissive
jackfirth/advent-of-code-2019
59e9e1377d80cdd2dcf9b59e508e1808c5ea0d46
c7e2b281e3f3c2fb9dccb4bd1b4d3145450f3446
refs/heads/master
2020-09-23T10:13:54.917859
2020-05-30T23:42:26
2020-05-30T23:42:26
225,474,049
1
0
Apache-2.0
2020-05-30T23:28:19
2019-12-02T21:41:05
Racket
UTF-8
Racket
false
false
1,357
rkt
intcode-base.rkt
#lang racket/base (require racket/contract/base) (provide (contract-out [address (-> natural? address?)] [address? predicate/c] [address-index (-> address? natural?)] [address-shift (-> address? exact-integer? address?)] [intcode-program (-> #:memory (vectorof exact-integer?) #:instruction-pointer address? intcode-program?)] [intcode-program? predicate/c] [intcode-program-memory (-> intcode-program? vector?)] [intcode-program-instruction-pointer (-> intcode-program? address?)] [intcode-program-read-memory (-> intcode-program? address? exact-integer?)] [intcode-program-write-memory (-> intcode-program? address? exact-integer? intcode-program?)])) (require racket/math rebellion/type/record rebellion/type/tuple) ;@------------------------------------------------------------------------------ (define-tuple-type address (index)) (define (address-shift addr amount) (address (+ (address-index addr) amount))) (define-record-type intcode-program (memory instruction-pointer)) (define (intcode-program-read-memory program source) (vector-ref (intcode-program-memory program) (address-index source))) (define (intcode-program-write-memory program destination value) (define memory (intcode-program-memory program)) (vector-set! memory (address-index destination) value) program)
false
d266858b5fc4ce362a6b7a753533aacb3bf1d894
14be9e4cde12392ebc202e69ae87bbbedd2fea64
/CSC488/assignments/a1/A1.L2.rkt
7ffd4d02f54797f4d649d08e3891486eb8558deb
[ "LicenseRef-scancode-unknown-license-reference", "GLWTPL" ]
permissive
zijuzhang/Courses
948e9d0288a5f168b0d2dddfdf825b4ef4ef4e1e
71ab333bf34d105a33860fc2857ddd8dfbc8de07
refs/heads/master
2022-01-23T13:31:58.695290
2019-08-07T03:13:09
2019-08-07T03:13:09
null
0
0
null
null
null
null
UTF-8
Racket
false
false
8,549
rkt
A1.L2.rkt
#lang racket #| Compile L1 to s-expression-machine language L2 |# (provide (struct-out compiled:L2) L1→L2) (module+ test (require rackunit)) #| Language L2 This is a machine-like language, for a machine that supports enough to track the extended information in the memory model. Along with the support to model the LC, it has support for variable mutation, integer constants, and a few named lambdas. There are six types of statement in L2. All expression results move through a special result location. |# #;(L2: closure <name>) ; λ ; Create a unary closure from the compiled body named <name>. ; Leave a reference to it in result. #;(L2: variable <n>) ; var ; Look up the variable <n> environments up from the current environment, put its value in result. ; Put the value of result on the stack. #;(L2: push_result) ; app ; Call the closure that is on the stack, with the argument that is in result. #;(L2: call) ; app ; Set the variable <n> environments up from the current environment, to the value of result. #;(L2: set <n>) ; set! ; Put integer <i> in result. #;(L2: set_result <i>) ; datum #| Compiling L1 to L2 From your tracing examples, you understand how to track the memory model via the above operations. Compiling an expression in L1 produces: • code: a list of L2 statements for the expression • λs: a list of two-element lists (<name> <code>) with the <name>s of the λs in the expression paired with the code for their bodies The following summarizes your understanding. These *descriptions* are slightly informal, in particular they blur the distinction between lists and individual elements of a list. Don't blindly turn them into an implementation! |# #;{(L1: λ <n> <e>) → code: (L2: closure lambda_<n>) ; L2 statements λs: {(lambda_<n> <code-for-e>) ; L2 statements <λs-for-e>}} #;{(L1: app <e1> <e2>) → code: {<code-for-e1> (L2: push_result) <code-for-e2> (L2: call)} λs: {<λs-for-e1> <λs-for-e2>}} #;{(L1: set! <n> <e>) → code: {<code-for-e> (L2: set <n>)} λs: {<λs-for-e>}} ; Each of the following produce a single L2 statement and no λs: #;{(L1: var <n>) → (L2: variable <n>)} #;{(L1: var +) → (L2: closure make_add)} #;{(L1: var *) → (L2: closure make_multiply)} #;{(L1: var <) → (L2: closure make_less_than)} #;{(L1: datum <i>) → (L2: set_result <i>)} #| L1→L2 Each expression produces an instance of struct compiled:L2, which has two fields for code and λs. |# (struct compiled:L2 (code λs) #:transparent) (module+ test ; Along with making a constructor named ‘compiled:L2’ and also a pattern with that name, ; the struct declaration implicitly defines two field accessor functions: ‘compiled:L2-code’ ; and ‘compiled:L2-λs’, which you might prefer sometimes instead of needing to name results ; via pattern matching. ;• code: a list of L2 statements for the expression ;• λs: a list of two-element lists (<name> <code>) with the <name>s of the λs in the expression ; paired with the code for their bodies (define c (compiled:L2 '((L2: set_result 123)) '((lambda_0 ((L2: variable 0)))))) (check-equal? (match c [(compiled:L2 some-code some-λs) some-code]) (compiled:L2-code c)) (check-equal? (match c [(compiled:L2 some-code some-λs) some-λs]) (compiled:L2-λs c))) ; Produce a symbol of the form lambda_<n>. (define (lambda_ n) (local-require (only-in racket/syntax format-symbol)) (format-symbol "lambda_~a" n)) (module+ test (check-equal? (lambda_ 123) 'lambda_123)) #| Evaluation: id Valid only during the evaluation of a λ body, during a call to the λ, where id is one of the parameters in the chain of environments from the closure's environment upwards. Set the current result to be the value of id in that environment. (λ (id) e) Add a closure λ<n> pairing this λ expression and current environment, to the set of closures. Set the current result to be λ<n>. (e1 e2) Evaluate e1. Push the current result [the value of e1] onto the stack of results. Evaluate e2. Pop to get the closure to call, let's refer to it as λf. Add a new environment E<n> to the tree of environments, under λf's environment, with the id from λf's λ expression and the current result [which is the value of e2]. Push the current environment onto the call stack. Set the current environment to E<n>. Evaluate the body of λf's λ expression. Pop the call stack into the current environment. |# ; L1 Language #;(L1: λ <n> <e>) ; The nth lambda in an L1 expression. #;(L1: app <e1> <e2>) ; Same meaning as in L0. #;(L1: var <n>) ; Reference to a variable <n> scopes up. #;(L1: var <id>) ; Free/unbound/open variable reference to <id>. #;(L1: set! <n> <e>) ; Set the variable <n> scopes up to the value of <e>. #;(L1: datum <i>) ; Same meaning as in L0. (module+ test ; test L1 producing no lambdas (check-equal? (L1→L2 '(L1: var 0)) (compiled:L2 '((L2: variable 0)) '())) (check-equal? (L1→L2 '(L1: datum 1)) (compiled:L2 '((L2: set_result 1)) '())) (check-equal? (L1→L2 '(L1: var +)) (compiled:L2 '((L2: closure make_add)) '())) (check-equal? (L1→L2 '(L1: var *)) (compiled:L2 '((L2: closure make_multiply)) '())) (check-equal? (L1→L2 '(L1: var <)) (compiled:L2 '((L2: closure make_less_than)) '())) ; test λ (check-equal? (L1→L2 '(L1: λ 0 (L1: var 0))) (compiled:L2 '((L2: closure lambda_0)) '((lambda_0 ((L2: variable 0)))))) (check-equal? (L1→L2 '(L1: λ 1 (L1: λ 0 (L1: var 1)))) (compiled:L2 '((L2: closure lambda_1)) '((lambda_1 ((L2: closure lambda_0))) (lambda_0 ((L2: variable 1)))))) ; test set! (check-equal? (L1→L2 '(L1: set! 3 (L1: var 2))) (compiled:L2 '((L2: variable 2) (L2: set 3)) '())) ; set! with λ (check-equal? (L1→L2 '(L1: λ 1 (L1: set! 0 (L1: λ 0 (L1: var 0))))) (compiled:L2 '((L2: closure lambda_1)) '((lambda_1 ((L2: closure lambda_0) (L2: set 0))) (lambda_0 ((L2: variable 0)))))) ; test app (check-equal? (L1→L2 '(L1: app (L1: λ 0 (L1: var 0)) (L1: datum 2))) (compiled:L2 '((L2: closure lambda_0) (L2: push_result) (L2: set_result 2) (L2: call)) '((lambda_0 ((L2: variable 0)))))) ) (define (L1→L2 e) (match e ; λ [`(L1: λ ,<n> ,<e>) (define lambda-name (lambda_ <n>)) (define compiled-<e> (L1→L2 <e>)) (compiled:L2 `((L2: closure ,lambda-name)) (append `((,lambda-name ,(compiled:L2-code compiled-<e>))) (compiled:L2-λs compiled-<e>)))] ; app [`(L1: app ,<e1> ,<e2>) (define compiled-<e1> (L1→L2 <e1>)) (define compiled-<e2> (L1→L2 <e2>)) (compiled:L2 (append (compiled:L2-code compiled-<e1>) '((L2: push_result)) (compiled:L2-code compiled-<e2>) '((L2: call))) (append (compiled:L2-λs compiled-<e1>) (compiled:L2-λs compiled-<e2>))) ] ; set! [`(L1: set! ,<n> ,<e>) (define compiled-<e> (L1→L2 <e>)) (compiled:L2 (append (compiled:L2-code compiled-<e>) `((L2: set ,<n>))) (compiled:L2-λs compiled-<e>))] ; L1 statement that produce no lambdas [`(L1: var +) (compiled:L2 '((L2: closure make_add)) '())] [`(L1: var *) (compiled:L2 '((L2: closure make_multiply)) '())] [`(L1: var <) (compiled:L2 '((L2: closure make_less_than)) '())] [`(L1: var ,<n>) (compiled:L2 `((L2: variable ,<n>)) `())] [`(L1: datum ,<i>) (compiled:L2 `((L2: set_result ,<i>)) '())] [_ (compiled:L2 '() '())]))
false
61c04b541c8fa62e53082066935320398674c3b2
f6c47c7dc48caef110e14796b74358d47b36068b
/z3/ffi.rkt
ab6d25a3667881daa4bba74cf2f30f489ef665fa
[ "BSD-2-Clause" ]
permissive
jeapostrophe/z3-rkt
86fd16ecba1814f07fce5b993b3fe8200ab402dc
39f2b707b744708fd96fbccf4666cda261da6e28
refs/heads/master
2020-12-11T03:32:11.167374
2016-09-07T12:38:29
2016-09-07T12:38:29
67,605,174
2
0
null
2016-09-07T12:38:15
2016-09-07T12:38:14
null
UTF-8
Racket
false
false
90
rkt
ffi.rkt
#lang typed/racket/base (require "ffi/main.rkt") (provide (all-from-out "ffi/main.rkt"))
false
edcd31dfef9a4e536f5b329dd383ce345a4cd99e
df0ba5a0dea3929f29358805fe8dcf4f97d89969
/exercises/computer-science-4/02/solutions.rkt
92d429e762c1b2ab24c1ae44d4fd502165ab7809
[ "MIT" ]
permissive
triffon/fp-2019-20
1c397e4f0bf521bf5397f465bd1cc532011e8cf1
a74dcde683538be031186cf18367993e70dc1a1c
refs/heads/master
2021-12-15T00:32:28.583751
2021-12-03T13:57:04
2021-12-03T13:57:04
210,043,805
14
31
MIT
2019-12-23T23:39:09
2019-09-21T19:41:41
Racket
UTF-8
Racket
false
false
1,576
rkt
solutions.rkt
#lang racket ; count-digits (define (count-digits n) (if (< n 10) 1 (+ 1 (count-digits (quotient n 10))))) ; pow (define (pow x n) (if (zero? n) 1 (* x (pow x (- n 1))))) ; interval-sum (define (interval-sum a b) (if (= a b) b (+ a (interval-sum (+ a 1) b)))) ; count-digits-i (define (count-digits-i n) (define (iter counter number) (if (< number 10) counter (iter (+ counter 1) (quotient number 10)))) (iter 1 (abs n))) ; interval-sum-i (define (interval-sum-i a b) (define (iter i j acc) (if (= i j) (+ acc i) (iter (+ i 1) j (+ acc i)))) (if (< a b) (iter a b 0) (iter b a 0))) ; reverse-digits-i (define (reverse-digits-i n) (define (iter number result) (if (zero? number) result (iter (quotient number 10) (+ (* result 10) (remainder number 10))))) (iter n 0)) ; pow-i (define (pow-i x n) (define (iter step accumulator) (if (zero? step) accumulator (iter (- step 1) (* accumulator x)))) (if (negative? n) (/ 1 (iter (- n) 1)) (iter n 1))) ; fast-pow (define (fast-pow x n) (define (iter base exponent accumulator) (cond [(zero? exponent) accumulator] [(even? exponent) (iter (* base base) (/ exponent 2) accumulator)] [else (iter base (- exponent 1) (* accumulator base))])) (if (negative? n) (/ 1 (iter x (- n) 1)) (iter x n 1)))
false
1f867cb265699fd72fbbce6b64b3137bb00b7c38
b08b7e3160ae9947b6046123acad8f59152375c3
/Programming Language Detection/Experiment-2/Dataset/Train/Racket/magic-squares-of-odd-order.rkt
79ce6b0a9cf2b8a7cf5e34c7026cb44e9ffc96c9
[]
no_license
dlaststark/machine-learning-projects
efb0a28c664419275e87eb612c89054164fe1eb0
eaa0c96d4d1c15934d63035b837636a6d11736e3
refs/heads/master
2022-12-06T08:36:09.867677
2022-11-20T13:17:25
2022-11-20T13:17:25
246,379,103
9
5
null
null
null
null
UTF-8
Racket
false
false
1,022
rkt
magic-squares-of-odd-order.rkt
#lang racket ;; Using "helpful formulae" in: ;; http://en.wikipedia.org/wiki/Magic_square#Method_for_constructing_a_magic_square_of_odd_order (define (squares n) n) (define (last-no n) (sqr n)) (define (middle-no n) (/ (add1 (sqr n)) 2)) (define (M n) (* n (middle-no n))) (define ((Ith-row-Jth-col n) I J) (+ (* (modulo (+ I J -1 (exact-floor (/ n 2))) n) n) (modulo (+ I (* 2 J) -2) n) 1)) (define (magic-square n) (define IrJc (Ith-row-Jth-col n)) (for/list ((I (in-range 1 (add1 n)))) (for/list ((J (in-range 1 (add1 n)))) (IrJc I J)))) (define (fmt-list-of-lists l-o-l width) (string-join (for/list ((row l-o-l)) (string-join (map (λ (x) (~a #:align 'right #:width width x)) row) " ")) "\n")) (define (show-magic-square n) (format "MAGIC SQUARE ORDER:~a~%~a~%MAGIC NUMBER:~a~%" n (fmt-list-of-lists (magic-square n) (+ (order-of-magnitude (last-no n)) 1)) (M n))) (displayln (show-magic-square 3)) (displayln (show-magic-square 5)) (displayln (show-magic-square 9))
false