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
e3b30ec1fc16beaa3042ebc0a11f98ce4cc04dc3
1397f4aad672004b32508f67066cb7812f8e2a14
/plot-lib/plot/private/plot3d/split.rkt
a785cc1a851e3c9a973ffc107badaba29f82bcdf
[ "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
10,451
rkt
split.rkt
#lang typed/racket/base (require racket/list racket/flonum) (provide point3d-plane-dist split-line3d canonical-polygon3d split-polygon3d canonical-lines3d split-lines3d polygon3d-divide polygon3d-triangulate) ;; =================================================================================================== (: plane-line-intersect (-> Flonum Flonum Flonum Flonum Flonum Flonum Flonum Flonum Flonum Flonum (Values Flonum Flonum Flonum))) (define (plane-line-intersect a b c d x1 y1 z1 x2 y2 z2) (define dot1 (+ (* a x1) (* b y1) (* c z1))) (define dot2 (+ (* a x2) (* b y2) (* c z2))) (define denom (- dot1 dot2)) (if (zero? denom) (values x2 y2 z2) (let ([t (/ (+ dot1 d) denom)]) (values (+ x1 (* t (- x2 x1))) (+ y1 (* t (- y2 y1))) (+ z1 (* t (- z2 z1))))))) ;; =================================================================================================== ;; Points (: point3d-plane-dist (-> FlVector FlVector Flonum)) (define (point3d-plane-dist v plane) (+ (* (flvector-ref plane 0) (flvector-ref v 0)) (* (flvector-ref plane 1) (flvector-ref v 1)) (* (flvector-ref plane 2) (flvector-ref v 2)) (flvector-ref plane 3))) ;; =================================================================================================== ;; Splitting lines (: split-line3d (-> FlVector FlVector FlVector FlVector)) (define (split-line3d v1 v2 plane) (define-values (x y z) (plane-line-intersect (flvector-ref plane 0) (flvector-ref plane 1) (flvector-ref plane 2) (flvector-ref plane 3) (flvector-ref v1 0) (flvector-ref v1 1) (flvector-ref v1 2) (flvector-ref v2 0) (flvector-ref v2 1) (flvector-ref v2 2))) (flvector x y z)) ;; =================================================================================================== ;; Splitting polygons (: canonical-polygon3d (-> (Listof FlVector) (Listof Boolean) (Values (Listof FlVector) (Listof Boolean)))) (define (canonical-polygon3d vs ls) (cond [(empty? vs) (values vs empty)] [else (define-values (new-vs new-ls) (for/fold ([vs : (Listof FlVector) empty] [ls : (Listof Boolean) empty] ) ([v1 (in-list (cons (last vs) vs))] [v2 (in-list vs)] [l (in-list ls)]) (if (equal? v1 v2) (values vs ls) (values (cons v2 vs) (cons l ls))))) (values (reverse new-vs) (reverse new-ls))])) (: split-polygon3d (-> (Listof FlVector) (Listof Boolean) FlVector (Values (Listof FlVector) (Listof Boolean) (Listof FlVector) (Listof Boolean) Boolean))) (define (split-polygon3d vs ls plane) (define a (flvector-ref plane 0)) (define b (flvector-ref plane 1)) (define c (flvector-ref plane 2)) (define d (flvector-ref plane 3)) (: in-bounds? (-> Flonum Flonum Flonum Boolean)) (define (in-bounds? x1 y1 z1) ((+ (* a x1) (* b y1) (* c z1) d) . >= . 0.0)) (define v1 (last vs)) (define x1 (flvector-ref v1 0)) (define y1 (flvector-ref v1 1)) (define z1 (flvector-ref v1 2)) (define v1? (in-bounds? x1 y1 z1)) (define-values (vs1 ls1 vs2 ls2 crossings _x1 _y1 _z1 _v1?) (for/fold: ([vs1 : (Listof FlVector) empty] [ls1 : (Listof Boolean) empty] [vs2 : (Listof FlVector) empty] [ls2 : (Listof Boolean) empty] [crossings : Natural 0] [x1 : Flonum x1] [y1 : Flonum y1] [z1 : Flonum z1] [v1? : Boolean v1?] ) ([v2 (in-list vs)] [l (in-list ls)]) (define x2 (flvector-ref v2 0)) (define y2 (flvector-ref v2 1)) (define z2 (flvector-ref v2 2)) (define v2? (in-bounds? x2 y2 z2)) (cond [(and v1? v2?) (values (cons v2 vs1) (cons l ls1) vs2 ls2 crossings x2 y2 z2 v2?)] [(not (or v1? v2?)) (values vs1 ls1 (cons v2 vs2) (cons l ls2) crossings x2 y2 z2 v2?)] [v1? (let-values ([(x y z) (plane-line-intersect a b c d x1 y1 z1 x2 y2 z2)]) (define v (flvector x y z)) (values (cons v vs1) (cons l ls1) (list* v2 v vs2) (list* l #f ls2) (+ crossings 1) x2 y2 z2 v2?))] [else (let-values ([(x y z) (plane-line-intersect a b c d x1 y1 z1 x2 y2 z2)]) (define v (flvector x y z)) (values (list* v2 v vs1) (list* l #f ls1) (cons v vs2) (cons l ls2) (+ crossings 1) x2 y2 z2 v2?))]))) (let-values ([(vs1 ls1) (canonical-polygon3d (reverse vs1) (reverse ls1))] [(vs2 ls2) (canonical-polygon3d (reverse vs2) (reverse ls2))]) (values vs1 ls1 vs2 ls2 (crossings . <= . 2)))) ;; =================================================================================================== ;; Splitting connected lines (: canonical-lines3d (All (A) ((Listof A) -> (Listof A)))) (define (canonical-lines3d xs) (if (empty? xs) xs (cons (first xs) (for/list: : (Listof A) ([x1 (in-list xs)] [x2 (in-list (rest xs))] #:unless (equal? x1 x2)) x2)))) (: split-lines3d (-> (Listof FlVector) FlVector (Values (Listof (Listof FlVector)) (Listof (Listof FlVector))))) (define (split-lines3d vs plane) (define a (flvector-ref plane 0)) (define b (flvector-ref plane 1)) (define c (flvector-ref plane 2)) (define d (flvector-ref plane 3)) (: in-bounds? (-> Flonum Flonum Flonum Boolean)) (define (in-bounds? x1 y1 z1) ((+ (* a x1) (* b y1) (* c z1) d) . >= . 0.0)) (define v1 (first vs)) (define x1 (flvector-ref v1 0)) (define y1 (flvector-ref v1 1)) (define z1 (flvector-ref v1 2)) (define v1? (in-bounds? x1 y1 z1)) (define-values (vss1 vss2 _x1 _y1 _z1 _v1?) (for/fold: ([vss1 : (Listof (Listof FlVector)) (if v1? (list (list v1)) (list empty))] [vss2 : (Listof (Listof FlVector)) (if v1? (list empty) (list (list v1)))] [x1 : Flonum x1] [y1 : Flonum y1] [z1 : Flonum z1] [v1? : Boolean v1?] ) ([v2 (in-list (rest vs))]) (define x2 (flvector-ref v2 0)) (define y2 (flvector-ref v2 1)) (define z2 (flvector-ref v2 2)) (define v2? (in-bounds? x2 y2 z2)) (cond [(and v1? v2?) (values (cons (cons v2 (first vss1)) (rest vss1)) vss2 x2 y2 z2 v2?)] [(not (or v1? v2?)) (values vss1 (cons (cons v2 (first vss2)) (rest vss2)) x2 y2 z2 v2?)] [v1? (define-values (x y z) (plane-line-intersect a b c d x1 y1 z1 x2 y2 z2)) (define v (flvector x y z)) (values (cons (cons v (first vss1)) (rest vss1)) (cons (list v2 v) vss2) x2 y2 z2 v2?)] [else (define-values (x y z) (plane-line-intersect a b c d x1 y1 z1 x2 y2 z2)) (define v (flvector x y z)) (values (cons (list v2 v) vss1) (cons (cons v (first vss2)) (rest vss2)) x2 y2 z2 v2?)]))) (values (map (inst canonical-lines3d FlVector) (filter (compose not empty?) vss1)) (map (inst canonical-lines3d FlVector) (filter (compose not empty?) vss2)))) ;; =================================================================================================== ;; Dividing and triangulating polygons (: polygon3d-divide (-> (Listof FlVector) (Listof Boolean) (Values (Listof FlVector) (Listof Boolean) (Listof FlVector) (Listof Boolean)))) (define (polygon3d-divide vs-list ls-list) ;(printf "vs-list = ~v~n" vs-list) (define n (length vs-list)) (cond [(<= n 3) (values vs-list ls-list empty empty)] [else (define vs (list->vector vs-list)) (define ls (list->vector ls-list)) (define n/2 (quotient n 2)) (define opposite (λ ([i1 : Fixnum]) (modulo (+ i1 n/2) n))) (define opposite-dist (λ ([i1 : Fixnum]) (define v1 (vector-ref vs i1)) (define v2 (vector-ref vs (opposite i1))) (define x (- (flvector-ref v2 0) (flvector-ref v1 0))) (define y (- (flvector-ref v2 1) (flvector-ref v1 1))) (define z (- (flvector-ref v2 2) (flvector-ref v1 2))) (+ (* x x) (* y y) (* z z)))) (define-values (i1 _) (for/fold ([best-i : Fixnum 0] [best-dist : Flonum (opposite-dist 0)] ) ([i1 : Positive-Fixnum (in-range 1 n)]) (define dist (opposite-dist i1)) (if (dist . < . best-dist) (values i1 dist) (values best-i best-dist)))) (define i2 (opposite i1)) (: extract (-> Fixnum Fixnum (Values (Listof FlVector) (Listof Boolean)))) (define (extract i1 i2) (let loop ([i i2] [new-vs : (Listof FlVector) empty] [new-ls : (Listof Boolean) empty]) (cond [(= i i1) (values (reverse (cons (vector-ref vs i) new-vs)) (reverse (cons (vector-ref ls i) new-ls)))] [else (loop (modulo (+ i 1) n) (cons (vector-ref vs i) new-vs) (cons (if (= i i2) #f (vector-ref ls i)) new-ls))]))) (define-values (vs1 ls1) (extract i1 i2)) (define-values (vs2 ls2) (extract i2 i1)) (values vs1 ls1 vs2 ls2)])) (: polygon3d-triangulate (-> (Listof FlVector) (Listof Boolean) (Values (Listof (Listof FlVector)) (Listof (Listof Boolean))))) (define (polygon3d-triangulate vs ls) (if (empty? vs) (values empty empty) (let loop ([vs vs] [ls ls]) (define-values (vs1 ls1 vs2 ls2) (polygon3d-divide vs ls)) (cond [(empty? vs2) (values (list vs1) (list ls1))] [else (define-values (vss1 lss1) (polygon3d-triangulate vs1 ls1)) (define-values (vss2 lss2) (polygon3d-triangulate vs2 ls2)) (values (append vss1 vss2) (append lss1 lss2))]))))
false
afa0516b0307587708f6d614ab4f3b41a63f1012
648d6a9732e37f31d49495076bd0d88eec4dae76
/Assignment2/assignment2.rkt
8d0ad2e782eb242b2912c8fe6c7de84f4778b391
[]
no_license
ryanlacroix/functional-programming-assignments
2853794d59a7ccbf4413956433f7ba59d2f88344
25f74567328dc52a9436c803080d2b446a949622
refs/heads/master
2021-04-29T07:43:42.535424
2017-01-04T03:24:41
2017-01-04T03:24:41
77,976,860
0
0
null
null
null
null
UTF-8
Racket
false
false
7,495
rkt
assignment2.rkt
; Ryan Lacroix, 100901696 ; Assignment 2 (#%require (only racket/base random)) ; Question 1 (define (make-interval a b) (cons a b)) (define (upper interval) (cdr interval)) (define (lower interval) (car interval)) (define (add-interval i1 i2) (cons (+ (car i1) (car i2)) (+ (cdr i1) (cdr i2)))) (define (subtract-interval i1 i2) (cons (- (car i1) (cdr i2)) (- (cdr i1) (car i2)))) (define (multiply-interval i1 i2) (cons (min (*(car i1) (car i2)) (*(car i1) (cdr i2)) (*(cdr i1) (car i2)) (*(cdr i1) (cdr i2))) (max (*(car i1) (car i2)) (*(car i1) (cdr i2)) (*(cdr i1) (car i2)) (*(cdr i1) (cdr i2))))) (define (divide-interval i1 i2) (cond ((= (car i2) 0) (display "error")) ((= (cdr i2) 0) (display "error")) (else (multiply-interval i1 (make-interval (/ 1 (car i2)) (/ 1 (cdr i2))))))) ; Question 2 (define (forEach lis) (define inner (lambda (op) (inner2 lis op))) (define (inner2 li op) (if (null? li) '() (cons (op (car li)) (inner2 (cdr li) op)))) inner) ; Question 3 ; a) (define (special-cons x y) (lambda (m) (m x y))) (define (special-car x) (car (x cons))) (define (special-cdr x) (cdr (x cons))) ; b) (define (triple x y z) (lambda (val) (cond ((= val 1)x) ((= val 2)y) ((= val 3)z)))) (define (triple-first trips) ; Renamed for namespace collision (trips 1)) (define (second trips) (trips 2)) (define (third trips) (trips 3)) ; Question 4 ; Including the 'accumulate' definition from class: (define (accumulate operator initial sequence) (if (null? sequence) initial (operator (car sequence) ; element (accumulate operator initial (cdr sequence))))) ;rest (define (filter predicate sequence) (cond ((null? sequence) '()) ((predicate (car sequence)) (cons (car sequence) (filter predicate (cdr sequence)))) (else (filter predicate (cdr sequence))))) ; a) (define (my-map proc sequence) (accumulate (lambda (x y) (cons (proc x) y)) '() sequence)) ;(define a (my-map (lambda (x) (* x x)) (list 1 2 3 4 5))) example use ; b) (define (my-append seq1 seq2) (accumulate cons seq2 seq1)) ;(define a (my-append (list 1 2 3 4 5) (list 7 8 9))) example use ; c) (define (my-length sequence) (accumulate (lambda (x y) (+ (+ 1 (- x x) ) y)) 0 sequence)) ; d) (define (my-filter predicate sequence) (accumulate (lambda (element rest) (cond ((predicate element)(cons element rest)) (else rest)) ) '() sequence)) ; Question 5 ; a) NOTE: I *think* this counts as tail-recursive. ; (define (intersection-set-iter set1 set2) (define (innerIntersect set1 set2 origSet2 intersect) (if (null? set1) intersect (if (null? set2) (innerIntersect (cdr set1) origSet2 origSet2 intersect) (if (= (car set1) (car set2)) (innerIntersect set1 (cdr set2) origSet2 (cons (car set1) intersect)) (innerIntersect set1 (cdr set2) origSet2 intersect))))) (innerIntersect set1 set2 set2 '())) ; b) Using Filter ; Including the 'filter' definition from class (define (filter predicate sequence) (cond ((null? sequence) '()) ((predicate (car sequence)) (cons (car sequence) (filter predicate (cdr sequence)))) (else (filter predicate (cdr sequence))))) (define (intersection-set set1 set2) (define (inner set1 set2 intersect) (if (null? set1) (filter (lambda (x) (not (null? x))) (flattenList intersect)) (inner (cdr set1) set2 (cons (filter (lambda(x)(= (car set1) x)) set2) intersect)))) (inner set1 set2 '())) ;(intersection-set '(1 2 3 4) '(3 4 5 1 7)) Note: leaves in empty set and 2D ; c) (define (mean lis) (define (mean-inner li total count) (cond ((null? li)(if (= count 0) (display "Error: no numbers in list") (/ total count))) ((integer? (car li))(mean-inner (cdr li) (+ total (car li)) (+ count 1))) (else (mean-inner (cdr li) total count)))) (mean-inner lis 0 0)) ; (mean '(10 d b 15 20 h)) ; d) (define (subsets x) (define (inner-subset set1 set2 superSet) (cond ((null? set1) '()) ((null? set2) (inner-subset (cdr set1) x superSet)) ;maybe add origSet2 to cdr through (else (cons (cons (car set1) (car set2)) (inner-subset set1 (cdr set2) superSet ))))) (inner-subset x x '())) ; Question 6 ; a) (define (depth lis) (define (inner-depth li currDepth maxDepth) (if (null? li) (+ maxDepth 1) (if (list? li) (if (list? (car li)) (inner-depth (car li) (+ 1 currDepth) maxDepth) (inner-depth (cdr li) currDepth (max currDepth maxDepth))) 0))) (inner-depth lis 0 0)) ; b) (define (treemap procedure lis) (if (null? lis) '() (if (list? lis) (cons (treemap procedure (car lis))(treemap procedure (cdr lis))) (procedure lis)))) ;(treemap sqr '((1) 2 3 ((4 5 6) 7) 8 9)) (define (sqr x) ; for testing (* x x)) ; c) (define (flattenList lis) (if (null? lis) '() (if (list? lis) (append (flattenList (car lis))(flattenList (cdr lis))) (list lis)))) ;(flattenList '(1 (2 3) ((4 5 6 (7)))(((8 (9)))))) ; Question 7 ; Definitions from lectures property of Andrew Runka (define-syntax cons-stream (syntax-rules () ((cons-stream a b)(cons a (delay b))))) (define (stream-car s)(car s)) (define (stream-cdr s)(force (cdr s))) (define (integers-starting-from n) (cons-stream n (integers-starting-from (+ n 1)))) (define (stream-filter predicate stream) (cond ((stream-null? stream) the-empty-stream) ((predicate (stream-car stream)) (cons-stream (stream-car stream) (stream-filter predicate (stream-cdr stream)))) (else (stream-filter predicate (stream-cdr stream))))) (define (stream-null? stream ) (null? stream)) (define integers (integers-starting-from 1)) ; a) ; i) (define (first n str) (if (= n 0) '() (cons-stream (stream-car str) (first (- n 1) (stream-cdr str))))) ; ii) (define (list->stream lis) (if (null? lis) '() (cons-stream (car lis) (list->stream (cdr lis))))) ;(define strFromList (list->stream '(1 2 3 4 5 6))) ; iii) (define (stream->list str) (if (null? str) '() (cons (stream-car str) (stream->list (stream-cdr str))))) ;(define 4ints (first 4 integers)) ;(define listFromStr (stream->list 4ints)) ; b) ; i) (define stream-of-ones (cons-stream 1 stream-of-ones)) ; ii) (define stream-of-odds (stream-filter odd? integers)) ; iii) (define (stream-of-randoms) (cons-stream (random 100) (stream-of-randoms))) ; iv) (define (iFun n) (if (< n 4) n (+ (iFun(- n 1)) (* 2 (iFun (- n 2))) (* 3 (iFun (- n 3)))))) (define (stream-of-function) (define (inner-sof n) (cons-stream (iFun n) (inner-sof (+ n 1)))) (inner-sof 1)) ; c) (define (partial-sums pos-ints) (define (inner-part-sums pos-ints sum) (cons-stream (+ (stream-car pos-ints) sum) (inner-part-sums (stream-cdr pos-ints) (+ (stream-car pos-ints) sum)))) (inner-part-sums pos-ints 0))
true
415dac298d8068f48dbd2b13ecdd759db415126c
9508c612822d4211e4d3d926bbaed55e21e7bbf3
/tests/dsls/peg/test/define-in-let.rkt
dd1859721d67dce868dd414bffd047a49a3cb691
[ "MIT", "Apache-2.0" ]
permissive
michaelballantyne/syntax-spec
4cfb17eedba99370edc07904326e3c78ffdb0905
f3df0c72596fce83591a8061d048ebf470d8d625
refs/heads/main
2023-06-20T21:50:27.017126
2023-05-15T19:57:55
2023-05-15T19:57:55
394,331,757
13
1
NOASSERTION
2023-06-19T23:18:13
2021-08-09T14:54:47
Racket
UTF-8
Racket
false
false
209
rkt
define-in-let.rkt
#lang racket/base (require "../main.rkt" rackunit) (let () (define-peg foo "foo") (define-peg foobar (seq foo "bar")) (check-equal? (parse-result-value (parse foobar "foobar")) "bar"))
false
aca8a67300de22799a1802cd4e3a82f9e06170bf
69e94593296c73bdfcfc2e5a50fea1f5c5f35be1
/Tutorials/Tut1/q6.rkt
388f88a6b5c9c1d7733fa6b4649590ef92641a9e
[]
no_license
nirajmahajan/CS152
7e64cf4b8ec24ed9c37ecc72c7731816089e959b
ef75b37715422bf96648554e74aa5ef6e36b9eb3
refs/heads/master
2020-05-29T18:02:08.993097
2019-05-29T20:35:06
2019-05-29T20:35:06
189,293,837
0
0
null
null
null
null
UTF-8
Racket
false
false
315
rkt
q6.rkt
#lang racket (define (iseven a) (= 0 (remainder a 2))) (define (square a) (* a a)) (define (modexp x y n) (cond [(= 0 y) 1] [(iseven y) (modulo (square (modexp x (/ y 2) n)) n)] [else (modulo (* (modulo (square (modexp x (/ (- y 1) 2) n)) n) (modulo x n)) n)]))
false
2b35ef02442bdd8b8e4c75d18998c567aca1b09d
cef478bf92e7878bff9397c7bdf18f39f6126154
/module-basic/hate-lambda-use.rkt
a399e016e8477269e42f45ca77db4dd8949862d4
[]
no_license
ruliana/racket-examples
bf0eb7a9152f449278771daeb3ed9463b4c10a71
688293c86132f3b5c924360d53238ca352d4cf5b
refs/heads/master
2020-04-10T22:05:01.336663
2017-11-01T16:00:23
2017-11-01T16:00:23
68,248,352
25
1
null
null
null
null
UTF-8
Racket
false
false
86
rkt
hate-lambda-use.rkt
#lang s-exp "hate-define.rkt" ;(define x (λ (y) (add1 y))) (def x (λ (y) (add1 y)))
false
1164967624ede4a3388d5c83a7096a6d968dc735
b937826bed3aa2673a85a1599ce8597dd2cc11c8
/liso/lang/hack.rkt
a104292c0efee7ccfd0e709752904e2f0b2da136
[]
no_license
lewisbrown/liso
9033683472feaaadada196a82742ddbdff85b655
c7a71c5d205fac88aee9c76a4257fc1293ddf51f
refs/heads/master
2021-01-14T11:56:50.323785
2014-01-16T23:53:52
2014-01-16T23:53:52
null
0
0
null
null
null
null
UTF-8
Racket
false
false
108
rkt
hack.rkt
(module _ racket (provide (except-out (all-from-out racket) = ==) (rename-out (define =) (= ==))))
false
000d7c4aa32c2c1c30caa4ad88584eb08b7db5db
ba4ad8a778c69640c9cca8e5dcaeb40d4a10fa10
/racket/plai/lecter-test.rkt
81cd3945204aae9ca2ba1d85c52b941e690a5622
[]
no_license
tangentstorm/tangentlabs
390ac60618bd913b567d20933dab70b84aac7151
137adbba6e7c35f8bb54b0786ada6c8c2ff6bc72
refs/heads/master
2023-08-31T20:36:53.127938
2023-08-18T01:30:10
2023-08-18T01:30:10
7,815,356
33
22
null
2015-06-06T12:15:35
2013-01-25T07:03:01
Visual Basic
UTF-8
Racket
false
false
392
rkt
lecter-test.rkt
#lang plai (require "lecter.rkt") (require rackunit) (printf "Running tests...\n") (check-equal? (parse '(@foo)) (@ "foo")) (check-equal? (parse '(!bar)) (! "bar")) (check-equal? (chain '(@a -> !b -> @c -> !d -> @e)) '((@a -> !b) (!b -> @c) (@c -> !d) (!d -> @e))) (printf "Done with tests!")
false
1c37c8c562871fdb92a598696d5f8e0b007d8e07
925045585defcc1f71ee90cf04efb841d46e14ef
/racket/webAppInRacket/model.rkt
a8fb887e2afeee6718fc21ed990cd67da4d67252
[]
no_license
rcherrueau/APE
db095c3b6fc43776d1421a16090937a49847bdd9
a881df53edf84d93ec0a377c2ed02c0d754f7041
refs/heads/master
2022-07-19T18:01:41.848025
2021-12-19T17:30:23
2021-12-19T17:30:23
11,178,796
4
1
null
2022-07-07T21:11:07
2013-07-04T14:12:52
Racket
UTF-8
Racket
false
false
2,940
rkt
model.rkt
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Web Applications in Racket ;; http://docs.racket-lang.org/continue/ ;; ;; 13. Abstracting the Model ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; #lang racket/base ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Blog Structure ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;; ;; Posts ;;;;;;;;;;;;;;;;;;;;; ; Blog post data-structure ; A blog post is title, a body (content) and a list of comments. (struct post (title body comments) #:mutable) ; post-add-comment! : post comment -> void ; Consumes a post and a comment, adds the comment at the end of the post. (define (post-add-comment! a-post comment) (set-post-comments! a-post (append (post-comments a-post) (list comment)))) ;;;;;;;;;;;;;;;;;;;;; ;; Blog ;;;;;;;;;;;;;;;;;;;;; ; A blog is a (blog posts) where posts is a (listof post) ; Mutable structure provide mutators to change their filds. ; So blog struct provide value set-blog-posts! : blog (listof post) -> void to ; set the posts value. (struct blog (posts) #:mutable) ; blog-insert-post!: blog post -> void ; Consumes a blog and a post, adds the pot at the top of the blog. (define (blog-insert-post! a-blog a-post) (set-blog-posts! a-blog (cons a-post (blog-posts a-blog)))) ; BLOG: blog ; The initial BLOG. (define BLOG (blog (list (post "Second Post" "This is another post. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." (list "Comment1" "Comment2")) (post "First Post" "This is my first post. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." (list "Comment1" "Comment2" "Comment3"))))) ; Grant other files access to eveything defined in this file. (provide (all-defined-out))
false
7f48b3ec7c235146d82bf38fc781dcd90cc14069
4d3a7c20c201dddb361e7f6685a1340a51bf54d3
/rkt/untyped-test.rkt
b3f3872ae32972bf88397da61f9a6dd6ca39bedf
[]
no_license
williamberman/tapl
ec0ecfcec7d8b2dc051988916b3bd6d5c6fe44dd
d07a99284f49b486a3b492b92061940f19e4d713
refs/heads/master
2021-01-07T00:35:05.362536
2020-06-19T03:16:01
2020-06-19T03:16:01
241,753,416
1
0
null
null
null
null
UTF-8
Racket
false
false
59
rkt
untyped-test.rkt
#lang s-exp "untyped.rkt" (require "untyped-stdlib.rkt")
false
2a51ecdd593d6b237e37cd77679d02464b21a6de
91e5c760bd348b07ff8898b0ae4305a505c6decd
/north/tool/syntax-color.rkt
935908e9c88acfcb93c913403993c991b250c1d5
[ "BSD-3-Clause" ]
permissive
Bogdanp/racket-north
bfad473dd974f8f0914c357d5e55aaf435720156
9b0499fa071a8e405a6976170f3c45b2eae9c1d8
refs/heads/master
2023-07-27T11:45:47.550900
2023-07-09T10:53:17
2023-07-09T10:53:17
167,856,521
19
3
null
2022-10-08T07:01:09
2019-01-27T20:42:44
Racket
UTF-8
Racket
false
false
2,644
rkt
syntax-color.rkt
#lang racket/base (require (for-syntax racket/base racket/port syntax/parse) parser-tools/lex (prefix-in : parser-tools/lex-sre)) (provide read-token) (define (val lex kind s e) (values lex kind #f (position-offset s) (position-offset e))) (define-syntax-rule (make-lex-string ch kind) (lambda (s) (define lxr (lexer [(eof) (val "" 'error s end-pos)] [(:~ ch #\\ #\newline) (lxr input-port)] [(:: #\\ #\\) (lxr input-port)] [(:: #\\ #\newline) (lxr input-port)] [(:: #\\ ch) (lxr input-port)] [ch (val "" kind s end-pos)] [any-char (val "" 'error s end-pos)])) lxr)) (define lex-string-sq (make-lex-string #\' 'string)) (define lex-string-dq (make-lex-string #\" 'identifier)) (define-lex-trans (or/ci stx) (syntax-parse stx [(_ ds:string ...+) #:with (ss ...) (for/list ([s (in-list (syntax-e #'(ds ...)))]) (datum->syntax #'(ds ...) (string-upcase (syntax->datum s)))) #'(:or ds ... ss ...)])) (begin-for-syntax (define here (syntax-source #'here)) (define (rel . p) (simplify-path (apply build-path here 'up p)))) (define-syntax (define-trans-from-file stx) (syntax-parse stx [(_ id:id filename:str) #:with (s ...) (for/list ([s (in-list (call-with-input-file (rel (syntax->datum #'filename)) port->lines))]) (datum->syntax stx s)) #'(define-lex-trans (id stx) (syntax-parse stx [(_) #'(or/ci s ...)]))])) (define-trans-from-file sql-constant "constants.txt") (define-trans-from-file sql-keyword "keywords.txt") (define-trans-from-file sql-operator "operators.txt") (define read-token (lexer [(:+ whitespace) (val lexeme 'whitespace start-pos end-pos)] [(:: "--" (:* (:~ #\newline))) (val lexeme 'comment start-pos end-pos)] [(sql-keyword) (val lexeme 'keyword start-pos end-pos)] [(sql-constant) (val lexeme 'constant start-pos end-pos)] [(:: (:or alphabetic #\_) (:* (:or alphabetic numeric #\_))) (val lexeme 'identifier start-pos end-pos)] [(:: numeric (:* (:or #\. numeric))) (val lexeme 'number start-pos end-pos)] [#\" ((lex-string-dq start-pos) input-port)] [#\' ((lex-string-sq start-pos) input-port)] [(:: #\E #\') ((lex-string-sq start-pos) input-port)] [(:or #\( #\) #\[ #\] #\{ #\}) (val lexeme 'parenthesis start-pos end-pos)] [(sql-operator) (val lexeme 'parenthesis start-pos end-pos)] [any-char (val lexeme 'error start-pos end-pos)] [(eof) (val lexeme 'eof start-pos end-pos)]))
true
aae70866f9fbfc5bc709bf127482c20550c3485a
8651ea2ea33e0a6d54a757aadc4a41663d5de4f2
/parse.rkt
32b9a92ef6a7b6d649c6344c531311e0b4f9e07e
[]
no_license
elibarzilay/gabot
43ccae8464cbad2bc56a859c85f188c170171abf
4bcc2e89fb03c891f317fbd0a568dc81e8e1c6b5
refs/heads/master
2020-04-27T08:50:41.195497
2013-10-16T07:04:30
2013-10-16T07:18:50
13,612,131
2
0
null
null
null
null
UTF-8
Racket
false
false
2,233
rkt
parse.rkt
#lang racket/base ;; Parse IRC messages and put the results in the right places for later ;; processing (require "utils.rkt" "globals.rkt") (define irc-line-rx (rx " *" "(?::([^ ]*) +)?" ; optional prefix "([^ ]*)" ; command "( +.*)?" ; parameters, including initial space )) (define irc-prefix-rx (rx "(.*?)" ; server/nick "(?:!(.*?))?" ; optional user "(?:@(.*?))?" ; optional host )) (define (not-empty bs) (and bs (< 0 (bytes-length bs)) (bytes->string/utf-8 bs #\?))) (define (parse-prefix x) (cond [(regexp-match irc-prefix-rx x) => (λ(m) (define xs (map not-empty (cdr m))) (cons (string->symbol (car xs)) (cdr xs)))] [else (warn 'parse-prefix "bad prefix: ~e" x) (list x #f #f)])) (define (parse-command x) (define s (bytes->string/utf-8 x #\?)) ((if (regexp-match? #rx"^[0-9]+$" s) string->number string->symbol) s)) (define (parse-params x) (let loop ([x x] [r '()]) (cond [(regexp-match #rx#"^ +: *(.*?) *$" x) => (λ(m) (reverse (cons (bytes->string/utf-8 (cadr m) #\?) r)))] [(regexp-match #rx#"^ +([^ ]+)(.*)$" x) => (λ(m) (loop (caddr m) (cons (bytes->string/utf-8 (cadr m) #\?) r)))] [else (unless (regexp-match? #rx#"^ *$" x) (warn 'parse-params "bad params: ~e" x)) (reverse r)]))) (provide irc-parse) ;; sets the message globals, if it doesn't, then a warning will happen later (define (irc-parse line) (cond [(regexp-match? #rx#"[\0\r\n]" line) (warn 'irc-parse "bad character in irc line")] [(regexp-match irc-line-rx line) => (λ(m) (define (get n parse) (define x (list-ref m n)) (and x (not (equal? "" x)) (parse x))) (define cmd (get 2 parse-command)) (define-values [who user host] (apply values (or (get 1 parse-prefix) '(#f #f #f)))) (define params (or (get 3 parse-params) '())) (set! *cmd* cmd) (set! *who* who) (set! *user* user) (set! *host* host) (set! *params* params) (set! *line* (list* cmd who params)))]))
false
c6d774e5b070755f47e99c7941ffeae031eb7f5d
bb6ddf239800c00988a29263947f9dc2b03b0a22
/solutions/exercise-5.x-letrec-lang.rkt
33b2c81961d7067ecaa40b11490bd50da52fc9b5
[]
no_license
aboots/EOPL-Exercises
f81b5965f3b17f52557ffe97c0e0a9e40ec7b5b0
11667f1e84a1a3e300c2182630b56db3e3d9246a
refs/heads/master
2022-05-31T21:29:23.752438
2018-10-05T06:38:55
2018-10-05T06:38:55
null
0
0
null
null
null
null
UTF-8
Racket
false
false
22,401
rkt
exercise-5.x-letrec-lang.rkt
#lang eopl ;; Grammar. (define the-lexical-spec '([whitespace (whitespace) skip] [comment ("%" (arbno (not #\newline))) skip] [identifier (letter (arbno (or letter digit "_" "-" "?"))) symbol] [number (digit (arbno digit)) number] [number ("-" digit (arbno digit)) number])) (define the-grammar '([program (expression) a-program] [expression (number) const-exp] [expression ("-" "(" expression "," expression ")") diff-exp] [expression ("zero?" "(" expression ")") zero?-exp] [expression ("if" expression "then" expression "else" expression) if-exp] [expression (identifier) var-exp] [expression ("let" (arbno identifier "=" expression) "in" expression) let-exp] [expression ("let2" identifier "=" expression identifier "=" expression "in" expression) let2-exp] [expression ("let3" identifier "=" expression identifier "=" expression identifier "=" expression "in" expression) let3-exp] [expression ("proc" "(" (separated-list identifier ",") ")" expression) proc-exp] [expression ("(" expression (arbno expression) ")") call-exp] [expression ("letrec" identifier "(" (separated-list identifier ",") ")" "=" expression "in" expression) letrec-exp] [expression ("cons" "(" expression "," expression ")") cons-exp] [expression ("car" "(" expression ")") car-exp] [expression ("cdr" "(" expression ")") cdr-exp] [expression ("null?" "(" expression ")") null?-exp] [expression ("emptylist") emptylist-exp] [expression ("list" "(" (separated-list expression ",") ")") list-exp])) (sllgen:make-define-datatypes the-lexical-spec the-grammar) (define scan&parse (sllgen:make-string-parser the-lexical-spec the-grammar)) ;; Data structures. (define-datatype proc proc? [procedure [bvars (list-of symbol?)] [body expression?] [env environment?]]) (define-datatype expval expval? [num-val [value number?]] [bool-val [boolean boolean?]] [proc-val [proc proc?]] [emptylist-val] [pair-val [car expval?] [cdr expval?]]) (define expval-extractor-error (lambda (variant value) (eopl:error 'expval-extractors "Looking for a ~s, found ~s" variant value))) (define expval->num (lambda (v) (cases expval v [num-val (num) num] [else (expval-extractor-error 'num v)]))) (define expval->bool (lambda (v) (cases expval v [bool-val (bool) bool] [else (expval-extractor-error 'bool v)]))) (define expval->proc (lambda (v) (cases expval v [proc-val (proc) proc] [else (expval-extractor-error 'proc v)]))) (define expval->car (lambda (v) (cases expval v [pair-val (car cdr) car] [else (expval-extractor-error 'pair v)]))) (define expval->cdr (lambda (v) (cases expval v [pair-val (car cdr) cdr] [else (expval-extractor-error 'pair v)]))) (define (expval-null? v) (cases expval v [emptylist-val () #t] [else #f])) (define-datatype environment environment? [empty-env] [extend-env [bvar symbol?] [bval expval?] [saved-env environment?]] [extend-env-rec [p-name symbol?] [b-vars (list-of symbol?)] [p-body expression?] [saved-env environment?]]) (define identifier? symbol?) (define-datatype continuation continuation? [end-cont] [zero1-cont [saved-cont continuation?]] [let-exps-cont [vars (list-of identifier?)] [vals (list-of expval?)] [exps (list-of expression?)] [body expression?] [saved-env environment?] [saved-cont continuation?]] [let2-exp1-cont [var1 identifier?] [var2 identifier?] [exp2 expression?] [body expression?] [saved-env environment?] [saved-cont continuation?]] [let2-exp2-cont [var1 identifier?] [val1 expval?] [var2 identifier?] [body expression?] [saved-env environment?] [saved-cont continuation?]] [let3-exp1-cont [var1 identifier?] [var2 identifier?] [exp2 expression?] [var3 identifier?] [exp3 expression?] [body expression?] [saved-env environment?] [saved-cont continuation?]] [let3-exp2-cont [var1 identifier?] [val1 expval?] [var2 identifier?] [var3 identifier?] [exp3 expression?] [body expression?] [saved-env environment?] [saved-cont continuation?]] [let3-exp3-cont [var1 identifier?] [val1 expval?] [var2 identifier?] [val2 expval?] [var3 identifier?] [body expression?] [saved-env environment?] [saved-cont continuation?]] [if-test-cont [exp2 expression?] [exp3 expression?] [saved-env environment?] [saved-cont continuation?]] [diff1-cont [exp2 expression?] [saved-env environment?] [saved-cont continuation?]] [diff2-cont [val1 expval?] [saved-cont continuation?]] [rator-cont [rands (list-of expression?)] [saved-env environment?] [saved-cont continuation?]] [rand-cont [proc1 expval?] [vals (list-of expval?)] [rands (list-of expression?)] [saved-env environment?] [saved-cont continuation?]] [cons-exp1-cont [exp2 expression?] [saved-env environment?] [saved-cont continuation?]] [cons-exp2-cont [val1 expval?] [saved-cont continuation?]] [car-cont [saved-cont continuation?]] [cdr-cont [saved-cont continuation?]] [null?-cont [saved-cont continuation?]] [list-exps-cont [vals (list-of expval?)] [exps (list-of expression?)] [saved-env environment?] [saved-cont continuation?]]) ;; Interpreter. (define apply-procedure/k (lambda (proc1 args cont) (cases proc proc1 [procedure (vars body saved-env) (value-of/k body (let loop ([env saved-env] [vars vars] [args args]) (if (null? vars) env (loop (extend-env (car vars) (car args) env) (cdr vars) (cdr args)))) cont)]))) (define used-end-conts '()) (define apply-cont (lambda (cont val) (cases continuation cont [end-cont () (if (memq cont used-end-conts) (eopl:error "Continuation is already used.") (begin (set! used-end-conts (cons cont used-end-conts)) val))] [zero1-cont (saved-cont) (apply-cont saved-cont (bool-val (zero? (expval->num val))))] [let-exps-cont (vars vals exps body saved-env saved-cont) (if (null? exps) (value-of/k body (let loop ([env saved-env] [vars vars] [vals (reverse (cons val vals))]) (if (null? vars) env (loop (extend-env (car vars) (car vals) env) (cdr vars) (cdr vals)))) saved-cont) (value-of/k (car exps) saved-env (let-exps-cont vars (cons val vals) (cdr exps) body saved-env saved-cont)))] [let2-exp1-cont (var1 var2 exp2 body saved-env saved-cont) (value-of/k exp2 saved-env (let2-exp2-cont var1 val var2 body saved-env saved-cont))] [let2-exp2-cont (var1 val1 var2 body saved-env saved-cont) (value-of/k body (extend-env var2 val (extend-env var1 val1 saved-env)) saved-cont)] [let3-exp1-cont (var1 var2 exp2 var3 exp3 body saved-env saved-cont) (value-of/k exp2 saved-env (let3-exp2-cont var1 val var2 var3 exp3 body saved-env saved-cont))] [let3-exp2-cont (var1 val1 var2 var3 exp3 body saved-env saved-cont) (value-of/k exp3 saved-env (let3-exp3-cont var1 val1 var2 val var3 body saved-env saved-cont))] [let3-exp3-cont (var1 val1 var2 val2 var3 body saved-env saved-cont) (value-of/k body (extend-env var1 val1 (extend-env var2 val2 (extend-env var3 val saved-env))) saved-cont)] [if-test-cont (exp2 exp3 saved-env saved-cont) (if (expval->bool val) (value-of/k exp2 saved-env saved-cont) (value-of/k exp3 saved-env saved-cont))] [diff1-cont (exp2 saved-env saved-cont) (value-of/k exp2 saved-env (diff2-cont val saved-cont))] [diff2-cont (val1 saved-cont) (let ([num1 (expval->num val1)] [num2 (expval->num val)]) (apply-cont saved-cont (num-val (- num1 num2))))] [rator-cont (rands saved-env saved-cont) (if (null? rands) (apply-procedure/k val '() saved-cont) (value-of/k (car rands) saved-env (rand-cont val '() (cdr rands) saved-env saved-cont)))] [rand-cont (proc1 vals rands saved-env saved-cont) (if (null? rands) (apply-procedure/k (expval->proc proc1) (reverse (cons val vals)) saved-cont) (value-of/k (car rands) saved-env (rand-cont proc1 (cons val vals) (cdr rands) saved-env saved-cont)))] [cons-exp1-cont (exp2 saved-env saved-cont) (value-of/k exp2 saved-env (cons-exp2-cont val saved-cont))] [cons-exp2-cont (val1 saved-cont) (apply-cont saved-cont (pair-val val1 val))] [car-cont (saved-cont) (apply-cont saved-cont (expval->car val))] [cdr-cont (saved-cont) (apply-cont saved-cont (expval->cdr val))] [null?-cont (saved-cont) (apply-cont saved-cont (bool-val (expval-null? val)))] [list-exps-cont (vals exps saved-env saved-cont) (if (null? exps) (apply-cont saved-cont (let loop ([result (pair-val val (emptylist-val))] [vals vals]) (if (null? vals) result (loop (pair-val (car vals) result) (cdr vals))))) (value-of/k (car exps) saved-env (list-exps-cont (cons val vals) (cdr exps) saved-env saved-cont)))]))) (define apply-env (lambda (env search-sym) (cases environment env [empty-env () (eopl:error 'apply-env "No binding for ~s" search-sym)] [extend-env (var val saved-env) (if (eqv? search-sym var) val (apply-env saved-env search-sym))] [extend-env-rec (p-name b-vars p-body saved-env) (if (eqv? search-sym p-name) (proc-val (procedure b-vars p-body env)) (apply-env saved-env search-sym))]))) (define value-of/k (lambda (exp env cont) (cases expression exp [const-exp (num) (apply-cont cont (num-val num))] [var-exp (var) (apply-cont cont (apply-env env var))] [proc-exp (vars body) (apply-cont cont (proc-val (procedure vars body env)))] [letrec-exp (p-name b-vars p-body letrec-body) (value-of/k letrec-body (extend-env-rec p-name b-vars p-body env) cont)] [zero?-exp (exp1) (value-of/k exp1 env (zero1-cont cont))] [let-exp (vars exps body) (if (null? vars) (value-of/k body env cont) (value-of/k (car exps) env (let-exps-cont vars '() (cdr exps) body env cont)))] [let2-exp (var1 exp1 var2 exp2 body) (value-of/k exp1 env (let2-exp1-cont var1 var2 exp2 body env cont))] [let3-exp (var1 exp1 var2 exp2 var3 exp3 body) (value-of/k exp1 env (let3-exp1-cont var1 var2 exp2 var3 exp3 body env cont))] [if-exp (exp1 exp2 exp3) (value-of/k exp1 env (if-test-cont exp2 exp3 env cont))] [diff-exp (exp1 exp2) (value-of/k exp1 env (diff1-cont exp2 env cont))] [call-exp (rator rands) (value-of/k rator env (rator-cont rands env cont))] [cons-exp (exp1 exp2) (value-of/k exp1 env (cons-exp1-cont exp2 env cont))] [car-exp (exp1) (value-of/k exp1 env (car-cont cont))] [cdr-exp (exp1) (value-of/k exp1 env (cdr-cont cont))] [null?-exp (exp1) (value-of/k exp1 env (null?-cont cont))] [emptylist-exp () (apply-cont cont (emptylist-val))] [list-exp (exps) (if (null? exps) (apply-cont cont (emptylist-val)) (value-of/k (car exps) env (list-exps-cont '() (cdr exps) env cont)))]))) (define (init-env) (empty-env)) (define value-of-program (lambda (pgm) (cases program pgm [a-program (exp1) (value-of/k exp1 (init-env) (end-cont))]))) ;; Interface. (define run (lambda (string) (value-of-program (scan&parse string)))) (provide bool-val emptylist-val num-val pair-val run)
false
48234cd81fc68be6af6c767d7761c035c6727bdc
8ad263e7b4368801cda4d28abb38c4f622e7019a
/reader-bridge.rkt
7ddfead00ce682d5d99ffc2cd9c219d708988d08
[]
no_license
LeifAndersen/expander
d563f93a983523dfa11bf4d7521ad4b5ab5cc7a6
eec8a6d973624adc7390272fa3c29a082e45e0f8
refs/heads/master
2020-02-26T17:28:17.399606
2016-06-09T15:20:27
2016-06-09T15:20:27
null
0
0
null
null
null
null
UTF-8
Racket
false
false
1,601
rkt
reader-bridge.rkt
#lang racket/base (require (prefix-in new: "syntax.rkt") (prefix-in new: "scope.rkt") "syntax-to-host-syntax.rkt" "host-syntax-to-syntax.rkt") (provide synthesize-reader-bridge-module) (define orig-eval (current-eval)) (define orig-compile (current-compile)) (define orig-resolver (current-module-name-resolver)) ;; Given a reader for the hosted module system and syntax, ;; declare a module in the host module system that provides ;; a reader for the host's syntax system (define (synthesize-reader-bridge-module mod-path reader) (define name (module-path-index-resolve (module-path-index-join mod-path #f))) (unless (module-declared? name) (define (root-of n) (if (pair? n) (car n) n)) (parameterize ([current-module-declare-name (make-resolved-module-path (root-of (resolved-module-path-name name)))] [current-eval orig-eval] [current-compile orig-compile] [current-module-name-resolver orig-resolver]) (eval `(,(namespace-module-identifier) mod '#%kernel (#%provide read-syntax) (define-values (read-syntax) ,(if (procedure-arity-includes? reader 6) (lambda (name in modname line col pos) (syntax->host-syntax (reader name in (host-syntax->syntax modname) line col pos))) (lambda (name in) (syntax->host-syntax (reader name in))))) (module* reader #f (#%provide read-syntax)))))))
false
bc0363b5615cd1a520cbd84e136c3ddc9547acde
09d42863e4425262a743d1c51955bb958970d347
/COMP-180/Insertion&QuickSort.rkt
17d52728f0d64f2133a0e1c4db091709110a7194
[ "MIT" ]
permissive
Semyonic/CourseCodes
f9211a284aeeb97c96e4b50654acc6cd32944af2
2111666e405fe54f35459930eadbe4be75ef2891
refs/heads/master
2020-04-14T16:19:09.506649
2016-01-30T11:20:31
2016-01-30T11:20:31
31,072,167
2
2
null
2016-01-30T11:20:32
2015-02-20T16:00:56
Java
UTF-8
Racket
false
false
1,131
rkt
Insertion&QuickSort.rkt
; List of Number -> LoN[sorted] (define (Qsort lon) (cond [(empty? lon) empty] [(empty? (rest lon)) lon] [else (append (Qsort (filter (lambda (x) (< x (first lon))) lon)) (filter (lambda (x) (= x (first lon))) lon) (Qsort (filter (lambda (x) (> x (first lon))) lon))) ])) ;smallers: Number LoN --> LoN ;largers: Number LoN --> LoN ;insertion-sort: LoX (X X -> Boolean) --> LoX[sorted] (define (insertion-sort lox p?) (cond [(empty? lox) empty] [else (insert (first lox) (insertion-sort (rest lox) p?) p? )])) ;insert: Number lon --> lon[sorted] (define (insert n lon p?) (cond [(empty? lon) (list n)] [else (if (p? n (first lon)) (cons n lon) (cons (first lon) (insert n (rest lon) p?)))])) (time (length (insertion-sort (build-list 1000 (lambda (x) x)) >))) (time (length (Qsort (build-list 1000 (lambda (x) x))))) (build-list 10 (lambda (x) (random 100))) (time (length (Qsort (build-list 1000 (lambda (x) (random 100))) ))) (time (length (insertion-sort (build-list 1000 (lambda (x) (random 100))) >)))
false
d325ade602b32f51f1ff98bc9ad9359c051b129a
25a6efe766d07c52c1994585af7d7f347553bf54
/gui-lib/mrlib/private/aligned-pasteboard/geometry-managed-pasteboard.rkt
9277541de8aaf15cd417d7c1ba1f6e36566c3833
[ "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
7,321
rkt
geometry-managed-pasteboard.rkt
(module geometry-managed-pasteboard mzscheme (require mzlib/class mzlib/contract mzlib/list mzlib/etc mzlib/match mred "aligned-editor-container.rkt" "interface.rkt" "alignment.rkt" "snip-lib.rkt" "pasteboard-lib.rkt") (provide/contract (make-aligned-pasteboard ((symbols 'vertical 'horizontal) . -> . class?))) ;; mixin to add geometry management to pasteboard with the give type of alignement (define (make-aligned-pasteboard type) (class* pasteboard% (aligned-pasteboard<%>) (inherit resize move-to find-first-snip refresh-delayed? begin-edit-sequence end-edit-sequence is-locked? lock) (field [needs-realign? false] [ignore-resizing? false] [alloted-width false] [alloted-height false] [aligned-min-width 0] [aligned-min-height 0] [aligned-rects empty]) ;; get-aligned-min-width (-> number?) ;; the aligned-min-width of the pasteboard (define/public (get-aligned-min-width) aligned-min-width) ;; get-aligned-min-height (-> number?) ;; the aligned-min-height of the pasteboard (define/public (get-aligned-min-height) aligned-min-height) (define/public (set-aligned-min-sizes) (dynamic-let ([ignore-resizing? true]) (for-each-snip (lambda (s) (if (is-a? s aligned-editor-snip%) (send s set-aligned-min-sizes))) (find-first-snip)) (set!-values (aligned-min-width aligned-min-height) (get-aligned-min-sizes type (find-first-snip))))) ;; set-algined-min-sizes (-> void?) ;; set the aligned min width and height of the pasteboard based on its children snips (inherit in-edit-sequence?) (define/public (aligned-min-sizes-invalid) ;; This in-edit-sequence? is not sound. It causes me to percollate invalidation ;; up the spin of my tree even when it is not visible (which refresh-delayed? ;; checks for. However, for some types of refreshed-delayed? blocks, like a ;; parent editor's edit-sequence, I have not yet figured out a way to reshedule ;; an alignment. With in-edit-sequence? blocking, I know I'll always get the ;; after-edit-sequence call where I can invoke alignment. (if (in-edit-sequence?) ;(refresh-delayed?) (set! needs-realign? true) (begin (set! needs-realign? false) (set!-values (aligned-min-width aligned-min-height) (get-aligned-min-sizes type (find-first-snip))) (let ([parent (pasteboard-parent this)]) (when parent (send parent aligned-min-sizes-invalid)))))) ;; realign (case-> (-> void?) (positive? positive? . -> . void?)) ;; called by the parent to realign the pasteboard's children (define/public (realign width height) (set! alloted-width width) (set! alloted-height height) (realign-to-alloted)) ;; realign-to-alloted (-> void?) ;; realign the snips to fill the alloted width and height (define/public (realign-to-alloted) (when (and alloted-width alloted-height) (when (not (and (positive? alloted-width) (positive? alloted-height))) (error "allotted width or height is not positive")) (dynamic-let ([ignore-resizing? true]) (let* ([first-snip (find-first-snip)] [aligned-rects (align type alloted-width alloted-height (map-snip build-rect first-snip))]) (begin-edit-sequence) (let ([was-locked? (is-locked?)]) (lock false) (for-each-snip move/resize first-snip aligned-rects) (lock was-locked?)) (end-edit-sequence))))) ;;move/resize (snip-pos? rect? . -> . void?) ;;moves and resizes the snips with in pasteboard (define move/resize (match-lambda* [(snip ($ rect ($ dim x width stretchable-width?) ($ dim y height stretchable-height?))) (move-to snip x y) (when (is-a? snip stretchable-snip<%>) (send snip stretch width height))])) ;;;;;;;;;; ;; Events ;; after-insert ((is-a?/c snip%) (is-a?/c snip%) number? number? . -> . void?) ;; called after a snip is inserted to the pasteboard (define/augment (after-insert snip before x y) (aligned-min-sizes-invalid) (inner (void) after-insert snip before x y)) ;; after-delete ((is-a?/c snip%) . -> . void?) ;; called after a snip is deleted from the pasteboard% (define/augment (after-delete snip) (aligned-min-sizes-invalid) (inner (void) after-delete snip)) ; after-reorder ((is-a?/c snip%) (is-a?/c snip%) boolean? . -> . void?) ;; called after a snip is moved in the front to back snip order (define/augment (after-reorder snip to-snip before?) (realign-to-alloted) (inner (void) after-reorder snip to-snip before?)) ;; resized ((is-a?/c snip%) . -> . void?) ;; called when a snip inside the editor is resized (define/override (resized snip redraw-now?) (super resized snip redraw-now?) (unless ignore-resizing? (aligned-min-sizes-invalid))) ;; after-edit-sequence (-> void?) ;; called after an edit-sequence ends (define/augment (after-edit-sequence) (when needs-realign? (aligned-min-sizes-invalid)) (inner (void) after-edit-sequence)) (super-new))) ;; build-rect ((is-a?/c snip%) . -> . rect?) ;; makes a new default rect out of a snip (define (build-rect snip) (make-rect (make-dim 0 (snip-min-width snip) (stretchable-width? snip)) (make-dim 0 (snip-min-height snip) (stretchable-height? snip)))) ;; get-aligned-min-sizes (((symbols 'horizontal vertical) (is-a?/c snip%)) . ->* . (number? number?)) ;; calculate the aligned min sizes for the pasteboard containing the given snips (define (get-aligned-min-sizes type init-snip) (let-values ([(x-func y-func) (if (symbol=? type 'horizontal) (values + max) (values max +))]) (let loop ([snip init-snip] [width 0] [height 0]) (cond [(boolean? snip) (values width height)] [else (loop (send snip next) (x-func (snip-min-width snip) width) (y-func (snip-min-height snip) height))])))) ;; dynamic-let is just like fluid-let but is less expensive and not safe over continuations (define-syntax (dynamic-let stx) (syntax-case stx () [(_ ((x y) ...) body body2 ...) (andmap identifier? (syntax-e #'(x ...))) (with-syntax ([(old-x ...) (generate-temporaries #'(x ...))]) #'(let ((old-x x) ...) (begin (set! x y) ... (begin0 (begin body body2 ...) (set! x old-x) ...))))])) )
true
5c520fc1253d23b1e118918ee5f2fab3e9e140d4
fc69a32687681f5664f33d360f4062915e1ac136
/private/drracket/line-summary.rkt
4aa37f5678f0ec455a474748a3ef2e170f297828
[]
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,829
rkt
line-summary.rkt
#lang racket/base (provide (struct-out line-summary) find-span-indent line-summary-indent line-summary-blank? summarize-span summarize-line summarize-line/ls classify-span classify-line) (require "editor-helpers.rkt" (only-in racket/class send)) ; A Line-class is (or/c 'code 'comment 'hash 'blank) ; An opt-nat is (or/c nat #f] ; A Line-summary is ; (line-summary nat opt-nat opt-nat opt-nat opt-nat opt-nat nat) (struct line-summary [start ; nat text ; opt-nat text-limit ; ^ ditto (correlated) hash ; opt-nat hash-limit ; ^ ditto (correlated) comm ; opt-nat (comm : nat implies hash : nat) comm-limit ; ^ ditto (correlated) limit] ; nat #:transparent) ; [listof Line-summary] -> nat ; Finds the minimum indent of the non-blank lines. (define (find-span-indent summaries) (for/fold ([acc 80]) ([summary (in-list summaries)]) (if (line-summary-blank? summary) acc (min acc (line-summary-indent summary))))) ; Line-summary -> nat ; Gets the summarized line's indent. (define (line-summary-indent summary) (cond [(or (line-summary-text summary) (line-summary-hash summary) (line-summary-limit summary)) => (λ (position) (- position (line-summary-start summary)))] [else 0])) ; Line-summary -> boolean (define (line-summary-blank? summary) (and (not (line-summary-text summary)) (not (line-summary-hash summary)))) ; Line-summary -> Line-class (define (classify-line summary) (cond [(line-summary-text summary) 'code] [(line-summary-comm summary) 'comment] [(line-summary-hash summary) 'hash] [else 'blank])) ; [listof Line-summary] -> Line-class (define (classify-span summaries) (for/fold ([acc 'blank]) ([summary (in-list summaries)]) (join-type acc (classify-line summary)))) ; Line-class Line-class -> Line-class (define (join-type a b) (cond [(or (eq? a 'code) (eq? b 'code)) 'code] [(or (eq? a 'comment) (eq? b 'comment)) 'comment] [(or (eq? a 'hash) (eq? b 'hash)) 'hash] [else 'blank])) ; summarize-span : text% (nat nat) -> [listof Line-summary] (define (summarize-span text [start (send text get-start-position)] [end (send text get-end-position)]) (let loop ([next end] [acc '()]) (if (< next start) acc (let ([summary (summarize-line text next)]) (loop (sub1 (line-summary-start summary)) (cons summary acc)))))) ; summarize-line : text% nat -> Line-summary (define (summarize-line text position) (summarize-line/ls text (find-line-start text position))) ; summarize-line : text% nat -> Line-summary (define (summarize-line/ls text-obj start) (define text #f) (define text-limit #f) (define hash #f) (define hash-limit #f) (define comm #f) (define comm-limit #f) (define limit #f) (define (get pos) (send text-obj get-character pos)) (define (scan-start pos) (case (get pos) [(#\space) (scan-start (add1 pos))] [(#\#) (set! hash pos) (scan-hash (add1 pos))] [(#\newline #\nul) (set! limit pos)] [else (set! text pos) (scan-text pos)])) (define (scan-text pos) (case (get pos) [(#\space) (scan-text (add1 pos))] [(#\#) (set! hash pos) (scan-hash (add1 pos))] [(#\newline #\nul) (set! limit pos)] [else (set! text-limit (add1 pos)) (scan-text (add1 pos))])) (define (scan-hash pos) (case (get pos) [(#\#) (scan-hash (add1 pos))] [else (set! hash-limit pos) (scan-post-hash pos)])) (define (scan-post-hash pos) (case (get pos) [(#\space) (scan-post-hash (add1 pos))] [(#\newline #\nul) (set! limit pos)] [else (set! comm pos) (scan-comment pos)])) (define (scan-comment pos) (case (get pos) [(#\newline #\nul) (set! limit pos)] [(#\space) (scan-comment (add1 pos))] [else (set! comm-limit (add1 pos)) (scan-comment (add1 pos))])) (scan-start start) (line-summary start text text-limit hash hash-limit comm comm-limit limit)) (module+ test (require "test-helpers.rkt" (only-in racket/format ~a)) (define-text%-check (check-summarize-line text) (summarize-line text 0)) (define LS line-summary) ; blank lines: (check-summarize-line "" (LS 0 #f #f #f #f #f #f 0)) (check-summarize-line " " (LS 0 #f #f #f #f #f #f 3)) (check-summarize-line " \nhi" (LS 0 #f #f #f #f #f #f 3)) ; text-only lines: (check-summarize-line "hello" (LS 0 0 5 #f #f #f #f 5)) (check-summarize-line " hello" (LS 0 2 7 #f #f #f #f 7)) (check-summarize-line "hello " (LS 0 0 5 #f #f #f #f 7)) (check-summarize-line " a b " (LS 0 2 5 #f #f #f #f 7)) (check-summarize-line "a\nb\nc" (LS 0 0 1 #f #f #f #f 1)) ; comment-only lines: (check-summarize-line "# hi" (LS 0 #f #f 0 1 2 4 4)) (check-summarize-line "## hi" (LS 0 #f #f 0 2 3 5 5)) (check-summarize-line " # hi" (LS 0 #f #f 1 2 3 5 5)) (check-summarize-line " # hi " (LS 0 #f #f 1 2 3 5 7)) ; hash-only lines: (check-summarize-line "#" (LS 0 #f #f 0 1 #f #f 1)) (check-summarize-line "##" (LS 0 #f #f 0 2 #f #f 2)) (check-summarize-line " #" (LS 0 #f #f 2 3 #f #f 3)) (check-summarize-line "# " (LS 0 #f #f 0 1 #f #f 3)) (check-summarize-line " # " (LS 0 #f #f 1 2 #f #f 3)) ; everything lines: (check-summarize-line "pass # do nothing" (LS 0 0 4 6 7 8 18 18)) (check-summarize-line "pass ## meh ##" (LS 0 0 4 6 8 9 15 15)) (check-summarize-line "pass ## meh ## " (LS 0 0 4 6 8 9 15 17)) (check-summarize-line " x = 6 # six\n more stuff" (LS 0 2 7 9 10 11 14 14)) (check-summarize-line "pass# more space" (LS 0 0 4 4 5 6 16 16)) (check-summarize-line "pass #more space" (LS 0 0 4 5 6 6 16 16)) (check-summarize-line "pass##more space" (LS 0 0 4 4 6 6 16 16)) (check-summarize-line "pass##more spa " (LS 0 0 4 4 6 6 14 16)) (check-summarize-line " ss##more spa " (LS 0 2 4 4 6 6 14 16)))
false
50e4f4e95a4e560628f393c4411db1f2735bc241
bde1fd2511c16bc4dfb3f26337eb4a8941fcb7af
/base/chapter2/sec2.2-proc-rep.rkt
280cf7865b2f7b3aaad3f10829d955c9147589f6
[]
no_license
sjhuangx/EOPL
dcb6d8c4e23f6a55de18a99c17366cdeb1ffab6e
a6475e10a955128600f964340c590b80955e0f83
refs/heads/master
2021-06-28T03:24:18.388747
2018-03-12T15:06:16
2018-03-12T15:06:16
96,590,962
1
0
null
2017-08-05T14:15:19
2017-07-08T02:34:20
Racket
UTF-8
Racket
false
false
1,205
rkt
sec2.2-proc-rep.rkt
#lang eopl (require "../../libs/utils.rkt") ;; Simple procedural representation of environments ;; Page: 40 ;; data definition: ;; Env = Var -> Schemeval ;; empty-env : () -> Env (define empty-env (lambda () (lambda (search-var) (report-no-binding-found search-var)))) ;; extend-env : Var * Schemeval * Env -> Env (define extend-env (lambda (saved-var saved-val saved-env) (lambda (search-var) (if (eqv? search-var saved-var) saved-val (apply-env saved-env search-var))))) ;; apply-env : Env * Var -> Schemeval (define apply-env (lambda (env search-var) (env search-var))) (define report-no-binding-found (lambda (search-var) (eopl:error 'apply-env "No binding for ~s" search-var))) (define report-invalid-env (lambda (env) (eopl:error 'apply-env "Bad environment: ~s" env))) (define e (extend-env 'd 6 (extend-env 'y 8 (extend-env 'x 7 (extend-env 'y 14 (empty-env)))))) (equal?? (apply-env e 'd) 6) (equal?? (apply-env e 'y) 8) (equal?? (apply-env e 'x) 7) (report-unit-tests-completed 'apply-env)
false
4e15e5a9373c1e901d44b34921d4e6560a929a41
21b370ff97102f8e39c7bbdc63c2b04622677d5e
/htdp/第二部分任意数据的处理/习题11.2.2.rkt
27deedefc2b862d930c28cb31305824177f1e871
[]
no_license
imxingquan/scheme
d8ba9a34b31cfbf796448686ff7b22491ea68cfe
531da0b60a23ac1d83deeaba1fc29dc954c55a65
refs/heads/master
2021-07-16T12:17:19.429706
2021-05-18T11:01:00
2021-05-18T11:01:00
124,641,579
0
0
null
null
null
null
UTF-8
Racket
false
false
942
rkt
习题11.2.2.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-abbr-reader.ss" "lang")((modname 习题11.2.2) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f () #f))) #| 习题11.2.2 设计函数tabulate-f 把函数f应用与一些由自然数值组成的表 具体地说,函数读入自然数 n,返回由 n 个 posn 结构体组成的表, 表的第一个元素是点(n (f n)),第二个元 素是点(n-1 (f n-1)),以此类推 |# ;; f : number -> number (define (f x) (+ (* 3 (* x x)) (+ (* -6 x) -1))) #| (define (tabulate-f n) (cond [(zero? n) empty] [else ... (tabulate-f (sub1 n)) ...])) |# (define (tabulate-f n) (cond [(zero? n) empty] [else (cons (make-posn n (f n)) (tabulate-f (sub1 n)) )])) (tabulate-f 10)
false
a6282cbe9adac1e0fa1fd7eb2011296911f67bee
0164923722367288c5b94e28d97e76047632d312
/seq-no-order/info.rkt
4b5e80fbde96c686d2e24f092eed5aa8211a70ac
[ "MIT" ]
permissive
AlexKnauth/seq-no-order
294c5402dc84897b45918e56c9a4468ac1449358
5911a6f2d4f92d115f964dbb2e55919e51db4478
refs/heads/master
2021-08-11T05:49:42.759164
2021-08-02T18:57:30
2021-08-02T18:57:30
22,124,392
3
0
null
null
null
null
UTF-8
Racket
false
false
68
rkt
info.rkt
#lang info (define scribblings '(["docs/seq-no-order.scrbl" ()]))
false
df4e8c418baff69867168e2a07a3427b3a1b297b
7759bda0d7e3b45aa77f25657c365b525f22a473
/monadic-eval/monad/monad-cache.rkt
a00f0d01ba265cd24700e59b24cbe4bad9e72778
[]
no_license
plum-umd/abstracting-definitional-interpreters
89bafe22c8f7d861c43edd2153f7309958b0c398
7a51f429227dd11b371b9a27f83b8aa0f6adb5d3
refs/heads/master
2021-08-19T07:13:31.621906
2017-11-25T04:19:30
2017-11-25T04:19:30
5,044,629
61
2
null
2017-11-25T04:19:31
2012-07-14T04:27:57
TeX
UTF-8
Racket
false
false
1,279
rkt
monad-cache.rkt
#lang racket/unit (require racket/match "../map.rkt" "../signatures.rkt" "../unparse.rkt" "../transformers.rkt") (import) (export monad^ menv^ mstore^ mcache^) ;; M ρ σ Σ a := ρ → σ → Σ → ℘(((a ∪ (failure)) × σ)) × Σ (define M (ReaderT ; ρ (FailT (StateT #f ; σ (NondetT (StateT (FinMapO PowerO) ; Σ ID)))))) (define-monad M) (define (mrun m [ρ₀ ∅] [σ₀ ∅] [Σ₀ ∅]) (run-StateT Σ₀ (run-StateT σ₀ (run-ReaderT ρ₀ m)))) (define (mret x) (match x ; disarcd cache and store [(cons svs cache) (unparse-⟨⟨maybe-v⟩×σ⟩set/discard-σ svs)])) (define ask-⊥ (lambda _ (error "unimplemented"))) (define local-⊥ (lambda _ (error "unimplemented"))) ;; menv^ impl: (define ask-env ask) (define local-env local) ;; mstore^ impl: (define get-store (bind get (compose1 return car))) (define (put-store σ) (do (cons _ Σ) ← get (put (cons σ Σ)))) (define (update-store f) (do σ ← get-store (put-store (f σ)))) ;; mcache^ impl: (define get-$ (bind get (compose1 return cdr))) (define (put-$ Σ) (do (cons σ _) ← get (put (cons σ Σ)))) (define (update-$ f) (do Σ ← get-$ (put-$ (f Σ))))
false
478ef3554c1dfb85f24195ce421ebdd6ead9e152
b9eb119317d72a6742dce6db5be8c1f78c7275ad
/SICP/2.40.rkt
7292781c98ce2dd1f71337dc26e5b6aee3470209
[]
no_license
offby1/doodles
be811b1004b262f69365d645a9ae837d87d7f707
316c4a0dedb8e4fde2da351a8de98a5725367901
refs/heads/master
2023-02-21T05:07:52.295903
2022-05-15T18:08:58
2022-05-15T18:08:58
512,608
2
1
null
2023-02-14T22:19:40
2010-02-11T04:24:52
Scheme
UTF-8
Racket
false
false
204
rkt
2.40.rkt
#lang racket (define (build-list n proc) (for/list ([i (in-range n)]) (proc i))) (define (upto n) (build-list (add1 n) values)) (map (lambda (n) (map (curryr cons n) (upto (sub1 n)))) (upto 10))
false
c39fc33a86e395fffda62e735d35405ab66f7044
a3673e4bb7fa887791beabec6fd193cf278a2f1a
/lib/racket-docs/utils/parse-class.rkt
1313b6164f1283bdfbccb5706373c3d257958dc6
[]
no_license
FDWraith/Racket-Docs
f0be2e0beb92f5d4f8aeeca3386240045a03e336
7eabb5355c19a87337f13287fbe3c10e10806ae8
refs/heads/master
2021-01-25T10:16:51.207233
2018-04-16T22:28:33
2018-04-16T22:28:33
123,346,280
1
0
null
null
null
null
UTF-8
Racket
false
false
1,995
rkt
parse-class.rkt
#lang racket (provide define-parse-class define-splicing-parse-class parse-class parse-classes) (require [for-syntax "syntax.rkt" syntax/parse racket/syntax racket/function] syntax/parse [for-template syntax/parse racket]) ; Parse class - A syntax class which both matches an expression and parses it. ; Functions as both define-syntax-class (match) and define-syntax (parse). (begin-for-syntax (define (define-gen-parse-class define-gen-syntax-class-stx) (syntax-parser [(_ id:id stxclass-option:stxparse-option ... [in-match pattern-option:pattern-option ... out-expr ...+] ...+) #:with define-gen-syntax-class define-gen-syntax-class-stx #:with (stxclass-opt-part ...) (flatten/stx #'(stxclass-option ...)) #:with ((pattern-opt-part ...) ...) (map/stx flatten/stx #'((pattern-option ...) ...)) #:with id1 (syntax-shift-phase-level #'id -1) #'(define-gen-syntax-class id stxclass-opt-part ... [pattern in-match pattern-opt-part ... #:attr out (begin out-expr ...) #:attr out1 #`(syntax-parse #'#,this-syntax ; TODO Fix ellipses, then use in-match directly [(~var x id1) (attribute x.out)])] ...)]))) (define-syntax define-parse-class (define-gen-parse-class #'define-syntax-class)) (define-syntax define-splicing-parse-class (define-gen-parse-class #'define-splicing-syntax-class)) (define-syntax parse-class (syntax-parser [(_ id:id) #:with id.out (format-id #'id #:source #'id "~a.out" (syntax-e #'id)) #'(attribute id.out)])) (define-syntax parse-classes (syntax-parser [(_ (id:id (~literal ...))) #:with id.out (format-id #'id #:source #'id "~a.out" (syntax-e #'id)) #'(attribute id.out)]))
true
ec26c8a779114a3b2bf66e8af0994baf5abe67ee
5633f66a941b418cf6c18724a78de36de82ac73c
/share/util.rkt
e205472ee5282bc3dab860909040b53cfbfe2587
[]
no_license
zvbchenko/Racket_Compiler
d21c546c05bedf8c0855be4fdb81343cff2c8b81
ab3968381895aa0d54b26427d1b0a2291c77a755
refs/heads/main
2023-07-13T07:59:19.641353
2021-08-17T18:36:57
2021-08-17T18:36:57
397,353,022
0
0
null
null
null
null
UTF-8
Racket
false
false
2,237
rkt
util.rkt
#lang racket (require racket/set "a9-graph-lib.rkt" "a9-compiler-lib.rkt") (provide (all-defined-out)) (define (aloc? s) (and (symbol? s) (not (register? s)) (not (label? s)) (regexp-match-exact? #rx".+\\.[0-9]+" (symbol->string s)))) (define (loc? loc) (or (aloc? loc) (rloc? loc))) (define (rloc? loc) (or (register? loc) (fvar? loc))) (define (triv? triv) (or (opand? triv) (label? triv))) (define (opand? opand) (or (int64? opand) (loc? opand))) ; Any -> Boolean ; Return true if the given offset is valid (define (dispoffset? n) (and (integer? n) (zero? (remainder n 8)))) (define (valid-addr? a) (match a [`(,rbp ,b ,o) #:when (and (number? o) (register? rbp) (member b '(+ -))) #t] [`(,reg1 + ,reg2) #:when (and (register? reg1) (register? reg2)) #t] [_ #f])) (define (mops-addr? a) (match a [`(,reg + ,num) #:when (and (number? num) (equal? reg (current-frame-base-pointer-register))) #t] [_ #f])) ; Any -> Boolean ; Return true if the given s is a label (define (label? s) (and (symbol? s) (regexp-match-exact? #rx"L\\..+\\.[0-9]+" (symbol->string s)))) (define (valid-binop? b) (member b '(+ * - bitwise-and bitwise-ior bitwise-xor arithmetic-shift-right))) (define (cmp? c) (member c '(neq? eq? < <= > >=))) (define (fbp? r) (eq? r (current-frame-base-pointer-register))) (define (ascii-char-literal? x) (and (char? x) (<= 40 (char->integer x) 176))) (define (fixnum? x) (int-size? 61 x)) (define (uint8? x) (<= 0 255)) (define (prim-f? x) (or (cmp? x) (member x '(vector-set! vector-length make-vector vector-ref procedure-arity cdr car cons vector? procedure? pair? not error? ascii-char? void? empty? boolean? fixnum? * + - eq? < <= > >=)))) (define (primop? x) (or (cmp? x) (prim-f? x) (member x '(closure-ref closure-apply)))) (define (not-reserved? r) (not (member r '(if let letrec lambda void error)))) (define (macro-id? m) (member m '(and or quote vector begin)))
false
f1a84926365efcb9e8a62f294f1a2b444f0e7c33
f3e1d44eb1780bd5a3fbe3f61c560f18c2447f48
/semantics/reduction.rkt
8e5e87d707c4868b9cd23f0a96590aa39022cc0f
[]
no_license
willemneal/decompose-plug
afdda44f0182708dae80610dfd98ce8b13af4f04
5bb1acff487d055386c075581b395eb3cfdc12e9
refs/heads/master
2020-12-24T06:24:57.820701
2011-12-07T00:45:16
2011-12-07T00:45:16
null
0
0
null
null
null
null
UTF-8
Racket
false
false
5,268
rkt
reduction.rkt
#lang racket/base (require (except-in redex/reduction-semantics plug) racket/list racket/set racket/match "patterns.rkt" "common.rkt" (only-in "syntax-directed-match-total.rkt" [matches total-matches/proc])) (provide reduction reduces reductions/multi reductions*/multi inst plug join has-context) (define-extended-language reduction patterns (r a :hole (:var x) (:app f r) (:in-hole r r) (:cons r r) (:hide-hole r)) (s (r (x ...)) ; optional freshness declarations r) (f (side-condition any_1 (procedure? (term any_1))))) (define-metafunction reduction inst : r b -> (tuple t bool) [(inst a b) (tuple a :false)] [(inst :hole b) (tuple :hole :true)] [(inst (:var x) b) (tuple (lookup b x) (has-context (lookup b x)))] [(inst (:in-hole r_1 r_2) b) (plug C (inst r_2 b)) (where (tuple C bool) (inst r_1 b))] [(inst (:cons r_1 r_2) b) (join (inst r_1 b) (inst r_2 b))] [(inst (:app f r) b) (tuple (meta-app f t) (has-context (meta-app f t))) (where (tuple t bool) (inst r b))] [(inst (:hide-hole p) b) (tuple t :false) (where (tuple t bool) (inst p b))]) (define-metafunction reduction plug : C (tuple t bool) -> (tuple t bool) [(plug :hole (tuple t bool)) (tuple t bool)] [(plug (:left C t_r) (tuple t bool)) (join (plug C (tuple t bool)) (tuple t_r :false))] [(plug (:right t_l C) (tuple t bool)) (join (tuple t_l :false) (plug C (tuple t bool)))]) #; (define-metafunction reduction plug : C (tuple t bool) -> (tuple t bool) [(plug :hole (tuple t bool)) (tuple t bool)] [(plug (:left C t_r) (tuple t bool)) (join (plug C (tuple t bool)) (tuple t_r (has-context t_r)))] [(plug (:right t_l C) (tuple t bool)) (join (tuple t_l (has-context t_l)) (plug C (tuple t bool)))]) #; (define-metafunction reduction plug : C (tuple t bool) -> (tuple t bool) [(plug :hole (tuple t bool)) (tuple t bool)] [(plug (:left C_1 t_r) (tuple C_2 bool_1)) (tuple (:left C_3 t_r) (∨ bool_1 (has-context t_r))) (where (tuple C_3 bool_2) (plug C_1 (tuple C_2 bool_1)))] [(plug (:left C_l t_r) (tuple t bool_1)) (tuple (:cons t_l t_r) (∨ bool_2 (has-context t_r))) (where (tuple t_l bool_2) (plug C_l (tuple t bool_1)))] [(plug (:right t_l C_1) (tuple C_2 bool_1)) (tuple (:right t_l C_3) (∨ bool_2 (has-context t_1))) (where (tuple C_3 bool_2) (plug C_1 (tuple C_2 bool_1)))] [(plug (:right t_l C_r) (tuple t bool_1)) (tuple (:cons t_l t_r) (∨ bool_2 (has-context t_1))) (where (tuple t_r bool_2) (plug C_r (tuple t bool_1)))]) (define-metafunction reduction join : (tuple t bool) (tuple t bool) -> (tuple t bool) [(join (tuple C :true) (tuple t :false)) (tuple (:left C t) :true)] [(join (tuple t :false) (tuple C :true)) (tuple (:right t C) :true)] [(join (tuple t_1 bool_1) (tuple t_2 bool_2)) (tuple (:cons t_1 t_2) (∨ bool_1 bool_2))]) (define-metafunction reduction ∨ : bool bool -> bool [(∨ :false :false) :false] [(∨ bool_1 bool_2) :true]) (define-metafunction reduction has-context : t -> bool [(has-context a) :false] [(has-context (:cons t_1 t_2)) (∨ (has-context t_1) (has-context t_2))] [(has-context t) :true]) (define-metafunction reduction lookup : b x -> t [(lookup (set (pair x_0 t_0) ... (pair x_i t_i) (pair x_i+1 t_i+1) ...) x_i) t_i]) (define-metafunction reduction meta-app : f t -> t [(meta-app f t) ,((term f) (term t))]) (define-judgment-form reduction #:mode (matches I I I O) #:contract (matches G t p b) [(matches G t p b_i) (where (b_0 ... b_i b_i+1 ...) (total-matches G t p))]) (define-metafunction reduction [(total-matches G t p) ,(total-matches/proc (term G) (term p) (term t))]) (define-judgment-form reduction #:mode (reduces I I I O I) #:contract (reduces G t p t s) [(reduces G t p t_^′ r) (matches G t p b) (where (tuple t_^′ bool) (inst r b))] ; Rules with freshness declarations (not shown in paper) [(reduces G t p t_^′ (r (x ...))) (matches G t p b) (where (tuple t_^′ bool) (inst r (add-fresh b t (x ...))))]) (define-metafunction reduction [(add-fresh b t (x ...)) ,(add-fresh/proc (term b) (term t) (term (x ...)))]) (define (reductions/multi language rules to-reduce) (define apply-rule (match-lambda [(list p r) (judgment-holds (reduces ,language ,to-reduce ,p t ,r) t)] [(list p r xs) (judgment-holds (reduces ,language ,to-reduce ,p t (,r ,xs)) t)])) (remove-duplicates (append-map apply-rule rules))) (define (reductions*/multi language rules to-reduce) (define seen (set)) (define irred (set)) (let loop ([t to-reduce]) (unless (set-member? seen t) (set! seen (set-add seen t)) (define ts (reductions/multi language rules t)) (if (empty? ts) (set! irred (set-add irred t)) (for-each loop ts)))) (set-map irred values)) (define (add-fresh/proc bindings wrt vars) (for/fold ([b bindings]) ([x vars] [s (variables-not-in wrt vars)]) (match b [`(set . ,others) `(set (pair ,x ,s) ,@others)])))
false
d42af85c6ea6ea32854f26219d31fdae2ddbe623
3b2cf17b2d77774a19e9a9540431f1f5a840031e
/src/lang/racket-ffi/whalesong-lib.rkt
e232f59b81e3fd0f1292c50abcb554b8a08bb4a8
[]
no_license
brownplt/pyret-lang-resugarer
5bfaa09e52665657abad8d9d863e8915e0029a29
49519679aefb7b280a27938bc7bfbaaecc0bd4fc
HEAD
2016-09-06T03:59:24.608789
2014-06-27T03:45:02
2014-06-27T03:45:02
13,936,477
1
1
null
null
null
null
UTF-8
Racket
false
false
5,904
rkt
whalesong-lib.rkt
#lang whalesong ; Miscellaneous whalesong functions (require (except-in "../runtime.rkt" raise) "../string-map.rkt" "../ffi-helpers.rkt") (provide (rename-out [read-sexpr-pfun %read-sexpr] [read-sexprs-pfun %read-sexpr-list] [sexp-obj %PYRET-PROVIDE])) ; read-sexpr: Convert an sexpr string into nested Pyret lists. ; Symbols are wrapped in ("symbol" ***). (define read-sexpr-pfun (p:pλ (pyret-str) "Take a string as input, and parse it into an s-expression. Each s-expression is a number, symbol, string, or a list of s-expressions surrounded by parenthesis and separated by whitespace. Parenthesized lists are converted into Pyret lists, and strings are each converted into a list [\"string\", <the-string>]. For example, read-sexpr(\"((-13 +14 88.8) cats ++ \\\"dogs\\\")\") will return [[-13, 14, 88.8], \"cats\", \"++\", [\"string\", \"dogs\"]] " (ffi-wrap (sexpr->list (parse-expr (ffi-unwrap pyret-str)))))) (define read-sexprs-pfun (p:pλ (pyret-str) "Read a sequence of s-expressions from a string. See read-sexpr." (ffi-wrap (sexpr->list (parse-exprs (ffi-unwrap pyret-str)))))) (define (sexpr->list x) (cond [(list? x) (map sexpr->list x)] [(symbol? x) (symbol->string x)] [(string? x) (list "string" x)] [x x])) (define (parse-expr str) (parse (action first (seq expr eof)) str)) (define (parse-exprs str) (parse (action first (seq exprs eof)) str)) #| Top-down Parsing |# (define-struct succ (value input) #:transparent) (define-struct fail () #:transparent) (define-struct buffer (str index) #:transparent) (define (parse x str) (define (raise-read-sexpr-exn str) (raise (p:pyret-error p:dummy-loc "read-sexpr" (format "read-sexpr: Invalid s-expression: \"~a\"" str)))) (let [[answer (x (buffer str 0))]] (if (succ? answer) (succ-value answer) (raise-read-sexpr-exn str)))) (define (eof? input) (eq? (string-length (buffer-str input)) (buffer-index input))) (define eof (λ (input) (if (eof? input) (succ (void) input) (fail)))) (define (char pred?) (λ (input) (if (eof? input) (fail) (let [[c (string-ref (buffer-str input) (buffer-index input))]] (if (pred? c) (succ (make-string 1 c) (buffer (buffer-str input) (+ (buffer-index input) 1))) (fail)))))) (define (star x [result (list)]) (λ (input) (if (eof? input) (succ result input) (let [[answer (x input)]] (if (succ? answer) ((star x (append result (list (succ-value answer)))) (succ-input answer)) (succ result input)))))) (define (option . xs) (λ (input) (if (empty? xs) (fail) (let [[answer ((car xs) input)]] (if (succ? answer) answer ((apply option (cdr xs)) input)))))) (define (seq . xs) (λ (input) (if (empty? xs) (succ (list) input) (let [[answer ((car xs) input)]] (if (succ? answer) (let [[answers ((apply seq (cdr xs)) (succ-input answer))]] (if (succ? answers) (succ (cons (succ-value answer) (succ-value answers)) (succ-input answers)) (fail))) (fail)))))) (define (action f x) (λ (input) (let [[answer (x input)]] (if (succ? answer) (succ (f (succ-value answer)) (succ-input answer)) (fail))))) (define (plus x) (action (λ (x) (cons (first x) (second x))) (seq x (star x)))) (define-syntax-rule (tie-knot x) (λ (input) (x input))) #| Reading S-expressions |# (define whitespace (star (char char-whitespace?))) (define num (action (λ (x) (let [[sign (first x)] [digits (second x)]] (* (if (equal? sign "-") -1 1) (string->number (apply string-append digits))))) (seq (option (char (λ (c) (eq? c #\-))) (char (λ (c) (eq? c #\+))) (seq)) (plus (char (λ (c) (or (char-numeric? c) (eq? c #\.)))))))) (define string (action (λ (x) (apply string-append (second x))) (seq (char (λ (c) (eq? c #\"))) (star (char (λ (c) (not (eq? c #\"))))) (char (λ (c) (eq? c #\")))))) (define symbol-chars (string->list "~!@#$%^&*-=_+?,./;:<>|")) (define (symbol-char? c) (or (char-alphabetic? c) (char-numeric? c) (member c symbol-chars))) (define symbol (action (λ (x) (string->symbol (apply string-append x))) (plus (char symbol-char?)))) (define (token x) (action (λ (x) (second x)) (seq whitespace x whitespace))) (define exprs (star (token (tie-knot expr)))) (define parens (action (λ (x) (second x)) (seq (token (char (λ (c) (eq? c #\()))) exprs (token (char (λ (c) (eq? c #\)))))))) (define expr (token (option parens string num symbol))) (define (f x) (parse-expr x)) #| Tests |# #| (parse num "3848a9") (parse string "\"some chars\"blarg") (parse symbol "symbool gogo") (parse-expr "3") (parse-expr "()") (parse-expr "(1 2)") (parse-expr "(( ()394 qqv?#%^fu8 ++ \"st ring\")( ))") (parse-expr "+") (parse-expr "++") (parse-expr "-385") (parse-expr "3.48") (parse-expr "+3.48") (parse-exprs "1 2 3") (parse-exprs "- 385") (parse-exprs "(_) (3 4)") |# (define sexp-obj (p:mk-object (make-string-map (list (cons "read-sexpr" read-sexpr-pfun) (cons "read-sexprs" read-sexprs-pfun)))))
true
d070530ff0e7990b940b6d84611e3b7291242cf3
305866aac39673ed935f04e3cfa9bfa147fe9836
/201309-racketcon/pixhunt.rkt
56c3bed5e4d001e23a66256b0d37778a9c7de053
[]
no_license
jeapostrophe/presentations
848fd8a5dbc9251a49ad31518382001bb943174f
b7279f5bcf03515320aace0c8f3d4f4efb0f65dc
refs/heads/master
2021-06-08T19:55:57.891944
2021-03-07T16:42:30
2021-03-07T16:42:30
13,227,978
6
0
null
null
null
null
UTF-8
Racket
false
false
1,471
rkt
pixhunt.rkt
#lang racket/gui (define (hunt p) (define f (new frame% [label ""])) (define b (make-object bitmap% p)) (define w (send b get-width)) (define h (send b get-height)) (define CX 0) (define CY 0) (define mcanvas% (class* canvas% () (define/override (on-char k) (match (send k get-key-code) [ 'left (set! CX (sub1 CX))] ['right (set! CX (add1 CX))] [ 'up (set! CY (sub1 CY))] [ 'down (set! CY (add1 CY))] [else (void)]) (send f set-label (format "~a,~a" CX CY)) (send c refresh-now)) (super-new))) (define c (new mcanvas% [parent f] [paint-callback (λ (c dc) (send dc set-background "pink") (send dc clear) (define cw (send c get-width)) (define ch (send c get-height)) (define it (send dc get-transformation)) (send dc set-smoothing 'unsmoothed) (send dc set-scale (add1 (/ cw w)) (add1 (/ ch h))) (send dc draw-bitmap b 0 0) (send dc set-brush (new brush% [color "white"])) (send dc set-pen (new pen% [width 0] [color "white"])) (send dc draw-rectangle CX CY 1 1) (send dc set-transformation it))])) (send f show #t) (printf "~a\n" p)) (module+ main (command-line #:args (p) (hunt p)))
false
52fd8fb0f3d9d3a65a10a47b31af08258de1d809
5bbc152058cea0c50b84216be04650fa8837a94b
/experimental/postmortem/experiments/what-does-contract-profile-measure/typed.rkt
8cd7b06828d2c8b5f34d356727ec3e0baaefca4b
[]
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
697
rkt
typed.rkt
#lang racket/base (module original typed/racket/base (: make-truth (-> Any Boolean)) (define (make-truth x) #t) (provide make-truth)) (module slow-contract typed/racket/base (define-type Boolean (U #t #f 0 1 2 3 4 5 6 7 8 9 10)) (: make-truth (-> Any Boolean)) (define (make-truth x) #t) (provide make-truth)) (module slow-function typed/racket/base (: make-truth (-> Any Boolean)) (define (make-truth x) (for ([i (in-range 200)]) (boolean? #t)) #t) (provide make-truth)) (require ;'original ;'slow-contract 'slow-function ) (define (main) (for ([i (in-range 999999)]) (make-truth i))) (require contract-profile) (contract-profile-thunk main)
false
4d969a7b5643ccf49524611c418c9f8b6176043d
bfe5286a7948115219be4c38e7b8a4e9f0e86413
/common.rkt
3ed445801624e1882f3e279c7db779143074f038
[]
no_license
bennn/racket-minus-contracts
3c6bfeea0ea9dbebe1d81fe01f12b80a30e5d0c8
17feb42d63777afac0ea17b6fba6dcd5ba50baaa
refs/heads/master
2021-06-07T05:41:48.305956
2018-02-19T00:47:46
2018-02-19T00:47:46
42,135,816
2
1
null
2016-01-02T00:51:36
2015-09-08T19:58:35
Racket
UTF-8
Racket
false
false
4,635
rkt
common.rkt
#lang racket/base (provide backup-dir ;; Path-String ;; Directory to save overwritten files to. contract.rkt ;; Path-String ;; Path fragment, locates the contract.rkt file within a Racket install overridden-files ;; (Listof String) ;; List of filenames that the patch will modify ignore-all-patchfile ;; String ;; Name of the .patch file that ignores all contracts ignore-some-patchfile ;; String ;; Name of the .patch file that ignores certain contracts. patchfile-template ;; String ;; Name of the patchfile template used to fill the ignore-some-patchfile debug ;; #'(-> Boolean String Void) ;; Macro, prints the second argument if the first is #t recompile ;; #'(-> Path-String Boolean) ;; Recompile the Racket installation rooted at the first argument. ;; Return a flag indicating whether the build was successful. infer-rkt-dir ;; (-> (U #f Path-String)) ;; Infer the location of the user's Racket installation by searching ;; for the `racket` executable parse-rkt-dir ;; (-> (U #f Path-String) (U #f Path-String)) ;; Check that the argument is the root of a Racket install. ;; Return #f on failure. read-rkt-dir ;; (-> (U #f Path-String)) ;; Query the user for their favorite Racket install. ;; Return #f if they lied and gave an argument that was not a Racket install. save-backups ;; (-> Path-String Void) ;; Save the files to-be-overwritten that live inside the directory. restore-backups ;; (-> Path-String Void) ;; Move already-saved backup files back to the directory. ) (require (only-in racket/list last) (only-in racket/string string-split) (only-in racket/system system)) ;; ============================================================================= ;; Constants (define backup-dir "./_backup") (define contract.rkt "racket/collects/racket/contract.rkt") (define overridden-files '("racket/collects/racket/contract/private/base.rkt" "racket/collects/racket/contract/private/provide.rkt")) (define ignore-all-patchfile "ignore-all-contracts.patch") (define ignore-some-patchfile "ignore-some-contracts.patch") (define patchfile-template "ignore-some-contracts.patch.template") ;; ----------------------------------------------------------------------------- ;; Print a message if the flag `v?` is set (define-syntax-rule (debug v? msg) (when v? (displayln (string-append "[INFO] " msg)))) ;; Recompile a racket install. Skip building the docs to save time. (define (recompile rkt-dir [only-this-file #f]) (parameterize ([current-directory rkt-dir]) (if only-this-file (system (format "raco make -v ~a" only-this-file)) (system "env PLT_SETUP_OPTIONS='-D' make")))) ;; ----------------------------------------------------------------------------- ;; Try to guess the correct racket installation (define (infer-rkt-dir) (define p (find-executable-path "racket")) (define s (and p (path->string p))) (define m (and s (regexp-match (regexp "^(.*)/racket/bin/racket$") s))) (and m (cadr m))) ;; Ensure that the path-string "looks like" a Racket install (define (parse-rkt-dir dir) (if (or (not dir) (not (directory-exists? dir))) (begin (when dir (printf "Warning: directory '~a' does not exist\n" dir)) #f) (and (for/and ([o-file (in-list overridden-files)]) (or (file-exists? (string-append dir "/" o-file)) (and (printf "Warning: file '~a' does not exist under directory '~a'\n" o-file dir) #f))) dir))) ;; Prompt user to enter a path-string to their Racket install. (define (read-rkt-dir) (printf "Enter the full path to your Racket install (or re-run with the --racket flag):\n") (define rkt (read-line)) (when (eof-object? rkt) (raise-user-error 'config "Got EOF, shutting down.")) (parse-rkt-dir rkt)) ;; ----------------------------------------------------------------------------- ;; Copy backup files to some place. ;; (: copy-backups (-> Path-String (U 'save 'restore) Void)) (define (copy-backups rkt-dir mode) (for ([o-file (in-list overridden-files)]) (define orig (string-append rkt-dir "/" o-file)) (define bk (string-append backup-dir "/" (last (string-split o-file "/")))) (case mode [(save) (copy-file orig bk #t)] [(restore) (copy-file bk orig #t)] [else (error 'copy-backups (format "Unknown mode '~a'" mode))]))) (define (save-backups rkt-dir) (unless (directory-exists? backup-dir) (make-directory backup-dir)) (copy-backups rkt-dir 'save)) (define (restore-backups rkt-dir) (copy-backups rkt-dir 'restore))
true
2e744e283e7c57bba0c915e24a94163d8678b59c
5687ac22fb543ae1f3ba27a1657bdeaaaada65ee
/algebraic/class/monoid.rkt
7f679459e26b1baba9c340c145651974e1c18876
[ "MIT" ]
permissive
anthonyquizon/racket-algebraic
9e78dde48f739578bd9c209d7eea062c0be67e8c
9275cd1a3f2514fd6779b56384443043411ba9cc
refs/heads/master
2022-01-07T22:30:39.643733
2019-07-12T21:44:05
2019-07-12T21:44:05
null
0
0
null
null
null
null
UTF-8
Racket
false
false
1,379
rkt
monoid.rkt
#lang algebraic/racket/base (require algebraic/class/semigroup) (provide (all-defined-out)) ;;; ---------------------------------------------------------------------------- ;; The class of monoids (types with an associative binary operation that has ;; an identity). ;; ;; Instances should satisfy the following laws: ;; ;; * x <> mempty = x ;; ;; * mempty <> x = x ;; ;; * x <> (y <> z) = (x <> y) <> z (Semigroup law) ;; ;; * mconcat = foldr (<>) mempty ;; ;; The method names refer to the monoid of lists under concatenation, but ;; there are many other instances. ;; ;; Some types can be viewed as a monoid in more than one way, e.g. both ;; addition and multiplication on numbers. In such cases we often define ;; newtypes and make those instances of Monoid, e.g. Sum and Product. (class Monoid ;; Identity of mappend ;; ;; mempty :: a [mempty] ;; An associative operation ;; ;; __NOTE__: This method is redundant and has the default implementation ;; mappend = (<>). ;; ;; mappend :: a -> a -> a [mappend <>] ;; Fold a list using the monoid. ;; ;; For most types, the default definition for 'mconcat' will be used, but ;; the function is included in the class definition so that an optimized ;; version can be provided for specific types. ;; ;; mconcat :: [a] -> a [mconcat (>> foldr mappend mempty)] minimal ([mempty]))
false
286d2f32d0b94aa6ee1508a09de5e04bb9ed4aad
564c81d365a21dae0a16c6970c5ad9650b25e39a
/Racket/W1/hw4.rkt
0610f98b2860d8a4ade6a8cf9b352e74bdcddae0
[]
no_license
0neir0s/plt-course
2e9991b82e39859322e1de1434dc4bb9ddedf0b9
7b7905d2d0df5614ac789b91a167ad5b41dfaba5
refs/heads/main
2023-04-23T23:38:17.876100
2021-04-23T19:37:33
2021-04-23T19:37:33
358,356,211
0
0
null
null
null
null
UTF-8
Racket
false
false
1,993
rkt
hw4.rkt
#lang racket (provide (all-defined-out)) ;; so we can put tests in a second file (define (sequence low high stride) (if (> low high) null (cons low (sequence (+ low stride) high stride)))) (define (string-append-map xs suffix) (map (lambda (x) (string-append x suffix)) xs)) (define (list-nth-mod xs n) (cond [(< n 0) (error "list-nth-mod: negative number")] [(null? xs) (error "list-nth-mod: empty list")] [#t (let* ([i (remainder n (length xs)) ]) (car (list-tail xs i)))])) (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 (n) (cons (if (= (remainder n 5) 0) (- 0 n) n) (lambda () (f (+ n 1)))))]) (lambda () (f 1)))) (define dan-then-dog (letrec ([pics (list "dan.jpg" "dog.jpg")] [f (lambda (n) (cons (list-nth-mod pics n) (lambda () (f (+ n 1)))))]) (lambda () (f 0)))) (define (stream-add-zero s) (letrec ([f (lambda () (cons (cons 0 (car (s))) (stream-add-zero (cdr (s)))))]) f)) (define (cycle-lists xs ys) (letrec ([f (lambda (i) (cons (cons (list-nth-mod xs i) (list-nth-mod ys i)) (lambda () (f (+ i 1) ))))]) (lambda () (f 0)))) (define (vector-assoc v vec) (letrec ([l (vector-length vec)] [f (lambda (c) (if (>= c l) #f (let ([val (vector-ref vec c)]) (cond [(not (pair? val)) (f (+ c 1))] [(equal? v (car val)) val] [#t (f (+ c 1))]))))]) (f 0))) (define (cached-assoc xs n) (letrec ([pos 0] [cache (build-vector n (lambda (x) #f))] [f (lambda (v) (letrec ([vecval (vector-assoc v cache)] [checker (lambda () (let* ([aval (assoc v xs)]) (and aval (begin (print aval) (vector-set! cache pos aval) (set! pos (remainder (+ pos 1) n)) aval))))]) (or vecval (checker))))]) f))
false
1fb47039463c2c7b7905a9fb17dee458ac638531
ee41ac08f0dc02c720636b239feb9f74868b1367
/dissertation/justification.scrbl
5dc7bb4b5b9e7b46e19558eb985598c6f69432b4
[ "MIT" ]
permissive
florence/esterel-calculus
80535dd393ac39abd474b6057e2d1bbc7ea5a3d9
b4ca80479150933d9c21f2fd463da341cfb4c5f9
refs/heads/master
2022-09-05T00:45:30.664730
2022-06-28T00:11:01
2022-06-28T00:11:01
63,906,736
3
1
null
null
null
null
UTF-8
Racket
false
false
818
scrbl
justification.scrbl
#lang scribble/book @[require "lib/util.rkt"] @title[#:style paper-title-style #:tag "just"]{Justifying the Calculus} The five properties I promise the Calculus for Esterel would have are: Syntactic, Local, Consistent, Sound, and Adequate. This section justifies that the calculus has each of these properties. This section relies heavily on the background given in @secref["background-circuits"], as well as the descriptions of the properties given in @secref["intro"]. @include-section["justification/syntactic.scrbl"] @include-section["justification/local.scrbl"] @include-section["justification/consistent.scrbl"] @include-section["justification/setup.scrbl"] @include-section["justification/soundness.scrbl"] @include-section["justification/adequacy.scrbl"] @;@include-section["justification/together.scrbl"]
false
b1c3ff587963fd4e3d10b59c3ec020ebf634a880
ee1c7dca55b3f278b446ece3b39fc0e461987648
/racket/keyboard.rkt
722d6e06bb35f1228aa6ad011eeb0e2e281f8708
[ "Zlib" ]
permissive
gcr/steno-keyboard-generator
123c9df6fa357c3b943e3a1bf5910d439beba177
7c6e8a88992a0f022a092776ae917541da96e404
refs/heads/master
2021-01-22T14:24:36.280225
2012-06-03T05:57:03
2012-06-03T05:57:03
4,531,896
6
0
null
null
null
null
UTF-8
Racket
false
false
5,277
rkt
keyboard.rkt
#lang racket (require racket/gui racket/draw slideshow/pict "key.rkt") (provide keyboard) (define tint-map (hash "control" (make-object color% 170 180 190) "*" (make-object color% 255 128 64) "A" (make-object color% 157 243 72) "C" (make-object color% 176 52 50) "B" (make-object color% 128 0 0) "E" (make-object color% 238 167 51) "D" (make-object color% 127 129 0) "G" (make-object color% 0 128 131) "F" (make-object color% 0 128 1) "I" (make-object color% 88 89 21) "H" (make-object color% 197 89 211) "K" (make-object color% 129 0 127) "J" (make-object color% 1 0 128) "M" (make-object color% 132 63 0) "L" (make-object color% 127 255 254) "O" (make-object color% 87 100 129) "N" (make-object color% 255 0 134) "Q" (make-object color% 82 15 82) "P" (make-object color% 0 127 255) "S" (make-object color% 0 255 0) "R" (make-object color% 0 254 129) "U" (make-object color% 188 243 237) "T" (make-object color% 127 0 253) "W" (make-object color% 242 106 191) "V" (make-object color% 255 255 128) "Y" (make-object color% 115 44 174) "X" (make-object color% 255 255 0) "Z" (make-object color% 255 0 0))) (define color-groups (list (list (set "S-" "T-" "P-" "K" "W") "Z") (list (set "T-" "P-" "K" "W") "G") (list (set "-P" "L" "B" "G") "J") (list (set "-P" "L" "B" "G") "J") (list (set "-S" "-R" "B" "G") "control") (list (set "F" "-P" "L" "-T") "control") (list (set "T-" "P-" "H") "N") (list (set "K" "W" "R-") "Y") (list (set "B" "G" "-S") "X") (list (set "K" "P-") "X") (list (set "S-" "R-") "V") (list (set "K" "W") "Q") (list (set "E" "U") "I") (list (set "K" "R-") "C") (list (set "-P" "B") "N") (list (set "-P" "L") "M") (list (set "P-" "H") "M") (list (set "H" "R-") "L") (list (set "T-" "K") "D") (list (set "P-" "W") "B") (list (set "T-" "P-") "F") (list (set "B" "G") "K") (list (set "W") "W") (list (set "U") "U") (list (set "O") "O") (list (set "H") "H") (list (set "E") "E") (list (set "A") "A") (list (set "Z") "Z") (list (set "F") "V") (list (set "L") "L") (list (set "K") "K") (list (set "G") "G") (list (set "F") "F") (list (set "B") "B") (list (set "R-") "R") (list (set "D") "D") (list (set "-R") "R") (list (set "P-") "P") (list (set "-P") "P") (list (set "T-") "T") (list (set "-T") "T") (list (set "S-") "S") (list (set "-S") "S") (list (set "*") "*"))) (define (pick-color ltr pressed-keys) (define base-color (make-object color% 16 16 16)) ;128 118 100)) (if (member ltr pressed-keys) ;; Fold out the remaining ones. (let loop ([groups-to-go color-groups] [keyset (list->set pressed-keys)]) (match-define (list group-set result-letter) (first groups-to-go)) (cond [(empty? groups-to-go) (error 'pick-color "Color not found! ~s for key ~s" keyset ltr)] [(subset? group-set keyset) ;; Found a group (if (set-member? group-set ltr) (hash-ref tint-map result-letter) (loop (rest groups-to-go) (set-subtract keyset group-set)))] [else (loop (rest groups-to-go) keyset)])) base-color)) (define (pick-style ltr pressed-keys) (if (member ltr pressed-keys) 'bold 'normal)) (define (pick-text-color ltr pressed-keys) (if (or (empty? pressed-keys) (member ltr pressed-keys)) (make-object color% 255 255 255) (make-object color% 128 128 128))) (define (sanitize-ltr ltr) (regexp-replace* "-" ltr "")) (define (keyboard pressed-keys) (define-syntax-rule (b ltr arg ...) (bkey (pick-color ltr pressed-keys) (pick-text-color ltr pressed-keys) (sanitize-ltr ltr) (pick-style ltr pressed-keys) arg ...)) (define-syntax-rule (t ltr arg ...) (tkey (pick-color ltr pressed-keys) (pick-text-color ltr pressed-keys) (sanitize-ltr ltr) (pick-style ltr pressed-keys) arg ...)) (inset (ht-append 20 ; S key (b "S-" #:height 210) ; Rest of keyboard, which is: (vl-append 10 (ht-append 20 ; Left side: TPH, KWR (vl-append 10 (ht-append 20 (t "T-") (t "P-") (t "H")) (ht-append 20 (b "K") (b "W") (b "R-"))) (b "*" #:height 210 #:width 80) ; Right side: FPLTD, RBGSZ (vl-append 10 (hc-append 20 (t "F") (t "-P") (t "L") (t "-T") (t "D")) (hc-append 20 (b "-R") (b "B") (b "G") (b "-S") (b "Z"))) ) ; Vowels (ht-append (blank 80) (blank 30) (b "A") (blank 10) (b "O") (blank 80) (b "E") (blank 10) (b "U")))) 4)) (define (save-pict pict file [kind 'png]) (define width (inexact->exact (ceiling (pict-width pict)))) (define height (inexact->exact (ceiling (pict-height pict)))) (define bm (make-object bitmap% width height #f #t)) (define dc (new bitmap-dc% [bitmap bm])) (send dc set-smoothing 'aligned) (draw-pict pict dc 0 0) (send bm save-file file 'png)) ;; (keyboard '("H" "E" "L"))
true
9fabdfd70c0efe850cd192ef0db3ef4816a414bf
b146e76d1e7446272a48d34ae1e0cb79e28317e2
/client.rkt
1526e2ef7101da33636488c647994de11ad5adf3
[ "MIT" ]
permissive
glebm/racketscript-playground
d53c17fb137ee87a2dc6413a1c6b1014b5e699e1
c7d7e93c43b060778c0b8b829a613a6ffbba057e
refs/heads/master
2021-01-22T03:08:43.224434
2017-06-20T09:32:38
2017-06-20T09:32:38
102,257,986
0
0
null
2017-09-03T10:51:34
2017-09-03T10:51:33
null
UTF-8
Racket
false
false
9,932
rkt
client.rkt
#lang racketscript/base (require racketscript/browser racketscript/interop racket/match racket/string (for-syntax racket/base)) (define jQuery #js*.$) ;;---------------------------------------------------------------------------- ;; Globals (define *split-gutter-size* 3) (define *racket-editor-id* "racket-edit") (define *jsout-editor-id* "jsout-edit") (define *console-log-editor-id* "console-log-edit") ;; Gist (define *gist-source-file* "source.rkt") (define *gist-javascript-file* "compiled.js") ;; CodeMirror (define *cm-theme* "neat") (define cm-editor-racket #f) (define cm-editor-console #f) (define cm-editor-jsout #f) ;; State (define compiling? #f) (define last-compile-time (#js*.Date.now)) (define ++ string-append) (define-syntax := (make-rename-transformer #'$/:=)) ;;------------------------------------------------------------------------------- ;; UI (define (init-split-layout!) (#js*.Split [$/array "#left-container" "#right-container"] {$/obj [direction "horizontal"] [sizes [$/array 50 50]] [gutterSize *split-gutter-size*]}) (#js*.Split [$/array "#play-container" "#console-log-container"] {$/obj [direction "vertical"] [sizes [$/array 75 25]] [gutterSize *split-gutter-size*]}) (#js*.Split [$/array "#racket-container" "#jsout-container"] {$/obj [direction "vertical"] [sizes [$/array 75 25]] [gutterSize *split-gutter-size*]})) (define (register-button-events!) ($> (jQuery "#btn-compile") (click (λ (e) (#js.e.preventDefault) (compile #f)))) ($> (jQuery "#btn-run") (click (λ (e) (#js.e.preventDefault) (run)))) ($> (jQuery "#btn-compile-run") (click (λ (e) (#js.e.preventDefault) (compile #t)))) ($> (jQuery "#btn-save") (click (λ (e) (#js.e.preventDefault) (save))))) ;;----------------------------------------------------------------------------- ;; Editors ;; DOM-Id (Listof (Pairof CodeMirrorOption CodeMirrorOptionValue)) -> CodeMirror ;; Initialize CodeMirror in HTML TextArea of id `dom-id` and ;; with CodeMirror `options` (define (create-editor dom-id options) (define options* (assoc->object (append options `([theme ,*cm-theme*] [matchBrackets ,#t] [scrollbarStyle "simple"] [extraKeys ,{$/obj ["F11" (λ (cm) (toggle-editor-fullscreen cm))] ["Esc" (λ (cm) (when (#js.cm.getOption "fullscreen") (toggle-editor-fullscreen cm)))]}])))) (#js*.CodeMirror.fromTextArea (#js.document.getElementById dom-id) options*)) (define (toggle-editor-fullscreen cm) (#js.cm.setOption "fullScreen" (not (#js.cm.getOption "fullScreen")))) (define (init-editors!) (set! cm-editor-racket (create-editor *racket-editor-id* '([lineNumbers #t] [mode "scheme"]))) (set! cm-editor-console (create-editor *console-log-editor-id* '([lineNumbers #f] [readOnly true]))) (set! cm-editor-jsout (create-editor *jsout-editor-id* '([lineNumbers #t] [readOnly #f] [mode "javascript"])))) (define (append-to-editor! editor str) (#js.editor.replaceRange str {$/obj [line +inf.0]})) ;;------------------------------------------------------------------------------- ;; Console (define (get-logger level) (λ args (append-to-editor! cm-editor-console (++ "[" level "] ")) (for-each (λ (a) (append-to-editor! cm-editor-console (++ (cond [(string? a) a] [(number? a) (number->string a)] [else (#js*.JSON.stringify a)]) " ")) (append-to-editor! cm-editor-console "\n")) args))) (define (override-console frame) (define frame-win #js.frame.contentWindow) (define new-con {$/obj [log (get-logger "log")] [debug (get-logger "debug")] [error (get-logger "error")] [info (get-logger "info")]}) (:= #js.new-con.prototype #js.frame-win.console) (:= #js.frame-win.console new-con) (:= #js.frame-win.document.console new-con)) (define (set-racket-code code) (#js.cm-editor-racket.setValue code)) (define (set-javascript-code code) (#js.cm-editor-jsout.setValue (#js*.js_beautify code {$/obj [indent_size 2]}))) ;;------------------------------------------------------------------------------- ;; Ops (define (run-racket code) (define run-frame (#js.document.getElementById "run-area")) (define src #js.run-frame.src) (:= #js.run-frame.src "") (:= #js.run-frame.src src) (:= #js.run-frame.onload (λ () (define doc #js.run-frame.contentWindow.document) (define head ($ (#js.doc.getElementsByTagName "head") 0)) (define script (#js.doc.createElement "script")) (override-console run-frame) (:= #js.script.type "module") (:= #js.script.text code) (#js.head.appendChild script) (#js.run-frame.contentWindow.System.loadScriptTypeModule)))) (define (run) (define code (#js.cm-editor-jsout.getValue)) (cond [(equal? code "") (#js*.console.warn "Code not compiled!")] [else (#js.cm-editor-console.setValue "Console Log: \n") (run-racket code)])) (define (compile execute?) (when (or (not compiling?) (> (- (#js*.Date.now) last-compile-time) 5000)) (:= compiling? #t) (#js*.setTimeout (λ () (:= compiling? #f)) 5000) (#js.cm-editor-console.setValue "Console Log:\n") (#js.cm-editor-jsout.setValue "Compiling ...") ($> (#js.jQuery.post "/compile" {$/obj [code (#js.cm-editor-racket.getValue)]}) (done (λ (data) (set-javascript-code data) (when execute? (run)))) (fail (λ (xhr status err) (#js.cm-editor-console.setValue (++ "Compilation error:\n" #js.xhr.responseText)) (#js.cm-editor-jsout.setValue ""))) (always (λ () (:= compiling? #f)))))) ;;----------------------------------------------------------------------------- ;; Save and Load Gist (define (load-gist id) ($> (#js.jQuery.get (++ "https://api.github.com/gists/" id)) (done (λ (data) (set-racket-code ($ #js.data.files *gist-source-file* 'content)) (define jscode ($ #js.data.files *gist-javascript-file* 'content)) (cond [(and jscode (not (equal? jscode ""))) (set-javascript-code jscode) (run)] [else (compile #t)]))) (fail (λ (xhr) (show-error "Error load Gist" (++ #js.xhr.responseJSON.message)))))) (define (save) (define data {$/obj [public #t] [files (assoc->object `([,*gist-source-file* ,{$/obj [content (#js.cm-editor-racket.getValue)]}] [,*gist-javascript-file* ,{$/obj [content (#js.cm-editor-jsout.getValue)]}]))]}) ($> (#js.jQuery.post "https://api.github.com/gists" (#js*.JSON.stringify data)) (done (λ (data) (define id #js.data.id) (:= #js.window.location.href (++ "#gist/" id)))) (fail (λ (e) (show-error "Error saving as Gist" #js.e.responseJSON.message))))) ;;------------------------------------------------------------------------------- (define (show-error title msg) ($> (#js.jQuery "#error-modal") (modal "show")) ($> (#js.jQuery "#error-modal .modal-title") (text title)) ($> (#js.jQuery "#error-modal p") (text msg))) ;;------------------------------------------------------------------------------- (define (load-racket-example example-name) ($> (#js.jQuery.get (format "/examples/~a.rkt" example-name)) (done (λ (data) (set-racket-code data)))) ($> (#js.jQuery.get (format "/examples/~a.rkt.js" example-name)) (done (λ (data) (set-javascript-code data) (run))))) (define (reset-ui!) ;; Reset editors (#js.cm-editor-racket.setValue "Loading ...") (#js.cm-editor-jsout.setValue "") (#js.cm-editor-console.setValue "") ;; Reset the iframe with a blank page (define run-frame (#js.document.getElementById "run-area")) (:= #js.run-frame.contentWindow.location "about:blank")) (define (load-racket-code) ;; TODO: string-split doesn't work (define parts ($> (substring #js.window.location.hash 1) (split "/"))) (reset-ui!) (case ($ parts 0) [("gist") (load-gist ($ parts 1))] [("example") (load-racket-example ($ parts 1))] [else (load-racket-example "default")])) (define (main) ($> (jQuery document) (ready (λ () (init-editors!) (init-split-layout!) (register-button-events!) (load-racket-code)))) ($> (jQuery window) (on "hashchange" load-racket-code))) (main)
true
83f1059f70ee8856aacd2cc12b98c2fc0ba42370
78cc191cebadf6477c99ff36debe1e429cce72f4
/project2/loc.rkt
9aa3d3276af5602ef3a05ea2b2e899e024ca5471
[]
no_license
noahmclean1/First-Year-Projects
311c49d233afd7e9cd68a6c45797e443f8821a52
a3475711ffbba760c31b3bdb56db5f282ad750a0
refs/heads/master
2021-01-19T07:59:48.412777
2017-06-21T18:44:50
2017-06-21T18:44:50
87,592,869
0
0
null
2017-06-21T18:44:51
2017-04-07T22:55:11
Roff
UTF-8
Racket
false
false
148
rkt
loc.rkt
#lang typed/racket (require "../uchicago151/uchicago151.rkt") (define-struct Loc ([row : Integer] [col : Integer])) (provide (struct-out Loc))
false
2321d543a6c8f24f502ab9b7f89380bf36bc7c4f
b62560d3387ed544da2bbe9b011ec5cd6403d440
/crates/steel-core/src/scheme/types.rkt
f84698823ef477789564ea26a2fcfd88c2e63a44
[ "LicenseRef-scancode-unknown-license-reference", "MIT", "Apache-2.0" ]
permissive
mattwparas/steel
c6fb91b20c4e613e6a8db9d9310d1e1c72313df2
700144a5a1aeb33cbdb2f66440bbe38cf4152458
refs/heads/master
2023-09-04T03:41:35.352916
2023-09-01T03:26:01
2023-09-01T03:26:01
241,949,362
207
10
Apache-2.0
2023-09-06T04:31:21
2020-02-20T17:39:28
Rust
UTF-8
Racket
false
false
1,042
rkt
types.rkt
(export define-type define-type-body define-type-help) (define-syntax define-type-help (syntax-rules () [(define-type name (variant fields) rest ...) (begin (struct variant fields) (define-type name rest ...))] [(define-type name (variant fields)) (struct variant fields)])) (define-syntax define-type-body (syntax-rules () [(define-type-body x (variant fields) rest ...) (or ((datum->syntax variant ?) x) (define-type-body x rest ...))] [(define-type-body x (variant fields)) ((datum->syntax variant ?) x)])) (define-syntax define-type (syntax-rules () [(define-type name (variant fields) rest ...) (begin (define ((datum->syntax name ?) x) (define-type-body x (variant fields) rest ...)) (define-type-help name (variant fields) rest ...))] [(define-type-test name (variant fields)) (begin (define ((datum->syntax name ?) x) (define-type-body x (variant fields))) (define-type-help name (variant fields)))]))
true
a639608c44bad0574c7c09f200d844602471a0e4
5bbc152058cea0c50b84216be04650fa8837a94b
/data/6.4.0.14/take5-2016-04-09T23:50:36.rktd
07d45fd5f7fd6122fea7bc9d8891c09887bd5208
[]
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
13,585
rktd
take5-2016-04-09T23:50:36.rktd
;; #(-j 16 -r /home/ben/code/racket/6.4.0.14/racket/bin benchmarks/take5) ;; 6.4.0.14 ;; base @ <unknown-commit> ;; typed-racket @ 495da1bd #( (137 140 137 140 140 140 141 143 139 139) (180 180 179 164 170 167 179 167 164 167) (191 189 186 187 188 201 191 190 182 187) (196 194 190 190 197 189 190 195 184 190) (179 180 189 180 186 178 190 188 186 193) (196 195 181 181 188 195 189 191 186 181) (194 203 214 194 200 197 205 210 201 200) (207 211 208 205 209 198 203 208 195 210) (180 177 169 170 174 187 184 174 171 169) (172 181 173 171 172 177 171 172 181 173 173 171 176 182 175 176 175 180 177 181 181 177 174 175 182 174 170 179 181 174 177) (191 195 187 188 189 200 188 188 196 193) (195 193 193 195 189 190 192 193 197 195) (189 186 194 193 193 188 195 187 188 192) (193 193 194 198 189 192 188 186 195 193) (212 205 205 202 207 210 199 204 203 201) (213 210 210 215 209 202 206 215 201 207) (239 239 240 234 237 242 239 226 235 237) (229 232 240 246 244 247 245 244 243 243) (247 248 247 246 248 248 244 248 246 243) (236 252 255 248 254 250 253 257 249 253) (242 236 238 240 239 237 234 241 233 238) (234 240 240 241 246 239 243 238 247 242) (215 220 223 227 215 217 209 217 216 227) (210 219 218 226 221 217 200 226 222 220) (228 243 238 241 239 239 238 229 228 230) (231 244 242 243 241 243 243 244 242 239 240 240 239 241 241 242 241 242 240 241 242 240 241 231 242 238 241 241 240 237 251) (236 246 241 238 249 244 244 247 218 245) (246 241 245 239 239 246 239 240 235 208 243 248 232 220 218 210 222 231 221 229 235 242 243 239 238 242 239 243 243 241 239) (238 238 237 236 238 237 238 235 240 236) (239 237 234 236 201 223 225 224 222 205) (164 162 163 163 166 165 163 164 161 163) (159 160 160 160 160 158 159 158 157 157) (196 197 196 200 203 202 198 198 197 199) (203 204 204 203 204 205 205 195 203 206 208 206 204 203 205 204 203 202 201 201 206 208 213 201 204 205 205 205 207 206 205) (230 235 230 231 229 229 232 222 232 231) (233 235 232 225 232 235 238 244 231 228) (222 228 227 224 226 228 234 233 227 227) (225 222 229 232 226 235 230 231 232 241) (252 251 245 252 247 256 246 242 245 246) (247 240 248 251 252 248 236 246 259 248) (204 201 212 206 214 218 212 217 215 217) (203 206 197 208 212 214 216 216 217 218) (244 237 239 240 238 239 237 240 237 238) (237 236 232 244 239 238 237 233 227 238) (234 237 229 236 237 241 236 238 244 232) (234 234 234 234 236 236 235 240 237 238) (257 258 252 252 255 251 256 255 252 255) (247 251 257 255 254 250 251 252 251 249) (243 244 246 241 238 243 244 244 244 241) (245 248 244 244 243 245 250 247 245 245) (250 259 250 244 243 236 235 238 241 251) (236 230 229 241 237 226 232 244 237 251) (238 239 220 230 230 221 213 239 237 245) (245 244 244 246 244 245 243 242 243 243) (223 220 219 214 218 223 223 222 219 229) (226 226 231 228 225 221 219 226 225 224) (231 235 234 229 232 232 231 237 236 241) (241 234 232 240 238 245 244 240 244 244) (244 243 244 243 244 247 237 244 241 244 248 237 237 240 237 244 239 244 251 238 242 247 244 247 234 242 244 250 244 245 243) (248 242 244 243 242 251 243 244 243 244 245 247 244 244 244 246 245 243 243 249 241 247 244 246 241 240 243 242 244 240 234) (240 237 245 240 239 242 237 237 243 241) (186 187 186 185 185 185 185 183 185 186) (161 160 159 160 161 162 162 162 160 159) (156 156 156 156 156 156 156 157 156 156 156 157 156 157 156 156 157 155 155 156 157 155 156 155 156 156 156 156 156 155 154) (213 206 207 211 215 207 207 200 197 212) (211 203 210 209 212 209 201 211 208 212) (218 195 216 229 227 234 232 220 228 231) (231 234 233 234 235 235 235 233 232 231) (239 226 229 232 231 231 234 230 233 229) (231 234 240 236 234 236 233 232 234 232) (252 249 236 255 250 250 250 252 253 248 237 230 231 225 229 247 244 251 249 252 252 249 248 238 247 249 250 253 247 248 248) (240 253 254 253 258 250 248 253 249 253) (208 197 214 212 220 216 219 210 218 213) (214 215 218 217 215 216 217 217 220 218) (235 239 246 245 240 242 241 240 240 242) (242 240 239 236 225 248 246 230 220 220) (238 235 237 238 234 239 239 237 240 241) (240 238 239 241 239 239 240 240 237 241) (259 256 251 262 264 256 252 263 256 257) (254 256 256 249 244 254 252 250 247 249) (241 238 244 241 247 237 244 240 240 246) (245 243 247 245 241 232 245 242 242 240) (246 236 249 247 247 243 250 255 251 249) (249 250 248 246 254 250 247 252 253 248) (239 238 236 240 235 239 239 237 241 232) (239 238 243 244 243 243 244 240 231 240) (218 221 219 216 220 220 220 220 221 216) (225 224 222 223 224 221 226 223 224 218) (238 232 240 246 246 242 248 235 243 238) (238 246 243 241 243 234 243 241 249 245) (243 241 231 244 244 242 248 244 240 244) (246 244 239 250 243 242 232 236 243 248) (241 242 243 233 244 242 225 233 233 240) (234 240 244 234 240 241 239 234 237 227) (205 195 201 210 204 212 203 207 204 203) (161 161 157 157 156 155 157 155 157 156) (209 212 216 210 198 203 194 213 207 209) (212 208 217 212 211 211 214 214 217 213) (233 235 223 236 232 231 232 229 235 234) (210 236 233 238 237 238 234 237 237 237 233 241 233 237 238 236 232 237 237 231 233 236 239 241 231 213 245 243 226 220 215) (235 234 233 228 236 236 224 224 231 235) (242 243 236 236 239 238 236 236 236 240) (259 256 255 246 255 251 250 253 253 255) (258 252 263 256 256 257 255 256 257 257) (218 218 225 214 213 221 223 216 218 212) (209 221 218 215 222 222 220 220 223 213) (240 241 246 243 242 243 241 242 238 235) (239 236 243 240 240 238 235 234 242 239) (238 243 240 240 244 243 242 236 243 239) (240 237 241 244 244 242 237 246 241 241) (252 254 255 252 249 251 255 254 252 242) (242 247 249 250 247 248 247 246 252 248) (246 232 240 241 244 245 244 243 235 234) (245 235 247 248 248 247 236 250 245 246 246 236 255 259 252 248 248 248 248 247 247 246 245 244 246 242 248 248 237 248 247) (256 256 257 254 254 252 252 250 252 240) (247 254 257 265 257 259 257 256 256 265) (248 248 233 241 253 254 246 237 241 243) (246 253 255 240 243 246 245 247 248 245) (223 219 225 222 222 225 229 224 224 226) (233 225 226 228 221 222 233 222 226 229) (245 251 248 246 249 254 256 217 232 247) (247 256 239 237 237 214 219 223 223 223) (247 248 249 244 245 244 242 240 244 242) (244 244 229 224 228 230 231 235 233 241) (247 243 248 246 243 243 243 243 243 188 191 191 191 190 191 190 191 192 189 188 189 187 188 189 189 186 189 187 189 187 186) (188 188 184 184 185 186 183 183 186 182) (160 158 159 159 160 159 160 160 159 159 159 159 160 158 159 158 159 160 158 157 155 157 158 157 156 157 158 158 159 160 159) (141 142 141 142 142 142 132 132 133 133 132 136 135 136 136 133 135 133 132 136 136 135 135 135 133 132 133 133 132 133 132) (196 199 189 193 196 194 196 194 196 196) (197 187 185 204 203 205 205 205 204 207 198 208 210 209 210 207 202 203 208 207 211 203 194 206 205 210 210 209 210 202 208) (225 221 206 212 203 204 214 222 224 226) (232 231 228 232 239 233 231 240 242 232) (230 228 228 217 223 228 227 228 231 219) (227 227 235 229 223 231 232 230 231 230) (244 245 248 245 243 247 251 233 251 253) (249 248 247 249 250 248 248 242 252 250) (221 215 212 210 206 215 203 214 215 216) (213 209 217 215 220 218 213 216 215 215) (239 236 231 237 236 236 238 228 241 236) (236 241 239 237 236 237 235 234 233 239) (236 234 238 235 236 235 238 238 237 236) (238 240 213 213 228 225 218 214 207 221) (267 258 257 259 255 253 253 255 256 255) (248 250 257 253 250 236 242 245 245 237) (237 237 238 242 242 241 231 241 237 241) (244 239 238 249 255 244 245 243 244 244) (258 253 250 250 248 250 249 250 248 249 248 248 247 250 249 236 248 253 247 249 254 249 250 245 245 247 255 248 250 248 246) (252 237 249 252 253 254 252 244 252 261) (242 226 238 236 240 239 242 234 235 241) (246 241 244 242 244 246 242 242 241 234) (218 220 225 216 224 218 221 223 221 224) (226 222 201 183 211 197 211 201 205 221) (243 241 241 239 240 243 245 243 239 239) (244 243 245 246 244 245 241 244 245 241) (237 224 225 222 221 226 227 238 239 246) (243 244 243 245 245 244 245 241 242 240) (249 232 230 225 217 225 235 237 236 235) (230 240 249 247 250 250 237 236 230 229) (165 167 164 166 164 166 165 165 166 165) (160 160 159 158 161 160 160 159 161 160) (200 202 202 202 201 205 202 203 198 198) (204 208 206 204 208 211 205 196 208 203) (190 208 210 221 217 229 226 233 231 220) (237 237 238 234 237 238 235 235 235 237) (228 226 227 232 233 234 229 235 224 232) (230 235 234 233 239 236 232 235 230 228) (252 242 249 250 249 245 242 250 253 246) (241 258 258 260 255 256 255 261 251 251) (219 213 214 216 217 214 219 216 217 222) (216 218 222 221 216 216 217 218 217 218) (247 250 241 241 204 213 227 226 233 232) (236 240 249 219 225 240 237 235 238 227) (244 252 248 238 240 237 238 239 239 242) (248 248 242 241 238 237 240 242 240 239) (257 256 257 254 253 252 251 250 254 250) (248 251 241 234 255 250 258 254 256 261) (242 244 244 242 242 247 246 239 248 244) (248 245 242 234 241 244 244 255 251 250) (249 223 258 259 250 249 232 242 252 248) (248 257 255 256 250 259 255 250 260 250) (247 246 242 242 243 245 233 246 242 249) (244 242 245 243 245 238 246 248 242 248) (222 223 224 222 225 218 223 222 225 226) (225 222 221 228 224 227 231 219 227 227) (242 241 247 247 223 209 209 233 244 245) (244 246 236 239 247 246 245 245 246 243) (244 243 246 247 246 243 243 245 242 246) (212 230 227 224 244 241 251 246 245 251) (224 222 211 212 238 236 243 241 243 245) (244 241 240 238 237 237 243 243 227 237) (209 212 212 210 210 210 196 177 165 165 163 164 165 164 161 160 161 161 162 162 160 161 161 162 160 161 163 161 162 162 161) (159 159 159 159 159 159 158 158 158 159 159 159 159 158 159 158 159 157 159 160 154 158 159 160 158 160 159 159 158 159 159) (208 209 213 215 212 207 208 205 211 209) (212 215 211 212 212 213 216 213 214 215) (235 235 234 231 234 233 234 235 233 235) (239 239 237 238 239 223 234 232 238 237 226 238 234 240 236 231 238 235 238 238 233 230 239 237 242 234 235 240 239 238 235) (235 230 236 237 221 230 232 240 242 232) (237 236 234 238 239 232 237 238 236 239) (253 247 250 253 254 251 241 249 248 250) (256 258 261 250 242 251 253 252 255 255) (219 215 222 217 218 214 216 215 215 218) (218 218 219 217 220 219 219 217 216 219) (249 243 242 243 244 241 242 244 242 241) (235 242 243 241 232 232 238 240 242 242) (228 242 236 242 250 248 241 239 240 238) (235 242 244 245 232 248 240 241 244 241) (254 258 259 254 258 231 238 247 246 241) (258 252 246 243 254 253 255 252 252 253) (243 240 240 243 250 240 246 239 243 245) (239 246 248 242 248 242 245 250 241 245) (253 251 254 253 247 256 250 234 255 258) (252 252 254 256 236 257 261 256 256 252 253 253 251 252 250 253 250 251 249 251 257 241 256 256 254 253 253 248 248 257 252) (233 237 242 240 241 227 238 241 238 244) (247 243 240 244 245 242 232 239 245 242) (218 222 223 223 223 222 214 219 222 221) (224 220 226 222 223 224 223 224 228 227) (247 241 240 244 240 242 247 236 242 247) (242 245 242 245 239 247 238 242 240 251) (239 243 244 237 248 248 245 237 241 243) (247 244 250 244 239 256 245 244 245 242) (236 243 245 234 239 244 232 234 243 240) (234 236 221 234 230 235 233 233 235 224 229 228 234 231 232 229 233 234 242 243 243 234 234 233 234 235 231 230 230 232 232) (155 156 153 153 153 152 152 152 151 157) (153 154 151 154 153 152 151 153 148 142 141 142 142 143 143 141 141 140 142 142 140 141 141 142 140 139 139 140 139 139 140) (212 201 219 218 211 206 189 217 216 203) (204 215 213 218 216 215 220 211 204 214) (233 233 230 239 238 236 227 238 232 234) (242 239 239 240 243 237 242 239 238 231) (238 229 217 218 227 215 207 222 230 227) (239 238 239 245 244 237 242 232 240 227) (262 250 259 260 254 258 250 259 255 254) (262 266 258 256 252 260 261 246 262 245) (222 220 209 217 219 226 215 227 215 223) (210 224 221 219 214 222 219 221 226 220) (246 244 241 237 239 243 242 247 239 245) (241 245 245 242 243 244 241 242 244 243) (245 245 245 245 242 243 241 236 244 246) (248 245 249 246 246 244 246 239 244 245) (262 255 264 257 253 258 247 262 255 258) (255 255 255 258 246 251 252 249 250 251) (153 155 155 152 151 154 152 152 151 152) (154 153 154 154 154 154 154 154 159 153 154 154 154 155 154 154 154 154 153 155 153 154 154 153 155 154 153 154 153 153 154) (160 159 154 156 156 155 156 155 155 156) (158 158 157 162 162 157 162 158 157 158 158 159 158 158 157 158 158 162 158 158 161 158 158 158 157 157 158 157 158 157 158) (150 155 150 150 149 150 155 149 155 150 151 150 150 150 151 150 151 150 149 150 150 154 150 150 151 149 150 151 150 150 150) (156 152 153 151 153 152 152 152 152 153 152 153 152 152 152 153 156 152 151 152 152 152 153 157 152 153 152 153 157 153 152) (143 140 144 139 138 139 138 139 139 138 142 139 139 140 139 139 138 139 139 139 139 140 140 139 139 139 139 139 139 139 139) (141 140 140 141 141 142 141 141 141 141 140 141 145 141 141 140 140 141 142 144 141 142 145 141 145 146 141 141 141 144 144) (151 152 152 152 152 151 151 151 151 151 151 156 151 151 151 152 156 156 155 151 151 156 151 151 152 151 152 152 152 152 152) (153 152 157 153 156 153 152 152 156 157) (152 152 151 155 151 155 152 153 151 156) (154 150 150 154 153 151 150 151 154 150) (149 150 154 154 150 150 150 149 150 150 149 150 150 150 150 150 150 149 150 153 154 153 150 149 149 151 150 150 150 150 150) (153 150 149 150 150 150 150 150 151 150 151 150 150 151 150 150 150 150 150 154 152 151 151 150 150 150 155 150 155 153 156) (133 133 134 134 134 134 138 139 138 138 134 133 137 134 133 134 134 133 134 133 133 137 137 134 134 134 135 134 137 133 133) (136 132 133 132 131 132 136 133 132 132 132 131 132 131 132 133 131 132 133 132 133 132 132 132 132 133 132 132 131 132 132) )
false
28cb6202d3dbf11179bf46b9c07dd8e9a213a0ab
de2a5717f440dce76d3b3bb2b3bd82b6f98cb06f
/redex/typing.rkt
a8a9334b45f92c14f0a4faf4d106034aa09f8ff0
[]
no_license
jonahkagan/doof
3d30f241aa9d6ec26babb29ebd71016e35e87b68
78e98149bd18de200140c1759c8b2b9311159858
refs/heads/master
2021-01-25T05:28:04.533437
2013-05-14T22:03:35
2013-05-14T22:03:35
null
0
0
null
null
null
null
UTF-8
Racket
false
false
7,714
rkt
typing.rkt
#lang racket (require redex) (provide (all-defined-out)) (require "pat.rkt" "lang.rkt" "kinding.rkt") (define-extended-language doof-tc doof-kc (Γ • (x : t Γ)) (tv p bool Top (-> t t) (t-obj (string t) ...) (tλ (X k) t)) (tE hole (tE t) (tv tE) (-> tE t) (-> tv tE) (t-cat tE t) (t-cat tv tE) (t-obj (string tv) ... (string tE) (string t) ...) (t-ext tE t t) (t-ext tv tE t) (t-ext tv tv tE) (t-get tE t) (t-get tv tE) (t-fold tE t t) (t-fold tv tE t) (t-fold tv tv tE))) ; Type (parallel) reduction (define t-red (reduction-relation doof-tc #:domain t (==> ((tλ (X k) t) tv) (t-subst X tv t) "q-app") (==> (t-cat p_1 p_2) (p-cat p_1 p_2) "q-cat") (==> p p_2 (where p_2 (pat-reduce p)) (side-condition (not (equal? (term p) (term p_2)))) "q-pat") (==> (t-ext (t-obj (string_1 tv_1) ...) string_new tv_new) (t-obj (string_new tv_new) (string_1 tv_1) ...) (side-condition (not (member (term string_new) (term (string_1 ...))))) "q-ext-add") (==> (t-ext (t-obj (string_1 tv_1) ... (string_k tv_k) (string_k+1 tv_k+1) ...) string_k tv_new) (t-obj (string_1 tv_1) ... (string_k tv_new) (string_k+1 tv_k+1) ...) "q-ext-replace") (==> (t-get (t-obj (string_1 tv_1) ... (string_k tv_k) (string_k+1 tv_k+1) ...) string_k) tv_k "q-get") (==> (t-fold tv_f tv_a (t-obj)) tv_a "q-fold-empty") (==> (t-fold tv_f tv_a (t-obj (string_1 tv_1) (string_2 tv_2) ...)) (((tv_f string_1) tv_1) (t-fold tv_f tv_a (t-obj (string_2 tv_2) ...))) "q-fold-obj") with [(--> (in-hole tE t_1) (in-hole tE t_2)) (==> t_1 t_2)] )) (require redex/tut-subst) (define-metafunction doof-tc t-subst : X tv t -> t [(t-subst X tv t) ,(subst/proc X? (list (term X)) (list (term tv)) (term t))]) (define X? (redex-match doof X)) ; Performs all possible substitutions according to Γ, then ; applies the reduction relation on types. (define-metafunction doof-tc t-reduce : Γ t -> tv [(t-reduce (X : tv_X Γ) t) (t-reduce Γ (t-subst X tv_X t))] [(t-reduce • t) ,(first (apply-reduction-relation* t-red (term t)))]) (define-metafunction doof-tc t-trans : e -> t [(t-trans string) string] [(t-trans boolean) bool] [(t-trans x) x] [(t-trans (λ (x t_1) t_2 e)) (-> t_1 ((tλ (x *) (t-trans e)) t_1))] [(t-trans (λ (x t) e)) (-> t ((tλ (x *) (t-trans e)) t))] [(t-trans (e_1 e_2)) ((t-trans e_1 e_2))] [(t-trans (cat e_1 e_2)) (t-cat (t-trans e_1) (t-trans e_2))] [(t-trans (obj (string e) ...)) (t-obj (string (t-trans e)) ...)] [(t-trans (ext e_1 e_2 e_3)) (t-ext (t-trans e_1) (t-trans e_2) (t-trans e_3))] [(t-trans (get e_1 e_2)) (t-get (t-trans e_1) (t-trans e_2))] [(t-trans (fold (λ (x_n t_n) (λ (x_v t_v) (λ (x_a t_a) e_b))) e_2 e_3)) (t-fold (tλ (x_n *) (tλ (x_v *) (tλ (x_a *) (t-trans e_b)))) (t-trans e_2) (t-trans e_3))] #;[(t-trans (fold e_1 e_2 e_3)) (t-fold (t-trans e_1) (t-trans e_2) (t-trans e_3))] #;[(t-trans (if e_1 e_2 e_3)) (∨ (t-trans e_2) (t-trans e_3))]) ; TODO: do we need to define trans on if expressions? ; Subtyping relation (define-relation doof-tc <: ⊆ t × t ; S-Arrow [(<: (-> t_11 t_12) (-> t_21 t_22)) (<: t_21 t_11) (<: t_12 t_22)] ; S-Pat [(<: p_1 p_2) (<p p_1 p_2)] ; S-Bool [(<: bool bool)] ; S-Obj [(<: (t-obj (string_n1 t_v1) ...) (t-obj (string_n2 t_v2) ...)) (side-condition (andmap (λ (n2 v2) (ormap (λ (n1 v1) (and (equal? n1 n2) (term (<: ,v1 ,v2)))) (term (string_n1 ...)) (term (t_v1 ...)))) (term (string_n2 ...)) (term (t_v2 ...))))] ; S-Top [(<: t Top)]) ; Join algorithm (define-metafunction doof-tc ∨ : t t -> t [(∨ t_1 t_2) t_2 (side-condition (term (<: t_1 t_2)))] [(∨ t_1 t_2) t_1 (side-condition (term (<: t_2 t_1)))] [(∨ (-> t_11 t_12) (-> t_21 t_22)) (-> t_1 t_2) (where t_1 (∧ t_11 t_21)) (where t_2 (∨ t_12 t_22))] [(∨ p_1 p_2) str] [(∨ t_1 t_2) Top]) ; Meet algorithm (define-metafunction doof-tc ∧ : t t -> t [(∧ t_1 t_2) t_1 (side-condition (term (<: t_1 t_2)))] [(∧ t_1 t_2) t_2 (side-condition (term (<: t_2 t_1)))] [(∧ (-> t_11 t_12) (-> t_21 t_22)) (-> t_1 t_2) (where t_1 (∨ t_11 t_21)) (where t_2 (∧ t_12 t_22))]) ; Type checking (define-judgment-form doof-tc #:mode (types I I O) #:contract (types Γ e t) [(types Γ string string) "t-str"] [(types Γ boolean bool) "t-bool"] [(types (x : t Γ) x t) "t-var"] [(types Γ x_1 t_1) (side-condition (distinct x_1 x_2)) ------------------------------------ "t-ctx" (types (x_2 : t_2 Γ) x_1 t_1)] [(kinds • t_a *) (where t_a2 (t-reduce Γ t_a)) (types (x : t_a2 Γ) e t_b) ------------------------------------- "t-abs" (types Γ (λ (x t_a) e) (-> t_a2 t_b))] [(kinds • t_a *) (kinds • t_r *) (where t_a2 (t-reduce Γ t_a)) (where t_r2 (t-reduce Γ t_r)) (types (x : t_a2 Γ) e t_b) (<: t_b t_r2) ------------------------------------------ "t-abs-ret" (types Γ (λ (x t_a) t_r e) (-> t_a2 t_r2))] [(types Γ e_1 (-> t_11 t_12)) (types Γ e_2 t_2) (<: t_2 t_11) ---------------------------- "t-app" (types Γ (e_1 e_2) t_12)] [(types Γ e_1 t_1) (types Γ e_2 t_2) (<: t_1 str) (<: t_2 str) --------------------------------------- "t-cat" (types Γ (cat e_1 e_2) (p-cat t_1 t_2))] [(types Γ e_1 t_1) ... (side-condition (distinct (string_1 ...))) ------------------------------------------ "t-obj" (types Γ (obj (string_1 e_1) ...) (t-obj (string_1 t_1) ...))] [(types Γ e_1 (t-obj (string_1 t_1) ...)) (types Γ e_2 string_new) (types Γ e_3 t_new) (side-condition ,(not (member (term string_new) (term (string_1 ...))))) ----------------------------------------------------- "t-ext-add" (types Γ (ext e_1 e_2 e_3) (t-obj (string_new t_new) (string_1 t_1) ...))] [(types Γ e_1 (t-obj (string_1 t_1) ... (string_k t_k) (string_k+1 t_k+1) ...)) (types Γ e_2 string_k) (types Γ e_3 t_new) -------------------------------------------- "t-ext-replace" (types Γ (ext e_1 e_2 e_3) (t-obj (string_1 t_1) ... (string_k t_new) (string_k+1 t_k+1) ...))] [(types Γ e_1 (t-obj (string_1 t_1) ... (string_k t_k) (string_k+1 t_k+1) ...)) (types Γ e_2 string_k) -------------------------------------------- "t-get" (types Γ (get e_1 e_2) t_k)] ; Old rule to check fold - not precise enough for dep functions #;[(types Γ e_1 (-> t_fn (-> t_fv (-> t_a t_a)))) (types Γ e_2 t_i) (types Γ e_3 t_o) (<: t_fn str) (<: t_i t_a) (<: t_o (t-obj)) ---------------------------------------------- "t-fold" (types Γ (fold e_1 e_2 e_3) t_a)] [(where t (t-reduce Γ (t-trans (fold e_1 e_2 e_3)))) ------------------------------------------------- "t-fold" (types Γ (fold e_1 e_2 e_3) t)] [(types Γ e_1 bool) (types Γ e_2 t_2) (types Γ e_3 t_3) (where t (∨ t_2 t_3)) ---------------------------- (types Γ (if e_1 e_2 e_3) t)])
false
67197b59ac7d764b824e6f8741a25d4deaead8f8
9683b726ac3766c7ed1203684420ab49612b5c86
/ts-adventure/katas/read-code-tips.rkt
258c92bbc1f681f7affcf36142ddf9ce0d6d9f6b
[]
no_license
thoughtstem/TS-GE-Katas
3448b0498b230c79fc91e70fdb5513d7c33a3c89
0ce7e0c7ed717e01c69770d7699883123002b683
refs/heads/master
2020-04-13T21:22:10.248300
2020-02-13T18:04:07
2020-02-13T18:04:07
163,454,352
1
0
null
2020-02-13T18:04:08
2018-12-28T22:25:21
Racket
UTF-8
Racket
false
false
585
rkt
read-code-tips.rkt
#lang racket (provide tips) ;(require ts-kata-util/katas/main) ;(require ts-kata-util/katas/rendering/scribble) (require scribble/manual) (define tips (list 'code-value-1 (list "Have the students vote for one of the given mottos, or lead a brainstorm to come up with a different one.") 'hello-world-1 (list "This is the simplest game possible.") 'avatar-3 (list "The default speed is " (bold "10") ".") 'npc-1 (list "The NPC modes are " (bold "'still") ", " (bold "'follow") ", " (bold "'wander") " (the default), and " (bold "'pace") ".") ))
false
26b10bd18159f5bb15459d1a368a4a71820c65ab
ddcff224727303b32b9d80fa4a2ebc1292eb403d
/2. Building Abstractions with Data/2.4/2.76.rkt
c3391982886a97d014042b6f9a67bba94b7e69a6
[]
no_license
belamenso/sicp
348808d69af6aff95b0dc5b0f1f3984694700872
b01ea405e8ebf77842ae6a71bb72aef64a7009ad
refs/heads/master
2020-03-22T02:01:55.138878
2018-07-25T13:59:18
2018-07-25T13:59:18
139,345,220
1
0
null
null
null
null
UTF-8
Racket
false
false
907
rkt
2.76.rkt
#lang racket #| 1. data-directed (dispatch table) Adding an operation: easy, automatically get correct selectors from dispatch table, just add one method. Adding a type: ok, just create an installation procedure that puts appropriate functions in the dispatch table |# #| 2. message passing (closure accepting message and acting accordingly) Adding an operation: trivial, every object has it's own selectors with it, just write a function respecting an interface Adding a type: easy, just write a closure |# #| 3. Type-tags + explicit dispatch Adding an operation: uncomfortable, you have to account for all the possible implementations yourself Adding a type: terrible, you have to update all your procedures, you have to remember to tag your data |# #| The easiest one is in both cases is message passing. |#
false
3c3fd33b0846f0067c01486355aa60cec0b66bb5
453869ca6ccd4c055aa7ba5b09c1b2deccd5fe0c
/tests/struct/super-name.rkt
58243e487ff08040fa7e37678dd3e53e8f85109b
[ "MIT" ]
permissive
racketscript/racketscript
52d1b67470aaecfd2606e96910c7dea0d98377c1
bff853c802b0073d08043f850108a57981d9f826
refs/heads/master
2023-09-04T09:14:10.131529
2023-09-02T16:33:53
2023-09-02T16:33:53
52,491,211
328
16
MIT
2023-09-02T16:33:55
2016-02-25T02:38:38
Racket
UTF-8
Racket
false
false
330
rkt
super-name.rkt
#lang racket (struct posn (x y) #:guard (λ (x y name) (displayln (list '2d x y name)) (values x y))) (struct posn3 posn (z) #:guard (λ (x y z name) (displayln (list '3d x y z name)) (values x y z))) (define p1 (posn3 10 12 14)) (displayln (list (posn-x p1) (posn-y p1) (posn3-z p1)))
false
434c90bfc862765addf69ff7698e56250900a458
5c58ab6f71ae0637bb701b21f288bc08e815f5e9
/chapter2/225.rkt
ffcaeecb23e9609585c77426cf7a0fca2342e575
[ "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
251
rkt
225.rkt
#lang sicp (define a (list 1 3 (list 5 7) 9)) (define b (list (list 7))) (define c (list 1 (list 2 (list 3 (list 4 (list 5 (list 6 7))))))) ;; to get 7 (car (cdr (car (cdr (cdr a))))) (car (car b)) (cadr (cadr (cadr (cadr (cadr (cadr c))))))
false
f5ed76e838a678f0b6ea1121f57112f6746a7ad2
68c4bab1f5d5228078d603066b6c6cea87fdbc7a
/lab/just-born/little-ant/src/racket/draft/v1/test.scm
ea96debdfd0290d2c1dd36532591c0b8d879817e
[]
no_license
felipelalli/micaroni
afab919dab304e21ba916aa6310dca102b1a04a5
741b628754b7c7085d3e68009a621242c2a1534e
refs/heads/master
2023-08-03T06:25:15.405861
2023-07-25T14:44:56
2023-07-25T14:44:56
537,536
2
1
null
null
null
null
UTF-8
Racket
false
false
60
scm
test.scm
;-*- mode: racket -*- #lang r5rs (display "Hello world!")
false
989329ec58a8c993e2e72db0728dfb9866f45c18
6582bfe2990716ee85fb69338aebf1abaa158bc0
/brag-lib/brag/codegen/codegen.rkt
029eb64675d58a031a258a2d2f57f7c8d04c1bca
[ "MIT" ]
permissive
mbutterick/brag
2a3962b8d4ed80488812caae870b852a44c247d8
f52c2a80c9cb6840b96532c2ca1371d12aea61e7
refs/heads/master
2022-06-03T00:15:21.317870
2022-02-09T18:04:04
2022-02-09T18:04:04
82,710,347
67
15
MIT
2022-03-16T01:04:27
2017-02-21T17:57:12
Racket
UTF-8
Racket
false
false
11,332
rkt
codegen.rkt
#lang racket/base (require racket/list racket/syntax brag/rules/stx-types syntax/id-table (prefix-in sat: "satisfaction.rkt") (for-template racket/base brag/codegen/runtime brag/private/internal-support)) (provide (all-defined-out) (for-template (all-from-out brag/codegen/runtime brag/private/internal-support))) ;; Given a flattened rule, returns a syntax for the code that ;; preserves as much source location as possible. ;; ;; Each rule is defined to return a list with the following structure: ;; ;; stx :== (name (U tokens rule-stx) ...) ;; (define (flat-rule->yacc-rule a-flat-rule) (syntax-case a-flat-rule () [(rule-type origin name . clauses) (with-syntax ([translated-clauses (for/list ([clause-stx (in-list (syntax->list #'clauses))]) (translate-clause clause-stx #'name #'origin))]) #'[name . translated-clauses])])) ;; translates a single primitive rule clause. ;; A clause is a simple list of ids, lit, vals, and inferred-id elements. ;; The action taken depends on the pattern type. (define (translate-clause a-clause rule-name/false origin) (define translated-patterns (let loop ([primitive-patterns (syntax->list a-clause)]) (cond [(empty? primitive-patterns) null] [else (cons (syntax-case (first primitive-patterns) (id lit token inferred-id) [(id val) #'val] [(lit val) (datum->syntax #f (string->symbol (syntax-e #'val)) #'val)] [(token val) #'val] [(inferred-id val reason) #'val]) (loop (rest primitive-patterns)))]))) (define translated-actions (for/list ([translated-pattern (in-list translated-patterns)] [primitive-pattern (in-list (syntax->list a-clause))] [pos (in-naturals 1)]) (if (eq? (syntax-property primitive-pattern 'hide) 'hide) #'null (with-syntax ([$X (format-id translated-pattern "$~a" pos)] [$X-start-pos (format-id translated-pattern "$~a-start-pos" pos)] [$X-end-pos (format-id translated-pattern "$~a-end-pos" pos)]) (syntax-case primitive-pattern (id lit token inferred-id) ;; When a rule usage is inferred, the value of $X is a syntax object ;; whose head is the name of the inferred rule. We strip that out, ;; leaving the residue to be absorbed. [(inferred-id val reason) #'(syntax-case $X () [(inferred-rule-name . rest) (syntax->list #'rest)])] [(id val) ;; at this point, the 'hide property is either #f or "splice" ;; ('hide value is handled at the top of this conditional) ;; we need to use boolean because a symbol is treated as an identifier. ;; also we'll separate it into its own property for clarity and test for it in "runtime.rkt" #`(list (syntax-property $X 'splice-rh-id #,(and (syntax-property primitive-pattern 'hide) #t)))] [(lit val) #'(list (atomic-datum->syntax $X $X-start-pos $X-end-pos))] [(token val) #'(list (atomic-datum->syntax $X $X-start-pos $X-end-pos))]))))) (define whole-rule-loc (if (empty? translated-patterns) #'(list (current-source) #f #f #f #f) (with-syntax ([$1-start-pos (datum->syntax (first translated-patterns) '$1-start-pos)] [$n-end-pos (format-id (last translated-patterns) "$~a-end-pos" (length translated-patterns))]) #`(positions->srcloc $1-start-pos $n-end-pos)))) ;; move 'hide-or-splice-lhs-id property into function because name is datum-ized (with-syntax ([(translated-pattern ...) translated-patterns] [(translated-action ...) translated-actions]) #`[(translated-pattern ...) (rule-components->syntax '#,rule-name/false translated-action ... #:srcloc #,whole-rule-loc #:hide-or-splice? #,(syntax-property rule-name/false 'hide-or-splice-lhs-id))])) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; collect-token-types: (listof rule-syntax) -> (values (listof identifier) (listof identifier)) ;; ;; Given a rule, automatically derive the list of implicit and ;; explicit token types we need to generate. ;; ;; Note: EOF is reserved, and will always be included in the list ;; of explicit token types, though the user is not allow to express it themselves. (define (rules-collect-token-types rules) (define-values (implicit explicit) (for/fold ([implicit null] [explicit (list (datum->syntax (first rules) 'EOF))]) ([a-rule (in-list rules)]) (syntax-case a-rule (rule) [(rule _ a-pattern) (let loop ([a-pattern #'a-pattern] [implicit implicit] [explicit explicit]) (syntax-case a-pattern (id lit token choice repeat maybe seq EOF) [(id val) (values implicit explicit)] [(lit val) (values (cons #'val implicit) explicit)] [(token EOF) (raise-syntax-error #f "Token EOF is reserved and can not be used in a grammar" #'val)] [(token val) (values implicit (cons #'val explicit))] [(choice . vals) (for/fold ([implicit implicit] [explicit explicit]) ([v (in-list (syntax->list #'vals))]) (loop v implicit explicit))] [(repeat min max val) (loop #'val implicit explicit)] [(maybe val) (loop #'val implicit explicit)] [(seq . vals) (for/fold ([implicit implicit] [explicit explicit]) ([v (in-list (syntax->list #'vals))]) (loop v implicit explicit))]))]))) (values (reverse implicit) (reverse explicit))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; rule-id: rule -> identifier-stx ;; Get the binding id of a rule. (define (rule-id a-rule) (syntax-case a-rule (rule) [(rule id a-pattern) #'id])) (define (rule-pattern a-rule) (syntax-case a-rule (rule) [(rule id a-pattern) #'a-pattern])) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; check-all-rules-defined!: (listof rule-stx) -> void (define (check-all-rules-defined! rules) (define table (make-free-id-table)) ;; Pass one: collect all the defined rule names. (for ([a-rule (in-list rules)]) (free-id-table-set! table (rule-id a-rule) #t)) ;; Pass two: check each referenced id, and make sure it's been defined. (for* ([a-rule (in-list rules)] [referenced-id (in-list (rule-collect-used-ids a-rule))] #:unless (free-id-table-ref table referenced-id (λ () #f))) (raise-syntax-error #f (format "Rule ~a has no definition" (syntax-e referenced-id)) referenced-id))) ;; check-all-rules-no-duplicates!: (listof rule-stx) -> void (define (check-all-rules-no-duplicates! rules) (define table (make-free-id-table)) ;; Pass one: collect all the defined rule names. (for ([a-rule (in-list rules)]) (define maybe-other-rule-id (free-id-table-ref table (rule-id a-rule) (λ () #f))) (when maybe-other-rule-id (raise-syntax-error #f (format "Rule ~a has a duplicate definition" (syntax-e (rule-id a-rule))) (rule-id a-rule) #f (list (rule-id a-rule) maybe-other-rule-id))) (free-id-table-set! table (rule-id a-rule) (rule-id a-rule)))) ;; rule-collect-used-ids: rule-stx -> (listof identifier) ;; Given a rule, extracts a list of identifiers (define (rule-collect-used-ids a-rule) (syntax-case a-rule (rule) [(rule id a-pattern) (pattern-collect-used-ids #'a-pattern null)])) ;; pattern-collect-used-ids: pattern-stx (listof identifier) -> (listof identifier) ;; Returns a flat list of rule identifiers referenced in the pattern. (define (pattern-collect-used-ids a-pattern acc) (let loop ([a-pattern a-pattern] [acc acc]) (syntax-case a-pattern (id lit token choice repeat maybe seq) [(id val) (cons #'val acc)] [(lit val) acc] [(token val) acc] [(choice . vals) (for/fold ([acc acc]) ([v (in-list (syntax->list #'vals))]) (loop v acc))] [(repeat min max val) (loop #'val acc)] [(maybe val) (loop #'val acc)] [(seq . vals) (for/fold ([acc acc]) ([v (in-list (syntax->list #'vals))]) (loop v acc))]))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; check-all-rules-satisfiable: (listof rule-stx) -> void ;; Does a simple graph traversal / topological sort-like thing to make sure that, for ;; any rule, there's some finite sequence of tokens that ;; satisfies it. If this is not the case, then something horrible ;; has happened, and we need to tell the user about it. ;; ;; NOTE: Assumes all referenced rules have definitions. (define (check-all-rules-satisfiable! rules) (define toplevel-rule-table (make-free-id-table (for/list ([a-rule (in-list rules)]) (cons (rule-id a-rule) (sat:make-and))))) (define leaves null) (define (make-leaf) (define a-leaf (sat:make-and)) (set! leaves (cons a-leaf leaves)) a-leaf) (define (process-pattern a-pattern) (syntax-case a-pattern (id lit token choice repeat maybe seq) [(id val) (free-id-table-ref toplevel-rule-table #'val)] [(lit val) (make-leaf)] [(token val) (make-leaf)] [(choice . vals) (let ([an-or-node (sat:make-or)]) (for* ([v (in-list (syntax->list #'vals))] [a-child (in-value (process-pattern v))]) (sat:add-child! an-or-node a-child)) an-or-node)] [(repeat min max val) (syntax-case #'min () [0 (make-leaf)] [_ (process-pattern #'val)])] [(maybe val) (make-leaf)] [(seq . vals) (let ([an-and-node (sat:make-and)]) (for* ([v (in-list (syntax->list #'vals))] [a-child (in-value (process-pattern v))]) (sat:add-child! an-and-node a-child)) an-and-node)])) (for* ([a-rule (in-list rules)] [rule-node (in-value (free-id-table-ref toplevel-rule-table (rule-id a-rule)))]) (sat:add-child! rule-node (process-pattern (rule-pattern a-rule)))) (for-each sat:visit! leaves) (for* ([a-rule (in-list rules)] [rule-node (in-value (free-id-table-ref toplevel-rule-table (rule-id a-rule)))] #:unless (sat:node-yes? rule-node)) (raise-syntax-error #f (format "Rule ~a has no finite derivation" (syntax-e (rule-id a-rule))) (rule-id a-rule))))
false
42f8647adc3d5384dfd2ee6da37aec0bbca5b72d
ea4a41b03c6d95c956655af36a8e955620714e7e
/interp-Cfun.rkt
a509180fec048dcdc25dd8dab94e1ad32d461199
[ "MIT" ]
permissive
IUCompilerCourse/public-student-support-code
9932dec1499261370c554690cee983d569838597
58c425df47b304895725434b441d625d2711131f
refs/heads/master
2023-08-13T07:29:56.236860
2023-06-05T18:05:29
2023-06-05T18:05:29
145,449,207
141
70
MIT
2023-08-23T01:16:47
2018-08-20T17:26:01
Racket
UTF-8
Racket
false
false
3,262
rkt
interp-Cfun.rkt
#lang racket (require "utilities.rkt") (require "interp-Lfun-prime.rkt") (require "interp-Cvar.rkt") (require "interp-Cif.rkt") (require "interp-Cwhile.rkt") (require "interp-Cvec.rkt") (require "interp-Cvecof.rkt") (require (prefix-in runtime-config: "runtime-config.rkt")) (provide interp-Cfun interp-Cfun-mixin) (define (interp-Cfun-mixin super-class) (class super-class (super-new) (inherit initialize!) (define/override (interp-stmt env) (lambda (s) (match s [(Call e es) (define f-val ((interp-exp env) e)) (define arg-vals (map (interp-exp env) es)) (call-function f-val arg-vals s) env] #;[(Assign (Var x) e) (dict-set env x (box ((interp-exp env) e)))] [else ((super interp-stmt env) s)] ))) (define/public (call-function fun arg-vals ast) (match fun [(CFunction xs info blocks def-env) (define f (dict-ref info 'name)) (define f-start (symbol-append f 'start)) (define params-args (for/list ([x xs] [arg arg-vals]) (cons x (box arg)))) (define new-env (append params-args def-env)) ((interp-tail new-env blocks) (dict-ref blocks f-start))] [else (error 'interp-exp "expected C function, not ~a\nin ~v" fun ast)])) (define/override ((interp-exp env) ast) (define result (match ast [(Call f args) (define f-val ((interp-exp env) f)) (define arg-vals (map (interp-exp env) args)) (call-function f-val arg-vals ast)] [else ((super interp-exp env) ast)])) (verbose 'interp-exp ast result) result) (define/override ((interp-tail env blocks) ast) (match ast [(TailCall f args) (define arg-vals (map (interp-exp env) args)) (define f-val ((interp-exp env) f)) (call-function f-val arg-vals ast)] [else ((super interp-tail env blocks) ast)])) (define/override (interp-def ast) (match ast [(Def f `([,xs : ,ps] ...) rt info blocks) (cons f (box (CFunction xs `((name . ,f)) blocks '())))] [else (error 'interp-def "unhandled" ast)] )) (define/override (interp-program ast) (match ast [(ProgramDefs info ds) ((initialize!) runtime-config:rootstack-size runtime-config:heap-size) (define top-level (for/list ([d ds]) (interp-def d))) (for/list ([f (in-dict-values top-level)]) (set-box! f (match (unbox f) [(CFunction xs info blocks '()) (CFunction xs info blocks top-level)]))) ((interp-tail top-level '()) (TailCall (Var 'main) '()))] [else (error 'interp-program "unhandled ~a" ast)] )) )) (define (interp-Cfun p) (define Cfun-class (interp-Cfun-mixin (interp-Cvecof-mixin (interp-Cvec-mixin (interp-Cwhile-mixin (interp-Cif-mixin (interp-Cvar-mixin interp-Lfun-prime-class))))))) (send (new Cfun-class) interp-program p))
false
a527ec73fea84cf2281124af2bfe5104814d2f29
7286de0514206517838e7ce56811fbd6a0812753
/private/contract.rkt
c57a92a91c518ad7ebabf50a6d3c0d02dc951ef8
[]
no_license
standardgalactic/relation
faa5d9e9e76325827bb74f25f7833a68b7332ec0
eba916a37511427f54b9d6093f7620600c99c1a7
refs/heads/master
2023-01-12T01:43:36.950886
2020-11-04T21:14:06
2020-11-04T21:14:06
null
0
0
null
null
null
null
UTF-8
Racket
false
false
703
rkt
contract.rkt
#lang racket/base (require (except-in racket/contract predicate/c) contract/social) (provide (contract-out [variadic-comparison-predicate/c (self-map/c contract?)] [variadic-comparison-selection/c (self-map/c contract?)])) (define (variadic-comparison/c type/c return/c) ;; TODO: improve to ensure that arguments are type/c ;; (rather than any/c) when no key is provided (->* (any/c) (#:key (maybe/c (encoder/c type/c))) #:rest list? return/c)) (define (variadic-comparison-predicate/c type/c) (variadic-comparison/c type/c boolean?)) (define (variadic-comparison-selection/c type/c) (variadic-comparison/c type/c any/c))
false
e76b92fee61e1b193fbf8864d80c33d8bbd8fc1d
6858cbebface7beec57e60b19621120da5020a48
/16/1/3.rkt
1ac657848d1847fdd31480d6dffb12733cb76c0d
[]
no_license
ponyatov/PLAI
a68b712d9ef85a283e35f9688068b392d3d51cb2
6bb25422c68c4c7717b6f0d3ceb026a520e7a0a2
refs/heads/master
2020-09-17T01:52:52.066085
2017-03-28T07:07:30
2017-03-28T07:07:30
66,084,244
2
0
null
null
null
null
UTF-8
Racket
false
false
53
rkt
3.rkt
(define (real-sqrt-1 x) (sqrt (non-neg?-contract x)))
false
360a2b0df84f3106996b0977a99b0f84f157ec02
2d07e3ae1f4df44ce8ce591d144d6d5d04ceb20d
/typed/2htdp/image-to-bitmap.rkt
a719bed6db40d743bb987e566cff68dd917a57f2
[ "MIT" ]
permissive
AlexKnauth/typed-big-bang
757e7cb9ba61c5a7591d8e241d66cb120f9b747c
36b8319d06bc61e1fb3129359962e5e63b590eda
refs/heads/master
2022-01-14T15:43:37.339740
2022-01-07T14:45:43
2022-01-07T14:45:43
29,885,420
1
1
null
null
null
null
UTF-8
Racket
false
false
652
rkt
image-to-bitmap.rkt
#lang typed/racket/base (provide image->bitmap) (require typed/racket/class (only-in typed/racket/draw Bitmap% make-bitmap bitmap-dc%) (only-in typed/2htdp/image Image image-width image-height)) (require/typed mrlib/image-core [render-image [Image (Object) Real Real -> Void]]) (: image->bitmap : Image -> (Instance Bitmap%)) (define (image->bitmap image) (let* ([width (assert (image-width image) positive?)] [height (assert (image-height image) positive?)] [bm (make-bitmap width height)] [dc (make-object bitmap-dc% bm)]) (send dc clear) (render-image image dc 0 0) bm))
false
84c71038a9fc348cffccaf6262be749f945f1c3d
50508fbb3a659c1168cb61f06a38a27a1745de15
/turnstile-example/turnstile/examples/util/filter-maximal.rkt
f1814941bb0180abe11d487a65e42a592d12cf28
[ "BSD-2-Clause" ]
permissive
phlummox/macrotypes
e76a8a4bfe94a2862de965a4fefd03cae7f2559f
ea3bf603290fd9d769f4f95e87efe817430bed7b
refs/heads/master
2022-12-30T17:59:15.489797
2020-08-11T16:03:02
2020-08-11T16:03:02
307,035,363
1
0
null
null
null
null
UTF-8
Racket
false
false
570
rkt
filter-maximal.rkt
#lang racket/base (provide filter-maximal) ;; filter-maximal : [Listof X] [X X -> Bool] -> [Listof X] ;; <? is a partial ordering predicate (define (filter-maximal xs <?) (reverse (for/fold ([acc '()]) ([x (in-list xs)]) (merge-with x acc <?)))) ;; merge-with : X [Listof X] [X X -> Bool] -> [Listof X] ;; <? is a partial ordering predicate (define (merge-with x ys <?) (define (greater? y) (<? x y)) (cond [(ormap greater? ys) ys] [else (define (not-lesser? y) (not (<? y x))) (cons x (filter not-lesser? ys))]))
false
ef46a875338c3cb05f9138c5ea59989226cf6ca4
fc6465100ab657aa1e31af6a4ab77a3284c28ff0
/results/brutally-unfair-24/rbtrees-2-enum-brutally-unfair.rktd
5b22b230731019f93cd6755137ee63cbed268e38
[]
no_license
maxsnew/Redex-Enum-Paper
f5ba64a34904beb6ed9be39ff9a5e1e5413c059b
d77ec860d138cb023628cc41f532dd4eb142f15b
refs/heads/master
2020-05-21T20:07:31.382540
2017-09-04T14:42:13
2017-09-04T14:42:13
17,602,325
0
0
null
null
null
null
UTF-8
Racket
false
false
67,857
rktd
rbtrees-2-enum-brutally-unfair.rktd
(start 2015-06-19T12:40:49 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:40:49 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T12:40:49 (#:amount 32790992 #:time 236)) (heartbeat 2015-06-19T12:40:59 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T12:41:03 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 1138 #:time 14102)) (new-average 2015-06-19T12:41:03 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 14101.0 #:stderr +nan.0)) (heartbeat 2015-06-19T12:41:09 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:41:19 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T12:41:23 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 1745 #:time 19855)) (new-average 2015-06-19T12:41:23 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 16978.0 #:stderr 2876.9999999999995)) (heartbeat 2015-06-19T12:41:29 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:41:39 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:41:49 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:41:59 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T12:42:05 (#:amount 93309624 #:time 303)) (heartbeat 2015-06-19T12:42:09 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T12:42:10 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 3977 #:time 47351)) (new-average 2015-06-19T12:42:10 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 27102.333333333336 #:stderr 10259.68656657914)) (heartbeat 2015-06-19T12:42:19 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:42:29 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:42:39 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:42:49 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:42:59 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:43:09 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:43:19 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T12:43:19 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) (R E (s (s (s (s (s O))))) E)) #:iterations 5684 #:time 69218)) (new-average 2015-06-19T12:43:19 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 37631.25 #:stderr 12786.268822288748)) (counterexample 2015-06-19T12:43:25 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 532 #:time 5600)) (new-average 2015-06-19T12:43:25 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 31225.0 #:stderr 11795.475458835901)) (gc-major 2015-06-19T12:43:28 (#:amount 101299472 #:time 253)) (heartbeat 2015-06-19T12:43:29 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T12:43:38 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 1335 #:time 13232)) (new-average 2015-06-19T12:43:38 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 28226.166666666668 #:stderr 10087.04592837324)) (heartbeat 2015-06-19T12:43:39 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T12:43:47 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s (s (s (s (s (s (s O)))))))) E) #:iterations 911 #:time 8709)) (new-average 2015-06-19T12:43:47 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 25438.0 #:stderr 8969.468779725821)) (heartbeat 2015-06-19T12:43:49 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T12:43:56 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 823 #:time 9407)) (new-average 2015-06-19T12:43:56 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 23434.125 #:stderr 8022.097148407151)) (counterexample 2015-06-19T12:43:57 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 49 #:time 467)) (new-average 2015-06-19T12:43:57 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 20882.222222222223 #:stderr 7520.994088360959)) (heartbeat 2015-06-19T12:43:59 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:44:09 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:44:19 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T12:44:29 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s (s (s O)))) E) #:iterations 3175 #:time 32039)) (new-average 2015-06-19T12:44:29 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 21997.9 #:stderr 6818.872235608726)) (heartbeat 2015-06-19T12:44:29 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T12:44:38 (#:amount 96354000 #:time 309)) (heartbeat 2015-06-19T12:44:39 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:44:49 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:44:59 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T12:45:05 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 3153 #:time 36020)) (new-average 2015-06-19T12:45:05 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 23272.636363636364 #:stderr 6298.251184795416)) (heartbeat 2015-06-19T12:45:09 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:45:19 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:45:29 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:45:39 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:45:49 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T12:45:55 (#:amount 98428016 #:time 305)) (heartbeat 2015-06-19T12:45:59 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:46:09 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:46:19 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:46:29 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:46:39 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:46:49 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:46:59 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:47:09 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:47:19 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T12:47:26 (#:amount 96782792 #:time 309)) (heartbeat 2015-06-19T12:47:29 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:47:39 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:47:49 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:47:59 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:48:09 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:48:19 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:48:29 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:48:39 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T12:48:43 (#:amount 97727224 #:time 253)) (heartbeat 2015-06-19T12:48:49 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:48:59 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:49:09 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T12:49:10 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 20179 #:time 246037)) (new-average 2015-06-19T12:49:10 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 41836.333333333336 #:stderr 19433.66885515232)) (heartbeat 2015-06-19T12:49:19 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:49:29 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T12:49:30 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 1777 #:time 19349)) (new-average 2015-06-19T12:49:30 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 40106.53846153846 #:stderr 17959.87153193995)) (heartbeat 2015-06-19T12:49:39 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:49:49 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T12:49:56 (#:amount 95180536 #:time 304)) (heartbeat 2015-06-19T12:49:59 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T12:50:00 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s (s O))) E) #:iterations 2491 #:time 29874)) (new-average 2015-06-19T12:50:00 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 39375.57142857143 #:stderr 16643.669333952752)) (heartbeat 2015-06-19T12:50:09 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T12:50:13 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 1252 #:time 13562)) (new-average 2015-06-19T12:50:13 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 37654.666666666664 #:stderr 15589.687133201585)) (counterexample 2015-06-19T12:50:14 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 46 #:time 478)) (new-average 2015-06-19T12:50:14 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 35331.125 #:stderr 14766.76666281276)) (heartbeat 2015-06-19T12:50:19 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:50:29 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:50:39 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:50:49 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T12:50:54 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s (s O))) E) #:iterations 3505 #:time 40101)) (new-average 2015-06-19T12:50:54 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 35611.705882352944 #:stderr 13873.799472907425)) (heartbeat 2015-06-19T12:50:59 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:51:09 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T12:51:14 (#:amount 101121352 #:time 303)) (heartbeat 2015-06-19T12:51:19 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:51:29 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:51:39 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:51:49 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:51:59 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:52:09 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:52:19 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T12:52:28 (#:amount 95986736 #:time 252)) (heartbeat 2015-06-19T12:52:29 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T12:52:33 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 8843 #:time 98941)) (new-average 2015-06-19T12:52:33 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 39130.0 #:stderr 13545.249417333658)) (heartbeat 2015-06-19T12:52:39 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:52:49 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:52:59 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T12:53:06 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s (s (s O)))) E) #:iterations 3019 #:time 33060)) (new-average 2015-06-19T12:53:06 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 38810.52631578947 #:stderr 12816.505590521236)) (heartbeat 2015-06-19T12:53:09 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:53:19 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:53:29 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T12:53:36 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s (s (s O)))) E) #:iterations 2669 #:time 30349)) (new-average 2015-06-19T12:53:36 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 38387.45 #:stderr 12166.16322287589)) (heartbeat 2015-06-19T12:53:39 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T12:53:44 (#:amount 99397008 #:time 262)) (heartbeat 2015-06-19T12:53:49 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:53:59 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:54:09 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:54:19 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:54:29 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:54:39 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T12:54:45 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s (s O))) E) #:iterations 6248 #:time 69478)) (new-average 2015-06-19T12:54:45 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 39867.95238095238 #:stderr 11666.64895994769)) (heartbeat 2015-06-19T12:54:49 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T12:54:58 (#:amount 95494064 #:time 298)) (heartbeat 2015-06-19T12:54:59 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:55:09 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:55:19 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:55:29 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:55:39 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:55:49 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:55:59 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:56:09 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T12:56:15 (#:amount 100238736 #:time 302)) (heartbeat 2015-06-19T12:56:19 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:56:29 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T12:56:38 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s (s O))) E) #:iterations 9911 #:time 112666)) (new-average 2015-06-19T12:56:38 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 43176.954545454544 #:stderr 11605.451023776264)) (heartbeat 2015-06-19T12:56:39 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T12:56:48 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 798 #:time 10192)) (new-average 2015-06-19T12:56:48 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 41742.82608695652 #:stderr 11181.741765206509)) (heartbeat 2015-06-19T12:56:49 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:56:59 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:57:09 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:57:19 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:57:29 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T12:57:31 (#:amount 95666872 #:time 295)) (heartbeat 2015-06-19T12:57:39 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:57:49 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:57:59 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:58:09 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:58:19 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T12:58:28 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 9267 #:time 99841)) (new-average 2015-06-19T12:58:28 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 44163.58333333333 #:stderr 10975.9799323038)) (heartbeat 2015-06-19T12:58:29 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:58:39 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T12:58:41 (#:amount 100040752 #:time 255)) (heartbeat 2015-06-19T12:58:49 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:58:59 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T12:59:00 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 3441 #:time 32343)) (new-average 2015-06-19T12:59:00 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 43690.759999999995 #:stderr 10538.402466262774)) (counterexample 2015-06-19T12:59:05 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s (s O))) E) #:iterations 569 #:time 5326)) (new-average 2015-06-19T12:59:05 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 42215.192307692305 #:stderr 10231.925973602914)) (heartbeat 2015-06-19T12:59:09 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:59:19 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:59:29 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:59:39 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T12:59:43 (#:amount 95875192 #:time 252)) (heartbeat 2015-06-19T12:59:49 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T12:59:59 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:00:09 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:00:19 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:00:29 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:00:35 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 9605 #:time 89896)) (new-average 2015-06-19T13:00:35 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 43981.148148148146 #:stderr 10002.795774097416)) (counterexample 2015-06-19T13:00:37 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 148 #:time 1406)) (new-average 2015-06-19T13:00:37 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 42460.60714285714 #:stderr 9758.130793492583)) (counterexample 2015-06-19T13:00:39 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 222 #:time 2089)) (new-average 2015-06-19T13:00:39 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 41068.48275862068 #:stderr 9517.991034175855)) (heartbeat 2015-06-19T13:00:39 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:00:44 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 528 #:time 4965)) (new-average 2015-06-19T13:00:44 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 39865.033333333326 #:stderr 9273.67063019994)) (gc-major 2015-06-19T13:00:47 (#:amount 99625888 #:time 252)) (heartbeat 2015-06-19T13:00:50 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:01:00 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:01:10 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:01:20 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:01:30 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:01:32 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 5205 #:time 48827)) (new-average 2015-06-19T13:01:32 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 40154.12903225805 #:stderr 8974.190425851519)) (counterexample 2015-06-19T13:01:36 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 422 #:time 3970)) (new-average 2015-06-19T13:01:36 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 39023.37499999999 #:stderr 8762.487809888671)) (heartbeat 2015-06-19T13:01:40 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T13:01:49 (#:amount 95505328 #:time 252)) (heartbeat 2015-06-19T13:01:50 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:02:00 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:02:10 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:02:20 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:02:22 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 4453 #:time 45265)) (new-average 2015-06-19T13:02:22 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 39212.515151515145 #:stderr 8494.913831353648)) (heartbeat 2015-06-19T13:02:30 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:02:40 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:02:50 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:03:00 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T13:03:02 (#:amount 100473376 #:time 254)) (heartbeat 2015-06-19T13:03:10 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:03:20 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:03:30 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:03:40 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:03:50 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:04:00 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:04:06 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s (s O))) E) #:iterations 9178 #:time 104485)) (new-average 2015-06-19T13:04:06 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 41132.26470588235 #:stderr 8461.919640397828)) (heartbeat 2015-06-19T13:04:10 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:04:20 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T13:04:23 (#:amount 95492136 #:time 298)) (heartbeat 2015-06-19T13:04:30 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:04:40 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:04:50 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:05:00 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:05:10 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:05:17 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 5930 #:time 70717)) (new-average 2015-06-19T13:05:17 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 41977.54285714286 #:stderr 8259.958668822761)) (heartbeat 2015-06-19T13:05:20 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:05:30 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:05:40 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T13:05:41 (#:amount 100274272 #:time 304)) (heartbeat 2015-06-19T13:05:50 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:06:00 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:06:02 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s (s O))) E) #:iterations 3668 #:time 45308)) (new-average 2015-06-19T13:06:02 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 42070.055555555555 #:stderr 8027.770021652759)) (heartbeat 2015-06-19T13:06:10 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:06:20 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:06:30 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:06:40 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:06:50 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:07:00 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:07:10 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T13:07:10 (#:amount 95891272 #:time 303)) (heartbeat 2015-06-19T13:07:20 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:07:30 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:07:40 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:07:50 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:08:00 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:08:10 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:08:12 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 9971 #:time 130416)) (new-average 2015-06-19T13:08:12 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 44457.78378378378 #:stderr 8164.730194676036)) (heartbeat 2015-06-19T13:08:20 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:08:30 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T13:08:38 (#:amount 99636240 #:time 308)) (heartbeat 2015-06-19T13:08:40 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:08:50 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:09:00 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:09:10 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:09:20 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:09:20 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s (s O))) E) #:iterations 5278 #:time 67921)) (new-average 2015-06-19T13:09:20 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 45075.23684210526 #:stderr 7970.91575680236)) (counterexample 2015-06-19T13:09:26 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s (s O))) E) #:iterations 452 #:time 5464)) (new-average 2015-06-19T13:09:26 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 44059.5641025641 #:stderr 7829.9973466863885)) (counterexample 2015-06-19T13:09:29 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s (s O))) E) #:iterations 237 #:time 3196)) (new-average 2015-06-19T13:09:29 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 43037.975 #:stderr 7699.809076927674)) (heartbeat 2015-06-19T13:09:30 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:09:40 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:09:50 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T13:10:00 (#:amount 95582320 #:time 299)) (heartbeat 2015-06-19T13:10:00 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:10:02 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s (s (s (s O))))) E) #:iterations 2695 #:time 33368)) (new-average 2015-06-19T13:10:02 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 42802.12195121951 #:stderr 7513.3637462300985)) (heartbeat 2015-06-19T13:10:10 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:10:20 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:10:30 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:10:40 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:10:50 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:11:00 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:11:10 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:11:17 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 6427 #:time 74290)) (new-average 2015-06-19T13:11:17 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 43551.83333333333 #:stderr 7370.52077357976)) (gc-major 2015-06-19T13:11:18 (#:amount 100081280 #:time 300)) (heartbeat 2015-06-19T13:11:20 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:11:23 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s (s O))) E) #:iterations 538 #:time 6632)) (new-average 2015-06-19T13:11:23 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 42693.23255813953 #:stderr 7248.106461537529)) (heartbeat 2015-06-19T13:11:30 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:11:40 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:11:43 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 1548 #:time 19885)) (new-average 2015-06-19T13:11:43 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 42174.86363636363 #:stderr 7100.408222236277)) (counterexample 2015-06-19T13:11:48 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 402 #:time 5261)) (new-average 2015-06-19T13:11:48 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 41354.555555555555 #:stderr 6989.134437424961)) (heartbeat 2015-06-19T13:11:50 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:12:00 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:12:10 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:12:20 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:12:30 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:12:40 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T13:12:45 (#:amount 94897912 #:time 303)) (heartbeat 2015-06-19T13:12:50 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:13:00 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:13:10 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:13:20 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:13:30 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:13:40 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:13:50 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:14:00 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:14:10 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T13:14:17 (#:amount 101401216 #:time 309)) (heartbeat 2015-06-19T13:14:20 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:14:22 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s (s O))) E) #:iterations 11557 #:time 154010)) (new-average 2015-06-19T13:14:22 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 43803.586956521736 #:stderr 7260.9867712552705)) (heartbeat 2015-06-19T13:14:30 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:14:36 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 1040 #:time 13692)) (new-average 2015-06-19T13:14:36 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 43162.91489361702 #:stderr 7133.6458594947235)) (heartbeat 2015-06-19T13:14:40 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:14:43 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 518 #:time 6727)) (new-average 2015-06-19T13:14:43 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 42403.83333333333 #:stderr 7024.580919539162)) (heartbeat 2015-06-19T13:14:50 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:15:00 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:15:10 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:15:20 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:15:30 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:15:32 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 3838 #:time 49369)) (new-average 2015-06-19T13:15:32 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 42545.97959183673 #:stderr 6881.19697088502)) (heartbeat 2015-06-19T13:15:40 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:15:42 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s (s O))) E) #:iterations 766 #:time 10083)) (new-average 2015-06-19T13:15:42 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 41896.719999999994 #:stderr 6773.357727126516)) (gc-major 2015-06-19T13:15:43 (#:amount 95945328 #:time 273)) (heartbeat 2015-06-19T13:15:50 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:16:00 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:16:10 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:16:20 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:16:30 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:16:40 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:16:50 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:17:00 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:17:10 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T13:17:12 (#:amount 99507776 #:time 305)) (counterexample 2015-06-19T13:17:19 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s (s O))) E) #:iterations 7346 #:time 96992)) (new-average 2015-06-19T13:17:19 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 42977.01960784313 #:stderr 6726.534782893976)) (heartbeat 2015-06-19T13:17:20 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:17:30 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:17:40 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:17:50 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:18:00 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:18:06 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s (s (s (s (s (s (s O)))))))) E) #:iterations 3993 #:time 47077)) (new-average 2015-06-19T13:18:06 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 43055.86538461538 #:stderr 6596.381256493382)) (heartbeat 2015-06-19T13:18:10 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:18:20 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:18:21 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s (s O))) E) #:iterations 1525 #:time 15199)) (new-average 2015-06-19T13:18:21 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 42530.264150943396 #:stderr 6492.0359520509455)) (gc-major 2015-06-19T13:18:29 (#:amount 95910336 #:time 298)) (heartbeat 2015-06-19T13:18:30 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:18:40 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:18:50 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:18:53 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 2681 #:time 31375)) (new-average 2015-06-19T13:18:53 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 42323.68518518518 #:stderr 6374.027223780324)) (heartbeat 2015-06-19T13:19:00 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:19:10 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:19:12 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s (s (s (s (s O)))))) E) #:iterations 1831 #:time 19694)) (new-average 2015-06-19T13:19:12 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 41912.23636363636 #:stderr 6270.575990542988)) (heartbeat 2015-06-19T13:19:20 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:19:29 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 1337 #:time 16212)) (new-average 2015-06-19T13:19:29 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 41453.303571428565 #:stderr 6174.6621320322465)) (heartbeat 2015-06-19T13:19:30 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:19:40 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T13:19:45 (#:amount 99490016 #:time 253)) (heartbeat 2015-06-19T13:19:50 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:19:59 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 2790 #:time 30607)) (new-average 2015-06-19T13:19:59 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 41262.99999999999 #:stderr 6068.352134874185)) (heartbeat 2015-06-19T13:20:00 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:20:10 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:20:20 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:20:30 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:20:40 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:20:50 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:21:00 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T13:21:07 (#:amount 95794200 #:time 297)) (heartbeat 2015-06-19T13:21:10 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:21:20 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:21:30 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:21:40 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:21:50 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:22:00 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:22:10 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:22:16 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 11023 #:time 136683)) (new-average 2015-06-19T13:22:16 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 42908.172413793094 #:stderr 6185.601494408878)) (counterexample 2015-06-19T13:22:17 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 91 #:time 1004)) (new-average 2015-06-19T13:22:17 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 42197.93220338982 #:stderr 6121.200975474778)) (heartbeat 2015-06-19T13:22:20 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T13:22:30 (#:amount 100037928 #:time 271)) (heartbeat 2015-06-19T13:22:30 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:22:40 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:22:50 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:23:00 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:23:10 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:23:20 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:23:24 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 5408 #:time 66782)) (new-average 2015-06-19T13:23:24 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 42607.66666666666 #:stderr 6032.24781209114)) (heartbeat 2015-06-19T13:23:30 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:23:37 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 1157 #:time 13953)) (new-average 2015-06-19T13:23:37 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 42137.918032786874 #:stderr 5951.103075657583)) (heartbeat 2015-06-19T13:23:40 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T13:23:50 (#:amount 95625376 #:time 302)) (heartbeat 2015-06-19T13:23:50 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:24:00 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:24:10 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:24:20 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:24:30 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:24:40 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:24:50 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:25:00 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:25:06 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 7130 #:time 88764)) (new-average 2015-06-19T13:25:06 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 42889.95161290321 #:stderr 5902.435320757059)) (heartbeat 2015-06-19T13:25:10 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T13:25:15 (#:amount 99903632 #:time 302)) (heartbeat 2015-06-19T13:25:20 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:25:30 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:25:40 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:25:50 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:25:54 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 3960 #:time 48047)) (new-average 2015-06-19T13:25:54 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 42971.80952380951 #:stderr 5808.567086730886)) (heartbeat 2015-06-19T13:26:00 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:26:01 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 544 #:time 7288)) (new-average 2015-06-19T13:26:01 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 42414.249999999985 #:stderr 5744.211552607644)) (heartbeat 2015-06-19T13:26:10 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:26:20 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:26:30 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T13:26:38 (#:amount 95443712 #:time 301)) (heartbeat 2015-06-19T13:26:40 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:26:50 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:27:00 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:27:01 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 4639 #:time 59338)) (new-average 2015-06-19T13:27:01 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 42674.61538461537 #:stderr 5661.139107211396)) (heartbeat 2015-06-19T13:27:10 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:27:14 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 1041 #:time 13697)) (new-average 2015-06-19T13:27:14 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 42235.56060606059 #:stderr 5591.96732327561)) (heartbeat 2015-06-19T13:27:20 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:27:30 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:27:40 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:27:50 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:28:00 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T13:28:04 (#:amount 100356976 #:time 256)) (heartbeat 2015-06-19T13:28:10 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:28:20 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:28:30 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:28:33 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 6323 #:time 78863)) (new-average 2015-06-19T13:28:33 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 42782.23880597013 #:stderr 5534.93629786182)) (heartbeat 2015-06-19T13:28:40 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:28:44 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s (s (s O)))) E) #:iterations 799 #:time 10417)) (new-average 2015-06-19T13:28:44 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 42306.27941176469 #:stderr 5473.6653593083)) (counterexample 2015-06-19T13:28:46 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s (s (s O)))) E) #:iterations 199 #:time 1872)) (new-average 2015-06-19T13:28:46 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 41720.2608695652 #:stderr 5425.494913236965)) (heartbeat 2015-06-19T13:28:51 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:29:01 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:29:11 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:29:21 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T13:29:25 (#:amount 95873864 #:time 302)) (heartbeat 2015-06-19T13:29:31 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:29:41 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:29:51 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:29:53 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 5299 #:time 67135)) (new-average 2015-06-19T13:29:53 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 42083.32857142856 #:stderr 5359.737379722518)) (heartbeat 2015-06-19T13:30:01 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:30:11 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:30:21 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:30:31 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:30:41 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:30:51 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T13:30:55 (#:amount 99618664 #:time 303)) (heartbeat 2015-06-19T13:31:01 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:31:11 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:31:21 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:31:31 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:31:37 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 7856 #:time 104096)) (new-average 2015-06-19T13:31:37 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 42956.73239436618 #:stderr 5355.409770732567)) (heartbeat 2015-06-19T13:31:41 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:31:51 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:32:01 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:32:03 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 1921 #:time 25825)) (new-average 2015-06-19T13:32:03 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 42718.79166666665 #:stderr 5285.863358137332)) (heartbeat 2015-06-19T13:32:11 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:32:21 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T13:32:23 (#:amount 95937864 #:time 303)) (heartbeat 2015-06-19T13:32:31 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:32:41 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:32:51 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:33:01 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:33:11 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:33:21 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:33:31 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:33:41 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:33:51 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T13:33:53 (#:amount 99602552 #:time 303)) (heartbeat 2015-06-19T13:34:01 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:34:03 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s (s O))) E) #:iterations 9115 #:time 120588)) (new-average 2015-06-19T13:34:03 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 43785.49315068492 #:stderr 5320.969311726301)) (heartbeat 2015-06-19T13:34:11 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:34:21 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:34:31 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:34:41 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:34:51 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:34:58 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s (s (s O)))) E) #:iterations 4286 #:time 55228)) (new-average 2015-06-19T13:34:58 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 43940.121621621605 #:stderr 5250.849063020052)) (heartbeat 2015-06-19T13:35:01 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:35:11 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T13:35:21 (#:amount 95641784 #:time 306)) (heartbeat 2015-06-19T13:35:21 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:35:31 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:35:41 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:35:51 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:36:01 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:36:11 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:36:21 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:36:31 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:36:37 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 7350 #:time 98566)) (new-average 2015-06-19T13:36:37 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 44668.46666666665 #:stderr 5231.315764737434)) (counterexample 2015-06-19T13:36:37 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s (s (s O)))) E) #:iterations 29 #:time 420)) (new-average 2015-06-19T13:36:37 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 44086.249999999985 #:stderr 5194.753650783122)) (heartbeat 2015-06-19T13:36:41 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T13:36:50 (#:amount 100115592 #:time 277)) (heartbeat 2015-06-19T13:36:51 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:36:51 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 1151 #:time 13798)) (new-average 2015-06-19T13:36:51 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 43692.8831168831 #:stderr 5141.914217043964)) (heartbeat 2015-06-19T13:37:01 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:37:10 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s (s (s (s (s (s O))))))) E) #:iterations 1525 #:time 18729)) (new-average 2015-06-19T13:37:10 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 43372.8205128205 #:stderr 5085.645640722346)) (heartbeat 2015-06-19T13:37:11 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:37:21 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:37:26 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 1368 #:time 16396)) (new-average 2015-06-19T13:37:26 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 43031.341772151885 #:stderr 5032.456634644758)) (counterexample 2015-06-19T13:37:30 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s (s O))) E) #:iterations 280 #:time 3188)) (new-average 2015-06-19T13:37:30 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 42533.29999999999 #:stderr 4994.048947687512)) (heartbeat 2015-06-19T13:37:31 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:37:41 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:37:51 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:38:01 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:38:11 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T13:38:12 (#:amount 96196600 #:time 300)) (heartbeat 2015-06-19T13:38:21 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:38:31 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:38:41 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:38:51 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:38:54 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 7058 #:time 84446)) (new-average 2015-06-19T13:38:54 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 43050.74074074073 #:stderr 4959.077977068668)) (heartbeat 2015-06-19T13:39:01 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:39:11 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:39:20 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s (s (s O)))) E) #:iterations 2206 #:time 26327)) (new-average 2015-06-19T13:39:20 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 42846.79268292682 #:stderr 4902.472155186723)) (heartbeat 2015-06-19T13:39:21 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T13:39:31 (#:amount 99028504 #:time 254)) (heartbeat 2015-06-19T13:39:31 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:39:41 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:39:51 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:40:01 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:40:11 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:40:21 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:40:31 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:40:41 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:40:51 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T13:40:51 (#:amount 95765496 #:time 302)) (heartbeat 2015-06-19T13:41:01 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:41:06 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s (s O))) E) #:iterations 8827 #:time 106220)) (new-average 2015-06-19T13:41:06 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 43610.32530120481 #:stderr 4902.86417733326)) (heartbeat 2015-06-19T13:41:11 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:41:21 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:41:31 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:41:41 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:41:51 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:42:01 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:42:11 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T13:42:11 (#:amount 99913640 #:time 302)) (counterexample 2015-06-19T13:42:16 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s (s (s (s (s (s O))))))) E) #:iterations 5906 #:time 69970)) (new-average 2015-06-19T13:42:16 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 43924.13095238094 #:stderr 4854.2987091911655)) (counterexample 2015-06-19T13:42:16 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s (s O))) E) #:iterations 11 #:time 160)) (new-average 2015-06-19T13:42:16 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 43409.2588235294 #:stderr 4824.40225592079)) (heartbeat 2015-06-19T13:42:21 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:42:30 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s (s (s O)))) E) #:iterations 1101 #:time 13984)) (new-average 2015-06-19T13:42:30 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 43067.10465116278 #:stderr 4780.235439543067)) (heartbeat 2015-06-19T13:42:31 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:42:41 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:42:51 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:43:01 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:43:11 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:43:21 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:43:31 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T13:43:38 (#:amount 95240616 #:time 303)) (heartbeat 2015-06-19T13:43:41 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:43:51 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:43:56 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s (s (s O)))) E) #:iterations 6464 #:time 85442)) (new-average 2015-06-19T13:43:56 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 43554.172413793094 #:stderr 4750.008794128155)) (heartbeat 2015-06-19T13:44:01 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:44:11 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:44:21 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:44:24 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 2142 #:time 27973)) (new-average 2015-06-19T13:44:24 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 43377.113636363625 #:stderr 4699.058135979653)) (heartbeat 2015-06-19T13:44:31 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:44:41 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:44:51 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:44:56 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 2517 #:time 32075)) (new-average 2015-06-19T13:44:56 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 43250.1235955056 #:stderr 4647.694942336743)) (heartbeat 2015-06-19T13:45:01 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:45:03 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s (s O))) E) #:iterations 641 #:time 7246)) (new-average 2015-06-19T13:45:03 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 42850.07777777776 #:stderr 4613.142225621781)) (gc-major 2015-06-19T13:45:05 (#:amount 101089224 #:time 287)) (heartbeat 2015-06-19T13:45:11 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:45:21 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:45:31 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:45:41 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:45:51 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:46:00 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 4822 #:time 57374)) (new-average 2015-06-19T13:46:00 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 43009.6813186813 #:stderr 4564.957657403834)) (heartbeat 2015-06-19T13:46:01 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:46:11 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:46:21 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T13:46:26 (#:amount 95961424 #:time 301)) (heartbeat 2015-06-19T13:46:31 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:46:41 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:46:51 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:47:01 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:47:06 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 5359 #:time 66159)) (new-average 2015-06-19T13:47:06 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 43261.30434782607 #:stderr 4522.071907466418)) (heartbeat 2015-06-19T13:47:11 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:47:22 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:47:32 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:47:42 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (gc-major 2015-06-19T13:47:46 (#:amount 99417320 #:time 303)) (counterexample 2015-06-19T13:47:47 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 3480 #:time 40302)) (new-average 2015-06-19T13:47:47 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 43229.48387096773 #:stderr 4473.296385131622)) (heartbeat 2015-06-19T13:47:52 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:48:02 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:48:03 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 1367 #:time 16468)) (new-average 2015-06-19T13:48:03 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 42944.78723404254 #:stderr 4434.600314195735)) (heartbeat 2015-06-19T13:48:12 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:48:22 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:48:32 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:48:42 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:48:52 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:49:02 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:49:09 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 5132 #:time 66144)) (new-average 2015-06-19T13:49:09 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 43188.989473684196 #:stderr 4394.462466086642)) (gc-major 2015-06-19T13:49:10 (#:amount 95523344 #:time 303)) (heartbeat 2015-06-19T13:49:12 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:49:22 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:49:25 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 1194 #:time 15965)) (new-average 2015-06-19T13:49:25 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 42905.406249999985 #:stderr 4357.68299133584)) (heartbeat 2015-06-19T13:49:32 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:49:42 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:49:52 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:49:53 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s (s (s O)))) E) #:iterations 2387 #:time 27910)) (new-average 2015-06-19T13:49:53 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 42750.814432989675 #:stderr 4315.294386311874)) (heartbeat 2015-06-19T13:50:02 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:50:12 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:50:22 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (heartbeat 2015-06-19T13:50:32 (#:model "rbtrees-2" #:type enum-brutally-unfair)) (counterexample 2015-06-19T13:50:33 (#:model "rbtrees-2" #:type enum-brutally-unfair #:counterexample (B (R E (s O) E) (s (s O)) E) #:iterations 3185 #:time 40154)) (new-average 2015-06-19T13:50:33 (#:model "rbtrees-2" #:type enum-brutally-unfair #:average 42724.3163265306 #:stderr 4271.11598492717)) (finished 2015-06-19T13:50:33 (#:model "rbtrees-2" #:type enum-brutally-unfair #:time-ms 4187009 #:attempts 348959 #:num-counterexamples 98 #:rate-terms/s 83.34326484609898 #:attempts/cexp 3560.8061224489797))
false
254c9e1c112b2aba68a89a018afb0fa4d445a713
b08b7e3160ae9947b6046123acad8f59152375c3
/Programming Language Detection/Experiment-2/Dataset/Train/Racket/user-input-graphical.rkt
c84a27bde6a1ec998a7e3af2ea1c1bbdbc4c0e3b
[]
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
305
rkt
user-input-graphical.rkt
#lang racket (require racket/gui) (define str (get-text-from-user "Hi" "Enter a string")) (message-box "Hi" (format "You entered: ~a" str)) (define n (get-text-from-user "Hi" "Enter a number")) (message-box "Hi" (format "You entered: ~a" (or (string->number n) "bogus text")))
false
03e35498ca88181fb28a84f47d174fb1c8828301
e995fce18dbdd69a757f55a2c023d07fcce3cb6b
/cpcf/heap/lang.rkt
ff6a11209a3095396c060079eaaa97d69d7288bf
[]
no_license
dvanhorn/pcf
883deb8c60547f04027e9381d54849ee2e0acd7f
f04e2ff7f34b89a3dc6c2a70a6a3283f954d3a67
refs/heads/master
2021-01-18T21:52:28.126007
2016-03-30T09:26:31
2016-03-30T09:26:31
6,306,139
8
1
null
2015-07-20T20:34:58
2012-10-20T06:45:08
Racket
UTF-8
Racket
false
false
604
rkt
lang.rkt
#lang racket (require (for-syntax racket/base pcf/private/make-lang) (for-syntax (only-in cpcf/redex typable/contract?)) cpcf/heap/semantics pcf/private/racket-pcf pcf/private/label pcf/private/return) (provide #%top-interaction #%module-begin (all-from-out pcf/private/label) (all-from-out pcf/private/racket-pcf)) (define-syntax #%top-interaction (make-#%top-interaction #'-->cvσ typable/contract? #'injσ #'returnσ)) (define-syntax #%module-begin (make-#%module-begin #'-->cvσ typable/contract? #'injσ #'returnσ #'pp #'color))
true
3a837a8279dfa2733ee2e956a063504249f6c75b
1e961c6871767a6c0e1b0a23460db345f674efd2
/examples/lines.rkt
242e26fe3a671ec3fe23f8e4b1151a1489fbd82c
[]
no_license
dedbox/racket-js-voxel
0738d5c1a64d63756ca0e68549e5fb895562f1c5
661d75489af339dba515a972c6e66db8525ab4c9
refs/heads/master
2022-02-05T17:59:25.417394
2022-01-27T22:26:00
2022-01-27T22:26:00
212,428,233
1
0
null
2022-01-27T22:26:01
2019-10-02T19:49:16
JavaScript
UTF-8
Racket
false
false
604
rkt
lines.rkt
#lang voxel (draw (line (^ 1 3 0) (^ 3 3 0) red)) (draw (line (^ -1 3 0) (^ -3 3 0) cyan)) (draw (line (^ 0 4 0) (^ 0 6 0) green)) (draw (line (^ 0 2 0) (^ 0 0 0) magenta)) (draw (line (^ 0 3 1) (^ 0 3 3) blue)) (draw (line (^ 0 3 -1) (^ 0 3 -3) yellow)) (draw (line (^ 1 3 3) (^ 3 3 1) black)) (draw (line (^ 3 3 -1) (^ 1 3 -3) black)) (draw (line (^ -1 3 -3) (^ -3 3 -1) black)) (draw (line (^ -3 3 1) (^ -1 3 3) black)) (draw (line (^ 0 2 3) (^ 0 0 1) white)) (draw (line (^ 0 2 -3) (^ 0 0 -1) white)) (draw (line (^ 1 0 0) (^ 3 2 0) white)) (draw (line (^ -1 0 0) (^ -3 2 0) white))
false
71ec437341763f0265bdb3cace87b041e3260b88
ecfd9ed1908bdc4b099f034b121f6e1fff7d7e22
/old1/eopl/7/test-letrec.rkt
e7d48e8428d6789862fc657003c41e86ea4dbc29
[ "MIT" ]
permissive
sKabYY/palestra
36d36fc3a03e69b411cba0bc2336c43b3550841c
06587df3c4d51961d928bd8dd64810c9da56abf4
refs/heads/master
2021-12-14T04:45:20.661697
2021-11-25T08:29:30
2021-11-25T08:29:30
12,856,067
6
3
null
null
null
null
UTF-8
Racket
false
false
123
rkt
test-letrec.rkt
#lang eopl (#%require "letrec.rkt") (#%require "lib.rkt") (#%require "test-cases.rkt") (interp-disp interp letrec-cases)
false
8f4721cc4bd07d03f730b9299fc53ad4587046e3
24338514b3f72c6e6994c953a3f3d840b060b441
/cur-test/cur/tests/ntac.rkt
919fdec93239c2bf8bdbdcc0041382bb47ab96f0
[ "BSD-2-Clause" ]
permissive
graydon/cur
4efcaec7648e2bf6d077e9f41cd2b8ce72fa9047
246c8e06e245e6e09bbc471c84d69a9654ac2b0e
refs/heads/master
2020-04-24T20:49:55.940710
2018-10-03T23:06:33
2018-10-03T23:06:33
172,257,266
1
0
BSD-2-Clause
2019-02-23T19:53:23
2019-02-23T19:53:23
null
UTF-8
Racket
false
false
740
rkt
ntac.rkt
#lang cur (require rackunit cur/stdlib/nat cur/stdlib/bool cur/stdlib/prop cur/stdlib/sugar cur/ntac/base cur/ntac/standard) ;; Not quite and-proj1; need elim for that. (define-theorem and-proj1 (forall (A : Type) (B : Type) (c : (And A B)) Type) (try by-assumption) nop (by-intro A-) by-intro (by-intros c) nop ;interactive ; try (fill (exact A-)) ;; This works too (by-exact A-) ;; And this #;by-assumption) (check-equal? (and-proj1 Nat Bool (conj Nat Bool z true)) Nat) (check-equal? ((ntac (forall (A : Type) (a : A) A) (try by-assumption) (by-intros A a) (by-assumption a) #;by-assumption) Nat z) z) (check-equal? (((ntac (forall (A : Type) (a : A) A) by-obvious) Nat) z) z)
false
c1bbe6a8ea473bf60ac26cdb4c05775484f8a7f8
0270165427f0c03219972228e3b3b80f38ce25ce
/k-2-sheet-helpers.rkt
fd98acd54018fec6b3cab89ba72706d72585def4
[]
no_license
thoughtstem/ts-curric-common
8100cf903bafd9f89663487f3cccac55b8222086
1a8c2d03fd2b4d44595e8bf2ad0e1e654b83f14b
refs/heads/master
2020-03-30T17:42:58.579594
2018-12-06T18:27:49
2018-12-06T18:27:49
151,466,965
0
0
null
null
null
null
UTF-8
Racket
false
false
705
rkt
k-2-sheet-helpers.rkt
#lang racket (provide bullets instructor-bg) (require 2htdp/image) (define title-font-size 18) (define (bullet-pad i) (overlay i (rectangle (+ 10 (image-width i)) (+ 10 (image-height i)) 'solid 'transparent))) (define (->bullet s+i) (text (~a (second s+i) ". " (first s+i)) title-font-size 'black)) (define (bullets . ss) (apply (curry above/align "left") (map bullet-pad (map ->bullet (map list ss (range 1 (add1 (length ss)))))))) (define (instructor-bg i) (overlay i (rectangle (image-width i) (image-height i) 'solid 'lightgray)))
false
a5c0b97144c9b920520457dcf558a13241a7672e
1b2e4194f09b31b23a5202dee0a7cc74d65a352a
/racket/convert.rkt
43fef7efee00f8ddd20b2f9ac441e077948b4bc8
[]
no_license
sorawee/Resugarer
80b78961285094817284bb0a1c0348ff9bac1a9a
1353b4309c101f0f1ac2df2cba7f3cba1f0a3a37
refs/heads/master
2020-03-17T02:35:40.110928
2014-06-03T04:24:09
2014-06-03T04:24:09
133,196,428
0
0
null
2018-05-13T01:31:13
2018-05-13T01:31:13
null
UTF-8
Racket
false
false
10,466
rkt
convert.rkt
(module term racket (provide (all-defined-out)) (require parser-tools/lex) (require ragg/support) (require (except-in rackunit fail)) (require racket/serialize) (require "term.rkt") (require "utility.rkt") (require "grammar.rkt") (define-setting DEBUG_COMMUNICATION set-debug-communication! #f) #| PRINTING |# (define (show-term t) (define (parens x) (format "(~a)" x)) (define (braces x) (format "{~a}" x)) (define (brackets x) (format "[~a]" x)) (define (comma-sep xs) (string-join xs ", ")) (define (origins->string os) (braces (brackets (comma-sep (map show-origin os))))) (define (show-node l . ts) (string-append (symbol->string l) (parens (comma-sep ts)))) (define (show-string s) (format "~v" s)) (define (show-symbol s) (format "~v" (symbol->string s))) (define (show-number n) (show-string (number->string n))) (define (show-origin o) (match o [(MacHead m c q) (string-append "Head" (parens (comma-sep (list (symbol->string m) (number->string c) (show-term q)))))] [(MacBody) "Body"] [(MacTranspBody) "!Body"] [(Alien) "Alien"])) (define (show-list xs) (brackets (comma-sep xs))) (define (show-binding b) (match b [(list v x) (show-node 'Bind (show-symbol v) (show-term x))])) (define (show-cond-case c) (match c [(list c x) (show-node 'CondCase (show-term c) (show-term x))])) (define (show-automaton-case c) (match c [(list s ': ts ...) (show-node 'ACondition (show-symbol s) (show-list (map show-automaton-transition ts)))])) (define (show-automaton-transition t) (match t ['accept (show-node 'Accept)] [(list s '-> l) (show-node 'ATransition (show-term s) (show-term l))])) (match t [(Tagged os t) (string-append (show-term t) (origins->string os))] [(list 'delay x) (show-node 'Delay (show-term x))] ; Surface [(list 'let (list bs ...) xs ...) (show-node 'Let (show-list (map show-binding bs)) (show-list (map show-term xs)))] [(list 'letrec (list bs ...) xs ...) (show-node 'Letrec (show-list (map show-binding bs)) (show-list (map show-term xs)))] [(list 'cond cs ... (list 'else c)) (show-node 'Cond (show-list (map show-cond-case cs)) (show-term c))] [(list 'inc x) (show-node 'Inc (show-term x))] [(list 'or xs ...) (show-node 'Or (show-list (map show-term xs)))] [(list 'and xs ...) (show-node 'And (show-list (map show-term xs)))] [(list 'automaton init cases ...) (show-node 'Automaton (show-symbol init) (show-list (map show-automaton-case cases)))] [(list 'transptest v x) (show-node 'TranspTest (show-symbol v) (show-term x))] [(list 'function (list (? symbol? vs) ...) x) (show-node 'Function (show-list (map show-symbol vs)) (show-term x))] [(list 'return x) (show-node 'Return (show-term x))] [(list 'cps-app x y (? symbol? k)) (show-node 'CpsApp (show-term x) (show-term y) (show-symbol k))] [(list 'cps x) (show-node 'Cps (show-term x))] ; Core [(? boolean? t) (if t (show-node 'True) (show-node 'False))] [(? number? t) (show-node 'Num (show-number t))] [(? string? t) (show-node 'Str (show-string t))] [(? symbol? t) (show-node 'Id (show-string (symbol->string t)))] [(list 'lambda (list (? symbol? vs) ...) x) (show-node 'Lambda (show-list (map show-symbol vs)) (show-term x))] [(list 'begin x xs ...) (show-node 'Begin (show-list (map show-term (cons x xs))))] [(list 'set! (? symbol? v) x) (show-node 'Set (show-symbol v) (show-term x))] [(list 'if x y z) (show-node 'If (show-term x) (show-term y) (show-term z))] [(list f xs ...) (show-node 'Apply (show-term f) (show-list (map show-term xs)))] ; Value [t (show-node 'Value (show-string (format "~s" (serialize t))))])) #| PARSING |# ; (also see grammar.rkt) (define (read-term str) (define (extract-list xs) (cond [(empty? xs) (list)] [(and (cons? xs) (string? (car xs))) (extract-list (cdr xs))] [(cons? xs) (cons (car xs) (extract-list (cdr xs)))])) (define (strip-quotes str) (substring str 1 (- (string-length str) 1))) (define (ast->term x) (match x [(? string? x) (strip-quotes x)] [`(tag "Body") (MacBody)] [`(tag "!Body") (MacTranspBody)] [`(tag "Alien") (Alien)] [`(tag "Head" ,_ ,l ,_ ,i ,_ ,t ,_) (MacHead (string->symbol l) (string->number i) (ast->term t))] [`(tags . ,xs) (map ast->term (extract-list xs))] [`(terms . ,xs) (map ast->term (extract-list xs))] [`(list ,_ ,xs ,_) (ast->term xs)] [`(node ,l ,_ ,x ,_) (Node (string->symbol l) (ast->term x))] [`(term ,x) (ast->term x)] [`(term ,x ,o) (Tagged (ast->term o) (ast->term x))])) (define (convert-origin o) (match o [(MacBody) (MacBody)] [(MacTranspBody) (MacTranspBody)] [(MacHead m i t) (MacHead m i (convert t))] [(Alien) (Alien)])) (define (convert t) (match t [(Tagged os x) (Tagged (map convert-origin os) (convert x))] [(Node 'Delay (list x)) (list 'delay (convert x))] ; Core [(Node 'True (list)) #t] [(Node 'False (list)) #f] [(Node 'Num (list x)) (string->number x)] [(Node 'Str (list x)) x] [(Node 'Id (list x)) (string->symbol x)] [(Node 'Lambda (list vs x)) (list 'lambda (map string->symbol vs) (convert x))] [(Node 'Begin (list xs)) (cons 'begin (map convert xs))] [(Node 'Set (list v x)) (list 'set! (string->symbol v) (convert x))] [(Node 'If (list x y z)) (list 'if (convert x) (convert y) (convert z))] [(Node 'Apply (list f xs)) (map convert (cons f xs))] ; Surface [(Node 'Function (list vs x)) (list 'function (map string->symbol vs) (convert x))] [(Node 'Return (list x)) (list 'return (convert x))] [(Node 'Bind (list v b)) (list (string->symbol v) (convert b))] [(Node 'Let (list bs xs)) (cons 'let (cons (map convert bs) (map convert xs)))] [(Node 'Letrec (list bs xs)) (cons 'letrec (cons (map convert bs) (map convert xs)))] [(Node 'Else (list x)) (list (convert x))] [(Node 'CondCase (list c x)) (list (convert c) (convert x))] [(Node 'Cond (list xs e)) (cons 'cond (append (map convert xs) (list (list 'else (convert e)))))] [(Node 'Inc (list x)) (list 'inc (convert x))] [(Node 'Or (list xs)) (cons 'or (map convert xs))] [(Node 'And (list xs)) (cons 'and (map convert xs))] [(Node 'Accept (list)) 'accept] [(Node 'ATransition (list s l)) (list (convert s) '-> (convert l))] [(Node 'ACondition (list s ts)) (cons (string->symbol s) (cons ': (map convert ts)))] [(Node 'ProcessState (list xs)) (map convert xs)] ;?? [(Node 'Automaton (list init cases)) (cons 'automaton (cons (string->symbol init) (map convert cases)))] [(Node 'TranspTest (list v x)) (list 'transptest (string->symbol v) (convert x))] [(Node 'CpsApp (list x y k)) (list 'cps-app (convert x) (convert y) (string->symbol k))] [(Node 'Cps (list x)) (list 'cps (convert x))] ; Value [(Node 'Value (list x)) (deserialize (read (open-input-string x)))] [_ (fail (format "Could not parse term: ~a" t))])) (let [[result (convert (ast->term (syntax->datum (parse (tokenize (open-input-string str)))))) ]] result)) (define (tokenize file) ; Glommed together from Danny Yoo's Ragg example & pyret lang lexer (port-count-lines! file) (define lexer (lexer-src-pos ;; numbers [(concatenation (repetition 1 +inf.0 numeric) (union "" (concatenation #\. (repetition 1 +inf.0 numeric)))) (token 'NUMBER lexeme)] ;; strings [(concatenation "\"" (repetition 0 +inf.0 (union "\\\"" (intersection (char-complement #\") (char-complement #\newline)))) "\"") (token 'STRING lexeme)] ; escaping? ;; tags [(union "Head" "Body" "!Body" "Alien") (token lexeme lexeme)] ;; brackets [(union "[" "]" "{" "}" "(" ")" ",") (token lexeme lexeme)] ;; whitespace [whitespace (token 'WS lexeme #:skip? #t)] ;; labels [(repetition 1 +inf.0 alphabetic) (token 'LABEL lexeme)] [(eof) (void)])) (lambda () (lexer file))) (define (test-conversion x) (check-equal? x (read-term (show-term x)))) (test-conversion (Tagged (list (MacBody) (MacBody)) (list '+ 'foo "bar" 3))) (test-conversion (Tagged (list (Alien)) `(+ (- x) 3))) (test-conversion (Tagged (list (MacHead 'Macro 2 `(+ x 1))) `(+ x y))) (test-conversion `(lambda (x y) (+ x y))) (test-conversion `(let [] 3)) (test-conversion `(let [[x 1] [y 2]] (+ x y))) (test-conversion `#t) (test-conversion `(set! x 3)) (test-conversion '(cond [1 2] [3 4] [else 5])) (test-conversion '(or 1 2 3)) (test-conversion `(delay 1)) (test-conversion `(letrec [[x 1] [y 2]] (+ x y))) (test-conversion `(automaton init [init : ["c" -> more]] [more : ["a" -> more] ["d" -> more] ["r" -> end]] [end : accept])) #| RESUGARING |# (define expand-term (make-parameter #f)) (define unexpand-term (make-parameter #f)) )
false
0ee82bd1285cf44992a8c2545bc621888fc7710a
98fd12cbf428dda4c673987ff64ace5e558874c4
/paip/gregr/greg-5.rkt
132161cee08c847de39f060d1d5e2950a8e9209e
[ "Unlicense" ]
permissive
CompSciCabal/SMRTYPRTY
397645d909ff1c3d1517b44a1bb0173195b0616e
a8e2c5049199635fecce7b7f70a2225cda6558d8
refs/heads/master
2021-12-30T04:50:30.599471
2021-12-27T23:50:16
2021-12-27T23:50:16
13,666,108
66
11
Unlicense
2019-05-13T03:45:42
2013-10-18T01:26:44
Racket
UTF-8
Racket
false
false
9,801
rkt
greg-5.rkt
#lang racket (print-as-expression #f) ;(pretty-print-abbreviate-read-macros #f) (define-syntax example (syntax-rules () ((_ e) (begin (newline) (pretty-print 'e) (displayln "==>") (pretty-print e))))) (define (random-elt xs) (list-ref xs (random (length xs)))) (define (sub* env d) (define (loop d) (sub* env d)) (cond ((assoc d env) => (lambda (old-new) (cdr old-new))) ((pair? d) (cons (loop (car d)) (loop (cdr d)))) ((vector? d) (vector-map loop d)) (else d))) (define (var? x) (and (symbol? x) (string-prefix? (symbol->string x) "?"))) (define (var-match env pattern input) (define existing (assoc pattern env)) (if existing (and (equal? (cdr existing) input) env) (cons (cons pattern input) env))) (define (segment-pattern? pattern) (and (pair? pattern) (pair? (car pattern)) (eq? (caar pattern) '?*))) (define (segment-match env pattern input) (define seg-var (cadar pattern)) (define pat (cdr pattern)) (define binding (assoc seg-var env)) (if binding ;; For efficiency as mentioned in exercise 5.13. (let loop ((input input) (binding binding)) (cond ((null? binding) (pat-match/env env pat input)) ((pair? binding) (and (pair? input) (equal? (car binding) (car input)) (loop (cdr input) (cdr binding)))) (else #f))) (let loop ((input input) (seg '())) (define e2 (pat-match/env env pat input)) (cond ((and e2 (var-match e2 seg-var (reverse seg)))) ((pair? input) (loop (cdr input) (cons (car input) seg))) (else #f))))) (define (pat-match/env env pattern input) (and env (cond ((var? pattern) (var-match env pattern input)) ((segment-pattern? pattern) (segment-match env pattern input)) ((and (pair? pattern) (pair? input)) (pat-match/env (pat-match/env env (car pattern) (car input)) (cdr pattern) (cdr input))) (else (and (equal? pattern input) env))))) (define (pat-match pattern input) (pat-match/env '() pattern input)) (example (pat-match '(I need a ?X) '(I need a vacation))) (example (pat-match '(I need a ?X) '(I really need a vacation))) (example (sub* (pat-match '(I need a ?X) '(I need a vacation)) '(What would it mean to you if you got a ?X ?))) (example (pat-match '(?X is ?X) '((2 + 2) is 4))) (example (pat-match '(?X is ?X) '((2 + 2) is (2 + 2)))) (example (pat-match '(?P need . ?X) '(I need a long vacation))) (example (pat-match '((?* ?p) need (?* ?x)) '(Mr Hulot and I need a vacation))) (example (pat-match '((?* ?x) is a (?* ?y)) '(What he is is a fool))) (example (pat-match '((?* ?x) a b (?* ?x)) '(1 2 a b a b 1 2 a b))) (define eliza-rules '((((?* ?x) hello (?* ?y)) (How do you do. Please state your problem.)) (((?* ?x) computer (?* ?y)) (Do computers worry you?) (What do you think about machines?) (Why do you mention computers?) (What do you think machines have to do with your problem?)) (((?* ?x) name (?* ?y)) (I am not interested in names)) (((?* ?x) sorry (?* ?y)) (Please do not apologize) (Apologies are not necessary) (What feelings do you have when you apologize?)) (((?* ?x) I remember (?* ?y)) (Do you often think of ?y) (Does thinking of ?y bring anything else to mind?) (What else do you remember?) (Why do you recall ?y right now?) (What in the present situation reminds you of ?y ?) (What is the connection between me and ?y ?)) (((?* ?x) do you remember (?* ?y)) (Did you think I would forget ?y ?) (Why do you think I should recall ?y now?) (What about ?y ?) (You mentioned ?y)) (((?* ?x) if (?* ?y)) (Do you really think it is likely that ?y) (Do you wish that ?y) (What do you think about ?y) (Really-- if ?y)) (((?* ?x) I dreamt (?* ?y)) (Really-- ?y) (Have you ever fantasized ?y while you were awake?) (Have you dreamt ?y before?)) (((?* ?x) dream about (?* ?y)) (how do you feel about ?y in reality?)) (((?* ?x) dream (?* ?y)) (What does this dream suggest to you?) (Do you dream often?) (What persons appear in your dreams?) (Do you believe that dream has to do with your problem?)) (((?* ?x) my mother (?* ?y)) (Who else in your family ?y ?) (Tell me more about your family)) (((?* ?x) my father (?* ?y)) (Your father) (Does he influence you strongly?) (What else comes to mind when you think of your father?)) (((?* ?x) I want (?* ?y)) (What would it mean if you got ?y) (Why do you want ?y) (Suppose you got ?y soon)) (((?* ?x) I am glad (?* ?y)) (How have I helped you to be glad?) (What makes you happy just now?) (Can you exlpain why you are suddenly glad?)) (((?* ?x) I am sad (?* ?y)) (I am sorry to hear you are depressed) (I am sure it is not pleasant to be sad)) (((?* ?x) are like (?* ?y)) (What resemblance do you see between ?x and ?y ?)) (((?* ?x) is like (?* ?y)) (In what way is it that ?x is like ?y ?) (What resemblance do you see?) (Could there really be some connection?) (How?)) (((?* ?x) alike (?* ?y)) (In what way?) (what similarities are there?)) (((?* ?x) same (?* ?y)) (what other connections do you see?)) (((?* ?x) I was (?* ?y)) (Were you really?) (Perhaps I already knew you were ?y) (Why do you tell me you were ?y now?)) (((?* ?x) was I (?* ?y)) (What if you were ?y ?) (Do you think you were ?y ?) (What would it mean if you were ?y ?)) (((?* ?x) I am (?* ?y)) (In what way are you ?y ?) (Do you want to be ?y ?)) (((?* ?x) am I (?* ?y)) (Do you believe you are ?y ?) (Would you want to be ?y ?) (You wish I would tell you you are ?y) (What would it mean if you were ?y ?)) (((?* ?x) am (?* ?y)) (Why do you say "AM?") (I do not understand that)) (((?* ?x) are you (?* ?y)) (Why are you interested in whether I am ?y or not?) (Would you prefer if I were not ?y ?) (Perhaps I am ?y in your fantasies)) (((?* ?x) you are (?* ?y)) (What makes you think I am ?y ?)) (((?* ?x) because (?* ?y)) (Is that the real reason?) (What other reasons might there be?) (Does that reason seem to explain anything else?)) (((?* ?x) were you (?* ?y)) (Perhaps I was ?y) (What do you think?) (What if I had been ?y ?)) (((?* ?x) I cannot (?* ?y)) (Maybe you could ?y now) (What if you could ?y ?)) (((?* ?x) I was (?* ?y)) (Were you really?) (Perhaps I already knew you were ?y) (Why do you tell me you were ?y now?)) (((?* ?x) I feel (?* ?y)) (Do you often feel ?y ?)) (((?* ?x) I felt (?* ?y)) (What other feelings do you have?)) (((?* ?x) I (?* ?y) you (?* ?z)) (Perhaps in your fantasy we ?y each other)) (((?* ?x) why do you not (?* ?y)) (Should you ?y yourself?) (Do you believe I do not ?y) (Perhaps I will ?y in good time)) (((?* ?x) yes (?* ?y)) (You seem quite positive) (You are sure) (I understand)) (((?* ?x) no (?* ?y)) (Why not?) (You are being a bit negative) (Are you saying "NO" just to be negative?)) (((?* ?x) someone (?* ?y)) (Can you be more specific?)) (((?* ?x) everyone (?* ?y)) (Surely not everyone) (Can you think of anyone in particular?) (Who for example?) (You are thinking of a special person)) (((?* ?x) always (?* ?y)) (Can you think of a specific example?) (When?) (What incident are you thinking of?) (Really-- always)) (((?* ?x) what (?* ?y)) (Why do you ask?) (Does that question interest you?) (What is it you really wnat to know?) (What do you think?) (What comes to your mind when you ask that?)) (((?* ?x) perhaps (?* ?y)) (You do not seem quite certain)) (((?* ?x) are (?* ?y)) (Did you think they might not be ?y ?) (Possibly they are ?y)) (((?* ?x)) (Very interesting) (I am not sure I understand you fully) (What does that suggest to you?) (Please continue) (Go on) (Do you feel strongly about discussing such things?)))) (define (eliza/script script) (for-each (lambda (input) (display "eliza> ") (pretty-print input) (pretty-print (flatten (use-eliza-rules input)))) script)) (define (eliza) (display "eliza> ") (define line (read-line)) (unless (eof-object? line) (define input (with-input-from-string (string-append "(" line ")") read)) (for-each (lambda (word) (printf "~a " word)) (flatten (use-eliza-rules input))) (newline) (eliza))) (define (use-eliza-rules input) (ormap (lambda (rule) (define pattern (car rule)) (define responses (cdr rule)) (define env (pat-match pattern input)) (and env (sub* (switch-viewpoint env) (random-elt responses)))) eliza-rules)) (define (switch-viewpoint words) (sub* '((I . you) (you . I) (me . you) (am . are) (my . your) (your . my)) words)) (eliza/script '((hello there) (I want to test this program) (I could see if it works) (no not really) (no) (forget it-- I was wondering how general the program is) (I felt like it) (I feel this is enough))) (eliza)
true
fd4efac80b7b391f5f1f515e6a77ecb6e41f4cba
00d4882c98aadb8010fcee2688e32d795fcc514e
/puzzles/random-generator/generator.rkt
824e9db08856bae24fcd87072f73c1ca81bf0da8
[]
no_license
thoughtstem/morugamu
dae77f19b9eecf156ffe501a6bfeef12f0c1749d
a9095ddebe364adffb036c3faed95c873a4d9f3c
refs/heads/master
2020-03-22T04:09:18.238849
2018-08-20T18:55:55
2018-08-20T18:55:55
139,476,760
13
5
null
2018-08-02T22:29:48
2018-07-02T17:56:26
Racket
UTF-8
Racket
false
false
314
rkt
generator.rkt
#lang racket (require "../../rule-systems/redex/boolean-algebra.rkt" "../../rule-systems/redex/clock-numbers.rkt" "../../rule-systems/redex/inequalities.rkt") (require redex) ;This should get made into a function, provided, and documented... (generate-term inequalities-lang in-e 10)
false
0c6d9a280cee2e0de4a52ad1937d75d7588327b2
2bf41fe232306e93a9d81db551f2fbe6c28c4e04
/k2/lang/hero/basic.rkt
e5c06e220e2804b58f9cb20046783035cd9cb5c1
[]
no_license
Cbranson14/TS-Languages
ad3e80d09bac64bd040688a1e19729b13dbb5064
ad868614ef07346ca06b85c9c69a4935dc16da33
refs/heads/master
2020-06-23T22:07:20.650428
2019-07-19T20:54:35
2019-07-19T20:54:35
null
0
0
null
null
null
null
UTF-8
Racket
false
false
1,800
rkt
basic.rkt
#lang racket ;This allows the lang to be used as a module: ; (require k2/lang/ocean/fish) (provide (all-from-out "./hero-lang.rkt")) (require "./hero-lang.rkt") ;This allows the lang to be used as a lang ; #lang k2/lang/hero/fish (module reader syntax/module-reader k2/lang/hero/hero-lang) ;This allows the lang to be used from Ratchet ; #lang k2/lang/hero/fish ; ... Then press "Ratchet" (module ratchet racket (require ratchet ratchet/util "./hero-lang.rkt" "../icons.rkt" (prefix-in a: battlearena-avengers)) (define (draw-head sprite) (a:crop/align 'center 'top 32 32 (a:draw-sprite sprite))) (define-visual-language #:wrapper launch-for-ratchet hero-lang "./hero-lang.rkt" [start w play-icon] [ironman i (a:scale-to-fit (draw-head a:ironman-sprite) 32)] [blackwidow b (a:scale-to-fit (draw-head a:blackwidow-sprite) 32)] [captainamerica c (a:scale-to-fit (draw-head a:captainamerica-sprite) 32)] [gamora g (a:scale-to-fit (draw-head a:gamora-sprite) 32)] [hulk u (a:scale-to-fit (draw-head a:hulk-sprite) 32)] [loki l (a:scale-to-fit (draw-head a:loki-sprite) 32)] [redskull r (a:scale-to-fit (draw-head a:redskull-sprite) 32)] [mandarin m (a:scale-to-fit (draw-head a:mandarin-sprite) 32)] [nebula n (a:scale-to-fit (draw-head a:nebula-sprite) 32)] ))
false
540d452206cf8b75d22479cd417af52876a3909f
7c58ed3a7fe9331ab49a1762fafdad460d8d326d
/algebraic/scribblings/algebraic-data.scrbl
5a24e17e664838d9829ab88b0b32433a9c4b3cd5
[ "MIT" ]
permissive
lemastero/racket-algebraic
72decf2fcee908b7d39f90492bcdd3b566aa7406
706b2d01ab735a01e372c33da49995339194e024
refs/heads/master
2023-01-01T06:24:30.889572
2019-08-09T21:50:57
2019-08-10T00:57:32
null
0
0
null
null
null
null
UTF-8
Racket
false
false
5,071
scrbl
algebraic-data.scrbl
#lang scribble/manual @title[#:tag "ref:data"]{Data} @require{./algebraic-includes.rkt} @require[ @for-label[ (except-in algebraic/racket/base #%module-begin) racket/contract/base ] ] @; ############################################################################# @defmodule[algebraic/data] The bindings documented in this section are provided by the @racketmodname[algebraic/data] and @racketmodname[algebraic/racket/base] libraries. The @racket[data] form defines several procedures and syntax @rtech{transformers} for working with named @tech{product} and @tech{sum} data structurs. A @deftech{product} identifies a family of structures comprising a list of @deftech{fields}, and a @deftech{sum} is a list of @tech{products}. @example[ (data Peano (Zero Succ)) ] In this example, @racket[Peano] is a @tech{sum} of the @tech{products} @racket[Zero] and @racket[Succ]. Each @tech{product} name is bound to a constructor function that creates @tech[#:key "product instance"]{instances} of the named @tech{product}. A @deftech{product instance} is a concrete expression of the @tech{product} as a tagged tuple of run-time values or expansion-time syntax fragments. @example[ (Succ Zero) (product-instance? (Succ Zero)) ] Equality is decided structurally for @tech{products} and their @tech[#:key "product instance"]{instances}. @example[ (equal? Succ Succ) (equal? (Succ Zero) (Succ Zero)) (equal? (Succ Zero) (Succ (Succ Zero))) ] The @racket[data] form also defines several membership predicates. @example[ (Succ? Succ) ((sum Peano?) Succ) ((sum Peano?) (sum Peano)) ] To prevent @tech{sum} and @tech{product} names from clashing, the @tech{sum} bindings are defined in their own @rtech{namespace}. Use the @racket[sum] form to add the appropriate @rtech{scope} to an identifier. @; ----------------------------------------------------------------------------- @defform[ (data sum-decl ...+) #:grammar [(sum-decl (code:line sum-id (product-id ...)))] ]{ Creates a new @tech{sum} on a list of @tech{products} and binds variables related to them. A @tech{sum} with @var[n] @tech{products} defines 3+3@var[n] names: @itemlist[ @item{for each @var[sum-id]: @itemlist[ @item{a @rtech{transformer} binding that encapsulates information about the @tech{sum} declaration.} @item{a @tech{sum} structure that can be printed to retrieve its definition.} ] } @item{@var[sum-id]@tt{?}, for each @var[sum-id]; a predicate that returns @racket[#t] for the @tech{sum} bound to @var[sum-id], its @tech{products} or their @tech[#:key "product instance"]{instances}, and @racket[#f] for any other value.} @item{for each @var[product-id]: @itemlist[ @item{a @rtech{transformer} binding that encapsulates information about the @tech{product} declaration.} @item{a @tech{product} constructor that takes any number of arguments and returns a new @tech[#:key "product instance"]{instance} of the @tech{product}.} ] } @item{@var[product-id]@tt{?}, for each @var[product-id]; a predicate that returns @racket[#t] for the @tech{product} constructor bound to @var[product-id] or its instances and @racket[#f] for any other value.} ] Example: @example[ (data Unit (Unit)) (Unit? Unit) (Unit? (Unit)) ((sum Unit?) Unit) ((sum Unit?) (sum Unit)) ] } @defform[(sum id)]{ Adds the @tech{sum} scope to @var[id]. To prevent clashes between @tech{sums} and @tech{products} with the same name, @tech{sum} bindings are defined in their own namespace. This form adds a @rtech{scope} to @var[id] that represents the @tech{sum} @rtech{namespace}. Example: @example[ (data Either (Left Right)) (eval:error (Either? Left)) ((sum Either?) Left) (eval:error ((sum Either?) Either)) ((sum Either?) (sum Either)) ] } @defproc[(data-less-than? [Π1 product?] [Π2 product?]) boolean?]{ Returns @racket[#t] if the arguments belong to the same @tech{sum} and are in order. Examples: @example[ (data ABC (A B C)) (values (data-less-than? A C) (data-less-than? C A)) ] @example[ (data XYZ (X Y Z)) (sort (list Z Y X) data-less-than?) ] } @defproc[(data->list [arg any/c]) (listof any/c)]{ If @var[arg] is a @tech{sum}, returns its @tech{products} in the order they were defined. If @var[arg] is an @tech{product instance}, returns its constructor followed by its @tech{fields}. Any other @var[arg] is returned as a singleton list. @example[ (data ABC (A B C)) (data->list (sum ABC)) (data->list (A 1 2 3)) (data->list 123) ] } @defproc[(sum? [v any/c]) boolean?]{ Returns @racket[#t] if @var[v] is a @tech{sum}. } @defproc[(product? [v any/c]) boolean?]{ Returns @racket[#t] if @var[v] is a @tech{product} constructor. } @defproc[(product-instance? [v any/c]) boolean?]{ Returns @racket[#t] if @var[v] is a @tech{product instance}. }
false
e50277c737a52c46994f081b2706d6801636189f
9683b726ac3766c7ed1203684420ab49612b5c86
/ts-kata-util/badge-maker/icons/main.rkt
7d0daa9bcbaf9a911396293e244806852f866ab5
[]
no_license
thoughtstem/TS-GE-Katas
3448b0498b230c79fc91e70fdb5513d7c33a3c89
0ce7e0c7ed717e01c69770d7699883123002b683
refs/heads/master
2020-04-13T21:22:10.248300
2020-02-13T18:04:07
2020-02-13T18:04:07
163,454,352
1
0
null
2020-02-13T18:04:08
2018-12-28T22:25:21
Racket
UTF-8
Racket
false
false
117
rkt
main.rkt
#lang racket (require define-assets-from) ;Provides pngs in ./images as identifiers (define-assets-from "images")
false
b7add4d02b2c24871c8a41ff7879db99dfb73ce4
c27b8ab46d5bf1638a8933e770ed01d8200ec731
/EOPL3/ch5_5threads.rkt
a54a6cc9e59150e4f819357dc7b1b93079dc4b2c
[]
no_license
3gx/drracket
21366d63b029e90da43690c54c6359ecd3cfefee
978d9bcc3b36ee73fe682039f62302b9bd5517d5
refs/heads/master
2023-01-04T10:28:24.591314
2020-10-19T14:21:55
2020-10-19T14:21:55
195,736,419
0
0
null
null
null
null
UTF-8
Racket
false
false
24,078
rkt
ch5_5threads.rkt
#lang racket (require eopl) ;;;;;;;;;;;;;;;; grammatical specification ;;;;;;;;;;;;;;;; (define the-lexical-spec '((whitespace (whitespace) skip) (comment ("%" (arbno (not #\newline))) skip) (identifier (letter (arbno (or letter digit "_" "-" "?"))) symbol) (number (digit (arbno digit)) number) (number ("-" digit (arbno digit)) number) )) (define the-grammar '((program (expression) a-program) (expression (number) const-exp) (expression ("-" "(" expression "," expression ")") diff-exp) (expression ("+" "(" expression "," expression ")") plus-exp) (expression ("*" "(" expression "," expression ")") mul-exp) (expression ("if" expression "then" expression "else" expression) if-exp) (expression (identifier) var-exp) (expression ("let" identifier "=" expression "in" expression) let-exp) (expression ("proc" "(" identifier ")" expression) proc-exp) (expression ("(" expression expression ")") call-exp) (expression ("letrec" (arbno identifier "(" identifier ")" "=" expression) "in" expression) letrec-exp) (expression ("try" expression "catch" "(" identifier ")" expression) try-exp) (expression ("begin" expression (arbno ";" expression) "end") begin-exp) (expression ("set" identifier "=" expression) set-exp) (expression ("spawn" "(" expression ")") spawn-exp) (expression ("yield" "(" ")") yield-exp) (expression ("mutex" "(" ")") mutex-exp) (expression ("wait" "(" expression ")") wait-exp) (expression ("signal" "(" expression ")") signal-exp) (expression ("raise" expression) raise-exp) (expression (unop "(" expression ")") unop-exp) (unop ("car") car-unop) (unop ("cdr") cdr-unop) (unop ("null?") null?-unop) (unop ("zero?") zero?-unop) (unop ("print") print-unop) (expression ("[" (separated-list number ",") "]") const-list-exp) )) ;;;;;;;;;;;;;;;; sllgen boilerplate ;;;;;;;;;;;;;;;; (sllgen:make-define-datatypes the-lexical-spec the-grammar) (define show-the-datatypes (lambda () (sllgen:list-define-datatypes the-lexical-spec the-grammar))) (define scan&parse (sllgen:make-string-parser the-lexical-spec the-grammar)) (define just-scan (sllgen:make-string-scanner the-lexical-spec the-grammar)) (define-datatype environment environment? (empty-env) (extend-env (var symbol?) (val reference?) (env environment?)) (extend-env-rec* (p-names (list-of symbol?)) (b-vars (list-of symbol?)) (bodies (list-of expression?)) (env environment?))) (define (apply-env env search-var) (cases environment env [empty-env () (error "No binding for" search-var)] [extend-env (saved-var saved-val saved-env) (if (eqv? saved-var search-var) saved-val (apply-env saved-env search-var))] [extend-env-rec* (p-names b-vars p-bodies saved-env) (cond [(location search-var p-names) => (lambda (n) (newref (proc-val (procedure (list-ref b-vars n) (list-ref p-bodies n) env))))] [else (apply-env saved-env search-var)])])) (define location (lambda (sym syms) (cond ((null? syms) #f) ((eqv? sym (car syms)) 0) ((location sym (cdr syms)) => (lambda (n) (+ n 1))) (else #f)))) ; queue (define (empty-queue) '()) (define empty? null?) (define (enqueue q val) (append q (list val))) (define (dequeue q f) (f (car q) (cdr q))) ; scheduler (define the-ready-queue 'uninitialized) (define the-final-answer 'uninitialized) (define the-max-time-slice 'uninitialized) (define the-time-remaining 'uninitialized) (define (initialize-scheduler! ticks) (set! the-ready-queue (empty-queue)) (set! the-final-answer 'uninitialized) (set! the-max-time-slice ticks) (set! the-time-remaining the-max-time-slice)) ; mutex (define (new-mutex) (a-mutex (newref #f) (newref '()))) (define (wait-for-mutex m th) (cases mutex m [a-mutex (ref-to-closed? ref-to-wait-queue) (cond [(deref ref-to-closed?) (setref! ref-to-wait-queue (enqueue (deref ref-to-wait-queue) th)) (run-next-thread)] [else (setref! ref-to-closed? #t) (th)])])) (define (signal-mutex m th) (cases mutex m [a-mutex (ref-to-closed? ref-to-wait-queue) (let ([closed? (deref ref-to-closed?)] [wait-queue (deref ref-to-wait-queue)]) (when closed? (if (empty? wait-queue) (setref! ref-to-closed? #f) (dequeue wait-queue (lambda (first-waiting-th other-waiting-ths) (place-on-ready-queue! first-waiting-th) (setref! ref-to-wait-queue other-waiting-ths))))) (th))])) ; continuation (define-datatype continuation continuation? [end-main-thread-cont] [end-subthread-cont] [unop-arg-cont (unop1 unop?) (saved-cont continuation?)] [let-exp-cont (var symbol?) (body expression?) (saved-env environment?) (saved-cont continuation?)] [if-test-cont (exp2 expression?) (exp3 expression?) (saved-env environment?) (saved-cont continuation?)] [diff1-cont (exp2 expression?) (saved-env environment?) (saved-cont continuation?)] [diff2-cont (val1 expval?) (saved-cont continuation?)] [plus1-cont (exp2 expression?) (saved-env environment?) (saved-cont continuation?)] [plus2-cont (val1 expval?) (saved-cont continuation?)] [mul1-cont (exp2 expression?) (saved-env environment?) (saved-cont continuation?)] [mul2-cont (val1 expval?) (saved-cont continuation?)] [rator-cont (rand expression?) (saved-env environment?) (saved-cont continuation?)] [rand-cont (val1 expval?) (saved-cont continuation?)] [try-cont (var symbol?) (handler-exp expression?) (env environment?) (cont continuation?)] [raise1-cont (saved-cont continuation?)] [set-rhs-cont (loc reference?) (cont continuation?)] [spawn-cont (saved-cont continuation?)] [wait-cont (saved-cont continuation?)] [signal-cont (saved-cont continuation?)] ) (define (empty-store) '()) (define the-store 'uninitialized) (define (get-store) the-store) (define (initialize-store!) (set! the-store (empty-store))) (define (reference? v) (integer? v)) (define (newref val) (let ([next-ref (length the-store)]) (set! the-store (append the-store (list val))) next-ref)) (define (deref ref) (list-ref the-store ref)) (define (setref! ref val) (set! the-store (letrec ([setref-inner (lambda (store1 ref1) (cond [(null? store1) (error "Invalid ref" ref the-store)] [(zero? ref1) (cons val (cdr store1))] [else (cons (car store1) (setref-inner (cdr store1) (sub1 ref1)))]))]) (setref-inner the-store ref)))) (define (apply-cont cont val) (if (time-expired?) (begin (place-on-ready-queue! (lambda () (apply-cont cont val))) (run-next-thread)) (begin (decrement-timer!) (cases continuation cont [end-main-thread-cont () (set-final-answer! val) (run-next-thread)] [end-subthread-cont () (run-next-thread)] [let-exp-cont (var body saved-env saved-cont) (value-of/k body (extend-env var (newref val) saved-env) saved-cont)] [if-test-cont (exp2 exp3 saved-env saved-cont) (if (expval->bool val) (value-of/k exp2 saved-env saved-cont) (value-of/k exp3 saved-env saved-cont))] [diff1-cont (exp2 saved-env saved-cont) (value-of/k exp2 saved-env (diff2-cont val saved-cont))] [diff2-cont (val1 saved-cont) (let ([num1 (expval->num val1)] [num2 (expval->num val)]) (apply-cont saved-cont (num-val (- num1 num2))))] [plus1-cont (exp2 saved-env saved-cont) (value-of/k exp2 saved-env (plus2-cont val saved-cont))] [plus2-cont (val1 saved-cont) (let ([num1 (expval->num val1)] [num2 (expval->num val)]) (apply-cont saved-cont (num-val (+ num1 num2))))] [mul1-cont (exp2 saved-env saved-cont) (value-of/k exp2 saved-env (mul2-cont val saved-cont))] [mul2-cont (val1 saved-cont) (let ([num1 (expval->num val1)] [num2 (expval->num val)]) (apply-cont saved-cont (num-val (* num1 num2))))] [rator-cont (rand saved-env saved-cont) (value-of/k rand saved-env (rand-cont val saved-cont))] [rand-cont (val1 saved-cont) (let ([proc (expval->proc val1)]) (apply-procedure/k proc val saved-cont))] [try-cont (var handler-exp env cont) (apply-cont cont val)] [raise1-cont (cont) (apply-handler val cont)] [unop-arg-cont (unop1 cont) (apply-unop unop1 val cont)] [set-rhs-cont (loc cont) (begin (setref! loc val) (apply-cont cont (num-val 26)))] [spawn-cont (saved-cont) (let ([proc1 (expval->proc val)]) (place-on-ready-queue! (lambda () (apply-procedure/k proc1 (num-val 28) (end-subthread-cont)))) (apply-cont saved-cont (num-val 73)))] [wait-cont (saved-cont) (wait-for-mutex (expval->mutex val) (lambda () (apply-cont saved-cont (num-val 42))))] [signal-cont (saved-cont) (signal-mutex (expval->mutex val) (lambda () (apply-cont saved-cont (num-val 53))))] )))) (define (apply-unop unop1 arg cont) (cases unop unop1 [zero?-unop () (apply-cont cont (bool-val (zero? (expval->num arg))))] [car-unop () (let [(lst (expval->list arg))] (apply-cont cont (car lst)))] [cdr-unop () (let [(lst (expval->list arg))] (apply-cont cont (list-val (cdr lst))))] [null?-unop () (apply-cont cont (bool-val (null? (expval->list arg))))] [print-unop () (begin (eopl:printf "~a~%" (expval->num arg)) (apply-cont cont (num-val 1)))] [else (error "Unsupported unop" unop1)])) (define (apply-handler val cont) (cases continuation cont [end-main-thread-cont () (error "Uncaught-exception in main-thread" val)] [end-subthread-cont () (error "Uncaught-exception in a subthread" val)] [spawn-cont (saved-cont) (apply-handler val saved-cont)] [signal-cont (saved-cont) (apply-handler val saved-cont)] [wait-cont (saved-cont) (apply-handler val wait-cont)] [unop-arg-cont (unop1 saved-cont) (apply-handler val saved-cont)] [let-exp-cont (var body saved-env saved-cont) (apply-handler val saved-cont)] [if-test-cont (exp2 exp3 saved-env saved-cont) (apply-handler val saved-cont)] [diff1-cont (exp2 saved-env saved-cont) (apply-handler val saved-cont)] [diff2-cont (val1 saved-cont) (apply-handler val saved-cont)] [plus1-cont (exp2 saved-env saved-cont) (apply-handler val saved-cont)] [plus2-cont (val1 saved-cont) (apply-handler val saved-cont)] [mul1-cont (exp2 saved-env saved-cont) (apply-handler val saved-cont)] [mul2-cont (val1 saved-cont) (apply-handler val saved-cont)] [rator-cont (rand saved-env saved-cont) (apply-handler val saved-cont)] [rand-cont (val1 saved-cont) (apply-handler val saved-cont)] [try-cont (var handler-exp saved-env saved-cont) (value-of/k handler-exp (extend-env var (newref val) saved-env) saved-cont)] [set-rhs-cont (loc saved-cont) (apply-handler loc saved-cont)] [raise1-cont (saved-cont) (apply-handler val saved-cont)])) (define (apply-procedure/k proc1 val cont) (cases proc proc1 [procedure (var body saved-env) (value-of/k body (extend-env var (newref val) saved-env) cont)])) (define (init-env) (extend-env 'i (newref (num-val 1)) (extend-env 'v (newref (num-val 5)) (extend-env 'x (newref (num-val 10)) (empty-env))))) (define-datatype proc proc? (procedure (var symbol?) (body expression?) (env environment?))) (define-datatype mutex mutex? [a-mutex (ref-to-closed? reference?) (ref-to-wait-queue? reference?)]) (define-datatype expval expval? [num-val (value number?)] [bool-val (boolean boolean?)] [proc-val (proc proc?)] [list-val (lst (list-of expval?))] [mutex-val (mutex mutex?)] ) (define (expval->num val) (cases expval val (num-val (num) num) (else (error "failed to extract num" val)))) (define (expval->bool val) (cases expval val (bool-val (bool) bool) (else (error "failed to extract bool" val)))) (define (expval->proc val) (cases expval val (proc-val (proc) proc) (else (error "failed to extract proc" val)))) (define expval->list (lambda (v) (cases expval v (list-val (lst) lst) (else (expval-extractor-error 'list v))))) (define expval-extractor-error (lambda (variant value) (eopl:error 'expval-extractors "Looking for a ~s, found ~s" variant value))) (define expval->mutex (lambda (v) (cases expval v (mutex-val (l) l) (else (expval-extractor-error 'mutex v))))) (define (run str ast) (println (format "~a:~a" str (value-of-program 1 ast)))) (define (value-of-program timeslice pgm) (initialize-store!) (initialize-scheduler! timeslice) (cases program pgm (a-program (exp1) (value-of/k exp1 (init-env) (end-main-thread-cont))))) (define (place-on-ready-queue! th) (set! the-ready-queue (enqueue the-ready-queue th))) (define (run-next-thread) (if (empty? the-ready-queue) the-final-answer (dequeue the-ready-queue (lambda (first-ready-thread other-ready-threads) (set! the-ready-queue other-ready-threads) (set! the-time-remaining the-max-time-slice) (first-ready-thread))))) (define (set-final-answer! val) (set! the-final-answer val)) (define (time-expired?) (zero? the-time-remaining)) (define (decrement-timer!) (set! the-time-remaining (sub1 the-time-remaining))) ; value-of/k (define (value-of/k exp env cont) (cases expression exp [const-exp (num) (apply-cont cont (num-val num))] [var-exp (var) (apply-cont cont (deref (apply-env env var)))] [diff-exp (exp1 exp2) (value-of/k exp1 env (diff1-cont exp2 env cont))] [plus-exp (exp1 exp2) (value-of/k exp1 env (plus1-cont exp2 env cont))] [mul-exp (exp1 exp2) (value-of/k exp1 env (mul1-cont exp2 env cont))] [if-exp (exp1 exp2 exp3) (value-of/k exp1 env (if-test-cont exp2 exp3 env cont))] [let-exp (var exp1 body) (value-of/k exp1 env (let-exp-cont var body env cont))] [proc-exp (var body) (apply-cont cont (proc-val (procedure var body env)))] [call-exp (rator rand) (value-of/k rator env (rator-cont rand env cont))] [try-exp (exp1 var handler-exp) (value-of/k exp1 env (try-cont var handler-exp env cont))] [raise-exp (exp1) (value-of/k exp1 env (raise1-cont cont))] [letrec-exp (p-names b-vars p-bodies letrec-body) (value-of/k letrec-body (extend-env-rec* p-names b-vars p-bodies env) cont)] [begin-exp (exp1 exps) (if (null? exps) (value-of/k exp1 env cont) (value-of/k (call-exp (proc-exp (fresh-identifier 'dummy) (begin-exp (car exps) (cdr exps))) exp1) env cont))] [set-exp (id1 exp1) (value-of/k exp1 env (set-rhs-cont (apply-env env id1) cont))] [unop-exp (unop1 exp1) (value-of/k exp1 env (unop-arg-cont unop1 cont))] [const-list-exp (nums) (apply-cont cont (list-val (map num-val nums)))] [spawn-exp (exp1) (value-of/k exp1 env (spawn-cont cont))] [yield-exp () (place-on-ready-queue! (lambda () (apply-cont cont (num-val 99)))) (run-next-thread)] [mutex-exp () (apply-cont cont (mutex-val (new-mutex)))] [wait-exp (exp1) (value-of/k exp1 env (wait-cont cont))] [signal-exp (exp1) (value-of/k exp1 env (signal-cont cont))] [else (error "Unsupported" exp)] )) (define fresh-identifier (let ((sn 0)) (lambda (identifier) (set! sn (+ sn 1)) (string->symbol (string-append (symbol->string identifier) "%" ; this can't appear in an input identifier (number->string sn)))))) (define spgm0 (scan&parse "-(55, -(x,11))")) spgm0 (run 'spgm0 spgm0) (define spgm1 (scan&parse "if zero?(42) then 43 else 45")) spgm1 (run 'spgm1 spgm1) (define spgm2 (scan&parse " let f = proc(x) -(x,11) in (f (f 77)) ")) spgm2 (run 'spgm2 spgm2) (define spgm3 (scan&parse " let f = proc(x) -(x,11) in (f (f 77)) ")) spgm3 (run 'spgm3 spgm3) (define spgm4 (scan&parse " let x = 200 in let f = proc (z) -(z,x) in let x = 100 in let g = proc (z) -(z,x) in -((f 1), (g 1)) ")) spgm4 (run 'spgm4 spgm4) (define ast1 (scan&parse " letrec double(x) = if zero?(x) then 0 else -((double -(x,1)), -2) in (double 6) ")) ast1 (run 'ast1 ast1) (define ast2 (scan&parse " letrec even(x) = if zero?(x) then 1 else (odd -(x,1)) odd(x) = if zero?(x) then 0 else (even -(x,1)) in (odd 13) ")) ast2 (run 'ast2 ast2) (define ast3 (scan&parse " letrec fact(n) = if zero?(n) then 1 else *(n, (fact -(n,1))) in (fact 5) ")) ast3 (run 'ast3 ast3) (define ast4 (scan&parse " letrec fix(f) = letrec d(x) = proc(z) ((f (x x)) z) in proc(n) ((f (d d)) n) in letrec t4m(f) = proc(x) if zero?(x) then 0 else +((f -(x,1)),4) in let times4 = (fix t4m) in (times4 3)" )) ast4 (run 'ast4 ast4) (define ast4a (scan&parse " letrec fix(f) = letrec d(x) = (f (x x)) in (f (d d)) in letrec t4m(f) = proc(x) if zero?(x) then 0 else +((f -(x,1)),4) in let times4 = (fix t4m) in (times4 3)" )) ast4a ;(run ast4a) - runs infinitely (define ast5a (scan&parse " let t1 = proc(x) proc(y) if zero?(y) then raise 42 else +(x,y) in ((t1 4) 3)")) ast5a (run 'ast5a ast5a) (define ast5b (scan&parse " let t1 = proc(x) proc(y) if zero?(y) then raise 42 else +(x,y) in try ((t1 4) 3) catch (exn) -(0,exn)")) ast5b (run 'ast5b ast5b) (define ast5c (scan&parse " let t1 = proc(x) proc(y) if zero?(y) then raise 42 else +(x,y) in try ((t1 4) 0) catch (exn) -(0,exn)")) ast5c (run 'ast5c ast5c) (define ast6 (scan&parse " let g = let count = 0 in proc (dummy) begin set count = -(count,-1); count end in let a = (g 11) in let b = (g 11) in -(a,b) ")) ast6 (run 'ast6 ast6) (define ast7 (scan&parse " let times4 = 0 in begin set times4 = proc (x) if zero?(x) then 0 else -((times4 -(x,1)), -4); (times4 3) end ")) ast7 (run 'ast7 ast7) (define ast8a (scan&parse " let lsst = [8,2,3,4,5] in car(lsst)")) ast8a (run 'ast8a ast8a) (define ast8b (scan&parse " let lsst = [8,2,3,4,5] in cdr(lsst)")) ast8a (run 'ast8b ast8b) (define thread1 (scan&parse " letrec noisy (l) = if null?(l) then 0 else begin print(car(l)); (noisy cdr(l)) end in begin spawn(proc (d) (noisy [1,2,3,4,5])); spawn(proc (d) (noisy [6,7,8,9,10])); print(100); 33 end ")) thread1 (run 'thread1 thread1) (define thread2 (scan&parse " let buffer = 0 in let producer = proc (n) letrec wait1(k) = if zero?(k) then set buffer = n else begin print(+(k,200)); (wait1 -(k,1)) end in (wait1 5) in let consumer = proc(d) letrec busywait1 (k) = if zero?(buffer) then begin print(+(k,100)); (busywait1 -(k,-1)) end else buffer in (busywait1 0) in begin spawn (proc (d) (producer 44)); print(300); (consumer 86) end ")) thread2 (run 'thread2 thread2) (define thread3 (scan&parse " let x = 0 in let mut = mutex() in let incr_x = proc (id) proc (dummy) begin wait(mut); set x = -(x,-1); set x = -(x,-1); print(x); signal(mut) end in begin spawn( (incr_x 100)); spawn( (incr_x 200)); spawn( (incr_x 300)); yield() end ")) thread3 (run 'thread3 thread3)
false
3aeb07c0f3c9b0df520b29030cd3d68c9c80490c
1e02b0f4e7203924ea15f59b19fb735e0b9729d9
/recurs/xpe.rkt
17633b86d5f9bf7c694024bf1d08faa565398844
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
ksromanov/unmix
811aec1436f1164c31c3963d0f1944ac5589c0d0
e156fb706e52994f86029ac512a79c737d7ee0d8
refs/heads/master
2023-03-17T12:47:12.068102
2013-12-29T16:26:21
2013-12-29T16:26:21
null
0
0
null
null
null
null
UTF-8
Racket
false
false
6,537
rkt
xpe.rkt
#lang racket (define ($specialize-fundef ann-prog sv) (let ((s-prog (caddr ann-prog)) (d-prog (cadr ann-prog)) (goal (caar ann-prog))) (let ((%%1 (assq goal d-prog))) (let ((body (car (cddddr %%1))) (dn (caddr %%1)) (sn (cadr %%1))) (let ((%%2 (umainpe:find-name! goal sv))) (let ((rfname (cdr %%2))) (list (umainpe:print-fundef! '$start dn `(call ,rfname unquote dn)) (umainpe:print-fundef! rfname dn ($pe-exp body sn dn ($contract-sv sn sv) dn s-prog d-prog))))))))) (define ($gen-res-fundef! fname sv s-prog d-prog) (let ((%%3 (assq fname d-prog))) (let ((body (car (cddddr %%3))) (dn (caddr %%3)) (sn (cadr %%3))) (let ((%%4 (umainpe:find-name! fname ($contract-sv sn sv)))) (let ((fn %%4)) ($gen-res-fundef-p! fn body sn dn sv s-prog d-prog)))))) (define ($gen-res-fundef-p! fn body sn dn sv s-prog d-prog) (let ((rfname (cdr fn)) (new (car fn))) (if new (umainpe:print-fundef! rfname dn ($pe-exp body sn dn sv dn s-prog d-prog)) rfname))) (define ($contract-sv sn sv) (if (null? sn) '() (let ((rest (cdr sn))) `(,(car sv) unquote ($contract-sv rest (cdr sv)))))) (define ($pe-exp exp sn dn sv dv s-prog d-prog) (cond ((let ((vname exp)) (not (pair? vname))) (let ((vname exp)) ($lookup-value vname dn dv))) ((equal? (car exp) 'static) (let ((exp1 (cadr exp))) `',($eval-exp exp1 sn sv s-prog))) ((equal? (car exp) 'ifs) (let ((exp3 (cadddr exp)) (exp2 (caddr exp)) (exp1 (cadr exp))) (if ($eval-exp exp1 sn sv s-prog) ($pe-exp exp2 sn dn sv dv s-prog d-prog) ($pe-exp exp3 sn dn sv dv s-prog d-prog)))) ((equal? (car exp) 'ifd) (let ((exp3 (cadddr exp)) (exp2 (caddr exp)) (exp1 (cadr exp))) `(if ,($pe-exp exp1 sn dn sv dv s-prog d-prog) ,($pe-exp exp2 sn dn sv dv s-prog d-prog) ,($pe-exp exp3 sn dn sv dv s-prog d-prog)))) ((equal? (car exp) 'call) (let ((d-exp* (cadddr exp)) (s-exp* (caddr exp)) (fname (cadr exp))) ($pe-call (assq fname d-prog) ($eval-exp* s-exp* sn sv s-prog) ($pe-exp* d-exp* sn dn sv dv s-prog d-prog) s-prog d-prog))) ((equal? (car exp) 'rcall) (let ((d-exp* (cadddr exp)) (s-exp* (caddr exp)) (fname (cadr exp))) (let ((%%5 ($eval-exp* s-exp* sn sv s-prog))) (let ((s-val* %%5)) (let ((%%6 ($gen-res-fundef! fname s-val* s-prog d-prog))) (let ((rfname %%6)) `(call ,rfname unquote ($pe-exp* d-exp* sn dn sv dv s-prog d-prog)))))))) ((equal? (car exp) 'xcall) (let ((exp* (cddr exp)) (fname (cadr exp))) `(xcall ,fname unquote ($pe-exp* exp* sn dn sv dv s-prog d-prog)))) (else (let ((exp* (cdr exp)) (fname (car exp))) `(,fname unquote ($pe-exp* exp* sn dn sv dv s-prog d-prog)))))) (define ($pe-exp* exp* sn dn sv dv s-prog d-prog) (if (null? exp*) '() (let ((rest (cdr exp*)) (exp (car exp*))) `(,($pe-exp exp sn dn sv dv s-prog d-prog) unquote ($pe-exp* rest sn dn sv dv s-prog d-prog))))) (define ($pe-call fundef sv dv s-prog d-prog) (let ((body (car (cddddr fundef))) (dn (caddr fundef)) (sn (cadr fundef))) ($pe-exp body sn dn sv dv s-prog d-prog))) (define ($eval-exp exp sn sv prog) (cond ((let ((vname exp)) (not (pair? vname))) (let ((vname exp)) ($lookup-value vname sn sv))) ((equal? (car exp) 'quote) (let ((s-exp (cadr exp))) s-exp)) ((equal? (car exp) 'if) (let ((exp3 (cadddr exp)) (exp2 (caddr exp)) (exp1 (cadr exp))) (if ($eval-exp exp1 sn sv prog) ($eval-exp exp2 sn sv prog) ($eval-exp exp3 sn sv prog)))) ((equal? (car exp) 'call) (let ((exp* (cddr exp)) (fname (cadr exp))) ($eval-call prog (assq fname prog) ($eval-exp* exp* sn sv prog)))) ((equal? (car exp) 'xcall) (let ((exp* (cddr exp)) (fname (cadr exp))) (xapply fname ($eval-exp* exp* sn sv prog)))) ((equal? (car exp) 'error) (let ((exp* (cdr exp))) (error "Error function encountered during partial evaluation" `(error unquote ($eval-exp* exp* sn sv prog))))) ((equal? (car exp) 'car) (let ((exp1 (cadr exp))) (car ($eval-exp exp1 sn sv prog)))) ((equal? (car exp) 'cdr) (let ((exp1 (cadr exp))) (cdr ($eval-exp exp1 sn sv prog)))) ((equal? (car exp) 'cons) (let ((exp2 (caddr exp)) (exp1 (cadr exp))) (cons ($eval-exp exp1 sn sv prog) ($eval-exp exp2 sn sv prog)))) ((equal? (car exp) 'null?) (let ((exp1 (cadr exp))) (null? ($eval-exp exp1 sn sv prog)))) ((equal? (car exp) 'pair?) (let ((exp1 (cadr exp))) (pair? ($eval-exp exp1 sn sv prog)))) ((equal? (car exp) 'equal?) (let ((exp2 (caddr exp)) (exp1 (cadr exp))) (equal? ($eval-exp exp1 sn sv prog) ($eval-exp exp2 sn sv prog)))) ((equal? (car exp) 'eq?) (let ((exp2 (caddr exp)) (exp1 (cadr exp))) (eq? ($eval-exp exp1 sn sv prog) ($eval-exp exp2 sn sv prog)))) ((equal? (car exp) 'eqv?) (let ((exp2 (caddr exp)) (exp1 (cadr exp))) (eqv? ($eval-exp exp1 sn sv prog) ($eval-exp exp2 sn sv prog)))) ((equal? (car exp) 'not) (let ((exp1 (cadr exp))) (not ($eval-exp exp1 sn sv prog)))) (else (let ((exp* (cdr exp)) (fname (car exp))) (xapply fname ($eval-exp* exp* sn sv prog)))))) (define ($eval-exp* exp* sn sv prog) (if (null? exp*) '() (let ((rest (cdr exp*)) (exp (car exp*))) `(,($eval-exp exp sn sv prog) unquote ($eval-exp* rest sn sv prog))))) (define ($eval-call prog fundef sv) (let ((body (cadddr fundef)) (sn (cadr fundef))) ($eval-exp body sn sv prog))) (define ($lookup-value vname vn vv) (let ((vvtl (cdr vv)) (vvhd (car vv)) (vntl (cdr vn)) (vnhd (car vn))) (if (eq? vnhd vname) vvhd ($lookup-value vname vntl vvtl)))) (provide (all-defined-out))
false
2ac3cd9b98eb9e3f6aa9a15e60a9234c0f43c398
7e4da44b83572c71f0b92d7b85a5b18cf5aab4e3
/full/direct-concrete.rkt
5221a191bef5fbb86c2f073a34a456e90936307c
[]
no_license
kimmyg/webppl-formal
7208a678d9cbe8533114574b8c64571a6aad1a6c
863ed022dca88e436bdb9ae47d01a39855517109
refs/heads/master
2021-01-10T08:26:47.982674
2015-04-25T02:54:23
2015-04-25T02:54:23
31,231,235
0
0
null
null
null
null
UTF-8
Racket
false
false
2,218
rkt
direct-concrete.rkt
#lang racket (require "parse.rkt") (define (flip p) (if (< (random) p) 0 1)) (define (beta) (random)) (struct clos (λ ρ Ω) #:prefab) (define (update x v ρ) (hash-set ρ (var-x x) v)) (define (update* xs vs ρ) (foldl update ρ xs vs)) (define (A e ρ) (if (ulam? e) (clos e ρ) (match e [(num n) n] [(href x) (case x [(*) *] [(sub1) sub1] [else (error 'A "not for ~a" x)])] [(sref x) (hash-ref ρ x)]))) (struct branch (v ωv ω) #:transparent) (struct constant () #:transparent) (struct deterministic (f ωs) #:transparent) (define (eval* es ρ Ω) (match es [(list) (values (list) (list))] [(cons e es) (let-values ([(v ω) (eval e ρ Ω)] [(vs ωs) (eval* es ρ Ω)]) (values (cons v vs) (cons ω ωs)))])) (define (subst ω0 ω1) (match ω0 [(constant) ω1])) (define (eval e ρ Ω) (cond [(lam? e) (values (clos e ρ Ω) (constant))] [else (match e [(app f es ℓ) (let-values ([(vf ωf) (eval f ρ Ω)] [(vs ωs) (eval* es ρ Ω)]) (if (procedure? vf) (values (apply vf vs) (subst ωf (deterministic vf ωs))) (match-let ([(clos (lam xs e) ρ Ω) vf]) (eval e (update* xs vs ρ) (update* xs ωs Ω)))))] [(fix f λ) (let* ([ph (make-placeholder #f)] [g (clos λ (update f ph ρ) (update f (constant) Ω))]) (placeholder-set! ph g) (values (make-reader-graph g) (constant)))] [(href x) (values (case x [(*) *] [(sub1) sub1] [else (error 'eval "no primitive found: ~a" x)]) (constant))] [(if0 et ec ea) (let*-values ([(v0 ω0) (eval et ρ Ω)] [(v1 ω1) (eval (if (zero? v0) ec ea) ρ Ω)]) (values v1 (branch (zero? v0) ω0 ω1)))] [(num n) (values n (constant))] [(sref x) (values (hash-ref ρ x) (hash-ref Ω x))])])) (define (inject p) (eval p (hasheq) (hasheq))) (inject (P ((λ (fact) (fact 5)) (fix fact (λ (n) (if0 n 1 (* n (fact (sub1 n)))))))))
false
74174992237262d8eacd40890934093475e6f76e
3424ab96c3265f69191dd3a219b2b66a1e61b57d
/zenspider/ch06.rkt
12916a8424c2963ac2f46c4a0feeaeba78525f07
[]
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
3,987
rkt
ch06.rkt
#lang racket/base (provide operator 1st-sub-exp 2nd-sub-exp) (require "lib/shared.rkt") (require "ch04.rkt") ; eqan? ** pick div (module+ test (require rackunit)) ;;; Chapter 6 ;; pg 97 - 99 (define numbered1? (lambda (aexp) (cond [(atom? aexp) (number? aexp)] [(eq? (car (cdr aexp)) '+) #t] [(eq? (car (cdr aexp)) '*) #t] [(eq? (car (cdr aexp)) '^) #t] [else #f]))) (module+ test (define (test/numbered numbered?) (check-true (numbered? 42)) (check-false (numbered? 'a)) (check-true (numbered? '(1 + 1))) (check-true (numbered? '(1 * 1))) (check-false (numbered? '(1 / 1))) (check-true (numbered? '((1 + 1) * (1 * 1)))) (check-true (numbered? '(1 ^ 1)))) (test/numbered numbered1?)) ;; pg 100 - 101 (define numbered2 (lambda (aexp) (cond [(atom? aexp) (number? aexp)] [(eq? (car (cdr aexp)) '+) (and (numbered2 (car aexp)) (numbered2 (car (cdr (cdr aexp)))))] [(eq? (car (cdr aexp)) '*) (and (numbered2 (car aexp)) (numbered2 (car (cdr (cdr aexp)))))] [(eq? (car (cdr aexp)) '^) (and (numbered2 (car aexp)) (numbered2 (car (cdr (cdr aexp)))))] [else #f]))) (module+ test (test/numbered numbered2)) ;; lame version - doesn't ask about op (define numbered? (lambda (aexp) (cond [(atom? aexp) (number? aexp)] [else (and (memq (cadr aexp) '(+ * ^)) (numbered? (car aexp)) (numbered? (car (cdr (cdr aexp)))))]))) (module+ test (test/numbered numbered?)) ;; pg 102 - 103 (define value1 (lambda (exp) (cond [(atom? exp) exp] [(eq? (car (cdr exp)) '+) (+ (value1 (car exp)) (value1 (car (cdr (cdr exp)))))] [(eq? (car (cdr exp)) '*) (* (value1 (car exp)) (value1 (car (cdr (cdr exp)))))] [(eq? (car (cdr exp)) '^) (expt (value1 (car exp)) (value1 (car (cdr (cdr exp)))))]))) (module+ test (define (test/value/infix value) (check-equal? (value '(1 + 3)) 4) (check-equal? (value '(1 + (3 * 4))) 13) (check-equal? (value '(1 + (2 ^ 3))) 9)) (test/value/infix value1)) ;; pg 104 - 105 (define value2 (lambda (exp) (cond [(atom? exp) exp] [(eq? (car exp) '+) (+ (value2 (car (cdr exp))) (value2 (car (cdr (cdr exp)))))] [(eq? (car exp) '*) (* (value2 (car (cdr exp))) (value2 (car (cdr (cdr exp)))))] [(eq? (car exp) '^) (expt (value2 (car (cdr exp))) (value2 (car (cdr (cdr exp)))))]))) (module+ test (define (test/value/pre value) (check-equal? (value '(+ 3 1)) 4) (check-equal? (value '(+ 1 (* 3 4))) 13) (check-equal? (value '(+ 1 (^ 2 3))) 9)) (test/value/pre value2)) (define 1st-sub-exp (lambda (exp) (car (cdr exp)))) ;; pg 106 (define 2nd-sub-exp (lambda (exp) (car (cdr (cdr exp))))) (define operator (lambda (exp) (car exp))) (define value3 (lambda (exp) (cond [(atom? exp) exp] [(eq? (operator exp) '+) (+ (value3 (1st-sub-exp exp)) (value3 (2nd-sub-exp exp)))] [(eq? (operator exp) '*) (* (value3 (1st-sub-exp exp)) (value3 (2nd-sub-exp exp)))] [(eq? (operator exp) '^) (expt (value3 (1st-sub-exp exp)) (value3 (2nd-sub-exp exp)))]))) (module+ test (test/value/pre value3)) ;; pg 107 (define sero? (lambda (n) (null? n))) (define edd1 (lambda (n) (cons '() n))) (define zub1 (lambda (n) (cdr n))) (define pluz (lambda (n m) (cond [(sero? m) n] [else (edd1 (pluz n (zub1 m)))]))) (module+ test (check-true (sero? '())) (check-false (sero? 4)) (check-equal? '(()) (edd1 '())) (check-equal? '() (zub1 (edd1 '()))) (check-equal? (pluz '() '()) '( )) (check-equal? (pluz '(()) '()) '(( ))) (check-equal? (pluz '() '(())) '(( ))) (check-equal? (pluz '(()) '()) '(( ))))
false
d3e9e27730e30e10ce5c9d4c0f2be10394979adb
c63a06955a246fb0b26485162c6d1bfeedfd95e2
/p-1.33.b.rkt
b7b1be369544eed99112f1bc9fcea0e249a20528
[]
no_license
ape-Chang/sicp
4733fdb300fe1ef8821034447fa3d3710457b4b7
9df49b513e721137d889a1f645fddf48fc088684
refs/heads/master
2021-09-04T00:36:06.235822
2018-01-13T11:39:13
2018-01-13T11:39:13
113,718,990
0
0
null
null
null
null
UTF-8
Racket
false
false
658
rkt
p-1.33.b.rkt
#lang racket (define (filtered-accumulate combiner null-value pred term a next b) (if (> a b) null-value (combiner (if (pred a) (term a) null-value) (filtered-accumulate combiner null-value pred term (next a) next b)))) (define (gcd a b) (if (= b 0) a (gcd b (remainder a b)))) (define (prod-of-coprime n) (filtered-accumulate * 1 (lambda (k) (= (gcd n k) 1)) (lambda (k) k) 1 (lambda (k) (+ k 1)) (- n 1))) ;; (prod-of-coprime 10)
false
93d5f7dbd364d1a714be5f8b879ef5d632404b81
b4e3010faa07d88d6ddd8f8531ab69ce9d88c7c3
/2020/day09/stars.rkt
ab767bbc80b5c997948124d8bd0783ae76633f52
[]
no_license
yfzhe/advent-of-code
97ccb436a247107315eb71b7fc4eed1d666f88f2
25f655a1c98f7d72fe6421680890d339be074240
refs/heads/master
2023-01-04T05:04:44.398861
2022-12-11T16:57:24
2022-12-11T16:57:47
225,107,572
2
0
null
null
null
null
UTF-8
Racket
false
false
2,523
rkt
stars.rkt
#lang racket (module+ test (require rackunit)) ;;; n-sum : (Listof Num) * Num * Nat -> (U (Listof Int) #f) ;;; copy from mbutterick's solution: ;;; https://github.com/mbutterick/aoc-racket/blob/61e5bf7d9c6c23fd67d5133ad06fb18b3e7966c6/2020/09.rkt#L12 (define (n-sum nums target n) (for/or ([lst (in-combinations nums n)]) (and (= (apply + lst) target) lst))) (define (two-sum nums target) (n-sum nums target 2)) ;;; parse-input : Input-Port -> (Listof Int) (define (parse-input in) (for/list ([line (in-lines in)]) (string->number line))) ;;; ---------------------- star 1 -------------------------- ;;; first-invalid : Nat * (Listof Num) -> Num (define (first-invalid length-of-preamble nums) (let loop ([nums nums]) (define-values (base remain) (split-at nums length-of-preamble)) (define target (car remain)) (if (two-sum base target) (loop (cdr nums)) target))) (module+ test (define lst '(35 20 15 25 47 40 62 55 65 95 102 117 150 182 127 219 299 277 309 576)) (check-equal? (first-invalid 5 lst) 127)) (module+ stars (define input (call-with-input-file "input.txt" parse-input)) (define target (first-invalid 25 input)) (displayln target)) ;;; ---------------------- star 2 -------------------------- ;;; continuous-nums : (Listof Num) * Num -> (U (Listof Num) #f) (define (continuous-nums nums target) (let loop ([nums nums]) (cond [(null? nums) #f] [else (or (try-once nums target) (loop (cdr nums)))]))) ;;; try-once : (Listof Num) * Num -> (U (Listof Num) #f) (define (try-once nums target) (let loop ([acc null] [sum 0] [remain nums]) (cond [(null? remain) #f] [(> sum target) #f] [(= sum target) (reverse acc)] [else (let ([num (car remain)]) (loop (cons num acc) (+ num sum) (cdr remain)))]))) (module+ test (check-equal? (try-once lst 127) #f) (check-equal? (try-once (cddr lst) 127) '(15 25 47 40)) (check-equal? (continuous-nums lst 127) '(15 25 47 40))) (module+ stars (define group (continuous-nums input target)) (+ (apply min group) (apply max group)))
false
93d2a5c4d20c5d4b4a36fed9fd395fdaaf5e98c0
3499f7bccd6e976cfe546b3bf6d8caf932b40a1c
/plp/4_gleaning_structure.rkt
8046726b14a158733eb82e5e1c3fee822e57c5fc
[]
no_license
rogvc/cs330
a7f8bca6a13212b61e94d64d3c50cd784271b6e5
a912073667f2ff1d40d05d8b186139012ccf1dcc
refs/heads/main
2023-04-01T15:33:50.657351
2021-04-16T03:26:37
2021-04-16T03:26:37
331,189,016
0
0
null
null
null
null
UTF-8
Racket
false
false
1,628
rkt
4_gleaning_structure.rkt
#lang plait ; parsing (define-type AE [numE (n : Number)] [plusE (lhs : AE) (rhs : AE)] [minusE (lhs : AE) (rhs : AE)]) ; to implement: ; parse (parse : (S-Exp -> AE)) (define (parse s-exp) (cond [(s-exp-match? `NUMBER s-exp) (numE (s-exp->number s-exp))] [(s-exp-match? `(+ ANY ANY) s-exp) (let ([se (s-exp->list s-exp)]) (plusE (parse (list-ref se 1)) (parse (list-ref se 2))))] [(s-exp-match? `(- ANY ANY) s-exp) (let ([se (s-exp->list s-exp)]) (minusE (parse (list-ref se 1)) (parse (list-ref se 2))))] [else (error 'parse "not in our language")] ) ) ; functional programming practice ; to implement (in any order) ; add-5 ; add-m ; transform-num-list ; transform-list (define-type (Listof 'a) [empty-list] [complete (first-element : 'a) (other-elements : (Listof 'a))] ) (define (add-5 ns) (add-m 5 ns) ) (define (add-m m ns) ; (type-case (Listof 'a) ns ; [(empty-list) empty] ; [(complete first-element other-elements) (cons (+ m first-element) (add-m m other-elements))] ; ) ; How to turn this into something without first and rest? (cond [(empty? ns) empty] [else (cons (+ m (first ns)) (add-m m (rest ns))) ]) ) (test (add-5 (list 0 0 0)) (list 5 5 5)) (test (add-m 25 (list 0 0 0)) (list 25 25 25)) (define (transform-num-list f ns) (cond [(empty? ns) empty] [else (cons (f (first ns)) (transform-num-list f (rest ns)))] ) ) (define (transform-list f ns) (cond [(empty? ns) empty] [else (cons (f (first ns)) (transform-list f (rest ns)))] ) )
false
8a75d0498b1d3196bf72ee9440060bb1eecd4475
8913c7639fb1439b1f35f513ac05c2023ce39acc
/noizy/test-c.rkt
25d514f850c4d92b80962811618bdb715bdde44c
[ "MIT" ]
permissive
krcz/zygote
124791acabaf48c62ee602f94c788916adec36c4
1f6298f0a73fd0320bc3ba5abe5f00a805fed8fc
refs/heads/master
2022-02-27T19:00:08.302486
2020-02-02T15:08:53
2020-02-02T15:08:53
183,607,857
20
0
null
null
null
null
UTF-8
Racket
false
false
932
rkt
test-c.rkt
#lang s-exp "c-syntax.rkt" (to-stdout render (function-definition (list 'int) (fun-declarator (var-name "main") (list (parameter-declaration (list 'int) (var-name "argc")) (parameter-declaration (list 'char) (pointer-declarator (pointer (list (list) (list))) (var-name "argv")))) #f) (list) (compound-statement (list (var-declaration (list 'int) (list (var-name "i") (var-name "n"))) (expression-statement (assignment-expression (assignment-operator "=") (var-name "n") (integer-literal 10))) (for-statement (assignment-expression (assignment-operator "=") (var-name "i") (integer-literal 1)) (binary-expression '<= (var-name "i") (var-name "n")) (unary-expression '++ (var-name "i")) (compound-statement (list (expression-statement (call-expression (var-name "f") (list (var-name "i") (var-name "n")))))))))))
false
3d9004207ab91b5b40ea2eeeca6f52604d48976a
015fb8b88cc26429d6aa75269f9c86f5ef0d33a3
/Applied-Mathematics-5th-Term/Lab5-Cyclic-Codes/coder-test.rkt
5d67d7afeb3ba85c5f7fa9e705bea742c4bfb7aa
[]
no_license
timlathy/itmo-third-year
fd1e2a6d97b5d49b4efdee8e08d30a3d6a5b48be
44bd4202beb115e27939add2e51fe13ff4d8b54e
refs/heads/master
2021-08-17T01:19:56.811533
2020-07-31T03:12:21
2020-07-31T03:12:21
208,321,854
0
1
null
null
null
null
UTF-8
Racket
false
false
880
rkt
coder-test.rkt
#lang racket (require rackunit rackunit/text-ui data/bit-vector "coder.rkt") (define coder-tests (test-suite "coder.rkt tests" (test-case "encode-decode" (define cases '("10011" "1100001010" "1100")) (for ([data (in-list cases)]) (define src (string->bit-vector data)) (define encoded (encode-cc src)) (define decoded (decode-cc encoded)) (check-equal? (bit-vector->string decoded) data))) (test-case "single bit error" (define src (string->bit-vector "1100")) (define encoded (encode-cc src)) (for ([i (in-range (bit-vector-length encoded))]) (define error-msg (bit-vector-copy encoded)) (bit-vector-set! error-msg i (not (bit-vector-ref error-msg i))) (define decoded (decode-cc error-msg)) (check-equal? (bit-vector->string decoded) "1100"))))) (run-tests coder-tests)
false
db289bd9628a1636ac980d8db8c20f5192b72dac
25de48a75948a2003f01d9763968d344dca96449
/private/lex.rkt
e7114ae5fbde89476d2e72e0af6ee9548bd9be2c
[]
no_license
lwhjp/racket-jlang
76c620f21b48c84a2100120708f56c1525b23bdc
021c40382f95d1a6dc0b329a152a171465b9bc75
refs/heads/master
2021-01-10T07:39:23.433422
2017-10-02T04:11:34
2017-10-02T04:11:34
47,949,158
13
1
null
null
null
null
UTF-8
Racket
false
false
1,109
rkt
lex.rkt
#lang racket/base (require parser-tools/lex (prefix-in : parser-tools/lex-sre)) (define-lex-abbrev comment (:: "NB." (complement (:: any-string #\newline any-string)))) (define-lex-abbrev number (:: (:or numeric #\_) (:* (:or numeric alphabetic #\. #\_)))) (define-lex-abbrev string (:: #\' (:* (:or (char-complement (:or #\' #\newline)) "''")) #\')) (define-lex-abbrev name (:: alphabetic (:* (:or alphabetic #\_ numeric)))) (define-lex-abbrev primary (:or (char-complement (:or numeric alphabetic #\_ #\')) (:: (:or graphic name) (:+ (:or #\. #\:))))) (define-tokens WORDS (NUMBER STRING NAME PRIMARY)) (define-empty-tokens PUNCTUATION (EOL EOF LPAREN RPAREN)) (define lex (lexer-src-pos [#\newline (token-EOL)] [(:+ (:- whitespace #\newline)) (return-without-pos 'whitespace)] [comment (return-without-pos 'comment)] [#\( (token-LPAREN)] [#\) (token-RPAREN)] [primary (token-PRIMARY lexeme)] [name (token-NAME lexeme)] [number (token-NUMBER lexeme)] [string (token-STRING lexeme)] [(eof) (token-EOF)])) (provide lex WORDS PUNCTUATION)
false
cd376df6d3e8110487b7610a930670903fc747b4
d2fc383d46303bc47223f4e4d59ed925e9b446ce
/courses/2015/spring/250/notes/12.rkt
7465bb60e829998ec95a6ae5eb744341e5db845a
[]
no_license
jeapostrophe/jeapostrophe.github.com
ce0507abc0bf3de1c513955f234e8f39b60e4d05
48ae350248f33f6ce27be3ce24473e2bd225f6b5
refs/heads/master
2022-09-29T07:38:27.529951
2022-09-22T10:12:04
2022-09-22T10:12:04
3,734,650
14
5
null
2022-03-25T14:33:29
2012-03-16T01:13:09
HTML
UTF-8
Racket
false
false
10,962
rkt
12.rkt
#lang racket/base (require racket/match racket/list (for-syntax racket/base racket/list syntax/parse)) (struct id (name) #:transparent) (define (slack? i) (eq? #f (id-name i))) (define (linear-print lin port mode) (when mode (write-string "<linear:" port)) (define recur (case mode [(#t) write] [(#f) display] [else (lambda (p port) (print p port mode))])) (recur `(+ ,@(for/list ([(var coeff) (in-hash (linear-var->coeff lin))]) `(* ,coeff ,(id-name var))) ,(linear-constant lin)) port) (when mode (write-string ">" port))) (struct linear (var->coeff constant) #:methods gen:custom-write [(define write-proc linear-print)]) (define linear0 (linear (hasheq) 0)) (define (linears->vars lins) (sort (hash-keys (linear-var->coeff (foldl linear+ linear0 lins))) <= #:key (λ (v) (if (slack? v) 1 0)))) (define (linear->vector var-order lin) (match-define (linear var->coeff constant) lin) (for/vector #:length (length var-order) ([var (in-list var-order)]) (hash-ref var->coeff var 0))) (define (linears->coeff-matrix var-order lins) (for/vector #:length (length lins) ([lin (in-list lins)]) (linear->vector var-order lin))) (define (linears->constant-vector var-order lins) (for/vector #:length (length lins) ([lin (in-list lins)]) (* -1 (linear-constant lin)))) ;; This is wrong if the slack don't form a basis (in which case you ;; need to do a Phase I) this is the case when you use min, =, or >= ;; rather than only max and <= (define (initial-tableau c A b) (define eqs (vector-length A)) (define vars (vector-length c)) (define mat (make-vector (+ eqs 1) #f)) (for ([i (in-naturals)] [eq (in-vector A)]) (define mat-eq (make-vector (+ vars 1) #f)) (for ([j (in-naturals)] [e (in-vector eq)]) (vector-set! mat-eq j e)) (vector-set! mat-eq vars (vector-ref b i)) (vector-set! mat i mat-eq)) (define mat-last (make-vector (+ vars 1) #f)) (for ([i (in-naturals)] [c (in-vector c)]) (vector-set! mat-last i c)) (vector-set! mat-last vars 0) (vector-set! mat eqs mat-last) mat) (define (can-improve? vars t) (for/or ([e (in-vector (vector-ref t (- (vector-length t) 1)))] [v (in-list vars)] [i (in-naturals)] #:unless (slack? v) #:when (positive? e)) i)) (define (more-than-one-minimum ns) (cond [(= (length ns) 1) #f] [else (define 1st-min (apply min ns)) (define ns-p (remove 1st-min ns)) (define 2nd-min (apply min ns-p)) (= 1st-min 2nd-min)])) (define (find-pivot-index t col) (when (for/and ([row (in-vector t)]) (not (positive? (vector-ref row col)))) (error 'find-pivot-index "Unbounded")) (define quotients (for/list ([i (in-range (- (vector-length t) 1))] [r (in-vector t)] #:when (positive? (vector-ref r col))) (cons i (/ (vector-ref r (- (vector-length r) 1)) (vector-ref r col))))) (when (more-than-one-minimum (map cdr quotients)) (error 'find-pivot-index "Degenerate")) (define row (car (argmin cdr quotients))) row) (define (pivot-about t pi pj) (printf "\tpi = ~v, pj = ~v\n" pi pj) (define denom (vector-ref (vector-ref t pi) pj)) (printf "\tdenom = ~v\n" denom) (define unit-pivot (let () (define r (vector-ref t pi)) (for/vector #:length (vector-length r) ([x (in-vector r)]) (/ x denom)))) (printf "\tunit-pivot = ~v\n" unit-pivot) (for/vector #:length (vector-length t) ([r (in-vector t)] [k (in-naturals)]) (cond [(= pi k) unit-pivot] [else (for/vector #:length (vector-length r) ([x (in-vector r)] [up (in-vector unit-pivot)]) (define y (* up (vector-ref r pj))) (- x y))]))) (define (extract-solution vars t) (for/fold ([subst (hasheq)]) ([v (in-list vars)] [i (in-naturals)] #:unless (slack? v)) (define val (for/or ([r (in-vector t)] #:when (and (= (vector-ref r i) 1) (for/and ([ov (in-list vars)] [oi (in-naturals)] #:unless (eq? v ov) #:unless (slack? ov)) (= (vector-ref r oi) 0)))) (vector-ref r (length vars)))) (if val (hash-set subst v val) subst))) (define (simplex* cs obj) (define vars (linears->vars (cons obj cs))) (printf "VARS = ~v\n" vars) (define c (linear->vector vars obj)) (printf "c = ~v\n" c) (define A (linears->coeff-matrix vars cs)) (printf "A = ~v\n" A) (define b (linears->constant-vector vars cs)) (printf "b = ~v\n" b) (define itab (initial-tableau c A b)) (printf "itab = ~v\n" itab) (define final-tableau (let loop ([tableau itab]) (printf "\n") (printf "\ttab = ~v\n" tableau) (define pivot-column (can-improve? vars tableau)) (printf "\tpivot-col = ~v\n" pivot-column) (cond [pivot-column (loop (pivot-about tableau (find-pivot-index tableau pivot-column) pivot-column))] [else tableau]))) (extract-solution vars final-tableau)) (module+ test (define x_1 (id 'x_1)) (define x_2 (id 'x_2)) (define slack_1 (id #f)) (define slack_2 (id #f)) (simplex* (list ;; 1 * x_1 + 2 * x_2 + 1 * slack_1 + (-4) = 0 (linear (hasheq x_1 1 x_2 2 slack_1 1) -4) ;; 1 * x_1 + -1 * x_2 + 1 * slack_2 + (-1) = 0 (linear (hasheq x_1 1 x_2 -1 slack_2 1) -1)) ;; MAX: 3 * x_1 + 2 * x_2 + 0 (linear (hasheq x_1 3 x_2 2) 0))) ;; Turn constraints into symbolic linear equations (define (linear+ lhs rhs) (match-define (linear lhs-map lhs-k) lhs) (match-define (linear rhs-map rhs-k) rhs) (linear (for/fold ([var->coeff lhs-map]) ([(var coeff) (in-hash rhs-map)]) (hash-update var->coeff var (λ (old) (+ old coeff)) 0)) (+ lhs-k rhs-k))) (define (linear* sc l) (match-define (linear var->coeff k) l) (linear (for/hasheq ([(var coeff) (in-hash var->coeff)]) (values var (* sc coeff))) (* sc k))) (define (->linear e) (match e [(? number?) (linear (hasheq) e)] [(? id?) (linear (hasheq e 1) 0)] [(? linear?) e])) (define (constraint+ lhs rhs) (match* (lhs rhs) [((? linear?) (? linear?)) (linear+ lhs rhs)] [(_ _) (constraint+ (->linear lhs) (->linear rhs))])) (define (constraint* lhs rhs) (match* (lhs rhs) [((? number? coeff) (? id? var)) (linear (hasheq var coeff) 0)] [((? id? var) (? number? coeff)) (linear (hasheq var coeff) 0)] [((? number?) (? number?)) (* lhs rhs)] [((? number? scalar) (? linear? lin)) (linear* scalar lin)] [((? linear? lin) (? number? scalar)) (linear* scalar lin)] [(_ _) (error 'constraint* "~v ~v" lhs rhs)])) (define (constraint- lhs rhs) (constraint+ lhs (constraint* -1 rhs))) (define-syntax (stx-pair-it stx) (syntax-parse stx [(_ fun arg1 arg2) (syntax/loc stx (fun arg1 arg2))] [(_ fun arg1 arg ...) (syntax/loc stx (fun arg1 (stx-pair-it fun arg ...)))])) (define-syntax (compute-constraint-expr stx) (syntax-parse stx #:literals (+ - *) [(_ (+ arg ...)) (syntax/loc stx (stx-pair-it constraint+ (compute-constraint-expr arg) ...))] [(_ (- arg ...)) (syntax/loc stx (stx-pair-it constraint- (compute-constraint-expr arg) ...))] [(_ (* arg ...)) (syntax/loc stx (stx-pair-it constraint* (compute-constraint-expr arg) ...))] [(_ var:id) #'var] [(_ coeff:number) #'coeff])) (define-syntax (compute-constraint stx) (syntax-parse stx #:literals (=) [(_ (= lhs rhs)) (syntax/loc stx (compute-constraint-expr (- lhs rhs)))])) (define-syntax (normalize-constraint stx) (syntax-parse stx #:literals (>= <= =) [(_ (~and con (= . _))) (quasisyntax/loc #'con (compute-constraint con))] ;; x <= y -----> x + e = y [(_ (~and con (<= lhs rhs))) (quasisyntax/loc stx (let ([slack (id #f)]) (normalize-constraint #,(quasisyntax/loc #'con (= (+ lhs slack) rhs)))))] ;; x >= y -----> x - e = y [(_ (~and con (>= lhs rhs))) (quasisyntax/loc stx (let ([slack (id #f)]) (normalize-constraint #,(quasisyntax/loc #'con (= (- lhs slack) rhs)))))])) (define-syntax (normalize-objective stx) (syntax-parse stx #:literals (max min) [(_ (max obj)) (syntax/loc stx (compute-constraint-expr obj))] [(_ (min obj)) (syntax/loc stx (normalize-objective (max (* -1 obj))))])) (define-syntax (simplex stx) (syntax-parse stx [(_ (var:id ...) constraint:expr ... objective:expr) (syntax/loc stx (let () (define var (id 'var)) ... (simplex* (list (normalize-constraint constraint) ...) (normalize-objective objective))))])) ;; Some tests (module+ test (simplex (x_1 x_2) (<= (+ x_1 (* 2 x_2)) 4) (<= (- x_1 x_2) 1) (max (+ (* 3 x_1) (* 2 x_2))))) (module+ test-general (simplex (x_1 x_2) (>= (+ x_1 (* 2 x_2)) 2) (>= (- x_1 x_2) 1) (min (+ (* 3 x_1) (* 2 x_2)))) (simplex (b m r) (>= (+ (* 91 b) (* 87 m) (* 87 r)) 3700) (>= (+ (* 47 b) (* 276 m) (* 40 r)) 1000) (>= (+ (* 89.2 b) (* 0 m) (* 53.2 r)) 90) (min (+ (* 0.381 b) (* 0.1 m) (* 0.272 r)))) "should be b -> 1.01, m -> 41.47, r -> 0" (simplex (x1 x2 x3) (>= (+ x1 x2 x3) 6) (>= (+ (* 2 x1) x3) 2) (>= (+ x2 x3) 1) (min (+ (* 4 x1) (* 3 x2) (* 9 x3)))) (simplex (x1 x2 x3) (<= (- (* 3 x1) (* 2 x2)) 7) (>= (+ x2 (* 4 x3)) 10) (= (+ x1 x2) 2) (min (+ x1 x2 x3))) (simplex (x y) (>= x 2) (>= y 2) (<= x 10) (<= y 10) (max (+ x y))))
true
3b01c19ecfc39df5d1bdf6195be5650be821b6f5
323c4b63da4e4cd9b7236d130a137b479f2597bf
/syndicate/mc/mc-chat-client.rkt
1049061cda91720cb61f51dc60c3e8d4aec42564
[]
no_license
frumioj/syndicate-rkt
b177fb55eaca6047c1bd63c024cf4297ee8b80e8
3030d1959e4b9bee9b8b6cbb7b8bab2d11f37d7c
refs/heads/master
2022-10-10T01:15:41.664050
2020-06-10T11:38:26
2020-06-10T11:38:26
null
0
0
null
null
null
null
UTF-8
Racket
false
false
896
rkt
mc-chat-client.rkt
#lang syndicate (require/activate "udp-dataspace.rkt") (require/activate syndicate/drivers/external-event) (require (only-in racket/port read-bytes-line-evt)) (require racket/random file/sha1) (message-struct speak (who what)) (assertion-struct present (who)) (spawn (define me (bytes->hex-string (crypto-random-bytes 8))) (define stdin-evt (read-bytes-line-evt (current-input-port) 'any)) (assert (mcds-outbound (present me))) (on (message (inbound (external-event stdin-evt (list $line)))) (if (eof-object? line) (stop-current-facet) (send! (mcds-outbound (speak me line))))) (during (mcds-inbound (present $user)) (on-start (printf "~a arrived\n" user)) (on-stop (printf "~a left\n" user)) (on (message (mcds-inbound (speak user $text))) (printf "~a says '~a'\n" user text))))
false
b66d545d3f8279f479ed2c98be35244f63188c6d
b3f7130055945e07cb494cb130faa4d0a537b03b
/gamble/examples/scratch/rerun.rkt
66252cba58d6657965ac669738aa947968b8041c
[ "BSD-2-Clause" ]
permissive
rmculpepper/gamble
1ba0a0eb494edc33df18f62c40c1d4c1d408c022
a5231e2eb3dc0721eedc63a77ee6d9333846323e
refs/heads/master
2022-02-03T11:28:21.943214
2016-08-25T18:06:19
2016-08-25T18:06:19
17,025,132
39
10
BSD-2-Clause
2019-12-18T21:04:16
2014-02-20T15:32:20
Racket
UTF-8
Racket
false
false
725
rkt
rerun.rkt
#lang gamble (require racket/class) ;; Demonstrates that rerun is necessary after changing observations. ;; used in observation, mutated below! (define expected 1) (define s (mh-sampler (define b (uniform 0 1)) (for ([i 10]) (observe (bernoulli b) expected)) b)) (printf "with expected = 1\n") (sampler->mean+variance s 1000) (newline) (printf "the last sample with expected = 1\n") (s) (newline) (set! expected 0) (printf "set expected = 0, BUT w/o rerun\n") (printf " same result as above, because all moves rejected by MH!\n") (sampler->mean+variance s 1000) (newline) (void (send s rerun)) (printf "after rerun\n") (printf " now get a reasonable result\n") (sampler->mean+variance s 1000) (newline)
false
e1ea752765add3d9297fe76d5ce2acfa8535ab27
b3dc4d8347689584f0d09452414ffa483cf7dcb3
/rash-demos/rash/demo/infix-math.rkt
16192862fd4c9381c9ffc44eda9526ca92a44139
[ "MIT", "Apache-2.0" ]
permissive
willghatch/racket-rash
75e336d985bf59b4adfe5d5a7bd68d31cf2fe7db
42460a283ce2d7296257b068505cd4649052f67c
refs/heads/master
2023-06-17T16:16:26.126945
2023-02-24T18:13:25
2023-02-24T18:17:02
65,781,414
556
43
NOASSERTION
2021-03-09T17:17:29
2016-08-16T02:37:13
Racket
UTF-8
Racket
false
false
1,435
rkt
infix-math.rkt
#lang rash ;; This is to demonstrate a quick-and-easy way to get infix math in your shell... ;; But a *better* way is to do this stuff with the k-infix package instead of ;; my simplistic `basic-infix-math` macro. (provide infix-math pipeline-or-math =infix-math= =unix-or-math= ) (require (rename-in "basic-infix-math.rkt" [infix-math basic-infix-math]) racket/stxparam (for-syntax racket/base syntax/parse )) (define-line-macro infix-math (syntax-parser [(_ arg ...) #'(basic-infix-math arg ...)])) (define-line-macro pipeline-or-math (syntax-parser [(_ arg1:number arg ...) #'(basic-infix-math arg1 arg ...)] [(_ arg ...) #'(run-pipeline arg ...)])) (define-pipeline-operator =infix-math= #:start (syntax-parser [(_ arg ...) #'(object-pipeline-member-spec (λ () (basic-infix-math arg ...)))]) #:joint (syntax-parser [(_ arg ...) #'(object-pipeline-member-spec (λ (x) (syntax-parameterize ([current-pipeline-argument (syntax-parser [_ #'x])]) (basic-infix-math arg ...))))])) (pipeop =unix-or-math= [(_ arg1:number arg ...) #'(=infix-math= arg1 arg ...)] [(_ arg ...) #'(=unix-pipe= arg ...)])
false
5f750295fbf118ac41d5f7a2fe63c1647ffe7a9a
0cbd6f5b80bbe1859aa0276d78cfb0cf0ccde51a
/lazy.rkt
09d3b0248bf8e3b3afb0f9ed659226039d6f6aee
[ "ISC" ]
permissive
peblair/racket-r7rs
c3827ff73df51f83373900c77aadc2efba5d8295
b689161660d5f52f497a26e49d8b8bc17456c576
refs/heads/master
2021-05-28T21:15:03.582933
2015-10-26T19:34:12
2015-10-26T19:34:12
null
0
0
null
null
null
null
UTF-8
Racket
false
false
291
rkt
lazy.rkt
#lang racket/base (require (prefix-in r: racket/promise) "private/strip-prefix.rkt") (provide (strip-colon-prefix-out r:delay delay-force r:force make-promise r:promise?)) (define-syntax-rule (delay-force expr) (r:delay (r:force expr))) (define (make-promise x) (r:lazy x))
true
3cdfc508e115d268a7b1b967787e030a7f06eb19
68b85d480bb48265dc845a6509e778136cdcd4cc
/src/5.rkt
3d896f88c9d8ace68f2323ec62db830691b86f09
[]
no_license
jpathy/aoc16
fd0da86774f3c4aae7bdd1c279ec0a7b79e09083
34e86f1808ac760ef56fd6fc94461f256801ccad
refs/heads/master
2021-01-13T08:44:27.485066
2017-02-13T13:53:42
2017-02-13T13:53:42
81,654,360
1
0
null
null
null
null
UTF-8
Racket
false
false
1,410
rkt
5.rkt
#lang racket/base (require racket/contract openssl/md5) (provide (contract-out [solve-1 (-> string? string?)] [solve-2 (-> string? string?)])) (define (solve-1 input) (define out (for*/vector #:length 8 ([i (in-naturals)] [h (in-value (md5-bytes (open-input-string (format "~a~a" input i))))] #:when (and (= (bytes-ref h 0) 0) (= (bytes-ref h 1) 0) (= (quotient (bytes-ref h 2) 16) 0))) (remainder (bytes-ref h 2) 16))) (apply string-append (map (lambda (x) (format "~x" x)) (vector->list out)))) (define (solve-2 input) (define count 0) (define out (for*/fold ([out (make-vector 8 16)]) ([i (in-naturals)] [h (in-value (md5-bytes (open-input-string (format "~a~a" input i))))] [idx (in-value (remainder (bytes-ref h 2) 16))] #:break (= count 8) #:when (and (= (bytes-ref h 0) 0) (= (bytes-ref h 1) 0) (= (quotient (bytes-ref h 2) 16) 0) (< idx 8) (= (vector-ref out idx) 16))) (vector-set! out idx (quotient (bytes-ref h 3) 16)) (set! count (add1 count)) out)) (apply string-append (map (lambda (x) (format "~x" x)) (vector->list out))))
false
78d4f5c8affe45be6c0dc5708b525b90545eaf88
82c76c05fc8ca096f2744a7423d411561b25d9bd
/typed-racket-test/succeed/pr13710.rkt
27e691889b685d6721a66c45befa119b52e2f475
[ "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
racket/typed-racket
2cde60da289399d74e945b8f86fbda662520e1ef
f3e42b3aba6ef84b01fc25d0a9ef48cd9d16a554
refs/heads/master
2023-09-01T23:26:03.765739
2023-08-09T01:22:36
2023-08-09T01:22:36
27,412,259
571
131
NOASSERTION
2023-08-09T01:22:41
2014-12-02T03:00:29
Racket
UTF-8
Racket
false
false
802
rkt
pr13710.rkt
#lang typed/racket (: convert-it (Any -> (HashTable Symbol Number))) (define (convert-it a) (if (hash? a) (begin (hash-ref a 3) (hash-has-key? a 3) (ann (hash-remove a 3) HashTableTop) (hash-remove! a 3) (length (hash-map a (lambda: ([x : Any] [y : Any]) x))) (hash-for-each a (lambda: ([x : Any] [y : Any]) (display x))) (add1 (hash-count a)) (length (hash-keys a)) (length (hash-values a)) (length (hash->list a)) (for ([(k v) (in-hash a)]) (display k)) (for/hash: : (HashTable Symbol Number) ([v (in-hash-values a)]) (values 'x 1)) (for/hash: : (HashTable Symbol Number) ([k (in-hash-keys a)]) (values 'x 1))) (error 'convert-it "not a hash ~s" a)))
false
d90a6cd6954322fb3772712b94c34b90885f9c23
47457420b9a1eddf69e2b2f426570567258f3afd
/3/47-48.rkt
b5fc2d42500253fb00983267b5ee800c4e000e22
[]
no_license
adromaryn/sicp
797496916620e85b8d85760dc3f5739c4cc63437
342b56d233cc309ffb59dd13b2d3cf9cd22af6c9
refs/heads/master
2021-08-30T06:55:04.560128
2021-08-29T12:47:28
2021-08-29T12:47:28
162,965,433
0
0
null
null
null
null
UTF-8
Racket
false
false
3,975
rkt
47-48.rkt
#lang racket ;; Реализация параллелизма как в SICP (define (set-car! pair v) (set! pair (cons v (cdr pair)))) (define (parallel-execute . procs) (map thread-wait (map (lambda (proc) (thread proc)) procs))) (define (make-mutex) (let ((cell (list false))) (define (the-mutex m) (cond ((eq? m 'acquire) (if (test-and-set! cell) (the-mutex 'acquire) '())) ((eq? m 'release) (clear! cell)))) the-mutex)) (define (clear! cell) (set-car! cell false)) ; No atomic, only for test!!! (define (test-and-set! cell) (if (car cell) true (begin (set-car! cell true) false))) (define (make-serializer) (let ((mutex (make-mutex))) (lambda (p) (define (serialized-p . args) (mutex 'acquire) (let ((val (apply p args))) (mutex 'release) val)) serialized-p))) ;; Тест параллельного исполнения (define x 10) (parallel-execute (lambda () (set! x (* x x))) (lambda () (set! x (+ x 1)))) x (define x2 10) (define s (make-serializer)) (parallel-execute (s (lambda () (set! x2 (* x2 x2)))) (s (lambda () (set! x2 (+ x2 1))))) x2 (define (make-account balance id) (define (withdraw amount) (if (>= balance amount) (begin (set! balance (- balance amount)) balance) "Insufficient funds")) (define (deposit amount) (set! balance (+ balance amount)) balance) (let ((protected (make-serializer))) (define (dispatch m) (cond ((eq? m 'withdraw) (protected withdraw)) ((eq? m 'deposit) (protected deposit)) ((eq? m 'balance) balance) ((eq? m 'id) id) (else (error "Unknown request -- MAKE-ACCOUNT" m)))) dispatch)) ;; semaphore with mutex (3.47 a) (define (make-semaphore1 n) (let ((mutex (make-mutex)) (count 0)) (define (acquire) (mutex 'acquire) (if (= count n) (begin (mutex 'release) (acquire)) (begin (set! count (+ 1 count)) (mutex 'release))) 'acquired) (define (release) (mutex 'acquire) (set! count (- count 1)) (mutex 'release) 'released) (define (the-sem m) (cond ((eq? m 'acquire) acquire) ((eq? m 'release) release) (else (error "Неизвестный метод -- MAKE-SEMAPHORE" m)))) the-sem)) ;; semaphore with test-and-set! (3.47 b) (define (make-semaphore2 n) (let ((cell (list false)) (counter 0)) (define (acquire) (if (or (test-and-set! cell) (= counter n)) (begin (clear! cell) (acquire)) (begin (set! counter (+ counter 1)) (clear! cell) 'acquired))) (define (release) (if (test-and-set! cell) (begin (clear! cell) (release)) (begin (set! counter (- counter 1)) (clear! cell) 'released))) (define (the-sem m) (cond ((eq? m 'acquire) acquire) ((eq? m 'release) release) (else (error "Неизвестный метод -- MAKE-SEMAPHORE" m)))) the-sem)) ;; exchange balance without deadlock (3.48) (define (exchange account1 account2) (let ((difference (- (account1 'balance) (account2 'balance)))) ((account1 'withdraw) difference) ((account2 'deposit) difference) 'ok)) (define (serialized-exchange account1 account2) (let ((serializer1 (account1 'serializer)) (serializer2 (account2 'serializer))) (if (< (account1 'id) (account2 'id)) ((serializer1 (serializer2 exchange)) account1 account2) ((serializer2 (serializer1 exchange)) account1 account2))))
false
127ef92f26cb4b7c0d479a9fa97762e26bdcd942
8ad2bcf76a6bda64f509da5f0844e0285f19d385
/espeaker.rkt
0b3fae6d0fc3b1ee4bca9e911c9ef51bd67b6300
[]
no_license
jeapostrophe/exp
c5efae0ea7068bb5c8f225df6de45e6c4fa566bd
764265be4bcd98686c46ca173d45ee58dcca7f48
refs/heads/master
2021-11-19T00:23:11.973881
2021-08-29T12:56:11
2021-08-29T12:56:11
618,042
39
5
null
null
null
null
UTF-8
Racket
false
false
1,069
rkt
espeaker.rkt
#lang racket/base (require racket/gui/base racket/class) (define (go!) (define-values (es-sp espeak-out espeak-in espeak-err) (subprocess (current-output-port) #f (current-error-port) "/usr/bin/espeak" "-x")) (define current "") (define es-frame% (class* frame% () (define/override (on-subwindow-char r e) (define kc (send e get-key-code)) (when (char? kc) (cond [(and (not (char=? kc #\return)) (not (char=? kc #\space))) (set! current (string-append current (string kc)))] [else (fprintf espeak-in "~a \n" current) (flush-output espeak-in) (set! current "")]) (send mw set-status-text current)) #t) (super-new))) (define mw (new es-frame% [label "espeaker"] [style '(no-resize-border no-caption hide-menu-bar no-system-menu)])) (send mw create-status-line) (send mw show #t) (send mw focus)) (module+ main (go!))
false
55d6c674dc2817c7b019df5a54f181e8a5d48644
04d3f2a238af3f50bff5a2fe2b5d8113cdceace8
/lectures/lecture-2013-03-11.rkt
88d0c4876089690e724ee64cd0d3478f70492aac
[]
no_license
neu-cs4800s13/public
8571de8ad77ecfcd588b7cf89f508defcb3876f1
97f3bddba2d1ab44a0df32d8372b9861916ac615
refs/heads/master
2021-01-19T13:46:16.689367
2013-04-16T21:20:42
2013-04-16T21:20:42
7,541,574
1
1
null
null
null
null
UTF-8
Racket
false
false
1,743
rkt
lecture-2013-03-11.rkt
#lang racket ;; Naive recursive solution: ;; Compute results, then choose item. (define (bfk-naive I w v W) (max-of-numbers (result-for-each-i I I w v W))) (define (result-for-each-i I* I w v W) (cond [(set-empty? I*) empty] [else (define i (set-first I*)) (define w.i (vector-ref w i)) (define v.i (vector-ref v i)) (define result-for-i (cond [(<= w.i W) (+ v.i (bfk-naive (set-remove I i) w v (- W w.i)))] [else (* W (/ v.i w.i))])) (cons result-for-i (result-for-each-i (set-rest I*) I w v W))])) (define (max-of-numbers ns) (cond [(empty? ns) 0] ;; correct for knapsack problem, not in general [else (max (first ns) (max-of-numbers (rest ns)))])) ;; Greedy solution: ;; Choose item, then compute result. (define (bfk I w v W) (result-for-given-i I w v W (item-of-max-value I w v))) (define (result-for-given-i I w v W i) (define w.i (vector-ref w i)) (define v.i (vector-ref v i)) (cond [(<= w.i W) (+ v.i (bfk (set-remove I i) w v (- W w.i)))] [else (* W (/ v.i w.i))])) (define (item-of-max-value I w v) (cond [(set-empty? (set-rest I)) (set-first I)] [else (better-item (set-first I) (item-of-max-value (set-rest I) w v) w v)])) (define (better-item i1 i2 w v) (define ratio1 (ratio i1 w v)) (define ratio2 (ratio i2 w v)) (cond [(> ratio1 ratio2) i1] [else i2])) (define (ratio i w v) (/ (vector-ref v i) (vector-ref w i))) (module+ test (require rackunit) (check-equal? (bfk (set 0 1 2) (vector 10 20 30) (vector 50 40 30) 55) 115) (check-equal? (bfk (set 0 1 2 3) (vector 10 20 30 45) (vector 50 40 30 41) 55) 115))
false
c69fe13ac8623be43b102ff6c89a7b99715bdf58
0c3a659831a5c693e7bcf9af69e739235fab1bef
/tc-call.rkt
a6027763a311b1c603435212978cb84f94b0f176
[]
no_license
deeglaze/limp
0e917e170dcd932b8a5a4c61189f52035b0c13cc
fba4bb41e05e2edbaaccf8ccb83d604e2cf0f039
refs/heads/master
2021-01-18T01:36:06.396086
2015-02-11T21:52:59
2015-02-11T21:52:59
null
0
0
null
null
null
null
UTF-8
Racket
false
false
2,807
rkt
tc-call.rkt
#lang racket/unit (require racket/match foracc (only-in racket/list make-list) "common.rkt" "language.rkt" "tc-common.rkt" "tc-sigs.rkt" "tc-ctxs.rkt" "type-lattice.rkt" "tast.rkt" "types.rkt") (import tc-expr^ tc-rules^) (export tc-call^) (define (ts-call Γ Ξ e path tagged) (match-define (ECall sy _ mf τs es) e) ;; We monomorphize as well as check the function. (define mfτ (hash-ref Ξ mf (unbound-mf sy 'tc-expr mf))) ;; instantiate with all given types, error if too many (define-values (Δ τs* inst) (apply-annotation Γ τs mfτ)) ;; also error if too few (define-values (dom-σs rng) (match inst [(TArrow: _ (TVariant: _ _ σs _) rng) (values σs rng)] [#f (values (make-list (length es) (type-error "Metafunction type must be fully instantiated, but ~a left: ~a" (num-top-level-Λs inst) inst)) T⊤)] [bad (error 'ecall "Unexpected metafunction type ~a" bad)])) ;; Check arguments against instantiated domain types. (define-values (Θ es*) (for/acc ([Δ Δ] [#:type list]) ([se (in-list es)] [σ (in-list dom-σs)] [i (in-naturals)]) (tc-expr Δ Ξ se σ `((call ,mf . ,i) . ,path) #f))) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Recheck MFs for monomorphization (define H (monomorphized)) (define renamed (cond [(and H (andmap mono-type? dom-σs) (mono-type? rng)) ;; We recheck whole mf body to get the instantiations. (define mf-mono (hash-ref! H mf make-hash)) (define name* ((mono-namer) mf τs*)) (printf "Mono name ~a~%" name*) (unless (hash-has-key? mf-mono name*) (hash-set! mf-mono name* 'gray) ;; don't diverge with self-calls (define old-mf (hash-ref (mf-defs) mf)) (unless (Metafunction? old-mf) (error 'tc-metafunction "Not a metafunction: ~a" mf)) (define opened (open-scopes-in-rules (Metafunction-rules old-mf) (reverse τs*))) (printf "Opened at ~a~%" τs*) (define-values (Δ rules*) (tc-rules (empty-ctx) Ξ ;; instantiate the mono-types in the mf body. opened ;; Outermost first. (TArrow-dom inst) rng `(def . ,name*) '())) (hash-set! mf-mono name* (Metafunction name* inst rules*))) name*] [else #f])) (define mk-e (if renamed ;; monomorphized (λ (ct) (ECall sy ct renamed '() es*)) (λ (ct) (ECall sy ct mf τs* es*)))) ;; End monomorphization ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (values Θ mk-e rng #f))
false
801434e342cb554fcf0648f6b2d543f1f8d5eee1
fe1611fa2ebaf959384ef2c8778f4da645692c96
/disposable/private/pool.rkt
2251e60adb1619b3200c9f353ce25937d14bfa20
[ "Apache-2.0" ]
permissive
jackfirth/racket-disposable
94d5a9b848de827f98c0788a2c12e3eb2001bc0e
843d3e224fd874b9c463b74cb5ef13d8a0b5766a
refs/heads/master
2021-03-22T04:00:55.964015
2017-10-28T03:04:06
2017-10-28T03:04:06
94,943,438
7
0
null
2017-10-28T03:04:07
2017-06-20T23:27:22
Racket
UTF-8
Racket
false
false
3,703
rkt
pool.rkt
#lang racket/base (require racket/contract) (provide (contract-out [make-pool (-> (-> any/c) (-> any/c void?) (or/c exact-nonnegative-integer? +inf.0) (or/c exact-nonnegative-integer? +inf.0) pool?)] [pool? predicate/c] [pool-lease (-> pool? lease?)] [pool-return (-> pool? lease? void?)] [pool-clear (-> pool? void?)] [lease? predicate/c] [lease-value (-> lease? any/c)])) (require disposable/private/atomic-box racket/function racket/list racket/match racket/promise) (module+ test (require rackunit)) (define (for-each/async f vs) (define (f/async v) (delay/thread (f v))) (for-each force (map f/async vs))) ;; Immutable representation of a pool and leases (struct lease (value)) ;; used for eq?-ness of opaque structs (struct stored (leases idle max max-idle) #:transparent) (define (make-stored max max-idle) (stored '() '() max max-idle)) (define (stored-num-leases s) (length (stored-leases s))) (define (stored-num-idle s) (length (stored-idle s))) (define (stored-num-values s) (+ (stored-num-leases s) (stored-num-idle s))) (define (stored-full? s) (>= (stored-num-values s) (stored-max s))) (define (stored-idle-full? s) (>= (stored-num-idle s) (stored-max-idle s))) (define (stored-idle-available? s) (> (stored-num-idle s) 0)) (define (stored-update s #:leases [leases-f values] #:idle [idle-f values]) (struct-copy stored s [leases (leases-f (stored-leases s))] [idle (idle-f (stored-idle s))])) (define (stored-add-new s v) (define l (lease v)) (list (stored-update s #:leases (λ (ls) (cons l ls))) l)) (define (stored-add-idle s v) (stored-update s #:idle (λ (vs) (cons v vs)))) (define (stored-use-idle s) (stored-add-new (stored-update s #:idle rest) (first (stored-idle s)))) (define (stored-remove-lease s l) (stored-update s #:leases (λ (ls) (remove l ls)))) ;; (Stored a) (-> a) -> (Maybe (Stored a, Lease a)) (define/contract (stored-get s produce) (-> stored? (-> any/c) (or/c #f (list/c stored? lease?))) (cond [(stored-idle-available? s) (stored-use-idle s)] [(stored-full? s) #f] [else (stored-add-new s (produce))])) ;; (Stored a) (Lease a) -> (Either (Stored a) (Stored a, a)) (define/contract (stored-return s l) (-> stored? lease? (or/c stored? (list/c stored? any/c))) (define new-s (stored-remove-lease s l)) (define v (lease-value l)) (if (stored-idle-full? s) (list new-s v) (stored-add-idle new-s v))) ;; (Stored a) -> [a] (define (stored-list s) (append (map lease-value (stored-leases s)) (stored-idle s))) ;; Pools (struct pool (stored sema produce release)) (define (make-pool create delete max max-unused) (define sema (and (not (equal? max +inf.0)) (make-semaphore max))) (pool (atomic-box (make-stored max max-unused)) sema create delete)) (define (pool-clear p) (define (clear s) (for-each/async (pool-release p) (stored-list s))) (atomic-box-close! (pool-stored p) #:on-close clear)) (define (pool-return p l) (define (update s) (define new-s (match (stored-return s l) [(list (? stored? new-s) v) ((pool-release p) v) new-s] [(? stored? new-s) new-s])) (when (pool-sema p) (semaphore-post (pool-sema p))) new-s) (atomic-box-update! (pool-stored p) update #:handle-closed void)) (define (pool-lease p) (define (apply s) (match (stored-get s (pool-produce p)) [#f (values s #f)] [(list (? stored? new-s) (? lease? l)) (values new-s l)])) (or (call/atomic-box (pool-stored p) apply) (let () (sync (pool-sema p)) (pool-lease p))))
false
20251ee2189eff8d16788b482647c407af813502
a77682238ecefd0b19e197c2815c71b858ffe9af
/x509-lib/private/stringprep.rkt
b3da0db07cef3960da13b3c5790034138aa80270
[]
no_license
rmculpepper/crypto
45f514c64244073303359ffa153e2c651869ed68
129997ab537db2eea142b5eb25cf2fc74a19d4ec
refs/heads/master
2022-07-10T16:10:15.795190
2022-06-21T11:10:11
2022-06-21T11:11:08
6,266,902
16
13
null
2022-06-11T12:58:56
2012-10-17T19:05:25
Racket
UTF-8
Racket
false
false
13,737
rkt
stringprep.rkt
;; Copyright 2020 Ryan Culpepper ;; SPDX-License-Identifier: Apache-2.0 #lang racket/base (require racket/string) (provide ldap-stringprep ldap-string=? ldap-string-ci=?) ;; ============================================================ (module intset racket/base (require (for-syntax racket/base syntax/parse racket/match)) (provide intset char-predicate int-in-set? char-in-set?) (define-syntax (intset stx) (define-syntax-class range (pattern [lo:nat hi:nat]) (pattern lo:nat #:with hi #'lo)) (syntax-parse stx [(_ r:range ...) (define ranges0 (syntax->datum #'((r.lo r.hi) ...))) (define (compress ranges) (match ranges [(list* (list lo1 hi1) (list lo2 hi2) more) (cond [(>= (add1 hi1) lo2) (compress (list* (list lo1 (max hi1 hi2)) more))] [else (cons (car ranges) (compress (cdr ranges)))])] [else ranges])) #`(quote #,(list->vector (apply append (compress (sort ranges0 < #:key car)))))])) (define ((char-predicate . sets) c) (for/or ([s (in-list sets)]) (char-in-set? c s))) (define (char-in-set? c is) (int-in-set? (char->integer c) is)) ;; An IntSet is (Vector {lo hi} ...) ;; Intepretation: (lambda (x) (or (<= lo x hi) ...)) (define (int-in-set? seek is) ;; (eprintf "seeking ~s\n" seek) (define (value k) (vector-ref is k)) (define (loop lo hi) ;; (eprintf " loop ~s, ~s\n" lo hi) (and (< lo hi) (loop* lo hi))) (define (loop* lo hi) ;; INV: (<= (value lo) seek (value hi)) ;; INV: (even? lo) and (odd? hi) (define midlo (* 2 (quotient (+ lo hi 1) 4))) (define midhi (add1 midlo)) (cond [(< seek (value midlo)) (loop lo (sub1 midlo))] [(< (value midhi) seek) (loop (add1 midhi) hi)] ;; (value midlo) <= seek <= (value midhi) [else #t])) (let ([last (sub1 (vector-length is))]) (cond [(<= (value 0) seek (value last)) (loop 0 last)] [else #f])))) (require (submod "." intset)) ;; ============================================================ ;; References: ;; - https://tools.ietf.org/html/rfc3454 (stringprep framework) ;; - https://tools.ietf.org/html/rfc4518 (LDAP profile) ;; ldap-stringprep : String #:on-error (U #f (String -> X)) -> (U String X) (define (ldap-stringprep orig #:on-error [handle #f] #:who [who 'ldap-stringprep]) (let* ([s (do-mapping orig)] [s (string-normalize-nfkc s)] [s (and (do-prohibit who s orig (not handle)) s)]) (cond [s (do-insignificant-character-handling s)] [else (handle orig)]))) (define (ldap-string-cmp who s1 s2 string-cmp) (define (convert s) (ldap-stringprep s #:on-error (lambda (x) #f) #:who who)) (let ([s1 (convert s1)] [s2 (convert s2)]) (and s1 s2 (string-cmp s1 s2)))) (define (ldap-string=? s1 s2) (ldap-string-cmp 'ldap-string=? s1 s2 string=?)) (define (ldap-string-ci=? s1 s2) (ldap-string-cmp 'ldap-string-ci=? s1 s2 string-ci=?)) ;; 2.2 Map (define (do-mapping s) (define out (open-output-string)) (for ([c (in-string s)]) (cond [(map-to-space? c) (write-char #\space out)] [(map-to-nothing? c) (void)] [else (write-char c out)])) (get-output-string out)) (define mapped-to-nothing (intset ;; para 1 #x00AD #x1806 #x034F [#x180B #x180D] [#xFE00 #xFE0F] #xFFFC ;; para 3 [#x0000 #x0008] [#x000E #x001F] [#x007F #x0084] [#x0086 #x009F] #x06DD #x070F #x180E [#x200C #x200F] [#x202A #x202E] [#x2060 #x2063] [#x206A #x206F] #xFEFF [#xFFF9 #xFFFB] [#x1D173 #x1D17A] #xE0001 [#xE0020 #xE007F] ;; para 4 #x200B)) (define mapped-to-space (intset ;; para 2 #x0009 #x000A #x000B #x000C #x000D #x0085 ;; para 4 #x00A0 #x1680 [#x2000 #x200A] [#x2028 #x2029] #x202F #x205F #x3000)) (define map-to-nothing? (char-predicate mapped-to-nothing)) (define map-to-space? (char-predicate mapped-to-space)) ;; 2.3 Normalize (KC) ;; 2.4 Prohibit ;; returns #t if okay, #f (or error) if contains prohibited char (define (do-prohibit who s orig error?) (define (bad c msg) (if error? (error who "~a\n string: ~e\n char: ~e" msg orig c) #f)) (for/and ([c (in-string s)]) (cond [(prohibited-char? c) (bad c "prohibited character in string")] [(unassigned-char? c) (bad c "unassigned character in string")] [else #t]))) ;; A.1 Unassigned code points in Unicode 3.2 (define unassigned-in-unicode-3.2 (intset #x0221 [#x0234 #x024F] [#x02AE #x02AF] [#x02EF #x02FF] [#x0350 #x035F] [#x0370 #x0373] [#x0376 #x0379] [#x037B #x037D] [#x037F #x0383] #x038B #x038D #x03A2 #x03CF [#x03F7 #x03FF] #x0487 #x04CF [#x04F6 #x04F7] [#x04FA #x04FF] [#x0510 #x0530] [#x0557 #x0558] #x0560 #x0588 [#x058B #x0590] #x05A2 #x05BA [#x05C5 #x05CF] [#x05EB #x05EF] [#x05F5 #x060B] [#x060D #x061A] [#x061C #x061E] #x0620 [#x063B #x063F] [#x0656 #x065F] [#x06EE #x06EF] #x06FF #x070E [#x072D #x072F] [#x074B #x077F] [#x07B2 #x0900] #x0904 [#x093A #x093B] [#x094E #x094F] [#x0955 #x0957] [#x0971 #x0980] #x0984 [#x098D #x098E] [#x0991 #x0992] #x09A9 #x09B1 [#x09B3 #x09B5] [#x09BA #x09BB] #x09BD [#x09C5 #x09C6] [#x09C9 #x09CA] [#x09CE #x09D6] [#x09D8 #x09DB] #x09DE [#x09E4 #x09E5] [#x09FB #x0A01] [#x0A03 #x0A04] [#x0A0B #x0A0E] [#x0A11 #x0A12] #x0A29 #x0A31 #x0A34 #x0A37 [#x0A3A #x0A3B] #x0A3D [#x0A43 #x0A46] [#x0A49 #x0A4A] [#x0A4E #x0A58] #x0A5D [#x0A5F #x0A65] [#x0A75 #x0A80] #x0A84 #x0A8C #x0A8E #x0A92 #x0AA9 #x0AB1 #x0AB4 [#x0ABA #x0ABB] #x0AC6 #x0ACA [#x0ACE #x0ACF] [#x0AD1 #x0ADF] [#x0AE1 #x0AE5] [#x0AF0 #x0B00] #x0B04 [#x0B0D #x0B0E] [#x0B11 #x0B12] #x0B29 #x0B31 [#x0B34 #x0B35] [#x0B3A #x0B3B] [#x0B44 #x0B46] [#x0B49 #x0B4A] [#x0B4E #x0B55] [#x0B58 #x0B5B] #x0B5E [#x0B62 #x0B65] [#x0B71 #x0B81] #x0B84 [#x0B8B #x0B8D] #x0B91 [#x0B96 #x0B98] #x0B9B #x0B9D [#x0BA0 #x0BA2] [#x0BA5 #x0BA7] [#x0BAB #x0BAD] #x0BB6 [#x0BBA #x0BBD] [#x0BC3 #x0BC5] #x0BC9 [#x0BCE #x0BD6] [#x0BD8 #x0BE6] [#x0BF3 #x0C00] #x0C04 #x0C0D #x0C11 #x0C29 #x0C34 [#x0C3A #x0C3D] #x0C45 #x0C49 [#x0C4E #x0C54] [#x0C57 #x0C5F] [#x0C62 #x0C65] [#x0C70 #x0C81] #x0C84 #x0C8D #x0C91 #x0CA9 #x0CB4 [#x0CBA #x0CBD] #x0CC5 #x0CC9 [#x0CCE #x0CD4] #x0CD7 #x0CDD #x0CDF [#x0CE2 #x0CE5] [#x0CF0 #x0D01] #x0D04 #x0D0D #x0D11 #x0D29 [#x0D3A #x0D3D] [#x0D44 #x0D45] #x0D49 [#x0D4E #x0D56] [#x0D58 #x0D5F] [#x0D62 #x0D65] [#x0D70 #x0D81] #x0D84 [#x0D97 #x0D99] #x0DB2 #x0DBC [#x0DBE #x0DBF] [#x0DC7 #x0DC9] [#x0DCB #x0DCE] #x0DD5 #x0DD7 [#x0DE0 #x0DF1] [#x0DF5 #x0E00] [#x0E3B #x0E3E] [#x0E5C #x0E80] #x0E83 [#x0E85 #x0E86] #x0E89 [#x0E8B #x0E8C] [#x0E8E #x0E93] #x0E98 #x0EA0 #x0EA4 #x0EA6 [#x0EA8 #x0EA9] #x0EAC #x0EBA [#x0EBE #x0EBF] #x0EC5 #x0EC7 [#x0ECE #x0ECF] [#x0EDA #x0EDB] [#x0EDE #x0EFF] #x0F48 [#x0F6B #x0F70] [#x0F8C #x0F8F] #x0F98 #x0FBD [#x0FCD #x0FCE] [#x0FD0 #x0FFF] #x1022 #x1028 #x102B [#x1033 #x1035] [#x103A #x103F] [#x105A #x109F] [#x10C6 #x10CF] [#x10F9 #x10FA] [#x10FC #x10FF] [#x115A #x115E] [#x11A3 #x11A7] [#x11FA #x11FF] #x1207 #x1247 #x1249 [#x124E #x124F] #x1257 #x1259 [#x125E #x125F] #x1287 #x1289 [#x128E #x128F] #x12AF #x12B1 [#x12B6 #x12B7] #x12BF #x12C1 [#x12C6 #x12C7] #x12CF #x12D7 #x12EF #x130F #x1311 [#x1316 #x1317] #x131F #x1347 [#x135B #x1360] [#x137D #x139F] [#x13F5 #x1400] [#x1677 #x167F] [#x169D #x169F] [#x16F1 #x16FF] #x170D [#x1715 #x171F] [#x1737 #x173F] [#x1754 #x175F] #x176D #x1771 [#x1774 #x177F] [#x17DD #x17DF] [#x17EA #x17FF] #x180F [#x181A #x181F] [#x1878 #x187F] [#x18AA #x1DFF] [#x1E9C #x1E9F] [#x1EFA #x1EFF] [#x1F16 #x1F17] [#x1F1E #x1F1F] [#x1F46 #x1F47] [#x1F4E #x1F4F] #x1F58 #x1F5A #x1F5C #x1F5E [#x1F7E #x1F7F] #x1FB5 #x1FC5 [#x1FD4 #x1FD5] #x1FDC [#x1FF0 #x1FF1] #x1FF5 #x1FFF [#x2053 #x2056] [#x2058 #x205E] [#x2064 #x2069] [#x2072 #x2073] [#x208F #x209F] [#x20B2 #x20CF] [#x20EB #x20FF] [#x213B #x213C] [#x214C #x2152] [#x2184 #x218F] [#x23CF #x23FF] [#x2427 #x243F] [#x244B #x245F] #x24FF [#x2614 #x2615] #x2618 [#x267E #x267F] [#x268A #x2700] #x2705 [#x270A #x270B] #x2728 #x274C #x274E [#x2753 #x2755] #x2757 [#x275F #x2760] [#x2795 #x2797] #x27B0 [#x27BF #x27CF] [#x27EC #x27EF] [#x2B00 #x2E7F] #x2E9A [#x2EF4 #x2EFF] [#x2FD6 #x2FEF] [#x2FFC #x2FFF] #x3040 [#x3097 #x3098] [#x3100 #x3104] [#x312D #x3130] #x318F [#x31B8 #x31EF] [#x321D #x321F] [#x3244 #x3250] [#x327C #x327E] [#x32CC #x32CF] #x32FF [#x3377 #x337A] [#x33DE #x33DF] #x33FF [#x4DB6 #x4DFF] [#x9FA6 #x9FFF] [#xA48D #xA48F] [#xA4C7 #xABFF] [#xD7A4 #xD7FF] [#xFA2E #xFA2F] [#xFA6B #xFAFF] [#xFB07 #xFB12] [#xFB18 #xFB1C] #xFB37 #xFB3D #xFB3F #xFB42 #xFB45 [#xFBB2 #xFBD2] [#xFD40 #xFD4F] [#xFD90 #xFD91] [#xFDC8 #xFDCF] [#xFDFD #xFDFF] [#xFE10 #xFE1F] [#xFE24 #xFE2F] [#xFE47 #xFE48] #xFE53 #xFE67 [#xFE6C #xFE6F] #xFE75 [#xFEFD #xFEFE] #xFF00 [#xFFBF #xFFC1] [#xFFC8 #xFFC9] [#xFFD0 #xFFD1] [#xFFD8 #xFFD9] [#xFFDD #xFFDF] #xFFE7 [#xFFEF #xFFF8] [#x10000 #x102FF] #x1031F [#x10324 #x1032F] [#x1034B #x103FF] [#x10426 #x10427] [#x1044E #x1CFFF] [#x1D0F6 #x1D0FF] [#x1D127 #x1D129] [#x1D1DE #x1D3FF] #x1D455 #x1D49D [#x1D4A0 #x1D4A1] [#x1D4A3 #x1D4A4] [#x1D4A7 #x1D4A8] #x1D4AD #x1D4BA #x1D4BC #x1D4C1 #x1D4C4 #x1D506 [#x1D50B #x1D50C] #x1D515 #x1D51D #x1D53A #x1D53F #x1D545 [#x1D547 #x1D549] #x1D551 [#x1D6A4 #x1D6A7] [#x1D7CA #x1D7CD] [#x1D800 #x1FFFD] [#x2A6D7 #x2F7FF] [#x2FA1E #x2FFFD] [#x30000 #x3FFFD] [#x40000 #x4FFFD] [#x50000 #x5FFFD] [#x60000 #x6FFFD] [#x70000 #x7FFFD] [#x80000 #x8FFFD] [#x90000 #x9FFFD] [#xA0000 #xAFFFD] [#xB0000 #xBFFFD] [#xC0000 #xCFFFD] [#xD0000 #xDFFFD] #xE0000 [#xE0002 #xE001F] [#xE0080 #xEFFFD] )) (define unassigned-char? (char-predicate unassigned-in-unicode-3.2)) ;; C.3 Private use (define private-use (intset [#xE000 #xF8FF]; [PRIVATE USE, PLANE 0] [#xF0000 #xFFFFD]; [PRIVATE USE, PLANE 15] [#x100000 #x10FFFD]; [PRIVATE USE, PLANE 16] )) ;; C.4 Non-character code points (define non-character-code-points (intset [#xFDD0 #xFDEF]; [NONCHARACTER CODE POINTS] [#xFFFE #xFFFF]; [NONCHARACTER CODE POINTS] [#x1FFFE #x1FFFF]; [NONCHARACTER CODE POINTS] [#x2FFFE #x2FFFF]; [NONCHARACTER CODE POINTS] [#x3FFFE #x3FFFF]; [NONCHARACTER CODE POINTS] [#x4FFFE #x4FFFF]; [NONCHARACTER CODE POINTS] [#x5FFFE #x5FFFF]; [NONCHARACTER CODE POINTS] [#x6FFFE #x6FFFF]; [NONCHARACTER CODE POINTS] [#x7FFFE #x7FFFF]; [NONCHARACTER CODE POINTS] [#x8FFFE #x8FFFF]; [NONCHARACTER CODE POINTS] [#x9FFFE #x9FFFF]; [NONCHARACTER CODE POINTS] [#xAFFFE #xAFFFF]; [NONCHARACTER CODE POINTS] [#xBFFFE #xBFFFF]; [NONCHARACTER CODE POINTS] [#xCFFFE #xCFFFF]; [NONCHARACTER CODE POINTS] [#xDFFFE #xDFFFF]; [NONCHARACTER CODE POINTS] [#xEFFFE #xEFFFF]; [NONCHARACTER CODE POINTS] [#xFFFFE #xFFFFF]; [NONCHARACTER CODE POINTS] [#x10FFFE #x10FFFF]; [NONCHARACTER CODE POINTS] )) ;; C.5 Surrogate codes (define surrogate-codes (intset [#xD800 #xDFFF]; [SURROGATE CODES] )) ;; C.8 Change display properties or are deprecated (define change-display-properties-or-deprecated (intset #x0340; COMBINING GRAVE TONE MARK #x0341; COMBINING ACUTE TONE MARK #x200E; LEFT-TO-RIGHT MARK #x200F; RIGHT-TO-LEFT MARK #x202A; LEFT-TO-RIGHT EMBEDDING #x202B; RIGHT-TO-LEFT EMBEDDING #x202C; POP DIRECTIONAL FORMATTING #x202D; LEFT-TO-RIGHT OVERRIDE #x202E; RIGHT-TO-LEFT OVERRIDE #x206A; INHIBIT SYMMETRIC SWAPPING #x206B; ACTIVATE SYMMETRIC SWAPPING #x206C; INHIBIT ARABIC FORM SHAPING #x206D; ACTIVATE ARABIC FORM SHAPING #x206E; NATIONAL DIGIT SHAPES #x206F; NOMINAL DIGIT SHAPES )) (define (prohibited-char? c) (or (char-in-set? c private-use) (char-in-set? c non-character-code-points) (char-in-set? c surrogate-codes) (char-in-set? c change-display-properties-or-deprecated) (char=? c #\uFFFD))) ;; 2.5 Check Bidi -- nothing to do ;; 2.6 Insignificant Character Handling ;; Per Appendix B, since we don't care about LDAP "substrings ;; matching", can simplify to trim/collapse space. ;; From 2.6: ;; For the purposes of this section, a space is defined to be the ;; SPACE (U+0020) code point followed by no combining marks. (define (do-insignificant-character-handling s) ;; M = Mn + Mc + Me (cond [(regexp-match? #rx"^[ ]+$" s) " "] [else (let* ([rx #px"[ ]+(?!\\p{M})"] [s (string-trim s rx)]) (regexp-replace* rx s " "))]))
true
4712b25cb7c9a597bde986ac44a56131ca9c30fe
616e16afef240bf95ed7c8670035542d59cdba50
/redex-benchmark/info.rkt
34d90d7320a57844c4dfb53a6d37a9e113015eca
[ "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
racket/redex
bd535d6075168ef7be834e7c1b9babe606d5cd34
8df08b313cff72d56d3c67366065c19ec0c3f7d0
refs/heads/master
2023-08-19T03:34:44.392140
2023-07-13T01:50:18
2023-07-13T01:50:18
27,412,456
102
43
NOASSERTION
2023-04-07T19:07:30
2014-12-02T03:06:03
Racket
UTF-8
Racket
false
false
383
rkt
info.rkt
#lang info (define collection 'multi) (define deps '("base" "compiler-lib" "rackunit-lib" "redex-lib" "redex-examples" "math-lib" "plot-lib")) (define build-deps '()) (define pkg-desc "PLT Redex Benchmark") (define pkg-authors '(robby bfetscher)) (define license '(Apache-2.0 OR MIT))
false
e46d2fcb680a08290a4d47622720811a4c2b92d8
b0c07ea2a04ceaa1e988d4a0a61323cda5c43e31
/www/schedule.scrbl
c87e035001299e007b108a1709ff26e03d633622
[ "AFL-3.0" ]
permissive
cmsc430/www
effa48f2e69fb1fd78910227778a1eb0078e0161
82864f846a7f8f6645821e237de42fac94dff157
refs/heads/main
2023-09-03T17:40:58.733672
2023-08-28T15:26:33
2023-08-28T15:26:33
183,064,322
39
30
null
2023-08-28T15:49:59
2019-04-23T17:30:12
Racket
UTF-8
Racket
false
false
1,973
scrbl
schedule.scrbl
#lang scribble/manual @(require scribble/core racket/list) @(require "defns.rkt") @title[#:style 'unnumbered]{Schedule} @;(TuTh 9:30-10:45, IRB 0318) @(define (wk d) (nonbreaking (bold d))) @; for unreleased assignments, switch to seclink when ready to release @(define (tbaseclink lnk txt) txt) @(define (day s) @elem[s]) @tabular[#:style 'boxed #:sep @hspace[1] #:row-properties '(bottom-border) (list (list @bold{Date} @bold{Topic} @bold{Due}) (list @day{5/30} @secref["Intro"] "") (list @day{5/31} @secref["OCaml to Racket"] "") (list @day{6/1} @secref["a86"] "") (list @day{6/2} @secref["Abscond"] @seclink["Assignment 1"]{A1}) (list @day{6/5} @itemlist[@item{@secref["Blackmail"]} @item{@secref["Con"]}] @seclink["Assignment 2"]{A2}) (list @day{6/6} @itemlist[@item{@secref["Dupe"]} @item{@secref{Dodger}}] "") (list @day{6/7} @secref["Evildoer"] "") (list @day{6/8} @secref["Extort"] "") (list @day{6/9} @secref["Fraud"] "") (list @day{6/12} @secref["Hustle"] @seclink["Assignment 3"]{A3}) (list @day{6/13} @secref["Hoax"] "") (list @day{6/14} "Midterm 1" @secref["Midterm_1"]) (list @day{6/15} @secref["Iniquity"] "") (list @day{6/16} @elem{@secref["Iniquity"], cont.} "") (list @day{6/19} @elem{Juneteenth Holiday} "") (list @day{6/20} @secref["Jig"] @seclink["Assignment 4"]{A4}) (list @day{6/21} @secref["Knock"] "") (list @day{6/22} @elem{@secref["Knock"], cont.} "") (list @day{6/23} @secref["Loot"] "") (list @day{6/26} @elem{@secref["Loot"], cont.} "") (list @day{6/27} @elem{GC} @seclink["Assignment 5"]{A5}) (list @day{6/28} @secref["Mug"] "") (list @day{6/29} "Midterm 2" @secref["Midterm_2"]) (list @day{6/30} @secref["Mountebank"] "") (list @day{7/3} @secref["Neerdowell"] @seclink["Assignment 6"]{A6}) (list @day{7/4} "Independence Day Holiday" "") (list @day{7/5} @secref["Outlaw"] "") (list @day{7/6} @elem{@secref["Outlaw"], cont.} "") (list @day{7/7} "Slack" @secref{Project}) ) ] @bold{Final project assessment: @|final-date|.}
false
845846950400aabff6f9cc462d04106bfd038a10
975d6de10c9ec7f897b57ebfb90e26b9cdcea365
/private/tape.rkt
c84bc1e70d2cd21f625f5ecb8d1f545da61119b8
[]
no_license
sabjohnso/jason-extras
4c5247a27992ae932059c21647a275d54efb3639
dc6df2935a6a6bbbedb129de475b3d52de3ac070
refs/heads/master
2022-07-12T23:11:08.713960
2020-05-12T01:50:47
2020-05-12T01:50:47
263,204,411
0
0
null
null
null
null
UTF-8
Racket
false
false
1,340
rkt
tape.rkt
#lang racket/base (require "optional.rkt") (define (head xs) (if (null? xs) (none) (some (car xs)))) (define (tail xs) (if (null? xs) xs (cdr xs))) (define (push xs x) (match x [(some x) (cons x xs)] [(none) xs])) (struct tape (data context) #:transparent) (define empty-tape (tape '() '())) (define (tape-empty? xs) (equal? tape empty-tape)) (define (tape-position xs) (length (tape-context xs))) (define (tape-remaining xs) (length (tape-data xs))) (define (tape-length xs) (+ (tape-remaining xs) (tape-position xs))) (define (tape-front? xs) (null? (tape-context xs))) (define (tape-back? xs) (null? (tape-data xs))) (define (tape-read xs) (head (tape-data xs))) (define (tape-insert xs x) (tape (cons x (tape-data xs)) (tape-context xs))) (define (tape-remove xs) (tape (tail (tape-data xs)) (tape-context xs))) (define (tape-write xs x) (tape-insert (tape-remove xs) x)) (define (tape-fwd xs) (match-let ([(tape data context) xs]) (tape (tail data) (push context (head xs))))) (define (tape-bwd xs) (match-let ([(tape data context) xs]) (tap (push data (head context)) (tail context)))) (define (tape-move-by xs n) (cond [(zero? n) xs] [(< n 0) (move-by (tape-bwd xs) (add1 n))] [(> n 0) (move-by (tape-fwd xs) (sub1 n))]))
false
59a2821551c4c1ced38317d322d8c86a4dc88a0a
2bb711eecf3d1844eb209c39e71dea21c9c13f5c
/test/unbound/mochi/nth.rkt
a67d575912beb3b48ccbb0d948eef88b2f93c547
[ "BSD-2-Clause" ]
permissive
dvvrd/rosette
861b0c4d1430a02ffe26c6db63fd45c3be4f04ba
82468bf97d65bde9795d82599e89b516819a648a
refs/heads/master
2021-01-11T12:26:01.125551
2017-01-25T22:24:27
2017-01-25T22:24:37
76,679,540
2
0
null
2016-12-16T19:23:08
2016-12-16T19:23:07
null
UTF-8
Racket
false
false
612
rkt
nth.rkt
#lang rosette/unbound (dbg-level 0) (define-symbolic n integer?) (define/unbound (nth n xs) (~> integer? (listof integer?) integer?) (cond [(null? xs) (assert #f)] [else (if (zero? n) (car xs) (nth (sub1 n) (cdr xs)))])) (define/unbound (make-list n) (~> integer? (listof integer?)) (if (< n 0) null (cons n (make-list (sub1 n))))) (define/unbound (trivial-query x) (~> integer? boolean?) (= (* 2 x) (+ x x))) ; Expecting unsat (time (verify/unbound (assert (trivial-query (if (> n 0) (nth (- n 1) (make-list n)) 0)))))
false
707d393bc040639cbc9794c7f4c2a8f24998feb7
0bd832b9b372ee7d4877e99b68536c15a7f7c9c9
/invert-binary-tree.rkt
aa94cfe5f96d655c7e74afbd579c132a774cb913
[]
no_license
jwilliamson1/schemer
eff9c10bcbcdea9110a44c80769a0334119b3da4
c2f9743392652664f1ff5687819f040e724c8436
refs/heads/master
2022-01-06T14:52:10.638822
2021-12-31T21:32:22
2021-12-31T21:32:22
75,143,723
0
0
null
2020-11-11T13:11:47
2016-11-30T02:37:55
Racket
UTF-8
Racket
false
false
665
rkt
invert-binary-tree.rkt
#lang sicp (define (make-tree entry left right) (cons entry (cons left right))) (define (left-branch tree) (cadr tree)) (define (right-branch tree) (cddr tree)) (define (entry-tree tree) (car tree)) (define lefts-left (make-tree 'c '() '())) (define rights-left (make-tree 'q '() '())) (define l1 (make-tree 'f lefts-left '())) (define r1 (make-tree 'z rights-left '())) (define t1 (make-tree 'm l1 r1)) (left-branch t1) (right-branch t1) t1 (define (invert-tree tree) (cond ((null? tree) '()) ((cons (entry-tree tree) (cons (invert-tree (right-branch tree)) (invert-tree (left-branch tree))))))) (invert-tree t1)
false
3c39dafd71f046278a840b059b6c9bd9ff6b6f5f
7fc3457730230d186578d30bec2c40efd3211dc1
/main.rkt
e32453f70d4c938d1b03e6df94470c87e430fb33
[]
no_license
jeapostrophe/non-det
0eed64f23baa8ea3c063c48e0168416e94d1ddda
4b6d4aec79680b362efcc32a0589e85e97d868c9
refs/heads/master
2022-12-18T04:16:21.476218
2022-12-02T20:55:21
2022-12-02T20:55:21
110,774,340
0
0
null
null
null
null
UTF-8
Racket
false
false
5,797
rkt
main.rkt
#lang racket/base (require (for-syntax racket/base syntax/parse) racket/match racket/list racket/stream racket/contract/base racket/generic) (struct nd ()) (struct *fail nd ()) (define fail (*fail)) (struct bind nd (x mx)) (struct *choice nd (x y)) (struct ans nd (a)) (struct seq nd (s)) (struct once nd (x)) (struct occurs nd (t x)) (define-generics non-det (non-det-prob non-det) #:fast-defaults ([nd? (define (non-det-prob n) n)])) (struct kont:return ()) (struct kont:bind (mx k)) (struct kont:choice (y k)) (struct kont:once (t k)) (struct kont:occurs (t k)) (define (once-in-kont? T k) (match k [(kont:return) #f] [(kont:bind _ k) (once-in-kont? T k)] [(kont:occurs _ k) (once-in-kont? T k)] [(kont:choice y k) (once-in-kont? T k)] [(kont:once (== T) k) #t] [(kont:once _ k) (once-in-kont? T k)])) (define (occurs-in-kont? T k) (match k [(kont:return) #f] [(kont:bind _ k) (occurs-in-kont? T k)] [(kont:once _ k) (occurs-in-kont? T k)] [(kont:choice _ k) (occurs-in-kont? T k)] [(kont:occurs (== T) k) #t] [(kont:occurs _ k) (occurs-in-kont? T k)])) (struct st (p kont)) (define-generics ndq (qempty? ndq) (qhead ndq) (enq ndq . v) (qfilter ndq ?)) (define sols (match-lambda [(? qempty?) empty-stream] [(app qhead (cons (st p k) q)) (match p ;; Do one step of work... [(bind x mx) (sols (enq q (st x (kont:bind mx k))))] [(*choice x y) (sols (enq q (st x (kont:choice y k))))] [(once x) (sols (enq q (st x (kont:once (gensym 'once) k))))] [(occurs t x) (cond ;; If the occurs is already in the continuation, then fail [(occurs-in-kont? t k) (sols (enq q (st fail k)))] ;; Otherwise, record this is in the kont [else (sols (enq q (st x (kont:occurs t k))))])] [(seq s) (cond [(stream-empty? s) (sols (enq q (st fail k)))] [else (sols (enq q (st (*choice (ans (stream-first s)) (seq (stream-rest s))) k)))])] [(*fail) (match k ;; Ignore and choose the other [(kont:choice y k) (sols (enq q (st y k)))] ;; Pass through bind, once, and occurs [(or (kont:bind _ k) (kont:once _ k) (kont:occurs _ k)) (sols (enq q (st p k)))] ;; Throw away the st [(kont:return) (sols q)])] [(ans a) (match k ;; Skip over occurs [(kont:occurs _ k) (sols (enq q (st p k)))] ;; Once should go kill off this tag in other places in the queue [(kont:once t k) (define qp (qfilter q (match-lambda [(st _ k) (not (once-in-kont? t k))]))) (sols (enq qp (st p k)))] ;; Fork the st and duplicate the continuation [(kont:choice y k) (sols (enq q (st p k) (st y k)))] ;; Call the function on a bind [(kont:bind mx k) (sols (enq q (st (mx a) k)))] ;; We found a solution! [(kont:return) (stream-cons a (sols q))])] [(and (? non-det?) (not (? nd?))) (sols (enq q (st (non-det-prob p) k)))])])) (struct bfs-ndq (in out) #:methods gen:ndq [(define (qempty? q) (match-define (bfs-ndq in out) q) (and (empty? in) (empty? out))) (define (qhead q) (match-define (bfs-ndq in out) q) (match in [(cons v in) (cons v (bfs-ndq in out))] ['() (if (empty? out) (error 'qhead "Non-det Queue is empty") (qhead (bfs-ndq (reverse out) empty)))])) (define (enq q . v) (match-define (bfs-ndq in out) q) (bfs-ndq in (append v out))) (define (qfilter q ?) (match-define (bfs-ndq in out) q) (bfs-ndq (filter ? in) (filter ? out)))]) (define bfs (bfs-ndq empty empty)) (struct dfs-ndq (in) #:methods gen:ndq [(define (qempty? q) (empty? (dfs-ndq-in q))) (define (qhead q) (match-define (dfs-ndq in) q) (match in [(cons v in) (cons v (dfs-ndq in))] ['() (error 'qhead "Non-det Queue is empty")])) (define (enq q . v) (dfs-ndq (append v (dfs-ndq-in q)))) (define (qfilter q ?) (dfs-ndq (filter ? (dfs-ndq-in q))))]) (define dfs (dfs-ndq empty)) (define (mode->ndq m) (match m ['bfs bfs] ['dfs dfs])) (define (stream-take k s) (for/list ([i (in-range k)] [sol (in-stream s)]) sol)) (define (nrun p #:k [k +inf.0] #:mode [m 'bfs]) (stream-take k (sols (enq (mode->ndq m) (st p (kont:return)))))) (define-syntax (ndo stx) (syntax-parse stx [(_) (syntax/loc stx fail)] [(_ p) #:declare p (expr/c #'non-det? #:name "non-det problem") #'p.c] [(_ [pat:expr p] . more) #:declare p (expr/c #'non-det? #:name "non-det problem") (syntax/loc stx (bind p.c (match-lambda [pat (ndo . more)])))])) (define (choice . l) (for/fold ([p fail]) ([sp (in-list l)]) (*choice p sp))) (define (ans* v) (match v [(? list?) (ans* (in-list v))] [(? sequence?) (seq (sequence->stream v))] [(? stream?) (seq v)])) ;; XXX Implement some sort of `memo` operation that will save work ;; that appears in multiple places in the search space. ;; XXX Write tests & docs (provide ndo gen:non-det (contract-out [non-det? (-> any/c boolean?)] [non-det-prob (-> non-det? non-det?)] [fail non-det?] [choice (->* () #:rest (listof non-det?) non-det?)] [once (-> non-det? non-det?)] [occurs (-> any/c non-det? non-det?)] [ans* (-> (or/c list? sequence? stream?) non-det?)] [ans (-> any/c non-det?)] [nrun (->* (non-det?) (#:k real? #:mode (or/c 'bfs 'dfs)) list?)]))
true
7bf483ac9d7e577cf62b175a0fa017d816991e90
c844f6dbdc3673032526ed2479798f02d027674e
/Lecture_Example/Week6/simple_choice.rkt
101dc8240127826ca3eed212f6b7c79c6739c894
[]
no_license
MandyZ0/CSC324
48bb03ee76c4a90c2df61f9c6955762e346e3b6f
a686854debe7332898be3c1bbd22cc0068fabc2b
refs/heads/master
2022-05-03T00:34:41.060526
2018-12-21T18:54:36
2018-12-21T18:54:36
null
0
0
null
null
null
null
UTF-8
Racket
false
false
1,911
rkt
simple_choice.rkt
#lang racket #| Choices and backtracking, Version 1 |# ; This file illustrates the basic implementation of the ambiguous operator -<. ; Note that while each (-< ...) saves the remaining choices in next-choice, ; it does *not* save the execution context of the expression. #| Usage note In the DrRacket menu, go to Language -> Choose Language... Click on Show Details, and make sure "Enforce constant definitions" is *NOT* checked. |# ; A constant representing the state of having *no more choices*. (define DONE 'done) #| A (private) global variable storing the result of choice expressions. This should either be (void) or a *thunk* that both returns a value and mutates `next-choice`. You can think about this value as a self-mutating stream (loosely, when the "rest thunk" is called, rather than returning a lazy list, it stores it in `next-choice`). |# (define next-choice (void)) (define-syntax -< (syntax-rules () ; Given no options, reset `next-choice` and return 'done. [(-<) (begin (set-next-choice! (void)) DONE)] ; If there are one or more values, return the first one and ; store the others in a thunk. [(-< <expr1> <expr2> ...) (begin ; 1. Update `next-choice` to store a *thunk* that wraps the ; remaining expressions. None of them are evaluated. (set-next-choice! (thunk (-< <expr2> ...))) ; 2. Evaluate and return the first expression. <expr1>)])) #| Mutating helper. Uses set! to update next-choice. |# (define (set-next-choice! v) (set! next-choice v)) #| (next) Returns the next choice, or 'done if there are no more choices. |# (define (next) (if (void? next-choice) DONE (next-choice))) ; Sample usage (module+ main (-< 1 2 3) ; Evaluates to 1. (next) ; Evaluates to 2. (next) ; Evaluates to 3. (next) ; Evaluates to 'done. )
true
7db8e5434bcd7849ffddb1cca9e9d96c3f4528ef
304f4484c4cdf0086ebcb91b9735f0755c37c797
/analysis.rkt
330f017e5c0a2bdba55395c43d2973512db40c69
[ "BSD-2-Clause" ]
permissive
rmculpepper/prob-pl
22792da22636a40879ad0182aab707ef0439f53c
6c12d61ec0d2104e8e364afd9c4821fe1009e68f
refs/heads/master
2021-01-10T05:14:07.473291
2016-03-17T19:13:54
2016-03-17T19:13:54
50,863,303
0
0
null
null
null
null
UTF-8
Racket
false
false
5,616
rkt
analysis.rkt
;; Copyright (c) 2016 Ryan Culpepper ;; Released under the terms of the 2-clause BSD license. ;; See the file COPYRIGHT for details. #lang racket/base (require racket/match racket/set (for-syntax racket/base) "base.rkt") (provide (all-defined-out)) ;; Alpha-conversion (define (alpha-convert expr) ;; loop* : Expr (Listof (cons Symbol Symbol)) -> Expr (define (loop* expr rens) (define (loop expr [rens rens]) (loop* expr rens)) (match expr [(? symbol? var) (cond [(assq var rens) => cdr] [else var])] [(expr:quote v) expr] [(expr:lambda formals body) (let ([formals* (freshen formals)]) (expr:lambda formals* (loop body (append (map cons formals formals*) rens))))] [(expr:fix e) (expr:fix (loop e))] [(expr:app cs op args) (expr:app cs (loop op) (map loop args))] [(expr:if e1 e2 e3) (expr:if (loop e1) (loop e2) (loop e3))] [(expr:S-sample cs e) (expr:S-sample cs (loop e))] [(expr:N-sample cs e) (expr:N-sample cs (loop e))] [(expr:observe-sample e1 e2) (expr:observe-sample (loop e1) (loop e2))] [(expr:fail) (expr:fail)] [(expr:mem cs e) (expr:mem cs (loop e))] [(expr:let* vars rhss body) (let bindingsloop ([vars vars] [rhss rhss] [rens rens] [r-vars* null] [r-rhss* null]) (match* [vars rhss] [[(cons var vars) (cons rhs rhss)] (define var* (freshen var)) (bindingsloop vars rhss (cons (cons var var*) rens) (cons var* r-vars*) (cons (loop rhs rens) r-rhss*))] [['() '()] (expr:let* (reverse r-vars*) (reverse r-rhss*) (loop body rens))]))])) (loop* expr null)) (define fresh-counter 0) (define (freshen x) (set! fresh-counter (add1 fresh-counter)) (let loop ([x x]) (cond [(symbol? x) (string->symbol (format "~s_~s" x fresh-counter))] [(list? x) (map loop x)]))) ;; SBA ;; An SBA-Init is hashof[(cons Key Key) => #t] ;; each entry is (cons From-Key To-Key) ;; An SBA-Inc is hashof[Key => (setof Key)] ;; also From => (setof To) order. ;; An SBA is hashof[Key => (setof Key)] ;; in To => (setof From) order. ;; A Key is one of ;; - Expr ;; - (list 'dom Nat Key) ;; - (list 'rng Key) ;; - (list 'car Key) ;; - (list 'cdr Key) (define (sba-init expr) (define t (make-hash)) (define (flow! from to) (hash-set! t (cons from to) #t)) (define (loop expr) (match expr [(? symbol? var) (void)] [(expr:quote v) (flow! expr expr)] [(expr:lambda formals body) (loop body) (flow! expr expr) (for ([formal formals] [i (in-naturals)]) (flow! (list 'dom i expr) formal)) (flow! body (list 'rng expr))] [(expr:fix e) ;; ???? (loop e) (flow! expr expr) (flow! expr (list 'dom 0 e))] [(expr:app cs op args) (loop op) (for-each loop args) (for ([arg args] [i (in-naturals)]) (flow! arg (list 'dom i op))) (flow! (list 'rng op) expr)] [(expr:if e1 e2 e3) (loop e1) (loop e2) (loop e3) (flow! e2 expr) (flow! e3 expr)] [(expr:S-sample cs e) (loop e)] [(expr:N-sample cs e) (loop e)] [(expr:observe-sample e1 e2) (loop e1) (loop e2)] [(expr:fail) (void)] [(expr:mem cs e) (loop e) ;; Pretend identity (flow! e expr)] [(expr:let* vars rhss body) (for-each loop rhss) (loop body) (for ([var vars] [rhs rhss]) (flow! rhs var)) (flow! body expr)])) (loop expr) (for/fold ([h (hash)]) ([from+to (in-hash-keys t)]) (sba-add h (car from+to) (cdr from+to)))) (define (sba-add h from to) (hash-set h from (set-add (hash-ref h from (set)) to))) (define (sba-closure sba) (let ([sba* (sba-closure1 sba)]) (if (equal? sba sba*) sba* (sba-closure sba*)))) ;; (M clause ...) : SBA -> SBA (define-syntax (M stx) (syntax-case stx (≤) [(M (p1 ≤ p2) . clauses) #'(lambda (sba) (for/fold ([sba sba]) ([(k1 _) (in-hash sba)]) (match k1 [p1 ((M* (p1 ≤ p2) . clauses) sba)] [_ sba])))])) ;; (M* clause ...) : SBA -> SBA (define-syntax (M* stx) (syntax-case stx (≤ =>) [(M* (p1 ≤ p2) . clauses) #'(lambda (sba) (for*/fold ([sba sba]) ([k2 (in-set (hash-ref sba p1 (set)))]) (match k2 [p2 ((M* . clauses) sba)] [_ sba])))] [(M* => (pfrom ≤ pto)) #'(lambda (sba) (sba-add sba pfrom pto))])) (define sba-closure1 (compose (M (k1 ≤ k2) (k2 ≤ k3) => (k1 ≤ k3)) (M (k1 ≤ (list 'rng k2)) (k2 ≤ k3) => (k1 ≤ (list 'rng k3))) (M ((list 'dom i k1) ≤ k2) (k2 ≤ k3) => ((list 'dom k3) ≤ k2)) (M (k1 ≤ (list 'rng k2)) ((list 'rng k2) ≤ k3) => (k1 ≤ k3)) ;; -- redundant w/ (1) ??? (M (k1 ≤ (list 'dom i k2)) ((list 'dom i k2) ≤ k3) => (k1 ≤ k3)))) (define (sba-final sba) (for*/fold ([h (hash)]) ([(k1 k2-set) (in-hash sba)] [k2 (in-set k2-set)]) (sba-add h k2 k1))) (define (sba expr) (sba-final (sba-closure (sba-init expr)))) (define p-sba-test (parse-expr '(lambda (k) (let* ([f (lambda (x) x)]) (k (f 1) (f 2))))))
true
5c6e4d175689034209190f9bc387a3c5fe0d025b
ea4fc87eafa7b36a43f8f04b9585d73aeed1f036
/laramie-lib/parser/convert.rkt
226f0a70d2936f9775130a11b727f91377d5cd99
[ "MIT" ]
permissive
jthodge/laramie
a58a551727aebc792bdcaa5193dff775fd9848df
7afc9314ff1f363098efeb68ceb25e2e9c419e6e
refs/heads/master
2023-06-19T21:19:43.308293
2021-07-19T05:20:01
2021-07-19T05:20:01
null
0
0
null
null
null
null
UTF-8
Racket
false
false
16,938
rkt
convert.rkt
#lang typed/racket/base (provide ->html) (require racket/require racket/pretty racket/list racket/match racket/function typed/racket/unsafe (file "types.rkt") (file "dom.rkt") (prefix-in xml: (file "../private/xml.rkt")) (multi-in "../html" ("types.rkt")) (multi-in "../tokenizer" ("types.rkt" "tokens.rkt"))) (module+ test (require typed/rackunit)) (: partition-prolog-children (->* ((Listof (U comment-node doctype-node))) ((Listof comment-node) (Option doctype-node) (Listof comment-node)) (List (Listof comment-node) (Option doctype-node) (Listof comment-node)))) (define (partition-prolog-children children [before (list)] [dtd #f] [after (list)]) (cond [(null? children) (list (reverse before) dtd (reverse after))] [(doctype-node? (car children)) (partition-prolog-children (cdr children) before (cond [(doctype-node? dtd) dtd] [else (car children)]) after)] [(doctype-node? dtd) (partition-prolog-children (cdr children) before dtd (cons (car children) after))] [else (partition-prolog-children (cdr children) (cons (car children) before) #f (list))])) (: partition-document-children (->* ((Listof (U element-node doctype-node comment-node))) ((Listof (U doctype-node comment-node)) (Option element-node) (Listof (U doctype-node comment-node))) (List (Listof (U doctype-node comment-node)) (Option element-node) (Listof (U doctype-node comment-node))))) (define (partition-document-children children [before (list)] [element #f] [after (list)]) (cond [(null? children) (list (reverse before) element (reverse after))] [(element-node? (car children)) (partition-document-children (cdr children) before (cond [(element-node? element) element] [else (car children)]) after)] [(element-node? element) (partition-document-children (cdr children) before element (cons (car children) after))] [else (partition-document-children (cdr children) (cons (car children) before) #f (list))])) (: comment-node->comment (-> comment-node comment)) (define (comment-node->comment c) (define token (comment-node-token c)) (define content (comment-token-content token)) (comment (span-start (comment-token-less-than token)) (list->string (enumerate-output-characters content)))) (: comment-node->xml-comment (-> comment-node xml:comment)) (define (comment-node->xml-comment c) (define token (comment-node-token c)) (define content (comment-token-content token)) (xml:comment (list->string (enumerate-output-characters content)))) (: doctype-node->dtd (-> doctype-node document-type)) (define (doctype-node->dtd d) (define token (doctype-node-token d)) (define start (span-start (doctype-token-less-than token))) (define name (character-tokens->string (doctype-token-name token))) (define system (doctype-token-system token)) (define public (doctype-token-system token)) (document-type start (string->symbol name) (cond [(eq? #f system) #f] [else (character-tokens->string system)]) (cond [(eq? #f public) #f] [else (character-tokens->string public)]))) (: doctype-node->xml-document-type (-> doctype-node xml:document-type)) (define (doctype-node->xml-document-type d) (define token (doctype-node-token d)) (define start (span-start (doctype-token-less-than token))) (define name (character-tokens->string (doctype-token-name token))) (define system (doctype-token-system token)) (define public (doctype-token-system token)) (define system/string (cond [(eq? #f system) ""] [else (character-tokens->string system)])) (define public/string (cond [(eq? #f public) ""] [else (character-tokens->string public)])) (define dtd (cond [(string=? "" public/string) (xml:external-dtd/system system/string)] [else (xml:external-dtd/public system/string public/string)])) (xml:document-type (string->symbol name) dtd #f)) (: attribute-node->attribute (-> attribute-node attribute)) (define (attribute-node->attribute attr) (define token (attribute-node-token attr)) (define value (attribute-token-value token)) (attribute (span-start token) (string->symbol (character-tokens->string (attribute-token-name token))) #f (cond [(eq? #f value) #f] [else (quoted-attr->string value)]))) (: location->xml-location (-> location xml:location)) (define (location->xml-location loc) (xml:location (location-line loc) (location-column loc) (location-position loc))) (: attribute-node->xml-attribute (-> attribute-node xml:attribute)) (define (attribute-node->xml-attribute attr) (define token (attribute-node-token attr)) (define value (attribute-token-value token)) (define name (character-tokens->string (attribute-token-name token))) (xml:attribute (location->xml-location (span-start token)) (location->xml-location (span-start token)) ; obviously wrong (string->symbol (character-tokens->string (attribute-token-name token))) (cond [(eq? #f value) name] [else (quoted-attr->string value)]))) (: attribute-node->xexpr-attribute (-> attribute-node (List Symbol String))) (define (attribute-node->xexpr-attribute attr) (define token (attribute-node-token attr)) (define value (attribute-token-value token)) (define name (character-tokens->string (attribute-token-name token))) (list (string->symbol (character-tokens->string (attribute-token-name token))) (cond [(eq? #f value) name] [else (quoted-attr->string value)]))) (: element-node->element (-> element-node element)) (define (element-node->element elem) (define token (element-node-token elem)) (define start (span-start (tag-token-less-than token))) (define name (character-tokens->string (tag-token-name token))) (define attrs (map attribute-node->attribute (element-node-attributes elem))) (define content (element-children->html (element-node-children elem))) (element start (string->symbol name) 'html attrs content)) (: element-node->xml-element (-> element-node xml:element)) (define (element-node->xml-element elem) (define token (element-node-token elem)) (define start (span-start (tag-token-less-than token))) (define name (character-tokens->string (tag-token-name token))) (define attrs (map attribute-node->xml-attribute (element-node-attributes elem))) (define content (element-children->xml (element-node-children elem))) (xml:element (location->xml-location start) (location->xml-location start) ; obviously wrong (string->symbol name) attrs content)) (: element-children->html (-> (Listof (U element-node comment-node character-token character-reference-token string-token)) (Listof (U element comment String)))) (define (element-children->html kids) (cond [(null? kids) (list)] [(element-node? (car kids)) (cons (element-node->element (car kids)) (element-children->html (cdr kids)))] [(comment-node? (car kids)) (cons (comment-node->comment (car kids)) (element-children->html (cdr kids)))] [else (define stretch (takef kids (lambda (x) (or (character-token? x) (character-reference-token? x) (string-token? x))))) (cons (text-stretch->string stretch) (element-children->html (drop kids (length stretch))))])) (: element-children->xml (-> (Listof (U element-node comment-node character-token character-reference-token string-token)) (Listof (U xml:element xml:comment xml:cdata)))) (define (element-children->xml kids) (cond [(null? kids) (list)] [(element-node? (car kids)) (cons (element-node->xml-element (car kids)) (element-children->xml (cdr kids)))] [(comment-node? (car kids)) (cons (comment-node->xml-comment (car kids)) (element-children->xml (cdr kids)))] [else (define kid (car kids)) (define start (span-start kid)) (define stretch (takef kids (lambda (x) (or (character-token? x) (character-reference-token? x) (string-token? x))))) (cons (xml:cdata (location->xml-location start) (location->xml-location start) ; obviously wrong (text-stretch->string stretch)) (element-children->xml (drop kids (length stretch))))])) (: html-element-children->xml-element-children (-> (Listof (U element comment String)) (Listof (U xml:element xml:comment xml:cdata)))) (define (html-element-children->xml-element-children kids) (cond [(null? kids) (list)] [(element? (car kids)) (cons (html-element->xml-element (car kids)) (html-element-children->xml-element-children (cdr kids)))] [(comment? (car kids)) (cons (html-comment->xml-comment (car kids)) (html-element-children->xml-element-children (cdr kids)))] [else (define kid (car kids)) (cons (xml:cdata (xml:location 1 0 0) (xml:location 1 0 0) kid) (html-element-children->xml-element-children (cdr kids)))])) (: html-attribute->xml-attribute (-> attribute xml:attribute)) (define (html-attribute->xml-attribute attr) (define start (attribute-start attr)) (define value (attribute-value attr)) (define name (attribute-local-name attr)) (xml:attribute (location->xml-location start) (location->xml-location start) name (cond [(eq? #f value) (symbol->string name)] [else value]))) (: ->html (-> document-node document)) (define (->html doc) (define doc-partitions (partition-document-children (document-node-children doc))) (define before-element (first doc-partitions)) (define element (second doc-partitions)) (define after-element (third doc-partitions)) (cond [(eq? #f element) (error "Failed to find a root element")] [else (define prolog-partitions (partition-prolog-children before-element)) (define before-doctype (first prolog-partitions)) (define doctype (second prolog-partitions)) (define after-doctype (third prolog-partitions)) (define p (prolog (map comment-node->comment (append before-doctype after-doctype)) (cond [(eq? #f doctype) #f] [else (doctype-node->dtd doctype)]))) (document p (element-node->element element) (map comment-node->comment (filter comment-node? after-element)))])) (: text-stretch->string (-> (Listof (U character-token character-reference-token string-token)) String)) (define (text-stretch->string stretch) (cond [(null? stretch) ""] [(character-token? (car stretch)) (define c (character-token-content (car stretch))) (define s (cond [(char? c) (format "~a" c)] [(char? (cdr c)) (format "~a" (cdr c))] [else ""])) (string-append s (text-stretch->string (cdr stretch)))] [(character-reference-token? (car stretch)) (define c (character-reference-token-result (car stretch))) (define s (cond [(char? c) (format "~a" c)] [else (list->string c)])) (string-append s (text-stretch->string (cdr stretch)))] [else (string-append (string-token-content (car stretch)) (text-stretch->string (cdr stretch)))])) (: html-comment->xml-comment (-> comment xml:comment)) (define (html-comment->xml-comment c) (xml:comment (comment-content c))) (: html-document-type->xml-document-type (-> document-type xml:document-type)) (define (html-document-type->xml-document-type d) (define name (document-type-name d)) (define system (document-type-system d)) (define public (document-type-system d)) (xml:document-type name (cond [(and (eq? #f system) (eq? #f public)) (xml:external-dtd/system "")] [(eq? #f system) (xml:external-dtd/public public "")] [else (xml:external-dtd/public public system)]) #f)) (: html-prolog->xml-prolog (-> prolog xml:prolog)) (define (html-prolog->xml-prolog pro) (define dt (prolog-dtd pro)) (xml:prolog (map html-comment->xml-comment (prolog-misc pro)) (cond [(eq? #f dt) #f] [else (html-document-type->xml-document-type dt)]) (list))) (: html-element->xml-element (-> element xml:element)) (define (html-element->xml-element elem) (define start (element-start elem)) (xml:element (location->xml-location start) (location->xml-location start) (element-local-name elem) (map html-attribute->xml-attribute (element-attributes elem)) (html-element-children->xml-element-children (element-content elem))))
false
bb90530aa9418ecb768697662e194f56b0a6d430
5de040bc36cb7938ae1383863f670a30fe0f87b4
/usr/racket-6.1/share/doc/racket/pict/blueboxes.rktd
74a7b4644237b51d2e0f3dd2bc8d85dd88f38b2c
[]
no_license
Kreachers/CS-112
a53a9b926bc4c7a922ae8de1d891a2cfb97f336b
5af6a26696614fc2fc3f0c1f09a0d73c2076075b
refs/heads/master
2020-04-18T10:23:39.836792
2019-01-25T01:46:45
2019-01-25T01:46:45
167,466,313
0
0
null
null
null
null
UTF-8
Racket
false
false
43,988
rktd
blueboxes.rktd
10948 ((3) 0 () 20 ((q lib "pict/code.rkt") (q lib "pict/main.rkt") (q 0 . 18) (q lib "pict/balloon.rkt") (q 15213 . 46) (q 10509 . 31) (q 455 . 10) (q lib "pict/face.rkt") (q 9841 . 25) (q 3952 . 13) (q 2037 . 15) (q 20771 . 13) (q 2551 . 10) (q lib "pict/tree-layout.rkt") (q 4242 . 108) (q 3788 . 7) (q lib "pict/convert.rkt") (q 1437 . 9) (q lib "pict/flash.rkt") (q 2870 . 19)) () (h ! (equal) ((c form c (c (? . 0) q code)) q (23659 . 2)) ((c def c (c (? . 1) q rc-find)) c (? . 4)) ((c def c (c (? . 0) q current-base-color)) q (25012 . 4)) ((c def c (c (? . 3) q pip-wrap-balloon)) q (19594 . 13)) ((c def c (c (? . 1) q fast-end)) q (28106 . 3)) ((c def c (c (? . 1) q make-pict)) c (? . 2)) ((c def c (c (? . 1) q rt-superimpose)) c (? . 5)) ((c def c (c (? . 1) q pict-children)) c (? . 2)) ((c def c (c (? . 0) q current-reader-forms)) q (25171 . 4)) ((c def c (c (? . 0) q pict->code-pict)) q (27167 . 4)) ((c def c (c (? . 1) q table)) q (12001 . 13)) ((c def c (c (? . 3) q balloon-point-x)) c (? . 11)) ((c def c (c (? . 1) q clip)) q (13644 . 3)) ((c def c (c (? . 1) q bitmap)) q (3639 . 5)) ((c def c (c (? . 1) q cbl-find)) c (? . 4)) ((c def c (c (? . 0) q current-id-color)) q (24531 . 4)) ((c def c (c (? . 1) q fast-middle)) q (28266 . 3)) ((c def c (c (? . 1) q slide-pict)) q (27611 . 7)) ((c def c (c (? . 1) q blank)) q (960 . 15)) ((c def c (c (? . 1) q pip-arrow-line)) c (? . 9)) ((c def c (c (? . 7) q default-face-color)) q (21260 . 2)) ((c def c (c (? . 1) q lbl-superimpose)) c (? . 5)) ((c def c (c (? . 1) q pin-over)) q (11395 . 11)) ((c def c (c (? . 1) q cc-find)) c (? . 4)) ((c def c (c (? . 1) q cellophane)) q (13544 . 4)) ((c def c (c (? . 1) q hbl-append)) c (? . 8)) ((c def c (c (? . 0) q literal-color)) q (27021 . 2)) ((c def c (c (? . 1) q child-sy)) c (? . 6)) ((c def c (c (? . 1) q split-phase)) q (28348 . 3)) ((c def c (c (? . 1) q child?)) c (? . 6)) ((c def c (c (? . 1) q thermometer)) q (17997 . 20)) ((c def c (c (? . 1) q pin-line)) c (? . 14)) ((c def c (c (? . 7) q face)) q (21323 . 4)) ((c def c (c (? . 1) q vr-append)) c (? . 8)) ((c def c (c (? . 1) q pip-line)) c (? . 9)) ((c def c (c (? . 0) q current-literal-color)) q (24686 . 4)) ((c def c (c (? . 1) q lb-superimpose)) c (? . 5)) ((c def c (c (? . 0) q code-align)) q (25298 . 3)) ((c def c (c (? . 1) q fade-pict)) q (27274 . 6)) ((c def c (c (? . 1) q vl-append)) c (? . 8)) ((c def c (c (? . 1) q fast-edges)) q (28185 . 3)) ((c def c (c (? . 1) q cc-superimpose)) c (? . 5)) ((c def c (c (? . 1) q linestyle)) q (13065 . 7)) ((c def c (c (? . 1) q reverse-animations)) q (27901 . 3)) ((c def c (c (? . 1) q draw-pict)) q (31198 . 6)) ((c def c (c (? . 1) q pict-path?)) q (16474 . 3)) ((c def c (c (? . 1) q use-last)) q (15022 . 4)) ((c def c (c (? . 1) q child-sxy)) c (? . 6)) ((c def c (c (? . 0) q code-colorize-quote-enabled)) q (25945 . 4)) ((c def c (c (? . 18) q filled-flash)) q (22829 . 11)) ((c def c (c (? . 1) q ct-find)) c (? . 4)) ((c def c (c (? . 1) q circle)) c (? . 10)) ((c def c (c (? . 1) q pict->argb-pixels)) q (31485 . 4)) ((c def c (c (? . 1) q text)) q (1250 . 6)) ((c def c (c (? . 1) q pict->bitmap)) q (31326 . 4)) ((c def c (c (? . 1) q launder)) q (16530 . 3)) ((c def c (c (? . 1) q cbl-superimpose)) c (? . 5)) ((c def c (c (? . 1) q pict-panbox)) c (? . 2)) ((c def c (c (? . 1) q pict)) c (? . 2)) ((c def c (c (? . 1) q filled-ellipse)) c (? . 10)) ((c def c (c (? . 0) q code-italic-underscore-enabled)) q (26063 . 4)) ((c def c (c (? . 1) q rb-superimpose)) c (? . 5)) ((c def c (c (? . 1) q hline)) c (? . 17)) ((c def c (c (? . 1) q show-pict)) q (31862 . 15)) ((c def c (c (? . 1) q child-dy)) c (? . 6)) ((c def c (c (? . 0) q racket/base-const-list)) q (25740 . 2)) ((c def c (c (? . 1) q ellipse)) c (? . 10)) ((c def c (c (? . 0) q current-code-tt)) q (23798 . 4)) ((c def c (c (? . 1) q rbl-find)) c (? . 4)) ((c def c (c (? . 1) q hc-append)) c (? . 8)) ((c def c (c (? . 1) q scale-color)) q (30118 . 4)) ((c def c (c (? . 3) q balloon)) q (20445 . 9)) ((c def c (c (? . 1) q rotate)) q (12840 . 4)) ((c def c (c (? . 1) q drop-below-ascent)) q (14730 . 4)) ((c def c (c (? . 1) q struct:pict)) c (? . 2)) ((c def c (c (? . 1) q use-last*)) q (15117 . 4)) ((c def c (c (? . 0) q prop:code-transformer)) q (26562 . 2)) ((c def c (c (? . 0) q get-current-code-font-size)) q (23929 . 4)) ((c def c (c (? . 1) q pict?)) c (? . 2)) ((c def c (c (? . 1) q current-expected-text-scale)) q (32640 . 4)) ((c def c (c (? . 0) q code-pict-bottom-line-pict)) q (27080 . 3)) ((c def c (c (? . 1) q child)) c (? . 6)) ((c def c (c (? . 1) q pict-width)) c (? . 2)) ((c def c (c (? . 1) q refocus)) q (14876 . 4)) ((c def c (c (? . 1) q ct-superimpose)) c (? . 5)) ((c def c (c (? . 1) q text-style/c)) q (9710 . 2)) ((c def c (c (? . 1) q black-and-white)) q (14157 . 4)) ((c def c (c (? . 1) q fade-around-pict)) q (27469 . 5)) ((c def c (c (? . 3) q balloon-point-y)) c (? . 11)) ((c def c (c (? . 1) q lbl-find)) c (? . 4)) ((c def c (c (? . 1) q inset)) q (14251 . 14)) ((c def c (c (? . 1) q colorize)) q (13379 . 5)) ((c def c (c (? . 1) q frame)) q (1699 . 9)) ((c def c (c (? . 1) q rectangle)) c (? . 12)) ((c def c (c (? . 1) q filled-rectangle)) c (? . 12)) ((c def c (c (? . 1) q lt-superimpose)) c (? . 5)) ((c def c (c (? . 1) q rt-find)) c (? . 4)) ((c def c (c (? . 1) q fast-start)) q (28025 . 3)) ((c def c (c (? . 13) q hv-alternating)) q (29722 . 7)) ((c def c (c (? . 1) q arrowhead)) c (? . 15)) ((c def c (c (? . 1) q rbl-superimpose)) c (? . 5)) ((c def c (c (? . 1) q linewidth)) q (12976 . 4)) ((c def c (c (? . 1) q cloud)) q (16586 . 5)) ((c def c (c (? . 13) q tree-edge)) q (28620 . 6)) ((c def c (c (? . 3) q balloon-enable-3d)) q (21162 . 4)) ((c def c (c (? . 1) q child-sx)) c (? . 6)) ((c def c (c (? . 0) q current-const-color)) q (24851 . 4)) ((c def c (c (? . 0) q id-color)) q (26967 . 2)) ((c def c (c (? . 1) q pin-arrow-line)) c (? . 14)) ((c def c (c (? . 16) q prop:pict-convertible?)) q (32849 . 2)) ((c def c (c (? . 1) q argb-pixels->pict)) q (31637 . 4)) ((c def c (c (? . 1) q htl-append)) c (? . 8)) ((c def c (c (? . 1) q desktop-machine)) q (17881 . 4)) ((c def c (c (? . 1) q pip-arrows-line)) c (? . 9)) ((c def c (c (? . 1) q lt-find)) c (? . 4)) ((c def c (c (? . 0) q code-colorize-enabled)) q (25839 . 4)) ((c def c (c (? . 1) q pict-descent)) c (? . 2)) ((c form c (c (? . 0) q define-exec-code)) q (26679 . 3)) ((c def c (c (? . 1) q cb-superimpose)) c (? . 5)) ((c form c (c (? . 0) q define-code)) q (26291 . 3)) ((c def c (c (? . 1) q lc-find)) c (? . 4)) ((c def c (c (? . 1) q convert-bounds-padding)) q (30990 . 5)) ((c def c (c (? . 1) q arrow)) c (? . 15)) ((c def c (c (? . 3) q balloon?)) c (? . 11)) ((c def c (c (? . 16) q prop:pict-convertible)) q (32795 . 2)) ((c def c (c (? . 1) q inset/clip)) q (13696 . 14)) ((c def c (c (? . 0) q current-keyword-list)) q (25357 . 4)) ((c def c (c (? . 0) q typeset-code)) q (23598 . 3)) ((c def c (c (? . 0) q code-transformer?)) q (26616 . 3)) ((c def c (c (? . 1) q standard-fish)) q (16896 . 13)) ((c def c (c (? . 1) q ghost)) q (12922 . 3)) ((c def c (c (? . 1) q vline)) c (? . 17)) ((c def c (c (? . 1) q clip-descent)) q (14578 . 3)) ((c def c (c (? . 0) q current-literal-list)) q (25611 . 4)) ((c def c (c (? . 0) q comment-color)) q (26849 . 2)) ((c def c (c (? . 1) q lc-superimpose)) c (? . 5)) ((c def c (c (? . 16) q pict-convert)) q (32967 . 3)) ((c def c (c (? . 1) q rb-find)) c (? . 4)) ((c def c (c (? . 0) q code-scripts-enabled)) q (26187 . 4)) ((c def c (c (? . 1) q color-series)) q (30249 . 17)) ((c def c (c (? . 1) q rc-superimpose)) c (? . 5)) ((c def c (c (? . 3) q wrap-balloon)) q (19087 . 13)) ((c def c (c (? . 1) q file-icon)) q (16722 . 6)) ((c def c (c (? . 0) q current-keyword-color)) q (24366 . 4)) ((c def c (c (? . 1) q ht-append)) c (? . 8)) ((c def c (c (? . 13) q naive-layered)) q (29065 . 7)) ((c def c (c (? . 1) q jack-o-lantern)) q (17490 . 7)) ((c def c (c (? . 1) q pict-ascent)) c (? . 2)) ((c def c (c (? . 3) q balloon-color)) q (21103 . 2)) ((c def c (c (? . 1) q baseless)) q (14819 . 3)) ((c def c (c (? . 1) q pict-draw)) c (? . 2)) ((c def c (c (? . 1) q dc)) q (674 . 11)) ((c def c (c (? . 13) q tree-layout?)) q (28886 . 3)) ((c def c (c (? . 1) q ltl-find)) c (? . 4)) ((c def c (c (? . 1) q lb-find)) c (? . 4)) ((c form c (c (? . 0) q define-exec-code/scale)) q (26755 . 3)) ((c def c (c (? . 13) q tree-edge?)) q (29009 . 3)) ((c def c (c (? . 1) q rtl-find)) c (? . 4)) ((c def c (c (? . 1) q bitmap-draft-mode)) q (9743 . 4)) ((c def c (c (? . 1) q ctl-find)) c (? . 4)) ((c def c (c (? . 1) q hb-append)) c (? . 8)) ((c def c (c (? . 1) q scale-to-fit)) q (12637 . 8)) ((c def c (c (? . 1) q filled-rounded-rectangle)) c (? . 19)) ((c def c (c (? . 1) q angel-wing)) q (17782 . 5)) ((c def c (c (? . 1) q sequence-animations)) q (27776 . 3)) ((c def c (c (? . 18) q outline-flash)) q (23211 . 11)) ((c def c (c (? . 0) q current-comment-color)) q (24201 . 4)) ((c def c (c (? . 0) q make-code-transformer)) q (26389 . 4)) ((c def c (c (? . 1) q child-dx)) c (? . 6)) ((c def c (c (? . 1) q make-pict-drawer)) q (31754 . 4)) ((c def c (c (? . 1) q pict-last)) c (? . 2)) ((c def c (c (? . 3) q pin-balloon)) q (20122 . 11)) ((c def c (c (? . 1) q ctl-superimpose)) c (? . 5)) ((c def c (c (? . 1) q rtl-superimpose)) c (? . 5)) ((c def c (c (? . 1) q scale)) q (12444 . 8)) ((c def c (c (? . 1) q disk)) c (? . 10)) ((c def c (c (? . 7) q face*)) q (21458 . 30)) ((c def c (c (? . 1) q hyperlinkize)) q (30057 . 3)) ((c def c (c (? . 13) q binary-tidier)) q (29390 . 7)) ((c form c (c (? . 1) q scale/improve-new-text)) q (14038 . 3)) ((c def c (c (? . 3) q make-balloon)) c (? . 11)) ((c def c (c (? . 1) q pin-arrows-line)) c (? . 14)) ((c def c (c (? . 0) q mzscheme-const-list)) q (25791 . 2)) ((c def c (c (? . 1) q cb-find)) c (? . 4)) ((c def c (c (? . 3) q balloon-pict)) c (? . 11)) ((c def c (c (? . 13) q binary-tree-layout?)) q (28944 . 3)) ((c def c (c (? . 13) q tree-layout)) q (28451 . 4)) ((c def c (c (? . 1) q vc-append)) c (? . 8)) ((c def c (c (? . 1) q pin-under)) q (11702 . 11)) ((c def c (c (? . 1) q rounded-rectangle)) c (? . 19)) ((c def c (c (? . 1) q pict-height)) c (? . 2)) ((c def c (c (? . 1) q panorama)) q (14965 . 3)) ((c def c (c (? . 1) q child-syx)) c (? . 6)) ((c def c (c (? . 0) q current-const-list)) q (25486 . 4)) ((c def c (c (? . 1) q struct:child)) c (? . 6)) ((c def c (c (? . 1) q dc-for-text-size)) q (30853 . 4)) ((c def c (c (? . 1) q lift-above-baseline)) q (14639 . 4)) ((c def c (c (? . 1) q make-child)) c (? . 6)) ((c def c (c (? . 16) q pict-convertible?)) q (32904 . 3)) ((c def c (c (? . 0) q current-code-line-sep)) q (24098 . 4)) ((c def c (c (? . 0) q current-code-font)) q (23685 . 4)) ((c def c (c (? . 1) q child-pict)) c (? . 6)) ((c def c (c (? . 0) q keyword-color)) q (26908 . 2)) ((c def c (c (? . 1) q ltl-superimpose)) c (? . 5)))) struct (struct pict (draw        width        height        ascent        descent        children        panbox        last)     #:extra-constructor-name make-pict)   draw : any/c   width : real?   height : real?   ascent : real?   descent : real?   children : (listof child?)   panbox : (or/c #f any/c)   last : (or/c #f pict-path?) struct (struct child (pict dx dy sx sy sxy syx)     #:extra-constructor-name make-child)   pict : pict?   dx : real?   dy : real?   sx : real?   sy : real?   sxy : real?   syx : real? procedure (dc draw w h) -> pict?   draw : ((is-a?/c dc<%>) real? real? . -> . any)   w : real?   h : real? (dc draw w h a d) -> pict?   draw : ((is-a?/c dc<%>) real? real? . -> . any)   w : real?   h : real?   a : real?   d : real? procedure (blank [size]) -> pict?   size : real? = 0 (blank w h) -> pict?   w : real?   h : real? (blank w a d) -> pict?   w : real?   a : real?   d : real? (blank w h a d) -> pict?   w : real?   h : real?   a : real?   d : real? procedure (text content [style size angle]) -> pict?   content : string?   style : text-style/c = null   size : (integer-in 1 1024) = 12   angle : real? = 0 procedure (hline w h [#:segment seg-length]) -> pict?   w : real?   h : real?   seg-length : (or/c #f real?) = #f (vline w h [#:segment seg-length]) -> pict?   w : real?   h : real?   seg-length : (or/c #f real?) = #f procedure (frame  pict          [#:segment seg-length          #:color color           #:line-width width]) -> pict?   pict : pict?   seg-length : (or/c #f real?) = #f   color : (or/c #f string? (is-a?/c color<%>)) = #f   width : (or/c #f real?) = #f procedure (ellipse w h) -> pict?   w : real?   h : real? (circle diameter) -> pict?   diameter : real? (filled-ellipse  w           h          [#:draw-border? draw-border?]) -> pict?   w : real?   h : real?   draw-border? : any/c = #t (disk diameter [#:draw-border? draw-border?]) -> pict?   diameter : (and/c rational? (not/c negative?))   draw-border? : any/c = #t procedure (rectangle w h) -> pict?   w : real?   h : real? (filled-rectangle  w           h          [#:draw-border? draw-border?]) -> pict?   w : real?   h : real?   draw-border? : any/c = #t procedure (rounded-rectangle  w           h          [corner-radius           #:angle angle]) -> pict?   w : real?   h : real?   corner-radius : real? = -0.25   angle : real? = 0 (filled-rounded-rectangle  w           h          [corner-radius           #:angle angle           #:draw-border? draw-border?]) -> pict?   w : real?   h : real?   corner-radius : real? = -0.25   angle : real? = 0   draw-border? : any/c = #t procedure (bitmap img) -> pict   img : (or/c path-string?       (is-a?/c bitmap%)       (is-a?/c image-snip%)) procedure (arrow size radians) -> pict?   size : real?   radians : real? (arrowhead size radians) -> pict?   size : real?   radians : real? procedure (pip-line dx dy size) -> pict?   dx : real?   dy : real?   size : real? (pip-arrow-line dx dy size) -> pict?   dx : real?   dy : real?   size : real? (pip-arrows-line dx dy size) -> pict?   dx : real?   dy : real?   size : real? procedure (pin-line  pict           src           find-src           dest           find-dest          [#:start-angle start-angle          #:end-angle end-angle           #:start-pull start-pull           #:end-pull end-pull           #:line-width line-width           #:color color           #:alpha alpha           #:style style           #:under? under?])  -> pict?   pict : pict?   src : pict-path?   find-src : (pict? pict-path? . -> . (values real? real?))   dest : pict-path?   find-dest : (pict? pict-path? . -> . (values real? real?))   start-angle : (or/c real? #f) = #f   end-angle : (or/c real? #f) = #f   start-pull : real? = 1/4   end-pull : real? = 1/4   line-width : (or/c #f real?) = #f   color : (or/c #f string? (is-a?/c color%)) = #f   alpha : (real-in 0.0 1.0) = #f   style : (one-of/c 'transparent 'solid 'xor 'hilite           'dot 'long-dash 'short-dash 'dot-dash           'xor-dot 'xor-long-dash 'xor-short-dash           'xor-dot-dash)      = 'solid   under? : any/c = #f (pin-arrow-line  arrow-size           pict           src           find-src           dest           find-dest          [#:start-angle start-angle           #:end-angle end-angle           #:start-pull start-pull           #:end-pull end-pull           #:line-width line-width           #:color color           #:alpha alpha           #:style style           #:under? under?           #:solid? solid?           #:hide-arrowhead? hide-arrowhead?]) -> pict?   arrow-size : real?   pict : pict?   src : pict-path?   find-src : (pict? pict-path? . -> . (values real? real?))   dest : pict-path?   find-dest : (pict? pict-path? . -> . (values real? real?))   start-angle : (or/c real? #f) = #f   end-angle : (or/c real? #f) = #f   start-pull : real? = 1/4   end-pull : real? = 1/4   line-width : (or/c #f real?) = #f   color : (or/c #f string? (is-a?/c color%)) = #f   alpha : (real-in 0.0 1.0) = #f   style : (one-of/c 'transparent 'solid 'xor 'hilite           'dot 'long-dash 'short-dash 'dot-dash           'xor-dot 'xor-long-dash 'xor-short-dash           'xor-dot-dash)      = 'solid   under? : any/c = #f   solid? : any/c = #t   hide-arrowhead? : any/c = #f (pin-arrows-line  arrow-size           pict           src           find-src           dest           find-dest          [#:start-angle start-angle           #:end-angle end-angle           #:start-pull start-pull           #:end-pull end-pull           #:line-width line-width           #:color color           #:alpha alpha]           #:style style          [#:under? under?           #:solid? solid?           #:hide-arrowhead? hide-arrowhead?]) -> pict?   arrow-size : real?   pict : pict?   src : pict-path?   find-src : (pict? pict-path? . -> . (values real? real?))   dest : pict-path?   find-dest : (pict? pict-path? . -> . (values real? real?))   start-angle : (or/c real? #f) = #f   end-angle : (or/c real? #f) = #f   start-pull : real? = 1/4   end-pull : real? = 1/4   line-width : (or/c #f real?) = #f   color : (or/c #f string? (is-a?/c color%)) = #f   alpha : (real-in 0.0 1.0) = #f   style : (one-of/c 'transparent 'solid 'xor 'hilite           'dot 'long-dash 'short-dash 'dot-dash           'xor-dot 'xor-long-dash 'xor-short-dash           'xor-dot-dash)   under? : any/c = #f   solid? : any/c = #t   hide-arrowhead? : any/c = #f value text-style/c : contract? parameter (bitmap-draft-mode) -> boolean? (bitmap-draft-mode on?) -> void?   on? : any/c procedure (vl-append [d] pict ...) -> pict?   d : real? = 0.0   pict : pict? (vc-append [d] pict ...) -> pict?   d : real? = 0.0   pict : pict? (vr-append [d] pict ...) -> pict?   d : real? = 0.0   pict : pict? (ht-append [d] pict ...) -> pict?   d : real? = 0.0   pict : pict? (htl-append [d] pict ...) -> pict?   d : real? = 0.0   pict : pict? (hc-append [d] pict ...) -> pict?   d : real? = 0.0   pict : pict? (hbl-append [d] pict ...) -> pict?   d : real? = 0.0   pict : pict? (hb-append [d] pict ...) -> pict?   d : real? = 0.0   pict : pict? procedure (lt-superimpose pict ...) -> pict?   pict : pict? (ltl-superimpose pict ...) -> pict?   pict : pict? (lc-superimpose pict ...) -> pict?   pict : pict? (lbl-superimpose pict ...) -> pict?   pict : pict? (lb-superimpose pict ...) -> pict?   pict : pict? (ct-superimpose pict ...) -> pict?   pict : pict? (ctl-superimpose pict ...) -> pict?   pict : pict? (cc-superimpose pict ...) -> pict?   pict : pict? (cbl-superimpose pict ...) -> pict?   pict : pict? (cb-superimpose pict ...) -> pict?   pict : pict? (rt-superimpose pict ...) -> pict?   pict : pict? (rtl-superimpose pict ...) -> pict?   pict : pict? (rc-superimpose pict ...) -> pict?   pict : pict? (rbl-superimpose pict ...) -> pict?   pict : pict? (rb-superimpose pict ...) -> pict?   pict : pict? procedure (pin-over base dx dy pict) -> pict?   base : pict?   dx : real?   dy : real?   pict : pict? (pin-over base find-pict find pict) -> pict?   base : pict?   find-pict : pict-path?   find : (pict? pict-path? . -> . (values real? real?))   pict : pict? procedure (pin-under base dx dy pict) -> pict?   base : pict?   dx : real?   dy : real?   pict : pict? (pin-under base find-pict find pict) -> pict?   base : pict?   find-pict : pict?   find : (pict? pict? . -> . (values real? real?))   pict : pict? procedure (table ncols          picts          col-aligns         row-aligns         col-seps          row-seps)  -> pict?   ncols : exact-positive-integer?   picts : (non-empty-listof pict?)   col-aligns : (list*of (pict? pict? -> pict?))   row-aligns : (list*of (pict? pict? -> pict?))   col-seps : (list*of real?)   row-seps : (list*of real?) procedure (scale pict factor) -> pict?   pict : pict?   factor : real? (scale pict w-factor h-factor) -> pict?   pict : pict?   w-factor : real?   h-factor : real? procedure (scale-to-fit pict size-pict) -> pict?   pict : pict?   size-pict : pict? (scale-to-fit pict width height) -> pict?   pict : pict?   width : real?   height : real? procedure (rotate pict theta) -> pict?   pict : pict?   theta : real? procedure (ghost pict) -> pict?   pict : pict? procedure (linewidth w pict) -> pict?   w : (or/c real? #f)   pict : pict? procedure (linestyle style pict) -> pict?   style : (one-of/c 'transparent 'solid 'xor 'hilite           'dot 'long-dash 'short-dash 'dot-dash           'xor-dot 'xor-long-dash 'xor-short-dash           'xor-dot-dash)   pict : pict? procedure (colorize pict color) -> pict?   pict : pict?   color : (or/c string? (is-a?/c color%)       (list/c byte? byte? byte?)) procedure (cellophane pict opacity) -> pict?   pict : pict?   opacity : (real-in 0 1) procedure (clip pict) -> pict   pict : pict? procedure (inset/clip pict amt) -> pict?   pict : pict?   amt : real? (inset/clip pict h-amt v-amt) -> pict?   pict : pict?   h-amt : real?   v-amt : real? (inset/clip pict l-amt t-amt r-amt b-amt) -> pict?   pict : pict?   l-amt : real?   t-amt : real?   r-amt : real?   b-amt : real? syntax (scale/improve-new-text pict-expr scale-expr) (scale/improve-new-text pict-expr x-scale-expr y-scale-expr) parameter (black-and-white) -> boolean? (black-and-white on?) -> void?   on? : any/c procedure (inset pict amt) -> pict?   pict : pict?   amt : real? (inset pict h-amt v-amt) -> pict?   pict : pict?   h-amt : real?   v-amt : real? (inset pict l-amt t-amt r-amt b-amt) -> pict?   pict : pict?   l-amt : real?   t-amt : real?   r-amt : real?   b-amt : real? procedure (clip-descent pict) -> pict?   pict : pict? procedure (lift-above-baseline pict amt) -> pict?   pict : pict?   amt : real? procedure (drop-below-ascent pict amt) -> pict?   pict : pict?   amt : real? procedure (baseless pict) -> pict?   pict : pict? procedure (refocus pict sub-pict) -> pict?   pict : pict?   sub-pict : pict? procedure (panorama pict) -> pict?   pict : pict? procedure (use-last pict sub-pict) -> pict?   pict : pict?   sub-pict : pict-path? procedure (use-last* pict sub-pict) -> pict?   pict : pict?   sub-pict : pict-path? procedure (lt-find pict find) -> real? real?   pict : pict?   find : pict-path? (ltl-find pict find) -> real? real?   pict : pict?   find : pict-path? (lc-find pict find) -> real? real?   pict : pict?   find : pict-path? (lbl-find pict find) -> real? real?   pict : pict?   find : pict-path? (lb-find pict find) -> real? real?   pict : pict?   find : pict-path? (ct-find pict find) -> real? real?   pict : pict?   find : pict-path? (ctl-find pict find) -> real? real?   pict : pict?   find : pict-path? (cc-find pict find) -> real? real?   pict : pict?   find : pict-path? (cbl-find pict find) -> real? real?   pict : pict?   find : pict-path? (cb-find pict find) -> real? real?   pict : pict?   find : pict-path? (rt-find pict find) -> real? real?   pict : pict?   find : pict-path? (rtl-find pict find) -> real? real?   pict : pict?   find : pict-path? (rc-find pict find) -> real? real?   pict : pict?   find : pict-path? (rbl-find pict find) -> real? real?   pict : pict?   find : pict-path? (rb-find pict find) -> real? real?   pict : pict?   find : pict-path? procedure (pict-path? v) -> boolean?   v : any/c procedure (launder pict) -> pict?   pict : pict? procedure (cloud w h [color]) -> pict?   w : real?   h : real?   color : (or/c string? (is-a?/c color%)) = "gray" procedure (file-icon w h color [shaded?]) -> pict?   w : real?   h : real?   color : (or/c string? (is-a?/c color%) any/c)   shaded? : any/c = #f procedure (standard-fish  w           h          [#:direction direction           #:color color           #:eye-color eye-color           #:open-mouth open-mouth]) -> pict?   w : real?   h : real?   direction : (or/c 'left 'right) = 'left   color : (or/c string? (is-a?/c color%)) = "blue"   eye-color : (or/c string? (is-a?/c color%) #f) = "black"   open-mouth : (or/c boolean? real?) = #f procedure (jack-o-lantern  size          [pumpkin-color          face-color])  -> pict?   size : real?   pumpkin-color : (or/c string? (is-a?/c color%)) = "orange"   face-color : (or/c string? (is-a?/c color%)) = "black" procedure (angel-wing w h left?) -> pict?   w : real?   h : real?   left? : any/c procedure (desktop-machine scale [style]) -> pict?   scale : real?   style : (listof symbol?) = null procedure (thermometer [#:height-% height-%       #:color-% color-%       #:ticks ticks       #:start-color start-color       #:end-color end-color       #:top-circle-diameter top-circle-diameter       #:bottom-circle-diameter bottom-circle-diameter      #:stem-height stem-height       #:mercury-inset mercury-inset])    -> pict?   height-% : (between/c 0 1) = 1   color-% : (between/c 0 1) = height-%   ticks : non-exact-negative-integer? = 4   start-color : (or/c string? (is-a?/c color%)) = "lightblue"   end-color : (or/c string? (is-a?/c color%)) = "lightcoral"   top-circle-diameter : positive-real? = 40   bottom-circle-diameter : positive-real? = 80   stem-height : positive-real? = 180   mercury-inset : positive-real? = 8 procedure (wrap-balloon  pict           spike           dx           dy          [color           corner-radius]) -> balloon?   pict : pict?   spike : (or/c 'n 's 'e 'w 'ne 'se 'sw 'nw)   dx : real?   dy : real?   color : (or/c string? (is-a?/c color%)) = balloon-color   corner-radius : (and/c real? (not/c negative?)) = 32 procedure (pip-wrap-balloon  pict           spike           dx           dy          [color           corner-radius]) -> pict?   pict : pict?   spike : (or/c 'n 's 'e 'w 'ne 'se 'sw 'nw)   dx : real?   dy : real?   color : (or/c string? (is-a?/c color%)) = balloon-color   corner-radius : (and/c real? (not/c negative?)) = 32 procedure (pin-balloon balloon base x y) -> pict?   balloon : balloon?   base : pict?   x : real?   y : real? (pin-balloon balloon base at-pict find) -> pict?   balloon : balloon?   base : pict?   at-pict : pict-path?   find : (pict? pict-path? . -> . (values real? real?)) procedure (balloon w h corner-radius spike dx dy [color]) -> balloon?   w : real?   h : real?   corner-radius : (and/c real? (not/c negative?))   spike : (or/c 'n 's 'e 'w 'ne 'se 'sw 'nw)   dx : real?   dy : real?   color : (or/c string? (is-a?/c color%)) = balloon-color procedure (balloon? v) -> boolean?   v : any/c (make-balloon pict x y) -> balloon?   pict : pict?   x : real?   y : real? (balloon-pict balloon) -> pict?   balloon : balloon? (balloon-point-x balloon) -> real?   balloon : balloon? (balloon-point-y balloon) -> real?   balloon : balloon? value balloon-color : (or/c string? (is-a?/c color%)) parameter (balloon-enable-3d) -> boolean? (balloon-enable-3d on?) -> void?   on? : any/c value default-face-color : (or/c string (is-a?/c color%)) procedure (face mood [color]) -> pict?   mood : symbol?   color : (or/c string (is-a?/c color%)) = default-face-color procedure (face*  eyebrow-kind           mouth-kind           frown?           color           eye-inset           eyebrow-dy           pupil-dx           pupil-dy          [#:eyebrow-shading? eyebrow-on?           #:mouth-shading? mouth-on?           #:eye-shading? eye-on?           #:tongue-shading? tongue-on?           #:face-background-shading? face-bg-on?          #:teeth? teeth-on?])  -> pict?   eyebrow-kind : (or/c 'none 'normal 'worried 'angry)   mouth-kind : (or/c 'plain 'smaller 'narrow 'medium 'large       'huge 'grimace 'oh 'tongue)   frown? : any/c   color : (or/c string (is-a?/c color%))   eye-inset : real?   eyebrow-dy : real?   pupil-dx : real?   pupil-dy : real?   eyebrow-on? : any/c = #t   mouth-on? : any/c = #t   eye-on? : any/c = #t   tongue-on? : any/c = #t   face-bg-on? : any/c = #t   teeth-on? : any/c = #t procedure (filled-flash  width           height          [n-points           spike-fraction          rotation])  -> pict?   width : real?   height : real?   n-points : exact-positive-integer? = 10   spike-fraction : (real-in 0 1) = 0.25   rotation : real? = 0 procedure (outline-flash  width           height          [n-points           spike-fraction          rotation])  -> pict?   width : real?   height : real?   n-points : exact-positive-integer? = 10   spike-fraction : (real-in 0 1) = 0.25   rotation : real? = 0 procedure (typeset-code stx) -> pict?   stx : syntax? syntax (code datum ...) parameter (current-code-font) -> text-style/c (current-code-font style) -> void?   style : text-style/c parameter (current-code-tt) -> (string? . -> . pict?) (current-code-tt proc) -> void?   proc : (string? . -> . pict?) parameter (get-current-code-font-size) -> (-> exact-nonnegative-integer?) (get-current-code-font-size proc) -> void?   proc : (-> exact-nonnegative-integer?) parameter (current-code-line-sep) -> real? (current-code-line-sep amt) -> void?   amt : real? parameter (current-comment-color) -> (or/c string? (is-a?/c color%)) (current-comment-color color) -> void?   color : (or/c string? (is-a?/c color%)) parameter (current-keyword-color) -> (or/c string? (is-a?/c color%)) (current-keyword-color color) -> void?   color : (or/c string? (is-a?/c color%)) parameter (current-id-color) -> (or/c string? (is-a?/c color%)) (current-id-color color) -> void?   color : (or/c string? (is-a?/c color%)) parameter (current-literal-color) -> (or/c string? (is-a?/c color%)) (current-literal-color color) -> void?   color : (or/c string? (is-a?/c color%)) parameter (current-const-color) -> (or/c string? (is-a?/c color%)) (current-const-color color) -> void?   color : (or/c string? (is-a?/c color%)) parameter (current-base-color) -> (or/c string? (is-a?/c color%)) (current-base-color color) -> void?   color : (or/c string? (is-a?/c color%)) parameter (current-reader-forms) -> (listof symbol?) (current-reader-forms syms) -> void?   syms : (listof symbol?) procedure (code-align pict) -> pict?   pict : pict? parameter (current-keyword-list) -> (listof string?) (current-keyword-list names) -> void?   names : (listof string?) parameter (current-const-list) -> (listof string?) (current-const-list names) -> void?   names : (listof string?) parameter (current-literal-list) -> (listof string?) (current-literal-list names) -> void?   names : (listof string?) value racket/base-const-list : (listof string?) value mzscheme-const-list : (listof string?) parameter (code-colorize-enabled) -> boolean? (code-colorize-enabled on?) -> void?   on? : any/c parameter (code-colorize-quote-enabled) -> boolean? (code-colorize-quote-enabled on?) -> void?   on? : any/c parameter (code-italic-underscore-enabled) -> boolean? (code-italic-underscore-enabled on?) -> void?   on? : any/c parameter (code-scripts-enabled) -> boolean? (code-scripts-enabled on?) -> void?   on? : any/c syntax (define-code code-id typeset-code-id) (define-code code-id typeset-code-id escape-id) procedure (make-code-transformer proc-or-stx) -> code-transformer?   proc-or-stx : (or/c (syntax? . -> . (or/c syntax? #f))       syntax?) value prop:code-transformer : struct-type-property? procedure (code-transformer? v) -> boolean?   v : any/c syntax (define-exec-code (pict-id runnable-id string-id)   datum ...) syntax (define-exec-code/scale scale-expr (pict-id runnable-id string-id)   datum ...) value comment-color : (or/c string? (is-a?/c color%)) value keyword-color : (or/c string? (is-a?/c color%)) value id-color : (or/c string? (is-a?/c color%)) value literal-color : (or/c string? (is-a?/c color%)) procedure (code-pict-bottom-line-pict pict) -> (or/c pict? #f)   pict : pict? procedure (pict->code-pict pict bl-pict) -> pict?   pict : pict?   bl-pict : (or/c pict? #f) procedure (fade-pict n p1 p2 [#:combine combine]) -> pict?   n : (real-in 0.0 1.0)   p1 : pict?   p2 : pict?   combine : (pict? pict? . -> . pict?) = cc-superimpose procedure (fade-around-pict n p1 make-p2) -> pict?   n : (real-in 0.0 1.0)   p1 : pict?   make-p2 : (pict? . -> . pict?) procedure (slide-pict base p p-from p-to n) -> pict?   base : pict?   p : pict?   p-from : pict?   p-to : pict?   n : (real-in 0.0 1.0) procedure (sequence-animations gen ...) -> (-> (real-in 0.0 1.0) pict?)   gen : (-> (real-in 0.0 1.0) pict?) procedure (reverse-animations gen ...) -> (-> (real-in 0.0 1.0) pict?)   gen : (-> (real-in 0.0 1.0) pict?) procedure (fast-start n) -> (real-in 0.0 1.0)   n : (real-in 0.0 1.0) procedure (fast-end n) -> (real-in 0.0 1.0)   n : (real-in 0.0 1.0) procedure (fast-edges n) -> (real-in 0.0 1.0)   n : (real-in 0.0 1.0) procedure (fast-middle n) -> (real-in 0.0 1.0)   n : (real-in 0.0 1.0) procedure (split-phase n) -> (real-in 0.0 1.0) (real-in 0.0 1.0)   n : (real-in 0.0 1.0) procedure (tree-layout [#:pict node-pict] child ...) -> tree-layout?   node-pict : (or/c #f pict?) = #f   child : (or/c tree-layout? tree-edge? #f) procedure (tree-edge node [#:edge-color edge-color]) -> tree-edge?   node : tree-layout?   edge-color : (or/c string?  = "gray"       (is-a?/c color%)       (list/c byte? byte? byte?)) procedure (tree-layout? v) -> boolean?   v : any/c procedure (binary-tree-layout? v) -> boolean?   v : any/c procedure (tree-edge? v) -> boolean?   v : any/c procedure (naive-layered  tree-layout          [#:x-spacing x-spacing           #:y-spacing y-spacing]) -> pict?   tree-layout : tree-layout?   x-spacing : (or/c (and/c real? positive?) #f) = #f   y-spacing : (or/c (and/c real? positive?) #f) = #f procedure (binary-tidier  tree-layout          [#:x-spacing x-spacing           #:y-spacing y-spacing]) -> pict?   tree-layout : binary-tree-layout?   x-spacing : (or/c (and/c real? positive?) #f) = #f   y-spacing : (or/c (and/c real? positive?) #f) = #f procedure (hv-alternating  tree-layout          [#:x-spacing x-spacing           #:y-spacing y-spacing]) -> pict?   tree-layout : binary-tree-layout?   x-spacing : (or/c (and/c real? positive?) #f) = #f   y-spacing : (or/c (and/c real? positive?) #f) = #f procedure (hyperlinkize pict) -> pict?   pict : pict? procedure (scale-color factor color) -> (is-a?/c color%)   factor : real?   color : (or/c string (is-a?/c color%)) procedure (color-series dc          max-step          step-delta          start          end          proc          set-pen?          set-brush?) -> void?   dc : (is-a?/c dc<%>)   max-step : exact-nonnegative-integer?   step-delta : (and/c exact? positive?)   start : (or/c string? (is-a?/c color%))   end : (or/c string? (is-a?/c color%))   proc : (exact? . -> . any)   set-pen? : any/c   set-brush? : any/c parameter (dc-for-text-size) -> (or/c #f (is-a?/c dc<%>)) (dc-for-text-size dc) -> void?   dc : (or/c #f (is-a?/c dc<%>)) parameter (convert-bounds-padding)  -> (list/c (>=/c 0) (>=/c 0) (>=/c 0) (>=/c 0)) (convert-bounds-padding padding) -> void?   padding : (list/c (>=/c 0) (>=/c 0) (>=/c 0) (>=/c 0)) procedure (draw-pict pict dc x y) -> void?   pict : pict?   dc : (is-a?/c dc<%>)   x : real?   y : real? procedure (pict->bitmap pict [smoothing]) -> (is-a?/c bitmap%)   pict : pict?   smoothing : (or/c 'unsmoothed 'smoothed 'aligned) = 'aligned procedure (pict->argb-pixels pict [smoothing]) -> bytes?   pict : pict?   smoothing : (or/c 'unsmoothed 'smoothed 'aligned) = 'aligned procedure (argb-pixels->pict bytes width) -> pict?   bytes : bytes?   width : exact-nonnegative-integer? procedure (make-pict-drawer pict)  -> ((is-a?/c dc<%>) real? real? . -> . void?)   pict : pict? procedure (show-pict  pict          [w           h]           #:frame-x frame-x           #:frame-y frame-y           #:frame-style frame-style) -> void?   pict : pict?   w : (or/c #f exact-nonnegative-integer?) = #f   h : (or/c #f exact-nonnegative-integer?) = #f   frame-x : (or/c (integer-in -10000 10000) #f)   frame-y : (or/c (integer-in -10000 10000) #f)   frame-style : (listof (or/c 'no-resize-border 'no-caption               'no-system-menu 'hide-menu-bar               'toolbar-button 'float 'metal)) parameter (current-expected-text-scale) -> (list/c real? real?) (current-expected-text-scale scales) -> void?   scales : (list/c real? real?) value prop:pict-convertible : struct-type-property? value prop:pict-convertible? : struct-type-property? procedure (pict-convertible? v) -> boolean?   v : any/c procedure (pict-convert v) -> pict?   v : pict-convertible?
false
5ff2095d06c4c92d0e61f577912420bdf63de10f
7e500549765a0bdc49d4fcf40158fb9bb5b07e3e
/tamer/zip/zipinfo.rkt
fb511dd469b85d315cb75981fd411985e0e7938f
[]
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
7,752
rkt
zipinfo.rkt
#lang typed/racket/gui (provide (all-defined-out)) (require racket/path) (require racket/symbol) (require digimon/archive) (require digimon/digitama/bintext/zipinfo) (require digimon/cmdopt) (require digimon/format) (require digimon/date) (require digimon/echo) (require digimon/debug) (require digimon/dtrace) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define-cmdlet-option zipinfo-flags #: ZipInfo-Flags #:program 'zipinfo #:args [file.zip] #:once-each [[(#\A) "list all entries, including those not in the central directory"] [(#\h) "display the header line"] [(#\t) "display the trailer line"] [(#\z) "display file comment"] [(#\T) "print the file dates and times in the sortable decimal format"] [(#\v) #:=> zip-verbose "run with verbose messages"]] #:once-any [[(#\1) "list filenames only"] [(#\2) "list filenames, but allow other information"] [(#\s) "list zip info with short format"] [(#\m) "list zip info with medium format"] [(#\l) "list zip info with long format"]]) (define zip-verbose : (Parameterof Boolean) (make-parameter #false)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define main : (-> (U (Listof String) (Vectorof String)) Nothing) (lambda [argument-list] (define-values (options λargv) (parse-zipinfo-flags argument-list #:help-output-port (current-output-port))) (define file.zip : String (λargv)) (parameterize ([current-logger /dev/dtrace] [pretty-print-columns 160] [date-display-format 'iso-8601]) (exit (time** (let ([tracer (thread (make-zip-log-trace))]) (with-handlers ([exn:fail? (λ [[e : exn:fail]] (dtrace-exception e #:brief? #false))]) (zipinfo options file.zip)) (dtrace-datum-notice eof) (thread-wait tracer))))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define make-zip-log-trace : (-> (-> Void)) (lambda [] (make-dtrace-loop (if (zip-verbose) 'trace 'info)))) (define zip-entry-info : (-> (U ZIP-Directory ZIP-Entry) ZipInfo-Flags (Listof String)) (lambda [ze opts] (filter string? (if (zip-directory? ze) (let-values ([(csize rsize) (values (zip-directory-csize ze) (zip-directory-rsize ze))]) (list (zip-version (zip-directory-cversion ze)) (symbol->immutable-string (zip-directory-csystem ze)) (zip-version (zip-directory-eversion ze)) (symbol->immutable-string (zip-directory-esystem ze)) (zip-size rsize) (cond [(zipinfo-flags-m opts) (zip-cfactor csize rsize)] [(zipinfo-flags-l opts) (zip-size csize)]) (symbol->immutable-string (zip-directory-compression ze)) (zip-datetime (zip-directory-mdate ze) (zip-directory-mtime ze) (zipinfo-flags-T opts)) (zip-directory-filename ze))) (let-values ([(csize rsize) (values (zip-entry-csize ze) (zip-entry-rsize ze))]) (list (zip-version (zip-entry-eversion ze)) (symbol->immutable-string (zip-entry-esystem ze)) (zip-size rsize) (cond [(zipinfo-flags-m opts) (zip-cfactor csize rsize)] [(zipinfo-flags-l opts) (zip-size csize)]) (symbol->immutable-string (zip-entry-compression ze)) (zip-datetime (zip-entry-mdate ze) (zip-entry-mtime ze) (zipinfo-flags-T opts)) (zip-entry-filename ze))))))) (define zip-display-tail-info : (->* (Path-String) (Term-Color) Void) (lambda [zip [fgc #false]] (define-values (csize rsize) (zip-content-size* zip)) (echof "~a, ~a uncompressed, ~a compressed: ~a~n" #:fgcolor fgc (~n_w (length (zip-list-directories* zip)) "entry") (~size rsize) (~size csize) (zip-cfactor csize rsize 1)))) (define zipinfo : (-> ZipInfo-Flags String Any) (lambda [opts file.zip] (define zip-entries : (U (Listof ZIP-Directory) (Listof ZIP-Entry)) (cond [(zipinfo-flags-A opts) (zip-list-local-entries* file.zip)] [else (zip-list-directories* file.zip)])) (define zip-comments : (Pairof String (Listof (Pairof String String))) (cond [(zipinfo-flags-z opts) (zip-list-comments* file.zip)] [else (cons "" null)])) (when (zipinfo-flags-1 opts) (for-each displayln (zip-list zip-entries)) (exit 0)) (when (zipinfo-flags-h opts) (printf "Archive: ~a~n" (simple-form-path file.zip)) (printf "Zip file size: ~a, number of entries: ~a~n" (~size (file-size file.zip)) (length zip-entries))) (define entries : (Listof (Listof String)) (cond [(zipinfo-flags-2 opts) (map (inst list String) (zip-list zip-entries))] [(or (zipinfo-flags-s opts) (zipinfo-flags-m opts) (zipinfo-flags-l opts) (not (or (zipinfo-flags-h opts) (zipinfo-flags-t opts)))) (for/list ([ze (in-list zip-entries)]) (zip-entry-info ze opts))] [else null])) (when (> (string-length (car zip-comments)) 0) (displayln (car zip-comments))) (when (pair? entries) (cond [(= (length (car entries)) 1) (for ([e entries]) (displayln (car e)))] [else (let ([widths (text-column-widths entries)]) (for ([e (in-list entries)]) (for ([col (in-list e)] [wid (in-list widths)] [idx (in-naturals)]) (when (> idx 0) (display #\space)) (let ([numerical? (memq (string-ref col (sub1 (string-length col))) (list #\% #\B))]) (display (~a col #:min-width (+ wid 1) #:align (if numerical? 'right 'left))))) (let ([?comment (assoc (last e) (cdr zip-comments))]) (when (and ?comment (> (string-length (cdr ?comment)) 0)) (display #\space) (display (cdr ?comment)))) (newline)))])) (when (zipinfo-flags-t opts) (zip-display-tail-info file.zip)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define zip-cfactor : (->* (Natural Natural) (Byte) String) (lambda [csize rsize [precision 0]] (~% #:precision (if (= precision 0) 0 `(= ,precision)) (- 1 (if (= rsize 0) 1 (/ csize rsize)))))) (define zip-size : (-> Natural String) (lambda [size] (~size size #:precision '(= 3) #:bytes->string (λ [n u] (~a n " B"))))) (define zip-version : (-> Index String) (lambda [version] (number->string (/ (real->double-flonum version) 10.0)))) (define zip-datetime : (-> Index Index Boolean String) (lambda [date time T?] (define the-date (seconds->date (zip-entry-modify-seconds date time) #true)) (if (not T?) (date->string the-date #true) (string-append (number->string (date-year the-date)) (~0time (date-month the-date)) (~0time (date-day the-date)) "." (~0time (date-hour the-date)) (~0time (date-minute the-date)) (~0time (date-second the-date)))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (module+ main (main (current-command-line-arguments)))
false
f75fc41a33e7d8dc0efce6000e91257a4a973c0a
af21b2d0c81fbbd228666268b112239d7a022a78
/misc.rkt
10855bb3bb50c88a209da01982aabd456bff31a1
[]
no_license
GlimmerLabs/gigls
a4e0f528d2a04107031529f323c7768cb3d9e39d
5116033d8acb30f201d1a0b27ef9fc88cc6fb136
refs/heads/master
2016-09-15T04:54:48.047038
2015-09-10T02:42:38
2015-09-10T02:42:38
10,534,146
2
1
null
null
null
null
UTF-8
Racket
false
false
2,376
rkt
misc.rkt
#lang racket ; A miscellaneous racket library for wrapper functions that ; a: don't belong in another library or b: would cause ; libraries to be interdependent. (require gigls/guard gigls/higher) (provide (all-defined-out)) ;;; Procedure: ;;; increment ;;; Parameters: ;;; val, a number ;;; Purpose: ;;; Add 1 to val ;;; Produces: ;;; incremented, a number ;;; Preconditions: ;;; [No additional] ;;; Postconditions: ;;; incremented = (+ 1 val) ;;; Ponderings: ;;; An obvious procedure, but one that is often useful. (define increment (l-s + 1)) ;;; Procedure: ;;; iota ;;; Parameters: ;;; n, a positive integer ;;; Purpose: ;;; Create a list of all non-negative integers less than n. ;;; Produces: ;;; ints, a list of integers ;;; Preconditions: ;;; [No additional] ;;; Postconditions: ;;; (length ints) = n ;;; ints has the form (0 1 2 3 ...) (define _iota (lambda (n) (let kernel ((i 0)) (if (= i n) null (cons i (kernel (+ i 1))))))) (define iota (lambda (n) (validate-param! 'iota 'non-negative-integer (^and integer? (^not negative?)) (list n)) (_iota n))) ;;; Procedure: ;;; repeat! ;;; Parameters: ;;; i, a non-negative integer ;;; proc!, an n-ary procedure ;;; v1 ... vn, 0 or more optional parameters ;;; Purpose: ;;; Calls (proc! v1 ... vn) i times. ;;; Produces: ;;; [Nothing; called for the side effect] ;;; Preconditions: ;;; [No additional] ;;; Postconditions: ;;; The procedure has been applied the specified number of times. (define _repeat (lambda (i proc! . args) (let kernel ((i i)) (cond ((positive? i) (apply proc! args) (kernel (- i 1))))))) (define repeat (lambda (i proc! . args) (let ((params (cons i (cons proc! args)))) (cond ((or (not (integer? i)) (negative? i)) (error/parameter-type 'repeat 1 'positive-integer params)) ((not (procedure? proc!)) (error/parameter-type 'repeat 2 'procedure params)) (else (apply _repeat params)))))) (define repeat! repeat) ;;; Procedure: ;;; square ;;; Parameters: ;;; n, a number ;;; Purpose: ;;; Computes n squared ;;; Produces: ;;; nsquared, a number ;;; Preconditions: ;;; [No additional preconditions] ;;; Postconditions: ;;; nsquared = n*n (define square (lambda (n) (* n n)))
false
af87f56543828a3b2a8e603bb88c82b58ad34998
f05faa71d7fef7301d30fb8c752f726c8b8c77d4
/src/exercises/ex-3.60.rkt
36a29b1f46e16e056961ded0a0ed757299569e7e
[]
no_license
yamad/sicp
c9e8a53799f0ca6f02b47acd23189b2ca91fe419
11e3a59f41ed411814411e80f17606e49ba1545a
refs/heads/master
2021-01-21T09:53:44.834639
2017-02-27T19:32:23
2017-02-27T19:32:23
83,348,438
1
0
null
null
null
null
UTF-8
Racket
false
false
1,016
rkt
ex-3.60.rkt
#lang racket (require "../examples/streams.rkt") (require "ex-3.59.rkt") ;; Exercise 3.60: With power series represented as streams of ;; coefficients as in *Note Exercise 3-59::, adding series is ;; implemented by `add-streams'. Complete the definition of the ;; following procedure for multiplying series: ;; ;; (define (mul-series s1 s2) ;; (cons-stream <??> (add-streams <??> <??>))) ;; ;; You can test your procedure by verifying that sin^2 x + cos^2 x = ;; 1, using the series from *Note Exercise 3-59::. ;; solution was looked up. hoping to come back to it to understand it ;; It's clear how each line emits part of the full set of pairs from ;; s1 and s2, but I don't see how the right terms are added ;; together. see Cauchy product for mathematics. (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)))) (provide mul-series)
false
c6717156d3c0f9bd4c830ff5b5db667a83ea8785
aecb552be3ace8a29afa7611568bb1970a8d50a9
/test/search-test.rkt
9712c88f44f7592d299c817da5c59231ed597146
[ "MIT" ]
permissive
mshockwave/synapse
60b453b004c19ef99509283406a3ed25a246912b
10f605f8f1fff6dade90607f516550b961a10169
refs/heads/master
2021-06-09T18:44:40.956448
2016-01-19T21:03:29
2016-01-19T21:03:29
null
0
0
null
null
null
null
UTF-8
Racket
false
false
1,844
rkt
search-test.rkt
#lang s-exp rosette (require "../opsyn/metasketches/superoptimization.rkt" "../opsyn/metasketches/cost.rkt" "../opsyn/engine/search.rkt" "../opsyn/engine/verifier.rkt" "../opsyn/engine/metasketch.rkt" "../opsyn/bv/lang.rkt" "../benchmarks/hd/reference.rkt" "../benchmarks/hd/d0.rkt" "../benchmarks/hd/d5.rkt" "../benchmarks/all.rkt" rackunit "test-runner.rkt") (current-bitwidth 32) ;(current-log-handler (log-handler #:info (lambda (s) (eq? s 'search)))) (define bench (list hd01 hd02 hd03 hd04 hd05 hd06 hd07 hd08 hd09 hd10 hd11 hd12 hd13 hd14 hd15 hd16 hd17 hd18 hd19 hd20)) (define (verify32 x P1 P2) (parameterize ([current-bitwidth 32]) (check equal? (program-inputs P1) (program-inputs P2)) (check-true (unsat? (verify #:post (list (= (interpret P1 x) (interpret P2 x)))))))) ; Test the correctness of the search over a HD benchmark metasketch. (define (test-hd ms hd i [widening #f] [threads 1]) (test-case (format "hd~a" i) (unsafe-clear-terms!) (define M-spec `(,ms (list-ref all-hd-programs ,i))) (define prog (search #:metasketch M-spec #:threads threads #:timeout 60 #:widening widening #:bitwidth (current-bitwidth))) (check-false (false? prog)) (define M (eval-metasketch M-spec)) (verify32 (inputs M) hd prog))) (define/provide-test-suite search-tests/d0 (for ([hd bench] [i (in-range 10)]) (test-hd 'hd-d0 hd i))) (define/provide-test-suite search-tests/d0-widening (for ([hd bench] [i (in-range 10)]) (test-hd 'hd-d0 hd i '(-1)))) (define/provide-test-suite search-tests/d5 (for ([hd bench] [i (in-range 10)]) (test-hd 'hd-d5 hd i))) (run-tests-quiet search-tests/d0) (run-tests-quiet search-tests/d0-widening) (run-tests-quiet search-tests/d5)
false
e254829019abed1464a3cd89f5a5608549a5854e
3e934e1eb7037ebc9ef5461e66981383cab6d373
/examples/heap/freelist-lang.rkt
b188523199637a2009c60e69172b4c4135b2bdc1
[ "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
1,182
rkt
freelist-lang.rkt
#lang seec (require seec/private/util) (require seec/private/monad) (require racket/format) (require (only-in racket/base build-list raise-argument-error raise-arguments-error)) (require (file "lib.rkt")) (provide (all-defined-out)) (define-grammar freelist (action ::= (free natural) alloc) (interaction ::= list<action>) (state ::= list<natural>) ; list of free blocks ) ;; freelist.action -> freelist.state -> freelist.state (define/debug #:suffix (freelist-action a s) (match a [(freelist (free n:natural)) (freelist (cons ,n ,s))] [(freelist alloc) (match s [(freelist nil) s] [(freelist (cons any s+:any)) s+]) ])) ;; freelist.interaction -> freelist.state -> freelist.state (define (freelist-interaction i s) (match i [(freelist (cons a:action i+:interaction)) (freelist-interaction i+ (freelist-action a s))] [(freelist nil) s])) (define-language freelist-lang #:grammar freelist #:expression state #:size 4 #:context interaction #:size 3 #:link cons #:evaluate (uncurry freelist-interaction))
false
184b91389f97d505bd39e03562a2880c32bca63a
5130312f0f3831ada0801a5b73995c9c501d15f7
/ex/capsule.rkt
a777a84dea113ffcee11e7dd996a577bac428358
[ "Apache-2.0" ]
permissive
zen3d/ruckus
5f6ee5f03d764332a889ac7d64e56c11613847f7
45c5928376092ca911afabfba73af28877c87166
refs/heads/master
2020-04-13T17:23:24.756503
2018-12-28T00:36:06
2018-12-28T00:36:06
163,346,905
5
0
NOASSERTION
2018-12-28T00:14:11
2018-12-28T00:14:11
null
UTF-8
Racket
false
false
31
rkt
capsule.rkt
#lang ruckus (capsule 500 50)
false