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
4ee38bb6be90758d0f4d6f6ba8490fc6a8c0265c
a153d785bd40c1f740fb4ae6ab1657e16908b080
/www/notes/grift/compile.rkt
526584e4fcb04c8aeb212ff5711c75ad4bc42e84
[ "AFL-3.0" ]
permissive
Nish-droid/www
7a52c090a508617f1d1f04ec6578d109771d8e9b
0993a9083d570f3643c9fe048ea4f639077c19fd
refs/heads/master
2022-06-05T05:11:32.201145
2020-04-30T22:37:50
2020-04-30T22:37:50
null
0
0
null
null
null
null
UTF-8
Racket
false
false
3,324
rkt
compile.rkt
#lang racket (provide (all-defined-out)) (define imm-shift 1) (define imm-type-mask (sub1 (arithmetic-shift 1 imm-shift))) (define imm-type-int #b0) (define imm-val-true #b11) (define imm-val-false #b01) ;; Expr -> Asm (define (compile e) `(entry ,@(compile-e e '()) ret err (push rbp) (call error) ret)) ;; Expr CEnv -> Asm (define (compile-e e c) (match e [(? integer? i) (compile-integer i)] [(? boolean? b) (compile-boolean b)] [(? symbol? x) (compile-variable x c)] [`(add1 ,e0) (compile-add1 e0 c)] [`(sub1 ,e0) (compile-sub1 e0 c)] [`(zero? ,e0) (compile-zero? e0 c)] [`(if ,e0 ,e1 ,e2) (compile-if e0 e1 e2 c)] [`(let ((,x ,e0)) ,e1) (compile-let x e0 e1 c)] [`(+ ,e0 ,e1) (compile-+ e0 e1 c)] [`(- ,e0 ,e1) (compile-- e0 e1 c)])) ;; Integer -> Asm (define (compile-integer i) `((mov rax ,(arithmetic-shift i imm-shift)))) ;; Boolean -> Asm (define (compile-boolean b) `((mov rax ,(if b imm-val-true imm-val-false)))) ;; Expr CEnv -> Asm (define (compile-add1 e0 c) (let ((c0 (compile-e e0 c))) `(,@c0 ,@assert-integer (add rax ,(arithmetic-shift 1 imm-shift))))) ;; Expr CEnv -> Asm (define (compile-sub1 e0 c) (let ((c0 (compile-e e0 c))) `(,@c0 ,@assert-integer (sub rax ,(arithmetic-shift 1 imm-shift))))) ;; Expr CEnv -> Asm (define (compile-zero? e0 c) (let ((c0 (compile-e e0 c)) (l0 (gensym)) (l1 (gensym))) `(,@c0 ,@assert-integer (cmp rax 0) (mov rax ,imm-val-false) (jne ,l0) (mov rax ,imm-val-true) ,l0))) ;; Expr Expr Expr CEnv -> Asm (define (compile-if e0 e1 e2 c) (let ((c0 (compile-e e0 c)) (c1 (compile-e e1 c)) (c2 (compile-e e2 c)) (l0 (gensym)) (l1 (gensym))) `(,@c0 (cmp rax ,imm-val-false) (je ,l0) ; jump to c2 if #f ,@c1 (jmp ,l1) ; jump past c2 ,l0 ,@c2 ,l1))) ;; Variable CEnv -> Asm (define (compile-variable x c) (let ((i (lookup x c))) `((mov rax (offset rsp ,(- (add1 i))))))) ;; Variable Expr Expr CEnv -> Asm (define (compile-let x e0 e1 c) (let ((c0 (compile-e e0 c)) (c1 (compile-e e1 (cons x c)))) `(,@c0 (mov (offset rsp ,(- (add1 (length c)))) rax) ,@c1))) ;; Expr Expr CEnv -> Asm (define (compile-+ e0 e1 c) (let ((c1 (compile-e e1 c)) (c0 (compile-e e0 (cons #f c)))) `(,@c1 ,@assert-integer (mov (offset rsp ,(- (add1 (length c)))) rax) ,@c0 ,@assert-integer (add rax (offset rsp ,(- (add1 (length c)))))))) ;; Expr Expr CEnv -> Asm (define (compile-- e0 e1 c) (let ((c1 (compile-e e1 c)) (c0 (compile-e e0 (cons #f c)))) `(,@c1 ,@assert-integer (mov (offset rsp ,(- (add1 (length c)))) rax) ,@c0 ,@assert-integer (sub rax (offset rsp ,(- (add1 (length c)))))))) ;; Variable CEnv -> Natural (define (lookup x cenv) (match cenv ['() (error "undefined variable:" x)] [(cons y cenv) (match (eq? x y) [#t (length cenv)] [#f (lookup x cenv)])])) (define assert-integer `((mov rbx rax) (and rbx ,imm-type-mask) (cmp rbx ,imm-type-int) (jne err)))
false
bf6113c0c79569161b5979bac1e9b73a27b6d9bd
e4d80c9d469c9ca9ea464a4ad213585a578d42bc
/Attic/lessons/Defining-Variables/lesson/lesson.scrbl
c6d4e50ebff59a4b6e9893b278691ddcdfe3f873
[]
no_license
garciazz/curr
0244b95086b0a34d78f720e9cae1cb0fdb686ec5
589a93c4a43967b06d7a6ab9d476b470366f9323
refs/heads/master
2021-01-17T19:14:21.756115
2016-02-24T22:16:26
2016-02-24T22:16:26
53,657,555
1
0
null
2016-03-11T09:58:01
2016-03-11T09:58:01
null
UTF-8
Racket
false
false
5,077
scrbl
lesson.scrbl
#lang curr/lib @declare-tags[pedagogy selftaught group] @lesson[#:title "Defining Variables" #:duration "10 minutes"]{ @itemlist/splicing[ @pedagogy{@item{@demo{Have students open their game files, and click Run. They should see a frozen screenshot of their game, using the images they requested. (By now, you should have students' graphics already created, and @(hyperlink "http://www.bootstrapworld.org/materials/resources/teachers/teachers-guide/teachers-guide.html#addingimages" "added to the file)")}}} @item{So far, everything that you've been doing has been down in the Interactions window. What happens when you click Run at the top? All the work you did disappears! @tag[student]{@editor-link[#:definitions-text "4" #:interactions-text "Click Run above. What happens to this line of text?" "See an example."] }} @item{That's because the Interactions window is meant just for trying things out. If you want to define something permanently, you need to use the Definitions window.} @item{The game in front of you is a bare-bones, totally broken game. It doesn't DO anything...YET!} @tag[selftaught]{@item{The following is a bare-bones, totally broken game. It doesn't DO anything...YET!} @item{@editor-link[#:public-id "q3fgrbasAi" "See an example."] }} @item{Look below Step 0, near the top of the screen. @pedagogy{Raise your hand if you can read the line of code just below that (Have a volunteer read it aloud).} @think-about[#:question (list "What will happen if I type " @code{TITLE} " into the Interactions window down at the bottom?") #:hint "Try it out!"]} @item{@think-about[#:question (list "What will happen if you type " @code{TITLE} " into the Interactions window down at the bottom?") #:answer (list "This code tells the computer that the name " @code{TITLE} " is a shortcut for the string " @code{"My Game"} ". When you click Run, the computer learns that name and that shortcut, along with any other definitions.")]} @item{When you click Run, you'll see the title @code{"My Game"} at the top left hand corner of your new game.} @item{This kind of name, which is just a shortcut for some value like a Number, String, or Image, is also called a variable. You've seen other names too, like @code{+} and @code{string-length} that are the names of functions. You'll name your own functions soon.} @item{Change the value of this variable from @code{"My Game"} to YOUR title. Then click Run, and see if the game is updated to reflect the change.} @item{@think-about[#:question "What is the name of the NEXT variable defined in this file? What is its value?" #:answer @code{TITLE-COLOR}] Try changing this value and clicking Run, until your title looks the way you want it to.} @item{For practice, try defining a new variable called @code{author}, and set its value to be the string containing your names. Don't forget - all strings are in quotes! (This won't do anything in the game, but when you close the game window, you can type @code{author} and see its value.) Then you can ask @code{(string-length author)}, etc.} @item{@think-about[#:question "What other variables do you see defined in this file? What is its name? What is its value?"] @pedagogy{Take a volunteer.}} @item{Variables can be more than just strings. They can be numbers, or images! These definitions are where we define the images for your background, player, target, and danger.} @item{As you can see, there are variables that define the @code{BACKGROUND, PLAYER, TARGET} and @code{DANGER} images.} @item{@think-about[#:question (list "What will happen if you type " @code{DANGER} " into the Interactions window down at the bottom?") #:answer (list "This code tells the computer that the name " @code{DANGER} " is a shortcut for a solid, red triangle of size 30. When you click Run, the computer learns that name and that shortcut, along with any other definitions.")]} @item{You can even define long expressions to be a single value. Look closely at the definition of @code{SCREENSHOT}. This definition is a complication expression, which puts all of the game images on top of one another ar various coordinates. The @code{PLAYER} image, for example, is being displayed on top of the @code{BACKGROUND}, at the position @code{(320, 240)}. } @item{@think-about[#:question (list "According to the definition of " @code{SCREENSHOT}", where is the " @code{DANGER}" located?") #:answer (list @code{(150, 200)} )]} @item{Try changing the various coordinates and clicking @bold{Run}, then evaluating @code{SCREENSHOT} in the Interactions window. Can you move the @code{TARGET} to the top-left corner of the screen by changing it's coordinates?} ] }
false
4232c6f0b06727fc6384c94eac4dccfc875d1d63
3c8f0893f3f123a77442eba85e3712f945e9fd49
/Macros/task-7.rkt
d849cf5881ffad64f7f506c3bd39bcff6f4dd016
[ "Apache-2.0", "MIT" ]
permissive
mfelleisen/7GUI
b3ba683841476588beb658450bc7d07043ff6296
ef86aeb1bfac0c098322242116a053fcd280c110
refs/heads/master
2022-02-04T08:06:39.903030
2022-01-20T17:04:46
2022-01-20T17:40:39
189,009,701
60
11
null
2022-01-20T17:40:40
2019-05-28T10:49:37
Racket
UTF-8
Racket
false
false
3,438
rkt
task-7.rkt
#! /usr/bin/env gracket #lang racket/gui ;; a simple spreadsheet (will not check for circularities) (require 7GUI/should-be-racket) (require 7GUI/task-7-exp) (require 7GUI/task-7-view) (require 7GUI/canvas-double-click) (require 7GUI/Macros/7guis 7GUI/Macros/7state) ;; --------------------------------------------------------------------------------------------------- (struct formula (formula dependents) #:transparent) #; {Formula = [formula Exp* || Number || (Setof Ref*)]} (define-syntax-rule (iff selector e default) (let ([v e]) (if v (selector v) default))) (define (get-exp ref*) (iff formula-formula (hash-ref *formulas ref* #f) 0)) (define (get-dep ref*) (iff formula-dependents (hash-ref *formulas ref* #f) (set))) (define (get-content ref*) (hash-ref *content ref* 0)) (define (set-content! ref* vc) (when (and* (get-content ref*) => (lambda (current) (not (= current vc)))) (set! *content (values (hash-set *content ref* vc) ref*)))) (define (propagate-content-change _ ref*) (for ((d (in-set (get-dep ref*)))) (set-content! d (evaluate (get-exp d) *content)))) (define-state *content (make-immutable-hash) propagate-content-change) ;; [Hashof Ref* Integer] (define (set-formula! ref* exp*) (define new (formula exp* (get-dep ref*))) (set! *formulas (values (hash-set *formulas ref* new) ref* (depends-on exp*))) (set-content! ref* (evaluate exp* *content))) (define (propagate-change-to-formulas _ ref dependents) (for ((d (in-set dependents))) (set! *formulas (stop (hash-set *formulas d (formula (get-exp d) (set-add (get-dep d) ref))))))) (define-state *formulas (make-immutable-hash) propagate-change-to-formulas) ;; [HashOF Ref* Formula] ;; --------------------------------------------------------------------------------------------------- (define ccanvas% (class canvas-double-click% (define/augment-final (on-click x y) (content-edit x y)) (define/augment-final (on-double-click x y) (formula-edit x y)) (super-new [paint-callback (lambda (_self dc) (paint-grid dc *content))]))) ;; --------------------------------------------------------------------------------------------------- ;; cells and contents (define ((mk-edit title-fmt validator setter source) x y) (define cell (list (x->A x) (y->0 y))) (when (and (first cell) (second cell)) (define value0 (~a (or (source cell) ""))) (gui #:id D #:frame (class dialog% (super-new [style '(close-button)])) (format title-fmt cell) (text-field% [label #f] [min-width 200] [min-height 80] [init-value value0] [callback (λ (self evt) (when (eq? (send evt get-event-type) 'text-field-enter) (when* (validator (send self get-value)) => (lambda (valid) (setter cell valid) (send D show #f)))))])))) (define content-edit (mk-edit "content for cell ~a" valid-content set-content! get-content)) (define formula-fmt "a formula for cell ~a") (define formula-edit (mk-edit formula-fmt string->exp* set-formula! (compose exp*->string get-exp))) ;; --------------------------------------------------------------------------------------------------- (define-gui frame "Cells" (#:id canvas ccanvas% (min-width (/ WIDTH 2)) (min-height (/ HEIGHT 3)) [style '(hscroll vscroll)])) (send canvas init-auto-scrollbars WIDTH HEIGHT 0. 0.) (send canvas show-scrollbars #t #t) (send frame show #t)
true
8c56f72dd044f7faae81cc22bc754e413e117007
d7aebcc4032eac2ea9bce1c2d5c7913c2b018e2a
/ts-enlace-summer-2019/katas/read-code-stimuli.rkt
bd63d8d168a6e54a36a9c834d28ef21150f7c24e
[]
no_license
thoughtstem/TS-MISC-Katas
30ae708d0c21b024c0d9a71b56e23ac48a976fce
c6fb182cd156968f4ec69eff1d38ae418b0b95f8
refs/heads/master
2020-09-06T20:43:38.439632
2019-12-21T01:18:40
2019-12-21T01:18:40
220,545,197
0
0
null
2019-12-21T01:18:41
2019-11-08T20:48:10
HTML
UTF-8
Racket
false
false
1,457
rkt
read-code-stimuli.rkt
#lang racket (provide stimuli) (require ts-kata-util/katas/main) (define stimuli (list 'data-sci-pict-000 (read "Procedurally generate an image of two small circles side by side.") 'data-sci-pict-001 (read "Procedurally generate an image of four small circles arranged a 2x2 grid.") 'data-sci-pict-002 (read "Procedurally generate an image of three 2x2 grids of circles arranged in a row. Make the middle grid twice as large as the others.") 'data-sci-pict-003 (read "Prodedurally generate an image of text that is upside down.") 'data-sci-pict-004 (read "Procedurally generate an image of text that is sideways.") 'data-sci-pict-005 (read "Procedurally generate an image of text that is double the size of the default.") 'data-sci-pict-006 (read "Procedurally generate an image of text that is sideways and double the size of the default.") 'data-sci-pict-007 (read "Procedurally generate an image of red text.") 'data-sci-pict-008 (read "Procedurally generate an image of green text that is rotated sideways.") 'data-sci-pict-009 (read "Procedurally generate an image of a rectangle with a green border") 'data-sci-pict-010 (read "Procedurally generate an image of text inside a green box.") 'data-sci-pict-011 (read "Procedurally generate a column of four boxes with text inside. Make the first and third box green and the second and fourth box red.") ))
false
aed504d3c965d9d0bcb42aadc66a006e12538fe5
471a04fa9301455c51a890b8936cc60324a51f27
/srfi-lib/srfi/16.rkt
ee7d50cff6dc0c0fbb64b5ed8cc1060cb7a8645a
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "MIT" ]
permissive
racket/srfi
e79e012fda6d6bba1a9445bcef461930bc27fde8
25eb1c0e1ab8a1fa227750aa7f0689a2c531f8c8
refs/heads/master
2023-08-16T11:10:38.100847
2023-02-16T01:18:44
2023-02-16T12:34:27
27,413,027
10
10
NOASSERTION
2023-09-14T14:40:51
2014-12-02T03:22:45
HTML
UTF-8
Racket
false
false
66
rkt
16.rkt
;; Supported by core PLT: #lang scheme/base (provide case-lambda)
false
b29a36f90dd732c860c92534664b09560d1bdf85
658ff2fa09b2a5dbe5dbf7e9807b2cca626a1b4e
/form-elements.rkt
ce439e2e876fb46cbd3e4f6b5087bf6745969104
[]
no_license
dyoo/scribble-bootstrap
84f53143f42c203db1d8ef6665ad515c5508239c
8c5262197d395ca68ef49a235a1b49ef3efdfa81
refs/heads/master
2021-01-23T02:24:28.655968
2012-05-22T21:09:02
2012-05-22T21:09:02
null
0
0
null
null
null
null
UTF-8
Racket
false
false
4,513
rkt
form-elements.rkt
#lang racket/base (require "sxml.rkt" (prefix-in wescheme: "wescheme.rkt") racket/runtime-path racket/stxparam scribble/base scribble/core scribble/decode scribble/html-properties (for-syntax racket/base)) ;; FIXME: must add contracts! (provide row current-row fill-in-the-blank free-response embedded-wescheme ;; Sections worksheet lesson drill ;; Itemizations materials goals) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; This provides form loops and indices (define current-row (make-parameter #f)) (define-syntax (row stx) (syntax-case stx () [(row #:count n body ...) ;; FIXME: set up the parameterizations so we can repeat the content #'(build-list n (lambda (i) (parameterize ([current-row i]) (paragraph (make-style "BootstrapRow" (list (make-alt-tag "div"))) (list body ...)))))])) ;; When creating the ids for the form elements, if we're in the context of a row, ;; add it to the identifier as a ";~a" suffix. (define (resolve-id id) (cond [(current-row) (format "~a;~a" id (current-row))] [else id])) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; One-line input (define (fill-in-the-blank #:id id #:columns (width 50) #:label (label #f)) (sxml->element `(input (@ (type "text") (id ,(resolve-id id)) (width ,(number->string width)) ,@(if label `((placeholder ,label)) '())) ""))) ;; Free form text (define (free-response #:id id #:columns (width 50) #:rows (height 20) #:label (label #f)) (sxml->element `(textarea (@ (id ,(resolve-id id)) (cols ,(number->string width)) (rows ,(number->string height)) ,@(if label `((placeholder ,label)) '())) ""))) ;; Embedded wescheme instances (define (embedded-wescheme #:id id #:public-id (pid #f) #:width (width "90%") #:height (height 500) #:interactions-text (interactions-text #f) #:hide-header? (hide-header? #f) #:hide-footer? (hide-footer? #t) #:hide-definitions? (hide-definitions? #f)) (wescheme:embedded-wescheme #:id (resolve-id id) #:public-id pid #:width width #:height height #:interactions-text interactions-text #:hide-header? hide-header? #:hide-footer? hide-footer? #:hide-definitions? hide-definitions?)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define-runtime-path bootstrap.css "bootstrap.css") (define (bootstrap-sectioning-style name) (make-style name (list (make-css-addition bootstrap.css) ;; Use <div/> rather than <p/> (make-alt-tag "div")))) ;; The following provides sectioning for bootstrap. They provide ;; worksheets, lessons, and drills. (define (worksheet . body) (compound-paragraph (bootstrap-sectioning-style "BootstrapWorksheet") (decode-flow body))) (define (lesson . body) (compound-paragraph (bootstrap-sectioning-style "BootstrapLesson") (decode-flow body))) (define (drill . body) (compound-paragraph (bootstrap-sectioning-style "BootstrapDrill") (decode-flow body))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define (materials . items) (list "Materials:" (apply itemlist items #:style "BootstrapMaterialsList"))) (define (goals . items) (list "Goals:" (apply itemlist items #:style "BootstrapGoalsList")))
true
eb098fd48f4237a3aa5e4f2aa04fea5cbd5fa129
5bbc152058cea0c50b84216be04650fa8837a94b
/experimental/micro/synth/typed/sequencer-note.rkt
c5598487d4f2aa38d28580837f56aa4ca10deb03
[]
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
501
rkt
sequencer-note.rkt
#lang typed/racket/base (provide note) ;; ----------------------------------------------------------------------------- (require benchmark-util) (require/typed/check "sequencer-name-octave-note.rkt" [name+octave->note (-> Symbol Natural Natural)]) ;; ============================================================================= ;; Single note. (: note (-> Symbol Natural Natural (Pairof Natural Natural))) (define (note name octave duration) (cons (name+octave->note name octave) duration))
false
ff0ea980cf8c42c6d209724a49eb51e7ad7e24c4
204668b065a065cd7a76a253b4a6029d7cd64453
/www/midterms/2.scrbl
6a2d37d89683125c6c706e12b8a2f846fd89b88c
[ "AFL-3.0" ]
permissive
shalomlhi/www
9c4cb29ea28132328efeeff8e57e321e57458678
8c5cd01e39aec2fbf0fb350cd56a406878a485ed
refs/heads/main
2023-02-24T23:54:15.886442
2021-01-30T14:23:10
2021-01-30T14:23:10
null
0
0
null
null
null
null
UTF-8
Racket
false
false
8,423
scrbl
2.scrbl
#lang scribble/manual @(require (for-label racket) "../notes/ev.rkt") @title{Midterm 2} @bold{Due: Friday, November 13th 11:59PM} @(define repo "https://classroom.github.com/a/Gv1cRIkD") Midterm repository: @centered{@link[repo repo]} The repository contains a single markdown file @tt{m2.md}, which you can edit to submit your answers to the following questions. Your submission must be pushed by 11:59pm on Friday (unless you have already arranged otherwise). During the 72 hours of the exam period, you may only ask private questions on Discord if you need assistance for the course staff. You may not communicate or collaborate with any one else about the content of this exam. @section[#:tag-prefix "m2"]{Short answer} @bold{Question 1} [12 points] Using only @racket[cons], @racket['()], symbols, and literal numbers, strings, booleans, or characters, write expressions that are equivalent to each of the following: @itemlist[ @item{@verbatim{'(y y z (5) 2)}} @item{@verbatim{'((1 2) . 2)}} @item{@verbatim{'(a . (b . (c)))}} @item{@verbatim{'(a . (b . c))}} @item{@verbatim{`(,(add1 1) . 2)}} @item{@verbatim|{`(,@'(1 2) ,@'(x) ,3)}|} ] For example, @racket['(1 2 3)] is equivalent to @racket[(cons 1 (cons 2 (cons 3 '())))]. @bold{Question 2} [10 points] Is it possible for the following program to run out of memory? Justify your answer. @#reader scribble/comment-reader (racketblock (define (fact x) (if (<= x 1) 1 (* x (fact (sub1 x))))) ) How about this one? Again, justify your answer. @#reader scribble/comment-reader (racketblock (define (fact x) (define (fact-prime acc i) (if (<= i 1) acc (fact-prime (* acc i) (sub1 i)))) (fact-prime 1 x)) ) Hint: consider Jig. @bold{Question 3} [8 points] For each of the following expressions, which subexpressions are in tail position? Assume that the top-level expression is in tail position. @itemlist[ @item{@verbatim{(if (if a0 a1 a2) e1 e2)}} @item{@verbatim{(match e0 [p1 e1] [p2 e2])}} @item{@verbatim{(if e0 (if a0 a1 a2) e2)}} @item{@verbatim{(add1 e0)}} @item{@verbatim{(cons e0 e1)}} ] @section[#:tag-prefix "m2"]{Code generation} @bold{Question 4} [20 points] Suppose we wanted to add a @racket[set-box!] operation to our language. A @racket[(set-box! _e0 _e1)] expression evaluates @racket[_e0] and @racket[_e1]. The result of @racket[_e0] should be a box (otherwise an error is signalled). The box is updated (mutated) to contain the value of @racket[_e1]. Racket's @racket[set-box!] returns a special value called @racket[void], but your compiler may have the expression return any value. Here's an example (note: @racket[let] is used for sequencing here): @ex[ (let ((b (box 10))) (let ((i1 (set-box! b 2))) (unbox b))) ] Implement the following function in the compiler. (You may assume this code will be added to the Knock compiler and may use any functions given to you.) @#reader scribble/comment-reader (racketblock ;; LExpr LExpr CEnv -> Asm ;; Compiler for (set-box! e0 e1) (define (compile-set-box! e0 e1 c) ...) ) @section[#:tag-prefix "m2"]{Program Transformation: Inlining} @bold{Question 5} [20 points] In our @secref["Iniquity"] compiler we introduced function definitions to help us organize our code. Function definitions came along with function @emph{calls}, and unfortunately function calls come with a performance hit. One solution is @emph{inlining}: Taking the body of a funtion definition and replacing a call to that function with an instance of its body. This allows the programmer to have all the benefits of the function abstraction, without the overhead. For example, consider the following program: @#reader scribble/comment-reader (racketblock (begin (define (f x) (+ x 5)) (+ 10 (f 42))) ) If you inlined @tt{f}, the result would be the following program: @#reader scribble/comment-reader (racketblock (begin (define (f x) (+ x 5)) (+ 10 (+ 42 5))) ) Your task is to write and document a function named @tt{inline} which takes a function @tt{f} and a program @tt{p}, and inlines the function @tt{f} @emph{at all uses of @tt{f} in the program} (this includes other function definitions!). @#reader scribble/comment-reader (racketblock (define (inline f p) ;TODO ) ) You can assume that you have a function @tt{fvs} that given an expression, returns a list of all the free variables in that expression. This is be necessary to avoid creating incorrect programs. If dealing with variable clashes and creating new names seems too complicated, you can assume the existence of a function @tt{barendregtify} which given a program makes sure that all variables are unique, running it on the following: @#reader scribble/comment-reader (racketblock (begin (define (f x) (+ x 5)) (define (g x) (+ x 10)) (f (g 10))) ) Would produce something like: @#reader scribble/comment-reader (racketblock (begin (define (f var1) (+ var1 5)) (define (g var2) (+ var2 10)) (f (g 10))) ) Why should you care about @tt{fvs} or @tt{barendregtify}? Well, consider the following inlining: @#reader scribble/comment-reader (racketblock (begin (define (f x) (let ((y 5)) x)) (let ((y 42)) (f y))) ) If you inline @tt{f} without care, you would get the following: @#reader scribble/comment-reader (racketblock (begin (define (f x) (let ((y 5)) x)) (let ((y 42)) (let ((y 5)) y))) ) Now you've changed the program, it would result in 5 instead of 42! You can use @tt{fvs} to figure out which variables might be captured, and deal with that, or you can use @tt{barendregtify} to make sure that all variables are unique. Notice how if we had used @tt{barendregtify} we could have avoided the problem: @#reader scribble/comment-reader (racketblock (begin (define (f var1) (let ((var2 5)) var1)) (let ((var3 42)) (f var3))) ) Then inlining @tt{f} we get: @#reader scribble/comment-reader (racketblock (begin (define (f var1) (let ((var2 5)) var1)) (let ((var3 42)) (let ((var2 5)) var3))) ) You may have to run/call @tt{barendregtify} more than once to ensure correctness, when inlining functions. In addition to your code, make sure you answer the following question as part of your submission: @itemlist[ @item{Recursive functions refer to themselves... What should you do? (You do not have to worry about mutual recursion between sets of functions, for this exam we will assume either a function refers to itself directly, or it is not recusive at all).} ] Other things you should consider: @itemlist[ @item{If @tt{f} does not exist in the program, the program should be unchanged} @item{You have to be careful with variable shadowing/capture.} ] Part A: 5 points from the total of 20 will be given if you can produce the correct inlining of @tt{f} for the following program (you are free to do this by hand): @#reader scribble/comment-reader (racketblock (begin (define (f x) (let ((y (+ x 10))) (let ((z 42)) (+ x (+ y z))))) (define (g x) (f x)) (let ((y 1024)) (g (f y)))) ) Part B: 15 points for completing the implementation below: @#reader scribble/comment-reader (racketblock (define (inline f p) (match p [(prog ds e) ;TODO ])) ) @bold{Question NaN: Extra Credit} [10 points] Provide two graphs in dot format (explained in our lecture on Graphviz/Dot) that shows the difference between interpreters and compilers. You can lay this out however you'd like, but the following items should definitely be present in one, or both, of the graphs (though not necessarily connected in the diagram!). These are in alphabetical order, so don't assume that their order reveals anything about how the diagram should be layed out. If you can think of other things that belong in the diagram, feel free to include them. @itemlist[ @item{Source Language} @item{Target Language} @item{AST} @item{Code-Gen} @item{CPU Execution} @item{Interp} @item{Parser} @item{RTS} @item{Source Language} @item{Target Language} @item{Value/Result} ] In order to get the points for this, we will take your description in dot and run @tt{dot} on it. If it does not produce an output, you will get not points. If it produces an output that is a good-faith effort (i.e. there is a clear attempt and showing the difference between compilers and interpreters, you will get 5 points. If it accurately shows the difference you will get 10 points.
false
c8dd808e7305a2a2786731a8740b1dffc58197f9
3906b8b073a874350da8914107909a90f87f282f
/tamer/normalize.rkt
90e680e805aa564dd90358c056614626897ae0ad
[]
no_license
wargrey/schema
7d99e4f513b6bac5e35d07d19d1e638972c7aad0
860a09a23a01104432be6b990a627afe9d752e66
refs/heads/master
2023-07-07T15:39:11.744020
2023-06-30T16:33:13
2023-06-30T16:33:13
76,066,993
6
2
null
2021-04-17T23:30:43
2016-12-09T20:14:41
Racket
UTF-8
Racket
false
false
375
rkt
normalize.rkt
#lang typed/racket (require (for-syntax "../digitama/normalize.rkt")) (define-syntax (normalize stx) (syntax-case stx [] [(_ name ...) (with-syntax ([(dbname ...) (for/list ([n (in-list (syntax->list #'(name ...)))]) (name->sql (syntax-e n)))]) (syntax/loc stx (begin (displayln dbname) ...)))])) (normalize sqlite-master tableof-key/values deleted?)
true
0cfd068ae71ca762c25812c89d21d84934e825b4
25a6efe766d07c52c1994585af7d7f347553bf54
/gui-test/framework/tests/load.rkt
3f4987746f136e173efc578c1b3fa275c1615e8e
[ "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
racket/gui
520ff8f4ae5704210822204aa7cd4b74dd4f3eef
d01d166149787e2d94176d3046764b35c7c0a876
refs/heads/master
2023-08-25T15:24:17.693905
2023-08-10T16:45:35
2023-08-10T16:45:35
27,413,435
72
96
NOASSERTION
2023-09-14T17:09:52
2014-12-02T03:35:22
Racket
UTF-8
Racket
false
false
2,157
rkt
load.rkt
#lang racket/base (require "test-suite-utils.rkt") (module test racket/base) (load-framework-automatically #f) (define (test/load file exp) (test (string->symbol file) void? `(let ([mred-name ((current-module-name-resolver) 'mred #f #f #t)] [orig-namespace (current-namespace)]) (parameterize ([current-namespace (make-base-namespace)]) (namespace-attach-module orig-namespace mred-name) (eval '(require (lib ,file "framework"))) (with-handlers ([(lambda (x) #t) (lambda (x) (if (exn? x) (exn-message x) (format "~s" x)))]) (eval ',exp) (void)))))) (test/load "gui-utils.rkt" 'gui-utils:next-untitled-name) (test/load "test.rkt" 'test:run-interval) (test/load "splash.rkt" 'start-splash) (test/load "framework-sig.rkt" '(begin (eval '(require mzlib/unit)) (eval '(define-signature dummy-signature^ ((open framework^)))))) (test/load "framework-unit.rkt" 'framework@) (test/load "framework.rkt" '(list test:button-push gui-utils:next-untitled-name frame:basic-mixin)) ;; ensures that all of the names in the signature are provided ;; by (require framework) (test/load "framework.rkt" ;; these extra evals let me submit multiple, independent top-level ;; expressions in the newly created namespace. '(begin (eval '(require mzlib/unit)) (eval '(require (for-syntax scheme/base))) (eval '(require (for-syntax scheme/unit-exptime))) (eval '(define-syntax (signature->symbols stx) (syntax-case stx () [(_ sig) (let-values ([(_1 eles _2 _3) (signature-members #'sig #'whatever)]) (with-syntax ([eles eles]) #''eles))]))) (eval '(require framework/framework-sig)) (eval '(for-each eval (signature->symbols framework^)))))
true
5c44251a3cf9f5aec11c2d9da3a95c7eddad541f
5162661b8ec358d1ac289956c3a23acfe9796c65
/expander.rkt
2cee0d5d5b012deef3f750888a294906238489dc
[ "ISC" ]
permissive
aymanosman/riposte
5e7457f48bbfe594f3b25d8af2a7eef77597f231
84e5975e9364703bff0b330438de59a30f8b5382
refs/heads/master
2020-05-07T08:43:34.057133
2019-04-09T10:33:30
2019-04-09T10:33:30
180,343,436
0
0
null
2019-04-09T10:32:48
2019-04-09T10:32:48
null
UTF-8
Racket
false
false
7,138
rkt
expander.rkt
#lang br/quicklang (require racket/contract (file "evaluator.rkt") (only-in (file "environment.rkt") make-fresh-environment environment?) (only-in (file "assignment.rkt") make-normal-assignment make-header-assignment make-parameter-assignment) (only-in (file "command.rkt") make-command-expression) (only-in (file "json-pointer.rkt") make-json-pointer-expression) (only-in (file "identifier.rkt") make-variable-identifier-expression make-parameter-identifier-expression make-header-identifier-expression make-environment-variable-identifier-expression) (only-in (file "json.rkt") make-json-object-expression) (only-in (file "assertion.rkt") make-response-code-matches-expression) (only-in (file "import.rkt") make-import) (only-in (file "parameters.rkt") param-environment) (only-in (file "step.rkt") step?)) (require (for-syntax (only-in (file "grammar.rkt") parse) (only-in (file "tokenizer.rkt") make-tokenizer))) (define-macro (riposte-module-begin PARSE-TREE) #'(#%module-begin (eval-program PARSE-TREE (param-environment)))) (provide (rename-out [riposte-module-begin #%module-begin])) (define-macro (riposte-program STEPS ...) #'(list STEPS ...)) (provide riposte-program) (define-macro (program-step STEP) #'STEP) (provide program-step) (define-macro-cases assignment [(assignment (normal-assignment ID ":=" VAL)) #'(make-normal-assignment ID VAL)] [(assignment (header-assignment HEADER ":=" VAL)) #'(make-header-assignment HEADER VAL)] [(assignment (parameter-assignment PARAM ":=" VAL)) #'(make-parameter-assignment PARAM VAL)]) (provide assignment) (define-macro (expression EXPR) #'EXPR) (provide expression) (define-macro (json-expression JSEXPR) #'JSEXPR) (provide json-expression) (define-macro-cases json-boolean ["true" #t] ["false" #t]) (provide json-boolean) (define-macro (json-object "{" ITEMS ... "}") #'(make-json-object-expression (remove "," (list ITEMS ...)))) (provide json-object) (define-macro (json-object-item PROP ":" EXPR-OR-ID) #'(cons PROP EXPR-OR-ID)) (provide json-object-item) (define-macro (json-object-property PROP) #'PROP) (provide json-object-property) (define-macro (json-string S) #'S) (provide json-string) (define-macro-cases id [(id (normal-identifier X)) #'(make-variable-identifier-expression X)] [(id (env-identifier X)) #'(make-environment-variable-identifier-expression X)] [(id (env-identifier X "with" "fallback" F)) #'(make-environment-variable-identifier-expression X #:fallback F)]) (provide id) (define-macro (parameter-identifier PARAM) #'(make-parameter-identifier-expression PARAM)) (provide parameter-identifier) (define-macro (normal-identifier ID) #'(make-variable-identifier-expression ID)) (provide normal-identifier) (define-macro (head-id ID) #'(make-header-identifier-expression ID)) (provide head-id) (define-macro-cases command [(command METHOD URI) #'(make-command-expression METHOD URI)] [(command METHOD URI "satisfies" "schema" SCHEMA) #'(list (make-command-expression METHOD URI) (make-schema-assertion (make-response-expression) SCHEMA))] [(command METHOD URI "responds" "with" CODE) #'(list (make-command-expression METHOD URI) (make-response-code-matches-expression CODE))] [(command METHOD URI "responds" "with" CODE "and" "satisfies" SCHEMA) #'(list (make-command-expression METHOD URI) (make-response-code-matches-expression CODE) (make-satisfies-schema-expression SCHEMA))] [(command METHOD URI "with" "headers" HEADERS) #'(make-command-expression METHOD URI #:headers HEADERS)] [(command METHOD URI "with" "headers" HEADERS "satisfies" "schema" SCHEMA) #'(list (make-command-expression METHOD URI #:headers HEADERS) (make-satisfies-schema-expression SCHEMA))] [(command METHOD URI "with" "headers" HEADERS "responds" "with" CODE) #'(list (make-command-expression METHOD URI) (make-response-code-matches-expression CODE))] [(command METHOD URI "with" "headers" HEADERS "responds" "with" CODE "and" "satisfies" "schema" SCHEMA) #'(list (make-command-expression METHOD URI #:headers HEADERS) (make-response-code-matches-expression CODE) (make-satisfies-schema-expression SCHEMA))] [(command METHOD PAYLOAD URI) #'(make-command-expression METHOD URI #:payload PAYLOAD)] [(command METHOD PAYLOAD URI "satisfies" "schema" SCHEMA) #'(list (make-command-expression METHOD URI #:payload PAYLOAD) (make-satisfies-schema-expression SCHEMA))] [(command METHOD PAYLOAD URI "responds" "with" CODE) #'(list (make-command-expression METHOD URI #:payload PAYLOAD) (make-response-code-matches-expression CODE))] [(command METHOD PAYLOAD URI "responds" "with" CODE "and" "satisfies" "schema" SCHEMA) #'(list (make-command-expression METHOD URI #:payload PAYLOAD) (make-response-code-matches-expression CODE) (make-satisfies-schema-expression SCHEMA))] [(command METHOD PAYLOAD URI "with" "headers" HEADERS) #'(make-command-expression METHOD URI #:payload PAYLOAD #:headers HEADERS)] [(command METHOD PAYLOAD URI "with" "headers" HEADERS "and" "satisfies" "schema" SCHEMA) #'(list (make-command-expression METHOD URI #:payload PAYLOAD #:headers HEADERS) (make-satisfies-schema-expression SCHEMA))] [(command METHOD PAYLOAD URI "with" "headers" HEADERS "responds" "with" CODE) #'(list (make-command-expression METHOD URI #:payload PAYLOAD #:headers HEADERS) (make-response-code-matches-expression CODE))] [(command METHOD PAYLOAD URI "with" "headers" HEADERS "responds" "with" CODE "and" "satisfies" "schema" SCHEMA) #'(list (make-command-expression METHOD URI #:payload PAYLOAD #:headers HEADERS) (make-response-code-matches-expression CODE) (make-satisfies-schema-expression SCHEMA))]) (provide command) (define-macro-cases http-response-code [(http-response-code DIGIT-1 DIGIT-2 DIGIT-3) (format "~a~a~a" #'DIGIT-1 #'DIGIT-2 #'DIGIT-3)] [(http-response-code CODE) #'CODE]) (provide http-response-code) (define-macro (json-pointer JP) #'(make-json-pointer-expression JP)) (provide json-pointer) (define-macro (import "import" FILE) (define port (open-input-file (syntax->datum #'FILE))) (define path (build-path 'same (syntax->datum #'FILE))) (define parse-tree (parse path (make-tokenizer port))) (define parse-datum (syntax->datum parse-tree)) (datum->syntax #'FILE parse-datum)) (provide import)
false
e6d67c368f4566108bbcabb7d2808f177038cbb1
50508fbb3a659c1168cb61f06a38a27a1745de15
/turnstile-example/turnstile/examples/linear/lin+cons.rkt
faf061c704316790425ba8a281bfe48d14797aa6
[ "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
2,090
rkt
lin+cons.rkt
#lang turnstile/base (extends "lin+tup.rkt") (require (for-syntax racket/contract)) (provide (type-out MList MList0) cons nil match-list) (define-type-constructor MList #:arity = 1) (define-base-type MList0) (begin-for-syntax (current-linear-type? (or/c MList? MList0? (current-linear-type?)))) (define-typed-syntax cons #:datum-literals (@) ; implicit memory location created [(_ e e_rest) ≫ [⊢ e ≫ e- ⇒ σ] [⊢ e_rest ≫ e_rest- ⇐ (MList σ)] -------- [⊢ (#%app- mcons- e- e_rest-) ⇒ (MList σ)]] ; with memory location given [(_ e e_rest @ e_loc) ≫ [⊢ e ≫ e- ⇒ σ] [⊢ e_rest ≫ e_rest- ⇐ (MList σ)] [⊢ e_loc ≫ e_loc- ⇐ MList0] #:with tmp (generate-temporary #'e_loc) -------- [⊢ (let- ([tmp e_loc-]) (set-mcar!- tmp e-) (set-mcdr!- tmp e_rest-) tmp) ⇒ (MList σ)]]) (define-typed-syntax nil [(_ {ty:type}) ≫ -------- [⊢ '() ⇒ (MList ty.norm)]] [(_) ⇐ (~MList σ) ≫ -------- [⊢ '()]]) (define-typed-syntax match-list #:datum-literals (cons nil @) [(_ e_list (~or [(cons x+:id xs+:id @ l+:id) e_cons+] [(nil) e_nil+]) ...) ≫ #:with [(l x xs e_cons)] #'[(l+ x+ xs+ e_cons+) ...] #:with [e_nil] #'[e_nil+ ...] ; list [⊢ e_list ≫ e_list- ⇒ (~MList σ)] #:with σ_xs ((current-type-eval) #'(MList σ)) #:with σ_l ((current-type-eval) #'MList0) #:mode (make-linear-branch-mode 2) (; cons branch #:submode (branch-nth 0) ([[x ≫ x- : σ] [xs ≫ xs- : σ_xs] [l ≫ l- : σ_l] ⊢ e_cons ≫ e_cons- ⇒ σ_out] #:do [(linear-out-of-scope! #'([x- : σ] [xs- : σ_xs] [l- : σ_l]))]) ; nil branch #:submode (branch-nth 1) ([⊢ [e_nil ≫ e_nil- ⇐ σ_out]])) -------- [⊢ (let- ([l- e_list-]) (if- (null? l-) e_nil- (let- ([x- (mcar- l-)] [xs- (mcdr- l-)]) e_cons-))) ⇒ σ_out]])
false
a5f4e66ba4f966bdb4e2d24a43cb9463fa6cc1dc
62a5febb060b3f02e773f0698d52f4f9d979c7e4
/info.rkt
367fc7e3df31c2a2cf5e6b61da7357d6ed615126
[ "Apache-2.0", "MIT" ]
permissive
thoughtstem/vr-assets
fdd0d1b5d9b1d5da92bdc072b26d4073159f262b
c2748df870b0b5ada94105148dbf6ddb9703f529
refs/heads/master
2020-07-29T15:59:33.542982
2020-06-09T20:26:11
2020-06-09T20:26:11
209,870,920
0
0
NOASSERTION
2020-06-09T20:26:12
2019-09-20T19:58:26
Racket
UTF-8
Racket
false
false
332
rkt
info.rkt
#lang info (define collection "vr-assets") (define deps '("base" "vr-engine")) (define build-deps '("scribble-lib" "racket-doc" "rackunit-lib")) (define scribblings '(("scribblings/manual.scrbl" ()))) (define pkg-desc "Description Here") (define version "0.0") (define pkg-authors '(thoughtstem)) (define test-omit-paths '("demo"))
false
2dfa8d9a7a741e71e34f40f4d45dd417b320a1a8
1bbf982e9aeddd2ab9353e5ea328d2f587702d0a
/initial-state.rkt
24b0c0df5d95f061bf8c53800167cfed6e0ad7aa
[ "LicenseRef-scancode-public-domain" ]
permissive
abduld/evaluator
a19506802f50b59f8c0a605fddd6b3683e01e7c0
2ac21e06e9fbfd8117753ace968cbfa8841e4a55
refs/heads/master
2020-12-29T00:42:12.641444
2015-09-29T19:17:38
2015-09-29T19:17:38
null
0
0
null
null
null
null
UTF-8
Racket
false
false
2,215
rkt
initial-state.rkt
#lang typed/racket/base (require racket/match "core-lang.rkt" "scanner.rkt" "env.rkt" "expander.rkt" ) (provide initial-eval-env initial-expand-env initial-state ) (define (make-initial-state ;; Initial bindings available during evaluation: (src-bindings : (Listof (List Symbol Any))) ;; More bindings only available during the application of a ;; macro transformer: (t-src-bindings : (Listof (List Symbol Any)))) : (Values AstEnv Env CompState) (define core-expand-env : Env (for/fold ((env (empty-Env))) ((entry : (List Symbol Binding) (list (list 'lambda (TransformBinding fun-transform)) (list 'quote (TransformBinding quote-transform)) (list 'syntax (TransformBinding quote-transform)) (list 'let-syntax (TransformBinding let-syntax-transform))))) (match entry ((list name binding) (Env-set env name binding))))) (define-values (eval-env expand-env) (for/fold ((#{eval-env : AstEnv} '()) (#{expand-env : Env} core-expand-env)) ((#{src-binding : (List Symbol Any)} src-bindings)) (match src-binding ((list name val) (values (cons (list (Var name) (scan val)) eval-env) (Env-set expand-env name (VarBinding (Stx (Sym name) (EmptyCtx))))))))) (define t-eval-env (for/fold ((#{t-eval-env : AstEnv} eval-env)) ((#{src-binding : (List Symbol Any)} t-src-bindings)) (match src-binding ((list name val) (cons (list (Var name) (scan val)) t-eval-env))))) (values eval-env expand-env (CompState 0 t-eval-env expand))) (define-values (initial-eval-env initial-expand-env initial-state) (make-initial-state '((cons #%cons) (car #%car) (cdr #%cdr) (list-ref #%list-ref) (list #%list) (stx-e #%stx-e) (mk-stx #%mk-stx) (+ #%+)) '((lvalue #%lvalue) (lexpand #%lexpand))))
false
e5206ca721736ab792ff2c33bca78db045da91c2
3517457ddede47041a1a5d104374575b5b00ba36
/Lab1/Lab1P2.rkt
4725e6ed46d9977ceb916d926d8c496bef0e61a2
[]
no_license
willypan96/CSC324
1e9006c0f2c040f58c9b00f4b2ef5ad0891167e0
0789bd746ab07fe3cedc72bb04d0c8ff5d947799
refs/heads/master
2021-04-30T16:06:00.220229
2017-01-24T02:59:25
2017-01-24T02:59:25
79,950,766
0
1
null
2017-01-24T20:24:50
2017-01-24T20:24:50
null
UTF-8
Racket
false
false
1,655
rkt
Lab1P2.rkt
;; The first three lines of this file were inserted by DrRacket. They record metadata ;; about the language level of this file in a form that our tools can easily process. #reader(lib "htdp-intermediate-reader.ss" "lang")((modname Lab1P2) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f () #f))) (define (number-of-evens a-list) (if (empty? a-list) 0 (+(if (even? (first a-list)) 1 0) (number-of-evens (rest a-list))) )) (define (number-of-strings a-list) (if (empty? a-list) 0 (+(if(string? (first a-list)) 1 0) (number-of-strings (rest a-list))))) (define (number-of-x a-lst pred) (if (empty? a-lst) 0 (if (pred (first a-lst)) (+ 1 (number-of-x (rest a-lst) pred)) (number-of-x (rest a-lst) pred))) ) (define (number-such-that pred a-lst) (if(empty? a-lst) 0 (+ (if (pred (first a-lst)) 1 0) (number-such-that pred (rest a-lst))))) (define (number-of-evens2 a-list) (number-of-x a-list even?)) ;(number-of-evens2 (list 12 345 67 8 90)) ;(number-such-that even? (list 1 2 3 4 5 6)) (check-expect (number-such-that even? (list 12 345 67 8 90)) (number-of-evens (list 12 345 67 8 90))) (check-expect (number-such-that string? (list 324 "Hello" + (list 123 "hi") "" -5.6 "bye")) (number-of-strings (list 324 "Hello" + (list 123 "hi") "" -5.6 "bye"))) (check-expect (number-such-that odd? (list 1 2 3 4 5)) 3) ;(number-of-strings(list 324 324 555))
false
62f0b51d842dcc132a61817469c0e8a931664c55
25de48a75948a2003f01d9763968d344dca96449
/lang/reader.rkt
6e6e5f11604db8e2560c0b592de01cfde2910295
[]
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
316
rkt
reader.rkt
#lang s-exp syntax/module-reader j/private/bindings #:read read-j-module #:read-syntax read-j-module-syntax #:whole-body-readers? #t (require racket/port "../private/read.rkt") (define (read-j-module in) (port->string in)) (define (read-j-module-syntax src in) (datum->syntax #f (read-j-module in)))
false
7b75df3577a3bcb0bc7063e175d05612828fd956
5f8d781ca6e4c9d3d1c3c38d2c04e18d090589cc
/2/www/lectures/6.scrbl
3ee2d9fb4cb569a1af52b3f6b48c7798f8e8d9d2
[ "AFL-3.0", "AFL-2.1", "LicenseRef-scancode-unknown-license-reference" ]
permissive
plum-umd/fundamentals
a8458621131b864f0e3389b030c5197ea6bb3f41
eb01ac528d42855be53649991a17d19c025a97ad
refs/heads/master
2021-06-20T05:30:57.640422
2019-07-26T15:27:50
2019-07-26T15:27:50
112,412,388
12
1
AFL-3.0
2018-02-12T15:44:48
2017-11-29T01:52:12
Racket
UTF-8
Racket
false
false
10,113
scrbl
6.scrbl
#lang scribble/manual @(require scribble/eval racket/sandbox (for-label (only-in lang/htdp-intermediate-lambda define-struct ... check-expect)) (for-label (except-in class/0 define-struct ... check-expect)) (for-label class/universe) "../utils.rkt") @(define the-eval (let ([the-eval (make-base-eval)]) (the-eval '(require (for-syntax racket/base))) (the-eval '(require class/0)) (the-eval '(require 2htdp/image)) (the-eval '(require (prefix-in r: racket))) (the-eval '(require "lectures/7/lon.rkt")) (the-eval '(require "lectures/7/los.rkt")) (the-eval '(require "lectures/7/lox.rkt")) the-eval)) @lecture-title[6]{Parametric Interface Definitions and Methods} @link["https://umd.hosted.panopto.com/Panopto/Pages/Viewer.aspx?id=48f72fe6-8739-484f-90e0-a8800126c62c"]{Video}. In the last lecture, we developed an interface and implementation for lists of numbers: @class-block{ ;; A LoN implements: ;; ;; length : -> Number ;; Compute the length of this list of numbers ;; ;; map : [Number -> Number] -> LoN ;; Apply given function to each element of this list of numbers ;; A (new empty-lon%) implements LoN ;; INTERP: Empty list of numbers (define-class empty-lon% ;; Compute the length of this empty list of numbers (check-expect (send (new empty-lon%) length) 0) (define (length) 0) ;; map : [Number -> Number] -> LoN ;; Apply given function to each element of this empty list of numbers (check-expect (send (new empty-lon%) map add1) (new empty-lon%)) (define (map f) (new empty-lon%))) ;; A (new cons-lon% Number LoN) implements LoN ;; INTERP: Non-empty list of numbers (define-class cons-lon% (fields first rest) ;; length : -> Number ;; Compute the length of this non-empty list of numbers (check-expect (send (new cons-lon% 3 (new cons-lon% 7 (new empty-lon%))) length) 2) (define (length) (add1 (send (send this rest) length))) ;; map : [Number -> Number] -> LoN ;; Apply given function to each element of this non-empty list of numbers (check-expect (send (new cons-lon% 3 (new cons-lon% 7 (new empty-lon%))) map add1) (new cons-lon% 4 (new cons-lon% 8 (new empty-lon%)))) (define (map f) (new cons-lon% (f (send this first)) (send (send this rest) map f)))) } You could imagine doing a similiar development for lists of strings: @class-block{ ;; A LoS implements: ;; ;; length : -> Number ;; Compute the length of this of strings ;; ;; map : [String -> String] -> LoS ;; Apply given function to each element of this list of strings ;; A (new empty-los%) implements LoS ;; INTERP: Empty list of strings (define-class empty-los% ;; Compute the length of this empty list of strings (check-expect (send (new empty-los%) length) 0) (define (length) 0) ;; map : [String -> String] -> LoS ;; Apply the given function to each element of this empty list of strings (check-expect (send (new empty-los%) map string-upcase) (new empty-los%)) (define (map f) (new empty-los%))) ;; A (new cons-los% String LoS) implements LoS ;; INTERP: Non-empty list of strings (define-class cons-los% (fields first rest) ;; length : -> Number ;; Compute the length of this non-empty list of strings (check-expect (send (new cons-los% "a" (new cons-los% "b" (new empty-los%))) length) 2) (define (length) (add1 (send (send this rest) length))) ;; map : [String -> String] -> LoS ;; Apply given function to each element of this non-empty list of strings (check-expect (send (new cons-los% "a" (new cons-los% "b" (new empty-los%))) map string-upcase) (new cons-los% "A" (new cons-los% "B" (new empty-los%)))) (define (map f) (new cons-los% (f (send this first)) (send (send this rest) map f)))) } Of course the obvious thing to observe is that these pairs of programs are very very similar. In fact, the @emph{code} is identical, it's only the signatures that differ. We can see evidence of this by experimenting with the code in ways that break the signatures. Notice that it's possible to correctly compute with lists of strings even when they're represented using the classes for lists of numbers. @examples[#:eval the-eval (send (new cons-lon% "a" (new cons-lon% "b" (new empty-lon%))) length) (send (new cons-lon% "a" (new cons-lon% "b" (new empty-lon%))) map string-upcase) ] This is strong evidence to suggest that @emph{abstraction} is needed to avoid the duplication. Since the differences between these programs is not at the level of @emph{values}, but @emph{data definitions}, we should do abstraction at this level. Let's consider first the interface definitions: @class-block{ ;; A LoN implements: ;; ;; length : -> Number ;; Compute the length of this list of numbers ;; ;; map : [Number -> Number] -> LoN ;; Apply given function to each element of this list of numbers ;; A LoS implements: ;; ;; length : -> Number ;; Compute the length of this of strings ;; ;; map : [String -> String] -> LoS ;; Apply given function to each element of this list of strings } By applying the abstraction process, we arrive at the following @emph{parameterized} interface definition as a first cut: @class-block{ ;; A [Listof X] implements: ;; ;; length : -> Number ;; Compute the length of this list of numbers ;; ;; map : [X -> X] -> [Listof X] ;; Apply given function to each element of this list of numbers } We could then revise the data definitions and signatures of the classes implementing this interface to arrive a single, re-usable program: @class-block{ ;; A (new empty%) implements [Listof X] ;; INTERP: Empty list of Xs (define-class empty% ;; Compute the length of this empty list of Xs (check-expect (send (new empty%) length) 0) (define (length) 0) ;; map : [X -> X] -> [Listof X] ;; Apply given function to each element of this empty list of Xs (check-expect (send (new empty%) map add1) (new empty%)) (define (map f) (new empty%))) ;; A (new cons% X [Listof X]) implements [Listof X] ;; INTERP: Non-empty list of Xs (define-class cons% (fields first rest) ;; length : -> Number ;; Compute the length of this non-empty list of Xs (check-expect (send (new cons% 3 (new cons% 7 (new empty%))) length) 2) (define (length) (add1 (send (send this rest) length))) ;; map : [X -> X] -> [Listof X] ;; Apply given function to each element of this non-empty list of Xs (check-expect (send (new cons% 3 (new cons% 7 (new empty%))) map add1) (new cons% 4 (new cons% 8 (new empty%)))) (define (map f) (new cons% (f (send this first)) (send (send this rest) map f)))) } We can now reconstruct our original programs by applying the parameteric definitions: @tt{[Listof Number]} and @tt{[Listof String]}. We also make new data definitions by applying @tt{Listof} to other things. For example, here's a computation over a @tt{[Listof Boolean]}. @examples[#:eval the-eval (send (new cons% #true (new cons% #false (new empty%))) map not) ] This is a big step forward, but there's an opportunity to do even better. Consider the following. @examples[#:eval the-eval (send (new cons% "a" (new cons% "aa" (new empty%))) map string-length)] This program works fine and makes perfect sense. It computes a length of numbers from a list of strings. However, it has broken the signature of the @tt{map} method since @racket[string-length] does not have the signature @tt{String -> String}, which is what's obtained when plugging in @tt{String} for @tt{X}. This is more evidence that further abstraction is possible. In particular we can loosen the constraints in the signature for @tt{map}: @class-block{ ;; A [Listof X] implements ;; ;; map : [X -> Y] -> [Listof Y] ;; Apply given function to each element of this list of Xs ;; ;; ... } Notice that this method signature makes use of two parameters: @tt{X} and @tt{Y}. The @tt{X} parameter is "bound" at the level, @tt{[Listof X]}. The @tt{Y} is implicitly a parameter of the method's signature. So in an object-oriented setting, these parameters can appear at the interface and class level, but also at the method level. We can do another exercise to write things we've seen before. Let's see what @tt{foldr} looks like: @class-block{ ;; A [Listof X] implements ;; ;; ... ;; ;; foldr : [X Y -> Y] Y -> Y ;; Fold over the elements with the given combining function and base } We can make some examples. @examples[#:eval the-eval (send (new empty%) foldr + 0) (send (new cons% 5 (new cons% 3 (new empty%))) foldr + 0) (send (new empty%) foldr string-append "") (send (new cons% "5" (new cons% "3" (new empty%))) foldr string-append "") ] Let's instantiate the template for @tt{foldr} for @racket[cons%]. @filebox[ (racket cons%) @class-block{ ;; foldr : [X Y -> Y] Y -> Y ;; Fold over this non-empty list of elements with combining function and base (define (foldr f b) (send this first) ... (send (send this rest) foldr f b)) }] Thinking through the examples and templates, we get: @filebox[ (racket empty%) @class-block{ ;; foldr : [X Y -> Y] Y -> Y ;; Fold over this empty list of elements (check-expect (send (new empty%) foldr + 0) 0) (define (foldr f b) b) }] @filebox[ (racket cons\%) @class-block{ ;; foldr : [X Y -> Y] Y -> Y ;; Fold over this empty list of elements (check-expect (send (new cons% 5 (new cons% 3 (new empty%))) foldr + 0) 8) (define (foldr f b) (f (send this first) (send (send this rest) foldr f b))) }] There's an interesting remaining question: how do we write methods that work on specific kinds of lists? For example, if we wanted to write a @tt{sum} method that summed up the elements in a list of numbers, how would we do it? We can't put it into the @tt{[Listof X]} interface since it wouldn't work if @tt{X} stood for string.
false
bd52f5e77927d8a221121844bab59c3f3fabb97a
ca8e30d012f8ab1d6ca29cdf8d6bb584de74b56f
/racket/clojure.rkt
4aa54c54e5c135b00a764aa28637b24bcd80e000
[]
no_license
squest/Lunity
ebf8a6ce8b8f1ad9c3dc45317d4a24f0e067470c
9a36acaf495a1111abad6e4b268ab93746636a95
refs/heads/master
2021-01-19T22:32:57.600559
2014-12-31T19:08:25
2014-12-31T19:08:28
null
0
0
null
null
null
null
UTF-8
Racket
false
false
6,935
rkt
clojure.rkt
#lang racket (require plot) (define-syntax-rule (defn fname fbinding fbody) (define fname (λ fbinding fbody))) (define-syntax-rule (def vname vbody) (define vname vbody)) (define-syntax (graf stx) (syntax-case stx () [(graf fun) #'(plot (function fun) #:x-min -10 #:x-max 10 #:y-min -10 #:y-max 10)] [(graf fun xpair) #'(plot (function fun) #:x-min (first xpair) #:x-max (second xpair) #:y-min -10 #:y-max 10)] [(graf fun xpair ypair) #'(plot (function fun) #:x-min (first xpair) #:x-max (second xpair) #:y-min (first ypair) #:y-max (second ypair))])) (define-syntax (grafs stx) (syntax-case stx () [(graf lst) #'(plot (list (axes) (function lst)) #:x-min -10 #:x-max 10 #:y-min -10 #:y-max 10)] [(graf l1 l2) #'(plot (list (axes) (function l1) (function l2)) #:x-min -10 #:x-max 10 #:y-min -10 #:y-max 10)] [(graf l1 l2 l3) #'(plot (list (axes) (function l1) (function l2) (function l3)) #:x-min -10 #:x-max 10 #:y-min -10 #:y-max 10)])) (define (distinct ls) (remove-duplicates ls)) (define-syntax (igraf stx) (syntax-case stx () [(igraf l1 l2) #'(plot (list (axes) (function-interval l1 l2)) #:x-min -4 #:x-max 4 #:y-min -10 #:y-max 10)])) (define expn (λ (x . ls) (map (λ (m) (expt m x)) ls))) (struct lazy-seq (hd tl)) (define-syntax-rule (lcons x xs) (lazy-seq x (λ () xs))) (define (head lxs) (lazy-seq-hd lxs)) (define (tail lxs) (lazy-seq-tl lxs)) (define (force lxs) (define (all-tail lxs1) (let ([tmp ((lazy-seq-tl lxs1))]) (if (lazy-seq? tmp) (cons (lazy-seq-hd tmp) (all-tail tmp)) tmp))) (cons (lazy-seq-hd lxs) (all-tail lxs))) (define (dec n) (- n 1)) (define (inc n) (+ n 1)) (define (ltake n lxs) (if (= n 0) null (cons (head lxs) (ltake (dec n) ((tail lxs)))))) (define (lrange- start step) (lcons start (lrange- (+ start step) step))) (define lrange (case-lambda [() (lrange- 0 1)] [(start) (lrange- start 1)] [(start step) (lrange- start step)])) (define (geo-seq start step) (lcons start (geo-seq (* start step) step))) (define (ldrop n lxs) (if (zero? n) lxs (if (null? lxs) null (if (list? lxs) (drop lxs n) (ldrop (dec n) ((tail lxs))))))) (define (iterate f i) (lcons i (iterate f (f i)))) (define (take-while f lxs) (define (ltake-while lxs) (let ([tmp (head lxs)]) (if (f tmp) (cons tmp (ltake-while ((tail lxs)))) null))) (define (stake-while lxs) (if (null? lxs) null (let ([tmp (first lxs)]) (if (f tmp) (cons tmp (stake-while (rest lxs))) null)))) (if (list? lxs) (stake-while lxs) (ltake-while lxs))) (define (drop-while f lxs) (define (ldrop-while lxs) (if (f (head lxs)) (ldrop-while ((tail lxs))) lxs)) (define (sdrop-while lxs) (if (null? lxs) null (if (f (first lxs)) (sdrop-while (rest lxs)) lxs))) (if (lazy-seq? lxs) (ldrop-while lxs) (sdrop-while lxs))) (define (lmap f lxs) (lcons (f (head lxs)) (lmap f ((tail lxs))))) (define (lfilter f lxs) (if (f (head lxs)) (cons (head lxs) (lfilter f ((tail lxs)))) (lfilter f ((tail lxs))))) (define (keep f lxs) (define (lkeep lxs) (let ([tmp (f (head lxs))]) (if tmp (lcons tmp (lkeep ((tail lxs)))) (let ([tmp (drop-while (λ (x) (not (f x))) lxs)]) (lcons (head tmp) (lkeep ((tail tmp)))))))) (define (skeep lxs) (if (null? lxs) null (let ([tmp (f (first lxs))]) (if tmp (cons tmp (skeep (rest lxs))) (skeep (rest lxs)))))) (if (lazy-seq? lxs) (lkeep lxs) (skeep lxs))) (define (comp . funs) (define (looper x lst) (if (= 1 (length lst)) ((first lst) x) (looper ((first lst) x) (rest lst)))) (lambda (x) (looper x (reverse funs)))) (define (rc f . num) (lambda (x) (apply f (reverse (cons x (reverse num)))))) (define (lc f . num) (lambda (x) (apply f (cons x num)))) (define (juxt . lst) (define (looper x lxs res) (if (null? lxs) res (looper x (rest lxs) (cons ((first lxs) x) res)))) (lambda (x) (reverse (looper x lst null)))) (define fibolist (case-lambda [() (lmap (juxt first third) (iterate (λ (x) (list (+ (first x) (second x)) (first x) (inc (third x)))) (list 1 1 1)))] [(i) (ltake i (lmap (juxt first third) (iterate (λ (x) (list (+ (first x) (second x)) (first x) (inc (third x)))) (list 1 1 1))))])) (define (take-while-by f g ls) (define (lver lxs) (if (null? lxs) null (if (f (g (first lxs))) (cons (first lxs) (lver (rest lxs))) lxs))) (define (sver lxs) (if (f (g (head lxs))) (cons (head lxs) (sver ((tail lxs)))) null)) (if (list? ls) (lver ls) (sver ls))) (define (drop-while-by f g ls) (define (sver lxs) (if (null? lxs) null (if (f (g (first lxs))) (sver (rest lxs)) lxs))) (define (lver lxs) (if (f (g (head lxs))) (lver ((tail lxs))) lxs)) (if (list? ls) (sver ls) (lver ls))) (define (sort-by f lst) (if (null? lst) null (append (sort-by f (filter (λ (x) (>= (f (first lst)) (f x))) (rest lst))) (list (first lst)) (sort-by f (filter (λ (x) (< (f (first lst)) (f x))) (rest lst)))))) (define reduce (case-lambda [(f lst) (foldl f (first lst) (rest lst))] [(f elmt lst) (foldl f elmt lst)])) (define lreduce (case-lambda [(f g lst) (lreduce f g (head lst) ((tail lst)))] [(f g elmt lst) (letrec ([looper (lambda (res lxs) (if (g res) res (looper (f res (head lxs)) ((tail lxs)))))]) (looper elmt lst))])) (define (negate f) (λ (x) (not (f x))))
true
cf034d02c2c464edd1365a7baec8cca04d063c9f
9900dac194d9e0b69c666ef7af5f1885ad2e0db8
/Tests/IndexModuleTypeTests.rkt
4982e3eaf73e3b6ce7f75ebd731e1f15119d9770
[]
no_license
atgeller/Wasm-prechk
b1c57616ce1c7adbb4b9a6e1077aacfa39536cd2
6d04a5474d3df856cf8af1877638b492ca8d0f33
refs/heads/canon
2023-07-20T10:58:28.382365
2023-07-11T22:58:49
2023-07-11T22:58:49
224,305,190
5
1
null
2021-07-01T18:09:17
2019-11-26T23:34:11
Racket
UTF-8
Racket
false
false
3,428
rkt
IndexModuleTypeTests.rkt
#lang racket (module+ test (require "../IndexTypingRules.rkt" "../IndexModuleTyping.rkt" "../SubTyping.rkt" redex/reduction-semantics rackunit) (define ticond0 `(((i32 a) (i32 b)) () ((empty (i32 a)) (i32 b)) empty)) (define ticond1 `(() ((i32 a) (i32 b)) ((empty (i32 a)) (i32 b)) empty)) (define ticond2 `(((i32 a_2)) ((i32 a) (i32 b)) (((empty (i32 a)) (i32 b)) (i32 a_2)) (empty (= a_2 a)))) (define ticond2_1 `(() ((i32 a) (i32 b)) (((empty (i32 a)) (i32 b)) (i32 a_2)) (empty (= a_2 a)))) (define ticond3 `(((i32 a_2) (i32 b_2)) ((i32 a) (i32 b)) ((((empty (i32 a)) (i32 b)) (i32 a_2)) (i32 b_2)) ((empty (= a_2 a)) (= b_2 b)))) (define ticond3_1 `(((i32 b_2)) ((i32 a) (i32 b)) ((((empty (i32 a)) (i32 b)) (i32 a_2)) (i32 b_2)) ((empty (= a_2 a)) (= b_2 b)))) (define ticond4 `(((i32 c)) ((i32 a) (i32 b)) (((((empty (i32 a)) (i32 b)) (i32 a_2)) (i32 b_2)) (i32 c)) (((empty (= a_2 a)) (= b_2 b)) (= c (add a_2 b_2))))) (define ticond5 `(((i32 c)) () (((empty (i32 a)) (i32 b)) (i32 c)) (empty (= c (add a b))))) (define ticond5_1 `(((i32 c)) ((i32 a) (i32 b)) (((empty (i32 a)) (i32 b)) (i32 c)) (empty (= c (add a b))))) (define context1 (term ((func (,ticond0 -> ,ticond5)) (global) (table) (memory) (local) (label) (return)))) (define context1-inner (term ((func (,ticond0 -> ,ticond5)) (global) (table) (memory) (local i32 i32) (label ,ticond5_1) (return ,ticond5_1)))) (define deriv1 (derivation `(⊢ ,context1-inner ((get-local 0)) (,ticond1 -> ,ticond2)) "Get-Local" (list))) (test-judgment-holds ⊢ deriv1) (define deriv2_0 (derivation `(⊢ ,context1-inner ((get-local 1)) (,ticond2_1 -> ,ticond3_1)) "Get-Local" (list))) (test-judgment-holds ⊢ deriv2_0) (define deriv2_1 (derivation `(⊢ ,context1-inner ((get-local 1)) (,ticond2 -> ,ticond3)) "Stack-Poly" (list deriv2_0))) (test-judgment-holds ⊢ deriv2_1) (define deriv2 (derivation `(⊢ ,context1-inner ((get-local 0) (get-local 1)) (,ticond1 -> ,ticond3)) "Composition" (list deriv1 deriv2_1 ))) (test-judgment-holds ⊢ deriv2) (define deriv3_0 (derivation `(⊢ ,context1-inner ((i32 add)) (,ticond3 -> ,ticond4)) "Binop" (list))) (test-judgment-holds ⊢ deriv3_0) (define deriv3 (derivation `(⊢ ,context1-inner ((get-local 0) (get-local 1) (i32 add)) (,ticond1 -> ,ticond4)) "Composition" (list deriv2 deriv3_0))) (test-judgment-holds ⊢ deriv3) (define deriv4 (derivation `(⊢-module-func ,context1 (() (func (,ticond0 -> ,ticond5) (local () ((get-local 0) (get-local 1) (i32 add))))) (() (,ticond0 -> ,ticond5))) #f (list deriv3))) (test-judgment-holds ⊢-module-func deriv4) )
false
47a2f76835fa53e0d1e3aeb3c5e9c30ec2d9d72d
d0d656b7729bd95d688e04be38dde7d8cde19d3d
/3/1/1/solution.3.4.rkt
e4539224ee1a84843b1509905db315623a5e9e4f
[ "MIT" ]
permissive
search-good-project/SICP-in-Racket
f0157335a1d39c8ff4231e579fc13b0297c07e65
daaae62db83bf8e911f4b8dbd00f8509113f557a
refs/heads/master
2022-02-20T01:21:33.633182
2019-09-16T03:58:02
2019-09-16T03:58:02
null
0
0
null
null
null
null
UTF-8
Racket
false
false
1,688
rkt
solution.3.4.rkt
#lang sicp (define (call-the-cops) "calling 110....") (define (make-account balance password) (let ((times 7) (remaining-try 7)) (define (correct-password? pw) (if (eq? pw password) (begin (set! remaining-try times) #t) (begin (set! remaining-try (- remaining-try 1)) #f))) (define (meeting-wrong-password m) (if (<= remaining-try 0) (call-the-cops) "Incorrect password")) (define (withdraw amount) (if (>= balance amount) (begin (set! balance (- balance amount)) balance) "Insufficient funds")) (define (deposit amount) (begin (set! balance (+ balance amount)) balance)) (define (dispatch pw m) (if (correct-password? pw) (cond ((eq? m 'withdraw) withdraw) ((eq? m 'deposit) deposit) (else (error "Unknow request --- MAKE-ACCOUNT" m))) meeting-wrong-password)) dispatch)) (define acc (make-account 100 'secret-password)) ((acc 'secret-password 'withdraw) 40) ((acc 'secret-password 'deposit) 120) ((acc 'wrong-password 'withdraw) 40) ;;; 1 ((acc 'wrong-password 'withdraw) 40) ;;; 2 ((acc 'wrong-password 'withdraw) 40) ;;; 3 ((acc 'wrong-password 'withdraw) 40) ;;; 4 ((acc 'wrong-password 'withdraw) 40) ;;; 5 ((acc 'wrong-password 'withdraw) 40) ;;; 6 ;;; 注意题目里面说的是 ;;; 连续访问 ;;; 所以,如果每次输入正确的密码后,都会重置尝试次数 ;;; ((acc 'secret-password 'deposit) 120) ((acc 'wrong-password 'withdraw) 40) ;;; 7 ((acc 'wrong-password 'withdraw) 40) ;;; 8
false
03f7173a53748d21ed970546c4590b3351732af5
b08b7e3160ae9947b6046123acad8f59152375c3
/Programming Language Detection/Experiment-2/Dataset/Train/Racket/use-another-language-to-call-a-function-1.rkt
dac98aadfc4db440a29ea79a916cb6651a8566a0
[]
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
73
rkt
use-another-language-to-call-a-function-1.rkt
typedef int strfun (char * Data, size_t * Length); strfun *Query = NULL;
false
83a571e071c35da00f8978c6a5911f5d17c90a16
08fbdb00feb0191adc5db86507fdd79c2fb308e7
/objects/point-class.rkt
af368e16cd9df257cdf8967c97d100ecaead96fe
[]
no_license
mkohlhaas/mflatt-macro-dsl-tutorial
dad0e24cb47811c6ec9548e612757e7525ecd1ca
b8b2ffaffe2bde27c2ff3ad25917ca250a34795d
refs/heads/master
2022-10-21T23:28:02.799348
2020-06-16T03:19:32
2020-06-16T03:19:32
271,256,333
0
0
null
null
null
null
UTF-8
Racket
false
false
628
rkt
point-class.rkt
#lang racket/base (require "class.rkt" racket/math) (define point-class (class [x y] ; fields (define (get-x) x) ; methods (define (get-y) y) (define (set-x v) (set! x v)) (define (set-y v) (set! y v)) (define (rotate degrees) (define pt (make-rectangular x y)) (define new-pt (make-polar (magnitude pt) (+ (angle pt) (* pi (/ degrees 180))))) (set! x (real-part new-pt)) (set! y (imag-part new-pt))))) (define a-pt (make-object point-class 0 5)) (send a-pt set-x 10) (send a-pt rotate 90) (send a-pt get-x) (send a-pt get-y)
false
750a8e54c872fa4a20a117b1e887f01b36815c22
863be632226fd9cdf31e26a26bc2433e1b4c196a
/code/iswim/generators.rkt
9a7549a85003a437b73e15a64b2816bda8222730
[]
no_license
dvanhorn/oaam
6902a03a70f19367960e389eeb277d9684dc9ca2
79bc68ecb79fef45474a948deec1de90d255f307
refs/heads/master
2021-01-20T08:48:50.237382
2017-04-06T17:17:35
2017-04-06T17:17:35
6,099,975
24
2
null
2017-04-06T17:17:36
2012-10-06T05:03:44
Racket
UTF-8
Racket
false
false
8,627
rkt
generators.rkt
#lang racket (provide aval^ widen) (require "ast.rkt" "data.rkt" "progs.rkt" racket/generator (for-syntax syntax/parse) racket/stxparam) ;; 0CFA in the AAM style on some hairy Church numeral churning ;; + compilation phase ;; + lazy non-determinism ;; + specialized step & iterator ;; State = (cons Conf Store) ;; State^ = (cons (Set Conf) Store) ;; Comp = Store Env Cont -> (values State StoreΔ) ;; We use generators that produce many steps as (define-syntax-rule (generator^ formals body1 body ...) (infinite-generator (yield (generator formals body1 body ... (yield 'done))))) (define <- (case-lambda)) (begin-for-syntax (define-syntax-class ids #:attributes ((is 1)) (pattern (~or (~and i:id (~bind [(is 1) (list #'i)])) (is:id ...)))) (define-syntax-class guards #:attributes ((guard-forms 1) (gv 2) (gfrome 1)) #:literals (<-) (pattern ((~and (~seq [is:ids e:expr] ...) (~seq start:expr ...)) (~optional (~seq [v:ids <- frome:expr] ...) #:defaults ([(v 1) #'()] [(frome 1) #'()]))) #:with (guard-forms ...) #'(start ...) #:with ((gv ...) ...) #'((v.is ...) ...) #:with (gfrome ...) #'(frome ...) ))) (define-syntax (for/get-vals stx) (syntax-parse stx [(_ form:id targets:expr gs:guards body1:expr body:expr ...) (syntax/loc stx (form targets (gs.guard-forms ...) (let*-values ([(gs.gv ...) gs.gfrome] ...) body1 body ...)))])) (define-syntax-rule (for*/append guards body1 body ...) (for/get-vals for*/fold ([res '()]) guards (append (let () body1 body ...) res))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; "Compiled" Machine ;; Compile away interpretive overhead of "ev" states ;; Expr -> Comp (define (compile e) (match e [(var l x) (λ (∆ ρ k) (values (co^ k (addr (lookup-env ρ x))) ∆))] [(num l n) (λ (∆ ρ k) (values (co^ k n) ∆))] [(bln l b) (λ (∆ ρ k) (values (co^ k b) ∆))] [(lam l x e) (define c (compile e)) (λ (∆ ρ k) (values (co^ k (clos l x c ρ)) ∆))] [(rec f (lam l x e)) (define c (compile e)) (λ (∆ ρ k) (values (co^ k (rlos l f x c ρ)) ∆))] [(app l e0 e1) (define c0 (compile e0)) (define c1 (compile e1)) (λ (∆ ρ k) (define-values (∆* a) (push∆ ∆ l ρ k)) (c0 ∆* ρ (ar c1 ρ a)))] [(ife l e0 e1 e2) (define c0 (compile e0)) (define c1 (compile e1)) (define c2 (compile e2)) (λ (∆ ρ k) (define-values (∆* a) (push∆ ∆ l ρ k)) (c0 ∆* ρ (ifk c1 c2 ρ a)))] [(1op l o e) (define c (compile e)) (λ (∆ ρ k) (define-values (∆* a) (push∆ ∆ l ρ k)) (c ∆* ρ (1opk o a)))] [(2op l o e0 e1) (define c0 (compile e0)) (define c1 (compile e1)) (λ (∆ ρ k) (define-values (∆* a) (push∆ ∆ l ρ k)) (c0 ∆* ρ (2opak o c1 ρ a)))])) ;; Store (Addr + Val) -> Set Val (define (get-val σ v) (match v [(addr loc) (hash-ref σ loc (λ () (error "~a ~a" loc σ)))] [_ (set v)])) (define-syntax-rule (do/noyield guards body1 body ...) (for*/append guards (define v (let () body1 body ...)) (cond [(list? v) v] [else '()]))) (define-syntax-rule (do guards body1 body ...) (yield (do/noyield guards body1 body ...))) (define-syntax-rule (memo-lambda (id) body1 body ...) (let ([h (make-hash)]) (λ (id) (match (hash-ref h id #f) ;; XXX: not robust to returning #f [#f (define v (let () body1 body ...)) (hash-set! h id v) v] [v v])))) ;; "Bytecode" interpreter ;; State -> State^ (define step-compiled^ (memo-lambda (s) (define (ap-op^ o vs k yield) (match* (o vs) [('zero? (list (? number? n))) (yield (co^ k (zero? n)))] [('sub1 (list (? number? n))) (yield (co^ k (widen (sub1 n))))] [('add1 (list (? number? n))) (yield (co^ k (widen (add1 n))))] [('zero? (list 'number)) (yield (co^ k #t)) (yield (co^ k #f))] [('sub1 (list 'number)) (yield (co^ k 'number))] [('* (list (? number? n) (? number? m))) (yield (co^ k (widen (* m n))))] [('* (list (? number? n) 'number)) (yield (co^ k 'number))] [('* (list 'number 'number)) (yield (co^ k 'number))] ;; Anything else is stuck [(_ _) '()])) (define (ap^ σ fun a k yield) (match fun [(or (? clos?) (? rlos?)) (do/noyield ([(v ∆) <- (bind σ fun a k)]) (yield v) ∆)] ;; Anything else is stuck [_ '()])) (match s [(co^ k v) (match k ['mt (generator^ (σ) (do ([v (get-val σ v)]) (yield (ans^ v))))] [(ar c ρ l) (define-values (v* ∆) (c '() ρ (fn v l))) (generator^ (σ) (yield v*) (yield ∆))] [(fn f l) (generator^ (σ) (do ([k (get-cont σ l)] [f (get-val σ f)]) (ap^ σ f v k yield)))] [(ifk c a ρ l) (generator^ (σ) (do ([k (get-cont σ l)] [v (get-val σ v)] [(c* ∆) <- ((if v c a) '() ρ k)]) (yield c*) ∆))] [(1opk o l) (generator^ (σ) (do ([k (get-cont σ l)] [v (get-val σ v)]) (ap-op^ o (list v) k yield)))] [(2opak o c ρ l) (define-values (v* ∆) (c '() ρ (2opfk o v l))) (generator^ (σ) (yield v*) (yield ∆))] [(2opfk o u l) (generator^ (σ) (do ([k (get-cont σ l)] [v (get-val σ v)] [u (get-val σ u)]) (ap-op^ o (list v u) k yield)))])] [_ (generator^ (σ) s)]))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; 0CFA-style Abstract semantics (define (widen b) (cond [(number? b) 'number] [else (error "Unknown base value" b)])) (define (bind σ fun v k) (match fun [(clos l x c ρ) (c (list (cons x (get-val σ v))) (extend ρ x x) k)] [(rlos l f x c ρ) (c (list (cons f (set (rlos l f x c ρ))) (cons x (get-val σ v))) (extend (extend ρ x x) f f) k)])) (define (push∆ ∆ l ρ k) (values (cons (cons l (set k)) ∆) l)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Exp -> Set Val ;; 0CFA with store widening and specialized iteration (define (aval^ e) (define fst (inj e)) (define snd (wide-step-specialized fst)) ;; wide-step-specialized is monotonic so we only need to check the current ;; state against it's predecessor to see if we have reached a fixpoint. (let loop ((next snd) (prev fst)) (cond [(equal? next prev) (for/set ([c (cdr prev)] #:when (ans^? c)) (ans^-v c))] [else (loop (wide-step-specialized next) next)]))) ;; Exp -> Set State (define (inj e) (define-values (cs ∆) ((compile e) '() (hash) 'mt)) (cons (update ∆ (hash)) (set cs))) (define (update ∆ σ) (match ∆ ['() σ] [(cons (cons a xs) ∆) (update ∆ (join σ a xs))])) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Widening State to State^ ;; State^ -> State^ ;; Specialized from wide-step : State^ -> { State^ } ≈ State^ -> State^ (define (wide-step-specialized state) (match state [(cons σ cs) (define-values (cs* ∆) (for/fold ([cs* (set)] [∆* '()]) ([c cs]) (define step (step-compiled^ c)) (define stepper (step)) (define-values (cs** ∆**) (for/fold ([cs** cs*] [last #f]) ([c (in-producer stepper (λ (x) (eq? x 'done)) σ)]) (cond [last (values (set-add cs** last) c)] [else (values cs** c)]))) (define-values (cs*** ∆***) (cond [(list? ∆**) (values cs** (append ∆** ∆*))] [else (values (set-add cs** ∆**) ∆*)])) (values cs*** ∆***))) (cons (update ∆ σ) (set-union cs cs*))])) (time (aval^ (let-values ([(e _) (parse church)]) e)))
true
7f1c6360bbf688233beb016eb9be1c53127d2fed
90b1285ab0be28a3be88910317e1e869385e3c0c
/pkg-update-experiment.rkt
5127c52e3c09c95f7250060f0e1b60c718876981
[ "MIT" ]
permissive
Blaisorblade/racket-playground
87b0f965349d81a10ad8cb739417f811ae2e0f43
1df9ea15b3997b81f5d616494ccf9940624a00ac
refs/heads/master
2016-09-05T13:07:28.997674
2015-11-02T00:14:01
2015-11-02T00:14:01
42,053,389
0
0
null
null
null
null
UTF-8
Racket
false
false
409
rkt
pkg-update-experiment.rkt
#lang racket (require net/git-checkout) (require pkg/lib) (define (get-pkg-checksum pkg-name) (define info (for/or ([scope (in-list (get-all-pkg-scopes))]) (hash-ref (installed-pkg-table #:scope scope) pkg-name #f))) (and info (pkg-info-checksum info))) (equal? (git-checkout "github.com" "ps-tuebingen/handin" #:dest-dir #f #:ref "deploy-production") (get-pkg-checksum "utue-info1-ws15"))
false
a8a8314d0da178c9ac0abf49cacaae4962b139c1
35fe68b15802fca23ba473e971360b98349c24aa
/tessellation.rkt
5632c710abe236bedb2cc149a0ad291c27138115
[ "Apache-2.0" ]
permissive
zkry/tessellation
f6db8cac727939ca1da43018957af31630f1c464
6f881912eb35592f96539485e7bdd62bdc329528
refs/heads/master
2020-07-10T16:03:07.801675
2020-07-05T12:29:49
2020-07-05T12:29:49
204,306,256
26
1
Apache-2.0
2020-07-05T12:29:50
2019-08-25T14:33:56
Racket
UTF-8
Racket
false
false
7,007
rkt
tessellation.rkt
#lang racket (require metapict) (require (for-syntax racket/list racket/format)) (define node-size 0.3) (define (set-scale scale) (match scale ['small (set-curve-pict-size 500 500) (set! node-size 0.03)] ['medium (set-curve-pict-size 800 800) (set! node-size 0.03)] ['large (set-curve-pict-size 1200 1200) (set! node-size 0.015)] ['x-large (set-curve-pict-size 2400 2400) (set! node-size 0.01)])) (set-scale 'large) (struct base-grid (points shapes) #:prefab) (struct filled-curve (curve) #:prefab) ;; How do I define the same thing (constant) for multiple levels? (define-for-syntax pt-ids (let ((base-ids (map (lambda (offset) (string (integer->char (+ (char->integer #\a) offset)))) (range 26)))) (append base-ids (for*/list ((i base-ids) (j base-ids)) (~a i j))))) (define pt-ids (let ((base-ids (map (lambda (offset) (string (integer->char (+ (char->integer #\a) offset)))) (range 26)))) (append base-ids (for*/list ((i base-ids) (j base-ids)) (~a i j))))) (define-for-syntax (pt-id stx) (and (identifier? stx) (index-of pt-ids (symbol->string (syntax->datum stx))))) (define (pt-id stx) (and (identifier? stx) (index-of pt-ids (symbol->string (syntax->datum stx))))) (define (pt-equal? a b) (and (< (abs (- (pt-x a) (pt-x b))) 1e-5) (< (abs (- (pt-y a) (pt-y b))) 1e-5))) ;; points-deduplicate returns the set of points in a ;; not in b. (define (pt-deduplicate a b) (filter (lambda (pa) (not (for/or ([pb b]) (pt-equal? pa pb)))) a)) (define (map-bez bezs f) (map (lambda (b) (bez (f (bez-p0 b)) (f (bez-p1 b)) (f (bez-p2 b)) (f (bez-p3 b)))) bezs)) (define square-frame (list (curve (pt -1 -1) .. (pt -1 1)) (curve (pt -1 1) .. (pt 1 1)) (curve (pt 1 1) .. (pt 1 -1)) (curve (pt -1 -1) .. (pt 1 -1)))) (define (rotate90 c) (define (rotate90-curve c) (list c ((rotatedd (- 90)) c))) (flatten (map rotate90-curve (flatten c)))) (define (rotate45 c) (define (rotate45-curve c) (list c ((rotatedd (- 45)) c))) (flatten (map rotate45-curve (flatten c)))) (define (rotate-curve-lambda angle n) (lambda (c) (map (lambda (n) ((rotatedd (* n angle)) c)) (range n)))) (define (rotate/4 c) (flatten (map (rotate-curve-lambda 90.0 4) (flatten c)))) (define (rotate/8 c) (flatten (map (rotate-curve-lambda 45.0 8) (flatten c)))) (define (rotate/16 c) (flatten (map (rotate-curve-lambda 22.5 16) (flatten c)))) (define (hmirror c) (define (pt-hflip p) (pt (- (pt-x p)) (pt-y p))) (define (hmirror-curve c) (defm (curve closed? bezs) c) (list c (curve: closed? (map-bez bezs pt-hflip)))) (flatten (map hmirror-curve (flatten c)))) (define (vmirror c) (define (pt-vflip p) (pt (pt-x p) (- (pt-y p)))) (define (vmirror-curve c) (defm (curve closed? bezs) c) (list c (curve: closed? (map-bez bezs pt-vflip)))) (flatten (map vmirror-curve (flatten c)))) ;; Return lambda that translates curve by x, y. Used for tessellation. (define (translate x y) (define (translate-pt x y) (lambda (p) (pt (+ x (pt-x p)) (+ y (pt-y p))))) (lambda (c) (match c [(? filled-curve?) (let ((c (filled-curve-curve c))) (defm (curve closed? bezs) c) (fill (curve: closed? (map-bez bezs (translate-pt x y)))))] [_ (defm (curve closed? bezs) c) (curve: closed? (map-bez bezs (translate-pt x y)))]))) (define (fill-wrap x) (map filled-curve (flatten x))) (define-syntax (process-curve stx) (syntax-case stx () [(_ points (f x ...)) (if (equal? (syntax->datum #'f) 'fill) #'(process-curve points (fill-wrap x ...)) ; We want process-curve to remove all instances of fill, so replace fill with identity. #'(f (process-curve points x) ...))] [(_ points id) (if (pt-id #'id) #'(list-ref points (pt-id #'id)) #'id)])) (define-syntax (generate-grid stx) (syntax-case stx () [(_ curve ...) #'(let ((points '()) (shapes '())) (let* ((processed-curves (flatten (process-curve points curve))) (new-points (for*/fold ([pt-acc '()]) ;; Compare every shape with every other shape ([i (append shapes processed-curves)] [j (flatten (list processed-curves))]) (if (equal? i j) ; If the shape is being compared with itself, pt-acc ; skip it. ;; Calculate the intersections of shapes i and j, then deduplicate the points ;; and add it to the accumulated list. (let ((next-pts (pt-deduplicate (intersection-points i j) pt-acc))) (append pt-acc next-pts)))))) (set! points (append points (pt-deduplicate new-points points))) (set! shapes (append shapes (flatten processed-curves)))) ... (base-grid points shapes))])) (def (node p id) (def circ (circle p node-size)) (def filled (color "white" (fill circ))) (def label (label-cnt (~a id) p)) (draw filled circ label)) (define (display-grid grid) (draw (for/draw ([s (base-grid-shapes grid)]) s) (for/draw ([pt (base-grid-points grid)] [id pt-ids]) (node pt id)))) ;; TODO: DRY this macro up. (define-syntax (tessellate stx) (syntax-case stx () [(_ g (width-start width-end) (height-start height-end) curves ...) #'(draw (for/draw ([xy (for*/list ([x (range (* 2 width-start) (* 2 (add1 width-end)) 2)] [y (range (* 2 height-start) (* 2 (add1 height-end)) 2)]) (cons x y))]) (for/draw ([s (map (translate (car xy) (cdr xy)) (flatten (list (process-curve (base-grid-points g) curves) ...)))]) s)))] [(_ g width height curves ...) #'(draw (for/draw ([xy (for*/list ([x (range 0 (* 2 width) 2)] [y (range 0 (* 2 height) 2)]) (cons x y))]) (for/draw ([s (map (translate (car xy) (cdr xy)) (flatten (list (process-curve (base-grid-points g) curves) ...)))]) s)))])) (define-syntax (with-grid stx) (syntax-case stx () [(_ grid body ...) #'(let ((points (base-grid-points grid))) (process-curve points body) ...)])) (provide set-scale with-grid tessellate display-grid generate-grid vmirror hmirror rotate/4 rotate/8 rotate/16 rotate90 rotate45 square-frame (all-from-out metapict))
true
476a9d799a3b989b204c728668e1a1918b1da8e6
602770a7b429ffdae579329a07a5351bb3858e7a
/data-lib/data/order.rkt
77bfd1c432d9445142c431fc9a130ba9185dc705
[ "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
racket/data
42c9a905dc9ce8716faf39698c5efbc0a95f1fbe
0b23dd66639ffd1d62cf690c26cbd58b508da609
refs/heads/master
2023-08-17T06:57:08.477218
2023-06-08T18:09:32
2023-06-08T19:34:18
27,431,296
15
23
NOASSERTION
2023-06-08T19:34:20
2014-12-02T12:21:39
Racket
UTF-8
Racket
false
false
10,861
rkt
order.rkt
#lang racket/base (require racket/dict racket/contract/base racket/string ffi/unsafe/atomic racket/private/generic) (define ordering/c (or/c '= '< '>)) (provide ordering/c) ;; we use the private version here because we need to ;; provide a backwards compatible interface (just in case) ;; i.e., exporting prop:ordered-dict as opposed to using a ;; generated hidden property. (define-primitive-generics (ordered-dict gen:ordered-dict prop:ordered-dict ordered-methods ordered-dict? ordered-dict-implements?) #:fast-defaults () #:defaults () #:fallbacks () #:derive-properties () (dict-iterate-least ordered-dict) (dict-iterate-greatest ordered-dict) (dict-iterate-least/>? ordered-dict key) (dict-iterate-least/>=? ordered-dict key) (dict-iterate-greatest/<? ordered-dict key) (dict-iterate-greatest/<=? ordered-dict key)) (define extreme-contract (->i ([d ordered-dict?]) [_r (d) (or/c #f (dict-iter-contract d))])) (define search-contract (->i ([d ordered-dict?] [k (d) (dict-key-contract d)]) [_r (d) (or/c #f (dict-iter-contract d))])) (define prop:ordered-dict-contract (let ([e (or/c extreme-contract #f)] ;; generics initializes with #f, ; then sets the methods [s (or/c search-contract #f)]) (vector/c e ;; iterate-least e ;; iterate-greatest s ;; iterate-least/>? s ;; iterate-least/>=? s ;; iterate-greatest/<? s)));; iterate-greatest/<=? ;; -------- (provide gen:ordered-dict) (provide/contract [prop:ordered-dict (struct-type-property/c prop:ordered-dict-contract)] [ordered-dict? (-> any/c boolean?)] [dict-iterate-least extreme-contract] [dict-iterate-greatest extreme-contract] [dict-iterate-least/>? search-contract] [dict-iterate-least/>=? search-contract] [dict-iterate-greatest/<? search-contract] [dict-iterate-greatest/<=? search-contract]) ;; ============================================================ (struct order (name domain-contract comparator =? <?) #:property prop:procedure (struct-field-index comparator)) (define order* (let ([order (case-lambda [(name ctc cmp) (order name ctc cmp (lambda (x y) (eq? (cmp x y) '=)) (lambda (x y) (eq? (cmp x y) '<)))] [(name ctc = <) (order name ctc (lambda (x y) (cond [(= x y) '=] [(< x y) '<] [(< y x) '>] [else (incomparable name x y)])) = <)] [(name ctc = < >) (order name ctc (lambda (x y) (cond [(= x y) '=] [(< x y) '<] [(> x y) '>] [else (incomparable name x y)])) = <)])]) order)) (define (incomparable name x y) (error name "values are incomparable: ~e ~e" x y)) (provide/contract [rename order* order (->* (symbol? contract? procedure?) (procedure? procedure?) order?)] [order? (-> any/c boolean?)] [order-comparator (-> order? procedure?)] [order-<? (-> order? procedure?)] [order-=? (-> order? procedure?)] [order-domain-contract (-> order? contract?)]) ;; ============================================================ (define (real/not-NaN? x) (and (real? x) (not (eqv? x +nan.0)))) (define real-order (order* 'real-order real/not-NaN? = < >)) (provide/contract [real-order order?]) ;; ============================================================ #| natural-cmp : Comparator datum-cmp : Comparator comparators for (most) built-in values !! May diverge on cyclical input. natural-cmp: * restriction to reals equiv to <,= real (exact and inexact, #e1 = #i1, +nan.0 not allowed!) < complex < Other datum-cmp: * restriction to reals NOT EQUIV to <,= (separates exact, inexact) exact real < inexact real (+nan.0 > +inf.0) < complex < Other Other: string < bytes < keyword < symbol < bool < char < path < null < pair < vector < box < prefab-struct < fully-transparent-struct ;; FIXME: What else to add? regexps (4 kinds?), syntax, ... |# ;; not exported because I'm not sure it's a good idea and I'm not sure ;; how to characterize it (define (natural-cmp x y) (gen-cmp x y #t)) (define (datum-cmp x y) (gen-cmp x y #f)) (define (gen-cmp x y natural?) (define-syntax-rule (recur x* y*) (gen-cmp x* y* natural?)) (cond [(eq? x y) '=] #| [(T? x) ...] ;; at this point, Type(x) > T [(T? y) ;; Type(x) > T = Type(y), so: '>] Assumes arguments are legal. |# [(real? x) (if (real? y) (cond [natural? (cmp* < = x y)] [else ;; exact < inexact (cond [(and (exact? x) (exact? y)) (cmp* < = x y)] [(exact? x) ;; inexact y '<] [(exact? y) ;; inexact x '>] [(and (eqv? x +nan.0) (eqv? y +nan.0)) '=] [(eqv? x +nan.0) '>] [(eqv? y +nan.0) '<] [else ;; inexact x, inexact y (cmp* < = x y)])]) '<)] [(real? y) '>] [(complex? x) (if (complex? y) (lexico (recur (real-part x) (real-part y)) (recur (imag-part x) (imag-part y))) '<)] [(complex? y) '>] [(string? x) (if (string? y) (cmp* string<? string=? x y) '<)] [(string? y) '>] [(bytes? x) (if (bytes? y) (cmp* bytes<? bytes=? x y) '<)] [(bytes? y) '>] [(keyword? x) (if (keyword? y) (cmp* keyword<? eq? x y) '<)] [(keyword? y) '>] [(symbol? x) (if (symbol? y) (cmp* symbol<? eq? x y) '<)] [(symbol? y) '>] [(boolean? x) (if (boolean? y) (cond [(eq? x y) '=] [y '<] [else '>]) '<)] [(boolean? y) '>] [(char? x) (if (char? y) (cmp* char<? char=? x y) '<)] [(char? y) '>] [(path-for-some-system? x) (if (path-for-some-system? y) (cmp* bytes<? bytes=? (path->bytes x) (path->bytes y)) '<)] [(path-for-some-system? y) '>] [(null? x) (if (null? y) '= '<)] [(null? y) '>] [(pair? x) (if (pair? y) (lexico (recur (car x) (car y)) (recur (cdr x) (cdr y))) '<)] [(pair? y) '>] [(vector? x) (if (vector? y) (vector-cmp x y 0 natural?) '<)] [(vector? y) '>] [(box? x) (if (box? y) (recur (unbox x) (unbox y)) '<)] [(box? y) '>] [(prefab-struct-key x) (if (prefab-struct-key y) (lexico (recur (prefab-struct-key x) (prefab-struct-key y)) ;; FIXME: use struct-ref to avoid allocation? (vector-cmp (struct->vector x) (struct->vector y) 1 natural?)) '<)] [(prefab-struct-key y) '>] [(fully-transparent-struct-type x) => (lambda (xtype) (cond [(fully-transparent-struct-type y) => (lambda (ytype) ;; could also do another lexico with object-name first (lexico (object-cmp xtype ytype) ;; FIXME: use struct-ref to avoid allocation? (vector-cmp (struct->vector x) (struct->vector y) 1 natural?)))] [else '<]))] [(fully-transparent-struct-type y) '>] [else (raise-type-error (if natural? 'natural-cmp 'datum-cmp) (string-join '("number" "string" "bytes" "keyword" "symbol" "boolean" "character" "path" "null" "pair" "vector" "box" "prefab struct" "or fully-transparent struct") ", ") 0 x y)])) (define-syntax-rule (cmp* <? =? xe ye) (let ([x xe] [y ye]) (if (=? x y) '= (if (<? x y) '< '>)))) (define-syntax-rule (lexico c1 c2) (case c1 ((<) '<) ((=) c2) ((>) '>))) (define (vector-cmp x y i natural?) (cond [(< i (vector-length x)) (if (< i (vector-length y)) (lexico (gen-cmp (vector-ref x i) (vector-ref y i) natural?) (vector-cmp x y (add1 i) natural?)) '>)] [(< i (vector-length y)) '<] [else '=])) ;; fully-transparent-struct-type : any -> struct-type or #f (define (fully-transparent-struct-type x) (parameterize ((current-inspector weak-inspector)) (let-values ([(x-type x-skipped?) (struct-info x)]) (and (not x-skipped?) x-type)))) ;; weak inspector controls no struct types; ;; so if it can inspect, must be transparent (define weak-inspector (make-inspector)) ;; Impose an arbitrary (but consistent) ordering on eq?-compared ;; objects. Use eq? and eq-hash-code for common fast path. Fall back ;; to table when comparing struct-types *same eq-hash-code* but *not ;; eq?*. That should be rare. (define object-order-table (make-weak-hasheq)) (define object-order-next 0) (define (object-cmp x y) (cond [(eq? x y) '=] [else (lexico (cmp* < = (eq-hash-code x) (eq-hash-code y)) (call-as-atomic (lambda () (let ([xi (hash-ref object-order-table x #f)] [yi (hash-ref object-order-table y #f)]) (cond [(and xi yi) ;; x not eq? y, so xi != yi (if (< xi yi) '< '>)] [xi '<] [yi '>] [else ;; neither one is in table; we only need to add one (hash-set! object-order-table x object-order-next) (set! object-order-next (add1 object-order-next)) '<])))))])) (define datum-order (order* 'datum-order any/c datum-cmp)) (provide/contract [datum-order order?])
true
1ae8cfbce9a2e25d5797b8a6f1886717574d1269
799b5de27cebaa6eaa49ff982110d59bbd6c6693
/soft-contract/test/gradual-typing-benchmarks/dungeon/main.rkt
96b6d0734082e502fb2f8252081f197875b22ab5
[ "MIT" ]
permissive
philnguyen/soft-contract
263efdbc9ca2f35234b03f0d99233a66accda78b
13e7d99e061509f0a45605508dd1a27a51f4648e
refs/heads/master
2021-07-11T03:45:31.435966
2021-04-07T06:06:25
2021-04-07T06:08:24
17,326,137
33
7
MIT
2021-02-19T08:15:35
2014-03-01T22:48:46
Racket
UTF-8
Racket
false
false
19,667
rkt
main.rkt
#lang racket ;(random-seed 4) ;; the old, unused random seed ;(provide ; generate-dungeon ; smooth-walls ;) ; for testing, and visibility ;; ----------------------------------------------------------------------------- (require require-typed-check racket/class "../base/un-types.rkt" racket/match ) (require (only-in racket/set set-intersect )) (require (only-in racket/dict dict-set )) (require (only-in "cell.rkt" void-cell% wall% door% vertical-door% horizontal-door% horizontal-wall% four-corner-wall% pillar% vertical-wall% north-west-wall% north-east-wall% south-west-wall% south-east-wall% north-tee-wall% west-tee-wall% east-tee-wall% south-tee-wall% empty-cell% )) (require (only-in "grid.rkt" left right up down grid-ref grid-height grid-width show-grid array-set! build-array )) (require (only-in "utils.rkt" random-between random-from random )) ;; ============================================================================= ;(define-type Poss->Cells (Listof (Pairof Pos Cell%))) ;(define-type Direction (->* (Pos) (Index) Pos)) ;(define-type Cache (HashTable Pos Boolean)) ;(define-type ExtPoints (Listof (Pairof Pos Room))) ;; dungeon generation (struct room (height width poss->cells ; maps positions to cell constructors ;; (so that we can construct the room later when we commit to it) free-cells ; where monsters or treasure could go extension-points)) ; where a corridor could sprout ;; ----------------------------------------------------------------------------- (define N 1) (define wall-cache (make-hash)) (define free-cache (make-hash)) (define animate-generation? #f) ; to see intermediate steps (define ITERS 10) (define dungeon-height 18) ; to be easy to display in 80x24, with other stuff (define dungeon-width 60) ;; ----------------------------------------------------------------------------- (define (try-add-rectangle grid pos height width direction) ;; height and width include a wall of one cell wide on each side (match-define (vector x y) pos) (define min-x (match direction [(== down) x] ;; expanding north, we have to move the top of the room ;; up so the bottom reaches the starting point [(== up) (+ (- x height) 1)] ;; have the entrance be at a random position on the ;; entrance-side wall [else (sub1 (- x (random (- height 2))))])) (define min-y (match direction ;; same idea as for x [(== right) y] [(== left) (+ (- y width) 1)] [else (sub1 (- y (random (- width 2))))])) (define max-x (+ min-x height)) (define max-y (+ min-y width)) (define-values (success? poss->cells free-cells extension-points) (for*/fold ([success? #t] [poss->cells '()] [free-cells '()] [extension-points '()]) ([x (in-range min-x max-x)] [y (in-range min-y max-y)]) ;#:break (not success?) (cond [(not success?) (values success? poss->cells free-cells extension-points)] [success? (define c (and (index? x) (index? y) (grid-ref grid (vector x y)))) (cond [(and c ; not out of bounds (or (is-a? c void-cell%) ; unused yet (is-a? c wall%))) ; neighboring room, can abut (define p (vector (assert x index?) (assert y index?))) ;; tentatively add stuff (define x-wall? (or (= x min-x) (= x (sub1 max-x)))) (define y-wall? (or (= y min-y) (= y (sub1 max-y)))) (if (or x-wall? y-wall?) ;; add a wall (values #t ; still succeeding (dict-set poss->cells p wall%) free-cells (if (and x-wall? y-wall?) ;; don't extend from corners extension-points (cons p extension-points))) (values #t (dict-set poss->cells p empty-cell%) (cons p free-cells) extension-points))] [else ; hit something, give up (values #f '() '() '() )])]))) (and success? (room height width poss->cells free-cells extension-points))) ;; mutate `grid` to add `room` (define (commit-room grid room) (for ([pos+cell% (in-list (room-poss->cells room))]) (match-define (cons pos cell%) pos+cell%) (array-set! grid pos (new cell%)))) ;(module+ test ; (require typed/rackunit) ; (: render-grid (-> (Listof String) String)) ; (define (render-grid g) (string-join g "\n" #:after-last "\n")) ; (: empty-grid (-> Grid)) ; (define (empty-grid) ; (array->mutable-array ; (build-array #(5 5) (lambda _ (new void-cell%))))) ; (define g1 (empty-grid)) ; (check-equal? (show-grid g1) ; (render-grid '("....." ; "....." ; "....." ; "....." ; "....."))) ; (check-false (try-add-rectangle g1 #(10 10) 3 3 right)) ; out of bounds ; (commit-room g1 (or (try-add-rectangle g1 #(2 1) 3 3 right) (error 'commit))) ; (check-equal? (show-grid g1) ; (render-grid '("....." ; ".XXX." ; ".X X." ; ".XXX." ; "....."))) ; (check-false (or (try-add-rectangle g1 #(2 2) 2 2 up) (error 'commit))) ; (commit-room g1 (or (try-add-rectangle g1 #(3 3) 2 2 down) (error 'commit))) ; (check-equal? (show-grid g1) ; (render-grid '("....." ; ".XXX." ; ".X X." ; ".XXX." ; "..XX."))) ; (define g2 (empty-grid)) ; (commit-room g2 (or (try-add-rectangle g2 #(1 1) 2 4 right) (error 'commit))) ; (check-equal? (show-grid g2) ; (render-grid '(".XXXX" ; ".XXXX" ; "....." ; "....." ; "....."))) ; ) (define (random-direction) (random-from (list left right up down))) (define (horizontal? dir) (or (eq? dir right) (eq? dir left))) (define (vertical? dir) (or (eq? dir up) (eq? dir down))) (define (new-room grid pos dir) (define w (assert (random-between 7 11) index?)) ; higher than that is hard to fit (define h (assert (random-between 7 11) index?)) (try-add-rectangle grid pos w h dir)) (define (new-corridor grid pos dir) (define h? (horizontal? dir)) (define len ;; given map proportions (terminal window), horizontal corridors are ;; easier to fit (assert (if h? (random-between 6 10) (random-between 5 8)) index?)) (define h (if h? 3 len)) (define w (if h? len 3)) (try-add-rectangle grid pos h w dir)) (define (generate-dungeon encounters) ;; a room for each encounter, and a few empty ones (define n-rooms (max (length encounters) (random-between 6 9))) (define grid (build-array (vector dungeon-height dungeon-width) (lambda _ (new void-cell%)))) (define first-room (let loop () (define starting-point (vector (assert (random dungeon-height) index?) (assert (random dungeon-width) index?))) (define first-room (new-room grid starting-point (random-direction))) (or first-room (loop)))) ; if it doesn't fit, try again (commit-room grid first-room) (when animate-generation? (display (show-grid grid))) (define connections '()) ; keep track of pairs of connected rooms (define (extension-points/room room) (for/list ([e (in-list (room-extension-points room))]) (cons e room))) ;; for the rest of the rooms, try sprouting a corridor, with a room at the end ;; try until it works (let loop () (define-values (n all-rooms _2) (for/fold ([n-rooms-to-go (sub1 n-rooms)] [rooms (list first-room)] [extension-points (extension-points/room first-room)]) ([i (in-range ITERS)]) (cond ((= n-rooms-to-go 0) (values n-rooms-to-go rooms extension-points)) (else (define (add-room origin-room room ext [corridor #f] [new-ext #f]) (when corridor (commit-room grid corridor)) (commit-room grid room) ;; add doors (define door-kind (if (horizontal? dir) vertical-door% horizontal-door%)) (array-set! grid ext (new door-kind)) (when new-ext (array-set! grid new-ext (new door-kind))) (set! connections (cons (cons origin-room room) connections)) (when animate-generation? (display (show-grid grid))) (values (sub1 n-rooms-to-go) (cons room rooms) ; corridors don't count (append (if corridor (extension-points/room corridor) '()) (extension-points/room room) extension-points))) ;; pick an extension point at random (match-define `(,ext . ,origin-room) (random-from extension-points)) ;; first, try branching a corridor at random (define dir (random-direction)) (cond [(and (zero? (random 4)) ; maybe add a room directly, no corridor (new-room grid ext dir)) => (lambda (room) (add-room origin-room room ext))] [(new-corridor grid ext dir) => (lambda (corridor) ;; now try adding a room at the end ;; Note: we don't commit the corridor until we know the room ;; fits. This means that `try-add-rectangle` can't check ;; whether the two collide. It so happens that, since we're ;; putting the room at the far end of the corridor (and ;; extending from it), then that can't happen. We rely on ;; that invariant. (define new-ext (dir ext (if (horizontal? dir) (assert (sub1 (room-width corridor)) index?) ; sub1 to make abut (assert (sub1 (room-height corridor)) index?)))) (cond [(new-room grid new-ext dir) => (lambda (room) ; worked, commit both and keep going (add-room origin-room room ext corridor new-ext))] [else ; didn't fit, try again (values n-rooms-to-go rooms extension-points)]))] [else ; didn't fit, try again (values n-rooms-to-go rooms extension-points)]))))) (cond [(not (= n 0)) ; we got stuck, try again ;(log-error "generate-dungeon: had to restart") ;; may have gotten too ambitious with n of rooms, back off (set! n-rooms (max (length encounters) (sub1 n-rooms))) (loop)] [else ; we did it ;; try adding more doors (define potential-connections (for*/fold ([potential-connections '()]) ([r1 (in-list all-rooms)] [r2 (in-list all-rooms)] #:unless (or (eq? r1 r2) (member (cons r1 r2) connections) (member (cons r2 r1) connections) (member (cons r2 r1) potential-connections))) (cons (cons r1 r2) potential-connections))) ;; if the two in a pair share a wall, put a door through it (for ([r1+r2 (in-list potential-connections)]) (match-define (cons r1 r2) r1+r2) (define common ;(set->list ; (set-intersect (list->set (room-extension-points r1)) ; (list->set (room-extension-points r2))))) (set-intersect (room-extension-points r1) (room-extension-points r2))) (define possible-doors (filter (lambda (x) x) (for/list ([pos (in-list common)]) (cond [(and (counts-as-free? grid (up pos)) (counts-as-free? grid (down pos))) (cons pos horizontal-door%)] [(and (counts-as-free? grid (left pos)) (counts-as-free? grid (right pos))) (cons pos vertical-door%)] [else #f])))) (when (not (empty? possible-doors)) (match-define (cons pos door-kind) (random-from possible-doors)) (array-set! grid pos (new door-kind)))) grid]))) (define (counts-as-free? grid pos) ; i.e., player could be there (cond [(hash-ref free-cache pos #f) => (lambda (x) x)] [else (define c (grid-ref grid pos)) (define res (or (is-a? c empty-cell%) (is-a? c door%))) (hash-set! free-cache pos res) res])) (define (hash-clear! h) (void)) ;; wall smoothing, for aesthetic reasons (define (smooth-walls grid) (for* ([x (in-range (grid-height grid))] [y (in-range (grid-width grid))]) (smooth-single-wall grid (vector (assert x index?) (assert y index?)))) (set! wall-cache (make-hash)) ; reset caches (set! free-cache (make-hash)) grid) (define (smooth-single-wall grid pos) (define (wall-or-door? pos) (cond [(hash-ref wall-cache pos #f) => (lambda (x) x)] [else (define c (grid-ref grid pos)) (define res (or (is-a? c wall%) (is-a? c door%))) (hash-set! wall-cache pos res) res])) (when (is-a? (grid-ref grid pos) wall%) (define u (wall-or-door? (up pos))) (define d (wall-or-door? (down pos))) (define l (wall-or-door? (left pos))) (define r (wall-or-door? (right pos))) (define fu (delay (counts-as-free? grid (up pos)))) (define fd (delay (counts-as-free? grid (down pos)))) (define fl (delay (counts-as-free? grid (left pos)))) (define fr (delay (counts-as-free? grid (right pos)))) (define ful (delay (counts-as-free? grid (up (left pos))))) (define fur (delay (counts-as-free? grid (up (right pos))))) (define fdl (delay (counts-as-free? grid (down (left pos))))) (define fdr (delay (counts-as-free? grid (down (right pos))))) (define (2-of-3? a b c) (or (and a b #t) (and a c #t) (and b c #t))) (array-set! grid pos (new (match* ( u d l r) [(#F #F #F #F) pillar%] [(#F #F #F #T) horizontal-wall%] [(#F #F #T #F) horizontal-wall%] [(#F #F #T #T) horizontal-wall%] [(#F #T #F #F) vertical-wall%] [( #F #T #F #T) north-west-wall%] [( #F #T #T #F) north-east-wall%] ;; only have tees if enough corners are "inside" [( #F #T #T #T) (cond [(2-of-3? (force fu) (force fdl) (force fdr)) north-tee-wall%] [(force fu) horizontal-wall%] [(force fdl) north-east-wall%] [(force fdr) north-west-wall%] [else (raise-user-error 'cond)])] [(#T #F #F #F) vertical-wall%] [(#T #F #F #T) south-west-wall%] [(#T #F #T #F) south-east-wall%] [(#T #F #T #T) (cond [(2-of-3? (force fd) (force ful) (force fur)) south-tee-wall%] [(force fd) horizontal-wall%] [(force ful) south-east-wall%] [(force fur) south-west-wall%] [else (raise-user-error 'cond)])] [(#T #T #F #F) vertical-wall%] [(#T #T #F #T) (cond [(2-of-3? (force fl) (force fur) (force fdr)) west-tee-wall%] [(force fl) vertical-wall%] [(force fur) south-west-wall%] [(force fdr) north-west-wall%] [else (raise-user-error 'cond)])] [(#T #T #T #F) (cond [(2-of-3? (force fr) (force ful) (force fdl)) east-tee-wall%] [(force fr) vertical-wall%] [(force ful) south-east-wall%] [(force fdl) north-east-wall%] [else (raise-user-error 'nocd)])] [(#T #T #T #T) (cond ; similar to the tee cases [(or (and (force ful) (force fdr)) (and (force fur) (force fdl))) ;; if diagonals are free, need a four-corner wall four-corner-wall%] [(and (force ful) (force fur)) south-tee-wall%] [(and (force fdl) (force fdr)) north-tee-wall%] [(and (force ful) (force fdl)) east-tee-wall%] [(and (force fur) (force fdr)) west-tee-wall%] [(force ful) south-east-wall%] [(force fur) south-west-wall%] [(force fdl) north-east-wall%] [(force fdr) north-west-wall%] [else (raise-user-error 'cond)])] [(_ _ _ _) (raise-user-error 'voidcase)]))))) (define (main) (show-grid (smooth-walls (generate-dungeon (range N))))) (time (void (main))) ;; Change `void` to `display` to test. Should see: ;;............................................................ ;;............................................................ ;;............................................................ ;;............................................................ ;;............................................................ ;;...................................╔═════╗......╔═══════╗... ;;...................................║ ║......║ ║... ;;...................................║ ║......║ ║... ;;......................╔═════╗......║ ║......║ ║... ;;......................║ ║......║ ╠══════╣ ║... ;;......................║ ╠══════╣ _ _ ║... ;;......................║ _ _ ╠══════╣ ║... ;;......................║ ╠══════╣ ║......║ ║... ;;......................║ ║......╚═════╝......║ ║... ;;......................╚═════╝...................╚═══════╝... ;;............................................................ ;;............................................................ ;;............................................................ ;;cpu time: 8177 real time: 8175 gc time: 3379
false
51fc5e8b0bd9ff5bb0a2799d68bbc3b295839215
ecf38a3025b502694f886e1f0396e837ed7aa0be
/benchmark/results.rkt
4ce31414d1d90fee38f5d752204b50e455efffd2
[]
no_license
takikawa/racket-benchmark
403d3bd7923709abb4b4464b76c9922b7cce7d66
ed2395b68a1c4d147c7886a25ac4b4209025a454
refs/heads/master
2020-12-30T22:55:57.438102
2013-12-05T04:50:20
2013-12-05T04:57:03
null
0
0
null
null
null
null
UTF-8
Racket
false
false
2,038
rkt
results.rkt
#lang racket (require racket/date racket/serialize "types.rkt") (provide get-past-results record-results) ;; path? exact-integer? -> bench-results? (define (get-past-results file [version #f]) (deserialize (file->value (get-file file version) #:mode 'text))) ;; bench-results? path? -> void? (define (record-results results file) (let ([fresh-name (make-fresh-file-name file)]) ;; serialization is used as otherwise read (write date) /= date ;; in the equal? sense (write-to-file (serialize results) fresh-name #:mode 'text #:exists 'truncate) (displayln (format "Wrote results to ~a" fresh-name)))) ;; get latest version of file-base if version #f ;; if version not #f, get (fmt file-base version) (define (get-file file-base version) (define (get-file-names [v 0]) (let ([file-name (fmt file-base v)]) (if (file-exists? file-name) (cons file-name (get-file-names (+ 1 v))) (list)))) (let ([file-names (get-file-names)]) (cond ;; no specific version and file-names not null [(and (not version) (not (null? file-names))) (last file-names)] ;; specific version and assoc. file exists [(and version (file-exists? (fmt file-base version))) (fmt file-base version)] ;; specific version and assoc. file doesn't exist [version (error 'get-file "No file found: ~a" (fmt file-base version))] ;; no specific version, but no matching files exist [else (error 'get-file "No files found matching ~a-([0-9]+)" (fmt file-base version))]))) ;; string? [exact-integer?] -> string? ;; create a new fresh file name of the form file-base-<n> (define (make-fresh-file-name file-base [version 0]) (if (file-exists? (fmt file-base version)) (make-fresh-file-name file-base (+ version 1)) (fmt file-base version))) ;; string? exact-integer? -> string? ;; format a file name given the file-base and version (define (fmt file-base version) (format "~a-~a" file-base version))
false
808abfe39f4924d83306ac8ba91458896ab54bf9
596f020ffe9b0f4e646d935328663dc6d73ea39c
/simple-scheme/ref-impl/test-framework/private/types.rkt
dc3825689527efb12a6e82a9a5b8e4435111f0f0
[]
no_license
rcobbe/learning-javascript
3aeb42acfad2461f4dcba719cc0033f2575f2cd1
abea37693d7751cb8f7a3e8d7314281fdac8524f
refs/heads/master
2021-09-01T04:45:59.976907
2017-12-04T00:17:51
2017-12-04T00:17:51
109,859,837
0
0
null
2017-12-04T00:17:52
2017-11-07T16:14:12
null
UTF-8
Racket
false
false
1,607
rkt
types.rkt
#lang typed/racket (provide (all-defined-out)) ;; Source location tracking for various components of the test framework (struct srcloc ([source : Any] [line : Exact-Positive-Integer])) ;; Given these definitions, the types `Test' and `test' are effectively ;; equivalent, but the type checker doesn't know that. In particular, if we ;; know ;; x : Test ;; (not (test-suite? x)) ;; then the type checker can conclude ;; x : test-case ;; ;; If, however, we know ;; x : test ;; (not (test-suite? x)) ;; then the type checker cannot infer the same conclusion, presumably because ;; it has to allow for the possibility of other subtypes of `test' that we ;; don't know about here. (define-type Test (U test-suite test-case)) ;; Supertype of all tests. We use the location for static test errors, ;; primarily duplicate names. (struct test ([name : Symbol] [location : srcloc])) (struct test-suite test ([contents : (Listof Test)])) (struct test-case test ([contents : (-> Result)])) ;; Type of the result of running a test case's thunk. The location, where ;; present, is the source location of the check that failed. (define-type Result (U success failure uncaught-exn)) (struct success ()) (struct failure ([msg : String] [location : srcloc])) (struct uncaught-exn ([exn : exn:fail] [location : srcloc])) ;; internal exception type used to signal test failure. We have to use this ;; instead of just throwing a `failure' object because, in typed racket, the ;; argument to `raise' must have type (U exn s-expression), roughly. (struct exn:failure exn ([f : failure]))
false
55e2314f2b6f9f2f491e9dcf0802cfe591a1590e
2d19dc910d6635700bac6a1e5326edaa28979810
/doc/utils/peg.scrbl
e0313ab8bacc47951293d76466a3e53eb2ae57dc
[ "BSD-3-Clause", "LicenseRef-scancode-other-permissive", "BSD-2-Clause", "MIT" ]
permissive
spurious/sagittarius-scheme-mirror
e88c68cd4a72c371f265f5174d4e5f7c9189fff5
53f104188934109227c01b1e9a9af5312f9ce997
refs/heads/master
2021-01-23T18:00:33.235458
2018-11-27T21:03:18
2018-11-27T21:03:18
2,843,561
5
2
null
null
null
null
UTF-8
Racket
false
false
13,243
scrbl
peg.scrbl
@; -*- coding: utf-8 -*- @subsection[:tag "peg"]{(peg) - PEG library} @define[Library]{@name{(peg)}} @desc{A parser combinators library. This library is named PEG (Paring Expression Grammar), howerver it only provides parser combinator not syntactical layer, yet. } The following example shows parsing simple arithmetic expressions. The first part of the example shows how to define the parser. The parser is defined with the name of @code{calc:expr}. This parser accepts one argument which is a lazy sequence provided by SRFI-127 @code{(srfi :127)}, and returns 3 values, parse state, parser value and next input. NOTE: A lazy sequence is a pair, whose @code{cdr} part might be a generator. A normal pair can also be a lazy sequence. @codeblock{ (import (rnrs) (peg) (peg chars) (srfi :14 char-sets) (srfi :121 generators) (srfi :127 lseqs)) (define ascii-digits (char-set-intersection char-set:digit char-set:ascii)) (define calc:num ($do (s ($optional ($or ($eqv? #\+) ($eqv? #\-)) #\+)) (n ($many ($char-set-contains? ascii-digits) 1)) ($return (string->number (apply string s n))))) (define (calc:op c) ($seq ($many ($satisfy char-whitespace?)) ($eqv? c) ($many ($satisfy char-whitespace?)))) (define calc:+ (calc:op #\+)) (define calc:* (calc:op #\*)) (define calc:open (calc:op #\()) (define calc:close (calc:op #\))) (define calc:simple ($or ($do calc:open (a ($lazy calc:expr)) calc:close ($return a)) calc:num)) (define calc:mulexp ($or ($do (a calc:simple) calc:* (b calc:simple) ($return (* a b))) calc:simple)) (define calc:expr ($or ($do (a calc:mulexp) calc:+ (b calc:mulexp) ($return (+ a b))) calc:mulexp)) } The parser can be called like this: @codeblock[=> "#<parse-succcess> 3 '()"]{ (calc:expr (generator->lseq (string->generator "1 + 2"))) } The parser doesn't check if the input is consumed entirely. So this also returns success: @codeblock[=> "#<parse-succcess> 1 '(#\space #\- #\space #\2)"]{ (calc:expr (generator->lseq (string->generator "1 - 2"))) } If you want to make sure that the entire input is consumed, then you need to check if the next input is @code{()} or not. NOTE: An input of parsers, which is lazy sequence, doesn't necessarily be a character sequence. So users can implmenet own lexer. NOTE2: The above example of the parser usage can also be like this: @codeblock[=> "#<parse-succcess> 3 '()"]{ (calc:expr (string->list "1 + 2")) } In this document, we always convert to a lazy sequence. @subsubsection{Predefined parsers} @define[Function]{@name{$return} @args{v}} @define[Function]{@name{$return} @args{v state}} @define[Function]{@name{$return} @args{v state l}} @desc{Returns a parser which returns given @var{v} as its value. The second form specifies the state of parser result, which must be one of the followings: @itemlist{ @item{@code{+parse-success+} - Indicating successful parse result} @item{@code{+parse-fail+} - Indicating failure parse result} @item{@code{+parse-expect+} - Indicating different from expected input} @item{@code{+parse-unexpect+} - Indicating unexpectedly matched input} } The third form specifies the state described above and the next input. The next input must be a lazy sequence. } @define[Function]{@name{$fail} @args{message}} @desc{Returns a parser whose returning state is @code{+parse-fail+} and return value is given @var{message}. } @define[Function]{@name{$expect} @args{parser message}} @desc{Returns a parser which uses the given @var{parser} to parse its input, and if the result state is not success, then return @code{+parse-expect+} with the given @var{message} as its return value. This is useful to provide detail message of the failure. } @define[Function]{@name{$eof} @args{input}} @desc{A parser which check if the @var{input} is exhausted or not. It returns success if the @var{input} is exhausted otherwise @code{+parse-expect+} as its state. } @define[Function]{@name{$any} @args{input}} @desc{A parser which consume the first element of @var{input} and returns success. } @define[Function]{@name{$empty} @args{v}} @desc{Returns a parser which returns success and given @var{v} as its value without consuming input. In the context of BNF term, this is called epsilon. } @define[Function]{@name{$satisfy} @args{pred}} @define[Function]{@name{$satisfy} @args{pred message}} @desc{Returns a parser which check if the first element of the input of the parser satisfies the given @var{pred} or not. If the @var{pred} returns true value, then it return success and the first element. Otherwise @code{+parse-expect+}. If the second form is used, then the @var{message} is returned when the @var{pred} returned @code{#f}. } @define[Function]{@name{$not} @args{parser}} @desc{Returns a parser which uses the given @var{parser} as its parser and check if the returning state is not successful or not. If the state is successful, then returns @code{+parse-unexpect+}, otherwise return successful and @code{#f} as its returning value. } @define[Function]{@name{$seq} @args{parser @dots{}}} @desc{Returns a parser which uses the given @var{parser}s as its parser. It returns successful if all the given @var{parser}s return successful. The returning value is the last parser's value. Otherwise @code{+parse-expect+} is returned. } @define[Function]{@name{$or} @args{parser @dots{}}} @desc{Returns a parser which uses the given @var{parser}s as its parser. It returns successful if one of the given @var{parser}s return successful. The returning value is the first successful parser's value. Otherwise @code{+parse-expect+} is returned. If one of the parser returns @code{+parse-fail+}, then the entire parser returned by this procedure fails. For example, the parser after the @code{$fail} won't be evaluated. @codeblock{ ($or ($satisfy char-whitespace?) ($fail "Boom!") ($satisfy char-lower-case?)) } } @define[Function]{@name{$many} @args{parser}} @define[Function]{@name{$many} @args{parser at-least}} @define[Function]{@name{$many} @args{parser at-least at-most}} @desc{Returns a parser which uses the given @var{parser} as its parser. The parser parses the input as long as the given @var{parser} returns successful state. The returning value is a list of the values returned by the given @var{parser}. If the second or third form is used, then it limits the number of trial. @var{at-least} specifies the number of minimum parse. If the given @var{parser} returned non successful state before this number, then the parser return @code{+parse-expect+}. @var{at-most} specifies the number of maximum parse. If the parser parsed @var{at-most} input, then it returns successful even the rest of the input contains the valid input of the given @var{parser}. } @define[Function]{@name{$peek} @args{parser}} @desc{Returns a parser which uses the given @var{parser} as its parser. The parser returns successful if the given @var{parser} returns successful. The returning next input will not be consumed by the parser. } @; derived @define[Function]{@name{$eqv?} @args{obj}} @desc{Returns a parser which compares the first element of the input and the given @var{obj} using @code{eqv?}. If the comparison result is @code{#t}, then it returns successful. This procedure is equivalent with the following: @codeblogk{ (define ($eqv? v) ($satisfy (lambda (e) (eqv? e v)))) } } @define[Function]{@name{$optional} @args{parser}} @define[Function]{@name{$optional} @args{parser fallback}} @desc{Returns a parser which uses the given @var{parser} as its parser. The parser returns always successful state. The returning value is the value of the given @var{parser} if the @var{parser} returns successful. Otherwise @code{#f}. If the second form is used, then @var{fallback} is returned when the @var{parser} returned non successful. } @define[Function]{@name{$repeat} @args{parser n}} @desc{Returns a parser which uses the given @var{parser} as its parser. The parser parses input exactly @var{n} times and returns a list of result value if the given @var{parser} returns @var{n} times successful. This is equivalent with the following code: @codeblogk{ (define ($repeat parser n) ($many parser n n)) } } @define[Function]{@name{$bind} @args{parser f}} @desc{Returns a parser which uses the given @var{parser} as its parser. The @var{f} must be a procedure which takes one argument and returns a parser. The parser returns the result of the parser created by @var{f}. The @var{f} is called when the given @var{parser} returned successful state, passed the returning value of the given @var{parser}. The @code{$bind} is useful to take the result of the parsers. This procedure is used to implement @code{$do} described below. } @define[Macro]{@name{$do} @args{clause @dot{} body}} @desc{A macro which creates a parser. The @code{$do} macro makes users easier to bind variables. The syntax is the following: @codeblock{ $do ::= ($do clause ... parser) clause ::= (var parser) | (parser) | parser } The following example shows how to bind a variable returned by the @code{$many} procedure. @codeblock{ ($do (c* ($many ($satisfy char-numeric?))) ($return (string->number (list->string c*)))) } The above parser parses given numeric character sequence and returns a number. The @var{c*} is the result of the @var{$many}. } @define[Macro]{@name{$lazy} @args{parser}} @desc{A macro which creates a parser. The @code{$lazy} macro delays the creation of @var{parser}. This macro is useful to handle cross reference. For example: @codeblock{ (define a ($do (c b) ($return c))) (define b ($do (c a) ($return c))) } The above code causes unbound variable in runtime when the definition of @code{a} is evaluated. To avoid this, users can use the @code{$lazy} like this: @codeblock{ (define a ($do (c ($lazy b)) ($return c))) (define b ($do (c a) ($return c))) } } @define[Macro]{@name{$if} @args{pred then else}} @desc{A macro which creates a parser. The returning parser calls either @var{then} or @var{else} parser depending on the result of @var{pred}. This is the simple example. @codeblock{ ($if #t ($eqv? #\t) ($eqv? #\f)) ;; ($eqv? #\t) will ba called } The @code{$if} can be used to dispatch parsers by the results like this: @codeblock{ ($do (c ($optional ($eqv? #\t))) ($if c ($return c) ($return 'something))) } } @define[Macro]{@name{$cond} @args{clause @dots{}}} @define[Macro]{@name{$cond} @args{clause @dots{} (else parser)}} @desc{A macro which creates a parser. The @var{clause} must be the following form: @codeblock{ clause ::= (pred parser) } The parser returned by this macro is similar with the one from @code{$if}, the difference is this macro can handle multiple predicates. } @define[Macro]{@name{$when} @args{pred parser}} @define[Macro]{@name{$unless} @args{pred parser}} @desc{A macro which creates a parser. The @code{$when} macro returns a parser which calls the given @var{parser} only if the @var{pred} returned true value. The @code{$unless} macro returns a parser which calls the given @var{parser} only if the @var{pred} returned @code{#f}. They are defined like this: @codeblock{ (define-syntax $when (syntax-rules () ((_ pred body) ($if pred body ($fail 'pred))))) (define-syntax $unless (syntax-rules () ((_ pred body) ($when (not pred) body)))) } } @define[Macro]{@name{$parameterize} @args{bindings parser}} @desc{A macro which creates a parser. The @code{$parameterize} macro returns a parser which calls the given @var{parser} in the extended dynamic extend with the given @var{bindings}. The @var{bindings} must be the following form: @codeblock{ bindings ::= ((parameter value) ...) } } @define[Macro]{@name{$guard} @args{guard-clause parser}} @desc{A macro which creates a parser. The @code{$guard} macro returns a parser which is wrapped by the @code{guard}. When the given @var{parser} raises an error during parsing, then the @var{guard-clause} will be executed. The @var{guard-clause} must be the following form: @code{ guard-clause ::= (variable (pred clause) ...) } The @var{pred} must be a expression which checks if the raised condition should be handled by the coupled @var{clause} or not. If the @var{pred} is evaluated to true value, then the coupled @var{clause} is called with the input of the given @var{parser}. } @; TBD writing own parser @subsubsection{Character specific parsers} The procedures provided by the @code{(peg)} can be used for all kinds of input. This section describes parsers which can only be used for character input. @define[Library]{@name{(peg chars)}} @desc{Character specific PEG parser library.} @define[Function]{@name{$char-set-contains?} @args{char-set}} @desc{Returns a parser which returns successful if the given @var{char-set} contains the input of the parser. This procedure is defined like this: @codeblock{ (define ($char-set-contains? s) ($satisfy (lambda (c) (char-set-contains? s c)) s)) } } @define[Function]{@name{$token} @args{string}} @desc{Returns a parser which returns successful if the input of the parser matches with the given @var{string}. This procedure is defined like this: @codeblock{ (define ($token s) (apply $seq (map $eqv? (string->list s)))) } }
true
eb27fd1801876918faf12b25d260f07e83a86f4e
3e9f044c5014959ce0e915fe1177d19f93d238ed
/racket/sketch/expand.rkt
8effa490ee06963eed9cd12f4251db60671e78d6
[ "MIT", "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0", "LicenseRef-scancode-public-domain", "CC0-1.0", "BSD-2-Clause" ]
permissive
edom/work
5e15c311dd49eb55fafbff3455cae505fa51643a
df55868caa436efc631e145a43e833220b8da1d0
refs/heads/master
2022-10-10T22:25:11.652701
2020-02-26T19:42:08
2020-02-26T19:44:58
138,504,284
0
1
NOASSERTION
2022-10-06T01:38:07
2018-06-24T18:03:16
TeX
UTF-8
Racket
false
false
778
rkt
expand.rkt
#lang stc-racket (define-syntax-rule (printeval exp ...) (begin (printf "~v --> ~v~n" 'exp exp) ... ) ) (define (f x) (+ x 1)) #| ;; https://docs.racket-lang.org/macro-debugger/index.html ;; useful for debugging macro expansions (require macro-debugger/stepper) (expand/step #'(printeval (f 1) (f 1))) |# (printeval (f 1) (f 2) (f 3) ) (require (only-in racket/base call-with-default-reading-parameterization ) ) (define (dump) (define (rec) (define stx (read-syntax)) (unless (eof-object? stx) (printf "~v ~~~ ~v~n" stx (syntax->datum stx)) (rec) ) ) (call-with-default-reading-parameterization rec) ) (with-input-from-file "load.rkt" (lambda () (dump) ))
true
188bda1b2f98586df74633aa1b5f1435209a7e85
ece0cff46980dd817abc5af494783a839786e523
/lib/local-form.rkt
9f2b00cbd7f519409beebde97434f4a51a177d8f
[ "MIT" ]
permissive
tiagosr/nanopassista
768ecd9e16f21b69aa48606f9514f58779f58a79
4950e9d44479fea7f404a777ce1166db2031833b
refs/heads/master
2021-01-01T17:21:58.809755
2015-04-11T22:17:37
2015-04-11T22:17:37
32,051,289
2
0
null
null
null
null
UTF-8
Racket
false
false
1,216
rkt
local-form.rkt
#lang racket #| | local form | replaces (define v ...) with (set! v ...) and makes them local variables through lambda | | transforms into | (begin ((lambda (a b) | (bla) (foo) | (define a (lambda () 10)) (set! a (lambda () 10)) | (define b (lambda () 20)) (set! b (lambda () 20)) | (a)) (a)) | #f #f) |# (define (local-form exp) (if (begin-exp? exp) (let ([vars (defined-vars (cdr exp))]) `((lambda ,vars ,@(replace-define (cdr exp))) ,@(map (lambda (v) #f) vars))) exp)) (define (defined-vars exps) (foldr (lambda (exp vars) (if (define-exp? exp) (cons (cadr exp) vars) vars)) '() exps)) (define (replace-define exps) (map (lambda (exp) (if (define-exp? exp) `(set! ,@(cdr exp)) exp)) exps)) (define (exp? exp sym) (and (pair? exp) (eq? (car exp) sym))) (define (begin-exp? exp) (exp? exp 'begin)) (define (define-exp? exp) (exp? exp 'define)) (provide (all-defined-out))
false
76d139d8e1f51197c34e4024b0b817117a9b88bd
82c76c05fc8ca096f2744a7423d411561b25d9bd
/typed-racket-test/succeed/pr11912.rkt
bb00fc50b58d08b8ff41eca7c35cef176293d848
[ "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
222
rkt
pr11912.rkt
#lang typed/racket (require typed/rackunit) (check-exn (lambda (exn) #t) (lambda () (/ 1 0))) (check-equal? 2 2) (check-not-exn (lambda () (begin0 3 4))) (check-true #t) (check-false #f) (check-not-false 4)
false
437f4d3bd3e44ad4e252d052179ddb6e918478a4
2f09df60be7100404c01084d3f8b97f5d4144510
/src/trove/naive-time.scrbl
c1b6387deb05e9dd2df81cadd72b9b479f2e68d0
[]
no_license
changka-diwan/pyret-dates-times
73960bb3e59d66672d4bd75dcce374be9d84905c
cfc852251be07e2d648fec8d2dc0d8f5d9cb9fae
refs/heads/main
2023-02-16T16:16:33.406576
2021-01-18T16:29:50
2021-01-18T16:29:50
324,372,629
2
0
null
null
null
null
UTF-8
Racket
false
false
8,985
scrbl
naive-time.scrbl
#lang scribble/manual @(require "../../scribble-api.rkt" "../abbrevs.rkt") @(require (only-in scribble/core delayed-block)) @(define (nt-method name #:args args #:return ret #:contract contract) (method-doc "NaiveTime" "naive-time" name #:alt-docstrings "" #:args args #:return ret #:contract contract)) @(append-gen-docs `(module "naive-time" (path "src/js/base/runtime-anf.js") (data-spec (name "NaiveTime") (variants ("naive-time")) (shared ( (method-spec (name "at-date")) (method-spec (name "at-offset")) (method-spec (name "get-second")) (method-spec (name "get-minute")) (method-spec (name "get-hour")) (method-spec (name "is-after")) (method-spec (name "is-before")) (method-spec (name "minus")) (method-spec (name "minus-seconds")) (method-spec (name "minus-minutes")) (method-spec (name "minus-hours")) (method-spec (name "plus")) (method-spec (name "plus-seconds")) (method-spec (name "plus-minutes")) (method-spec (name "plus-hours")) (method-spect(name "to-string")) (method-spec (name "to-second-of-day")) (method-spec (name "until")) (method-spec (name "with-unit")) (method-spec (name "with-second")) (method-spec (name "with-minute")) (method-spec (name "with-hour")) ))) (fun-spec (name "naive-time-of-any")) (fun-spec (name "naive-time-now")) (fun-spec (name "naive-time-from-zone-now")) (fun-spec (name "parse-naive-time")) )) @docmodule["naive-time"]{ @ignore[(list "make-naive-time")] @section{NaiveTime Methods} @nt-method["at-date" #:contract (a-arrow NT ND NDT) #:args (list (list "self" #f) (list "date" #f)) #:return NDT ] Combines this time with a date to create a Temporal%(is-naive-date-time). @examples{ check: 1 is 1 end } @nt-method["at-offset" #:contract (a-arrow NT ZO OT) #:args (list (list "self" #f) (list "offset" #f)) #:return OT ] Combines this time with an offset to create an Temporal%(is-offset-time). @examples{ check: 1 is 1 end } @nt-method["get-second" #:contract (a-arrow NT N) #:args (list (list "self" #f)) #:return N ] Gets the value of the seconds unit. @examples{ check: 1 is 1 end } @nt-method["get-minute" #:contract (a-arrow NT N) #:args (list (list "self" #f)) #:return N ] Gets the value of the minutes unit. @examples{ check: 1 is 1 end } @nt-method["get-hour" #:contract (a-arrow NT N) #:args (list (list "self" #f)) #:return N ] Gets the value of the hours unit. @examples{ check: 1 is 1 end } @nt-method["is-after" #:contract (a-arrow NT NT B) #:args (list (list "self" #f) (list "other" #f)) #:return B ] Checks if this Temporal%(is-naive-time) is after the specified Temporal%(is-naive-time). @examples{ check: 1 is 1 end } @nt-method["is-before" #:contract (a-arrow NT NT B) #:args (list (list "self" #f) (list "other" #f)) #:return B ] Checks if this Temporal%(is-naive-time) is before the specified Temporal%(is-naive-time). @examples{ check: 1 is 1 end } @nt-method["minus" #:contract (a-arrow NT D NT) #:args (list (list "self" #f) (list "amt" #f)) #:return NT ] Returns a copy of this time with the specified amount subtracted. @examples{ check: 1 is 1 end } @nt-method["minus-seconds" #:contract (a-arrow NT N NT) #:args (list (list "self" #f) (list "seconds" #f)) #:return NT ] Returns a copy of this time with the specified number of seconds subtracted. @examples{ check: 1 is 1 end } @nt-method["minus-minutes" #:contract (a-arrow NT N NT) #:args (list (list "self" #f) (list "minutes" #f)) #:return NT ] Returns a copy of this time with the specified number of minutes subtracted. @examples{ check: 1 is 1 end } @nt-method["minus-hours" #:contract (a-arrow NT N NT) #:args (list (list "self" #f) (list "hours" #f)) #:return NT ] Returns a copy of this time with the specified number of hours subtracted. @examples{ check: 1 is 1 end } @nt-method["plus" #:contract (a-arrow NT D NT) #:args (list (list "self" #f) (list "amt" #f)) #:return NT ] Returns a copy of this time with the specified amount added. @examples{ check: 1 is 1 end } @nt-method["plus-seconds" #:contract (a-arrow NT N NT) #:args (list (list "self" #f) (list "seconds" #f)) #:return NT ] Returns a copy of this time with the specified number of seconds added. @examples{ check: 1 is 1 end } @nt-method["plus-minutes" #:contract (a-arrow NT N NT) #:args (list (list "self" #f) (list "minutes" #f)) #:return NT ] Returns a copy of this time with the specified number of minutes added. @examples{ check: 1 is 1 end } @nt-method["plus-hours" #:contract (a-arrow NT N NT) #:args (list (list "self" #f) (list "hours" #f)) #:return NT ] Returns a copy of this time with the specified number of hours added. @examples{ check: 1 is 1 end } @nt-method["to-string" #:contract (a-arrow NT S) #:args (list (list "self" #f)) #:return S ] Outputs this time as a String, such as 10:15:30 @examples{ check: 1 is 1 end } @nt-method["to-second-of-day" #:contract (a-arrow NT N) #:args (list (list "self" #f)) #:return N ] Extracts the time as seconds of day, from 0 to 24 * 60 * 60 - 1. @examples{ check: 1 is 1 end } @nt-method["until" #:contract (a-arrow NT NT D) #:args (list (list "self" #f) (list "other" #f)) #:return D ] Calculates the normalized duration of time until another time. @examples{ check: 1 is 1 end } @nt-method["with-unit" #:contract (a-arrow NT TU N NT) #:args (list (list "self" #f) (list "unit" #f) (list "val" #f)) #:return NT ] Returns a copy of this time with the specified unit set to a new value. @examples{ check: 1 is 1 end } @nt-method["with-second" #:contract (a-arrow NT N NT) #:args (list (list "self" #f) (list "second" #f)) #:return NT ] Returns a copy of this temporal with the seconds altered. @examples{ check: 1 is 1 end } @nt-method["with-minute" #:contract (a-arrow NT N NT) #:args (list (list "self" #f) (list "minute" #f)) #:return NT ] Returns a copy of this temporal with the minutes altered. @examples{ check: 1 is 1 end } @nt-method["with-hour" #:contract (a-arrow NT N NT) #:args (list (list "self" #f) (list "hour" #f)) #:return NT ] Returns a copy of this temporal with the hours altered. @examples{ check: 1 is 1 end } @section{NaiveTime Functions} These functions require the Temporal module to be @pyret{import}ed, as indicated in the examples. @function["naive-time-of-any" #:contract (a-arrow N N N NT) #:args (list (list "hour" #f) (list "month" #f) (list "day" #f)) #:return NT ]{ Obtains an instance of NaiveTime from a year, month and day. @examples{ import temporal as T check: 1 is 1 end } } @function["naive-time-now" #:contract (a-arrow NT) #:args '() #:return NT ]{ Obtains the current time from the system clock in the default time-zone. @examples{ import temporal as T check: 1 is 1 end } } @function["naive-time-from-zone-now" #:contract (a-arrow NT) #:args '() #:return NT ]{ Obtains the current time from the system clock in the specified time-zone. @examples{ import temporal as T check: 1 is 1 end } } @function["parse-naive-time" #:contract (a-arrow S NT) #:args (list (list "text" #f)) #:return NT ]{ Obtains an instance of Temporal%(is-naive-time) from a text string such as 23:59:59 @examples{ import temporal as T check: 1 is 1 end } } }
false
5f9f1cc49c146eba577d5649feff36fb70255fd8
20941a8216d2a06e5250d8df6518ad57c68d7a78
/Week 5/hw4.rkt
66a129f5b127e3fbbe6e530460f077914a933230
[ "MIT" ]
permissive
ljsong/Programming-Language
a60a8b28f34855060fb7780d9067926711a02cfd
bf73172924b370cbcae203d603b70a70278c4a49
refs/heads/master
2022-11-09T05:27:44.245452
2022-11-01T09:53:11
2022-11-01T09:53:11
210,485,277
0
0
null
null
null
null
UTF-8
Racket
false
false
2,908
rkt
hw4.rkt
#lang racket (provide (all-defined-out)) ;; so we can put tests in a second file ;; put your code below (define (sequence low high stride) (if (<= low high) (cons low (sequence (+ low stride) high stride)) null)) (define (string-append-map xs suffix) (map (lambda (x) (string-append x suffix)) xs)) (define (list-nth-mod xs n) (if (< n 0) (error "list-nth-mod: negative number") (if (null? xs) (error "list-nth-mod: empty list") (car (list-tail xs (remainder n (length xs))))))) (define (stream-for-n-steps s n) (letrec ([f (lambda (xs s n) (if (> n 0) (cons (car (s)) (f xs (cdr (s)) (- n 1))) xs))]) (f null s n))) (define funny-number-stream (letrec ([f (lambda (x) (cons x (lambda () (let ([real-num (+ (abs x) 1)]) (f (if (= (remainder real-num 5) 0) (- real-num) real-num))))))]) (lambda () (f 1)))) (define dan-then-dog (letrec ([f (lambda (x) (cons (if (even? x) "dan.jpg" "dog.jpg") (lambda () (f (+ x 1)))))]) (lambda () (f 0)))) (define (stream-add-zero s) (letrec ([f (lambda (pr) (cons (cons 0 (car pr)) (lambda () (f ((cdr pr))))))]) (lambda() (f (s))))) (define (cycle-lists xs ys) (letrec ([f (lambda (x) (cons (cons (list-nth-mod xs x) (list-nth-mod ys x)) (lambda () (f (+ x 1)))))]) (lambda () (f 0)))) (define (vector-assoc v vec) (letrec ([f (lambda (vec n) (let ([it (if (< n (vector-length vec)) (vector-ref vec n) #f)]) (if (not it) #f (cond [(pair? it) (if (equal? (car it) v) it (f vec (+ n 1)))] [#t (f vec (+ n 1))]))))]) (f vec 0))) (define (cached-assoc xs n) (letrec ([memo (make-vector n #f)] [slot 0] [f (lambda (v) (let ([ans (vector-assoc v memo)]) (if ans ans (let ([missed-item (assoc v xs)]) (begin (vector-set! memo slot missed-item) (set! slot (remainder (+ slot 1) n)) missed-item)))))]) f)) (define-syntax while-less (syntax-rules (do) [(while-less e1 do e2) ((letrec ([pred e1] [f (lambda () (if (< e2 pred) (f) #t))]) f))]))
true
5ec3ecbbf90aa9f523383281f49933272282d64d
9683b726ac3766c7ed1203684420ab49612b5c86
/ts-battle-arena-fortnite/scribblings/manual.scrbl
c4da4747160c6d03607e593e954aadf37d317dbe
[]
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
1,220
scrbl
manual.scrbl
#lang scribble/manual @(require ts-kata-util/katas/main ts-kata-util/katas/rendering "../katas.rkt" "../rendering.rkt" (except-in racket read do)) @title{Battle Arena Fortnite} These @(~a (length (kata-collection-katas battlearena-fortnite-katas))) katas pertain to @racket[battlearena-fortnite]. They can be browsed in various ways using the table of contents below. To use these katas in another collection do: @racketblock[ (require ts-battle-arena-fortnite/katas)] @table-of-contents[] @section{Intro Katas} @(render hello-world-katas) @section{Avatar Katas} @(render avatar-katas) @section{Enemy Katas} @(render enemy-katas) @section{Enemy Weapon Katas} @(render enemy-weapon-katas) @section{Weapon Katas} @(render selected-weapon-katas) @section{Background Katas} @(render background-katas) @section{Health Katas} @(render health-katas) @section{Boost Katas} @(render boost-katas) @section{Shield Katas} @(render shield-katas) @section{Force Field Katas} @(render force-field-katas) @section{Lava Pit Katas} @(render lava-pit-katas) @section{Spike Mine Katas} @(render spike-mine-katas) @(include-section battlearena-fortnite/scribblings/assets-library)
false
11b0cd4c5888a1409214eec6934c39d9a6c12d46
f987ad08fe780a03168e72efce172ea86ad5e6c0
/plai-lib/tests/gc/good-mutators/test-framework.rkt
5b928df3c295a6085c3ec7702ff7a5c706aaaa57
[ "LicenseRef-scancode-unknown-license-reference", "MIT", "Apache-2.0" ]
permissive
racket/plai
a76573fdd29b648e04f8adabcdc8fb1f6825d036
ae42bcb581ab02dcb9ddaea98d5ecded589c8d47
refs/heads/master
2023-08-18T18:41:24.326877
2022-10-03T02:10:02
2022-10-03T02:10:14
27,412,198
11
12
NOASSERTION
2022-07-08T19:16:11
2014-12-02T02:58:30
Racket
UTF-8
Racket
false
false
122
rkt
test-framework.rkt
#lang plai/mutator (allocator-setup "../good-collectors/good-collector.rkt" 28) (halt-on-errors #t) (test/value=? 12 12)
false
67253404fe553dcc786ee3ae1128e650eb7ff938
8620239a442323aee50ab0802bc09ab3eacdb955
/siek/patch-instructions.rkt
534f0721d155e2971f1c4e49140da1bfea9dc3a2
[]
no_license
aymanosman/racket-siek-compiler
45b9cffd93c57857fe94ba742770fc2540574705
85bcf2cf4881e7b68bfcd1d14e2c28712ab2e68e
refs/heads/master
2022-10-20T08:56:49.918822
2021-02-02T17:23:37
2021-02-03T22:28:06
170,332,069
0
0
null
null
null
null
UTF-8
Racket
false
false
1,700
rkt
patch-instructions.rkt
#lang racket (provide patch-instructions-R1 patch-instructions-R2) (module+ for-test (provide patch-instructions-instr)) (require "match-instr.rkt" "raise-mismatch-error.rkt") (define (patch-instructions-R1 p) (send (new patch-instructions-R1%) patch p)) (define (patch-instructions-R2 p) (send (new patch-instructions-R2%) patch p)) (define (patch-instructions-instr i) (send (new patch-instructions-R1%) patch-instr i)) (define patch-instructions-R1% (class object% (super-new) (define/public (who) 'patch-instructions-R1) (define/public (patch p) (match p [`(program ,info ,code) `(program ,info ,(map (match-lambda [(cons label block) (cons label (patch-block block))]) code))] [_ (raise-mismatch-error (who) 'top p)])) (define/public (patch-block b) (match b [`(block ,info ,instr* ...) `(block ,info ,@(append-map (lambda (i) (patch-instr i)) instr*))] [_ (raise-mismatch-error (who) 'block b)])) (define/public (patch-instr i) (match i [`(,op ,a) (list i)] [`(,op (deref ,r0 ,a0) (deref ,r1 ,a1)) `((movq (deref ,r0 ,a0) (reg rax)) (,op (reg rax) (deref ,r1 ,a1)))] [`(movq ,(arg a0) ,(arg a1)) #:when (symbol=? a0 a1) empty] [`(,op ,a0 ,a1) (list i)] [_ (raise-mismatch-error (who) 'instr i)])))) (define patch-instructions-R2% (class patch-instructions-R1% (super-new) (define/override (who) 'patch-instructions-R2)))
false
44b3c02f0a93cad540bc2d206eb1a886ae9c30ea
799b5de27cebaa6eaa49ff982110d59bbd6c6693
/soft-contract/test/programs/safe/softy/last.rkt
97642709cc94b519711388cfae55facfa37df49d
[ "MIT" ]
permissive
philnguyen/soft-contract
263efdbc9ca2f35234b03f0d99233a66accda78b
13e7d99e061509f0a45605508dd1a27a51f4648e
refs/heads/master
2021-07-11T03:45:31.435966
2021-04-07T06:06:25
2021-04-07T06:08:24
17,326,137
33
7
MIT
2021-02-19T08:15:35
2014-03-01T22:48:46
Racket
UTF-8
Racket
false
false
346
rkt
last.rkt
#lang racket (require soft-contract/fake-contract) (define (Y f) (λ (y) (((λ (x) (f (λ (z) ((x x) z)))) (λ (x) (f (λ (z) ((x x) z))))) y))) (define (last l) ((Y (λ (f) (λ (x) (if (empty? (cdr x)) (car x) (f (cdr x)))))) l)) (provide/contract [last ((cons/c any/c (listof any/c)) . -> . any/c)])
false
af64755a66626985dcbe3158922c759b9c160c22
76df16d6c3760cb415f1294caee997cc4736e09b
/rosette-benchmarks-3/rtr/benchmarks/business_time/translated3.rkt
a43139179b0a375ae0999912d3daad89022fcd44
[ "MIT" ]
permissive
uw-unsat/leanette-popl22-artifact
70409d9cbd8921d794d27b7992bf1d9a4087e9fe
80fea2519e61b45a283fbf7903acdf6d5528dbe7
refs/heads/master
2023-04-15T21:00:49.670873
2021-11-16T04:37:11
2021-11-16T04:37:11
414,331,908
6
1
null
null
null
null
UTF-8
Racket
false
false
2,087
rkt
translated3.rkt
#lang rosette (require "../../verif_libraries/ivl.rkt") (require racket/include)(require racket/undefined) (define USE_BV false) (define BVSIZE 6)(include (file "../../verif_libraries/integer.rkt")) (include (file "../../verif_libraries/hash.rkt")) (include (file "../../verif_libraries/bool.rkt")) (include (file "../../verif_libraries/array.rkt")) (include (file "../../verif_libraries/float.rkt")) (include (file "../../verif_libraries/fixnum.rkt")) (include (file "../../verif_libraries/helper.rkt")) (include (file "../../verif_libraries/ids.rkt")) (include (file "../../verif_libraries/basicobject.rkt")) (include (file "../../verif_libraries/kernel.rkt")) ;;; OBJECT STRUCT: (struct object ([classid][objectid] [size #:auto #:mutable] [contents #:auto #:mutable] [vec #:auto #:mutable] [id #:auto #:mutable] [value #:auto #:mutable] [@hour #:auto #:mutable] [@min #:auto #:mutable] [@sec #:auto #:mutable] [@hours #:auto #:mutable] ) #:transparent #:auto-value (void)) ;;; ARGUMENT DEFINITIONS: ; Initialize symbolic inputs to method ; Initialize struct self of type Date (define self (let ([self (object 8 (new-obj-id))]) self)) ;;; FUNCTION DEFINITIONS: (define (Date_inst_week self #:block [BLK (void)]) (let ([cyw 'undefined]) (begin (begin (set! cyw (Integer_inst_+ (begin (Integer_inst_/ (begin (Integer_inst_- (let ([self self])(begin(define d (int (Date_inst_yday (object-objectid self) )))(assume (and (Integer_inst_>= d (int 1) ) (Integer_inst_<= d (int 366) ) )) d)) (int 1) ) ) (int 7) ) ) (int 1) )) cyw) (if (Integer_inst_== cyw (int 53) ) (begin (set! cyw (int 52)) cyw) (void)) (return cyw) ))) (define-symbolic Date_inst_yday (~> integer? integer?)) ;;;RETURN VALUE: (define w (Date_inst_week self )) ;;;VERIFIED ASSERTION: (verify #:assume (assert (and )) #:guarantee (assert (unless (stuck? w) (and (Integer_inst_>= w (int 1) ) (Integer_inst_<= w (int 52) ) )))) #| Class Name->Class ID Hash->0 Class->1 Array->2 Fixnum->3 Bignum->3 Integer->3 Float->4 Boolean->5 BusinessTime::ParsedTime->6 BusinessTime::BusinessHours->7 Date->8 |#
false
446385889dc6c70851c1a3810115f71c5a6d02c8
50508fbb3a659c1168cb61f06a38a27a1745de15
/turnstile-example/turnstile/examples/cmu15-814/stlc+sum+fix.rkt
632626f68de5a81489b8953c492d35a24821af55
[ "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
453
rkt
stlc+sum+fix.rkt
#lang turnstile/quicklang ;; extends stlc+sum with fixpoint operator (extends "stlc+sum.rkt") (provide fix) (define-typed-syntax (fix e) ≫ [⊢ e ≫ e- ⇒ (~→ τ_in τ_out)] [τ_in τ= τ_out] ; #:when (typecheck? #'τ_in #'τ_rst) ---- [⊢ ((λ- (f-) (#%app- (λ- (x-) (#%app- f- (λ- (v-) (#%app- (#%app- x- x-) v-)))) (λ- (x-) (#%app- f- (λ- (v-) (#%app- (#%app- x- x-) v-)))))) e-) ⇒ τ_in])
false
544d4353c9cd2217228409950470345a7be2db77
574ce36c8ec0536c40aae809ba9c9de8e43133a9
/scribblings/irandom.scrbl
cff13b18da97da62f5fe1eadca92d76d8519ff52
[ "MIT" ]
permissive
hkrish/irandom
4f89a26af7d7c7912a211ac1fa1593ad89b61694
f38e03c69fce7462b81106f567c32ce34f0ed830
refs/heads/master
2023-04-04T14:32:35.430805
2021-04-17T15:32:15
2021-04-17T15:32:15
343,003,624
0
0
null
null
null
null
UTF-8
Racket
false
false
4,980
scrbl
irandom.scrbl
#lang scribble/manual @require[@for-label[irandom racket/base racket/flonum racket/fixnum ffi/vector racket/random]] @title{irandom} @author{hkrish} @defmodule[irandom] Racket implementation of Bob Jenkins' ISAAC pseudo-random number generator. @margin-note{At the moment, this module requires racket @tech["CS" #:doc '(lib "scribblings/reference/reference.scrbl")] variant running on a 64-bit platform.} @nested[#:style 'inset]{ @bold{ISAAC: a fast cryptographic random number generator} "ISAAC (Indirection, Shift, Accumulate, Add, and Count) generates 32-bit random numbers. ... Cycles are guaranteed to be at least 2@superscript["40"] values long, and they are 2@superscript["8295"] values long on average. The results are uniformly distributed, unbiased, and unpredictable unless you know the seed." --- @url["http://burtleburtle.net/bob/rand/isaacafa.html"]} Output of this implementation has been tested with output of the original source for conformity and correctness, as well as the @link["https://webhome.phy.duke.edu/~rgb/General/dieharder.php"]{dieharder} random number generator test suit and passes all the tests ---see the results in the @filepath{test/data} directory. @table-of-contents[] @;--------------------------------------------------------- @section[#:tag "random"]{Random Numbers} @defproc[(irandom-context? [v any/c]) boolean]{ Returns @racket[#t] if @racket[v] is an irandom-context, @racket[#f] otherwise. } @defproc[(make-irandom-context) irandom-context]{ Returns a new irandom-context. The irandom-context is used by all functions in this module via the parameter @racket[current-irandom-context] for generating random numbers. The new irandom-context is seeded with bytes from @racket[crypto-random-bytes]. } @defparam[current-irandom-context context irandom-context?]{ A @tech["parameter" #:doc '(lib "scribblings/reference/reference.scrbl")] that determines the irandom-context used by all functions in this module. } @defproc[(irandom) (and/c flonum? (>=/c 0) (</c 1))]{ Returns a random @tech["flonum" #:doc '(lib "scribblings/reference/reference.scrbl")] between 0 (inclusive) and 1 (exclusive). } @defproc[(irandom-fixnum) fixnum?]{ Returns a random @tech["fixnum" #:doc '(lib "scribblings/reference/reference.scrbl")]. } @defproc[(irandom-32) fixnum?]{ Returns a random @tech["fixnum" #:doc '(lib "scribblings/reference/reference.scrbl")] that is 32-bits in size. On 64-bit platforms, the leading bits are 0. } @defproc[(irandom-bytes [n (and/c fixnum? (>=/c 0))]) bytes?]{ Generates @racket[n] random bytes. } @defproc[(irandom-list-32 [n (and/c fixnum? (>=/c 0))]) list?]{ Returns a list containing @racket[n] 32-bit random numbers. } @defproc[(irandom-fxvector [n (and/c fixnum? (>=/c 0))]) fxvector?]{ Returns a @tech["fxvector" #:doc '(lib "scribblings/reference/reference.scrbl")] containing @racket[n] random numbers. } @defproc[(irandom-fxvector-32 [n (and/c fixnum? (>=/c 0))]) fxvector?]{ Returns a @tech["fxvector" #:doc '(lib "scribblings/reference/reference.scrbl")] containing @racket[n] 32-bit random numbers. } @defproc[(irandom-flvector [n (and/c fixnum? (>=/c 0))]) flvector?]{ Returns a @tech["flvector" #:doc '(lib "scribblings/reference/reference.scrbl")] containing @racket[n] random floating point numbers, each between 0 (inclusive) and 1 (exclusive). } @defproc[(irandom-u32vector [n (and/c fixnum? (>=/c 0))]) u32vector?]{ Returns a @racket[u32vector] containing @racket[n] random 32-bit integers. } @defproc[(irandom-u64vector [n (and/c fixnum? (>=/c 0))]) u64vector?]{ Returns a @racket[u64vector] containing @racket[n] random 64-bit integers. } @defproc[(irandom-f64vector [n (and/c fixnum? (>=/c 0))]) f64vector?]{ Returns a @racket[f64vector] containing @racket[n] random double-precision floating point numbers, each between 0 (inclusive) and 1 (exclusive). } @;--------------------------------------------------------- @section[#:tag "uuid"]{Random UUID Generation} @defmodule[irandom/uuid] Following bindings are exported by both @racketmodname[irandom], and @racketmodname[irandom/uuid]. @defproc[(uuid-string) (and/c string? immutable?)]{ Generates an immutable @link["https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_(random)"]{ version-4 random UUID} string using random bytes generated by @racket[irandom-bytes]. } @defproc[(uuid-bytes) (and/c bytes? immutable?)]{ Generates an immutable @link["https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_(random)"]{ version-4 random UUID} bytestring using random bytes generated by @racket[irandom-bytes]. } @defproc[(uuid-string? [v any/c]) boolean?]{ Checks if the input is a string or bytestring and conforms to the @link["https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_(random)"]{ version-4 random UUID} format. }
false
58b7cc4faa781446e0640bb0b16aa8b7e5a7c1f0
ef61a036fd7e4220dc71860053e6625cf1496b1f
/HTDP2e/01-fixed-size-data/ch-04-intervals-enumeration-and-itemization/ex-058-tax-land.rkt
c86f9e4205c28bcfa3747e37e085acba35a1b803
[]
no_license
lgwarda/racket-stuff
adb934d90858fa05f72d41c29cc66012e275931c
936811af04e679d7fefddc0ef04c5336578d1c29
refs/heads/master
2023-01-28T15:58:04.479919
2020-12-09T10:36:02
2020-12-09T10:36:02
249,515,050
0
0
null
null
null
null
UTF-8
Racket
false
false
1,317
rkt
ex-058-tax-land.rkt
;; The first three lines of this file were inserted by DrRacket. They record metadata ;; about the language level of this file in a form that our tools can easily process. #reader(lib "htdp-beginner-reader.ss" "lang")((modname ex-058-tax-land) (read-case-sensitive #t) (teachpacks ((lib "image.rkt" "teachpack" "2htdp") (lib "universe.rkt" "teachpack" "2htdp"))) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ((lib "image.rkt" "teachpack" "2htdp") (lib "universe.rkt" "teachpack" "2htdp")) #f))) ; constans (define NON-RATE 0) (define LOW-RATE 0.05) (define LUXURY-RATE 0.08) ; data definition ; A Price falls into one of three intervals: ; — 0 through 1000 ; — 1000 through 10000 ; — 10000 and above. ; interpretation the price of an item ; functions ; Price -> Number ; computes the amount of tax charged for p (check-expect (sales-tax 0) (* NON-RATE 0)) (check-expect (sales-tax 537) (* NON-RATE 537)) (check-expect (sales-tax 1000) (* LOW-RATE 1000)) (check-expect (sales-tax 1282) (* LOW-RATE 1282)) (check-expect (sales-tax 10000) (* LUXURY-RATE 10000)) (check-expect (sales-tax 12017) (* LUXURY-RATE 12017)) (define (sales-tax p) (cond [(and (<= 0 p) (< p 1000)) (* NON-RATE p)] [(and (<= 1000 p) (< p 10000)) (* LOW-RATE p)] [(>= p 1000) (* LUXURY-RATE p)]))
false
063adc7997d856b9e196f10d34e65b2cdd7328d1
fc6465100ab657aa1e31af6a4ab77a3284c28ff0
/results/fair-24/stlc-sub-1-enum.rktd
0af95b413d0d23d98cac75c1c59f42eee176af5b
[]
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
46,880
rktd
stlc-sub-1-enum.rktd
(gc-major 2015-06-21T19:45:23 (#:amount 23232960 #:time 284)) (start 2015-06-21T19:45:23 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:45:23 (#:model "stlc-sub-1" #:type enum)) (gc-major 2015-06-21T19:45:23 (#:amount 396520 #:time 258)) (counterexample 2015-06-21T19:45:28 (#:model "stlc-sub-1" #:type enum #:counterexample (λ (𝣆 (((list int) → ((int → int) → int)) → ((int → (int → int)) → ((list int) → (list int))))) (λ (° (((int → int) → (list int)) → ((list int) → int))) ((λ (b int) b) 3))) #:iterations 401 #:time 5601)) (new-average 2015-06-21T19:45:28 (#:model "stlc-sub-1" #:type enum #:average 5600.0 #:stderr +nan.0)) (heartbeat 2015-06-21T19:45:33 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:45:43 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T19:45:49 (#:model "stlc-sub-1" #:type enum #:counterexample (λ (S ((int → (list int)) → (int → (list int)))) ((λ (a int) a) -1)) #:iterations 1535 #:time 20622)) (new-average 2015-06-21T19:45:49 (#:model "stlc-sub-1" #:type enum #:average 13111.0 #:stderr 7510.999999999999)) (heartbeat 2015-06-21T19:45:53 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:46:03 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:46:13 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:46:23 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:46:33 (#:model "stlc-sub-1" #:type enum)) (gc-major 2015-06-21T19:46:34 (#:amount 87012192 #:time 258)) (heartbeat 2015-06-21T19:46:43 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:46:53 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T19:46:54 (#:model "stlc-sub-1" #:type enum #:counterexample ((λ (b int) b) -14) #:iterations 5044 #:time 65331)) (new-average 2015-06-21T19:46:54 (#:model "stlc-sub-1" #:type enum #:average 30517.666666666668 #:stderr 17938.70354227913)) (heartbeat 2015-06-21T19:47:03 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:47:13 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T19:47:15 (#:model "stlc-sub-1" #:type enum #:counterexample (λ (m ((int → (list int)) → (int → (list int)))) ((λ (a (list int)) a) nil)) #:iterations 1608 #:time 20661)) (new-average 2015-06-21T19:47:15 (#:model "stlc-sub-1" #:type enum #:average 28053.5 #:stderr 12921.712725099564)) (heartbeat 2015-06-21T19:47:23 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:47:33 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:47:43 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:47:53 (#:model "stlc-sub-1" #:type enum)) (gc-major 2015-06-21T19:47:54 (#:amount 98740984 #:time 313)) (heartbeat 2015-06-21T19:48:03 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T19:48:10 (#:model "stlc-sub-1" #:type enum #:counterexample (λ (P ((int → int) → ((list int) → (list int)))) ((λ (a int) a) 1)) #:iterations 4240 #:time 55175)) (new-average 2015-06-21T19:48:10 (#:model "stlc-sub-1" #:type enum #:average 33477.8 #:stderr 11384.437901802617)) (heartbeat 2015-06-21T19:48:13 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T19:48:13 (#:model "stlc-sub-1" #:type enum #:counterexample (λ (f (((list int) → int) → ((list int) → int))) ((λ (a int) a) 0)) #:iterations 290 #:time 2856)) (new-average 2015-06-21T19:48:13 (#:model "stlc-sub-1" #:type enum #:average 28374.166666666668 #:stderr 10604.277003224272)) (heartbeat 2015-06-21T19:48:23 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:48:33 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:48:43 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:48:53 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:49:03 (#:model "stlc-sub-1" #:type enum)) (gc-major 2015-06-21T19:49:03 (#:amount 90376120 #:time 261)) (counterexample 2015-06-21T19:49:06 (#:model "stlc-sub-1" #:type enum #:counterexample ((λ (c int) c) 29) #:iterations 4300 #:time 53124)) (new-average 2015-06-21T19:49:06 (#:model "stlc-sub-1" #:type enum #:average 31909.857142857145 #:stderr 9634.470878862328)) (counterexample 2015-06-21T19:49:12 (#:model "stlc-sub-1" #:type enum #:counterexample ((λ (a int) ((λ (a int) cons) a)) -7172) #:iterations 387 #:time 5507)) (new-average 2015-06-21T19:49:12 (#:model "stlc-sub-1" #:type enum #:average 28609.5 #:stderr 8972.715815579073)) (heartbeat 2015-06-21T19:49:13 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:49:23 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:49:33 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:49:43 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:49:53 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:50:03 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T19:50:08 (#:model "stlc-sub-1" #:type enum #:counterexample ((λ (a int) a) 5) #:iterations 4553 #:time 56544)) (new-average 2015-06-21T19:50:08 (#:model "stlc-sub-1" #:type enum #:average 31713.333333333332 #:stderr 8500.140103420517)) (heartbeat 2015-06-21T19:50:13 (#:model "stlc-sub-1" #:type enum)) (gc-major 2015-06-21T19:50:18 (#:amount 96212536 #:time 305)) (heartbeat 2015-06-21T19:50:23 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:50:33 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:50:43 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T19:50:48 (#:model "stlc-sub-1" #:type enum #:counterexample (λ (g (((list int) → (list int)) → ((list int) → (list int)))) ((λ (a int) a) -2)) #:iterations 3117 #:time 40328)) (new-average 2015-06-21T19:50:48 (#:model "stlc-sub-1" #:type enum #:average 32574.8 #:stderr 7651.407075825988)) (heartbeat 2015-06-21T19:50:53 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:51:03 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T19:51:04 (#:model "stlc-sub-1" #:type enum #:counterexample ((λ (a int) a) 1) #:iterations 1206 #:time 15702)) (new-average 2015-06-21T19:51:04 (#:model "stlc-sub-1" #:type enum #:average 31040.909090909092 #:stderr 7088.898534077511)) (heartbeat 2015-06-21T19:51:13 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:51:23 (#:model "stlc-sub-1" #:type enum)) (gc-major 2015-06-21T19:51:29 (#:amount 89644224 #:time 297)) (heartbeat 2015-06-21T19:51:33 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:51:43 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:51:53 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:52:03 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T19:52:11 (#:model "stlc-sub-1" #:type enum #:counterexample (λ (| | (((int → int) → (int → int)) → (int → (int → (list int))))) ((λ (a int) a) -18)) #:iterations 5346 #:time 67232)) (new-average 2015-06-21T19:52:11 (#:model "stlc-sub-1" #:type enum #:average 34056.833333333336 #:stderr 7139.528536587515)) (heartbeat 2015-06-21T19:52:13 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T19:52:17 (#:model "stlc-sub-1" #:type enum #:counterexample ((λ (b int) b) 14) #:iterations 423 #:time 5765)) (new-average 2015-06-21T19:52:17 (#:model "stlc-sub-1" #:type enum #:average 31880.538461538465 #:stderr 6918.608779500904)) (heartbeat 2015-06-21T19:52:23 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:52:33 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T19:52:42 (#:model "stlc-sub-1" #:type enum #:counterexample ((λ (b int) b) 0) #:iterations 2018 #:time 25246)) (new-average 2015-06-21T19:52:42 (#:model "stlc-sub-1" #:type enum #:average 31406.64285714286 #:stderr 6422.893473124979)) (heartbeat 2015-06-21T19:52:43 (#:model "stlc-sub-1" #:type enum)) (gc-major 2015-06-21T19:52:45 (#:amount 97279272 #:time 308)) (heartbeat 2015-06-21T19:52:53 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:53:03 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:53:13 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:53:23 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T19:53:32 (#:model "stlc-sub-1" #:type enum #:counterexample (λ (X (((list int) → int) → (int → (int → int)))) ((λ (a int) a) 0)) #:iterations 3934 #:time 50221)) (new-average 2015-06-21T19:53:32 (#:model "stlc-sub-1" #:type enum #:average 32660.933333333334 #:stderr 6109.527839652756)) (heartbeat 2015-06-21T19:53:33 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:53:43 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:53:53 (#:model "stlc-sub-1" #:type enum)) (gc-major 2015-06-21T19:53:58 (#:amount 91064512 #:time 301)) (heartbeat 2015-06-21T19:54:03 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:54:13 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:54:23 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:54:33 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:54:43 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:54:53 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:55:03 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:55:13 (#:model "stlc-sub-1" #:type enum)) (gc-major 2015-06-21T19:55:17 (#:amount 96523904 #:time 305)) (heartbeat 2015-06-21T19:55:23 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:55:33 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:55:43 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:55:53 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T19:55:59 (#:model "stlc-sub-1" #:type enum #:counterexample (λ (| | ((int → (list int)) → ((int → int) → int))) ((λ (a int) a) 1)) #:iterations 10933 #:time 146952)) (new-average 2015-06-21T19:55:59 (#:model "stlc-sub-1" #:type enum #:average 39804.125 #:stderr 9147.990287887918)) (heartbeat 2015-06-21T19:56:03 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T19:56:04 (#:model "stlc-sub-1" #:type enum #:counterexample ((λ (a (list int)) a) nil) #:iterations 366 #:time 5130)) (new-average 2015-06-21T19:56:04 (#:model "stlc-sub-1" #:type enum #:average 37764.470588235294 #:stderr 8831.791260053602)) (heartbeat 2015-06-21T19:56:13 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T19:56:14 (#:model "stlc-sub-1" #:type enum #:counterexample (λ (t (((list int) → int) → int)) ((λ (a int) a) -1)) #:iterations 810 #:time 9465)) (new-average 2015-06-21T19:56:14 (#:model "stlc-sub-1" #:type enum #:average 36192.27777777778 #:stderr 8473.818547532566)) (heartbeat 2015-06-21T19:56:23 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:56:33 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T19:56:36 (#:model "stlc-sub-1" #:type enum #:counterexample (λ (‹ ((int → int) → ((int → int) → int))) ((λ (b int) b) -3)) #:iterations 1595 #:time 22325)) (new-average 2015-06-21T19:56:36 (#:model "stlc-sub-1" #:type enum #:average 35462.42105263158 #:stderr 8048.590393571048)) (gc-major 2015-06-21T19:56:38 (#:amount 91004984 #:time 314)) (heartbeat 2015-06-21T19:56:43 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:56:53 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:57:03 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T19:57:10 (#:model "stlc-sub-1" #:type enum #:counterexample ((λ (a int) a) 0) #:iterations 2316 #:time 33307)) (new-average 2015-06-21T19:57:10 (#:model "stlc-sub-1" #:type enum #:average 35354.65 #:stderr 7636.3238008167955)) (heartbeat 2015-06-21T19:57:13 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:57:23 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:57:33 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:57:43 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:57:53 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T19:57:54 (#:model "stlc-sub-1" #:type enum #:counterexample ((λ (a int) a) 5) #:iterations 3173 #:time 44589)) (new-average 2015-06-21T19:57:54 (#:model "stlc-sub-1" #:type enum #:average 35794.380952380954 #:stderr 7276.891055636392)) (counterexample 2015-06-21T19:58:02 (#:model "stlc-sub-1" #:type enum #:counterexample (((λ (a int) (λ (a int) a)) -1) -1006) #:iterations 542 #:time 7625)) (new-average 2015-06-21T19:58:02 (#:model "stlc-sub-1" #:type enum #:average 34513.954545454544 #:stderr 7055.403113121617)) (gc-major 2015-06-21T19:58:03 (#:amount 96671184 #:time 305)) (heartbeat 2015-06-21T19:58:03 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:58:13 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:58:23 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T19:58:31 (#:model "stlc-sub-1" #:type enum #:counterexample ((λ (a (list int)) a) nil) #:iterations 2268 #:time 29302)) (new-average 2015-06-21T19:58:31 (#:model "stlc-sub-1" #:type enum #:average 34287.34782608695 #:stderr 6745.478481699422)) (heartbeat 2015-06-21T19:58:33 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:58:43 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T19:58:48 (#:model "stlc-sub-1" #:type enum #:counterexample (((λ (a int) (λ (a int) a)) 1) 2816) #:iterations 1458 #:time 17304)) (new-average 2015-06-21T19:58:48 (#:model "stlc-sub-1" #:type enum #:average 33579.70833333333 #:stderr 6496.9564877091025)) (heartbeat 2015-06-21T19:58:53 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:59:03 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:59:13 (#:model "stlc-sub-1" #:type enum)) (gc-major 2015-06-21T19:59:16 (#:amount 91191304 #:time 299)) (heartbeat 2015-06-21T19:59:23 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T19:59:26 (#:model "stlc-sub-1" #:type enum #:counterexample ((λ (a int) a) -24) #:iterations 2834 #:time 37720)) (new-average 2015-06-21T19:59:26 (#:model "stlc-sub-1" #:type enum #:average 33745.31999999999 #:stderr 6233.861992301937)) (heartbeat 2015-06-21T19:59:33 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T19:59:39 (#:model "stlc-sub-1" #:type enum #:counterexample (λ (b (((list int) → (int → int)) → ((int → int) → int))) ((λ (b int) b) 11)) #:iterations 1063 #:time 12557)) (new-average 2015-06-21T19:59:39 (#:model "stlc-sub-1" #:type enum #:average 32930.38461538461 #:stderr 6044.488779828072)) (heartbeat 2015-06-21T19:59:43 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T19:59:53 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:00:03 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:00:13 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:00:19 (#:model "stlc-sub-1" #:type enum #:counterexample (λ (|"| (((list int) → (int → int)) → (int → (list int)))) ((λ (a int) a) -4)) #:iterations 3178 #:time 40626)) (new-average 2015-06-21T20:00:19 (#:model "stlc-sub-1" #:type enum #:average 33215.4074074074 #:stderr 5823.291486906643)) (heartbeat 2015-06-21T20:00:23 (#:model "stlc-sub-1" #:type enum)) (gc-major 2015-06-21T20:00:33 (#:amount 96475120 #:time 308)) (heartbeat 2015-06-21T20:00:33 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:00:43 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:00:53 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:01:03 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:01:13 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:01:14 (#:model "stlc-sub-1" #:type enum #:counterexample ((λ (b int) b) 15) #:iterations 4182 #:time 54755)) (new-average 2015-06-21T20:01:14 (#:model "stlc-sub-1" #:type enum #:average 33984.678571428565 #:stderr 5663.948032274928)) (counterexample 2015-06-21T20:01:14 (#:model "stlc-sub-1" #:type enum #:counterexample ((λ (a (list int)) a) nil) #:iterations 9 #:time 99)) (new-average 2015-06-21T20:01:14 (#:model "stlc-sub-1" #:type enum #:average 32816.20689655172 #:stderr 5588.6669591455)) (heartbeat 2015-06-21T20:01:23 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:01:32 (#:model "stlc-sub-1" #:type enum #:counterexample ((λ (b int) b) -14) #:iterations 1449 #:time 18416)) (new-average 2015-06-21T20:01:32 (#:model "stlc-sub-1" #:type enum #:average 32336.199999999993 #:stderr 5420.460476346284)) (heartbeat 2015-06-21T20:01:33 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:01:43 (#:model "stlc-sub-1" #:type enum)) (gc-major 2015-06-21T20:01:47 (#:amount 91152472 #:time 261)) (counterexample 2015-06-21T20:01:51 (#:model "stlc-sub-1" #:type enum #:counterexample ((λ (a int) a) -1) #:iterations 1366 #:time 18532)) (new-average 2015-06-21T20:01:51 (#:model "stlc-sub-1" #:type enum #:average 31890.903225806444 #:stderr 5261.568903834231)) (heartbeat 2015-06-21T20:01:53 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:02:03 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:02:13 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:02:23 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:02:26 (#:model "stlc-sub-1" #:type enum #:counterexample (λ ( ((int → (int → int)) → (list int))) ((λ (a int) a) -2)) #:iterations 2726 #:time 35055)) (new-average 2015-06-21T20:02:26 (#:model "stlc-sub-1" #:type enum #:average 31989.781249999993 #:stderr 5095.451646846583)) (heartbeat 2015-06-21T20:02:33 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:02:43 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:02:53 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:03:03 (#:model "stlc-sub-1" #:type enum)) (gc-major 2015-06-21T20:03:05 (#:amount 96626224 #:time 263)) (heartbeat 2015-06-21T20:03:13 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:03:23 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:03:33 (#:model "stlc-sub-1" #:type enum #:counterexample (λ (Œ (((list int) → (int → int)) → ((list int) → ((list int) → int)))) (λ (e (int → (int → int))) ((λ (a (list int)) a) nil))) #:iterations 5224 #:time 66920)) (new-average 2015-06-21T20:03:33 (#:model "stlc-sub-1" #:type enum #:average 33048.24242424242 #:stderr 5050.783539392656)) (heartbeat 2015-06-21T20:03:33 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:03:43 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:03:53 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:04:03 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:04:13 (#:model "stlc-sub-1" #:type enum)) (gc-major 2015-06-21T20:04:21 (#:amount 91152496 #:time 303)) (heartbeat 2015-06-21T20:04:23 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:04:32 (#:model "stlc-sub-1" #:type enum #:counterexample (λ (F (((list int) → (int → int)) → (int → (list int)))) ((λ (a int) a) -1)) #:iterations 4259 #:time 59537)) (new-average 2015-06-21T20:04:32 (#:model "stlc-sub-1" #:type enum #:average 33827.323529411755 #:stderr 4961.528909591684)) (heartbeat 2015-06-21T20:04:33 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:04:43 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:04:53 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:05:02 (#:model "stlc-sub-1" #:type enum #:counterexample ((λ (c int) c) 5) #:iterations 2082 #:time 30101)) (new-average 2015-06-21T20:05:02 (#:model "stlc-sub-1" #:type enum #:average 33720.85714285713 #:stderr 4818.862074286459)) (heartbeat 2015-06-21T20:05:03 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:05:13 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:05:23 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:05:33 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:05:43 (#:model "stlc-sub-1" #:type enum)) (gc-major 2015-06-21T20:05:47 (#:amount 96574696 #:time 311)) (heartbeat 2015-06-21T20:05:53 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:05:57 (#:model "stlc-sub-1" #:type enum #:counterexample (λ (ؙ ((((list int) → int) → ((list int) → int)) → ((int → (list int)) → int))) (λ (r (((list int) → int) → ((list int) → int))) ((λ (a (list int)) a) nil))) #:iterations 3763 #:time 54858)) (new-average 2015-06-21T20:05:57 (#:model "stlc-sub-1" #:type enum #:average 34307.999999999985 #:stderr 4719.755172389939)) (heartbeat 2015-06-21T20:06:03 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:06:13 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:06:23 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:06:33 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:06:43 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:06:53 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:07:03 (#:model "stlc-sub-1" #:type enum)) (gc-major 2015-06-21T20:07:11 (#:amount 91090504 #:time 302)) (heartbeat 2015-06-21T20:07:13 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:07:23 (#:model "stlc-sub-1" #:type enum #:counterexample ((λ (a int) a) 1) #:iterations 5917 #:time 85750)) (new-average 2015-06-21T20:07:23 (#:model "stlc-sub-1" #:type enum #:average 35698.32432432431 #:stderr 4796.350456470248)) (heartbeat 2015-06-21T20:07:23 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:07:33 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:07:43 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:07:46 (#:model "stlc-sub-1" #:type enum #:counterexample (λ (ᐎ ((int → ((list int) → int)) → (int → int))) (λ (| | ((int → (list int)) → (int → (int → int)))) ((λ (a int) a) -1))) #:iterations 1624 #:time 23419)) (new-average 2015-06-21T20:07:46 (#:model "stlc-sub-1" #:type enum #:average 35375.15789473683 #:stderr 4679.596771349769)) (heartbeat 2015-06-21T20:07:53 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:07:59 (#:model "stlc-sub-1" #:type enum #:counterexample (λ (Z (((int → (list int)) → ((list int) → int)) → (((list int) → int) → (int → (list int))))) ((λ (b int) b) 17)) #:iterations 948 #:time 12808)) (new-average 2015-06-21T20:07:59 (#:model "stlc-sub-1" #:type enum #:average 34796.51282051281 #:stderr 4594.610930836789)) (heartbeat 2015-06-21T20:08:03 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:08:07 (#:model "stlc-sub-1" #:type enum #:counterexample (λ ( (int → (int → (list int)))) ((λ (a int) a) 2)) #:iterations 559 #:time 8080)) (new-average 2015-06-21T20:08:07 (#:model "stlc-sub-1" #:type enum #:average 34128.59999999999 #:stderr 4527.806826851389)) (heartbeat 2015-06-21T20:08:13 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:08:23 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:08:33 (#:model "stlc-sub-1" #:type enum)) (gc-major 2015-06-21T20:08:35 (#:amount 96689304 #:time 311)) (heartbeat 2015-06-21T20:08:43 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:08:53 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:09:03 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:09:13 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:09:23 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:09:33 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:09:43 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:09:53 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:09:55 (#:model "stlc-sub-1" #:type enum #:counterexample ((λ (a int) a) -5) #:iterations 7492 #:time 108111)) (new-average 2015-06-21T20:09:55 (#:model "stlc-sub-1" #:type enum #:average 35933.0487804878 #:stderr 4770.431803453847)) (gc-major 2015-06-21T20:09:59 (#:amount 91172224 #:time 305)) (heartbeat 2015-06-21T20:10:03 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:10:13 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:10:23 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:10:33 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:10:36 (#:model "stlc-sub-1" #:type enum #:counterexample ((λ (a (list int)) a) nil) #:iterations 2813 #:time 40837)) (new-average 2015-06-21T20:10:36 (#:model "stlc-sub-1" #:type enum #:average 36049.80952380952 #:stderr 4656.928715687443)) (counterexample 2015-06-21T20:10:38 (#:model "stlc-sub-1" #:type enum #:counterexample ((λ (a int) (cons a)) 213) #:iterations 140 #:time 2021)) (new-average 2015-06-21T20:10:38 (#:model "stlc-sub-1" #:type enum #:average 35258.441860465115 #:stderr 4615.685307937201)) (heartbeat 2015-06-21T20:10:43 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:10:53 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:11:03 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:11:09 (#:model "stlc-sub-1" #:type enum #:counterexample (λ (ύ (((int → (int → int)) → (int → (list int))) → (((int → int) → (int → int)) → (int → int)))) (λ (n ((list int) → int)) ((λ (a int) a) -3))) #:iterations 2184 #:time 31473)) (new-average 2015-06-21T20:11:09 (#:model "stlc-sub-1" #:type enum #:average 35172.40909090909 #:stderr 4510.38399959511)) (heartbeat 2015-06-21T20:11:14 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:11:24 (#:model "stlc-sub-1" #:type enum)) (gc-major 2015-06-21T20:11:26 (#:amount 96439120 #:time 310)) (heartbeat 2015-06-21T20:11:34 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:11:44 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:11:54 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:12:04 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:12:14 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:12:24 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:12:30 (#:model "stlc-sub-1" #:type enum #:counterexample ((λ (a (list int)) a) nil) #:iterations 5572 #:time 80354)) (new-average 2015-06-21T20:12:30 (#:model "stlc-sub-1" #:type enum #:average 36176.444444444445 #:stderr 4521.89035943856)) (heartbeat 2015-06-21T20:12:34 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:12:44 (#:model "stlc-sub-1" #:type enum)) (gc-major 2015-06-21T20:12:48 (#:amount 91156896 #:time 300)) (heartbeat 2015-06-21T20:12:54 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:13:04 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:13:14 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:13:24 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:13:34 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:13:44 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:13:54 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:14:04 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:14:09 (#:model "stlc-sub-1" #:type enum #:counterexample (λ ( (int → (list int))) ((λ (a int) a) 0)) #:iterations 7191 #:time 99060)) (new-average 2015-06-21T20:14:09 (#:model "stlc-sub-1" #:type enum #:average 37543.47826086957 #:stderr 4628.958032683704)) (gc-major 2015-06-21T20:14:10 (#:amount 96571816 #:time 264)) (heartbeat 2015-06-21T20:14:14 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:14:24 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:14:34 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:14:44 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:14:54 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:15:04 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:15:14 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:15:24 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:15:27 (#:model "stlc-sub-1" #:type enum #:counterexample ((λ (l int) l) -26597) #:iterations 5824 #:time 78194)) (new-average 2015-06-21T20:15:27 (#:model "stlc-sub-1" #:type enum #:average 38408.382978723406 #:stderr 4611.237866553443)) (gc-major 2015-06-21T20:15:28 (#:amount 91342816 #:time 300)) (heartbeat 2015-06-21T20:15:34 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:15:44 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:15:54 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:15:58 (#:model "stlc-sub-1" #:type enum #:counterexample ((λ (c int) c) 41) #:iterations 2208 #:time 31045)) (new-average 2015-06-21T20:15:58 (#:model "stlc-sub-1" #:type enum #:average 38254.97916666667 #:stderr 4516.754101554479)) (heartbeat 2015-06-21T20:16:04 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:16:14 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:16:24 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:16:34 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:16:38 (#:model "stlc-sub-1" #:type enum #:counterexample (λ (梳 ((((int → int) → int) → ((list int) → (list int))) → ((int → (int → (list int))) → ((list int) → (int → int))))) (λ (U ((int → (int → (list int))) → (list int))) ((λ (a int) a) 1))) #:iterations 2902 #:time 40442)) (new-average 2015-06-21T20:16:38 (#:model "stlc-sub-1" #:type enum #:average 38299.612244897966 #:stderr 4423.840309988505)) (heartbeat 2015-06-21T20:16:44 (#:model "stlc-sub-1" #:type enum)) (gc-major 2015-06-21T20:16:51 (#:amount 96219216 #:time 308)) (heartbeat 2015-06-21T20:16:54 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:17:04 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:17:14 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:17:24 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:17:34 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:17:44 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:17:54 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:18:04 (#:model "stlc-sub-1" #:type enum)) (gc-major 2015-06-21T20:18:10 (#:amount 91050664 #:time 299)) (heartbeat 2015-06-21T20:18:14 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:18:24 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:18:34 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:18:44 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:18:54 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:19:01 (#:model "stlc-sub-1" #:type enum #:counterexample (((λ (c int) (λ (a int) a)) 22) 13694) #:iterations 10957 #:time 143029)) (new-average 2015-06-21T20:19:01 (#:model "stlc-sub-1" #:type enum #:average 40394.200000000004 #:stderr 4814.026010375456)) (heartbeat 2015-06-21T20:19:04 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:19:14 (#:model "stlc-sub-1" #:type enum)) (gc-major 2015-06-21T20:19:17 (#:amount 96915632 #:time 261)) (heartbeat 2015-06-21T20:19:24 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:19:32 (#:model "stlc-sub-1" #:type enum #:counterexample ((λ (a int) a) -3) #:iterations 2798 #:time 30909)) (new-average 2015-06-21T20:19:32 (#:model "stlc-sub-1" #:type enum #:average 40208.21568627451 #:stderr 4722.353130222324)) (counterexample 2015-06-21T20:19:34 (#:model "stlc-sub-1" #:type enum #:counterexample ((λ (d int) d) 168) #:iterations 119 #:time 1702)) (new-average 2015-06-21T20:19:34 (#:model "stlc-sub-1" #:type enum #:average 39467.71153846154 #:stderr 4689.482845766306)) (heartbeat 2015-06-21T20:19:34 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:19:44 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:19:54 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:20:04 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:20:14 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:20:23 (#:model "stlc-sub-1" #:type enum #:counterexample ((λ (b int) b) -2) #:iterations 3458 #:time 49309)) (new-average 2015-06-21T20:20:23 (#:model "stlc-sub-1" #:type enum #:average 39653.377358490565 #:stderr 4603.896468321222)) (heartbeat 2015-06-21T20:20:24 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:20:34 (#:model "stlc-sub-1" #:type enum)) (gc-major 2015-06-21T20:20:38 (#:amount 91026896 #:time 301)) (heartbeat 2015-06-21T20:20:44 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:20:54 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:21:04 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:21:14 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:21:24 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:21:25 (#:model "stlc-sub-1" #:type enum #:counterexample (λ (| | ((int → (list int)) → ((list int) → int))) ((λ (a int) a) 0)) #:iterations 4879 #:time 62416)) (new-average 2015-06-21T20:21:25 (#:model "stlc-sub-1" #:type enum #:average 40074.90740740741 #:stderr 4537.45725287205)) (heartbeat 2015-06-21T20:21:34 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:21:41 (#:model "stlc-sub-1" #:type enum #:counterexample (λ (o (((int → int) → int) → int)) ((λ (a int) a) 1)) #:iterations 1129 #:time 15431)) (new-average 2015-06-21T20:21:41 (#:model "stlc-sub-1" #:type enum #:average 39626.836363636365 #:stderr 4476.674277674558)) (heartbeat 2015-06-21T20:21:44 (#:model "stlc-sub-1" #:type enum)) (gc-major 2015-06-21T20:21:54 (#:amount 96944336 #:time 328)) (heartbeat 2015-06-21T20:21:54 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:22:04 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:22:14 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:22:21 (#:model "stlc-sub-1" #:type enum #:counterexample (λ (򩟤v (((((list int) → (list int)) → (int → (int → int))) → (((list int) → (int → int)) → (int → (int → int)))) → (((int → (list int)) → ((list int) → (int → int))) → (((list int) → (list int)) → int)))) (λ (ڌ ((((list int) → (int → int)) → (int → int)) → ((int → (list int)) → (int → (list int))))) ((λ (c int) c) 169))) #:iterations 3080 #:time 39917)) (new-average 2015-06-21T20:22:21 (#:model "stlc-sub-1" #:type enum #:average 39632.017857142855 #:stderr 4396.009926330558)) (heartbeat 2015-06-21T20:22:24 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:22:34 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:22:44 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:22:54 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:23:04 (#:model "stlc-sub-1" #:type enum)) (gc-major 2015-06-21T20:23:10 (#:amount 90718624 #:time 309)) (heartbeat 2015-06-21T20:23:14 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:23:24 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:23:34 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:23:37 (#:model "stlc-sub-1" #:type enum #:counterexample ((λ (a (list int)) a) nil) #:iterations 5591 #:time 76357)) (new-average 2015-06-21T20:23:37 (#:model "stlc-sub-1" #:type enum #:average 40276.31578947368 #:stderr 4366.000036247706)) (heartbeat 2015-06-21T20:23:44 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:23:54 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:24:04 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:24:10 (#:model "stlc-sub-1" #:type enum #:counterexample (λ (|6| ((int → int) → int)) ((λ (a int) a) 4)) #:iterations 2346 #:time 32963)) (new-average 2015-06-21T20:24:10 (#:model "stlc-sub-1" #:type enum #:average 40150.22413793103 #:stderr 4291.916423068278)) (heartbeat 2015-06-21T20:24:14 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:24:24 (#:model "stlc-sub-1" #:type enum)) (gc-major 2015-06-21T20:24:34 (#:amount 97464760 #:time 318)) (heartbeat 2015-06-21T20:24:34 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:24:44 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:24:54 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:25:04 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:25:13 (#:model "stlc-sub-1" #:type enum #:counterexample (λ (Ä (((list int) → (list int)) → ((list int) → int))) ((λ (b int) b) 11)) #:iterations 4828 #:time 63622)) (new-average 2015-06-21T20:25:13 (#:model "stlc-sub-1" #:type enum #:average 40548.05084745762 #:stderr 4237.261776847297)) (heartbeat 2015-06-21T20:25:14 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:25:24 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:25:34 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:25:44 (#:model "stlc-sub-1" #:type enum)) (gc-major 2015-06-21T20:25:49 (#:amount 90895800 #:time 312)) (heartbeat 2015-06-21T20:25:54 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:26:04 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:26:14 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:26:24 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:26:34 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:26:44 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:26:54 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:27:04 (#:model "stlc-sub-1" #:type enum)) (gc-major 2015-06-21T20:27:14 (#:amount 96844448 #:time 305)) (counterexample 2015-06-21T20:27:14 (#:model "stlc-sub-1" #:type enum #:counterexample (λ (|4| ((int → (int → (list int))) → ((list int) → int))) ((λ (b int) b) -6)) #:iterations 8619 #:time 120512)) (new-average 2015-06-21T20:27:14 (#:model "stlc-sub-1" #:type enum #:average 41880.783333333326 #:stderr 4374.023738571673)) (heartbeat 2015-06-21T20:27:14 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:27:24 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:27:34 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:27:44 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:27:54 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:27:56 (#:model "stlc-sub-1" #:type enum #:counterexample (λ (j ((int → (list int)) → (int → (list int)))) ((λ (a (list int)) a) nil)) #:iterations 3046 #:time 42355)) (new-average 2015-06-21T20:27:56 (#:model "stlc-sub-1" #:type enum #:average 41888.557377049176 #:stderr 4301.727870249997)) (counterexample 2015-06-21T20:28:02 (#:model "stlc-sub-1" #:type enum #:counterexample (λ (m (((list int) → (int → int)) → ((int → int) → (list int)))) ((λ (a int) a) 1)) #:iterations 388 #:time 5527)) (new-average 2015-06-21T20:28:02 (#:model "stlc-sub-1" #:type enum #:average 41302.08064516129 #:stderr 4272.222673605702)) (heartbeat 2015-06-21T20:28:04 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:28:14 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:28:24 (#:model "stlc-sub-1" #:type enum)) (gc-major 2015-06-21T20:28:32 (#:amount 91570664 #:time 300)) (heartbeat 2015-06-21T20:28:34 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:28:44 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:28:54 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:29:04 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:29:14 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:29:20 (#:model "stlc-sub-1" #:type enum #:counterexample (λ (b int) ((λ (a int) a) b)) #:iterations 6014 #:time 78388)) (new-average 2015-06-21T20:29:20 (#:model "stlc-sub-1" #:type enum #:average 41890.74603174603 #:stderr 4244.8779181109885)) (heartbeat 2015-06-21T20:29:24 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:29:29 (#:model "stlc-sub-1" #:type enum #:counterexample ((λ (h int) h) 649) #:iterations 608 #:time 8445)) (new-average 2015-06-21T20:29:29 (#:model "stlc-sub-1" #:type enum #:average 41368.15625 #:stderr 4210.581340834907)) (heartbeat 2015-06-21T20:29:34 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:29:35 (#:model "stlc-sub-1" #:type enum #:counterexample (((λ (a int) (λ (a int) a)) 0) 1737) #:iterations 552 #:time 6677)) (new-average 2015-06-21T20:29:35 (#:model "stlc-sub-1" #:type enum #:average 40834.446153846155 #:stderr 4179.51362589635)) (heartbeat 2015-06-21T20:29:44 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:29:48 (#:model "stlc-sub-1" #:type enum #:counterexample ((λ (b int) b) 0) #:iterations 1000 #:time 13171)) (new-average 2015-06-21T20:29:48 (#:model "stlc-sub-1" #:type enum #:average 40415.30303030303 #:stderr 4136.988233969795)) (gc-major 2015-06-21T20:29:50 (#:amount 96052928 #:time 309)) (heartbeat 2015-06-21T20:29:54 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:30:03 (#:model "stlc-sub-1" #:type enum #:counterexample (λ (| | (((int → int) → (list int)) → ((list int) → (int → int)))) ((λ (b int) b) 5)) #:iterations 1204 #:time 14389)) (new-average 2015-06-21T20:30:03 (#:model "stlc-sub-1" #:type enum #:average 40026.85074626866 #:stderr 4093.2482338773552)) (heartbeat 2015-06-21T20:30:04 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:30:14 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:30:24 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:30:34 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:30:44 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:30:54 (#:model "stlc-sub-1" #:type enum)) (gc-major 2015-06-21T20:31:04 (#:amount 91102632 #:time 298)) (heartbeat 2015-06-21T20:31:04 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:31:14 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:31:24 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:31:34 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:31:44 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:31:54 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:32:04 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:32:14 (#:model "stlc-sub-1" #:type enum)) (gc-major 2015-06-21T20:32:20 (#:amount 96795432 #:time 266)) (heartbeat 2015-06-21T20:32:24 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:32:34 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:32:44 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:32:54 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:32:58 (#:model "stlc-sub-1" #:type enum #:counterexample (λ (E (((list int) → (list int)) → ((list int) → (list int)))) ((λ (a (list int)) a) nil)) #:iterations 13425 #:time 175581)) (new-average 2015-06-21T20:32:58 (#:model "stlc-sub-1" #:type enum #:average 42020.29411764706 #:stderr 4498.4122577500075)) (heartbeat 2015-06-21T20:33:04 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:33:14 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:33:24 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:33:34 (#:model "stlc-sub-1" #:type enum)) (gc-major 2015-06-21T20:33:35 (#:amount 91135504 #:time 308)) (counterexample 2015-06-21T20:33:42 (#:model "stlc-sub-1" #:type enum #:counterexample ((λ (a int) a) 8) #:iterations 3526 #:time 43946)) (new-average 2015-06-21T20:33:42 (#:model "stlc-sub-1" #:type enum #:average 42048.188405797104 #:stderr 4432.826246403971)) (heartbeat 2015-06-21T20:33:44 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:33:54 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:34:04 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:34:14 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:34:19 (#:model "stlc-sub-1" #:type enum #:counterexample ((λ (a (list int)) a) nil) #:iterations 2835 #:time 36725)) (new-average 2015-06-21T20:34:19 (#:model "stlc-sub-1" #:type enum #:average 41972.14285714286 #:stderr 4369.703005399545)) (heartbeat 2015-06-21T20:34:24 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:34:34 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:34:44 (#:model "stlc-sub-1" #:type enum)) (gc-major 2015-06-21T20:34:52 (#:amount 96686888 #:time 261)) (heartbeat 2015-06-21T20:34:54 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:35:04 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:35:07 (#:model "stlc-sub-1" #:type enum #:counterexample (λ (ȶ ((((list int) → int) → int) → ((list int) → ((list int) → int)))) ((λ (c int) c) 18)) #:iterations 3783 #:time 47684)) (new-average 2015-06-21T20:35:07 (#:model "stlc-sub-1" #:type enum #:average 42052.59154929578 #:stderr 4308.469405617947)) (heartbeat 2015-06-21T20:35:14 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:35:24 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:35:34 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:35:44 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:35:54 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:36:04 (#:model "stlc-sub-1" #:type enum)) (gc-major 2015-06-21T20:36:06 (#:amount 91063128 #:time 257)) (heartbeat 2015-06-21T20:36:14 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:36:24 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:36:34 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:36:39 (#:model "stlc-sub-1" #:type enum #:counterexample ((λ (a int) ((λ (a int) a) a)) -1144) #:iterations 7120 #:time 92080)) (new-average 2015-06-21T20:36:39 (#:model "stlc-sub-1" #:type enum #:average 42747.41666666667 #:stderr 4304.654946954925)) (heartbeat 2015-06-21T20:36:44 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:36:54 (#:model "stlc-sub-1" #:type enum #:counterexample (((λ (a int) (λ (a int) a)) -5) -17849) #:iterations 1149 #:time 15327)) (new-average 2015-06-21T20:36:54 (#:model "stlc-sub-1" #:type enum #:average 42371.79452054795 #:stderr 4261.8626785540555)) (heartbeat 2015-06-21T20:36:54 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:37:00 (#:model "stlc-sub-1" #:type enum #:counterexample ((λ (a int) (cons a)) 113) #:iterations 520 #:time 5914)) (new-average 2015-06-21T20:37:00 (#:model "stlc-sub-1" #:type enum #:average 41879.108108108114 #:stderr 4232.647954048723)) (heartbeat 2015-06-21T20:37:04 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:37:14 (#:model "stlc-sub-1" #:type enum)) (gc-major 2015-06-21T20:37:22 (#:amount 96887752 #:time 310)) (heartbeat 2015-06-21T20:37:24 (#:model "stlc-sub-1" #:type enum)) (heartbeat 2015-06-21T20:37:34 (#:model "stlc-sub-1" #:type enum)) (counterexample 2015-06-21T20:37:44 (#:model "stlc-sub-1" #:type enum #:counterexample (λ (C ((int → int) → (int → (list int)))) ((λ (a int) a) 0)) #:iterations 3672 #:time 44550)) (new-average 2015-06-21T20:37:44 (#:model "stlc-sub-1" #:type enum #:average 41914.72000000001 #:stderr 4175.9831590112935)) (finished 2015-06-21T20:37:44 (#:model "stlc-sub-1" #:type enum #:time-ms 3143625 #:attempts 236018 #:num-counterexamples 75 #:rate-terms/s 75.07829337150582 #:attempts/cexp 3146.9066666666668))
false
cd0a5f1c43e324eeef5c56766da719ed90bc53cb
2bb711eecf3d1844eb209c39e71dea21c9c13f5c
/rosette/base/unbound/call-graph.rkt
8a5a7a5df7d58ac6aefbc235a6c5b743497b3fdc
[ "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
4,859
rkt
call-graph.rkt
#lang racket (require racket/dict syntax/id-table syntax/id-set) (provide with-call called? stack-size recursive? mutual-recursion-root? make-associations associate associated? reset-associations-cache fold/reachable) ;; ----------------- Call graph ----------------- ;; ; Maps id to its callees (define call-graph (make-free-id-table)) (define (connect v1 v2) (free-id-set-add! (free-id-table-ref! call-graph v1 (mutable-free-id-set)) v2)) (define (in-callees v) (in-free-id-set (free-id-table-ref call-graph v (immutable-free-id-set)))) ;; ----------------- Call stack ----------------- ;; (define current-call-stack (make-parameter (list (box (cons #'%:main #f))))) ; Updates the internal information about the call graph evaluating the given bodies. (define-syntax-rule (with-call id body body-rest ...) (let ([caller (car (unbox (car (current-call-stack))))]) (detect-recursion id) (parameterize ([current-call-stack (cons (box (cons id #f)) (current-call-stack))]) (connect caller id) body body-rest ...))) ; Returns #f if 'id is not currently in a call stack or a tail of a call stack ; below the last call of 'id otherwise. (define (called? id) (member id (current-call-stack) (λ (id frame) (free-identifier=? id (car (unbox frame)))))) ; Returns a number of entries in current call stack. Note that top-level context is also included ; into call-stack. (define (stack-size) (length (current-call-stack))) ;; ----------------- Recursion detection ----------------- ;; (define recursive-functions (mutable-free-id-set)) (define (detect-recursion id) (when (called? id) (let ([mutual-recursion-component (dropf-right (current-call-stack) (λ (frame) (not (free-identifier=? id (car (unbox frame))))))]) (for ([frame mutual-recursion-component]) (free-id-set-add! recursive-functions (car (unbox frame))) (set-box! frame (cons (car (unbox frame)) #f))) (unless (empty? mutual-recursion-component) (set-box! (last mutual-recursion-component) (cons id #t)))))) ; Returns #t if 'id is an identifier of (mutually) recursive function. (define (recursive? id) (free-id-set-member? recursive-functions id)) ; Returns #t if current callstack top is a (mutually) recusive function and ; if it was called by function that is not (mutually) recursive. ; In other words, returns #f if and only if current call stack top is call ; in the middle of mutually recursive sequence of calls. (define (mutual-recursion-root?) (cdr (unbox (car (current-call-stack))))) ;; ----------------- Associations ----------------- ;; (struct associations (storage cache)) ; Associations is a data structure that allows associating some arbitrary ; data with call graph vertices (i.e. solvable functions). The associated ; information can be then folded with fold/reachable. The results of folding ; will be cached in associations structure itself. ; make-associations returns fresh associations cache. (define (make-associations) (associations (make-free-id-table) (make-free-id-table))) ; Erases all data memorized for fold/reachable queries. (define (reset-associations-cache associations) (dict-clear! (associations-cache associations))) ; Overwrites the current value associated with 'id. (define (associate associations id info) (free-id-table-set! (associations-storage associations) id info)) ; Returns true if associations cache contains some info associated with 'id. (define (associated? associations id) (dict-has-key? (associations-storage associations) id)) ; Same as foldl, but folds associations with all reachable from 'id vertices. ; The results of folding are cached, so next time when some caller of 'id ; will be folded, reacable from 'id vertices will not be traversed one more time. ; Instead, prevoious results will be reused. That means that the set of reachable ; from 'id vertices should not be changed between fold/reachable calls. If it does ; reset-associations-cache should be called. (define (fold/reachable associations id proc) (let ([storage (associations-storage associations)] [cache (associations-cache associations)]) (if (dict-has-key? cache id) (free-id-table-ref cache id) (let* ([current-assoc (free-id-table-ref! storage id '())] [_ (free-id-table-set! cache id current-assoc)] [result (for/fold ([acc current-assoc]) ([v (in-callees id)]) (proc acc (fold/reachable associations v proc)))]) (free-id-table-set! cache id result) result))))
true
eda834bea76c4ec733181da235b65a08ac14132d
6aec9716c8d9cfea8bc69ffff15aba4f72d59055
/metapict/structs.rkt
5735dca7ac9acacd6b82ddaaeeb44cc8e8bb3503
[]
no_license
erichaney/metapict
e870b3de73ad2af53ab9342c383b91b84943caab
96f49303ded294d43b27fe4268d01209bd460ba7
refs/heads/master
2020-04-13T16:00:30.741379
2019-01-10T23:51:27
2019-01-10T23:51:27
163,309,532
0
0
null
null
null
null
UTF-8
Racket
false
false
5,352
rkt
structs.rkt
#lang racket/base (require (for-syntax racket/base) pict/convert racket/format) (define-syntax (provide-structs stx) (syntax-case stx () [(_ id ...) #'(begin (provide (struct-out id) ...))])) ;;; Base types (provide-structs arw bez curve: mat pt vec window) ;;; Paths (provide-structs path open-path closed-path knot knot/info segment type open explicit non-explicit tenscurl given endpoint end-cycle) ;;; Path Joins (provide-structs join tension-and controls-and full-join) ;;; Direction Specifier (provide-structs curl) ;;; Accessors (provide left-tension right-tension get-tension) ;;; Labels and their placements (provide-structs label lft rt top bot ulft urt llft lrt cnt placement) ; The basic data types (struct pt (x y) #:transparent) ; point (struct vec (x y) #:transparent) ; vector (struct arw (pt vec) #:transparent) ; arrow (struct bez (p0 p1 p2 p3) #:transparent) ; bezier curve (struct mat (a b c d) #:transparent) ; 2x2 matrix [[a b] [c d]] (struct window (minx maxx miny maxy) #:transparent) ; window (coordinate system) (struct curve: (closed? bezs) #:transparent ; a resolved curve is a list of bezs #:reflection-name 'curve) ;;; ;;; Representation of paths (274, 275) ;;; (require "list3-sequence.rkt") ;; A path is basically a list of knots, which can be open or closed. ;; This representation is meant to be internal. Users should use path: to construct paths. (struct path (knots) #:transparent) (struct open-path path () #:transparent #:property prop:sequence (λ (p) (make-3-sequence (path-knots p)))) (struct closed-path path () #:transparent #:property prop:sequence (λ (p) (make-3-sequence (path-knots p)))) ;; A knot consists of ;; p a point ;; p-,p+ the previous and the following control point ;; left-type, right-type control info ;; Note: a #f in p- and p+ means the control points haven't been computed yet. (struct knot (p p- p+ left-type right-type) #:transparent) ; The first step in computing control points is to determine ; turning angles and distances to previous and posteriour knots. (struct knot/info knot (ψ d- d+) #:transparent) ;; A SEGMENT is list of knots (with info) whose first and last knots are breakpoints. (struct segment (knots) #:transparent #:property prop:sequence (λ (p) (make-3-sequence (segment-knots p)))) ;; A type is one of (struct type () #:transparent) (struct explicit type () #:transparent); the Bezier control points have already been ; ; computed (in p- and p+). (struct non-explicit type (τ) ; All non-explicit control point types have a tension τ. #:transparent) (struct open non-explicit () ; the curve leaves the knot in the same direction #:transparent) ; it enters, MP finds the direction (struct tenscurl non-explicit (amount) ; the curve should leave the knot in a direction #:transparent) ; depending on the angle at which it enters the next knot (struct given non-explicit (angle) ; the curve enters/leaves (left/right) in a known angle #:transparent) ; Note: this is an absolute angle (φ and θ are relative!) (struct endpoint type () ; for an open path the first endpoint do not use z- #:transparent) ; and the last doesn't use z+. (struct end-cycle type () ; temporary type: used to break cycles #:transparent) ;;; Basic Path Joins (struct join () #:transparent) (struct tension-and join (τ- τ+) #:transparent) (struct controls-and join (c- c+) #:transparent) (struct & join () #:transparent) ;;; Full Join (struct full-join join (ds- j ds+) #:transparent) ;; Note: A negative tension τ is interpreted as tension "at least abs(τ)". ;; The default tension is 1. A tension of ∞ gives a (almost) linear curve. ;; Tensions are always at least ; <direction specifier> ::= <empty> | (curl <num-expr>) | <vec-expr> (struct curl (amount) #:transparent) ; accessors (define (left-tension k) (non-explicit-τ (knot-left-type k))) (define (right-tension k) (non-explicit-τ (knot-right-type k))) (define (get-tension t) (and (non-explicit? t) (non-explicit-τ t))) ;;; Labels (struct label (string-or-pict pos plc) #:transparent) ;;; Label placements (struct placement ()) (struct lft placement()) ; left (struct rt placement()) ; right (struct top placement()) (struct bot placement()) (struct ulft placement()) ; upper left (struct urt placement()) ; upper right (struct llft placement()) ; lower left (struct lrt placement()) ; lower right (struct cnt placement()) ; center ;;; Nodes ; A NODE has ; - a position pos the node is centered over pos ; - a curve the curve determines the outline of the node ; - anchor vec -> pt function, returns a point on the outline in the given direction ; - normal vector normal to the outline pointing outwards (struct node (convert pos curve anchor normal) ; convert : node -> pict ; is called by pict-convert #:transparent #:property prop:pict-convertible (λ (v) ((node-convert v) v))) (provide-structs node)
true
571bd3a423ce6ee8c43243ff301b9f9f191b40b0
ab00a4b7743b55f05ee117bd5a20ceb300e069d4
/urlang/html.rkt
e55e6949097e73bc30d9d2dbdd51b54bcfe1cb97
[]
no_license
soegaard/urlang
8bf331fab485ab75cd6c96e11fd01a6c6a502d40
f7ac3390d73d7991bfb956d480042a2efdd68607
refs/heads/master
2023-06-08T12:58:44.389834
2023-05-31T12:47:15
2023-05-31T12:47:15
40,402,158
324
22
null
2022-02-27T11:55:51
2015-08-08T12:27:06
Racket
UTF-8
Racket
false
false
207
rkt
html.rkt
#lang racket ;; This file is intended to be use as ;; (require urlang/html) ;; and will import all html related utilities in urlang/html/ (require "html/all.rkt") (provide (all-from-out "html/all.rkt"))
false
a32ebf38a3071a852e88b266a4321957f82e9a9e
9195bf7d21642dc73960a4a6571f1319b3be8d2d
/cex_generalization/to-sketch.rkt
edf7ce88148d4272b274cfebd0fd03e41a5a64da
[]
no_license
eidelmanj/concurrent-object-synthesis
86d46417c3dad900defa44399274c584c72d1ac4
6978ddd6ec608656397d45fe82cf74d55c4a5896
refs/heads/master
2021-01-17T02:44:17.321113
2017-03-01T16:17:36
2017-03-01T16:17:36
58,645,368
2
0
null
null
null
null
UTF-8
Racket
false
false
44,127
rkt
to-sketch.rkt
#lang racket (require "../program_representation/simulator-structures.rkt") (require "../utilities/utilities.rkt") (require racket/string) (require racket/hash) (provide to-string-instr print-non-sketch-simulation add-binding-parent retrieve-code new-scope-num generate-optimistic-condition-lists generate-optimistic-condition-sketches get-interfering-ret-vars generate-library-code generate-smart-optimistic-condition-grammar generate-top-level-grammar trace-list-to-sketch instr-list-to-sketch) ;; Find all the return variables of interfering methods ;; so that we can initialize them in sketch (define (get-interfering-ret-vars t) (let ([interfering-lines (filter (lambda (ti) (and (Run-method? ti) (boolean? (C-Instruction-thread-id ti)))) t)]) ;; (display "getting interfering for: ") (displayln t) (unique equal? (map (lambda (ti) (Run-method-ret ti)) interfering-lines)))) ;;;;;;;;;;;;;;;;; Binding related stuff - TODO: Determine whether still needed ;;;;;;;;;;;;;;;;;;;;;; (define num-sim-loops (void)) (set! num-sim-loops 0) (define scope-count (void)) (set! scope-count 0) (define (new-scope-num) (set! scope-count (+ scope-count 1)) scope-count) (define (new-sim-loop-name) (set! num-sim-loops (+ num-sim-loops 1)) (string-append "loop" (~v num-sim-loops))) (define num-arg-lists (void)) (set! num-arg-lists 0) (define (new-arg-list-id) (set! num-arg-lists (+ 1 num-arg-lists)) (string-append "arg-list" (~v num-arg-lists))) (define all-bindings (make-hash)) (define (new-binding id scope-num parent-scope) (let ([id-bindings (hash-ref all-bindings scope-num)]) (hash-set! all-bindings scope-num (Binding-list (Binding-list-parent id-bindings) (append (Binding-list-id-list id-bindings) (list id)))))) (define (add-binding-parent scope-num parent-scope) (hash-set! all-bindings scope-num (Binding-list parent-scope (list)))) (define (list-contains l elem) (> (length (filter (lambda (i) (equal? i elem)) l)) 0)) (define (get-most-recent-binding var-name scope-num parent-scope) (cond [(equal? scope-num 0) 0] [else (let ([bindings (hash-ref all-bindings scope-num)]) (let ([parent-binding (Binding-list-parent bindings)] [id-list (Binding-list-id-list bindings)]) ;; (display "most recent: ") (display var-name) (display scope-num) (displayln id-list) (if (list-contains id-list var-name) scope-num (get-most-recent-binding var-name parent-binding parent-scope))))])) ;;;;;;;;;;;;;;;;;;;;;;;;;;; Trace to Sketch conversion ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define (print-non-sketch-simulation instr-list library arg-store ret-store scope-num parent-scope) (cond [(empty? instr-list) ""] [else ;; (display "FIRST INSTR: ") (displayln instr-list) (let ([elem (first instr-list)]) (cond [(Loop? elem) (let ([loop-name (new-sim-loop-name)]) (string-append "(define (" loop-name " c )\n" "(if (and (void? TO-RETURN) c)\n" "(begin\n" (print-non-sketch-simulation (Loop-instr-list elem) library arg-store ret-store scope-num parent-scope) "(" loop-name " " (to-string-instr (Loop-condition elem) arg-store scope-num parent-scope) "))\n" "(begin (void))))\n" "(" loop-name " " (to-string-instr (Loop-condition elem) arg-store scope-num parent-scope) ")\n" (print-non-sketch-simulation (rest instr-list) library arg-store ret-store scope-num parent-scope) ))] [(Meta-addition? elem) (string-append "(if meta-var" (~v (Meta-addition-which-var elem)) "\n" "(begin\n" (print-non-sketch-simulation (Meta-addition-instr-list elem) library arg-store ret-store scope-num parent-scope) ")\n" "(begin (void)))\n" (print-non-sketch-simulation (rest instr-list) library arg-store ret-store scope-num parent-scope) )] [(Repeat-meta? elem) (string-append "(cond " (sketch-unroll-repeat-non-simul (Repeat-meta-instr-list elem) (string-append "meta-var" (~v (Repeat-meta-which-var elem))) 3 library arg-store ret-store scope-num parent-scope) ")" (print-non-sketch-simulation (rest instr-list) library arg-store ret-store scope-num parent-scope))] [(Single-branch? elem) (string-append "(if " (to-string-instr (Single-branch-condition elem) arg-store scope-num parent-scope) "\n" "(begin\n" (print-non-sketch-simulation (Single-branch-branch elem) library arg-store ret-store scope-num parent-scope) ")\n" "(begin (void)))" "(if method-exit\n" "(begin\n" "(set! method-exit #f)\n" ")\n" "(begin\n" (print-non-sketch-simulation (rest instr-list) library arg-store ret-store scope-num parent-scope) "(void)\n" "))\n" )] [(Branch? elem) (string-append "(if " (to-string-instr (Branch-condition elem) arg-store scope-num parent-scope) "\n" "(begin\n" (print-non-sketch-simulation (Branch-branch1 elem) library arg-store ret-store scope-num parent-scope) ")\n" "(begin\n" (print-non-sketch-simulation (Branch-branch2 elem) library arg-store ret-store scope-num parent-scope) "))" (print-non-sketch-simulation (rest instr-list) library arg-store ret-store scope-num parent-scope) )] [(Run-method? elem) ;; (let ([args-list (new-arg-list-id)] ;; [new-scope (new-scope-num)]) ;; (add-binding-parent new-scope scope-num) ;; (string-append ;; "(set! current-thread " (~v (C-Instruction-thread-id elem)) ")\n" ;; "(set! method-exit #f)\n" ;; "(define " args-list " (void))\n" ;; "(set! " args-list " " (to-string-instr (Run-method-args elem) arg-store scope-num parent-scope) ")\n" ;; "(begin\n" ;; (print-non-sketch-simulation (retrieve-code library (Run-method-method elem)) library args-list (Run-method-ret elem) new-scope scope-num) ;; ")\n" ;; (print-non-sketch-simulation (rest instr-list) library args-list ret-store scope-num parent-scope) ;; ))] (string-append "(set! " (Run-method-ret elem) " " "(METHOD-" (Run-method-method elem) " " (to-string-instr (Run-method-args elem) arg-store scope-num parent-scope) "))\n" (print-non-sketch-simulation (rest instr-list) library arg-store ret-store scope-num parent-scope))] [(Create-var? elem) ;; (display "create-var-id: ") (display (Create-var-id elem)) (display "\n") ;; (new-binding (Create-var-id elem) scope-num parent-scope) (string-append ;; "(display \"creating.... " (Create-var-id elem) "\n\")" "(define " (Create-var-id elem) ;; (~v (get-most-recent-binding (Create-var-id elem) scope-num parent-scope)) " (void))\n" (print-non-sketch-simulation (rest instr-list) library arg-store ret-store scope-num parent-scope))] [(Lock? elem) (string-append "(if (not (has-lock current-thread " (~v (Lock-id elem)) " ))\n" "(set! POSSIBLE #f)\n" "(begin \n (get-lock current-thread " (~v (Lock-id elem)) ")\n" ;; "(display \"locking!\n\")" (print-non-sketch-simulation (rest instr-list) library arg-store ret-store scope-num parent-scope) "))")] [(Unlock? elem) (string-append "(release-lock current-thread " (~v (Unlock-id elem)) ")\n" (print-non-sketch-simulation (rest instr-list) library arg-store ret-store scope-num parent-scope))] [(Set-var? elem) ;; "todo\n"] ;; (display "SETVARID: ") ;; (displayln (Set-var-id elem)) ;; (display "string?: ") (if (string? (Set-var-id elem)) (displayln "STRING") (displayln "nope")) (string-append "(set! " (Set-var-id elem) ;; (~v (get-most-recent-binding (Set-var-id elem) scope-num parent-scope)) " " (to-string-instr (Set-var-assignment elem) arg-store scope-num parent-scope) ")\n" (print-non-sketch-simulation (rest instr-list) library arg-store ret-store scope-num parent-scope))] [(Set-pointer? elem) (string-append "(set-" (Set-pointer-type elem) "-" (Set-pointer-offset elem) "! " (Set-pointer-id elem) ;; (~v (get-most-recent-binding (Set-pointer-id elem) scope-num parent-scope)) " " (to-string-instr (Set-pointer-val elem) arg-store scope-num parent-scope) ")\n" (print-non-sketch-simulation (rest instr-list) library arg-store ret-store scope-num parent-scope))] [(CAS? elem) (string-append "(if (not (equal? " (to-string-instr (CAS-v1 elem) arg-store scope-num parent-scope) " " (to-string-instr (CAS-v2 elem) arg-store scope-num parent-scope) "))\n" "(begin\n " "(" (special-set-string-instr (CAS-v1 elem) arg-store scope-num parent-scope) " " (to-string-instr (CAS-new-val elem) arg-store scope-num parent-scope) ")\n" ;; "(set! " (special-set-string-instr (CAS-v1 elem) arg-store) " " (to-string-instr (CAS-new-val elem) arg-store) ")\n" "(set! " (CAS-ret elem) ;; (~v (get-most-recent-binding (CAS-ret elem) scope-num parent-scope)) " 1))" "(begin\n " "(set! " (CAS-ret elem) ;; (~v (get-most-recent-binding (CAS-ret elem) scope-num parent-scope)) " 0)))\n" (print-non-sketch-simulation (rest instr-list) library arg-store ret-store scope-num parent-scope))] [(Continue? elem) (let ([where-to (find-continue-sublist (rest instr-list) (Continue-to-where elem))]) ;; (display (Continue-to-where elem)) (display "\n") "(void)")] ;; (print-non-sketch-simulation `() library arg-store ret-store))] [(Return? elem) ;; (displayln "found return") ;; (displayln (to-string-instr (Return-val elem) arg-store scope-num parent-scope)) (string-append ;; "(display \"returning....." (to-string-instr (Return-val elem) arg-store scope-num parent-scope) "\n\")\n" ;; "(set! " ret-store ;; (~v (get-most-recent-binding ret-store scope-num parent-scope)) ;; " " (to-string-instr (Return-val elem) arg-store scope-num parent-scope) ")\n" "(set! method-exit #t)\n" "(if (void? TO-RETURN) (begin " "(set! TO-RETURN " (to-string-instr (Return-val elem) arg-store scope-num parent-scope) " )\n" ") (begin (void) ))\n" ;; (to-string-instr (Return-val elem) arg-store scope-num parent-scope) )] ;; (print-non-sketch-simulation (rest instr-list) library arg-store ret-store))] [else ;; (display "todo case\n") (string-append ;; "TODO\n" ";;TODO:" (~v (first instr-list)) "\n" (print-non-sketch-simulation (rest instr-list) library arg-store ret-store scope-num parent-scope))]))])) (define (special-set-string-instr instr arg-store scope-num parent-scope) (cond [(Dereference? instr) (string-append "set-" (Dereference-type instr) "-" (Dereference-offset instr) "! " (Dereference-id instr) (~v (get-most-recent-binding (Dereference-id instr) scope-num parent-scope)))] [else (string-append "set! " (to-string-instr instr arg-store scope-num parent-scope))])) (define (to-string-instr instr arg-store scope-num parent-scope) ;; (display "to-string-instr: ") (display instr) (display "\n") (cond [(Optimistic-Condition? instr) ;; TODO Need to deal with optimistic condition (string-append "(OPT" (~v (Optimistic-Condition-meta-var instr)) ")")] [(Dereference? instr) (cond [(Dereference? (Dereference-id instr)) (string-append "("(Dereference-type instr) "-" (Dereference-offset instr) " " (to-string-instr (Dereference-id instr) arg-store scope-num parent-scope) ")")] ;; (string-append ;; "("(Dereference-type instr) "-" (Dereference-offset instr) " " (to-string-instr (Get-var (to-string-instr (Dereference-id instr) arg-store scope-num parent-scope)) arg-store scope-num parent-scope) ")")] [else (string-append "("(Dereference-type instr) "-" (Dereference-offset instr) " " (Dereference-id instr) ;; (~v (get-most-recent-binding (Dereference-id instr) scope-num parent-scope)) ")")])] [(Equal? instr) (string-append "(equal? " (to-string-instr (Equal-expr1 instr) arg-store scope-num parent-scope) " " (to-string-instr (Equal-expr2 instr) arg-store scope-num parent-scope) ")")] [(Or? instr) (string-append "(or " (to-string-instr (Or-expr1 instr) arg-store scope-num parent-scope) " " (to-string-instr (Or-expr2 instr) arg-store scope-num parent-scope) ")")] [(Not? instr) (string-append "(not " (to-string-instr (Not-expr instr) arg-store scope-num parent-scope) ")")] [(And? instr) (string-append "(and " (to-string-instr (And-expr1 instr) arg-store scope-num parent-scope) " " (to-string-instr (And-expr2 instr) arg-store scope-num parent-scope) ")")] [(Add? instr) (string-append "(+ " (to-string-instr (Add-expr1 instr) arg-store scope-num parent-scope) " " (to-string-instr (Add-expr2 instr) arg-store scope-num parent-scope) ")")] [(Subtract? instr) (string-append "(- " (to-string-instr (Subtract-expr1 instr) arg-store scope-num parent-scope) " " (to-string-instr (Subtract-expr2 instr) arg-store scope-num parent-scope) ")")] [(Multiply? instr) (string-append "(* " (to-string-instr (Multiply-expr1 instr) arg-store scope-num parent-scope) " " (to-string-instr (Multiply-expr2 instr) arg-store scope-num parent-scope) ")")] [(Get-var? instr) (string-append (Get-var-id instr) ;; (~v (get-most-recent-binding (Get-var-id instr) scope-num parent-scope)) )] [(Get-argument? instr) (string-append "(list-ref " arg-store " " (~v (Get-argument-id instr)) ")")] [(New-struct? instr) (string-append "(" (New-struct-type instr) " " (reduce string-append (map (lambda (v) (string-append " " (to-string-instr v arg-store scope-num parent-scope))) (New-struct-arg-list instr))) ")")] [(list? instr) ;; (display "found list: ") ;; (displayln instr) (string-append "(list " (reduce (lambda (a b) (string-append a " " b)) (map (lambda (i) (to-string-instr i arg-store scope-num parent-scope)) instr)) ")")] [(None? instr) (string-append "(None)")] [(Is-none?? instr) (string-append "(None? " (to-string-instr (Is-none?-val instr) arg-store scope-num parent-scope) ")")] [(Mystery-const? instr) (string-append "??")] [else (~v instr)])) (define (sketch-unroll-repeat instr-list meta-var depth arg-store scope-num parent-scope) (cond [(equal? depth 0) (string-append "[(equal? " meta-var " 0) (begin (void))]\n")] [else (string-append "[(equal? " meta-var " " (~v depth) ") (begin \n" (instr-list-to-sketch (list-multiply instr-list depth) arg-store scope-num parent-scope) ")]\n" (sketch-unroll-repeat instr-list meta-var (- depth 1) arg-store))])) (define (sketch-unroll-repeat-non-simul instr-list meta-var depth library arg-store ret-store scope-num parent-scope) (cond [(equal? depth 0) (string-append "[(equal? " meta-var " 0) (begin (void))]\n")] [else (string-append "[(equal? " meta-var " " (~v depth) ") (begin \n" (print-non-sketch-simulation (list-multiply instr-list depth) library arg-store ret-store scope-num parent-scope) ;; (instr-list-to-sketch (list-multiply instr-list depth) arg-store) ")]\n" (sketch-unroll-repeat-non-simul instr-list meta-var (- depth 1) library arg-store ret-store scope-num parent-scope))])) ;; Generates Sketch where we only separate traces that are actually different from each other ;; so if two traces have a common prefix, they only diverge when they have to (define (trace-list-to-sketch trace-list library arg-store scope-num parent-scope) (define (equals-any-t-id t-list) ;; (displayln "equals-any-t-id") (cond [(empty? t-list) ""] [else (string-append "(equal? pick-trace " (~v (Trace-trace-id (first t-list))) ") " (equals-any-t-id (rest t-list)))])) ;; Assumes all traces are non-empty (define (common-first-elem-trace-sets t-list) ;; (displayln "common-first-elem-trace-sets") (cond [(empty? t-list) `()] [else ;; (displayln "common ELSE case") (let ([begins-with-first (filter (lambda (t) (command-equality-check (first (Trace-t (first t-list))) (first (Trace-t t)))) ;; (equal? (object-name (first (Trace-t (first t-list)))) ;; (object-name (first (Trace-t t))))) ;; TODO need better equality check t-list)] [not-begins-with-first (filter (lambda (t) (not (command-equality-check (first (Trace-t (first t-list))) (first (Trace-t t))))) ;; (not (equal? (object-name (first (Trace-t (first t-list)))) ;; (object-name (first (Trace-t t)))))) ;; TODO need better equality check t-list)]) (append (list begins-with-first) (common-first-elem-trace-sets not-begins-with-first)))])) (define (trace-list-to-sketch-recursive trace-list) (let ([split-traces (common-first-elem-trace-sets trace-list)]) ;; (display "SPLIT-TRACES: ") ;; (displayln split-traces) (cond [(empty? split-traces) ;; (displayln "FOUND EMPTY") ""] [(equal? (length split-traces) 1) ;; (displayln "Recusive case - 1 split trace ") ;; (display "TRACE-FIRST: " ) (displayln (trace-list-to-sketch-recursive (rest-of-traces (first split-traces)))) (define str (string-append (single-instr-to-sketch (first (Trace-t (first (first split-traces)))) library arg-store scope-num parent-scope) (trace-list-to-sketch-recursive (rest-of-traces (first split-traces))))) ;; (displayln "STRING FINISHED") str ] [(> (length split-traces) 1) ;; (displayln "Recursive case - NOT 1") (let ([max-length-split (reduce (lambda (l1 l2) (if (> (length l1) (length l2)) l1 l2)) split-traces)]) ;; (display "max-length-split: ") (displayln max-length-split) ;; "")]))) (let ([no-max-length-split-traces (filter (lambda (t-set) (not (trace-ids-equal? t-set max-length-split))) split-traces)]) ;; (display "no-max-length-split: ") (displayln no-max-length-split-traces) ;; (display "FIRST MAX-LENGTH-SPLIT: ") (displayln (first (Trace-t (first max-length-split)))) (define str (string-append "(cond \n" (reduce string-append (map (lambda (t-set) ;; (display "(first (trace-t (first t-set)))::::") ;; (displayln (first (Trace-t (first t-set)))) (string-append "[ (and POSSIBLE (or " (equals-any-t-id t-set) ")) " (single-instr-to-sketch (first (Trace-t (first t-set))) library arg-store scope-num parent-scope) (trace-list-to-sketch-recursive (rest-of-traces t-set)) "]\n")) no-max-length-split-traces)) "[POSSIBLE \n" (single-instr-to-sketch (first (Trace-t (first max-length-split))) library arg-store scope-num parent-scope) (trace-list-to-sketch-recursive (rest-of-traces max-length-split))"])\n" )) ;; (displayln "NOT 1 STRING FINISHED") str ))]))) (let ([split-traces (common-first-elem-trace-sets trace-list)]) (cond [(> (length split-traces) 1) ;; (displayln "LENGTH > 1") (string-append "(cond \n" (reduce string-append (map (lambda (t-set) (string-append "[ (or " (equals-any-t-id t-set) ") " (single-instr-to-sketch (first (Trace-t (first t-set))) library arg-store scope-num parent-scope) (trace-list-to-sketch-recursive (rest-of-traces t-set)) "]\n")) split-traces)) ")\n")] [(equal? (length split-traces) 1) ;; (displayln "LENGTH = 1") ;; (displayln (Trace-t (first (first split-traces)))) (single-instr-to-sketch (first (Trace-t (first (first split-traces)))) library arg-store scope-num parent-scope)] [else ""]))) ;; Translates library methods into racket code (define (generate-library-code library) (reduce string-append (map (lambda (method) (string-append "\n\n(define (METHOD-" (Method-id method) " arg-list)" "(define TO-RETURN (void))\n" (all-instrs-to-sketch (retrieve-code library (Method-id method)) library) "(set! method-exit #f)\n" "TO-RETURN" ")\n\n\n\n")) library))) ;; Combines the single-instr-to-sketch for all the instructions in a list of instructions (define (all-instrs-to-sketch instr-list library) (print-non-sketch-simulation instr-list library "arg-list" "" 0 0)) ;; Translates individual instruction to sketch instruction (define (single-instr-to-sketch instr library arg-store scope-num parent-scope) ;; (display "to-sketch: ")(display (first instr-list))(display "\n") (cond [(Create-var? instr) ;; (display "create-var-id: ") (display (Create-var-id instr)) (display "\n") ;; (new-binding (Create-var-id instr) scope-num parent-scope) (string-append "(define " (Create-var-id instr) ;; (~v (get-most-recent-binding (Create-var-id instr) scope-num parent-scope)) " (void))\n")] [(Lock? instr) (string-append "(if (not (has-lock current-thread " (~v (Lock-id instr)) " ))\n" "(set! POSSIBLE #f)" "(begin (void))) \n")] [(Run-method? instr) (let ([args-list (new-arg-list-id)] [new-scope (new-scope-num)]) ;; (add-binding-parent new-scope scope-num) (string-append "(displayln \"running method: " (Run-method-method instr) "\")" "(set! current-thread " (~v (C-Instruction-thread-id instr)) ")\n" ;; "(set! method-exit #f)\n" "(METHOD-" (Run-method-method instr) " " (to-string-instr (Run-method-args instr) arg-store scope-num parent-scope) ")\n" ;; "(define " args-list " (void))\n" ;; "(set! " args-list " " (to-string-instr (Run-method-args instr) arg-store scope-num parent-scope) ")\n" ;; "(begin\n" ;; (print-non-sketch-simulation (retrieve-code library (Run-method-method instr)) library args-list (Run-method-ret instr) new-scope scope-num) ;; ")\n" ;; (print-non-sketch-simulation (rest instr-list) library args-list ret-store) ))] [(Set-var? instr) ;; "todo\n"] ;; (display "found set var\n") (string-append "(set! " (Set-var-id instr) ;; (~v (get-most-recent-binding (Set-var-id instr) scope-num parent-scope)) " " (to-string-instr (Set-var-assignment instr) arg-store scope-num parent-scope) ")\n")] [(Assume-simulation? instr) (string-append "(if (not " (to-string-instr (Assume-simulation-condition instr) arg-store scope-num parent-scope) ")\n (set! POSSIBLE #f)\n (begin (void)))\n")] [(Assume-loop? instr) (string-append "(if (not " (to-string-instr (Assume-loop-condition instr) arg-store scope-num parent-scope) ")\n (set! POSSIBLE #f)\n (begin \n" "(void)))\n")] [(Set-pointer? instr) (string-append "(set-" (Set-pointer-type instr) "-" (Set-pointer-offset instr) "! " (Set-pointer-id instr) ;; (~v (get-most-recent-binding (Set-pointer-id instr) scope-num parent-scope)) " " (to-string-instr (Set-pointer-val instr) arg-store scope-num parent-scope) ")\n")] [(Assume-meta? instr) (string-append "(if (not meta-var" (~v (Assume-meta-condition instr)) ")\n (set! POSSIBLE #f) (begin \n" "(void)))\n")] [(Assume-not-meta? instr) (string-append "(if meta-var" (~v (Assume-not-meta-condition instr)) "\n (set! POSSIBLE #f)\n (begin\n" "(void)))\n")] [(Repeat-meta? instr) (string-append "(cond " (sketch-unroll-repeat (Repeat-meta-instr-list instr) "meta-count" 3 library arg-store scope-num parent-scope) ")" )] ;; [(Meta-branch? instr) ;; (string-append ;; "(if meta-var" (~v (Meta-branch-condition instr)) "(begin\n" ;; (instr-list-to-sketch (Meta-branch-branch1 instr) library arg-store scope-num parent-scope) ;; ")\n" ;; "(begin\n" (instr-list-to-sketch (Meta-branch-branch2 instr) library arg-store scope-num parent-scope) ")\n")] ;; [(Maybe-loop? instr) ;; (string-append ;; "(if meta-var" (~v (Maybe-loop-meta-var instr)) "(begin\n" ;; (maybe-loop-to-sketch (Maybe-loop-condition instr) ;; (Maybe-loop-instr-list1 instr) ;; (Maybe-loop-instr-list2 instr) ;; (Maybe-loop-hole instr) ;; library arg-store scope-num parent-scope) ;; ")\n (begin\n" ;; (instr-list-to-sketch (Maybe-loop-original-instr-list instr) library arg-store scope-num parent-scope) "))\n")] [(CAS? instr) (string-append "(if (not (equal? " (to-string-instr (CAS-v1 instr) arg-store scope-num parent-scope) " " (to-string-instr (CAS-v2 instr) arg-store scope-num parent-scope) "))\n" "(begin\n " "(set! " (to-string-instr (CAS-v1 instr) arg-store scope-num parent-scope) " " (to-string-instr (CAS-new-val instr) arg-store scope-num parent-scope) ")\n" "(set! " (CAS-ret instr) ;; (~v (get-most-recent-binding (CAS-ret instr) scope-num parent-scope)) " 1))" "(begin\n " "(set! " (CAS-ret instr) ;; (~v (get-most-recent-binding (CAS-ret instr) scope-num parent-scope)) " 0)))\n" )] [(Continue? instr) (string-append "TODO: continue\n")] ;; (let ([where-to (find-continue-sublist (rest instr-list) (Continue-to-where instr))]) ;; ;; (display (Continue-to-where instr)) (display "\n") ;; (instr-list-to-sketch where-to library arg-store scope-num parent-scope))] [else ;; (display "todo case\n") (string-append ;; "TODO\n" ";;TODO-single-instr:" (~v instr) "\n")])) (define (instr-list-to-sketch instr-list library arg-store scope-num parent-scope) ;; (display "to-sketch: ")(display (first instr-list))(display "\n") (cond [(empty? instr-list) ""] [else (let ([elem (first instr-list)]) (cond [(Create-var? elem) ;; (display "create-var-id: ") (display (Create-var-id elem)) (display "\n") ;; (new-binding (Create-var-id elem) scope-num parent-scope) (string-append "(define " (Create-var-id elem) ;; (~v (get-most-recent-binding (Create-var-id elem) scope-num parent-scope)) " (void))\n" (instr-list-to-sketch (rest instr-list) library arg-store scope-num parent-scope))] [(Lock? elem) (string-append "(if (not (has-lock current-thread " (~v (Lock-id elem)) " ))\n" "(set! POSSIBLE #f)" "(begin \n" (instr-list-to-sketch (rest instr-list) library arg-store scope-num parent-scope) "))")] [(Run-method? elem) (let ([args-list (new-arg-list-id)] [new-scope (new-scope-num)]) ;; (add-binding-parent new-scope scope-num) (string-append "(displayln \"running method: " (Run-method-method elem) "\")" "(set! current-thread " (~v (C-Instruction-thread-id elem)) ")\n" "(set! method-exit #f)\n" "(display \"result: \")" "(set! TMP-RET (METHOD-" (Run-method-method elem) " " (to-string-instr (Run-method-args elem) arg-store scope-num parent-scope) "))\n" "(displayln TMP-RET)\n" "(set! " (format "~a" (Run-method-ret elem)) " TMP-RET)\n" ;; "(define " args-list " (void))\n" ;; "(set! " args-list " " (to-string-instr (Run-method-args elem) arg-store scope-num parent-scope) ")\n" ;; "(begin\n" ;; (print-non-sketch-simulation (retrieve-code library (Run-method-method elem)) library args-list (Run-method-ret elem) new-scope scope-num) ;; ")\n" (instr-list-to-sketch (rest instr-list) library arg-store scope-num parent-scope) ;; (print-non-sketch-simulation (rest instr-list) library args-list ret-store) ))] [(Set-var? elem) ;; "todo\n"] ;; (display "found set var\n") (string-append "(set! " (Set-var-id elem) ;; (~v (get-most-recent-binding (Set-var-id elem) scope-num parent-scope)) " " (to-string-instr (Set-var-assignment elem) arg-store scope-num parent-scope) ")\n" (instr-list-to-sketch (rest instr-list) library arg-store scope-num parent-scope))] [(Assume-simulation? elem) ;; (display "printing out assume simulation: ") (displayln elem) (string-append "(if (not " (to-string-instr (Assume-simulation-condition elem) arg-store scope-num parent-scope) ")\n (set! POSSIBLE #f)\n (begin \n" (instr-list-to-sketch (rest instr-list) library arg-store scope-num parent-scope) "" "))\n")] [(Assume-loop? elem) (string-append "(if (not " (to-string-instr (Assume-loop-condition elem) arg-store scope-num parent-scope) ")\n (set! POSSIBLE #f)\n (begin \n" (instr-list-to-sketch (rest instr-list) library arg-store scope-num parent-scope) "" "))\n")] [(Set-pointer? elem) (string-append "(set-" (Set-pointer-type elem) "-" (Set-pointer-offset elem) "! " (Set-pointer-id elem) ;; (~v (get-most-recent-binding (Set-pointer-id elem) scope-num parent-scope)) " " (to-string-instr (Set-pointer-val elem) arg-store scope-num parent-scope) ")\n" (instr-list-to-sketch (rest instr-list) library arg-store scope-num parent-scope))] [(Assume-meta? elem) (string-append "(if (not meta-var" (~v (Assume-meta-condition elem)) ")\n (set! POSSIBLE #f) (begin \n" (instr-list-to-sketch (rest instr-list) library arg-store scope-num parent-scope) "))\n")] [(Assume-not-meta? elem) (string-append "(if meta-var" (~v (Assume-not-meta-condition elem)) "\n (set! POSSIBLE #f)\n (begin\n" (instr-list-to-sketch (rest instr-list) library arg-store scope-num parent-scope) "))\n")] [(Repeat-meta? elem) (string-append "(cond " (sketch-unroll-repeat (Repeat-meta-instr-list elem) "meta-count" 3 library arg-store scope-num parent-scope) ")" (instr-list-to-sketch (rest instr-list) library arg-store scope-num parent-scope))] ;; [(Meta-branch? elem) ;; (string-append ;; "(if meta-var" (~v (Meta-branch-condition elem)) "(begin\n" ;; (instr-list-to-sketch (Meta-branch-branch1 elem) library arg-store scope-num parent-scope) ;; ")\n" ;; "(begin\n" (instr-list-to-sketch (Meta-branch-branch2 elem) library arg-store scope-num parent-scope) ")\n")] ;; [(Maybe-loop? elem) ;; (string-append ;; "(if meta-var" (~v (Maybe-loop-meta-var elem)) "(begin\n" ;; (maybe-loop-to-sketch (Maybe-loop-condition elem) ;; (Maybe-loop-instr-list1 elem) ;; (Maybe-loop-instr-list2 elem) ;; (Maybe-loop-hole elem) ;; library arg-store scope-num parent-scope) ;; ")\n (begin\n" ;; (instr-list-to-sketch (Maybe-loop-original-instr-list elem) library arg-store scope-num parent-scope) "))\n")] [(CAS? elem) (string-append "(if (not (equal? " (to-string-instr (CAS-v1 elem) arg-store scope-num parent-scope) " " (to-string-instr (CAS-v2 elem) arg-store scope-num parent-scope) "))\n" "(begin\n " "(set! " (to-string-instr (CAS-v1 elem) arg-store scope-num parent-scope) " " (to-string-instr (CAS-new-val elem) arg-store scope-num parent-scope) ")\n" "(set! " (CAS-ret elem) ;; (~v (get-most-recent-binding (CAS-ret elem) scope-num parent-scope)) " 1))" "(begin\n " "(set! " (CAS-ret elem) ;; (~v (get-most-recent-binding (CAS-ret elem) scope-num parent-scope)) " 0)))\n" (instr-list-to-sketch (rest instr-list) library arg-store scope-num parent-scope))] [(Continue? elem) (let ([where-to (find-continue-sublist (rest instr-list) (Continue-to-where elem))]) ;; (display (Continue-to-where elem)) (display "\n") (instr-list-to-sketch where-to library arg-store scope-num parent-scope))] [(Return? elem) (string-append "(set! RETURN-VAL " (to-string-instr (Return-val elem) arg-store scope-num parent-scope) ")\n" (instr-list-to-sketch (rest instr-list) library arg-store scope-num parent-scope))] [(Trace-Type? elem) (string-append "(set! TRACE-TYPE " (to-string-instr (Trace-Type-tp elem) arg-store scope-num parent-scope) ")\n" (instr-list-to-sketch (rest instr-list) library arg-store scope-num parent-scope))] [(Optimistic-Check? elem) (cond [(Optimistic-Check-which-val elem) (string-append "(set! OPT" (~v (Optimistic-Check-opt-id elem)) "-true-list (append (list (OPT" (~v (Optimistic-Check-opt-id elem)) ")) OPT" (~v (Optimistic-Check-opt-id elem)) "-true-list))\n" (instr-list-to-sketch (rest instr-list) library arg-store scope-num parent-scope))] [else (string-append "(set! OPT" (~v (Optimistic-Check-opt-id elem)) "-false-list (append (list (OPT" (~v (Optimistic-Check-opt-id elem)) ")) OPT" (~v (Optimistic-Check-opt-id elem)) "-false-list))\n" (instr-list-to-sketch (rest instr-list) library arg-store scope-num parent-scope))])] [else ;; (display "todo case\n") (string-append ;; "TODO\n" ";;TODO-instr-list-to-sketch:" (~v (first instr-list)) "\n" (instr-list-to-sketch (rest instr-list) library arg-store scope-num parent-scope))]))])) (define (find-continue-sublist instr-list to-where) ;; (display "finding continue: ") (display instr-list) (display to-where) (display "\n") (cond [(empty? instr-list) `()] [(Assume-loop? (first instr-list)) (cond [(equal? to-where (Assume-loop-to-where (first instr-list))) instr-list] [else (find-continue-sublist (rest instr-list) to-where)])] [else (find-continue-sublist (rest instr-list) to-where)])) (define (generate-optimistic-condition-lists opt-conds) (reduce string-append (map (lambda (c) (string-append "(define OPT" (~v (Optimistic-Check-opt-id c)) "-true-list (void))\n" "(set! OPT" (~v (Optimistic-Check-opt-id c)) "-true-list `())\n" "(define OPT" (~v (Optimistic-Check-opt-id c)) "-false-list (void))\n" "(set! OPT" (~v (Optimistic-Check-opt-id c)) "-false-list `())\n")) opt-conds))) ;; Optimistic Concurrency condition grammar generated for each Optimistic-Condition ;; object given. (define (generate-optimistic-condition-sketches opt-conds depth) (reduce string-append (map (lambda (opt-cond) (let ([opt-meta-id (cond [(Optimistic-Condition? opt-cond) (~v (Optimistic-Condition-meta-var opt-cond))] [(Optimistic-Check? opt-cond) (~v (Optimistic-Check-opt-id opt-cond))] [else (displayln "opt-meta-id not found...") (exit)])]) (string-append " (define-synthax (optimistic-condition" opt-meta-id " depth) #:base (choose (lambda () (METHOD-contains (list (list-ref first-args 0) (list-ref first-args 1)))) (lambda () (not (METHOD-contains (list (list-ref first-args 0) (list-ref first-args 1)))))) #:else (choose (lambda () (METHOD-contains (list (list-ref first-args 0) (list-ref first-args 1)))) (lambda () (not (METHOD-contains (list (list-ref first-args 0) (list-ref first-args 1))))) (lambda () ((choose && ||) ((optimistic-condition" opt-meta-id " (- depth 1))) ((optimistic-condition" opt-meta-id " (- depth 1))))))) (define OPT1" " (optimistic-condition" opt-meta-id " 2))"))) ;; (~v (Optimistic-Condition-meta-var opt-cond)) " (lambda () (optimistic-condition" (~v (Optimistic-Condition-meta-var opt-cond)) " 1)))\n")) opt-conds))) ;; Top level grammar to connect all the parts (define (generate-top-level-grammar opt-info-list arg-store depth) (define (range1 i j) (cond [(> i j) `()] [(equal? i j) (list i)] [else (append (list i) (range1 (+ i 1) j))])) (reduce string-append (map (lambda (opt-info) (let ([opt-meta-id (~v (Optimistic-Info-id opt-info))] [opt-possible-vals (Optimistic-Info-possible-vals opt-info)]) (string-append "(define OPT" opt-meta-id "(choose\n (lambda () #f)\n (lambda () (choose (not (equal? (method-choice" opt-meta-id (~v depth)") (var-choice" opt-meta-id (~v depth)")))\n" (cond [(not (equal? depth 1)) (reduce string-append (map (lambda (i) (string-append "((choose || &&) " (reduce string-append (map (lambda (j) (string-append "(not (equal? (method-choice" opt-meta-id (~v j)") (var-choice" opt-meta-id (~v j) "))) ")) (range1 1 i))) ")\n")) (range1 2 depth))) "))))\n"] [else "))))\n"])))) opt-info-list))) ;; Generates optimistic condition grammar based on trace consistency checks (define (generate-smart-optimistic-condition-grammar opt-info-list arg-store depth) (cond [(equal? depth 0) ""] [else (string-append (reduce string-append (map (lambda (opt-info) (let ([opt-meta-id (~v (Optimistic-Info-id opt-info))] [opt-possible-vals (Optimistic-Info-possible-vals opt-info)]) (string-append " (define method-choice" opt-meta-id (~v depth) "\n" " (choose\n (lambda () #f)\n" (reduce string-append (map (lambda (elem) (string-append "(lambda () (METHOD-" (Run-method-method elem) " " (to-string-instr (Run-method-args elem) arg-store 0 `()) "))\n")) opt-possible-vals)) "))\n" ))) opt-info-list)) (reduce string-append (map (lambda (opt-info) (let ([opt-meta-id (~v (Optimistic-Info-id opt-info))] [opt-possible-vals (Optimistic-Info-possible-vals opt-info)]) (string-append " (define var-choice" opt-meta-id (~v depth) "\n" " (choose\n (lambda () #f)\n" (reduce string-append (map (lambda (elem) (string-append "(lambda () "(Run-method-ret elem) ")\n")) opt-possible-vals)) "))\n" ))) opt-info-list)) ;; (reduce ;; string-append ;; (map ;; (lambda (opt-info) ;; (let ([opt-meta-id (~v (Optimistic-Info-id opt-info))] ;; [opt-possible-vals (Optimistic-Info-possible-vals opt-info)]) ;; (string-append ;; " ;; (define grammar" opt-meta-id (~v depth) "\n" ;; " (choose\n ;; (lambda () (not (equal? (method-choice" opt-meta-id (~v depth)") (var-choice" opt-meta-id (~v depth)"))))" ;; (if (not (equal? depth 1)) ;; (string-append "(lambda () ((choose || &&) (grammar" opt-meta-id (~v (- depth 1))") (grammar" opt-meta-id (~v (- depth 1))")))))") ;; "))\n") ;; ))) ;; opt-info-list)) (generate-smart-optimistic-condition-grammar opt-info-list arg-store (- depth 1)))])) ;; (define (generate-smart-optimistic-condition-grammar opt-info-list arg-store depth) ;; (reduce ;; string-append ;; (map ;; (lambda (opt-info) ;; (let ;; ([opt-meta-id (~v (Optimistic-Info-id opt-info))] ;; [opt-possible-vals (Optimistic-Info-possible-vals opt-info)]) ;; (string-append " ;; (define-synthax (optimistic-condition" opt-meta-id " depth)\n" ;; "#:base (choose " ;; (reduce ;; string-append ;; (map ;; (lambda (elem) ;; (string-append ;; " (lambda () (equal? " (Run-method-ret elem) " (METHOD-" (Run-method-method elem) " " (to-string-instr (Run-method-args elem) arg-store 0 `()) ")))\n")) ;; opt-possible-vals) ;; ) ;; ")\n" ;; "#:else (choose " ;; (reduce ;; string-append ;; (map ;; (lambda (elem) ;; (string-append ;; " (lambda () (equal? " (Run-method-ret elem) " (METHOD-" (Run-method-method elem) " " (to-string-instr (Run-method-args elem) arg-store 0 `()) ")))\n")) ;; opt-possible-vals)) ;; "( (choose || &&) ((optimistic-condition" opt-meta-id " (- depth 1))) ((optimistic-condition" opt-meta-id " (- depth 1))) )))\n" ;; "(define OPT" opt-meta-id ;; " (optimistic-condition" opt-meta-id " 2))" ;; ))) ;; opt-info-list)))
false
8606838b7e4aca14d9354179dde95dfbef8ec379
925045585defcc1f71ee90cf04efb841d46e14ef
/racket/fear_of_macro/pattern-matching.rkt
673cfbd4c4c996a70380fae351aa6e6a1cffcce9
[]
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
15,597
rkt
pattern-matching.rkt
#lang racket ; Fear of Macros ; http://www.greghendershott.com/fear-of-macros/ ; Most useful syntax transformers work by taking some input syntax, ; and rearranging the pieces into something else. As we saw, it's more ; convenient and less error-prone to use `match' to do pattern ; matching. It tunrs out that pattern-matching was one of the first ; improvements to be added to the Racket macro system. It's called ; `syntax-case' and has a shorthand for simple situations called ; `define-syntax-rule'. ; The way we specify the new syntax is similar. We d'ont need to do ; quasi-quoting and unquoting. We don't need to use `datum->syntax'. ; Instead, we supply a "template", which uses vaiable from the ; pattern. (define-syntax (my-if-using-syntax-case stx) (syntax-case stx () [(_ condition? right-expr left-expr) #'(cond [condition? right-expr] [else left-expr])])) (my-if-using-syntax-case #t ((lambda () (displayln "true") "true")) ((lambda () (displayln "false") "false"))) ; Pattern variable vs. template -- fight! ---------------------------- ; Let's say we want to define a function with a hyphenated name, a-b, ; but we supply the a and b separately: ;; (define-syntax (hyphen-define stx) ;; (syntax-case stx () ;; [(_ a b (args ...) body ...) ;; (let ([name (string->symbol (format "~a-~a" a b))]) ;; #'(define (name args ...) body ...))])) ; patter-matching.rkt:35:49: a: pattern variable cannot be used ; outside of a template in: a. We have no idea what this error message ; means. Well, let's try to work it out. The "template the error ; message refers to is the #'(define (name args ...) body ...) part. ; The `let' isn't part of that template. It soundslike we can't use ; `a' (or a `b') in the `let' part. But you can have as many template ; as you want. Thus, you can use `syntax' on a pattern variable. This ; makes another template, albeit a small, template. (define-syntax (hyphen-define/wrong stx) (syntax-case stx () [(_ a b (args ...) body ...) (let ([name (string->symbol (format "~a-~a" #'a #'b))]) #'(define (name args ...) body ...))])) (hyphen-define/wrong foo bar () #t) ;; (foo-bar) ;; foo-bar: undefined; ;; cannot reference an identifier before its definition ; Be careful, our macro is defining a function with some name other ; than `foo-bar'. Using the Macro Stepper in DrRacket, it appears that ; the use of our macro `(hyphen-define/wrong1.1 foo bar () #t)' ; exanpded to `(define (name) #t)'. Instead, we wanted to expand to ; `(define (foo-bar) #t)'. Our template is using the symbol `name' but ; we wanted its value, such as `foo-bar' in this use of macro. ; Our pattern doesn't include `name' because we don't expect it in the ; original syntax -- indeed the whole point of this macro is to create ; it. So name can't be in the main pattern. Fine -- let's make an ; additional pattern. We can do that using an additional nested ; `syntax-case'. (define-syntax (hyphen-define/ok1 stx) ; Normally our transformer function is given syntax by Racket, and ; we pass that syntax to `syntax-case'. But we can also create some ; syntax of our own, on the fly, and pass that to `syntax-case'. (syntax-case stx () [(_ a b (args ...) body ...) ; The whole `(datum->syntax ...)' expression is syntax that we're ; creating on the fly. Then, we can give that to `syntax-case', ; and match it using a pattern variable named `name'. Voilà, we ; have a new pattern variable. We can use it in a template, and ; its value will go in the template. (syntax-case (datum->syntax stx (string->symbol (format "~a-~a" (syntax->datum #'a) (syntax->datum #'b)))) () [name #'(define (name args ...) body ...)])])) ; with-syntax -------------------------------------------------------- ; Instead of an additional, nested `syntax-case', we could use ; `with-syntax'. This rearranges the `syntax-case' to look more like a ; `let' statement. Also, it's more convenient if we need to define ; more than one patter variable. (define-syntax (hyphen-define/ok2 stx) (syntax-case stx () [(_ a b (args ...) body ...) ; Use the `with-syntax' as a let (with-syntax ([name (datum->syntax stx (string->symbol (format "~a-~a" (syntax->datum #'a) (syntax->datum #'b))))]) #'(define (name args ...) body ...))])) (hyphen-define/ok2 foo bar () #t) (foo-bar) ; Whether we use an additional `syntax-case' or use `with-syntax', ; either way we are simply defining additional pattern variable. Don't ; let the terminology and structure make it seem mysterious. ; We know that `let' doesn't let us use a binding in a subsequent one. ; Instead we can use nested lets. Or use a shortand for nesting, ; `let*'. Similary, instead of writing nested `with-syntax', we can ; use `with-syntax*'. One gotcha is that `with-syntax*' isn't provided ; by racket/base. We must require racket/syntax. Otherwise we may get ; a rather bewildering error message: ...: ellipses not allowed as an ; expression in: ... (require (for-syntax racket/syntax)) (define-syntax (foo stx) (syntax-case stx () [(_ a) (with-syntax* ([b #'a] [c #'b]) #'c)])) (foo (displayln "foo")) ; format-id ---------------------------------------------------------- ; There is a utility function in racket/syntax called `format-id' that ; lets us format identifier names more succintly than what we did ; above: (require (for-syntax racket/syntax)) (define-syntax (hyphen-define/ok3 stx) (syntax-case stx () [(_ a b (args ...) body ...) (with-syntax ([name (format-id stx "~a-~a" #'a #'b)]) #'(define (name args ...) body ...))])) (hyphen-define/ok3 bar baz () #t) (bar-baz) ; Another example ---------------------------------------------------- ; A variation that accepts an arbitrary number of name parts to be ; joined with hyphens: (require (for-syntax racket/string)) (define-syntax (hyphen-defines* stx) ; Takes a list of string and return a new syntax object where each ; string are hyphened (define (hyphenyze names) (datum->syntax stx (string->symbol (string-join names "-")))) (syntax-case stx () [(_ (name ...) (arg ...) body ...) (with-syntax ([hyphened-name (hyphenyze (map symbol->string (map syntax->datum (syntax->list #'(name ...)))))]) #'(define (hyphened-name arg ...) body ...))])) (hyphen-defines* (foo bar baz) (v) (* 2 v)) (displayln (string-append "result is " (number->string (foo-bar-baz 2)))) ; Making our own struct ---------------------------------------------- ; Let's apply what we just learned to a more-realistic example. We'll ; pretend that Racket doesn't already have a `struct' capability. ; Fortunately, we can write a macro to provide our own system for ; defining and using structure. To keep things simple, our structure ; will be immutable (read-only) and it won't support inheritance. ; ; (my-struct name (filed1 field2 ...)) ; ; We need to define some procedures: ; * A constructor procedure whose name is the struct name. We'll ; represent structures as a `vector'. The structure name will be ; element zero. The fields will be elements one onward. ; * A predicate, whose name is the struct name with "?" appended. ; * For each field, an accessor procedure to get its value? These wil ; be named "struc-field". (require (for-syntax racket/syntax)) (define-syntax (my-struct stx) (syntax-case stx () [(_ name (field ...)) (with-syntax ([name? (format-id stx "~a?" #'name)]) #`(begin ; Constructor (define (name field ...) (apply vector (cons 'name (list field ...)))) ; Predicate (define (name? struct) (and (vector? struct) (eq? (vector-ref struct 0) 'name))) ; accessor for each field #,@(for/list ([x (syntax->list #'(field ...))] [n (in-naturals 1)]) (with-syntax ([name-field (format-id stx "~a-~a" #'name x)] [idx n]) #`(define (name-field struct) (unless (name? struct) (error 'name-field "~a is not a ~a struct" struct 'name)) (vector-ref struct idx))))))])) ; Test it out (require rackunit) (my-struct foo (a b)) (define s (foo 1 2)) (check-true (foo? s)) (check-false (foo? 1)) (check-equal? (foo-a s) 1) (check-equal? (foo-b s) 2) (check-exn exn:fail? (lambda () (foo-a "furble"))) ; Next, what if someone tries to declare: ;; (my-struct "blah" ("bli" "blo")) ;; format-id: contract violation ;; expected: (or/c string? symbol? identifier? keyword? char? number?) ;; given: #<syntax:: "blah"> ; The error message is not very helpful. It's coming from `format-id', ; which is a private implementation detail of our macro. A ; `syntax-case' clause can take an optional "guard" or "fender" ; expression. Insread of [pattern template] it cloud be ; [pattern fender template]: (require (for-syntax racket/syntax)) (define-syntax (my-struct/fendered stx) (syntax-case stx () [ ; pattern (_ name (field ...)) ; fender (for-each (lambda (x) (unless (identifier? x) (raise-syntax-error #f "not an identifier" stx x))) (cons #'name (syntax->list #'(field ...)))) ; template (with-syntax ([name? (format-id stx "~a?" #'name)]) #`(begin (define (name field ...) (apply vector (cons 'name (list field ...)))) (define (name? struct) (and (vector? struct) (eq? (vector-ref struct 0) 'name))) #,@(for/list ([x (syntax->list #'(field ...))] [n (in-naturals 1)]) (with-syntax ([name-field (format-id stx "~a-~a" #'name x)] [idx n]) #`(define (name-field struct) (unless (name? struct) (error 'name-field "~a is not a ~a struct" struct 'name)) (vector-ref struct idx))))))])) ; Test it out (require rackunit) (my-struct/fendered foo/fendered (a b)) (define s/fendered (foo/fendered 1 2)) (check-true (foo/fendered? s/fendered)) (check-false (foo/fendered? 1)) (check-equal? (foo/fendered-a s/fendered) 1) (check-equal? (foo/fendered-b s/fendered) 2) (check-exn exn:fail? (lambda () (foo/fendered-a "furble"))) ; Test a macro that raises a syntax error, raises it at compile time. ; But the `with-handlers' doesn't (or rather, wouldn't) get set up to ; catche the exception until run-time. The methode to catch the syntax ; error at run-time is to wrap the macro call in something that ; catches the compile-time exception and produces code that raises a ; similar run-time exception. ; http://lists.racket-lang.org/users/archive/2012-December/055343.html (define-syntax (convert-syntax-error stx) (syntax-case stx () [(_ expr) (with-handlers ([exn:fail:syntax? (lambda (e) #`(error '#,(exn-message e)))]) (parameterize ((error-print-source-location #f)) (local-expand #'expr 'expression null)))])) (check-exn exn:fail? (lambda () (convert-syntax-error (my-struct/fendered "blah" ("bli" "blo"))))) ; Using dot notation ------------------------------------------------- ; The previsous two examples used a macro to define functions whose ; names were made by joining identifiers provided to the macro. This ; example does the opposite: The identifier given to the macro is ; split into pieces. ; If you write programs for web services you deal with JSON, which is ; represented in Racket by a `jsexpr?'. JSON often has dictionaries ; that contain other dictionaires. In a `jsexpr?' these are ; represented by nested `hashed' tables: ; Nested `hasheq' typical of a jsexpr: (define js (hasheq 'a (hasheq 'b (hasheq 'c "value")))) ; In Javascript you can use dot notation: `foo = js.a.b.c'. In Racket ; it's not so convenient: ; `(hash-ref (hash-ref (hash-ref js 'a) 'b) 'c)' ; We can write a helper function to make this a bit cleaner: (define/contract (hash-refs h ks [def #f]) ((hash? (listof any/c)) (any/c) . ->* . any) (with-handlers ([exn:fail? (const (cond [(procedure? def) (def)] [else def]))]) (for/fold ([h h]) ([k (in-list ks)]) (hash-ref h k)))) (hash-refs js '(a b c)) ; That's better. Can we go even further and use a dot notation ; somewhat like Javascript? (require (for-syntax racket/syntax)) (define-syntax (hash.refs stx) (syntax-case stx () ; Assume default is #f [(_ chain) #'(hash.refs chain #f)] [(_ chain default) (let ([xs (map (lambda (x) (datum->syntax stx (string->symbol x))) (regexp-split #rx"\\." (symbol->string (syntax->datum #'chain))))]) (with-syntax ([h (car xs)] [ks (cdr xs)]) #'(hash-refs h 'ks default)))])) (hash.refs js.a.b.c) (hash.refs js.a.blah 'did-not-exist) ; We've started to appreciate that our macros should give helpful ; messages when used in error. Let's trys to do that here: (require (for-syntax racket/syntax)) (define-syntax (hash.refs/fendered stx) (syntax-case stx () ; No args [(_) ; Fence: raises syntax error (raise-syntax-error #f "Expected (hash.key0[.key1 ...] [default])" stx #'chain)] ; No default: Assume default is #f [(_ chain) #'(hash.refs/fendered chain #f)] [(_ chain default) ; Fence: Test chain is not a string or number (unless (symbol? (syntax-e #'chain)) (raise-syntax-error #f "Expected (hash.key0[.key1 ...] [default])" stx #'chain)) (let ([xs (map (lambda (x) (datum->syntax stx (string->symbol x))) (regexp-split #rx"\\." (symbol->string (syntax->datum #'chain))))]) ; Fence: Test that we have at least hash.key (unless (and (>= (length xs) 2) (not (eq? (syntax-e (cadr xs)) '||))) (raise-syntax-error #f "Expected (hash.key0[.key1 ...] [default])" stx #'chain)) (with-syntax ([h (car xs)] [ks (cdr xs)]) #'(hash-refs h 'ks default)))])) (hash.refs/fendered js.a.b.c) (hash.refs/fendered js.a.blah 'did-not-exist) (with-handlers ([exn:fail? (lambda (e) 'syntax-error-caught)]) (convert-syntax-error (hash.refs/fendered))) (with-handlers ([exn:fail? (lambda (e) 'syntax-error-caught)]) (convert-syntax-error (hash.refs/fendered js."lala"))) (with-handlers ([exn:fail? (lambda (e) 'syntax-error-caught)]) (convert-syntax-error (hash.refs/fendered js)))
true
0919cd1fb4699192b0868bb08d2a519b8ac944ce
bb6ddf239800c00988a29263947f9dc2b03b0a22
/tests/exercise-3.35-test.rkt
42fbd4c16d68d1307c3a40c4c7c8a8438f82d480
[]
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
1,178
rkt
exercise-3.35-test.rkt
#lang racket/base (require rackunit) (require "../solutions/exercise-3.x-letrec-lang-circular.rkt") (check-equal? (run "let f = proc (x, y) -(x, y) in (f 0 0)") (num-val 0)) (check-equal? (run "let f = proc (x, y) -(x, y) in (f 0 1)") (num-val -1)) (check-equal? (run "let f = proc (x, y) -(x, y) in (f 1 0)") (num-val 1)) (check-equal? (run "let f = proc (x, y) -(x, y) in (f 1 1)") (num-val 0)) (check-equal? (run "let f = proc (x, y) -(x, y) in (f 7 4)") (num-val 3)) (check-equal? (run "letrec f(x, y) = -(x, y) in (f 0 0)") (num-val 0)) (check-equal? (run "letrec f(x, y) = -(x, y) in (f 0 1)") (num-val -1)) (check-equal? (run "letrec f(x, y) = -(x, y) in (f 1 0)") (num-val 1)) (check-equal? (run "letrec f(x, y) = -(x, y) in (f 1 1)") (num-val 0)) (check-equal? (run "letrec f(x, y) = -(x, y) in (f 7 4)") (num-val 3))
false
d47efc046b47e1b7faed76dd7929b4c026a64619
b3dc4d8347689584f0d09452414ffa483cf7dcb3
/shell-pipeline/private/pipeline-macro-logicwrapper.rkt
24e6a4e516dcaa5011641798a87edbe3d7fbed39
[ "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
2,417
rkt
pipeline-macro-logicwrapper.rkt
#lang racket/base (provide run-pipeline/logic ) (require "pipeline-macro-parse.rkt" "pipeline-operators.rkt" (prefix-in mp: "../mixed-pipeline.rkt") (for-syntax racket/base syntax/parse )) (begin-for-syntax (define-syntax-class not-piperet (pattern (~and (~not (~literal &bg)) (~not (~literal &pipeline-ret))))) (define-syntax-class not-logic (pattern (~and (~not (~literal mp:and/success)) (~not (~literal mp:or/success))))) (define-syntax-class logic (pattern (~or (~literal mp:and/success) (~literal mp:or/success)))) ) (define-syntax (run-pipeline/logic stx) (syntax-parse stx #:literals (&bg &pipeline-ret mp:and/success mp:or/success) [(_ (~or (~optional (~and s-bg &bg)) (~optional (~and s-pr &pipeline-ret))) ... arg:not-piperet ... (~or (~optional (~and e-bg &bg)) (~optional (~and e-pr &pipeline-ret))) ...) (cond [(or (and (attribute s-bg) (attribute e-bg)) (and (attribute s-pr) (attribute e-pr))) (raise-syntax-error 'run-pipeline/logic "duplicated occurences of pipeline options at beginning and end" stx)] [(or (attribute s-bg) (attribute e-bg)) #'(run-pipeline &bg =basic-object-pipe/expression= (run-pipeline/logic arg ...))] [(or (attribute s-pr) (attribute e-pr)) #'(run-pipeline/logic/inner arg ...)] [else #'(let* ([pline (run-pipeline/logic/inner arg ...)] [ret (mp:pipeline-return pline)]) (or (and (mp:pipeline-success? pline) ret) (raise ret)))])])) (define-syntax (run-pipeline/logic/inner stx) (syntax-parse stx [(_ a:not-logic ... op:logic b:not-logic ... rest ...) #'(run-pipeline/logic/helper (op (run-pipeline &pipeline-ret a ...) (run-pipeline &pipeline-ret b ...)) rest ...)] [(_ a:not-logic ...) #'(run-pipeline &pipeline-ret a ...)])) (define-syntax (run-pipeline/logic/helper stx) (syntax-parse stx [(rec prev op:logic b:not-logic ... rest ...) #'(rec (op prev (run-pipeline &pipeline-ret b ...)) rest ...)] [(_ prev) #'prev]))
true
14323a5951c8479d964ca1e1333f574dc1ee8211
8e74195db596783558d59f05a8b4069387156238
/info.rkt
d5419410b7eaf084e8595540f518a7ccfc41d839
[]
no_license
racket-dep-fixer/play
d776e18962c200952ddd71edf833654060c15274
1bb9fcb63d8454817c29880cd04012e414376b6c
refs/heads/master
2020-04-05T18:57:30.268754
2015-11-16T20:16:03
2015-11-16T20:16:03
46,388,399
0
0
null
2015-11-18T02:00:20
2015-11-18T02:00:20
null
UTF-8
Racket
false
false
252
rkt
info.rkt
#lang setup/infotab (define blurb '("PLAY")) (define homepage "http://dcc.uchile.cl/~etanter/") (define primary-file "main.rkt") (define deps '("base" "plai" "redex")) ;;(define scribblings '(("scribblings/play.scrbl" (multi-page) (teaching -20))))
false
f30500e52857aef34e56ad1f714696f3e131aaf7
98fd4b7b928b2e03f46de75c8f16ceb324d605f7
/drracket/browser/private/btree.rkt
07d08c5ae5c4c47e7a873f3aadefe00a49ca1514
[ "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
racket/drracket
213cf54eb12a27739662b5e4d6edeeb0f9342140
2657eafdcfb5e4ccef19405492244f679b9234ef
refs/heads/master
2023-08-31T09:24:52.247155
2023-08-14T06:31:49
2023-08-14T06:32:14
27,413,460
518
120
NOASSERTION
2023-09-11T17:02:44
2014-12-02T03:36:22
Racket
UTF-8
Racket
false
false
7,482
rkt
btree.rkt
#lang racket/unit (require "sig.rkt") ;; Implements a red-black tree with relative indexing along right ;; splines. This allows the usual O(log(n)) operations, plus a ;; O(log(n)) shift operation. ;; (This is the same data structure as used for lines by GRacket's text% ;; class, but that one is implemented in C++.) (import) (export (rename relative-btree^ (create-btree make-btree))) (struct btree (root) #:mutable) (struct node (pos data parent left right color) #:mutable) (define (adjust-offsets n new-child) (when new-child (set-node-pos! new-child (- (node-pos new-child) (node-pos n))))) (define (deadjust-offsets n old-child) (when old-child (set-node-pos! old-child (+ (node-pos old-child) (node-pos n))))) (define (rotate-left n btree) (let ([old-right (node-right n)]) (deadjust-offsets n old-right) (let ([r (node-left old-right)]) (set-node-right! n r) (when r (set-node-parent! r n))) (let ([p (node-parent n)]) (set-node-parent! old-right p) (cond [(not p) (set-btree-root! btree old-right)] [(eq? n (node-left p)) (set-node-left! p old-right)] [else (set-node-right! p old-right)])) (set-node-left! old-right n) (set-node-parent! n old-right))) (define (rotate-right n btree) (let ([old-left (node-left n)]) (adjust-offsets old-left n) (let ([l (node-right old-left)]) (set-node-left! n l) (when l (set-node-parent! l n))) (let ([p (node-parent n)]) (set-node-parent! old-left p) (cond [(not p) (set-btree-root! btree old-left)] [(eq? n (node-left p)) (set-node-left! p old-left)] [else (set-node-right! p old-left)])) (set-node-right! old-left n) (set-node-parent! n old-left))) (define (insert before? n btree pos data) (let ([new (node pos data #f #f #f 'black)]) (if (not (btree-root btree)) (set-btree-root! btree new) (begin (set-node-color! new 'red) ; Insert into tree (if before? (if (not (node-left n)) (begin (set-node-left! n new) (set-node-parent! new n)) (let loop ([node (node-left n)]) (if (node-right node) (loop (node-right node)) (begin (set-node-right! node new) (set-node-parent! new node))))) (if (not (node-right n)) (begin (set-node-right! n new) (set-node-parent! new n)) (let loop ([node (node-right n)]) (if (node-left node) (loop (node-left node)) (begin (set-node-left! node new) (set-node-parent! new node)))))) ; Make value in new node relative to right-hand parents (let loop ([node new]) (let ([p (node-parent node)]) (when p (when (eq? node (node-right p)) (adjust-offsets p new)) (loop p)))) ; Balance tree (let loop ([node new]) (let ([p (node-parent node)]) (when (and (not (eq? node (btree-root btree))) (eq? 'red (node-color p))) (let* ([recolor-k (lambda (y) (set-node-color! p 'black) (set-node-color! y 'black) (let ([pp (node-parent p)]) (set-node-color! pp 'red) (loop pp)))] [rotate-k (lambda (rotate node) (let ([p (node-parent node)]) (set-node-color! p 'black) (let ([pp (node-parent p)]) (set-node-color! pp 'red) (rotate pp btree) (loop pp))))] [k (lambda (node-y long-rotate always-rotate) (let ([y (node-y (node-parent p))]) (if (and y (eq? 'red (node-color y))) (recolor-k y) (let ([k (lambda (node) (rotate-k always-rotate node))]) (if (eq? node (node-y p)) (begin (long-rotate p btree) (k p)) (k node))))))]) (if (eq? p (node-left (node-parent p))) (k node-right rotate-left rotate-right) (k node-left rotate-right rotate-left)))))) (set-node-color! (btree-root btree) 'black))))) (define (find-following-node btree pos) (let ([root (btree-root btree)]) (let loop ([n root] [so-far root] [so-far-pos (and root (node-pos root))] [v 0]) (if (not n) (values so-far so-far-pos) (let ([npos (+ (node-pos n) v)]) (cond [(<= pos npos) (loop (node-left n) n npos v)] [(or (not so-far-pos) (> npos so-far-pos)) (loop (node-right n) n npos npos)] [else (loop (node-right n) so-far so-far-pos npos)])))))) (define (create-btree) (btree #f)) (define (btree-get btree pos) (let-values ([(n npos) (find-following-node btree pos)]) (and n (= npos pos) (node-data n)))) (define (btree-put! btree pos data) (let-values ([(n npos) (find-following-node btree pos)]) (if (and n (= npos pos)) (set-node-data! n data) (insert (and n (< pos npos)) n btree pos data)))) (define (btree-shift! btree start delta) (let loop ([n (btree-root btree)] [v 0]) (when n (let ([npos (node-pos n)]) (cond [(< start (+ v npos)) (set-node-pos! n (+ npos delta)) (loop (node-left n) v)] [else (loop (node-right n) (+ v npos))]))))) (define (btree-for-each btree f) (when (btree-root btree) (let loop ([n (btree-root btree)] [v 0]) (when (node-left n) (loop (node-left n) v)) (f (+ v (node-pos n)) (node-data n)) (when (node-right n) (loop (node-right n) (+ v (node-pos n))))))) (define (btree-map btree f) (reverse (let loop ([n (btree-root btree)] [v 0] [a null]) (if (not n) a (let* ([pre (loop (node-left n) v a)] [here (cons (f (+ v (node-pos n)) (node-data n)) pre)]) (loop (node-right n) (+ v (node-pos n)) here))))))
false
10e6b709ea4b578e937fa688a7789064078a16c6
0f4a095e2ae8a013cf8c69519c5865c9764f6519
/inv/MonitoringInv.rkt
3b3d90dd6c3d3651a447634d581487e35182cb19
[]
no_license
nlsfung/MADE-Language
e49a99d75f86ebe5067531f4c3515a6c853143bd
27e1a7f54a378726847c6f1bfaeda6fe65d72831
refs/heads/master
2023-05-30T23:34:13.852916
2021-06-19T18:56:10
2021-06-19T18:56:10
206,230,119
2
0
null
null
null
null
UTF-8
Racket
false
false
11,509
rkt
MonitoringInv.rkt
#lang rosette/safe (require "../rpm/MonitoringProcess.rkt" "../rpm/MadeProcess.rkt" "../rim/BasicDataTypes.rkt" "../rim/TemporalDataTypes.rkt" "../rim/MadeDataStructures.rkt") ; Symbolic constants for verifying generate data. ; Executed with datetime-unwind and schedule-unwind set to 0. (define (gen-dt-part) (define-symbolic* dt-part integer?) dt-part) (define (gen-datetime) (let ([hour (gen-dt-part)]) (assert (and (>= hour 0) (< hour 24))) (datetime 7 10 20 hour 0 0))) (define (gen-window) (let ([hour (gen-dt-part)]) (assert (and (>= hour 0) (< hour 24))) (duration 0 hour 0 0))) (define (gen-proxy) (define-symbolic* proxy boolean?) proxy) (define (gen-measure-value) (define-symbolic* m integer?) (assert (> m 0)) m) (struct body-acceleration measurement () #:transparent) (define (gen-body-acc) (body-acceleration (gen-proxy) (gen-datetime) (gen-measure-value))) (struct blood-glucose observed-property () #:transparent) (define (gen-blood-gluc) (blood-glucose (gen-proxy) (gen-datetime) (gen-measure-value))) (struct activity-level observed-property () #:transparent) (struct exercise-event observed-event () #:transparent) (define (sum d-list) (+ (foldl (lambda (d result) (+ (measurement-value d) result)) 0 (filter (lambda (d) (body-acceleration? d)) d-list)) (foldl (lambda (d result) (+ (measurement-value d) result)) 0 (filter (lambda (d) (blood-glucose? d)) d-list)))) (define property-window (gen-window)) (define activity-spec (property-specification property-window sum)) (define event-start-win (gen-window)) (define event-end-win (gen-window)) (define event-start-pred (lambda (d-list) (> (sum d-list) 25))) (define event-end-pred (lambda (d-list) (and (< (sum d-list) 5) (> (sum d-list) 0)))) (define exercise-spec (event-specification (event-trigger event-start-win event-start-pred) (event-trigger event-end-win event-end-pred))) (define d-state (list (gen-body-acc) (gen-body-acc))) (define sched-dt (gen-datetime)) (define cur-dt (gen-datetime)) (define-symbolic proc-status boolean?) (define c-state (control-state (schedule (list sched-dt) #f) #t)) (define sample-process-1-proxy (gen-proxy)) (struct sample-process-1 monitoring-process () #:transparent #:methods gen:monitoring [(define (monitoring-process-output-specification self) activity-spec) (define (monitoring-process-output-type self) activity-level) (define (monitoring-process-proxy-flag self) sample-process-1-proxy)] #:methods gen:typed [(define/generic super-valid? valid?) (define (get-type self) sample-process-1) (define (valid? self) (and (valid-spec? self) (super-valid? (made-process (made-process-data-state self) (made-process-control-state self)))))]) (define sample-process-2-proxy (gen-proxy)) (struct sample-process-2 monitoring-process () #:transparent #:methods gen:monitoring [(define (monitoring-process-output-specification self) exercise-spec) (define (monitoring-process-output-type self) exercise-event) (define (monitoring-process-proxy-flag self) sample-process-2-proxy)] #:methods gen:typed [(define/generic super-valid? valid?) (define (get-type self) sample-process-2) (define (valid? self) (and (valid-spec? self) (super-valid? (made-process (made-process-data-state self) (made-process-control-state self)))))]) (define m-proc-1 (sample-process-1 d-state c-state)) (define m-proc-2 (sample-process-2 d-state c-state)) (define output-1 (generate-data m-proc-1 null cur-dt)) (define output-2 (generate-data m-proc-2 null cur-dt)) ; Inv. 3.6 - Verify relevance of measurements for Monitoring processes. (define output-1-alt (generate-data m-proc-1 (list (gen-blood-gluc)) cur-dt)) (define (verify-measurement-relevance) (verify #:assume (assert (is-proc-activated? c-state cur-dt)) #:guarantee (assert (eq? output-1 output-1-alt)))) ; Inv. 3.7 - Verify type of output data. (define (verify-output-type) (verify (assert (implies (not (null? output-1)) (andmap (lambda (d) (observation? d)) output-1))))) ; Inv. 3.8 - Verify implementation of proxy flag. (define (verify-proxy-flag) (verify (assert (implies (not (null? output-1)) (andmap (lambda (d) (eq? (made-data-proxy-flag d) (monitoring-process-proxy-flag m-proc-1))) output-1))))) ; Inv. 6.7 - Verify length of output. (define (verify-output-length) (verify (assert (<= (length output-1) 1)))) ; Inv. 6.8 - Verify implementation of generate-data for the Monitoring of observed properties. (define (filter-ext dSet dt-start dt-end) (filter-measurements (remove-duplicates (filter (lambda (d) (not (made-data-proxy-flag d))) dSet)) dt-start dt-end)) (define (verify-generate-property) (verify (assert (implies (is-proc-activated? c-state cur-dt) (eq? output-1 (list (activity-level sample-process-1-proxy cur-dt (sum (filter-ext d-state (dt- cur-dt property-window) cur-dt))))))))) ; Inv. 6.9 - Verify implementation of filter-measurements. (define (verify-filter) (verify (assert (eq? (filter-measurements (append d-state (list (made-data #f))) (dt- cur-dt property-window) cur-dt) (filter (lambda (d) (and (measurement? d) (dt>=? (measurement-valid-datetime d) (dt- cur-dt property-window)) (dt<=? (measurement-valid-datetime d) cur-dt))) (append d-state (list (made-data #f)))))))) ; Inv. 6.10 - Verify output-type and transation date-time of observed events. (define (verify-generate-event-id) (verify (assert (implies (not (null? output-2)) (and (exercise-event? (list-ref output-2 0)) (dt=? (transaction-datetime (list-ref output-2 0)) cur-dt) (eq? sample-process-2-proxy (made-data-proxy-flag (list-ref output-2 0)))))))) ; Inv. 6.11 - Verify necessary and sufficient conditions for outputting an observed event. (define (verify-event-condition) (verify #:assume (assert (is-proc-activated? c-state cur-dt)) #:guarantee (assert (eq? (null? output-2) (not (not (and (or (not (event-start-pred (filter-ext d-state (dt- cur-dt event-start-win) cur-dt))) (andmap (lambda (dt-mid) (not (and (dt<=? dt-mid cur-dt) (event-end-pred (filter-ext d-state (dt- dt-mid event-end-win) dt-mid))))) (map (lambda (d) (measurement-valid-datetime d)) d-state))) (or (not (event-end-pred (filter-ext d-state (dt- cur-dt event-end-win) cur-dt))) (andmap (lambda (dt-mid) (not (and (dt<=? dt-mid cur-dt) (event-start-pred (filter-ext d-state (dt- dt-mid event-start-win) dt-mid))))) (map (lambda (d) (measurement-valid-datetime d)) d-state)))))))))) ; Inv. 6.12 - Verify implementation of generate-data for false events. (define (get-event-start-dt d) (datetime-range-start (observed-event-valid-datetime-range d))) (define (get-event-end-dt d) (datetime-range-end (observed-event-valid-datetime-range d))) (define (verify-generate-false-event) (verify (assert (implies (and (not (null? output-2)) (not (observed-event-value (list-ref output-2 0)))) (and (eq? (get-event-end-dt (list-ref output-2 0)) cur-dt) (event-start-pred (filter-ext d-state (dt- cur-dt event-start-win) cur-dt)) (event-end-pred (filter-ext d-state (dt- (get-event-start-dt (list-ref output-2 0)) event-end-win) (get-event-start-dt (list-ref output-2 0)))) (andmap (lambda (dt-mid) (implies (dt>? dt-mid (get-event-start-dt (list-ref output-2 0))) (not (event-end-pred (filter-ext d-state (dt- dt-mid event-end-win) dt-mid))))) (map (lambda (d) (measurement-valid-datetime d)) (filter-ext d-state (get-event-start-dt (list-ref output-2 0)) (get-event-end-dt (list-ref output-2 0)))))))))) ; Inv. 6.13 - Verify implementation of generate-data for true events. (define (verify-generate-true-event) (verify (assert (implies (and (not (null? output-2)) (observed-event-value (list-ref output-2 0))) (and (eq? (get-event-end-dt (list-ref output-2 0)) cur-dt) (event-end-pred (filter-ext d-state (dt- cur-dt event-end-win) cur-dt)) (event-start-pred (filter-ext d-state (dt- (get-event-start-dt (list-ref output-2 0)) event-start-win) (get-event-start-dt (list-ref output-2 0)))) (andmap (lambda (dt-mid) (implies (dt>? dt-mid (get-event-start-dt (list-ref output-2 0))) (not (event-start-pred (filter-ext d-state (dt- dt-mid event-start-win) dt-mid))))) (map (lambda (d) (measurement-valid-datetime d)) (filter-ext d-state (get-event-start-dt (list-ref output-2 0)) (get-event-end-dt (list-ref output-2 0))))))))))
false
767abf4b4fafca729cbbfa9d04d7ff93f9cddc39
82c76c05fc8ca096f2744a7423d411561b25d9bd
/typed-racket-test/succeed/req-type-sub.rkt
0f141e99011c3485c1c1a69f262b58615edf1a18
[ "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
230
rkt
req-type-sub.rkt
#lang racket (define (f x) (add1 x)) (provide f) (module* m typed/racket (require/typed (submod "..") [f (Integer -> Integer)]) (f 7)) (module* n typed/racket (require/typed (submod "..") [f (Integer -> String)]) (f 7))
false
117a629ddff87a59a33993eb117d29ef3edd4910
2a2e0613c4b2d0c71f0860e1920c861ff22118f5
/stages.rkt
befcf8cff7d6fcf16a71bf851538dfda09b35623
[]
no_license
samth/pi-2018
a491fe83bd86f44c51e0f9ecd5dd22097875e0f4
1df123022ca5700669fb3bb161e3f0981261680e
refs/heads/master
2020-03-12T17:49:32.441280
2018-04-23T19:24:17
2018-04-23T19:24:17
130,745,762
0
0
null
null
null
null
UTF-8
Racket
false
false
1,034
rkt
stages.rkt
#lang slideshow (require "config.rkt" "lib.rkt") (define ((mk-stage . words) hi?) (define name-pic (apply vc-append -5 (map (λ (p) (if (string? p) (t p) p)) words))) (define box (parameterize ([current-outline-color (if hi? "red" "black")]) (colorize (transparent-block name-pic) (if hi? "red" "black")))) box) (define il (mk-stage "Intermediate" "Language")) (define static (mk-stage "Semantic" "Analysis")) (define codegen (mk-stage "Code" "Generation")) (define parser (mk-stage "Lexing &" "Parsing")) (define linking (mk-stage (cc-superimpose (t "Linking") (vc-append -5 (t " ") (t " "))))) (define (connect-stages a b) (pin-arrow-line #:hide-arrowhead? #f #:line-width 4 8 (hc-append 40 a b) a rc-find b lc-find)) (define order (list parser static il codegen linking)) (define (stages [highlight (map (λ _ #f) order)]) (match* (order highlight) [((list rst ... lst) (list rst* ... lst*)) (foldr connect-stages (lst lst*) (map (λ (f a) (f a)) rst rst*))])) (provide (all-defined-out))
false
8327fe450c9bfa1ec9d51696f00f41cdb4bdde76
5bbc152058cea0c50b84216be04650fa8837a94b
/experimental/micro/tetris/typed/tetras-tetra-overlaps-blocks.rkt
08a4c2b5254168550b00fabab3a83b219ab155d2
[]
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
544
rkt
tetras-tetra-overlaps-blocks.rkt
#lang typed/racket/base (provide tetra-overlaps-blocks?) (require benchmark-util "data-posn-adapted.rkt" "data-block-adapted.rkt" "data-tetra-adapted.rkt") (require/typed/check "bset-blocks-intersect.rkt" [blocks-intersect (-> BSet BSet BSet)]) ;; ============================================================================= ;; Is the tetra on any of the blocks? (: tetra-overlaps-blocks? (-> Tetra BSet Boolean)) (define (tetra-overlaps-blocks? t bs) (not (eq? '() (blocks-intersect (tetra-blocks t) bs))))
false
8bb0d24ce7893798fd6a0fb76f153bb6aca11133
804e0b7ef83b4fd12899ba472efc823a286ca52d
/apps/coastmed/binding_env/Behr.rkt
0750731884b9a0524d4989634b861be50e60dbf7
[]
no_license
cha63506/CRESTaceans
6ec436d1bcb0256e17499ea9eccd5c034e9158bf
a0d24fd3e93fc39eaf25a0b5df90ce1c4a96ec9b
refs/heads/master
2017-05-06T16:59:57.189426
2013-10-17T15:22:35
2013-10-17T15:22:35
null
0
0
null
null
null
null
UTF-8
Racket
false
false
1,974
rkt
Behr.rkt
#lang racket/base (require COAST "bindings-extensions.rkt" db/sqlite3 db/base) (provide (all-defined-out)) (define conn-ehrdb (kill-safe-connection (sqlite3-connect #:database "ehr" #:mode 'read/write))) (define (get-all-patients-records) (query-rows conn-ehrdb "select * from patients LEFT JOIN patient_procedures ON patients.patient_id=patient_procedures.patient_id LEFT JOIN patient_immunization_records ON patient_procedures.patient_id=patient_immunization_records.patient_id")) (define (get-all-patients-records-anonymized) (query-rows conn-ehrdb "SELECT * FROM view_anonimized_patients_records")) (define (get-patient-record patient_id) (query-row conn-ehrdb "select * from patients, patient_procedures, patient_immunization_records where patients.patient_id = $1 and patient_procedures.patient_id = $1 and patient_immunization_records.patient_id = $1" patient_id)) (define (get-my-record curl) (get-patient-record (hash/ref (curl/get-meta curl) 'patient_id #f))) ;;transform a vector into a motile persistent vector (define (vector->vector/persist vec) (list/vector vector/null (vector->list vec))) ; defines the binding environment βhospital for actor Ahospital (define βstaffServices (pairs/environ (environs/merge BASELINE MESSAGES/SEND MESSAGES/RECEIVE DISPLAYING) (global-defines get-all-patients-records get-patient-record vector->vector/persist))) ; defines the binding environment βArequestEHR for actor Arequest (define βpatientServices (pairs/environ (environs/merge BASELINE MESSAGES/SEND MESSAGES/RECEIVE DISPLAYING) (global-defines get-my-record vector->vector/persist))) ; defines the binding environment βAresearcher for actor Aresearcher (define βresearcherServices (pairs/environ (environs/merge BASELINE MESSAGES/SEND MESSAGES/RECEIVE DISPLAYING) (global-defines get-all-patients-records-anonymized vector->vector/persist)))
false
7ca2a0ccfa576872d3e93e486e91d238e74a7940
d5b24cc43f13d84ccfccf7867ffdd90efb45f457
/libs/tile.rkt
d45391f4a0aef0c6eff7905c78f6ada7aaf983ac
[ "MIT" ]
permissive
jpverkamp/house-on-the-hill
ae86d46265636cacbc1fcf93e728daf24842da1d
af6dcad52dbeba25c8f376ba6ce2ec24c6f4362f
refs/heads/master
2021-01-13T01:35:56.049740
2014-02-17T23:40:44
2014-02-17T23:40:44
8,725,181
6
1
null
null
null
null
UTF-8
Racket
false
false
2,561
rkt
tile.rkt
#lang racket (provide define-tile define-global-tile get-global-tile) ; global tiles (define *global-tiles* (make-hasheq)) ; store information about tiles ; ; required fields: ; name - the name for the room displayed to the player ; tile - the tile used in floorplans and the default tile to display ; ; optional fields: ; description - the description sent to the player on inspection (default = "") ; default-tile - the tile to use when the room is oriented normally (default = tile) ; rotated-tile - the tile to use when the room is rotated 90 degrees (default = tile) ; foreground - the foreground color (default = "white") ; background - the background color (default = "black") ; walkable - if you can walk on the tile (default = #t) ; on-walk - event called when the player walks onto this tile (default = none) (define tile% (class object% ; required fields (init-field name tile) ; optional fields (init-field [description ""] [default-tile tile] [rotated-tile tile] [foreground "white"] [background "black"] [walkable #t] [on-walk #f]) ; accessors for public fields (define/public (get-name) name) (define/public (get-description) description) (define/public (get-foreground) foreground) (define/public (get-background) background) ; various helper methods (define/public (get-tile-key) tile) (define/public (get-tile [rotated #f]) (if rotated rotated-tile default-tile)) (define/public (walkable?) walkable) (define/public (do-walk player tile) (when on-walk (on-walk player tile))) ; fix the tiles if they were given as a string (when (string? tile) (set! tile (string-ref tile 0))) (when (string? default-tile) (set! default-tile (string-ref default-tile 0))) (when (string? rotated-tile) (set! rotated-tile (string-ref rotated-tile 0))) ; this has to be here (super-new))) ; public API for tiles (define-syntax-rule (define-tile args ...) (new tile% args ...)) ; public API for defining tiles ; these will be used if a room doesn't override it with define-tile ; if you call this more than once with different keys, the last will be used ; TODO: finish this (define-syntax-rule (define-global-tile args ...) (begin (define tile (define-tile args ...)) (define char (send tile get-tile)) (hash-set! *global-tiles* char tile))) ; get a global tile definition (define (get-global-tile char) (hash-ref *global-tiles* char #f))
true
8df6ec9c151f32d57388f7bb6a1003160f735bdf
d755de283154ca271ef6b3b130909c6463f3f553
/htdp-doc/teachpack/htdp/scribblings/hangman.scrbl
00732eb0ff649e8b8943f841c20f921b417051fe
[ "Apache-2.0", "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
racket/htdp
2953ec7247b5797a4d4653130c26473525dd0d85
73ec2b90055f3ab66d30e54dc3463506b25e50b4
refs/heads/master
2023-08-19T08:11:32.889577
2023-08-12T15:28:33
2023-08-12T15:28:33
27,381,208
100
90
NOASSERTION
2023-07-08T02:13:49
2014-12-01T13:41:48
Racket
UTF-8
Racket
false
false
1,349
scrbl
hangman.scrbl
#lang scribble/doc @(require scribble/manual "shared.rkt" (for-label racket teachpack/htdp/hangman)) @teachpack["hangman"]{Hangman} @defmodule[#:require-form beginner-require htdp/hangman] The teachpack implements the callback functions for playing a @emph{Hangman} game, based on a function designed by a student. The player guesses a letter and the program responds with an answer that indicates how many times, if at all, the letter occurs in the secret word. @defproc[(hangman [make-word (-> symbol? symbol? symbol? word?)][reveal (-> word? word? word?)][draw-next-part (-> symbol? true)]) true]{ Chooses a ``secret'' three-letter word and uses the given functions to manage the @emph{Hangman} game.} @defproc[(hangman-list [reveal-for-list (-> symbol? (list-of symbol?) (list-of symbol?) (list-of symbol?))] [draw-next-part (-> symbol? true)]) true]{ Chooses a ``secret'' word---a list of symbolic letters---and uses the given functions to manage the @emph{Hangman} game: @racket[reveal-for-list] determines how many times the chosen letter occurs in the secret word; @racket[draw-next-part] is given the symbolic name of a body part and draws it on a separately managed canvas. } In addition, the teachpack re-exports the entire functionality of the drawing library; see @secref{draw} for documentation.
false
ca7936e5c404aee014b27506b83903688504fec9
fdac667c3df2c88492190ace2672f740c461a3b4
/kw-utils/docs/mapper.scrbl
8ac37f20676991d5da92be3020024b255fdec1e9
[ "MIT" ]
permissive
AlexKnauth/kw-utils
b7d96e6bdc4dfeb896549b76143dd1077b3787ac
99b1fc4cb7f28defb04d8d0504ee4eff1540eb28
refs/heads/master
2022-09-11T15:24:30.021914
2022-08-24T00:03:03
2022-08-24T00:03:03
26,516,596
4
2
null
2016-09-02T19:43:27
2014-11-12T03:03:38
Racket
UTF-8
Racket
false
false
932
scrbl
mapper.scrbl
#lang scribble/manual @(require scribble/eval (for-label kw-utils/mapper kw-utils/partial kw-utils/kw-map (except-in racket/base map) racket/contract/base racket/function )) @title{Creating functions that map over lists} @defmodule[kw-utils/mapper] @defproc*[([(mapper [f procedure?] [arg any/c] ... [#:<kw> kw-arg any/c] ...) procedure?] [(mapper [#:<kw> kw-arg any/c] ...) procedure?])]{ The one-argument case is equivalent to a curried version of @racket[map]. @racket[(mapper f)] is equivalent to @racket[(partial map f)], and @racket[(mapper arg ...)] is equivalent to @racket[(partial map (partial arg ...))]. @examples[ (require kw-utils/mapper) ((mapper add1) '(1 2 3)) ((mapper +) '(1 2 3) '(4 5 6)) ((mapper + 3) '(1 2 3)) ((mapper + 3) '(1 2 3) '(4 5 6)) ]}
false
776f3d76e3f91407cb595c2f232bb9bc609bf4e9
b08b7e3160ae9947b6046123acad8f59152375c3
/Programming Language Detection/Experiment-2/Dataset/Train/Racket/almost-prime.rkt
a2e5a4c9d500f5b50d09a4d72f60b17fe2e1897f
[]
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
809
rkt
almost-prime.rkt
#lang racket (require (only-in math/number-theory factorize)) (define ((k-almost-prime? k) n) (= k (for/sum ((f (factorize n))) (cadr f)))) (define KAP-table-values (for/list ((k (in-range 1 (add1 5)))) (define kap? (k-almost-prime? k)) (for/list ((j (in-range 10)) (i (sequence-filter kap? (in-naturals 1)))) i))) (define (format-table t) (define longest-number-length (add1 (order-of-magnitude (argmax order-of-magnitude (cons (length t) (apply append t)))))) (define (fmt-val v) (~a v #:width longest-number-length #:align 'right)) (string-join (for/list ((r t) (k (in-naturals 1))) (string-append (format "║ k = ~a║ " (fmt-val k)) (string-join (for/list ((c r)) (fmt-val c)) "| ") "║")) "\n")) (displayln (format-table KAP-table-values))
false
575fcaf1c2479369eb8c8a67f2f211fc457e390c
9bb366800f4acd0616ac0661811897d6be3e0a75
/pollen-utilities/utility.rkt
966a6ed703a23d693a960f91866bddcca4dc06e1
[]
no_license
beelzebielsk/pollen-utilities
e1ff62a2ecd92d84d04501f600defeebb16a31eb
9c30ea2b56effa7c1c33e0ba9087c5e832583945
refs/heads/master
2020-04-05T14:23:22.002707
2019-12-07T05:58:15
2019-12-07T05:58:15
156,926,729
1
0
null
null
null
null
UTF-8
Racket
false
false
12,308
rkt
utility.rkt
#lang racket (require txexpr pollen/decode) (module+ test (require rackunit)) (provide (all-defined-out)) ; Pollen Helpers: {{{ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Makes it so that a list of elements appears in the pollen document ; as if they were not enclosed in a list. Like when/splice, but always ; happens. The map here is for just in case something is produced that ; is not a txexpr-element. Any number that's not a symbol (I think) is ; not a txexpr-element, so that's nonpositive numbers, floating-point, ; exact rational numbers which do not reduce to an integer. (define (list-splice . args) (if (= 1 (length args)) (let ([lst (first args)]) (cons '@ (map (lambda (e) (if (txexpr-element? e) e (~a e))) lst))) (list-splice (list* args)))) (define-syntax let-splice (lambda (stx) (syntax-case stx () [(_ ((id val) ...) body) #'(let ((id val) ...) body)] [(_ ((id val) ...) body ...) #'(let ((id val) ...) (list-splice body ...))]))) (define (@-flatten txpr) (decode txpr #:txexpr-proc (decode-flattener #:only '(@)))) ; }}} ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define (is-tag? tag . names) (and (txexpr? tag) (member (get-tag tag) names))) (define (has-attr? tag attr) (attrs-have-key? (get-attrs tag) attr)) ; lambda? -> lambda? ; This takes a procedure and alters it so that it is safe to use as ; the #:txexpr-proc argument to the decode-elements function. It's a ; temporary hack. The problem is that decode-elements functions like ; decode, but it places the txexpr-elements? inside a temporary tag. ; And this temporary tag is a vaid target of the #:txexpr-proc. This ; can be very confusing. (define (make-d-el-proc proc) (lambda (tx) (if (string-prefix? (symbol->string (get-tag tx)) "temp-tag") tx (proc tx)))) ; list? list? -> lambda ; Takes in one of two optional lists of tags: ; #:only, which specifies which tags to flatten and nothing else (a ; whitelist for flattening). ; #:exclude, which will flattens all tags except for those listed (a ; blacklist for flattening). ; Returns a function that, when given as #:txexpr-proc in ; pollen/decode, will flatten those tags and leave all others alone. ; ; #:only and #:exclude should not be given together, as the effect of ; only one of the two will work. ; ; Here, flattening means that the contents of the tag will be placed ; in the parent tag. The flattening here is recursive, so for a given ; tag which is to be flattened, first all of it's descendants will ; have their contents flattened (if specified to be), then those ; results will be placed in the parent tag of that tag. (define (decode-flattener #:only [only-these (void)] #:exclude [except-these (void)]) (cond [(and (void? only-these) (void? except-these)) get-elements] [(void? except-these) (λ (tx) (if (ormap (λ (name) (is-tag? tx name)) only-these) (get-elements tx) tx))] [else (λ (tx) (if (ormap (λ (name) (is-tag? tx name)) except-these) tx (get-elements tx)))])) (define (flatten-tags elements #:only [only-these (void)] #:exclude [except-these (void)]) (if (txexpr? elements) (decode elements #:txexpr-proc (decode-flattener #:only only-these #:exclude except-these)) (decode-elements elements #:txexpr-proc (decode-flattener #:only only-these #:exclude except-these)))) (define printable? (or/c string? number? symbol?)) ; list? procedure? ; #:keep-where procedure? ; #:split-map procedure? ; #:keep-empty-splits? boolean? ; #:action (or/c procedure? #f) ; -> list? ; Somewhat similar to the split procedure for strings. Takes a list ; and returns a list of the same elements of lst, in the same order, ; but placed in sublists. Each sublist ends where an element occurs ; that causes (split-pred? element current-split tail) to be true. The ; next sublist picks up from there. ; - The #:keep-where procedure determines where an element that causes ; a split will go. If the procedure returns: ; - 'current: The element which caused the split will be placed ; at the end of the sublist that was being built when the ; element was encountered. ; - 'next: The element which caused the split will be placed ; at the start of the next sublist that will be built up. ; - 'separate: The element will be placed on its own. It won't ; be in a sublist, the element itself will be placed between ; the current sublist being built, and the next sublist that ; will be built. ; - 'ignore: The element will not be placed in any split, nor on ; its own. It just gets ignored. ; - The split-map option is supplied because the output of split-where ; may not be a list of splits if the #:keep-where function returns ; 'separate. In this case, the split element is placed on it's own ; in the list of splits. Mapping over the splits (and only the ; splits) is a common enough use-case, I think, that the optional ; parameter is ; warranted. ; - If a split should be empty (such as when there are two consecutive ; elements that cause split-pred? to be true), then those splits are ; not kept if #:keep-empty-splits? is false. Otherwise, the splits ; are kept. ; - #:action is a procedure that should take the following paramters: ; current-split, splits, remaining and return (values ; next-current-split, next-splits, next-remaining). This allows ; total control over how to produce splits from the function, if ; that's desired. ; ; The reason why the objects at which we split are not placed in the ; list as splits is that this function takes after split-string, and ; functions like it from other languages. The thing upon which we ; split is normally removed. Not considered. There are use cases where ; you wouldn't want to throw away that which you split upon, but you'd ; want to run a function over everything else. (define (split-where lst split-pred? #:keep-where [keep-pred? (λ _ 'ignore)] #:split-map [split-func identity] #:action [loop-body #f]) (define (update-splits-list current-split element decision splits) (define finished-splits (make-finished-splits current-split element decision)) (append finished-splits splits)) (define (make-finished-splits current-split element decision) (define current-split-before-map (if (eq? decision 'current) (cons element current-split) current-split)) (define finished-current-split (if (null? current-split-before-map) current-split-before-map (split-func (reverse current-split-before-map)))) (define splits null) (unless (null? finished-current-split) (set! splits (cons finished-current-split splits))) ; split-func is not applied when a split is kept using 'separate. ; Nor is it wrapped in a list like other splits. (when (eq? decision 'separate) (set! splits (cons element splits))) splits) (define (make-new-split element decision) (case decision [(next) (list element)] [else null])) (define-values (last-split splits _) (if loop-body (for/fold ([current-split null] [splits null] [remaining lst]) ([element lst]) (loop-body current-split splits remaining)) (for/fold ([current-split null] [splits null] [remaining lst]) ([element lst]) (define tail (cdr remaining)) (define split? (split-pred? element current-split tail)) (define decision (keep-pred? element current-split tail)) (if (not split?) (values (cons element current-split) splits tail) (values (make-new-split element decision) (update-splits-list current-split element decision splits) tail))))) (reverse (if (null? last-split) splits (cons (split-func (reverse last-split)) splits)))) ; any/c lambda? -> any/c ; If a value is a list, then it will reverse the list and all lists ; contained within. If the value is not a list, or it satisfies the ; leaf? predicate, then the value will be untouched. (define (reverse* val [leaf? (λ (v) (not (list? v)))]) (define (helper val) (if (leaf? val) val (reverse (map helper val)))) (helper val)) ; list? lambda? -> list? ; Takes a list and a predicate. Removes all contiguous series of ; elements at the front and back of the list which satisfy the ; predicate. (define (list-strip lst pred?) (dropf-right (dropf lst pred?) pred?)) (define (attr-list-ref lst key [failure-result #f]) (let ([pair (findf (λ (p) (eq? (first p) key)) lst)]) (if pair (second pair) failure-result))) (module+ test (define (zip l1 l2) (cond ((or (null? l1) (null? l2)) null) (else (cons (list (car l1) (car l2)) (zip (cdr l1) (cdr l2)))))) (test-case "reverse*" (define tests `((a b c) (a b c d) (0 1 2 3 4) (a b 0 1) (a (b c) d e (f g)) (a (b c d) 0 1 2 (3 4 5 e f (g h))))) (define expected-results `((c b a) (d c b a) (4 3 2 1 0) (1 0 b a) ((g f) e d (c b) a) (((h g) f e 5 4 3) 2 1 0 (d c b) a))) (for ([test-case tests] [result expected-results]) (check-equal? (reverse* test-case) result "reverse* failed"))) (test-case "decode-flattener" (define xexp1 `(root (a "content") (b "content") (c "content") (d "content"))) (match-let ([(list 'root a b c d) xexp1]) (check-equal? `(root ,@(get-elements a) ,b ,c ,d) (decode xexp1 #:txexpr-proc (decode-flattener #:only '(a)))) (check-equal? `(root ,a ,@(get-elements b) ,c ,d) (decode xexp1 #:txexpr-proc (decode-flattener #:only '(b)))) (check-equal? `(root ,a ,b ,@(get-elements c) ,d) (decode xexp1 #:txexpr-proc (decode-flattener #:only '(c)))) (check-equal? `(root ,a ,b ,c ,@(get-elements d)) (decode xexp1 #:txexpr-proc (decode-flattener #:only '(d)))) (check-equal? `(root ,@(get-elements a) ,@(get-elements b) ,c ,d) (decode xexp1 #:txexpr-proc (decode-flattener #:only '(a b)))) (check-equal? `(root ,a ,@(get-elements b) ,@(get-elements c) ,d) (decode xexp1 #:txexpr-proc (decode-flattener #:only '(b c)))) (check-equal? `(root ,a ,b ,@(get-elements c) ,@(get-elements d)) (decode xexp1 #:txexpr-proc (decode-flattener #:only '(c d)))) (check-equal? `(root ,@(get-elements a) ,b ,c ,@(get-elements d)) (decode xexp1 #:txexpr-proc (decode-flattener #:only '(a d)))))) (define (split a-case) (split-where a-case (λ (e . _) (eq? 's e)))) (test-case "split-where 1" (define the-case '(0 1 2 s 3 4 5 s s 6 7 8 9 10 s)) (define expected-result '((0 1 2) (3 4 5) (6 7 8 9 10))) (check-equal? (split the-case) expected-result)) (test-case "split-where 2" (define the-case '(10 8 9 7 6 5 4 3 2 1)) (define expected-result (list the-case)) (check-equal? (split the-case) expected-result)) (test-case "split-where 3" (define the-case '(10 8 9 s 7 6 s 5 s s 4 s 3 2 1 s)) (define expected-result '((10 8 9) (7 6) (5) (4) (3 2 1))) (check-equal? (split the-case) expected-result)) (test-case "split-where 4" (define the-case '(s 10 8 9 s 7 6 s 5 s s 4 s 3 2 1 s)) (define expected-result '((10 8 9) (7 6) (5) (4) (3 2 1))) (check-equal? (split the-case) expected-result)) (test-case "split-where 5" (define the-case '(s)) (define expected-result null) (check-equal? (split the-case) expected-result))) ; TODO: ; - make let-splice convert numbers to strings in the final product.
true
7cdda46fc817677ef8809f69c3a32a03a5e2ac88
30e5578d82f77b67153d38abce61e00e80694f6e
/bitmap/digitama/unsafe/composite.rkt
eb5767dcc892244715b73e59a495c0ac30563e9b
[]
no_license
soegaard/graphics
b492b414d38d0df9ecf8bb79a56d026454df1f59
3d2f9a008322b541237b7cb52a9116e2f8164ef2
refs/heads/master
2022-11-15T11:19:58.815282
2020-07-11T03:52:23
2020-07-11T03:52:23
null
0
0
null
null
null
null
UTF-8
Racket
false
false
14,044
rkt
composite.rkt
#lang typed/racket/base (provide (all-defined-out)) (require typed/racket/unsafe) (require "convert.rkt") (module unsafe racket/base (provide (all-defined-out) CAIRO_OPERATOR_OVER) (require (only-in racket/list make-list)) (require (only-in racket/vector vector-append)) (require "pangocairo.rkt") (require "paint.rkt") (require (submod "convert.rkt" unsafe)) (define (bitmap_composite operator sfc1 sfc2 dx dy density) (define-values (w1 h1) (cairo-surface-size sfc1 density)) (define-values (w2 h2) (cairo-surface-size sfc2 density)) (define-values (dx1 dy1) (values (unsafe-flmax (unsafe-fl- 0.0 dx) 0.0) (unsafe-flmax (unsafe-fl- 0.0 dy) 0.0))) (define-values (dx2 dy2) (values (unsafe-flmax dx 0.0) (unsafe-flmax dy 0.0))) (define-values (img cr) (make-cairo-image (unsafe-flmax (unsafe-fl+ dx1 w1) (unsafe-fl+ dx2 w2)) (unsafe-flmax (unsafe-fl+ dy1 h1) (unsafe-fl+ dy2 h2)) density #true)) (cairo-composite cr sfc1 dx1 dy1 w1 h1 CAIRO_FILTER_BILINEAR CAIRO_OPERATOR_SOURCE density #true) (cairo-composite cr sfc2 dx2 dy2 w2 h2 CAIRO_FILTER_BILINEAR operator density #false) (cairo_destroy cr) img) (define (bitmap_pin operator x1% y1% x2% y2% sfc1 sfc2 density) (define-values (w1 h1) (cairo-surface-size sfc1 density)) (define-values (w2 h2) (cairo-surface-size sfc2 density)) (bitmap_composite operator sfc1 sfc2 (unsafe-fl- (unsafe-fl* x1% w1) (unsafe-fl* x2% w2)) (unsafe-fl- (unsafe-fl* y1% h1) (unsafe-fl* y2% h2)) density)) (define (bitmap_pin* operator x1% y1% x2% y2% sfc1 sfcs density) (define-values (min-width min-height) (cairo-surface-size sfc1 density)) (define-values (flwidth flheight all) (let compose ([width min-width] [height min-height] [lla (list (vector sfc1 0.0 0.0 min-width min-height))] [dx 0.0] [dy 0.0] ; offsets passed to (bitmap_composite), also see (flomap-pin*) [width1 min-width] [height1 min-height] [children sfcs]) (cond [(null? children) (values width height (reverse lla))] [else (let ([sfc2 (unsafe-car children)]) (define-values (width2 height2) (cairo-surface-size sfc2 density)) (define nx (unsafe-fl+ dx (unsafe-fl- (unsafe-fl* width1 x1%) (unsafe-fl* width2 x2%)))) (define ny (unsafe-fl+ dy (unsafe-fl- (unsafe-fl* height1 y1%) (unsafe-fl* height2 y2%)))) (define-values (xoff1 yoff1) (values (unsafe-flmax (unsafe-fl- 0.0 nx) 0.0) (unsafe-flmax (unsafe-fl- 0.0 ny) 0.0))) (define-values (xoff2 yoff2) (values (unsafe-flmax nx 0.0) (unsafe-flmax ny 0.0))) (compose (unsafe-flmax (unsafe-fl+ xoff1 width) (unsafe-fl+ xoff2 width2)) (unsafe-flmax (unsafe-fl+ yoff1 height) (unsafe-fl+ yoff2 height2)) (unsafe-cons-list (vector sfc2 xoff2 yoff2 width2 height2) lla) (unsafe-flmax nx 0.0) (unsafe-flmax ny 0.0) width2 height2 (unsafe-cdr children)))]))) (define-values (bmp cr) (make-cairo-image flwidth flheight density #true)) (let combine ([all all]) (unless (null? all) (define child (unsafe-car all)) (cairo-composite cr (unsafe-vector*-ref child 0) (unsafe-vector*-ref child 1) (unsafe-vector*-ref child 2) (unsafe-vector*-ref child 3) (unsafe-vector*-ref child 4) CAIRO_FILTER_BILINEAR operator density #true) (combine (unsafe-cdr all)))) bmp) (define (bitmap_append alignment operator base others gapsize density) ; slight but more efficient than (bitmap_pin*) (define-values (min-width min-height) (cairo-surface-size base density)) (define-values (flwidth flheight all) (let compose ([width min-width] [height min-height] [lla (list (vector base min-width min-height))] [children others]) (cond [(null? children) (values width height (reverse lla))] [else (let-values ([(child rest) (values (unsafe-car children) (unsafe-cdr children))]) (define-values (chwidth chheight) (cairo-surface-size child density)) (define ++ (unsafe-cons-list (vector child chwidth chheight) lla)) (case alignment [(vl vc vr) (compose (unsafe-flmax width chwidth) (unsafe-fl+ gapsize (unsafe-fl+ height chheight)) ++ rest)] [(ht hc hb) (compose (unsafe-fl+ gapsize (unsafe-fl+ width chwidth)) (unsafe-flmax height chheight) ++ rest)] [else #|unreachable|# (compose (unsafe-flmax width chwidth) (unsafe-flmax height chheight) ++ rest)]))]))) (define-values (bmp cr) (make-cairo-image flwidth flheight density #true)) (let combine ([all all] [maybe-used-x 0.0] [maybe-used-y 0.0]) (unless (null? all) (define child (unsafe-car all)) (define-values (chwidth chheight) (values (unsafe-vector*-ref child 1) (unsafe-vector*-ref child 2))) (define-values (dest-x dest-y) (case alignment [(vl) (values 0.0 maybe-used-y)] [(vc) (values (unsafe-fl* (unsafe-fl- flwidth chwidth) 0.5) maybe-used-y)] [(vr) (values (unsafe-fl- flwidth chwidth) maybe-used-y)] [(ht) (values maybe-used-x 0.0)] [(hc) (values maybe-used-x (unsafe-fl* (unsafe-fl- flheight chheight) 0.5))] [(hb) (values maybe-used-x (unsafe-fl- flheight chheight))] [else #|unreachable|# (values maybe-used-x maybe-used-y)])) (cairo-composite cr (unsafe-vector*-ref child 0) dest-x dest-y chwidth chheight CAIRO_FILTER_BILINEAR operator density #true) (combine (unsafe-cdr all) (unsafe-fl+ maybe-used-x (unsafe-fl+ chwidth gapsize)) (unsafe-fl+ maybe-used-y (unsafe-fl+ chheight gapsize))))) bmp) (define (bitmap_superimpose alignment operator sfcs density) (define-values (flwidth flheight layers) (let compose ([width 0.0] [height 0.0] [sreyal null] [sfcs sfcs]) (cond [(null? sfcs) (values width height (reverse sreyal))] [else (let ([sfc (unsafe-car sfcs)]) (define-values (w h) (cairo-surface-size sfc density)) (compose (unsafe-flmax width w) (unsafe-flmax height h) (unsafe-cons-list (cons sfc (make-layer alignment w h)) sreyal) (unsafe-cdr sfcs)))]))) (define-values (bmp cr) (make-cairo-image flwidth flheight density #true)) (let combine ([all layers]) (unless (null? all) (define layer (unsafe-car all)) (define-values (x y) ((unsafe-cdr layer) flwidth flheight)) (cairo-composite cr (unsafe-car layer) x y flwidth flheight CAIRO_FILTER_BILINEAR operator density #true) (combine (unsafe-cdr all)))) bmp) (define (bitmap_table sfcs ncols nrows col-aligns row-aligns col-gaps row-gaps density) (define alcols (list->n:vector col-aligns ncols)) (define alrows (list->n:vector row-aligns nrows)) (define gcols (list->n:vector (map real->double-flonum col-gaps) ncols)) (define grows (list->n:vector (map real->double-flonum row-gaps) nrows)) (define table (list->table sfcs nrows ncols density)) (define table-ref (λ [c r] (unsafe-vector*-ref table (unsafe-fx+ (unsafe-fx* r ncols) c)))) (define-values (pbcols pbrows) (values (for/vector ([c (in-range ncols)]) (superimpose* (unsafe-vector*-ref alcols c) (let ++ ([swor null] [r 0]) (cond [(unsafe-fx= r nrows) swor] [else (++ (unsafe-cons-list (table-ref c r) swor) (unsafe-fx+ r 1))])))) (for/vector ([r (in-range nrows)]) (superimpose* (unsafe-vector*-ref alrows r) (let ++ ([sloc null] [c 0]) (cond [(unsafe-fx= c ncols) sloc] [else (++ (unsafe-cons-list (table-ref c r) sloc) (unsafe-fx+ c 1))])))))) (unsafe-vector*-set! gcols (unsafe-fx- ncols 1) 0.0) (unsafe-vector*-set! grows (unsafe-fx- nrows 1) 0.0) (define-values (flwidth flheight) (let compose-row ([width 0.0] [height 0.0] [row 0]) (cond [(unsafe-fx= row nrows) (values width height)] [else (let ([pbrow (unsafe-vector*-ref pbrows row)]) (define hrow (unsafe-fl+ (unsafe-car (unsafe-cdr pbrow)) (unsafe-vector*-ref grows row))) (let compose-col ([xoff 0.0] [col 0]) (cond [(unsafe-fx= col ncols) (compose-row xoff (unsafe-fl+ height hrow) (unsafe-fx+ row 1))] [else (let ([cell (table-ref col row)]) (define pbcol (unsafe-vector*-ref pbcols col)) (define wcol (unsafe-fl+ (unsafe-car pbcol) (unsafe-vector*-ref gcols col))) (define-values (x y) (values (find-position cell pbcol 1) (find-position cell pbrow 2))) (unsafe-vector*-set! cell 1 (unsafe-fl+ x xoff)) (unsafe-vector*-set! cell 2 (unsafe-fl+ y height)) (compose-col (unsafe-fl+ xoff wcol) (unsafe-fx+ col 1)))])))]))) (define-values (bmp cr) (make-cairo-image flwidth flheight density #true)) (let combine ([idx (unsafe-fx- (unsafe-fx* ncols nrows) 1)]) (when (unsafe-fx>= idx 0) (define cell (unsafe-vector*-ref table idx)) (cairo-composite cr (unsafe-vector*-ref cell 0) (unsafe-vector*-ref cell 1) (unsafe-vector*-ref cell 2) flwidth flheight CAIRO_FILTER_BILINEAR CAIRO_OPERATOR_OVER density #true) (combine (unsafe-fx- idx 1)))) bmp) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define ((make-layer alignment w h) W H) (superimpose-position alignment W H w h)) (define (superimpose-position alignment width height w h) (define-values (rx by) (values (unsafe-fl- width w) (unsafe-fl- height h))) (define-values (cx cy) (values (unsafe-fl/ rx 2.0) (unsafe-fl/ by 2.0))) (case alignment [(lt) (values 0.0 0.0)] [(lc) (values 0.0 cy)] [(lb) (values 0.0 by)] [(ct) (values cx 0.0)] [(cc) (values cx cy)] [(cb) (values cx by)] [(rt) (values rx 0.0)] [(rc) (values rx cy)] [(rb) (values rx by)] [else #|unreachable|# (values 0.0 0.0)])) (define (superimpose* alignment sllec) (define-values (width height) (let compose ([width 0.0] [height 0.0] [rest sllec]) (cond [(null? rest) (values width height)] [else (let ([cell (unsafe-car rest)]) (compose (unsafe-flmax width (unsafe-vector*-ref cell 1)) (unsafe-flmax height (unsafe-vector*-ref cell 2)) (unsafe-cdr rest)))]))) (list width height (let locate ([cells null] [rest sllec]) (cond [(null? rest) cells] [else (let ([cell (unsafe-car rest)]) (define-values (w h) (values (unsafe-vector*-ref cell 1) (unsafe-vector*-ref cell 2))) (define-values (x y) (superimpose-position alignment width height w h)) (locate (unsafe-cons-list (vector cell x y) cells) (unsafe-cdr rest)))])))) (define (find-position sfc psfcs which) (let find ([rest (unsafe-list-ref psfcs 2)]) (cond [(null? rest) (values 0.0 0.0)] [else (let ([cell (unsafe-car rest)]) (if (eq? sfc (unsafe-vector*-ref cell 0)) (unsafe-vector*-ref cell which) (find (unsafe-cdr rest))))]))) (define (list->table sfcs nrows ncols density) (define cells (for/vector ([sfc (in-list sfcs)]) (define-values (w h) (cairo-surface-size sfc density)) (vector sfc w h))) (define diff (unsafe-fx- (unsafe-fx* nrows ncols) (unsafe-vector-length cells))) (cond [(unsafe-fx<= diff 0) cells] [else (let ([filling (vector the-surface 1.0 1.0)]) (vector-append cells (make-vector diff filling)))])) (define (list->n:vector src total) ; NOTE: (length src) is usually very small. (define count (length src)) (cond [(unsafe-fx= total count) (list->vector src)] [else (let ([supplement (unsafe-list-ref src (unsafe-fx- count 1))]) (list->vector (append src (make-list (unsafe-fx- total count) supplement))))]))) (unsafe-require/typed/provide (submod "." unsafe) [CAIRO_OPERATOR_OVER Integer] [bitmap_composite (-> Integer Bitmap-Surface Bitmap-Surface Flonum Flonum Flonum Bitmap)] [bitmap_pin (-> Integer Flonum Flonum Flonum Flonum Bitmap-Surface Bitmap-Surface Flonum Bitmap)] [bitmap_pin* (-> Integer Flonum Flonum Flonum Flonum Bitmap-Surface (Listof Bitmap-Surface) Flonum Bitmap)] [bitmap_append (-> Symbol Integer Bitmap-Surface (Listof Bitmap-Surface) Flonum Flonum Bitmap)] [bitmap_superimpose (-> Symbol Integer (Listof Bitmap-Surface) Flonum Bitmap)] [bitmap_table (-> (Listof Bitmap-Surface) Integer Integer (Listof Symbol) (Listof Symbol) (Listof Flonum) (Listof Flonum) Flonum Bitmap)])
false
f55d4b5fe12fdac4e1198b5ada394faec14e349d
6aa3ae88e6f9e25163ceaedf5bb580b2cb8669bb
/dialects/scheme48-tex2page.rkt
b8c4de41148be9cd13ed9f608f1a6ff860c63f2f
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
ds26gte/tex2page
fc0f4442a1718d0af9c2b6eaa03400e34f9e4242
66d04e93147b3e5dbf3774597217f79c4853ad0c
refs/heads/master
2023-01-11T20:58:49.827831
2023-01-05T16:43:48
2023-01-05T16:43:48
23,206,061
28
3
NOASSERTION
2022-12-20T07:22:23
2014-08-21T23:15:29
Racket
UTF-8
Racket
false
false
4,109
rkt
scheme48-tex2page.rkt
; last change: 2022-12-28 (scmxlate-insert ";The structures ; ;c-system-function ;extended-ports ;posix ; ;need to be open before you can run the code in this file ") (define *scheme-version* "Scheme 48") (define *int-corresp-to-nul* (- (char->integer #\a) 97)) (define (s48-int-to-char n) (integer->char (+ n *int-corresp-to-nul*))) (define (s48-char-to-int c) (- (char->integer c) *int-corresp-to-nul*)) (scmxlate-rename (char->integer s48-char-to-int) (integer->char s48-int-to-char) (substring subseq) ) (define (get-arg1 ) #f) (scmxlate-uncall require main ) (define-syntax when (lambda (e r c) `(if ,(cadr e) (begin ,@(cddr e))))) (define-syntax unless (lambda (e r c) `(if (not ,(cadr e)) (begin ,@(cddr e))))) (define-syntax fluid-let (lambda (e r c) (let ((xvxv (cadr e)) (ee (cddr e))) (let ((xx (map car xvxv)) (vv (map cadr xvxv)) (old-xx (map (lambda (xv) (string->symbol (string-append "%__" (symbol->string (car xv))))) xvxv)) (res '%_*_res)) `(let ,(map (lambda (old-x x) `(,old-x ,x)) old-xx xx) ,@(map (lambda (x v) `(set! ,x ,v)) xx vv) (let ((,res (begin ,@ee))) ,@(map (lambda (x old-x) `(set! ,x ,old-x)) xx old-xx) ,res)))))) ;(define-macro when ; (lambda (b . ee) ; `(if ,b (begin ,@ee)))) ; ;(define-macro unless ; (lambda (b . ee) ; `(if (not ,b) (begin ,@ee)))) ; ;(define-macro fluid-let ; (lambda (xvxv . ee) ; (let ((xx (map car xvxv)) ; (vv (map cadr xvxv)) ; (old-xx (map (lambda (xv) ; (string->symbol ; (string-append "%__" ; (symbol->string (car xv))))) xvxv)) ; (res '%_*_res)) ; `(let ,(map (lambda (old-x x) `(,old-x ,x)) old-xx xx) ; ,@(map (lambda (x v) ; `(set! ,x ,v)) xx vv) ; (let ((,res (begin ,@ee))) ; ,@(map (lambda (x old-x) `(set! ,x ,old-x)) xx old-xx) ; ,res))))) (define (list* . args) (let ((a (car args)) (d (cdr args))) (if (null? d) a (cons a (apply list* d))))) (define (reverse! s) (let loop ((s s) (r '())) (if (null? s) r (let ((d (cdr s))) (set-cdr! s r) (loop d s))))) (define (append! s1 s2) ;appends s1 and s2 destructively (s1 may be modified) (if (null? s1) s2 (let loop ((r1 s1)) (if (null? r1) (error 'append! s1 s2) (let ((r2 (cdr r1))) (if (null? r2) (begin (set-cdr! r1 s2) s1) (loop r2))))))) (define (ormap f s) ;Returns true if f is true of some elt in s (let loop ((s s)) (if (null? s) #f (or (f (car s)) (loop (cdr s)))))) (define (subseq s i . z) (let ((f (if (pair? z) (car z) (string-length s)))) (substring s i f))) (define (read-line i) (let ((c (peek-char i))) (if (eof-object? c) c (let loop ((r '())) (let ((c (read-char i))) (if (or (eof-object? c) (char=? c #\newline)) (list->string (reverse! r)) (loop (cons c r)))))))) (define (file-exists? f) (accessible? f (access-mode read))) (define (flush-output . z) #f) (define (call-with-input-string s p) (p (make-string-input-port s))) (define (file-or-directory-modify-seconds f) (time-seconds (file-info-last-modification (get-file-info f))) ;(file-info:mtime (file-info f)) ) '(define (seconds-to-human-time secs) (time->string (make-time secs))) (scmxlate-include "seconds-to-date.scm") (define (current-seconds ) #f) (define *tex2page-namespace* (scheme-report-environment 5)) (define (do-evalh s) (let ((f "./.evalh.scm")) (call-with-output-file f (lambda (o) (display s o))) (load f) (unlink f))) (scmxlate-include "temp-file.scm") (scmxlate-include "with-port.scm")
true
507aadf72a0125e868c24c156a54d89fc928cfe1
4dd19196602623d0db1f5aa2ac44eaeace198b4a
/Chapter3/3.48.rkt
aa41898dfd74c2d310f5f97f822f68e220658406
[]
no_license
Dibel/SICP
f7810b2c45aa955b8207e6cb126431d6f0ef48cb
abd27c0ed4bdaaa755eff01e78e5fb2a2ef8ee18
refs/heads/master
2020-06-05T16:38:00.957460
2014-12-02T15:20:40
2014-12-02T15:20:40
null
0
0
null
null
null
null
UTF-8
Racket
false
false
2,866
rkt
3.48.rkt
#lang scheme ; 原理解释 ; 书上所讲的死锁情况是由于在并行过程中,两个账户的串行化进程分别被保护导致的 ; 根据编号顺序进行交换的时候,总会先尝试保护编号较小的账户的串行化进程,那么即使 ; 另一个操作员同时尝试进行交换操作,也会因为无法申请到小编号账户的串行化进程而等 ; 待,从而避免了死锁 ; My code begins at Line 50 (require scheme/mpair) (define cdr mcdr) (define car mcar) (define set-cdr! set-mcdr!) (define set-car! set-mcar!) (define cons mcons) (define list mlist) (define pair? mpair?) (define list? mlist?) (define (make-mutex) (let ((cell (list false))) (define (the-mutex m) (cond ((eq? m 'acquire) (if (test-and-set! cell) (the-mutex 'acquire) (void))) ; retry ((eq? m 'release) (clear! cell)))) the-mutex)) (define (clear! cell) (set-car! cell false)) (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))) ; My code (define make-serial (let ((serial 0)) (lambda () (set! serial (+ serial 1)) serial))) (define (make-account-and-serializer balance) (let ((serial (make-serial))) (define (withdraw amount) (if (>= balance amount) (begin (set! balance (- balance amount)) balance) "Insufficient funds")) (define (deposit amount) (set! balance (+ balance amount)) balance) (let ((balance-serializer (make-serializer))) (define (dispatch m) (cond ((eq? m 'withdraw) withdraw) ((eq? m 'deposit) deposit) ((eq? m 'balance) balance) ((eq? m 'serial) serial) ((eq? m 'serializer) balance-serializer) (else (error "Unknown request -- MAKE-ACCOUNT" m)))) dispatch))) (define (exchange account1 account2) (let ((difference (- (account1 'balance) (account2 'balance)))) ((account1 'withdraw) difference) ((account2 'deposit) difference))) (define (serialized-exchange a1 a2) (define (iter account1 account2) (let ((serializer1 (account1 'serializer))) (let ((serializer2 (account2 'serializer))) ((serializer1 (serializer2 exchange)) account1 account2)))) (if (< (a1 'serial) (a2 'serial)) (iter a1 a2) (iter a2 a1))) ; For test (define x (make-account-and-serializer 100)) (define y (make-account-and-serializer 200)) (y 'serial) (x 'serial) (serialized-exchange x y) (y 'balance) (x 'balance)
false
46c5a08b043fe24277aff25aa1f104ce147e79c8
310fec8271b09a726e9b4e5e3c0d7de0e63b620d
/test.rkt
5b593e7794d5d2e35b9da552c2dff18571fea23a
[ "Apache-2.0", "MIT" ]
permissive
thoughtstem/badge-bot
b649f845cdc4bf62ca6bd838f57353f8e508f1ae
e535eefac26f15061c412fd0eb5b7adee158a0bf
refs/heads/master
2022-12-14T21:55:00.173686
2020-09-21T19:54:15
2020-09-21T19:54:15
265,321,144
0
0
null
null
null
null
UTF-8
Racket
false
false
499
rkt
test.rkt
#lang racket (require discord-bot mc-discord-config) (module+ main (define rid "412679210310828033") (define cmd "test") (send-message-on-channel "715315491102785666" (if (user-has-role-on-server? rid mc-badge-checker-role-id mc-server-id) (~a "Because a <@!" mc-badge-checker-role-id "> emojified a \\`! submit\\` message a few moments ago. I ran \\`" cmd "\\` internally." ) (~a "You must have the <@!" mc-badge-checker-role-id "> role to award badges"))))
false
8a6eb2ac3fcc3304f2a8d7ff0ab6de358173b73c
c86a68a8b8664e6def1e072448516b13d62432c2
/markdown/html.rkt
60f1c9d9f4957e6a141c04d15c11df8c558b9cbd
[ "BSD-2-Clause", "BSD-3-Clause" ]
permissive
greghendershott/markdown
97e9317aed13bfc7d48f9c88ca9b726774d7911d
34ada7458fad51d3a5e0516352f8bd399c517140
refs/heads/master
2022-12-05T13:35:32.353364
2022-11-25T18:06:09
2022-11-25T18:09:38
8,568,669
89
27
null
2021-03-25T14:21:20
2013-03-05T00:42:54
Racket
UTF-8
Racket
false
false
22,208
rkt
html.rkt
;; Copyright (c) 2013-2022 by Greg Hendershott. ;; SPDX-License-Identifier: BSD-2-Clause #lang racket/base (require (for-syntax racket/base) racket/format racket/match racket/set "entity.rkt" "parsack.rkt") ;; Note: I would have loved to reuse the work of Racket's ;; read-html-as-xml or the html-parsing package. It's possible to ;; jerry-rig them into a Parsack-style parser -- I tried. However both ;; of those presume you want to parse elements, plural. I need ;; something that parses AT MOST one element, then stops. Anyway, ;; Parsack is pleasant to use, so we'll use that here, too. (provide (rename-out [$element $html-element] [$block-element $html-block-element] [$not-block-element $html-not-block-element] [$inline-element $html-inline-element] [$comment $html-comment] [$document $html-document])) (module+ test (require rackunit) ;; Some syntax to make tests more concise. ;; Slightly complicated only because want correct srcloc for fail msgs. (define-syntax (with-parser stx) (syntax-case stx () [(_ parser [input expected] ...) #'(begin (ce parser input expected) ...)])) (define-syntax (ce stx) (syntax-case stx () [(_ parser input expected) (syntax/loc #'input ;this has the desired srcloc (check-equal? (parse-result parser input) expected))]))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define space-chars " \t") (define $space-char (<?> (oneOf space-chars) "space or tab")) (define $sp (<?> (many $space-char) "zero or more spaces or tabs")) (define $spnl (<?> (pdo $sp (optional (char #\return)) (optional $newline) $sp (return null)) "zero or more spaces, and optional newline plus zero or more spaces")) (define (quoted c) (try (>>= (between (char c) (char c) (many (noneOf (make-string 1 c)))) (compose1 return list->string)))) (define $single-quoted (quoted #\')) (define $double-quoted (quoted #\")) (define $quoted (<or> $single-quoted $double-quoted)) ;; Parsack's <or> disallows zero elements, and `choice` uses it. So: (define choice* (match-lambda [(list) $err] [(list xs ...) (choice xs)])) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define list->symbol (compose1 string->symbol list->string)) (define list->tagsym (compose1 string->symbol string-downcase list->string)) (define $attribute (<?> (try (pdo $spnl (key <- (>>= (many1 (noneOf "=>/\n\t ")) (compose1 return list->symbol))) (val <- (option (symbol->string key) (try (pdo $spnl (char #\=) $spnl (<or> $quoted (>>= (many1 (noneOf ">/\n\t ")) (compose1 return list->string))))))) $spnl (return (list key val)))) "attribute")) (module+ test (with-parser $attribute [" k " '(k "k")] [" k = 1" '(k "1")] [" k = '1'" '(k "1")] [" k = \"1\"" '(k "1")])) (define (open-tag* name-parser end-parser msg) (<?> (try (pdo (char #\<) (notFollowedBy (char #\/)) (name <- name-parser) (attribs <- (<or> (try (pdo $spnl end-parser (return '()))) (pdo $space (many1Till $attribute end-parser)))) (return (list (list->tagsym name) attribs)))) msg)) (define $any-open-tag (open-tag* (many1 (noneOf " />\n")) (char #\>) "any open tag")) (define (open-tag name) (open-tag* (stringAnyCase (~a name)) (char #\>) (format "<~a>" name))) (define $any-void-tag (open-tag* (many1 (noneOf " />\n")) (string "/>") "any void tag")) (define (void-tag name) (open-tag* (stringAnyCase (~a name)) (string "/>") (format "<~a/>" name))) (define $any-open-or-void-tag (<or> $any-open-tag $any-void-tag)) (module+ test (with-parser $any-open-tag ["<foo>" '(foo ())] ["<foo a = 1 b>" '(foo ([a "1"][b "b"]))] ["<foo a='1' b='2'>" '(foo ([a "1"][b "2"]))] ["<foo a=1 b=2>" '(foo ([a "1"][b "2"]))] ["<p><i b=2></i></p>" '(p ())])) (module+ test (with-parser (open-tag 'foo) ["<foo>" '(foo ())] ["<foo a = 1 b>" '(foo ([a "1"][b "b"]))] ["<foo a='1' b='2'>" '(foo ([a "1"][b "2"]))] ["<foo a=1 b=2>" '(foo ([a "1"][b "2"]))]) (check-exn exn:fail? (lambda () (parse-result (open-tag 'p) "<pre>")))) (module+ test (with-parser $any-void-tag ["<foo/>" '(foo ())] ["<foo />" '(foo ())] ["<foo a = 1 b/>" '(foo ([a "1"][b "b"]))] ["<foo a = 1 b />" '(foo ([a "1"][b "b"]))] ["<foo a='1' b='2'/>" '(foo ([a "1"][b "2"]))] ["<foo a='1' b='2' />" '(foo ([a "1"][b "2"]))] ["<foo a=1 b=2/>" '(foo ([a "1"][b "2"]))] ["<foo a=1 b=2 />" '(foo ([a "1"][b "2"]))])) (module+ test (with-parser (void-tag 'foo) ["<foo/>" '(foo ())] ["<foo />" '(foo ())] ["<foo a = 1 b/>" '(foo ([a "1"][b "b"]))] ["<foo a = 1 b />" '(foo ([a "1"][b "b"]))] ["<foo a='1' b='2'/>" '(foo ([a "1"][b "2"]))] ["<foo a='1' b='2' />" '(foo ([a "1"][b "2"]))] ["<foo a=1 b=2/>" '(foo ([a "1"][b "2"]))] ["<foo a=1 b=2 />" '(foo ([a "1"][b "2"]))])) (define (close-tag* name-parser msg) (<?> (try (pdo (char #\<) (char #\/) $spnl (name <- name-parser) $spnl (char #\>) (return (list->tagsym name)))) msg)) (define $any-close-tag (close-tag* (many1 (noneOf " >\n")) "any close tag")) (define (close-tag name) (close-tag* (stringAnyCase (~a name)) (format "</~a>" name))) (module+ test (with-parser $any-close-tag ["</foo>" 'foo] ["</FOO>" 'foo] ["</foo >" 'foo])) (module+ test (with-parser (close-tag 'foo) ["</foo>" 'foo] ["</FOO>" 'foo] ["</foo >" 'foo]) (check-exn exn:fail? (lambda () (parse-result (close-tag 'foo) "</bar>")))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define (element name) (try (pdo (open <- (open-tag name)) $spnl ;; eat leading ws; $content must handle trailing (xs <- (manyTill $content (close-tag name))) (return (append open xs))))) (define $other-element (try (pdo (open <- $any-open-tag) (name <- (return (car open))) $spnl ;; eat leading ws; $content must handle trailing (xs <- (manyTill $content (close-tag name))) (return (append open xs))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define $junk (<?> (>> (many1 (oneOf " \r\n\r")) (return "")) "whitespace between elements")) ;; Some elements have no content, and we will accept any of: ;; 1. <img .../> ;; 2. <img></img> ;; 3. <img ...> (define (empty name) (<or> (void-tag name) ;1 (try (pdo (open <- (open-tag name)) ;2 (optional $junk) (close-tag name) (return open))) (open-tag name))) ;2 (define $empty (choice (map empty '(area base br col command embed hr img input keygen link meta param source track wbr)))) (module+ test (let ([hr '(hr ())] [hr/a '(hr ([a "1"]))]) (with-parser $empty ["<hr>" hr] ["<hr/>" hr] ["<hr />" hr] ["<hr></hr>" hr] ["<hr a=1>" hr/a] ["<hr a=1/>" hr/a] ["<hr a=1 />" hr/a] ["<hr a=1></hr>" hr/a]))) ;; Some elements may be ended by any of the following: ;; 1. A close tag, as usual. e.g. </li> ;; 2. Another open tag of the same e.g. <li> or other (see <p>). ;; 3. A parent end tag. e.g. </ul> or </ol> ;; ;; http://www.w3.org/html/wg/drafts/html/master/syntax.html#syntax-tag-omission (define (flexi name starters closers) (try (pdo (open <- (open-tag name)) $spnl ;; eat leading ws; $content must handle trailing (xs <- (manyUntil $content (<or> (close-tag name) (lookAhead (<or> (choice* (map open-tag starters)) (choice* (map close-tag closers))))))) (return (append open xs))))) ;; It's a common mistake to do e.g. <p><blockquote></blockquote></p> ;; or <p><pre></pre></p> and so on. For such a mistake, let's do ;; parse it that way if possible.[1] Only if that doesn't parse, let's ;; use the HTML optional close tag rules: ;; ;; "A p element's end tag may be omitted if the p element is ;; immediately followed by an address, article, aside, blockquote, ;; div, dl, fieldset, footer, form, h1, h2, h3, h4, h5, h6, header, ;; hgroup, hr, main, menu, nav, ol, p, pre, section, table, or ul, ;; element, or if there is no more content in the parent element and ;; the parent element is not an a element." (define $p (<or> (element 'p) ;[1] (flexi 'p '(address article aside blockquote div dl fieldset footer form h1 h2 h3 h4 h5 h6 header hgroup hr main menu nav ol p pre section table ul) '(div td)))) (module+ test (with-parser $p ["<p>foo</p>" '(p () "foo")] ["<p>foo<p>" '(p () "foo")] ["<p>foo<p>bar</p>" '(p () "foo")] ["<p>foo<h1>" '(p () "foo")] ["<p>foo</div>" '(p () "foo")] ["<p>foo</td>" '(p () "foo")] ["<p><blockquote>foo</blockquote></p>" '(p () (blockquote () "foo"))] ["<p>foo<blockquote>" '(p () "foo")])) (module+ test (with-parser (many $content) ["<p>foo</p>" '((p () "foo"))] ["<p>foo<p>bar</p>" '((p () "foo") (p () "bar"))] ["<p>foo<h1>bar</h1>" '((p () "foo") (h1 () "bar"))] ["<div><p>foo</div>" '((div () (p () "foo")))] ["<td><p>foo</td>" '((td () (p () "foo")))] ["<p><blockquote>foo</blockquote></p>" '((p () (blockquote () "foo")))] ["<p>foo<blockquote>bar</blockquote>" '((p () "foo") (blockquote () "bar"))])) ;; A thead element's end tag may be omitted if the thead element is ;; immediately followed by a tbody or tfoot element. (define $thead (flexi 'thead '(tbody tfoot) '(table))) ;; A tfoot element's end tag may be omitted if the tfoot element is ;; immediately followed by a tbody element, or if there is no more ;; content in the parent element. (define $tfoot (flexi 'tfoot '(tbody) '(table))) ;; A tr element's end tag may be omitted if the tr element is ;; immediately followed by another tr element, or if there is no more ;; content in the parent element. (define $tr (flexi 'tr '(tr) '(table))) ;; A td element's end tag may be omitted if the td element is ;; immediately followed by a td or th element, or if there is no more ;; content in the parent element. (define $td (flexi 'td '(td th) '(tr table))) ;; A th element's end tag may be omitted if the th element is ;; immediately followed by a td or th element, or if there is no more ;; content in the parent element. (define $th (flexi 'th '(td th) '(tr table))) ;; A tbody element's start tag may be omitted if the first thing ;; inside the tbody element is a tr element, and if the element is not ;; immediately preceded by a tbody, thead, or tfoot element whose end ;; tag has been omitted. (It can't be omitted if the element is ;; empty.) (define $tbody ;; This doesn't attempt to fully implement the above description. (<or> (element 'tbody) $tr)) (module+ test (with-parser $tbody ["<tbody>foo</tbody>" '(tbody () "foo")] ["<tr>foo</tr>" '(tr () "foo")])) ;; Some elements may only contain certain other elements (directly). (define (only-kids name kids) (try (pdo (open <- (open-tag name)) $spnl ;; eat leading ws; $content must handle trailing (xs <- (manyTill (choice* kids) (close-tag name))) (return (append open xs))))) (define $li (flexi 'li '(li) '(ol ul))) (define $ul (only-kids 'ul (list $li $junk))) (define $ol (only-kids 'ol (list $li $junk))) (define $table (only-kids 'table (list $thead $tbody $tfoot $tr $junk))) (define $comment (<?> (try (pdo (string "<!--") (xs <- (many1Till $anyChar (try (string "-->")))) (return `(!HTML-COMMENT () ,(list->string xs))))) "<!-- comment -->")) (define (plain-body tag) (<?> (try (pdo (open <- (open-tag tag)) (cs <- (manyTill $anyChar (close-tag tag))) (return (append open (list (list->string cs)))))) "<pre> or <style> or <script>")) (define $pre (plain-body 'pre)) (define $style (plain-body 'style)) (define $script (plain-body 'script)) (module+ test (with-parser $pre ["<pre>One\nTwo\nThree</pre>" '(pre () "One\nTwo\nThree")])) (module+ test (with-parser $script ["<script>\nif 1 < 2; // <foo>\n</script>" '(script () "\nif 1 < 2; // <foo>\n")])) (module+ test (with-parser $style ["<style>\ncls {key: value;} /* <foo> */\n</style>" '(style () "\ncls {key: value;} /* <foo> */\n")])) (define $summary (element 'summary)) (define $details (<?> (try (pdo (open <- (open-tag 'details)) $spnl ;; eat leading ws (?summary <- (option #f $summary)) (summary <- (return (if ?summary (list ?summary) '()))) (cs <- (manyTill $anyChar (close-tag 'details))) (return (append open summary (list (list->string cs)))))) "<details> element with optional <summary>")) (module+ test (with-parser $details ["<details><summary>Hi</summary>blah blah blah</details>" '(details () (summary () "Hi") "blah blah blah")] ["<details>blah blah blah</details>" '(details () "blah blah blah")])) ;; Pragmatic: HTML from LiveJournal blog posts has <lj-cut> ;; tags. Convert the open tag to <!-- more --> and discard the close ;; tag. (define $lj-cut (<or> (pdo (open-tag 'lj-cut) (return `(!HTML-COMMENT () " more"))) (pdo (close-tag 'lj-cut) (return `(SPLICE ""))))) (module+ test (with-parser $lj-cut ["<lj-cut a='adasasf'>" '(!HTML-COMMENT () " more")] ["</lj-cut>" '(SPLICE "")])) (define $lj (pdo (open-tag 'lj) (return '(SPLICE "")))) (define $die-die-die (<or> $lj-cut $lj)) ;; Pragmatic: Handle a common mistake of the form <x><y>foo</x></y> (define $transposed-close-tags (try (pdo (open0 <- $any-open-tag) (open1 <- $any-open-tag) (xs <- (manyTill $content (close-tag (car open0)))) (close-tag (car open1)) (return (append open0 (list (append open1 xs))))))) ;; Pragmatic (define $orphan-open-tag (>> $any-open-tag (return '(SPLICE "")))) ;; Pragmatic (define $orphan-close-tag (>> $any-close-tag (return '(SPLICE "")))) ;; The strategy here is to define parsers for some specific known ;; elements with special rules, and handle "all other" elements with ;; the "generic" parsers `$any-void-tag` and `$other-element`. ;; ;; Note that some specific element parsers aren't in this list ;; directly. Prime exammple: $table uses quite a few parsers for child ;; elements, which don't _need_ to be here. (And _shouldn't_ be here, ;; unless we were trying to be an extremely tolerant/pragmatic HTML ;; parser like `html-parsing`. But different motivation for this ;; parser.) (define $element (>> (lookAhead (char #\<)) ;;optimization (<or> $p $ul $ol $pre $script $style $details $empty $comment $table $die-die-die $transposed-close-tags $any-void-tag $other-element $orphan-close-tag $orphan-open-tag))) (define $elements (many (<or> $element $junk))) (define $block-element (<?> (>> (lookAhead (char #\<)) ;;optimization (<or> $comment $die-die-die (pdo (open <- (lookAhead $any-open-or-void-tag)) (cond [(set-member? block-elements (car open)) $element] [else $err])))) "block element")) ;; In some cases (such as parsing markdown), the desired concept isn't ;; "inline" so much as it is "not block". For example, this will parse ;; any elements that we don't specifically know about (not in either ;; of the block nor inline sets). Ergo this: (define $not-block-element (<?> (>> (lookAhead (char #\<)) ;;optimization (<or> $comment $die-die-die (pdo (open <- (lookAhead $any-open-or-void-tag)) (cond [(or (not (set-member? block-elements (car open))) (set-member? inline-elements (car open))) $element] [else $err])))) "not block element")) (define $inline-element (<?> (<or> $comment $die-die-die (pdo (open <- (lookAhead $any-open-or-void-tag)) (cond [(set-member? inline-elements (car open)) $element] [else $err]))) "inline element")) (module+ test (check-equal? (parse-result $block-element "<p>foo</p>") '(p () "foo")) (check-exn exn:fail? (lambda () (parse-result $block-element "<i>foo</i>"))) (check-equal? (parse-result $inline-element "<i>foo</i>") '(i () "foo")) (check-exn exn:fail? (lambda () (parse-result $inline-element "<p>foo</p>")))) (define block-elements (apply seteq '(!HTML-COMMENT address applet article blockquote body ; ~= block; useful for markdown br button canvas center del details dir div dl fieldset figcaption figure footer form h1 h2 h3 h4 h5 h6 head ; ~= block; useful for markdown header hgroup hr html ; ~= block; useful for markdown iframe ins isindex map menu noframes noscript object ol output p pre progress script section table ul video))) (define inline-elements (apply seteq '(!HTML-COMMENT a abbr address applet area audio b bm button cite code del dfn command datalist em font i iframe img input ins kbd label legend link map mark meter nav object optgroup option q script select small source span strike strong sub summary sup tbody td time var))) ;; Pragmatic: Allow "< " not just "&lt; " (define $lt-followed-by-space (try (pdo-one (~> (char #\<)) (lookAhead (char #\space))))) (define $text (<?> (pdo (cs <- (many1 (<or> (noneOf "<& \n\r") $lt-followed-by-space))) (return (list->string cs))) "normal char")) (define $whitespace (>> (many1 (oneOf " \n\r")) (<or> (pdo (lookAhead $any-close-tag) (return "")) (return " ")))) (define $content (<?> (<or> $whitespace $entity $text $element) "content")) (module+ test (with-parser (many $content) ["The lazy brown fox" '("The" " " "lazy" " " "brown" " " "fox")] ["&quot;" '(quot)] ["A &quot;" '("A" " " quot)] ["A&P" '("A" "&" "P")])) (module+ test (with-parser $element ["<ul>\n <li>0</li>\n<li>1<li>2</ul>" '(ul () (li () "0") "" (li () "1") (li () "2"))] ["<div><p>0<p>1</div>" '(div () (p () "0") (p () "1"))] ["<p><pre>x</pre></p>" '(p () (pre () "x"))])) (define $xml (try (pdo (string "<?") (cs <- (manyTill $anyChar (string "?>"))) (return (list->string cs))))) (define $doctype (try (pdo (stringAnyCase "<!DOCTYPE") $sp (cs <- (many1Till $anyChar (char #\>))) (return (list->string cs))))) (define $document (pdo (many $junk) (optional $xml) (many $junk) (optional $doctype) (many $junk) (open <- (open-tag 'html)) (many $junk) (head <- (option #f (element 'head))) (many $junk) (body <- (option #f (element 'body))) (many $junk) (close-tag 'html) (many $junk) $eof (return (append open (if head (list head) '()) (if body (list body) '()))))) (module+ test (with-parser $document ["<html></html>" '(html ())] ["<html><head>yo</head></html>" '(html () (head () "yo"))] ["<html><body>yo</body></html>" '(html () (body () "yo"))] ["<html><head>yo</head><body>yo</body></html>" '(html () (head () "yo") (body () "yo"))]))
true
82d7a1012e7e3978b2d69b1fd502521b2c0aca6b
ba5e83653b21a43d958542f4a9a4f838a1f76b7a
/src/languages.rkt
acf5adbc4de9a1392f391e23902b5ad101c7f74d
[]
no_license
hakandingenc/CPCF
2b56bccc384d391135701a9b1f24ea2e80274166
29a4abe4b0fdeb644dcd6de6a06c5a783489ff33
refs/heads/master
2020-05-31T16:15:30.282696
2019-09-12T19:45:43
2019-09-12T19:45:43
190,377,426
3
0
null
null
null
null
UTF-8
Racket
false
false
1,963
rkt
languages.rkt
#lang racket (provide PCF source CPCF CPCF-I CPCF-O CPCF-IO CPCF-O-Γ CPCF-IO-Γ CPCF-O-Δ CPCF-IO-Δ CPCF-O-ΓΔ CPCF-IO-ΓΔ) (require redex) (define-language PCF [e v x (e e) (μ (x : t) e) (op e e) (zero? e) (if e e e)] [v c (λ (x : t) e)] [c n b] [n integer] [b boolean] [t o (-> t t) (con t)] [o I B] [op op1 op2] [op1 + -] [op2 and or] [(x y f) variable-not-otherwise-mentioned] [E hole (E e) (v E) (op E e) (op v E) (zero? E) (if E e e)] #:binding-forms (λ (x : t) e #:refers-to x) (μ (x : t) e #:refers-to x)) (define-extended-language PCF-κ PCF [κ flat-κ ->-κ ->d-κ] [flat-κ (flat e)] [->-κ (-> κ κ)] [->d-κ (->d κ (λ (x : t) κ))] #:binding-forms (λ (x : t) κ #:refers-to x)) (define-extended-language CPCF PCF-κ [e .... (mon (l l l) κ e)] [(j k l) string] [E .... (mon (l l l) κ E)]) (define-extended-language CPCF-I CPCF [e .... (error l l) (check (l l) e v)] [E .... (check (l l) E v)]) (define-extended-language CPCF-O CPCF [e .... (own e l)] [v .... (own v l)] [flat-κ (flat-ob e (l ...))] [E .... (own E l)]) (define-union-language CPCF-IO CPCF-I CPCF-O) (define-extended-language source PCF-κ [p (let* ([x_!_ κ e] ...) e)] #:binding-forms (let* ([x κ e_x] #:...bind (clauses x (shadow clauses x))) e_body #:refers-to clauses)) (define-extended-language CPCF-O-Γ CPCF-O [Γ ∘ (Γ ∪ x : l)]) (define-extended-language CPCF-O-Δ CPCF-O [Δ ∘ (Δ ∪ x : t)]) (define-union-language CPCF-IO-Γ CPCF-I CPCF-O-Γ) (define-union-language CPCF-IO-Δ CPCF-I CPCF-O-Δ) (define-union-language CPCF-O-ΓΔ CPCF-O-Γ CPCF-O-Δ) (define-union-language CPCF-IO-ΓΔ CPCF-I CPCF-O-ΓΔ)
false
71bdd1cd986486fc9af9979933114a1b27a6d043
b232a8795fbc2176ab45eb3393f44a91112702f7
/typed/rosette/vector.rkt
e84e0a9e182463b36bf615f983a1a5985bb5623e
[]
no_license
ilya-klyuchnikov/typed-rosette
9845b2fcd8b203749bb3469dea4f70f8cf05c368
d72d4e7aad2c339fdd49c70682d56f83ab3eae3d
refs/heads/master
2021-09-20T08:25:13.996681
2018-08-06T17:58:30
2018-08-06T17:58:30
null
0
0
null
null
null
null
UTF-8
Racket
false
false
5,283
rkt
vector.rkt
#lang turnstile (require typed/rosette/types (prefix-in ro: rosette) (postfix-in - rosette)) ;; ------------------------------------------------------------------------ (provide (typed-out [vector? : LiftedPred])) (provide vector vector-immutable make-vector make-immutable-vector build-vector build-immutable-vector vector-length vector-ref vector-set! vector->list list->vector) ;; mutable constructor (define-typed-syntax vector [(_ e:expr ...) ≫ [⊢ e ≫ e- ⇒ τ] ... -------- [⊢ (ro:vector e- ...) ⇒ #,(if (stx-andmap concrete? #'(τ ...)) #'(CMVectorof (CU τ ...)) #'(CMVectorof (U τ ...)))]]) ;; immutable constructor (define-typed-syntax vector-immutable [(_ e:expr ...) ≫ [⊢ e ≫ e- ⇒ τ] ... -------- [⊢ (ro:vector-immutable e- ...) ⇒ #,(if (stx-andmap concrete? #'(τ ...)) #'(CIVectorof (CU τ ...)) #'(CIVectorof (U τ ...)))]]) (define-typed-syntax vector-ref [(_ v:expr i:expr) ≫ [⊢ [v ≫ v- ⇒ : (~or (~CMVectorof τ) (~CIVectorof τ))]] [⊢ [i ≫ i- ⇐ : CInt]] -------- [⊢ (ro:vector-ref v- i-) ⇒ : τ]] [(_ v:expr i:expr) ≫ [⊢ [v ≫ v- ⇒ : (~or (~CMVectorof τ) (~CIVectorof τ))]] [⊢ [i ≫ i- ⇐ : Int]] -------- [⊢ (ro:vector-ref v- i-) ⇒ : #,(type-merge #'τ #'τ)]] [(_ v:expr i:expr) ≫ [⊢ [v ≫ v- ⇒ : (~U* (~and (~or (~CMVectorof τ) (~CIVectorof τ))) ...)]] [⊢ [i ≫ i- ⇐ : Int]] -------- [⊢ (ro:vector-ref v- i-) ⇒ : #,(type-merge* #'[τ ...])]] [(_ v:expr i:expr) ≫ [⊢ [v ≫ v- ⇒ : (~CU* (~and (~or (~CMVectorof τ) (~CIVectorof τ))) ...)]] [⊢ [i ≫ i- ⇐ : Int]] -------- [⊢ (ro:vector-ref v- i-) ⇒ : #,(type-merge* #'[τ ...])]]) (define-typed-syntax vector-length [(_ e) ≫ [⊢ e ≫ e- ⇒ (~or (~CMVectorof _) (~CIVectorof _))] -------- [⊢ (ro:vector-length e-) ⇒ CNat]] [(_ e) ≫ [⊢ e ≫ e- ⇒ (~U* (~and (~or (~CMVectorof τ) (~CIVectorof τ))) ...)] -------- [⊢ (ro:vector-length e-) ⇒ Nat]]) (define-typed-syntax vector-set! [(_ v:expr i:expr x:expr) ≫ [⊢ v ≫ v- ⇒ (~CMVectorof ~! τ)] #:fail-when (no-mutate/ty? #'τ) (no-mut-msg "vector elements") [⊢ i ≫ i- ⇐ Int] [⊢ x ≫ x- ⇐ τ] -------- [⊢ (ro:vector-set! v- i- x-) ⇒ CUnit]] [(_ v:expr i:expr x:expr) ≫ [⊢ v ≫ v- ⇒ (~CU* (~and (~or (~CMVectorof τ) (~CIVectorof τ))) ...)] #:fail-when (stx-ormap no-mutate/ty? #'(τ ...)) (no-mut-msg "vector elements") [⊢ i ≫ i- ⇐ Int] [⊢ x ≫ x- ⇐ (U τ ...)] ; #:when (stx-andmap (lambda (t) (typecheck? #'τ_x t)) #'(τ ...)) -------- [⊢ (ro:vector-set! v- i- x-) ⇒ CUnit]]) ;; ------------------------------------------------------------------------ (define-typed-syntax vector->list [(_ v:expr) ≫ [⊢ v ≫ v- ⇒ (~or (~CMVectorof τ) (~CIVectorof τ))] -------- [⊢ (ro:vector->list v-) ⇒ (CListof τ)]]) ;; TODO: add CList case? ;; returne mutable vector (define-typed-syntax list->vector [_:id ≫ ;; TODO: use polymorphism -------- [⊢ ro:list->vector ⇒ : (Ccase-> (C→ (CListof Any) (CMVectorof Any)) (C→ (Listof Any) (MVectorof Any)))]] [(_ e) ≫ [⊢ [e ≫ e- ⇒ : (~CListof τ)]] -------- [⊢ (ro:list->vector e-) ⇒ : (CMVectorof #,(if (concrete? #'τ) #'(U τ) #'τ))]] [(_ e) ≫ [⊢ [e ≫ e- ⇒ : (~U* (~CListof τ) ...)]] #:with [τ* ...] (stx-map (λ (τ) (if (concrete? τ) #`(U #,τ) τ)) #'[τ ...]) -------- [⊢ (ro:list->vector e-) ⇒ : (U (CMVectorof τ*) ...)]] [(_ e) ≫ [⊢ [e ≫ e- ⇒ : (~CList τ ...)]] -------- [⊢ (ro:list->vector e-) ⇒ : (CMVectorof (U τ ...))]] [(_ e) ≫ [⊢ [e ≫ e- ⇒ : (~U* (~CList τ ...) ...)]] -------- [⊢ (ro:list->vector e-) ⇒ : (U (CMVector (U τ ...)) ...)]]) ;; ------------------------------------------------------------------------ ;; not in rosette/safe (define-typed-syntax make-vector [(_ size:expr v:expr) ≫ [⊢ size ≫ size- ⇐ CNat] [⊢ v ≫ v- ⇒ τ] -------- [⊢ (ro:make-vector size- v-) ⇒ #,(syntax/loc this-syntax (CMVectorof τ))]]) ;; programmer cannot manually do (vector->immutable-vector (make-vector ...)) ;; bc there might be an intermediate mutable vector with non-symbolic elements (define-typed-syntax make-immutable-vector [(_ n v) ≫ [⊢ n ≫ n- ⇐ CNat] [⊢ v ≫ v- ⇒ τ] -------- [⊢ (vector->immutable-vector- (make-vector- n- v-)) ⇒ (CIVectorof τ)]]) (define-typed-syntax build-vector [(_ n f) ≫ [⊢ n ≫ n- ⇐ CNat] [⊢ f ≫ f- ⇒ (~C→ CNat τ_out)] -------- [⊢ (build-vector- n- f-) ⇒ #,(syntax/loc this-syntax (CMVectorof τ_out))]]) (define-typed-syntax build-immutable-vector [(_ n f) ≫ [⊢ n ≫ n- ⇐ CNat] [⊢ f ≫ f- ⇒ (~C→ CNat τ_out)] -------- [⊢ (vector->immutable-vector- (build-vector- n- f-)) ⇒ (CIVectorof τ_out)]])
false
53aa937dee3cbb89310d16c6b301b23cbe77ce71
b9eb119317d72a6742dce6db5be8c1f78c7275ad
/ciphersaber/misc.rkt
c79c0ff44cd63ec5f186bb9dec5fc75bf3ec0a97
[]
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
911
rkt
misc.rkt
#lang racket ;; Stolen from ;; .../planet/300/5.0.1.900/cache/soegaard/math.plt/1/4/number-theory.ss (define (digits n [base 10]) (define (d x) (if (< x base) (list x) (cons (remainder x base) (d (quotient x base))))) (unless (integer? n) (error 'digits "expected an integer, got: n")) (reverse (d (if (negative? n) (- n) n)))) (provide integers->hex) (define (integers->hex ints) (apply string-append (map (lambda (i) (leading-zero (number->string i 16))) ints))) (provide hex->integers) (define (hex->integers s) (digits (string->number s 16) 256)) (provide leading-zero) (define (leading-zero string) (if (= 1 (string-length string)) (string-append "0" string) string)) (provide for-ever) (define-syntax-rule (for-ever body ...) (let loop () body ... (loop))) (provide m+) (define (m+ . numbers) (modulo (apply + numbers) 256))
true
84a510e107dab35fec2e753f22a419bdcb598c9c
3c742a640cdc7ab489e92cc85d31c1e5e693679b
/GUI.rkt
cd8439915c4adec983448e43a2dc5c0bd374f228
[]
no_license
AnshKhurana/CorRacketify
a6f3bda5cbf317e571dac2064d9e730350a2a959
412ec21821c330118e4341b7843788847db03f1c
refs/heads/master
2021-11-25T01:31:00.867340
2021-11-14T19:17:25
2021-11-14T19:17:25
130,190,179
0
0
null
null
null
null
UTF-8
Racket
false
false
3,177
rkt
GUI.rkt
#lang racket ;;;;;;;;;;;;;;;;;;GUI;;;;;;;;;;;;;;;;;;; (define (func) (define temp (send input get-value)) (define ans (print-solution temp)) (send output set-value ans) (define inc (incorrect-list temp)) (send incorrect-words update-choices inc)) (define mainframe (new frame% [label "CorRacketify"] [width 800] [height 800] [enabled #t] [border 5])) (send mainframe show #t) (define panel1 (new horizontal-panel% [parent mainframe])) (define input (new text-field% [parent panel1] [label "Enter Your Text Here"] [min-height 100] [style (list 'multiple)] [vert-margin 0])) (define correct-button(new button% [label "Correct It!"] [parent panel1] [callback (lambda (x y) (func))] )) (define panel2 (new horizontal-panel% [parent mainframe])) (define output (new text-field% [parent panel2] [label "Parsed Text"] [min-height 100] [horiz-margin 60] [vert-margin 0])) (define panel3 (new horizontal-panel% [parent mainframe])) (define incorrect-words (new (class combo-field% (super-new) (inherit get-menu append) (define/public (update-choices choice-list) ; remove all the old items (map (lambda (i) (send i delete)) (send (get-menu) get-items)) ; set up the menu with all new items (map (lambda (choice-label) (append choice-label)) choice-list) (void) )) [parent panel3] [label "Incorrect-Words"] [choices '()] [callback (lambda (x y) (send suggestions update-choices (smart-correction (send x get-value) 1)))] )) (define suggestions (new (class combo-field% (super-new) (inherit get-menu append) (define/public (update-choices choice-list) ; remove all the old items (map (lambda (i) (send i delete)) (send (get-menu) get-items)) ; set up the menu with all new items (map (lambda (choice-label) (append choice-label)) choice-list) (void) )) [parent panel3] [label "Suggestions"] [choices '()] [callback (lambda (x y) (define word (send x get-value)) (set! sug word))] )) (define add-button (new button% [label "Add To Dictionary"] [parent panel3] [callback (lambda (x y) (map modify-vec (hasher sug)) (set! dictree (add dictree sug)))] )) (define sug #f)
false
6eaf3859e90a31b4b0747afd9321c1d8d58e1513
22e86e42ace811a1250e9bf4aa2b2456be997f62
/chunk-visualizer.rkt
a7e381b9f45bacd132401200675608242be92870
[]
no_license
jbclements/mcr-readwrite
9283545a86c74036424ab8749276e0114e41be9b
188b2b5df626f3b5cd3243dcccced993f3fa81bd
refs/heads/master
2016-08-08T02:59:46.685981
2015-11-11T04:15:34
2015-11-11T04:19:04
1,772,818
5
0
null
null
null
null
UTF-8
Racket
false
false
7,793
rkt
chunk-visualizer.rkt
#lang racket (require "minecraft-mcr-reader.rkt" "minecraft-editor.rkt" "data-skeleton.rkt" mred (except-in slideshow get-field) plot) #;(compound-thing->names c1) ;(mc-thing->skeleton c1) ;(define data (second (get-field/chain c1 '("" "Level" "Blocks")))) #;(for*/list ([z (in-range 15)] [x (in-range 15)]) (vector-ref block-names (regular-byte-ref data x 63 z))) (define green-bytes (list->bytes '(255 0 255 0))) (define blue-bytes (list->bytes '(255 0 0 255))) (define white-bytes (list->bytes '(255 255 255 255))) (define black-bytes (list->bytes '(255 0 0 0))) (define red-bytes (list->bytes '(255 255 0 0))) (define water-num (block-name->num "Stationary water")) (define air-num (block-name->num "Air")) (define diamond-ore-num (block-name->num "Diamond Ore")) (define moss-stone-num (block-name->num "Moss Stone")) (define special-block-nums (map block-name->num '("Moss Stone" "Monster Spawner" "Locked Chest"))) (define all-black-block (apply bytes-append (for/list ([i (in-range (* 16 16))]) black-bytes))) (define (cell->bytes val) (cond [(= val air-num) white-bytes] [(= val water-num) blue-bytes] [else green-bytes])) (define (column-has-special? data x z) (for/or ([y (in-range CHUNKDY)]) (member (regular-byte-ref data x y z) special-block-nums))) (define (column-has-diamond-ore? data x z) (for/or ([y (in-range CHUNKDY)]) (= (regular-byte-ref data x y z) diamond-ore-num))) (define (column-has-moss-stone? data x z) (for/or ([y (in-range CHUNKDY)]) (= (regular-byte-ref data x y z) moss-stone-num))) (define (make-map global-x-offset global-y-offset map-x-chunks map-y-chunks y-level) (define x-pixels (* map-x-chunks CHUNKDX)) (define z-pixels (* map-z-chunks CHUNKDZ)) (define d (make-object bitmap% x-pixels z-pixels)) (for* ([x-chunk (in-range map-x-chunks)] [z-chunk (in-range map-z-chunks)]) (when (and (= (modulo x-chunk 5) 0) (= z-chunk 0)) (printf "x = ~s\n" x-chunk)) (define x-offset (* x-chunk CHUNKDX)) (define z-offset (* z-chunk CHUNKDZ)) (with-handlers ([(lambda (exn) (and (exn:fail? exn) (regexp-match #px"does not exist in this file" (exn-message exn)))) (lambda (exn) (send d set-argb-pixels (- x-pixels (+ x-offset CHUNKDX)) (- z-pixels (+ z-offset CHUNKDZ)) CHUNKDX CHUNKDZ all-black-block))]) (define chunk-data (second (get-field/chain (chunk-read/dir "/tmp/world" (+ global-x-offset (- x-chunk (/ map-x-chunks 2))) (+ global-z-offset (- z-chunk (/ map-z-chunks 2)))) '("" "Level" "Blocks")))) (for* ([z (in-range CHUNKDZ)] [x (in-range CHUNKDX)]) (send d set-argb-pixels (- x-pixels 1 (+ x-offset x)) (- z-pixels 1 (+ z-offset z)) 1 1 #;(cell->bytes (regular-byte-ref chunk-data x y-level z)) (cond [(column-has-moss-stone? chunk-data x z) red-bytes] [else (cell->bytes (regular-byte-ref chunk-data x 62 z))]))))) (bitmap d)) (define map-x-chunks 2) (define map-z-chunks 2) (define global-x-offset -8) (define global-z-offset -8) #;(make-map global-x-offset global-z-offset map-x-chunks map-z-chunks 62) #;(for/list ([y (in-range 62 0 -2)]) (make-map global-x-offset global-z-offset map-x-chunks map-z-chunks y)) (define (get-chunk-data x-chunk z-chunk) (second (get-field/chain (chunk-read/dir "/tmp/world" x-chunk z-chunk) '("" "Level" "Blocks")))) (define (one-column x z) (define chunk-x (floor (/ x CHUNKDX))) (define chunk-z (floor (/ z CHUNKDZ))) (define data (get-chunk-data chunk-x chunk-z)) (define rel-x (modulo x CHUNKDX)) (define rel-z (modulo z CHUNKDZ)) (for/list ([y (in-range CHUNKDY)]) (vector-ref block-names (regular-byte-ref data rel-x y rel-z)))) (define (find-diamonds chunk-x chunk-z) (define data (get-chunk-data chunk-x chunk-z)) (for* ([x (in-range CHUNKDX)] [z (in-range CHUNKDZ)]) (for ([y (in-range CHUNKDY)]) (when (= (regular-byte-ref data x y z) diamond-ore-num) (printf "diamond ore: ~s ~s ~s\n" x y z))))) #;(find-diamonds -5 -81) #;(column-has-special? -72 -1268) #;(one-column -72 -1290) #;(one-column (+ -1 (* 16 -6)) (+ 4 (* 16 -10))) #;(list (+ 1 (* 16 -6)) (+ 3 (* 16 -10))) #| (define (square->image bytes x z) (define content (vector-ref block-names (regular-byte-ref bytes x 63 z))) (cond [(equal? content "Water") "blue"] [else "green"])) (define (row->image bytes z) (apply append (reverse (for/list ([x (in-range 15)]) (square->image bytes x z))))) (define (chunk->image bytes) (color-list->bitmap (apply append (reverse (for/list ([z (in-range 15)]) (row->image bytes z)))) 16 16)) (define (region-row->image z) (apply beside (reverse (for/list ([x (in-range 0 31)]) (with-handlers ((exn:fail? (lambda (exn) (rectangle 16 16 "solid" "black")))) (chunk->image )))))) (time (apply above (reverse (for/list ([z (in-range 0 31)]) (region-row->image z))))) #;(for ([z (in-range 15)] [x (in-range 15)])) #;(block-bytes-display data (current-output-port)) |# (define (find-something sought cx-min cx-max cz-min cz-max) (define found empty) (for* ([x-chunk (in-range cx-min cx-max)] [z-chunk (in-range cz-min cz-max)]) (when (and (= (modulo x-chunk 5) 0)) (printf "x = ~s\n" x-chunk)) #;(define x-offset (* x-chunk CHUNKDX)) #;(define z-offset (* z-chunk CHUNKDZ)) (with-handlers ([(lambda (exn) (and (exn:fail? exn) (regexp-match #px"does not exist in this file" (exn-message exn)))) (lambda (exn) (void))]) (define chunk-data (second (get-field/chain (chunk-read/dir "/tmp/world" x-chunk z-chunk) '("" "Level" "Blocks")))) (for* ([z (in-range CHUNKDZ)] [x (in-range CHUNKDX)] [y (in-range CHUNKDY)]) (cond [(= (regular-byte-ref chunk-data x y z) sought) (set! found (cons (list (+ (* CHUNKDX x-chunk)x) y (+ (* CHUNKDZ z-chunk)z)) found))])))) found) (define diamond-locations (find-something diamond-ore-num -15 5 -91 -71 )) (define diamond-ys (map second diamond-locations)) (define min-y (apply min diamond-ys)) (define max-y (apply max diamond-ys)) (define the-hash (make-hash)) (for ([y (in-list diamond-ys)]) (hash-set! the-hash y (add1 (hash-ref the-hash y 0)))) (define bins (sort (hash-map the-hash (lambda (k v) (vector k v))) < #:key (lambda (v) (vector-ref v 0)))) (plot (discrete-histogram bins))
false
b6274ea360aed609f2b7379530d9336963eb0d28
fc69a32687681f5664f33d360f4062915e1ac136
/test/dssl2/while.rkt
4618f33ec6e8f4f5bec45846a0fc6d2433b2f122
[]
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
129
rkt
while.rkt
#lang dssl2 let sum = 0 let counter = 5 while counter > 0: sum = sum + counter counter = counter - 1 assert sum == 15
false
0c4fefdc2a9c40ba6ef6cab96f4bab71bb9cc185
ddcff224727303b32b9d80fa4a2ebc1292eb403d
/4. Metalinguistic Abstraction/4.1/4.3.rkt
b3567bfb78058c6c67a5495ec832cb9d9dfdf6cf
[]
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
671
rkt
4.3.rkt
#lang racket ; dispatch mechanism (define *table* (make-hash)) (define (lookup tag) (let ([res (hash-ref *table* tag #f)]) (if res res (error "unknown operation" tag)))) (define (record tag proc) (hash-set! *table* tag proc)) ; eval (define self-evaluating? (or/c number? string?)) (define variable? symbol?) (define (eval exp env) (if (self-evaluating? exp) exp ((lookup (car exp)) (cdr exp) env))) ; parts (define (eval-var var env) (env var)) (record 'var eval-var) (define (eval-if if-exp env) (if (eval (first if-exp) env) (eval (second if-exp) env) (eval (third if-exp) env))) (record 'if eval-if) ;...
false
bcecd469a55fa8ba4ecc053357a61556d0973f02
7e15b782f874bcc4192c668a12db901081a9248e
/eopl/ch4/ex-4.20/interp.rkt
1e01d527be100d99454c535cd64f9d2945c203b7
[]
no_license
Javran/Thinking-dumps
5e392fe4a5c0580dc9b0c40ab9e5a09dad381863
bfb0639c81078602e4b57d9dd89abd17fce0491f
refs/heads/master
2021-05-22T11:29:02.579363
2021-04-20T18:04:20
2021-04-20T18:04:20
7,418,999
19
4
null
null
null
null
UTF-8
Racket
false
false
4,719
rkt
interp.rkt
(module interp (lib "eopl.ss" "eopl") ;; interpreter for the IMPLICIT-REFS language (require "drscheme-init.rkt") (require "lang.rkt") (require "data-structures.rkt") (require "environments.rkt") (require "store.rkt") (provide value-of-program value-of instrument-let instrument-newref) ;;;;;;;;;;;;;;;; switches for instrument-let ;;;;;;;;;;;;;;;; (define instrument-let (make-parameter #f)) ;; say (instrument-let #t) to turn instrumentation on. ;; (instrument-let #f) to turn it off again. ;;;;;;;;;;;;;;;; the interpreter ;;;;;;;;;;;;;;;; ;; value-of-program : Program -> ExpVal (define value-of-program (lambda (pgm) (initialize-store!) (cases program pgm (a-program (exp1) (value-of exp1 (init-env)))))) ; make sure the return value is a dereferenced value (define (ensure-value ev) (cases expval ev (ref-val (r) (expval-deref ev)) (else ev))) ;; value-of : Exp * Env -> ExpVal ;; Page: 118, 119 (define value-of (lambda (exp env) (cases expression exp ;\commentbox{ (value-of (const-exp \n{}) \r) = \n{}} (const-exp (num) (num-val num)) ;\commentbox{ (value-of (var-exp \x{}) \r) ; = (deref (apply-env \r \x{}))} (var-exp (var) (ensure-value (apply-env env var))) ;\commentbox{\diffspec} (diff-exp (exp1 exp2) (let ((val1 (ensure-value (value-of exp1 env))) (val2 (ensure-value (value-of exp2 env)))) (let ((num1 (expval->num val1)) (num2 (expval->num val2))) (num-val (- num1 num2))))) ;\commentbox{\zerotestspec} (zero?-exp (exp1) (let ((val1 (ensure-value (value-of exp1 env)))) (let ((num1 (expval->num val1))) (if (zero? num1) (bool-val #t) (bool-val #f))))) ;\commentbox{\ma{\theifspec}} (if-exp (exp1 exp2 exp3) (let ((val1 (ensure-value (value-of exp1 env)))) (if (expval->bool val1) (value-of exp2 env) (value-of exp3 env)))) ;\commentbox{\ma{\theletspecsplit}} (let-exp (var exp1 body) (let ((v1 (value-of exp1 env))) (value-of body (extend-env var v1 env)))) (letmutable-exp (var exp1 body) (let ((v1 (value-of exp1 env))) (value-of body (extend-env var (expval-newref v1) env)))) (proc-exp (var body) (proc-val (procedure var body env))) (call-exp (rator rand) (let ((proc (expval->proc (value-of rator env))) (arg (value-of rand env))) (apply-procedure proc arg))) (letrec-exp (p-names b-vars p-bodies letrec-body) (value-of letrec-body (extend-env-rec* p-names b-vars p-bodies env))) (begin-exp (exp1 exps) (letrec ((value-of-begins (lambda (e1 es) (let ((v1 (value-of e1 env))) (if (null? es) v1 (value-of-begins (car es) (cdr es))))))) (value-of-begins exp1 exps))) (assign-exp (var exp1) ; todo (begin (expval-setref! (apply-env env var) (value-of exp1 env)) (num-val 27))) ))) ;; apply-procedure : Proc * ExpVal -> ExpVal ;; Page: 119 ;; uninstrumented version ;; (define apply-procedure ;; (lambda (proc1 val) ;; (cases proc proc1 ;; (procedure (var body saved-env) ;; (value-of body ;; (extend-env var (newref val) saved-env)))))) ;; instrumented version (define apply-procedure (lambda (proc1 arg) (cases proc proc1 (procedure (var body saved-env) (let ((new-env (extend-env var arg saved-env))) (when (instrument-let) (begin (eopl:printf "entering body of proc ~s with env =~%" var) (pretty-print (env->list new-env)) (eopl:printf "store =~%") (pretty-print (store->readable (get-store-as-list))) (eopl:printf "~%"))) (value-of body new-env)))))) ;; store->readable : Listof(List(Ref,Expval)) ;; -> Listof(List(Ref,Something-Readable)) (define store->readable (lambda (l) (map (lambda (p) (list (car p) (expval->printable (cadr p)))) l))) )
false
5a4466a64f5d32d8e59333d8c6001f02518ae2fb
7b072554ea34e9ef6f687e9bb24f6564c9d39d13
/racket/jsonconv.rkt
c5c4e62a998eff8cb9c21dac97c336f51a2d2268
[]
no_license
craftofelectronics/ardu-see
412bda3fd7fb61ec97fb5d99fba6a4c42c25a0d6
a457167cf85a019f18801f3dddf372bafbd9d20c
refs/heads/master
2020-05-09T13:29:51.433065
2012-07-11T18:55:07
2012-07-11T18:55:07
4,873,118
0
1
null
null
null
null
UTF-8
Racket
false
false
12,845
rkt
jsonconv.rkt
#lang racket ;; (require (planet dherman/json:4:0)) (require (planet neil/json-parsing:2:0)) (require mzlib/list (prefix-in srfi1: srfi/1)) (require racket/cmdline) (require (file "base.rkt") (file "store.rkt")) (provide json->occ) (define VERSION 1.00) #| { name: 'jadudm', project: 'testout', working: { modules: [Object], wires: [Object], properties: [Object] } } |# (define p1 "{\"diagram\":{\"name\":\"\",\"project\":\"\",\"working\":{\"modules\":[{\"name\":\"Read Sensor\",\"value\":{\"1int\":\"A0\"},\"config\":{\"position\":[176,34]}},{\"name\":\"Turn On In Range\",\"value\":{\"1int\":\"2\",\"2int\":\"0\",\"3int\":\"100\"},\"config\":{\"position\":[222,214]}}],\"wires\":[{\"src\":{\"moduleId\":0,\"terminal\":\"0out\"},\"tgt\":{\"moduleId\":1,\"terminal\":\"0in\"}}],\"properties\":{\"name\":\"\",\"project\":\"\",\"description\":\"\"}}},\"username\":\"\",\"project\":\"\",\"storage_key\":\"_\"}" ) (define-syntax (get stx) (syntax-case stx () [(_ json field) #`(hash-ref json (quote field))])) (define (get-working json) (get (get json diagram) working)) (define (get-modules json) (get json modules)) (define (get-wires json) (get json wires)) (define (get-name module) (get module name)) (define smoosh (λ (str) (regexp-replace* " " str ""))) (define (find-module-index modules name ndx) (cond [(empty? modules) (error (format "Could not find name: ~a" name))] [(equal? name (get-name (first modules))) ndx] [else (find-module-index (rest modules) name (add1 ndx))])) (define (ns-equal? n-or-s1 n-or-s2) (equal? (format "~a" n-or-s1) (format "~a" n-or-s2))) (define (find-wire-direction module-index wires) (cond [(empty? wires) '()] [(ns-equal? (number->string module-index) (get (get (first wires) src) moduleId)) (define term (get (get (first wires) src) terminal)) (define m (regexp-match "[0-9]+(.*)" term)) (cons (second m) (find-wire-direction module-index (rest wires)))] [(ns-equal? (number->string module-index) (get (get (first wires) tgt) moduleId)) (define term (get (get (first wires) tgt) terminal)) (define m (regexp-match "[0-9]+(.*)" term)) (cons (second m) (find-wire-direction module-index (rest wires))) ] [else (find-wire-direction module-index (rest wires))])) (define (make-wire-name moduleId wires) (cond [(empty? wires) '()] [(or (ns-equal? (number->string moduleId) (get (get (first wires) src) moduleId)) (ns-equal? (number->string moduleId) (get (get (first wires) tgt) moduleId))) (define num (apply string-append (map ->string (quicksort (list (get (get (first wires) src) moduleId) (get (get (first wires) tgt) moduleId)) uber<?)))) (cons (format "wire~a" num) (make-wire-name moduleId (rest wires)))] [else (make-wire-name moduleId (rest wires))])) (define (symbol<? a b) (string<? (symbol->string a) (symbol->string b))) (define (list-intersperse ls o) (cond [(empty? (rest ls)) ls] [else (cons (first ls) (cons o (list-intersperse (rest ls) o)))])) (define (snoc ls o) (reverse (cons o (reverse ls)))) (define build-procs (λ (working) (λ (moduleId) ;(define moduleId ;(find-module-index (get-modules working) name 0)) (define me (list-ref (get-modules working) moduleId)) (define (I o) o) (define wire-directions (find-wire-direction moduleId (I (get-wires working)))) (define wire-names (make-wire-name moduleId (I (get-wires working)))) (define decorated-wire-names (map (λ (wire-direction wire-name) (if (equal? wire-direction "out") (format "~a!" wire-name) (format "~a?" wire-name))) wire-directions wire-names)) (define parameters (let* ([my-values (get me value)] [param-positions (quicksort (hash-keys my-values) symbol<?)]) (map (λ (key) (hash-ref my-values key)) param-positions))) (define name (get (list-ref (get-modules working) moduleId) name)) (format "~a(~a)" (smoosh name) (apply string-append (list-intersperse (append parameters (quicksort (I decorated-wire-names) string<?)) ", "))) ))) (define (leading-number str) (second (regexp-match "([0-9]+).*" (->string str)))) (define (->num s) (if (string? s) (string->number s) s)) #| (define src (get wires src)) (define tgt (get wires tgt)) (define src-modu (->num (get src moduleId))) (define src-posn (->num (leading-number (get src terminal)))) (define tgt-modu (->num (get tgt moduleId))) (define tgt-posn (->num (leading-number (get tgt terminal)))) (printf "src ~a tgt ~a src-posn ~a tgt-posn ~a~n" src-modu tgt-modu src-posn tgt-posn) ;; Add this wire to the respective in and out lists for the module. ;; The source module gets the wire in the src-modu. (define ins (hash-ref procs src-modu (λ () (make-hash)))) (define outs (hash-ref procs src-modu (λ () (make-hash)))) (hash-set! ins src-modu (cons (list src-posn wires) ;; Return an empty list if it is not there. (hash-ref procs src-modu (λ () '())))) (hash-set! outs tgt-modu (cons (list tgt-posn wires) ;; Return an empty list if it is not there. (hash-ref procs tgt-modu (λ () '())))) |# (define node% (class object% (init-field id name) (field (outputs (make-hash)) (inputs (make-hash)) (params (make-hash))) (define/public (set-id n) (set! id n)) (define/public (add-output posn val) (hash-set! outputs posn val)) (define/public (add-input posn val) (hash-set! inputs posn val)) (define/public (add-param posn val) (hash-set! params posn val)) (define/public (get-outputs) outputs) (define/public (get-inputs) inputs) (define/public (get-params) params) (define/public (return-header) (define all-params (merge-hashes (list outputs inputs params))) (define lop (hash-map all-params (λ (k v) (list k v)))) (define sorted (quicksort lop (λ (a b) (< (first a) (first b))))) (format "~a~a" (smoosh name) (list-intersperse (map second sorted) ", "))) (super-new) )) (define procs (make-hash)) (define (load-skeletons modules) ;; For each module, load a skeleton object into ;; the procs hash. (let ([c 0]) (for-each (λ (m) (hash-set! procs c (new node% (id c) (name (get m name)))) (set! c (add1 c))) modules))) (define (load-parameters modules) (define c 0) (for-each (λ (m) (define params (hash-ref m 'value)) (hash-for-each params (λ (k v) (define num (->num (leading-number k))) (define proc (hash-ref procs c)) (send proc add-param num v))) (set! c (add1 c))) modules)) (define (make-decorator str) (if (regexp-match "out" str) "!" "?")) (define (load-wires wires) ;; For each wire, load data about source and target ;; into the appropriate modules. (define (opposite sym) (if (equal? sym 'src) 'tgt 'src)) (for-each (λ (w) (define src (hash-ref w 'src)) (define tgt (hash-ref w 'tgt)) (define src-modu (->num (hash-ref src 'moduleId))) (define tgt-modu (->num (hash-ref tgt 'moduleId))) (define src-term (hash-ref src 'terminal)) (define tgt-term (hash-ref tgt 'terminal)) (define src-posn (->num (leading-number src-term))) (define tgt-posn (->num (leading-number tgt-term))) ;; Get the source proc (define src-proc (hash-ref procs src-modu)) (define tgt-proc (hash-ref procs tgt-modu)) (define wire-name (apply string-append (map ->string (list src-modu tgt-modu) ))) ;(printf "Building wire ~a~n" wire-name) ;; Load connection info into the list ;; use make-decorator to get the ?/! right regardless of ;; which way the user drew the arrow. (Otherwise, src and tgt ;; could be wonky, and be backwards from what the processes expect). (send tgt-proc add-input tgt-posn (format "wire~a~a" wire-name (make-decorator tgt-term))) (send src-proc add-output src-posn (format "wire~a~a" wire-name (make-decorator src-term)))) wires)) (define (merge-hashes loh) (define h (make-hash)) (for-each (λ (hprime) (hash-for-each hprime (λ (k v) (hash-set! h k v)))) loh) h) (define (build-procs2 working) (define wires (get working wires)) (define modules (get working modules)) (load-skeletons modules) (load-parameters modules) (load-wires wires) (hash-map procs (λ (k v) (send v return-header))) ) (define (uber<? a b) (cond [(and (string? a) (string? b)) (string<? a b)] [(and (number? a) (number? b)) (< a b)] [else (string<? (format "~a" a) (format "~a" b))])) (define (build-wire-names working) (define wires (get working wires)) (map (λ (w) (define ls (quicksort (list (get (get w src) moduleId) (get (get w tgt) moduleId)) uber<?)) (define str (apply string-append (map ->string ls))) (format "wire~a" str)) wires)) (define (build-wire-names2 working) (define wires (get working wires)) (map (λ (w) (define ls (list (get (get w src) moduleId) (get (get w tgt) moduleId))) (define str (apply string-append (map ->string ls))) (format "wire~a" str)) wires)) (define (json->occ prog) (define result "") (define (s! s) (set! result (string-append result s))) (define sjson (json->sjson prog)) (define names (map get-name (get-modules (get-working sjson)))) ;(printf "NAMES: ~a~n" names) (define proc-names (map smoosh names)) ;(printf "PROC-NAMES: ~a~n" proc-names) (define ndx* (srfi1:iota (length names))) ;(printf "NDX*: ~a~n" ndx*) ;(define proc-list (map (build-procs (get-working sjson)) ndx*)) (define proc-headers (build-procs2 (get-working sjson))) (s! (format "#INCLUDE \"ardu-see-ardu-do.module\"~n")) (s! (format "PROC main~a ()\n" (current-seconds))) (s! (format " SEQ~n")) ;(s! (format " serial.start(TX0, ~a)~n" (get-data 'baud))) (s! (format " CHAN INT ~a:~n" (apply string-append (list-intersperse (build-wire-names2 (get-working sjson)) ", ")))) (s! " PAR\n") (for-each (λ (str) (s! (format " ~a~n" str))) proc-headers) (s! ":\n") result ) (define (file->string fname) (define ip (open-input-file fname)) (define s "") (let loop ([line (read-line ip)]) (unless (eof-object? line) (set! s (string-append line s)) (loop (read-line ip)))) (close-input-port ip) s) (define outfile (make-parameter "ardusee.occ")) (define (run v) (define outfile "ARDU.occ") (command-line #:program "jsonconv" #:argv v #:once-each [("-v" "--version") "Current version" (printf "Version: ~a~n" VERSION) (exit)] [("-o" "--outfile") of "Output filename" (outfile of)] #:args (filename) (let ([res (json->occ (file->string filename))]) (define op (open-output-file outfile #:exists 'replace)) (fprintf op res) (close-output-port op)) )) ;(run (current-command-line-arguments))
true
db96d2a7d414b94c34b7e825009e57621ac36140
64145e6fd2f67317320d31c3119d5c929410de93
/live-free-or-die.scrbl
63b2e4919d3c7fbc0290b51099d708471721ff20
[]
no_license
jeapostrophe/live-free-or-die
b91e1168a0af5bb5986f8b79b7f7f319e9ea7e59
b6fbe5364c51eb793a7f88fb916e41506b1d519e
refs/heads/master
2021-01-13T11:06:30.917753
2017-11-03T20:21:51
2017-11-03T20:21:51
68,876,492
7
0
null
null
null
null
UTF-8
Racket
false
false
496
scrbl
live-free-or-die.scrbl
#lang scribble/manual @(require (for-label racket/base live-free-or-die)) @title{live-free-or-die: Freedom from Typed Racket} @author{Jay McCarthy} @defmodule[live-free-or-die] The @racketmodname[live-free-or-die] module provides a way to escape from Typed Racket's contracts by pretending to be a typed context. @defform[(live-free-or-die!)]{Pretend to be a typed context.} @defform[(Doctor-Tobin-Hochstadt:Tear-down-this-wall!)]{Alias for @racket[live-free-or-die!].}
false
a4278a3062c069831ad6f562c7b2e9973edae163
fcf30f3d29751819c05a69f2b8993140481970bb
/src/modules/rkt/syntax-case.rkt
92269ac6e13428badf48f0713a798c0015c207d5
[ "Apache-2.0" ]
permissive
nus-cs4215/x-slang-t3-tt-nk-cjw
6a7f70f8c50ce807c8790fde46f4c93a0e2781c6
540728eed1f46a74543d39d2998d625b8aa81147
refs/heads/master
2023-04-03T14:29:12.282342
2021-04-23T11:27:39
2021-04-23T11:27:39
333,485,799
0
0
Apache-2.0
2021-04-21T10:07:26
2021-01-27T16:12:35
TypeScript
UTF-8
Racket
false
false
11,487
rkt
syntax-case.rkt
; // magic file that's simultaneously a racket module and a typescript module ; const contents = ` (module syntax-case '#%builtin-kernel ; Implements syntax-case raw-syntax-case (pattern matching + un-matching) ; pattern-match pattern-unmatch (applying patterns) ; make-cons-pattern make-datum-pattern make-var-pattern make-star-pattern make-plus-pattern (constructing patterns) ; pattern-parse (constructing patterns more easily) ; (raw-syntax-case is the composition of pattern-match and pattern-unmatch basically) ; (and syntax-case is the composition of pattern-parse and raw-syntax-case ) (#%require /libs/racket/private/and-or /libs/racket/private/car-et-al /libs/racket/private/cond /libs/racket/private/dict /libs/racket/private/let /libs/racket/private/quasiquote /libs/racket/private/queue ) (#%provide syntax-case raw-syntax-case) (#%provide pattern-match pattern-unmatch) (#%provide make-cons-pattern make-datum-pattern make-var-pattern make-star-pattern make-plus-pattern) (#%provide pattern-parse) (#%provide test-result) (define test-result 5) ; (raw-syntax-case is the composition of pattern-match and pattern-unmatch basically) ; (and syntax-case is the composition of pattern-parse and raw-syntax-case ) ; pattern-parse takes in an sexpr ; and replaces the following constructs ; with their corresponding pattern objects. ; (something ... . rest) --> (make-star-pattern something rest) ; (something ...+ . rest) --> (make-plus-pattern something rest) ; (lhs . rhs) --> (make-cons-pattern lhs rhs) ; 'some-symbol --> (make-datum-pattern 'some-symbol) ; some-symbol --> (make-var-pattern 'some-symbol) ; other-datum --> (make-datum-pattern other-datum) ; The typescript implementation... ; uses paattern matching to do this. ; Yes. ; The typescript implementation uses pattern matching ; to implement pattern parsing, ; a preprocessing step before pattern matching. ; ; We shall do the same. (define-syntax lambda (#%plain-lambda (stx) (cons '#%plain-lambda (cdr stx)))) (define make-match-object (lambda () (make-dict))) (define match-object-has? (lambda (match-object var-name) (and (dict-has-key? match-object var-name) (not (queue-empty? (dict-ref match-object var-name)))))) (define match-object-enqueue! (lambda (match-object var-name matched-expr) (if (dict-has-key? match-object var-name) (enqueue! (dict-ref match-object var-name) matched-expr) (let [(new-queue (make-queue))] (enqueue! new-queue matched-expr) (dict-set! match-object var-name new-queue))))) (define match-object-dequeue! (lambda (match-object var-name) (dequeue! (dict-ref match-object var-name)))) ; A pattern object is a list-structure constructed with the constructors ; datum-pattern, var-pattern, cons-pattern, star-pattern, make-plus-pattern ; and nothing else. ; if you attempt to use the matching library with a non-pattern, expect crashes. (define make-datum-pattern (lambda (datum) ~(datum ,datum))) (define make-var-pattern (lambda (var-name) ~(var ,var-name))) (define make-cons-pattern (lambda (lhs-pattern rhs-pattern) ~(cons ,lhs-pattern ,rhs-pattern))) (define make-star-pattern (lambda (repeat-pattern tail-pattern) ~(star ,repeat-pattern ,tail-pattern))) (define make-plus-pattern (lambda (repeat-pattern tail-pattern) ~(plus ,repeat-pattern ,tail-pattern))) ; pattern-match will take in an expression and a pattern ; and return a pair of a boolean indicating success ; and the match object if the match succeeded. (define pattern-match (lambda (expr pattern) (define match-object (make-match-object)) (define match_ (lambda (expr pattern) (define pattern-type (car pattern)) (cond [(symbol=? pattern-type 'datum) (eq? expr (cadr pattern))] [(symbol=? pattern-type 'var) (begin (match-object-enqueue! match-object (cadr pattern) expr) #t )] [(symbol=? pattern-type 'cons) (and (cons? expr) (match_ (car expr) (cadr pattern)) (match_ (cdr expr) (caddr pattern)))] [(symbol=? pattern-type 'star) (if (and (cons? expr) (match_ (car expr) (cadr pattern))) (match_ (cdr expr) pattern) (match_ expr (caddr pattern)))] [(symbol=? pattern-type 'plus) (and (cons? expr) (match_ (car expr) (cadr pattern)) (match_ (cdr expr) (cons 'star (cdr pattern))))] ))) (cons (match_ expr pattern) match-object))) ; pattern-unmatch will take in a match object and a pattern ; and return a pair of a boolean indicating success ; and the sexpr if the unmatch succeeded. (define pattern-unmatch (lambda (match-object pattern) (define pattern-type (car pattern)) (cond [(symbol=? pattern-type 'datum) (cons #t (cadr pattern))] [(symbol=? pattern-type 'var) (if (match-object-has? match-object (cadr pattern)) (cons #t (match-object-dequeue! match-object (cadr pattern))) (cons #f #f))] [(symbol=? pattern-type 'cons) (let [(lhs-unmatch (pattern-unmatch match-object (cadr pattern)))] (if (car lhs-unmatch) (let [(rhs-unmatch (pattern-unmatch match-object (caddr pattern)))] (if (car rhs-unmatch) (cons #t (cons (cdr lhs-unmatch) (cdr rhs-unmatch))) (cons #f #f))) (cons #f #f)))] [(symbol=? pattern-type 'star) (let [(rep-unmatch (pattern-unmatch match-object (cadr pattern)))] (if (car rep-unmatch) (let [(again-unmatch (pattern-unmatch match-object pattern))] (cons (and (car rep-unmatch) (car again-unmatch)) (cons (cdr rep-unmatch) (cdr again-unmatch)))) (pattern-unmatch match-object (caddr pattern))))] [(symbol=? pattern-type 'plus) (let [(lhs-unmatch (pattern-unmatch match-object (cadr pattern)))] (if (car lhs-unmatch) (let [(rhs-unmatch (pattern-unmatch match-object (cons 'star (cdr pattern))))] (if (car rhs-unmatch) (cons #t (cons (cdr lhs-unmatch) (cdr rhs-unmatch))) (cons #f #f))) (cons #f #f)))] ) )) ; (raw-syntax-case input-expr [pattern-object unpattern-object] . rest-cases) ; expands to ; (let* ([input input-expr] ; [match-result (pattern-match input pattern-object)] ; [match-success? (car match-result)] ; [match-object (cdr match-result)]) ; (if match-success? ; (cdr (pattern-unmatch match-object unpattern-object)) ; (raw-syntax-case input . rest-cases))) ; ; (raw-syntax-case input-expr) ; expands to ; 'no-match (define-syntax raw-syntax-case (lambda (raw-syntax-case+stx) (define input-expr (cadr raw-syntax-case+stx)) (define cases (cddr raw-syntax-case+stx)) (if (null? cases) ''no-match (let ([case (car cases)] [rest-cases (cdr cases)]) ~(let ([r-s-c-input__ ,input-expr]) (let ([r-s-c-match-result__ (pattern-match r-s-c-input__ ,(car case))]) (let ([r-s-c-match-success? (car r-s-c-match-result__)] [r-s-c-match-object (cdr r-s-c-match-result__)]) (if r-s-c-match-success? (cdr (pattern-unmatch r-s-c-match-object ,(cadr case))) (raw-syntax-case r-s-c-input__ . ,rest-cases))))) )))) (define star-spec-pattern (make-cons-pattern (make-var-pattern 'repeat-pattern) (make-cons-pattern (make-datum-pattern '...) (make-var-pattern 'tail-pattern))) ) (define star-unpattern (make-cons-pattern (make-datum-pattern 'star) (make-cons-pattern (make-var-pattern 'repeat-pattern) (make-cons-pattern (make-var-pattern 'tail-pattern) (make-datum-pattern '())))) ) (define plus-spec-pattern (make-cons-pattern (make-var-pattern 'repeat-pattern) (make-cons-pattern (make-datum-pattern '...+) (make-var-pattern 'tail-pattern))) ) (define plus-unpattern (make-cons-pattern (make-datum-pattern 'plus) (make-cons-pattern (make-var-pattern 'repeat-pattern) (make-cons-pattern (make-var-pattern 'tail-pattern) (make-datum-pattern '())))) ) (define literal-spec-pattern (make-cons-pattern (make-datum-pattern 'quote) (make-cons-pattern (make-var-pattern 'datum-value) (make-datum-pattern '()))) ) (define literal-unpattern (make-cons-pattern (make-datum-pattern 'datum) (make-cons-pattern (make-var-pattern 'datum-value) (make-datum-pattern '()))) ) (define anything-pattern (make-var-pattern 'anything) ) (define anything-unpattern (make-cons-pattern (make-datum-pattern 'anything) (make-cons-pattern (make-var-pattern 'anything) (make-datum-pattern '()))) ) (define pattern-parse (lambda (pattern-spec) (define outer-parse (raw-syntax-case pattern-spec [star-spec-pattern star-unpattern] [plus-spec-pattern plus-unpattern] [literal-spec-pattern literal-unpattern] [anything-pattern anything-unpattern] )) (define match-type (car outer-parse)) (cond ; (repeat-pattern ... . tail-patttern) [(symbol=? match-type 'star) ~(star ,(pattern-parse (cadr outer-parse)) ,(pattern-parse (caddr outer-parse)))] ; (repeat-pattern ...+ . tail-patttern) [(symbol=? match-type 'plus) ~(plus ,(pattern-parse (cadr outer-parse)) ,(pattern-parse (caddr outer-parse)))] ; 'something [(symbol=? match-type 'datum) outer-parse] ; we couldn't detect the right spec from a simple pattern matching ; (lhs . rhs) [(cons? pattern-spec) (make-cons-pattern (pattern-parse (car pattern-spec)) (pattern-parse (cdr pattern-spec)))] ; some-symbol [(symbol? pattern-spec) (make-var-pattern pattern-spec)] ; other-datum [#t (make-datum-pattern pattern-spec)]) )) (define-syntax syntax-case (lambda (syntax-case+stx) (define input-expr (cadr syntax-case+stx)) (define cases (cddr syntax-case+stx)) (if (null? cases) ''no-match (let ([case (car cases)] [rest-cases (cdr cases)]) (let ([parsed-pattern (pattern-parse (car case))] [parsed-unpattern (pattern-parse (cadr case))]) ~(let ([s-c-input__ ,input-expr]) (let ([s-c-match-result__ (pattern-match s-c-input__ ',parsed-pattern)]) (let ([s-c-match-success? (car s-c-match-result__)] [s-c-match-object (cdr s-c-match-result__)]) (if s-c-match-success? (cdr (pattern-unmatch s-c-match-object ',parsed-unpattern)) (syntax-case s-c-input__ . ,rest-cases))))) ))))) ) ; ` ; exports.default = contents ; exports.contents = contents
true
9a431c5cc916984defba394f986936254e65f438
fe90ad785111fb25426f049eff6fd3d25e6fe818
/section-6/section-6-tests.rkt
a969ad5549fb36cdd55def64f0ff997e4491610f
[ "CC0-1.0" ]
permissive
pbl64k/coursera-proglang-practice
4699e22d6678ffe263503eadfd55564e1c8db691
51608c213a3c844e64d1ef0dcd115a5ec26b0978
refs/heads/master
2021-01-18T22:49:37.364703
2016-08-03T08:45:54
2016-08-03T08:45:54
24,757,194
1
0
null
null
null
null
UTF-8
Racket
false
false
7,806
rkt
section-6-tests.rkt
#lang racket ;; Based on the provided test file for HW4 in proglang. ;; INSTRUCTIONS: ;; Put into the same folder as the file with your practice problem solutions. ;; Make sure it starts with: ;; #lang racket ;; (provide (all-defined-out)) (require "Put the name of the file with your solutions here") (require rackunit) (require rackunit/text-ui) (define tests (test-suite "Model tests for section 6 practice problems" ;;; The Usual Suspects ;;; (check-equal? (btree-fold string-append "!" (btree-node "foo" (btree-node "bar" (btree-leaf) (btree-leaf)) (btree-node "baz" (btree-leaf) (btree-leaf)))) "!bar!foo!baz!" "btree-fold test #1") (check-equal? (btree-fold * 1 (btree-leaf)) 1 "btree-fold #2") (check-equal? (btree-fold (lambda (l v r) (- v l r)) 1 (btree-node 10 (btree-node 5 (btree-leaf) (btree-leaf)) (btree-node 3 (btree-leaf) (btree-leaf)))) 6 "btree-fold test #3") (check-equal? (btree-unfold (lambda (x) (if (zero? x) #f (cons x (cons (sub1 x) (sub1 x))))) 2) (btree-node 2 (btree-node 1 (btree-leaf) (btree-leaf)) (btree-node 1 (btree-leaf) (btree-leaf))) "btree-unfold test #1") (check-equal? (btree-unfold (lambda (x) #f) #f) (btree-leaf) "btree-unfold test #2") (check-equal? (btree-unfold (lambda (x) (if (zero? x) #f (cons x (cons (quotient x 2) (quotient x 3))))) 6) (btree-node 6 (btree-node 3 (btree-node 1 (btree-leaf) (btree-leaf)) (btree-node 1 (btree-leaf) (btree-leaf))) (btree-node 2 (btree-node 1 (btree-leaf) (btree-leaf)) (btree-leaf))) "btree-unfold test #3") (check-equal? (gardener (btree-leaf)) (btree-leaf) "gardener test #1") (check-equal? (gardener (btree-node 10 (btree-node "some string" (btree-node #f (btree-node 1 (btree-leaf) (btree-leaf)) (btree-node (lambda (x) x) (btree-node "foobar" (btree-leaf) (btree-leaf)) (btree-leaf))) (btree-node "hm..." (btree-node 20 (btree-leaf) (btree-leaf)) (btree-node #f (btree-leaf) (btree-leaf)))) (btree-node #t (btree-leaf) (btree-node (list 1 2 3) (btree-leaf) (btree-leaf))))) (btree-node 10 (btree-node "some string" (btree-leaf) (btree-node "hm..." (btree-node 20 (btree-leaf) (btree-leaf)) (btree-leaf))) (btree-node #t (btree-leaf) (btree-node (list 1 2 3) (btree-leaf) (btree-leaf)))) "gardener test #2") (check-equal? (gardener (btree-node #f (btree-node "some string" (btree-node #f (btree-node 1 (btree-leaf) (btree-leaf)) (btree-node (lambda (x) x) (btree-node "foobar" (btree-leaf) (btree-leaf)) (btree-leaf))) (btree-node "hm..." (btree-node 20 (btree-leaf) (btree-leaf)) (btree-node #f (btree-leaf) (btree-leaf)))) (btree-node #t (btree-leaf) (btree-node (list 1 2 3) (btree-leaf) (btree-leaf))))) (btree-leaf) "gardener test #3") ;;; So Dynamic ;;; ;; Crazy Sum ;; (check-equal? (crazy-sum (list 10 * 6 / 5 - 3)) 9 "crazy-sum test #1") (check-equal? (crazy-sum (list 1 2 3 4 5 * 6)) 90 "crazy-sum test #2") (check-equal? (crazy-sum (list 6 - 3 6 9 / 6 + 5)) 3 "crazy-sum test #3") ;; Universal Fold ;; (check-equal? (universal-fold (lambda (x y) x) 0 null) 0 "universal-fold test #1") (check-equal? (universal-fold string-append "" (list "a" "b" "c")) "abc" "universal-fold test #2") (check-equal? (universal-fold * 1 (btree-node 1 (btree-node 2 (btree-node 3 (btree-leaf) (btree-leaf)) (btree-node 4 (btree-leaf) (btree-leaf))) (btree-node 5 (btree-leaf) (btree-leaf)))) 120 "universal-fold test #3") (check-equal? (universal-fold (lambda (x y) y) #t (btree-leaf)) #t "universal-fold test #4") (check-equal? (universal-sum null) 0 "universal-sum test #1") (check-equal? (universal-sum (list 10 21 32)) 63 "universal-sum test #2") (check-equal? (universal-sum (btree-node 1 (btree-node 2 (btree-node 3 (btree-leaf) (btree-leaf)) (btree-node 4 (btree-leaf) (btree-leaf))) (btree-node 5 (btree-leaf) (btree-leaf)))) 15 "universal-sum test #3") (check-equal? (universal-sum (btree-leaf)) 0 "universal-sum test #4") ;; Stomp! ;; (check-equal? (flatten (list 1 2 (list (list 3 4) 5 (list (list 6) 7 8)) 9 (list 10))) (list 1 2 3 4 5 6 7 8 9 10) "flatten test #1") (check-equal? (flatten null) null "flatten test #2") (check-equal? (flatten (list (list (list "a" "b" "c")) (list "d" "e") "f")) (list "a" "b" "c" "d" "e" "f") "flatten test #3") (check-equal? (flatten (list (list null) (list "c" null "d") "e")) (list "c" "d" "e") "flatten test #4") ;;; Lambda Madness ;;; (check-equal? (simplify (mlet "x" (add (int 1) (int 2)) (var "x"))) (call (fun #f "x" (var "x")) (add (int 1) (int 2))) "simplify test #1") (check-equal? (simplify (fun #f "x" (mlet "p" (apair (aunit) (var "x")) (apair (snd (var "p")) (fst (var "p")))))) (fun #f "x" (call (fun #f "p" (fun #f "_f" (call (call (var "_f") (call (var "p") (fun #f "_x" (fun #f "_y" (var "_y"))))) (call (var "p") (fun #f "_x" (fun #f "_y" (var "_x"))))))) (fun #f "_f" (call (call (var "_f") (aunit)) (var "x"))))) "simplify test #2") )) (run-tests tests)
false
a4e190ea3aec1f817617566a8e221ae6d3b886da
d2fc383d46303bc47223f4e4d59ed925e9b446ce
/courses/2010/fall/330/notes/2-24.rkt
f3801022cf380101cb96a25f31721b83d78ffd62
[]
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
2,812
rkt
2-24.rkt
#lang racket (define current-browser-tab (box "google.com")) (define (prompt/k p after-fun) (display p) (set-box! current-browser-tab after-fun) (error 'http "Connection closed!")) (define (submit n) ((unbox current-browser-tab) n)) (define (show fmt a) (printf fmt a) (error 'http "Connection closed!")) (define (start) ; This is a CONTINUATION ; is abbreviated kont ; is abbreviated k ; This is the program in DIRECT style #;(define (get-n-numbers-and-add-them n) (if (zero? n) 0 (+ (get-a-number) (get-n-numbers-and-add-them (sub1 n))))) ; We have to write in CONTINUATION PASSING STYLE (CPS) #;(define (get-n-numbers-and-add-them/k n k) (if (zero? n) (k 0) (prompt/k "Number:" (λ (nth-number) (get-n-numbers-and-add-them/k (sub1 n) (λ (the-rest-of-the-sum) (k (+ nth-number the-rest-of-the-sum)))))))) ; This is the program in DIRECT style #;(define (foldr f-cons v-empty l) (if (empty? l) v-empty (f-cons (first l) (foldr f-cons v-empty (rest l))))) #;(define (build-list n f) (if (zero? n) empty (cons (f n) (build-list (sub1 n) f)))) #;(define (get-a-number i) (prompt "Number:")) #;(define (get-n-numbers-and-add-them n) (foldr + 0 (build-list n get-a-number))) ; We have to write in CONTINUATION PASSING STYLE (CPS) (define (foldr/k f-cons/k v-empty l k) (if (empty? l) (k v-empty) (foldr/k f-cons/k v-empty (rest l) (λ (the-rest-v) (f-cons/k (first l) the-rest-v k #;(λ (the-ans) (k the-ans))))))) ; What part of a normal implementation is no longer necessary? ; ANSWER: (define (build-list/k n f/k k) (if (zero? n) (k empty) (f/k n (λ (nth-entry) (build-list/k (sub1 n) f/k (λ (all-the-others) (k (cons nth-entry all-the-others)))))))) (define (get-n-numbers-and-add-them/k n k) (build-list/k n (λ (i k) (prompt/k "Number:" k)) (λ (the-numbers) ; We don't need to change this, but a program wouldn't know that #;(k (foldr + 0 the-numbers)) (foldr/k (λ (a b k) (k (+ a b))) ; Here we are wrapping a primitive 0 the-numbers k)))) (prompt/k "How many numbers?" (λ (how-many) (get-n-numbers-and-add-them/k how-many (λ (the-sum) (show "The sum of your numbers is ~a." the-sum)))))) (start)
false
8843156b2aa0c56b12692ce063ddc9836348dc13
1affee41c600b845a6f2bc27c02a7f38b72194ad
/Lisp/maze_foo.rkt
c9e657a6b08d5e2606658da2ac826b6ca58f1990
[]
no_license
PascalZh/Practice
f33702a0e5d04737943e35ed3a02d29165123634
6ba455b18404cc25f275043ff277edafe626b237
refs/heads/master
2022-06-01T02:55:04.886150
2022-05-14T04:54:32
2022-05-14T04:54:32
107,367,122
2
0
null
null
null
null
UTF-8
Racket
false
false
5,241
rkt
maze_foo.rkt
#!/usr/bin/env racket #lang racket/gui (require "libcommon.rkt") (provide set-Oxy set-size set-grid-size set-colors refresh-maze get-canvas) (provide make-colors colors-ref colors-set!) (def (paint-maze canvas dc) (def (iter i) (def (iter_ j) (if (= j 0) null (let ([x (+ Ox (* grid-width (- i 1)) grid-border)] [y (+ Oy (* grid-height (- j 1)) grid-border)] [color (colors-ref colors (- i 1) (- j 1))]) (send dc set-brush color'solid) (send dc draw-rectangle x y (- grid-width grid-border) (- grid-height grid-border)) (iter_ (- j 1))))) (if (= i 0) null (begin (iter_ H) (iter (- i 1))))) (send dc set-brush "green" 'solid) (send dc draw-rectangle Ox Oy maze-width maze-height) (iter W)) (def H 4) (def W 4) (def Ox 10) (def Oy 11) (def grid-width 40) (def grid-height 40) (def grid-border (/ grid-width 10)) (def maze-width (+ grid-border (* grid-width W))) (def maze-height (+ grid-border (* grid-height H))) (def (set-Oxy x y) (set! Ox x) (set! Oy y)) (def (set-size w h) (set! W w) (set! H h) (set! colors (make-colors W H)) (set! maze-width (+ grid-border (* grid-width W))) (set! maze-height (+ grid-border (* grid-height H))) ) (def (set-grid-size w h) (set! grid-width w) (set! grid-height h) (set! maze-width (+ grid-border (* grid-width W))) (set! maze-height (+ grid-border (* grid-height H))) ) ; assign color for every grid (def (make-colors w h) (build-mlist W (λ (x) (build-mlist H (λ (x) "blue"))))) (def colors (make-colors W H)) (def (colors-ref clrs x y) (mlist-ref (mlist-ref clrs x) y)) (def set-colors (case-lambda [(clrs) (cond [(mpair? clrs) (set! colors clrs)])] [(x y color) (colors-set! colors x y color)])) (def (colors-set! clrs x y color) (def (iter l i) (def (iter_ l_ j) (if (= j 0) (set-mcar! l_ color) (iter_ (mcdr l_) (j . - . 1)))) (if (= i 0) (iter_ (mcar l) y) (iter (mcdr l) (i . - . 1)))) (iter clrs x)) (def canvas 0) (def (get-canvas) canvas) (def (set-canvas cvs) (set! canvas cvs)) (def (refresh-maze) (send canvas refresh)) (module+ test (require rackunit) (displayln colors) (colors-set! colors 1 0 "red") (displayln colors) (displayln (colors-ref colors 1 0)) ) (module* main #f (define my-canvas% (class canvas% ; The base class is canvas% ; Define overriding method to handle mouse events (define/override (on-event event) (when (send event button-down? 'left) (let* ([x (send event get-x)] [y (send event get-y)] [i (quotient (- x Ox) grid-width)] [j (quotient (- y Oy) grid-height)] [x_ (+ Ox (+ (* grid-width i) grid-border))] [y_ (+ Oy (+ (* grid-height j) grid-border))]) (when (and (> (remainder (- x Ox) grid-width) grid-border) (> (remainder (- y Oy) grid-height) grid-border) (< i W) (< j H)) (send dc set-brush "black" 'solid) (send dc draw-rectangle x_ y_ (- grid-width grid-border) (- grid-height grid-border))))) ) ; Call the superclass init, passing on all init args (super-new))) (def frame (new frame% [label "Maze"] [width 500] [height 600])) (set-canvas (new my-canvas% [parent frame] ;[min-width (+ maze-width Ox)] ;[min-height (+ maze-height Oy)] [paint-callback paint-maze])) (def dc (send canvas get-dc)) (new button% [parent frame] [label "随机使一个格子变黑"] [callback (lambda (button event) (let ([x (+ Ox (+ (* grid-width (random W)) grid-border))] [y (+ Oy (+ (* grid-height (random H)) grid-border))]) (send dc set-brush "black" 'solid) (send dc draw-rectangle x y (- grid-width grid-border) (- grid-height grid-border))) )]) (new button% [parent frame] [label "恢复"] [callback (λ (button event) (send canvas refresh))]) (set-size 5 5) (set-Oxy 10 10) (colors-set! colors 0 0 "red") (colors-set! colors 3 0 "red") (colors-set! colors 0 3 "red") (colors-set! colors 3 3 "red") (send frame show #t) )
false
e97675496e40fc084112fe647768c578c34393ae
c7a0f9211b6787c7bc51d445acdf056b877e3491
/column.rkt
7bf054b13208d258ec5e16007b0d7d6f8750cf1d
[ "MIT" ]
permissive
DavidAlphaFox/tabular-asa
11de5a473f15b47e0df31b367f050f6db4a6b5ea
cb7b2c0390279505c16600dbd604547813983599
refs/heads/master
2023-07-09T03:02:26.537350
2021-08-08T03:12:10
2021-08-08T03:12:10
null
0
0
null
null
null
null
UTF-8
Racket
false
false
3,479
rkt
column.rkt
#lang racket #| Tabular Asa - a fast, efficient, dataframes implementation Copyright (c) 2021 by Jeffrey Massung All rights reserved. |# (require "orderable.rkt") (require "utils.rkt") ;; ---------------------------------------------------- (provide (all-defined-out)) ;; ---------------------------------------------------- (struct column [name index data] #:property prop:sequence (λ (col) (let ([ix (column-index col)] [data (column-data col)]) (sequence-map (λ (i) (vector-ref data i)) ix))) ; custom printing #:methods gen:custom-write [(define write-proc (λ (col port mode) (fprintf port "#<column ~a [~a values]>" (column-name col) (column-length col))))]) ;; ---------------------------------------------------- (define empty-column (column '|| #() #())) ;; ---------------------------------------------------- (define (build-column seq #:as [as #f]) (let* ([data (for/vector ([x seq]) x)] [index (build-vector (vector-length data) identity)]) (column (or as (gensym "col")) index data))) ;; ---------------------------------------------------- (define (column-length col) (vector-length (column-index col))) ;; ---------------------------------------------------- (define (column-empty? col) (vector-empty? (column-index col))) ;; ---------------------------------------------------- (define (column-compact col) (struct-copy column col [data (for/vector ([x col]) x)])) ;; ---------------------------------------------------- (define (column-rename col [as #f]) (struct-copy column col [name (or as (gensym "col"))])) ;; ---------------------------------------------------- (define (column-ref col n) (vector-ref (column-data col) (vector-ref (column-index col) n))) ;; ---------------------------------------------------- (define (column-head col [n 10]) (struct-copy column col [index (vector-head (column-index col) n)])) ;; ---------------------------------------------------- (define (column-tail col [n 10]) (struct-copy column col [index (vector-tail (column-index col) n)])) ;; ---------------------------------------------------- (define (column-reverse col) (struct-copy column col [index (vector-reverse (column-index col))])) ;; ---------------------------------------------------- (define (column-sort col [less-than? sort-ascending]) (let ([ix (column-index col)] [data (column-data col)]) (struct-copy column col [index (vector-sort ix less-than? #:key (λ (i) (vector-ref data i)))]))) ;; ---------------------------------------------------- (module+ test (require rackunit) ; create a simple column (define c (build-column 5 #:as 'foo)) ; verify the column (check-equal? (column-name c) 'foo) (check-equal? (column-length c) 5) (check-equal? (column-empty? c) #f) (check-equal? (sequence->list c) '(0 1 2 3 4)) ; renaming check (check-equal? (column-name (column-rename c 'bar)) 'bar) ; head and tail (check-equal? (sequence->list (column-head c 2)) '(0 1)) (check-equal? (sequence->list (column-tail c 2)) '(3 4)) ; sorting (check-equal? (sequence->list (column-sort c sort-descending)) '(4 3 2 1 0)))
false
20d5db20e01bbe962293ed88c8d573503d87f151
25a6efe766d07c52c1994585af7d7f347553bf54
/gui-test/framework/tests/autosave.rkt
b18b7915c04b2503fe806479aeaba57155511e46
[ "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
5,923
rkt
autosave.rkt
#lang racket (require rackunit framework string-constants racket/gui/base "test-suite-utils.rkt") (define-syntax (in-scratch-directory stx) (syntax-case stx () [(_ e1 e2 ...) #`(in-scratch-directory/proc #,(syntax/loc stx (λ () e1 e2 ...)))])) (define (in-scratch-directory/proc body) (define d (make-temporary-file "framework-autosave-test~a" #:copy-from 'directory)) (dynamic-wind void (λ () (parameterize ([current-directory d]) (body))) (λ () (delete-directory/files d)))) (define (wait-for-recover) (let loop () (define chan (make-channel)) (queue-callback (λ () (define f (test:get-active-top-level-window)) (channel-put chan (and f (equal? (string-constant recover-autosave-files-frame-title) (send f get-label))))) #f) (or (channel-get chan) (loop)))) (define (wait-for-recover-gone f1) (let loop () (define keep-going-chan (make-channel)) (queue-callback (λ () (define f2 (test:get-active-top-level-window)) (cond [(equal? f1 f2) (channel-put keep-going-chan #t)] [(not f2) (channel-put keep-going-chan #f)] [else ;; this is some debugging code; we don't expect any ;; new windows to show up, so printout what it is (pretty-write (let loop ([w f2]) (cond [(is-a? w area-container<%>) (for/list ([w (in-list (send w get-children))]) (loop w))] [(is-a? w message%) (vector "message%" (send w get-label))] [(is-a? w button%) (vector "button%" (send w get-label))] [(and (is-a? w editor-canvas%) (is-a? (send w get-editor) text%)) (vector "tet%" (send (send w get-editor) get-text))] [else w])) (current-error-port)) (error 'wait-for-recover-gone "a frame that's not the recovery frame")])) #f) (when (channel-get keep-going-chan) (loop)))) (define (fetch-content fn) (define sp (open-output-string)) (call-with-input-file fn (λ (p) (copy-port p sp))) (get-output-string sp)) (parameterize ([test:use-focus-table #t]) (printf "framework/tests/autosave.rkt: test that the window opens\n") (let () (define t (thread (λ () (define f (wait-for-recover)) (test:button-push (string-constant autosave-done)) (wait-for-recover-gone f)))) (in-scratch-directory (call-with-output-file "x.rkt" void) (autosave:restore-autosave-files/gui (list (list #f (build-path (current-directory) "x.rkt")))) (yield t) (void))) (printf "framework/tests/autosave.rkt: test that the window opens and no files change when we just click ”done“\n") (let () (define t (thread (λ () (define f (wait-for-recover)) (test:button-push (string-constant autosave-done)) (wait-for-recover-gone f)))) (in-scratch-directory (call-with-output-file "x.rkt" (λ (p) (displayln "x.rkt" p))) (call-with-output-file "y.rkt" (λ (p) (displayln "y.rkt" p))) (autosave:restore-autosave-files/gui (list (list (build-path (current-directory) "x.rkt") (build-path (current-directory) "y.rkt")))) (yield t) (check-equal? (fetch-content "x.rkt") "x.rkt\n") (check-equal? (fetch-content "y.rkt") "y.rkt\n") (void))) (printf "framework/tests/autosave.rkt: test that the window opens with a variety of items\n") (let () (define t (thread (λ () (define f (wait-for-recover)) (test:button-push (string-constant autosave-done)) (wait-for-recover-gone f)))) (in-scratch-directory (call-with-output-file "x.rkt" void) (call-with-output-file "y.rkt" void) (call-with-output-file "z.rkt" void) (call-with-output-file "a.rkt" void) (call-with-output-file "b.rkt" void) (call-with-output-file "c.rkt" void) (autosave:restore-autosave-files/gui (list (list #f (build-path (current-directory) "x.rkt")) (list (build-path (current-directory) "z.rkt") (build-path (current-directory) "c.rkt")) (list #f (build-path (current-directory) "y.rkt")) (list (build-path (current-directory) "a.rkt") (build-path (current-directory) "b.rkt")))) (yield t) (void))) (printf "framework/tests/autosave.rkt: test that we can click on the details button\n") (let () (define t (thread (λ () (define f (wait-for-recover)) (test:button-push (string-constant autosave-details)) (test:button-push (string-constant autosave-done)) (wait-for-recover-gone f)))) (in-scratch-directory (call-with-output-file "x.rkt" void) (call-with-output-file "y.rkt" void) (autosave:restore-autosave-files/gui (list (list #f (build-path (current-directory) "x.rkt")) (list #f (build-path (current-directory) "y.rkt")))) (yield t) (void))) (printf "framework/tests/autosave.rkt: test that we can restore a file\n") (let () (define t (thread (λ () (define f (wait-for-recover)) (test:button-push (string-constant autosave-recover)) (test:button-push (string-constant autosave-done)) (wait-for-recover-gone f)))) (in-scratch-directory (call-with-output-file "x.rkt" (λ (p) (displayln "x.rkt" p))) (call-with-output-file "y.rkt" (λ (p) (displayln "y.rkt" p))) (autosave:restore-autosave-files/gui (list (list (build-path (current-directory) "x.rkt") (build-path (current-directory) "y.rkt")))) (yield t) (check-false (file-exists? "y.rkt")) (check-equal? (fetch-content "x.rkt") "y.rkt\n"))) )
true
f14e5de43e0f1fd4447f9bab1615ae1823cdcb8c
cce7569795ef6aa32f0ed1d1a5f0798d41f734d4
/underconstruction/11-semanticsofisl.scrbl
6da4f299928df4023ba423428e7cc94e7c238332
[]
no_license
klauso/KdP2012
09ab42ceb0e89881ebfccc1e8daf1f1e715695c3
c0d0c34d3a7816c6aeb93d29d09822b151f44b86
refs/heads/master
2020-04-25T11:35:10.526171
2012-07-12T07:41:03
2012-07-12T07:41:03
3,492,527
1
0
null
null
2012-02-20T10:02:45
Racket
UTF-8
Racket
false
false
11,167
scrbl
11-semanticsofisl.scrbl
#lang scribble/manual @(require scribble/eval) @(require scribble/core) @(require "marburg-utils.rkt") @(require (for-label lang/htdp-beginner)) @(require (for-label (except-in 2htdp/image image?))) @(require (for-label 2htdp/universe)) @(require scribble/bnf) @(require scribble/decode scribble/html-properties scribble/latex-properties) @(define inbox-style (make-style "InBox" (list (make-css-addition "inbox.css") (make-tex-addition "inbox.tex")))) @title[#:version ""]{Bedeutung von ISL+} In diesem Abschnitt wollen wir genau definieren, was die neuen Sprachkonstrukte, die wir kennengelernt haben (insbesondere lokale Definitionen und Funktionen als Werte), bedeuten. In der Terminologie von HTDP/2e heißt diese Sprache ISL+ oder "Zwischenstufe mit Lambda". Wir werden wieder die Bedeutung in Form von Reduktionsschritten angeben. Allerdings werden wir diesmal die Reduktionsschritte anders aufschreiben, nämlich als Programm in ISL+! Den kompletten Code (und mehr) dieses Kapitels finden Sie unter @url{https://github.com/klauso/KdP2012/raw/master/islinterpreter.rkt} (für die vollständige Version) oder @url{https://github.com/klauso/KdP2012/raw/master/islinterpreterwostructs.rkt} (für die vereinfachte Version ohne Strukturen). Man könnte sagen, dass wir eine Variante des "Stepper" aus DrRacket definieren. Wir haben uns aus mehreren Gründen dafür entschieden, die Bedeutung von ISL+ als ISL+ Programm zu definieren. Zum einen wird dadurch die Bedeutungsdefinition "lebendiger" --- sie können damit Programme ausführen, testen, mit Varianten und "was wäre wenn" Szenarien experimentieren. Zum zweiten lernen Sie einige wichtige Programmiertechniken kennen, die unabhängig von dieser Sprache für jeden Programmierer relevant sind. Zum dritten ist ein Lernziel dieses Kurses, dass sie nicht nur eigene Programme von Null auf neu schreiben können, sondern auch bestehende, größere Programme lesen, verstehen und erweitern können. @section{Syntax von Kern-ISL+} Wir werden nicht die gesamte Sprache ISL+ modellieren, sondern wie sie es bereits aus den vorherigen Kapiteln kennen, nur die Kernkonstrukte; was als syntaktischer Zucker darauf aufbauend definiert werden kann, lassen wir aus. Durch die λ-Notation wird die Kernsprache erstmal deutlich vereinfacht, weil wir nicht mehr zwischen Variablendefinitionen und Funktionsdefinitionen unterscheiden müssen, daher nehmen wir nur Syntax für Variablendefinitionen in unsere formale Syntaxdefinition auf. Aus dem gleichen Grund muss syntaktisch nicht mehr zwischen primitiven Werten und primitiven Funktionen unterschieden werden. In diesem Abschnitt verzichten wir der Einfachheit halber auf die Behandlung der boolschen Operatoren, da es diesbezüglich nichts neues im Vergleich zur Definition aus Abschnitt @secref{semanticsbsl} gibt. Außerdem verzichten wir hier auf die Behandlung von Strukturen; in der Vorlesung werden wir jedoch die Variante des Interpreters mit Unterstützung für Strukturen (oben verlinkt) präsentieren. Wenn Sie dieses einfachere Programm verstanden haben, werden sie dann auch ohne Probleme das größere Programm mit Unterstützung für Strukturen verstehen. Insgesamt ergibt sich folgende Syntax für die Kernsprache: @(define open (litchar "(")) @(define close (litchar ")")) @(define lb (litchar "[")) @(define rb (litchar "]")) @(define (mv s) (make-element #f (list (make-element 'italic s)))) @BNF[(list @nonterm{definition} @BNF-seq[open @litchar{define} @nonterm{name} @nonterm{e} close]) (list @nonterm{e} @BNF-seq[open @nonterm{e} @kleeneplus[@nonterm{e}] close] @BNF-seq[open @litchar{lambda} open @kleeneplus[@nonterm{name}] close @nonterm{e} close] @BNF-seq[open @litchar{local} lb @kleeneplus[@nonterm{definition}] rb @nonterm{e} close] @BNF-seq[open @litchar{cond} @kleeneplus[@BNF-group[@BNF-seq[lb @nonterm{e} @nonterm{e} rb ] ]] close] @nonterm{name} @nonterm{v} ) (list @nonterm{v} @BNF-seq[open @litchar{closure} open @litchar{lambda} open @kleeneplus[@nonterm{name}] close @nonterm{e} close @nonterm{env} close] @nonterm{number} @nonterm{boolean} @nonterm{string} @nonterm{image} @nonterm{+} @nonterm{*} @nonterm{...})] ] Wenn wir die Reduktionsschritte als ISL+ Programm definieren wollen, müssen wir uns erstmal überlegen, wie wir Programme repräsentieren. Zu diesem Zweck können wir Datentypen so definieren, daß sie genau den Nichtterminalen der Grammatik entsprechen. Jede Alternative einer Regel können wir als Produkttypen definieren und die Menge aller Alternativen als Summentyp. Die Terminalsymbole (wie @litchar{define}) sind hierbei nicht interessant, sondern wir repräsentieren nur die relevanten Informationen: @#reader scribble/comment-reader (racketblock (define-struct var-def (name e)) ; a Var-Def is: (make-var-def String Exp) (define-struct app (fun args)) (define-struct lam (args body)) (define-struct var (x)) (define-struct locl (defs e)) (define-struct closure (args body env)) (define-struct cnd (clauses)) (define-struct cnd-clause (c e)) (define-struct primval (v)) ; a Value is either ; - (make-primval Any) ; - (make-closure (list-of Symbol) Exp Env) ; an Exp is either: ; - a Value ; - (make-app Exp (list-of Exp)) ; - (make-lam (list-of Symbol) Exp) ; - (make-var Symbol) ; - (make-locl (list-of Var-Def) Exp) ; - (make-cnd (list-of (make-cnd-clause Exp Exp))) ) @section{Umgebungen} @#reader scribble/comment-reader (racketblock ; Exp -> Boolean (define (value? e) (or (closure? e) (primval? e))) ; (list-of Exp) -> Boolean ; are all elements in the list values? (define (all-value? es) (foldr (lambda (v b) (and (value? v) b)) true es)) ; an Env is a (list-of (make-var-def Value)) ; (list-of Var-Def) -> Boolean ; determines whether env is an Env (define (env? env) (or (empty? env) (and (var-def? (first env)) (value? (var-def-e (first env))) (env? (rest env))))) ; Env Symbol -> Value ; looks up x in (append env intial-env) (define (lookup-env env x) (cond [(empty? env) (error (string-append "Unbound variable: " (symbol->string x)))] [(and (var-def? (first env)) (eq? (var-def-name (first env)) x)) (var-def-e (first env))] [else (lookup-env (rest env) x)])) ) @section{Reduktion von Ausdrücken} @#reader scribble/comment-reader (racketblock ; Exp Env -> Exp ; reduces an expression in an environment (define (reduce e env) (cond [(app? e) (reduce-app (app-fun e) (app-args e) env)] [(lam? e) (make-closure (lam-args e) (lam-body e) env)] [(var? e) (lookup-env env (var-x e))] [(locl? e) (reduce-local (locl-defs e) (locl-e e) env)] [(cnd? e) (reduce-cond (cnd-clause-c (first (cnd-clauses e))) (cnd-clause-e (first (cnd-clauses e))) (rest (cnd-clauses e)) env)] [else (error "Cannot reduce: " e)])) ) @subsection{Reduktion von Funktionsapplikation} @#reader scribble/comment-reader (racketblock ; Exp (list-of Exp) Env -> Exp ; reduction of an application of fun to args in env (define (reduce-app fun args env) (cond ; expression has the form (v-1 v-2 ... v-n)? [(and (value? fun) (all-value? args)) (cond [(closure? fun) (make-locl (closure-env fun) (make-locl (map make-var-def (closure-args fun) args) (closure-body fun)))] [(primval? fun) (apply (primval-v fun) args)])] ; expression has the form (v-0 v-1 ... e-i ... e-n)? [(value? fun) ; reduce leftmost non-value (make-app fun (reduce-first args env))] [else ; expression has the form (e-0 ... e-n)? ; then reduce function argument (make-app (reduce fun env) args )])) ; (list-of Exp) -> (list-of Exp) ; reduces first non-value of es (define (reduce-first es env) (if (value? (first es)) (cons (first es) (reduce-first (rest es) env)) (cons (reduce (first es) env) (rest es)))) ) @subsection{Reduktion lokaler Definitionen} @#reader scribble/comment-reader (racketblock ; (list-of Var-Def) Exp Env -> Exp ; reduction of (local defs e) in env (define (reduce-local defs e env) (cond ; expression has the form (local [(define x-1 v1)...] v)? [(and (env? defs) (value? e)) ; then reduce to v e] ; expression has the form (local [(define x-1 v1)...] e)? [(env? defs) ; then reduce e (make-locl defs (reduce e (append defs env)))] [else ; expression has the form ; (local [(define x-1 v1)...(define x-i e-i) ...] e) ? ; then reduce left-most e-i which is not a value (make-locl (reduce-first-def defs env) e)])) ; (list-of Def) Env -> (list-of Def) ; reduces the first expression which is not a value ; in a list of definitions (define (reduce-first-def defs env) (cond [(value? (var-def-e (first defs))) (cons (first defs) (reduce-first-def (rest defs) (cons (first defs) env)))] [else (cons (make-var-def (var-def-name (first defs)) (reduce (var-def-e (first defs)) env)) (rest defs))])) ) @subsection{Reduktion konditionaler Ausdrücke} @#reader scribble/comment-reader (racketblock ; Exp Exp (list-of (make-cnd-clause Exp Exp) -> Exp ; reduction of a cond expression (define (reduce-cond condition e clauses env) (cond ; expression has the form (cond [(v e) rest])? [(value? condition) ; check if v is true or v is false (if (primval-v condition) e ; if true reduce to e (make-cnd clauses))] ; if false reduce to (cond [rest]) [else ; expression has the form (cond [(e-1 e-2) rest]) ; and e-1 is not a value? ; then reduce e-1 (make-cnd (cons (make-cnd-clause (reduce condition env) e) clauses))])) ) @subsection{Auswertung von Ausdrücken} @#reader scribble/comment-reader (racketblock ; Exp -> Value ; reduces expression until it becomes a value (or loops) (define (eval e) (if (value? e) e (eval (reduce e empty)))) ) @section{Ist das keine zirkuläre Sprachdefinition?} Wir haben im Interpreter zwar ISL+-Features benutzt, aber nicht in einer essentiellen Art und Weise (wir könnten ihn leicht so umbauen, dass er nur BSL-Features benutzt). Insbesondere verwenden wir lokale Definitionen und λ nicht in essentieller Art und Weise. Für BSL haben wir bereits die Bedeutung definiert. Es gibt jedoch Eigenschaften der Sprache, deren Bedeutung durch diese Reduktionssemantik nicht festgelegt wird, wie beispielsweise die Präzision der Arithmetik oder was passiert wenn durch 0 dividiert wird. @section{Ist dies ein Interpreter?} Nein, Interpreter ist typischerweise "big-step".
false
f0a85fda30dcf42bd1e1f784b43742140e75497c
1be6d6a351510c03150a763f3f4a02e9f8f25ee6
/chapter_2/2.1-2.2.rkt
f719c94351da88263d17940df4b18c801ed3524d
[]
no_license
Alexander-Blair/sicp
c6fde5db4274465f37e50202e9dea07a4ce0587d
b6e035d023e233bf83f40b78ed9af4c08b873642
refs/heads/main
2023-07-09T21:53:37.987513
2021-08-10T09:31:01
2021-08-10T09:31:01
394,595,506
0
0
null
null
null
null
UTF-8
Racket
false
false
23,312
rkt
2.1-2.2.rkt
; 2.1 (define (make-rat n d) (let ((g (gcd n d)) (n-negative? (< n 0)) (d-negative? (< d 0))) (cond ((or (and n-negative? d-negative?) (and (not n-negative?) (not d-negative?))) (cons (/ (abs n) g) (/ (abs d) g))) (n-negative? (cons (/ n g) (/ d g))) (d-negative? (cons (/ (- n) g) (/ (- d) g)))))) ; 2.2 (define (average a b) (/ (+ a b) 2)) (define (make-segment start-point end-point) (cons start-point end-point)) (define (start-segment segment) (car segment)) (define (end-segment segment) (cdr segment)) (define (make-point x y) (cons x y)) (define (x-point point) (car point)) (define (y-point point) (cdr point)) (define (midpoint-segment segment) (cons (average (x-point (start-segment segment)) (x-point (end-segment segment))) (average (y-point (start-segment segment)) (y-point (end-segment segment))))) ; 2.3 ; Implementation 1 (using two segments, a top and a left, to represent rectangle (define (make-rectangle top-segment left-segment) (cons top-segment left-segment)) (define (top-segment rectangle) (car rectangle)) (define (left-segment rectangle) (cdr rectangle)) (define (height rectangle) (abs (- (y-point (start-segment (left-segment rectangle))) (y-point (end-segment (left-segment rectangle)))))) (define (width rectangle) (abs (- (x-point (start-segment (top-segment rectangle))) (x-point (end-segment (top-segment rectangle)))))) ; Implementation 2 (using two points to represent rectangle, top left and bottom right) (define (make-rectangle top-left bottom-right) (cons top-left bottom-right)) (define (top-left rectangle) (car rectangle)) (define (bottom-right rectangle) (cdr rectangle)) (define (height rectangle) (abs (- (y-point (bottom-right rectangle)) (y-point (top-left rectangle))))) (define (width rectangle) (abs (- (x-point (bottom-right rectangle)) (x-point (top-left rectangle))))) ; Perimeter and area methods (define (perimeter rectangle) (+ (* 2 (height rectangle)) (* 2 (width rectangle)))) (define (area rectangle) (* (height rectangle) (width rectangle))) ; 2.4 (define (cons x y) (lambda (m) (m x y))) (define (car z) (z (lambda (p q) p))) ; Definition of cdr: (define (cdr z) (z (lambda (p q) q))) ; 2.5 (define (power x e) (define (iter e total) (cond ((= e 0) total) (else (iter (- e 1) (* total x))))) (iter e 1)) (define (cons x y) (* (power 2 x) (power 3 y))) (define (get-value pair base) (define (iter n v) (if (not (= (modulo n base) 0)) v (iter (/ n base) (+ v 1)))) (iter pair 0)) (define (cdr pair) (get-value pair 3)) (define (car pair) (get-value pair 2)) ; 2.6 (define one (lambda (f) (lambda (x) (f x)))) (define two (lambda (f) (lambda (x) (f (f x))))) ; repeated function is defined in chapter 1.4 exercises (define (+ a b) (lambda (f) (lambda (x) ((repeated f b) ((a f) x))))) ; 2.7 (define (lower-bound interval) (car interval)) (define (upper-bound interval) (cdr interval)) ; 2.8 (define (sub-interval x y) (make-interval (abs (- (lower-bound x) (lower-bound y))) (abs (- (upper-bound x) (upper-bound y))))) ; 2.9 ; If we take two intervals initially defined (define int-1 (make-interval 6.12 7.48)) (define int-2 (make-interval 4.465 4.935)) ; Width of int-1 is 0.68 ; Width of int-2 is 0.235 (add-interval int-1 int-2) => (10.585 . 12.415) ; Width of result is 0.915 which equals width of int-1 + width of int-2 (mul-interval int-1 int-2) => (27.3258 . 36.9138) ; Width of result 4.794 ; To show that the new width is not purely a function of the initial widths, ; take the following example, where the widths remain the same, but the upper ; and lower bounds are incremented by 1: (define int-3 (make-interval 7.12 8.48)) (define int-4 (make-interval 5.465 5.935)) ; Width of int-1 is 0.68 ; Width of int-2 is 0.235 (mul-interval int-3 int-4) => (38.9108 . 50.3288) ; Width of new interval is 5.709. As you can see, the resulting width cannot be ; calculated purely from the width alone ; 2.10 (define (div-interval x y) (cond ((= (upper-bound y) (lower-bound y)) (error "Cannot divide by interval that spans zero")) (else (mul-interval x (make-interval (/ 1.0 (upper-bound y)) (/ 1.0 (lower-bound y))))))) ; 2.11 (define (mul-interval x y) (let* ((low-x (lower-bound x)) (upper-x (upper-bound x)) (low-y (lower-bound y)) (upper-y (upper-bound y)) (x-negative? (negative? upper-x)) (y-negative? (negative? upper-y)) (x-non-negative? (not (negative? low-x))) (y-non-negative? (not (negative? low-y))) (x-crosses-zero? (and (not x-negative?) (not x-non-negative?))) (y-crosses-zero? (and (not y-negative?) (not y-non-negative?)))) (cond ((and x-non-negative? y-non-negative?) (make-interval (* low-x low-y) (* upper-x upper-y))) ((and x-negative? y-negative?) (make-interval (* upper-x upper-y) (* low-x low-y))) ((and x-non-negative? y-negative?) (make-interval (* upper-x low-y) (* low-x upper-y))) ((and x-negative? y-non-negative?) (make-interval (* low-x upper-y) (* low-x low-y))) ((and x-crosses-zero? y-non-negative?) (make-interval (* low-x upper-y) (* upper-x upper-y))) ((and x-non-negative? y-crosses-zero?) (make-interval (* upper-x low-y) (* upper-x upper-y))) ((and x-negative? y-crosses-zero?) (make-interval (* low-x upper-y) (* low-x low-y))) ((and x-crosses-zero? y-negative?) (make-interval (* upper-x low-y) (* low-x low-y))) ((and x-crosses-zero? y-crosses-zero?) (let ((p1 (* low-x low-y)) (p2 (* low-x upper-y)) (p3 (* upper-x low-y)) (p4 (* upper-x upper-y))) (make-interval (min p1 p2 p3 p4) (max p1 p2 p3 p4)))) (else (error "Invalid interval configuration"))))) ; 2.12 (define (make-center-percent c percent-tolerance) (let ((tolerance (/ percent-tolerance 100.0))) (make-interval (* c (- 1.0 tolerance)) (* c (+ 1.0 tolerance))))) ; 2.13 ; A rough approximation for the percentage tolerance of the product of two intervals ; is simply the sum of the percentages, assuming that both intervals are positive, and ; only when the percentage tolerances are small ; (define int-1 (make-center-percent 10 1)) => (9.9 . 10.1) ; (define int-2 (make-center-percent 12 1)) => (11.88 . 12.12) ; Product of the two intervals is (117.612 . 122.412) ; percentage tolerance is 1.9998 ; If we take the intervals (make-center-percent a 1) and (make-center-percent b 1) ; Lower bound of product is 0.9801ab ; Upper bound of product is 1.0201ab ; Tolerance of new interval is ; (1.0201ab - 0.9801ab) / 2 == 0.02ab ; Percentage tolerance is ; 100 * tolerance / (upper-bound - tolerance) ; => 100 * 0.02ab / (1.0201ab - 0.02ab) ; => 2ab / 1.0001ab, which is 2/1.0001 == 1.9998 (sum of initial percentages, minus a tiny bit) ; As the percentage grows, the divisor will also grow, reducing the accuracy. For example, at 10% ; (make-center-percent a 10) and (make-center-percent b 10) ; Lower bound of product is 0.81ab ; Upper bound of product is 1.21ab ; Tolerance of new interval is ; (1.21ab - 0.81ab) / 2 == 0.2ab ; Percentage tolerance is ; 100 * tolerance / (upper-bound - tolerance) ; => 100 * 0.2ab / (1.21ab - 0.2ab) ; => 20ab / 1.01ab, which is 20/1.01 == 19.8 (sum of initial percentages, minus a bit more) ; And if we then take a 50% percentage tolerance ; Lower bound is 0.25ab ; Upper bound is 2.25ab ; Tolerance of new interval is ; (2.25ab - 0.25ab) / 2 == ab ; Percentage tolerance is ; 100 * tolerance / (upper-bound - tolerance) ; => 100 * ab / (2.25ab - ab) ; => 100ab / 1.25ab, which is 100/1.25 == 80 (sum of initial percentages is now 20% off) ; 2.14 (define int-1 (make-center-percent 10 10)) (define int-2 (make-center-percent 10 1)) (define int-3 (make-center-percent 10 0.1)) (div-interval int-1 int-1) => (0.8181 . 1.2222) (div-interval int-3 int-3) => (0.9980 . 1.0020) ; When dividing an interval by itself, the smaller the percentage tolerance, the closer ; dividing it by itself equals one i.e. (make-interval 1 1) ; If you take the two formulas, (R1 * R2) / (R1 + R2), and 1 / (1/R1 + 1/R2) ; the second is a derivative of the first, if you divide both sides by R1 * R2 ; In the code equivalent of the second version, the formula doesn't seem to work ; due to the fact that 1 / R1 * R1 does not equal 1. ;Hierarchical Data ; 2.17 (define (last-pair list) (if (null? (cdr list)) (car list) (last-pair (cdr list)))) ; 2.18 (define (reverse l) (define (iter new old) (if (null? old) new (iter (cons (car old) new) (cdr old)))) (iter (list) l)) ; 2.19 (define (first-denomination coin-values) (car coin-values)) (define (except-first-denomination coin-values) (cdr coin-values)) (define (no-more? coin-values) (null? coin-values)) ; The order has no effect, as all possible combinations are calculated ; 2.20 (define (same-parity . list) (if (even? (car list)) (filter list even?) (filter list odd?))) (define (filter items filter-fn) (cond ((null? items) nil) (else (if (filter-fn (car items)) (cons (car items) (filter (cdr items) filter-fn)) (filter (cdr items) filter-fn))))) ; 2.21 ; Not using map (define (square-list items) (define (square x) (* x x)) (if (null? items) nil (cons (square (car items)) (square-list (cdr items))))) ; Using map (define (square-list-new items) (map (lambda (x) (* x x)) items)) ; 2.22 ; Effectively, the squares that we calculating are being prepended to the list we are ; building each time ; Given that the first value of answer is nil, when cons is called for the first time, ; you'll end up with the first item squared and nil. The next time, through, the next ; call to cons will be with the second item squared, and the previous pair (first item ; squared and nil). So you'll end up prepending the latest item in the list ; Swapping the arguments to cons also doesn't work as the first call to cons will be with ; nil and the first item squared. Having nil as the first of a pair means the list will end ; up looking like this: (square-list (list 1 2 3 4 5)) => (((((() . 1) . 4) . 9) . 16) . 25) ; 2.23 (define (for-each fn items) (cond ((null? items) #t) (else (fn (car items)) (for-each fn (cdr items))))) ; 2.24 ; Interpreter gives (1 (2 (3 4))) ; ; Box interpretation: ; (1 (2 (3 4))) ; _ _ (2 (3 4)) ; |.|.| _ _ (3 4) ; |_|_| -> |.|.| _ _ _ _ ; | |_|_| -> |.|.| -> |.|/| ; 1 | |_|_| |_|_| ; 2 | | ; 3 4 ; ; Tree interpretation: ; (1 (2 (3 4))) ; / \ ; 1 . (2 (3 4)) ; / \ ; 2 . (3 4) ; / \ ; 3 4 ; 2.25 ; To grab the 7 out of the sequence (define items '(1 3 (5 7) 9)) (cdr (car (cdr (cdr items)))) (define items '((7))) (car (car items)) (define items '(1 (2 (3 (4 (5 (6 7))))))) (car (cdr (car (cdr (car (cdr (car (cdr (car (cdr (car (cdr items)))))))))))) ; Using repeated (from exercise 1.43) (define (repeated f n) (define (compose f g) (lambda (x) (f (g x)))) (define (iter g i) (cond ((= i 0) g) (else (iter (compose f g) (- i 1))))) (iter identity n)) ((repeated (lambda (items) (car (cdr items))) 6) items) ; 2.26 (define x (list 1 2 3)) (define y (list 4 5 6)) (append x y) => (1 2 3 4 5 6) (cons x y) => ((1 2 3) 4 5 6) (list x y) => ((1 2 3) (4 5 6)) ; 2.27 (define (deep-reverse l) (define (iter new old) (if (null? old) new (let ((current-item (if (pair? (car old)) (deep-reverse (car old)) (car old)))) (iter (cons current-item new) (cdr old))))) (iter (list) l)) ; 2.28 (define x (list (list 1 2) (list 3 4))) (define (fringe list) (cond ((null? list) nil) ((pair? (car list)) (fringe (append (car list) (cdr list)))) (else (cons (car list) (fringe (cdr list)))))) ; 2.29 (define (left-branch mobile) (car mobile)) (define (right-branch mobile) (car (cdr mobile))) (define (branch-length branch) (car branch)) (define (branch-structure branch) (car (cdr branch))) ; Part 2 (define (branch-weight branch) (if (number? (branch-structure branch)) (branch-structure branch) (total-weight (branch-structure branch)))) (define (total-weight mobile) (+ (branch-weight (left-branch mobile)) (branch-weight (right-branch mobile)))) ; Part 3 (define (torque branch) (* (branch-length branch) (branch-weight branch))) (define (balanced? mobile) (or (number? mobile) (and (= (torque (left-branch mobile)) (torque (right-branch mobile))) (balanced? (branch-structure (left-branch mobile))) (balanced? (branch-structure (right-branch mobile)))))) ; Part 4 ; When using cons instead of list to construct mobiles and branches, the only ; changes would be to the right sided selectors: (define (right-branch mobile) (cdr mobile)) (define (branch-structure branch) (cdr branch)) ; 2.30 ; Using no higher level abstractions (define (square-tree tree) (cond ((null? tree) nil) ((not (pair? tree)) (square tree)) (else (cons (square-tree (car tree)) (square-tree (cdr tree)))))) ; Using map abstraction (define (square-tree tree) (map (lambda (sub-tree) (if (pair? sub-tree) (square-tree sub-tree) (square subtree))) tree)) ; 2.31 (define (tree-map transform-fn tree) (map (lambda (sub-tree) (if (pair? sub-tree) (tree-map transform-fn sub-tree) (transform-fn sub-tree))) tree)) ; 2.32 (define (subsets s) (if (null? s) (list nil) (let ((rest (subsets (cdr s)))) (append rest (map (lambda (x) (cons (car s) x)) rest))))) ; The collection is built from the base case upwards. ; In the example (subsets (list 1 2 3)), we will recurse until ; we reach the terminating case, the list of an empty list (()) ; ; We then prepend the final element of the list (which is 3) to each ; list in the base case: ; ((3)) ; ; and then append that onto the existing list: ; (() (3)) ; ; This step is then repeated. We prepend the next previous list element, ; which is 2, to the already generated lists: ; ((2) (2 3)) ; ; and then append that list onto the first: ; (() (3) (2) (2 3)) ; ; Repeating the procedure for 1: ; ((1) (1 3) (1 2) (1 2 3)) ; ; And appending the new list: ; (() (3) (2) (2 3) (1) (1 3) (1 2) (1 2 3)) ; 2.33 (define (map p sequence) (accumulate (lambda (x y) (cons (p x) y)) nil sequence)) (define (append seq1 seq2) (accumulate cons seq2 seq1)) (define (length sequence) (accumulate (lambda (x y) (inc y)) 0 sequence)) ; 2.34 (define (horner-eval x coefficient-sequence) (accumulate (lambda (this-coeff sum) (+ this-coeff (* x sum))) 0 coefficient-sequence)) ; 2.35 (define (count-leaves t) (accumulate (lambda (x y) (inc y)) 0 (enumerate-tree t))) ; Also works as (define (count-leaves t) (accumulate + 0 (map (lambda (x) 1) (enumerate-tree t)))) ; 2.36 (define (accumulate-n op init seqs) (if (null? (car seqs)) nil (cons (accumulate op init (map car seqs)) (accumulate-n op init (map cdr seqs))))) ; 2.37 (define (dot-product v w) (accumulate + 0 (map * v w))) (define (matrix-*-vector m v) (map (lambda (matrix-vector) (dot-product matrix-vector v)) m)) (define (transpose mat) (accumulate-n cons nil mat)) (define (matrix-*-matrix m n) (let ((cols (transpose n))) (map (lambda (v) (matrix-*-vector cols v)) m))) ; 2.38 ; For fold-left and fold-right to produce the same output, op should be commutative. ; i.e. multiplication will produce the same result: a * b == b * a ; division will not since a / b != b / a ; 2.39 ; reverse with fold-right (define (reverse sequence) (fold-right (lambda (x y) (append y (list x))) nil sequence)) ; reverse with fold-left (define (reverse sequence) (fold-left (lambda (x y) (cons y x)) nil sequence)) ; 2.40 (define (unique-pairs n) (flatmap (lambda (i) (map (lambda (j) (list i j)) (enumerate-interval 1 (- i 1)))) (enumerate-interval 1 n))) ; 2.41 ; To generate unique tuples of arbitrary size: (define (unique-tuples size n) (accumulate (lambda (i combinations) (flatmap (lambda (tuple) (map (lambda (x) (cons x tuple)) (enumerate-interval i (if (null? tuple) n (- (car tuple) 1))))) combinations)) (list nil) (enumerate-interval 1 size))) (define (find-triples-with-sum n s) (filter (lambda (tuple) (= s (accumulate + 0 tuple))) (unique-tuples 3 n))) ; 2.42 (define (adjoin-position row-number column-number positions) (cons (list column-number row-number) positions)) (define (safe? k positions) (define (all-positions-safe? checking-position positions) (cond ((null? positions) #t) ((accessible? checking-position (car positions)) #f) (else (all-positions-safe? checking-position (cdr positions))))) (all-positions-safe? (car (filter (lambda (p) (= (car p) k)) positions)) positions)) (define (accessible? p1 p2) (let ((horizontal-distance (- (car p1) (car p2))) (vertical-distance (- (cadr p1) (cadr p2)))) (and (not (equal? p1 p2)) (or (= horizontal-distance 0) (= vertical-distance 0) (= (- (abs horizontal-distance) (abs vertical-distance)) 0))))) ; 2.43 ; By interchanging the nested mappings in the queen-cols function, we'd ; end up calling the queen-cols function rows * columns times, instead of ; just once per column. This would suggest that since 6^2 is 36, and 8^2 ; is 64, it'd take T * 64 / 36 = 16T/9 (or roughly 1.8 times) ; 2.44 (define (up-split painter n) (if (= n 0) painter (let ((smaller (up-split painter (- n 1)))) (below painter (beside smaller smaller))))) ; 2.45 (define (split op1 op2) (define (repeat painter n) (if (= n 0) painter (let ((smaller (repeat painter (- n 1)))) (op1 painter (op2 smaller smaller))))) repeat) ; 2.46 (define (make-vect xcor ycor) (cons xcor ycor)) (define (xcor-vect v) (car v)) (define (ycor v) (cdr v)) (define (add-vect v1 v2) (cons (+ (car v1) (car v2)) (+ (cdr v1) (cdr v2)))) (define (sub-vect v1 v2) (cons (- (car v1) (car v2)) (- (cdr v1) (cdr v2)))) (define (scale-vect v scalar) (cons (* (car v) scalar) (* (cdr v) scalar))) ; 2.47 ; For the following constructor (define (make-frame origin edge1 edge2) (list origin edge1 edge2)) ; Selectors would be: (define (frame-origin frame) (car frame)) (define (frame-edge1 frame) (cadr frame)) (define (frame-edge2 frame) (caddr frame)) ; For the following constructor (define (make-frame origin edge1 edge2) (cons origin (cons edge1 edge2))) ; Selectors would be: (define (frame-origin frame) (car frame)) (define (frame-edge1 frame) (cadr frame)) (define (frame-edge2 frame) (cddr frame)) ; Only difference is the edge2 selector ; 2.48 (define (make-segment start-segment end-segment) (cons start-segment end-segment)) (define (start-segment segment) (car segment)) (define (end-segment segment) (cdr segment)) ; 2.49 (define (outline-painter frame) (let ((far-edge (add-vect (edge1-frame frame) (edge2-frame frame)))) ((segments->painter (list (make-segment (origin-frame frame) (edge1-frame frame)) (make-segment (origin-frame frame) (edge2-frame frame)) (make-segment (edge1-frame frame) far-edge) (make-segment (edge2-frame frame) far-edge))) frame))) (define (draw-x-painter frame) (let ((far-edge (add-vect (edge1-frame frame) (edge2-frame frame)))) ((segments->painter (list (make-segment (origin-frame frame) far-edge) (make-segment (edge1-frame frame) (edge2-frame frame)))) frame))) (define (draw-diamond frame) (let* ((edge1-midpoint (scale-vect 0.5 (edge1-frame frame))) (edge2-midpoint (scale-vect 0.5 (edge2-frame frame))) (opposite-edge1-midpoint (add-vect edge1-midpoint (edge2-frame frame))) (opposite-edge2-midpoint (add-vect edge2-midpoint (edge1-frame frame)))) ((segments->painter (list (make-segment edge1-midpoint edge2-midpoint) (make-segment edge2-midpoint opposite-edge1-midpoint) (make-segment opposite-edge1-midpoint opposite-edge2-midpoint) (make-segment opposite-edge2-midpoint edge1-midpoint))) frame))) ; 2.50 (define (flip-horiz painter) (transform-painter painter (make-vect 1.0 0.0) (make-vect 0.0 0.0) (make-vect 0.0 1.0))) (define (rotate180 painter) (transform-painter painter (make-vect 1.0 1.0) (make-vect 0.0 1.0) (make-vect 1.0 0.0))) (define (rotate270 painter) (transform-painter painter (make-vect 0.0 1.0) (make-vect 0.0 0.0) (make-vect 1.0 1.0))) ; 2.51 ; In the same vein as definition of beside: (define (below painter1 painter2) (let ((split-point (make-vect 0.0 0.5))) (let ((paint-bottom (transform-painter painter1 (make-vect 0.0 0.0) (make-vect 1.0 0.0) split-point)) (paint-top (transform-painter painter2 split-point (make-vect 1.0 0.5) (make-vect 0.0 1.0)))) (lambda (frame) (paint-bottom frame) (paint-top frame))))) ; In terms of beside + rotation: (define (below painter1 painter2) (rotate270 (beside (rotate90 painter2) (rotate90 painter1))))
false
18a6c330e63ef0b60a5c10074721b2ae1ceac19a
0f883648943e655da8cc34d105f01498ef2c6a4a
/lang/convert-type.rkt
0079344974a75d5347cce6b875797ca8fb642424
[]
no_license
lwhjp/rince
66d16857c957f6da47e1a92a8071d9bd562e826c
61664bfee27a53d18fcb9880e1202eb5cc8f4a5f
refs/heads/master
2021-12-24T21:17:33.561307
2021-08-10T14:06:03
2021-08-10T14:06:03
173,320,930
6
2
null
null
null
null
UTF-8
Racket
false
false
6,016
rkt
convert-type.rkt
#lang racket/base ;;; ;;; Type conversions ;;; (require (prefix-in r: (only-in racket/base void)) (except-in turnstile/base char? void void?) "rep.rkt" "types.rkt") (provide (for-syntax integer-promote common-real-type usual-arithmetic-conversion-types make-conversion) constrain-value decay-array) (define-for-syntax DEBUG #f) (define-for-syntax integer-conversion-ranks (list (list _Bool?) (list __int8? __uint8?) (list |signed char?| |unsigned char?| char?) (list __int16? __uint16?) (list |short int?| |unsigned short int?|) (list __int32? __uint32?) (list __int64? __uint64?) (list int? |unsigned int?|) (list |long int?| |unsigned long int?|) (list |long long int?| |unsigned long long int?|))) (define-for-syntax (integer-conversion-rank τ) (for/first ([r (in-naturals)] [ps (in-list integer-conversion-ranks)] #:when (memf (λ (p) (p τ)) ps)) r)) (define-for-syntax (integer-rank<? τ1 τ2) (define r1 (integer-conversion-rank τ1)) (define r2 (integer-conversion-rank τ2)) (< r1 r2)) (define-for-syntax (integer-promote τ) (define τ-int ((current-type-eval) #'int)) (cond [(integer-rank<? τ-int τ) τ] [(integer-type⊂? τ τ-int) τ-int] [else ((current-type-eval) #'|unsigned int|)])) (define-for-syntax (make-conversion τ_old τ_new stx) (when DEBUG (printf "convert ~a -> ~a\nexpr: ~a\n" (type->str τ_old) (type->str τ_new) stx)) (syntax-parse #`(#,((current-type-eval) τ_new) #,((current-type-eval) τ_old)) [(τ_new τ_old) #:when (type=? #'τ_new #'τ_old) (when DEBUG (displayln "same type")) stx] [(_ (~const base_old)) (when DEBUG (displayln "un-const old")) (make-conversion #'base_old τ_new stx)] [((~const base_new) _) (when DEBUG (displayln "un-const new")) (make-conversion τ_old #'base_new stx)] [((~Pointer _) (~Array base_old _)) (when DEBUG (displayln "array->pointer")) (make-conversion #'(Pointer base_old) τ_new #`(array->pointer #,stx))] [((~Pointer ~char) (~Pointer base_old)) (when DEBUG (displayln "int->raw")) ; TODO: handle non-integer types #`(integer->raw/pointer #,stx #,(sizeof/type #'base_old) #,(signed-integer-type? #'base_old))] [((~Pointer base_new) (~Pointer ~char)) (when DEBUG (displayln "raw->int")) ; TODO: handle non-integer types #`(raw->integer/pointer #,stx #,(sizeof/type #'base_new) #,(signed-integer-type? #'base_new))] [((~Pointer _) (~Pointer _)) (when DEBUG (displayln "pun")) ; TODO: handle non-integer types (make-conversion #'(Pointer char) τ_new (make-conversion τ_old #'(Pointer char) stx))] [_ #:when (and (basic-type? τ_old) (basic-type? τ_new)) (when DEBUG (displayln "basic")) (make-conversion/basic τ_old τ_new stx)] [_ (raise-syntax-error #f (format "unsupported type conversion: ~a -> ~a" (type->str τ_old) (type->str τ_new)) stx)])) (define-syntax constrain-value (syntax-parser [(_ τ:type e) (if (floating-type? #'τ.norm) #'e (with-syntax ([bits (integer-type-width #'τ.norm)]) (if (signed-integer-type? #'τ.norm) #'(constrain-integer/signed bits e) #'(constrain-integer/unsigned bits e))))])) (define-for-syntax (make-conversion/integer τ_old τ_new stx) (cond [(_Bool? τ_new) #`(->_Bool #,stx)] [(integer-type⊂? τ_old τ_new) stx] [else #`(constrain-value #,τ_new #,stx)])) (define-for-syntax (make-conversion/real+integer τ_old τ_new stx) (cond [(_Bool? τ_new) #`(->_Bool #,stx)] [(real-floating-type? τ_old) ; TODO: truncation of integer part is UB #`(inexact->exact (truncate #,stx))] [else #`(real->double-flonum #,stx)])) (define-for-syntax (make-conversion/real-floating τ_old τ_new stx) ; everything is a double-flonum stx) (define-for-syntax (make-conversion/arithmetic τ_old τ_new stx) (when (or (complex-type? τ_old) (complex-type? τ_new)) (error "TODO: complex arithmetic conversion")) (define i?-old (integer-type? τ_old)) (define i?-new (integer-type? τ_new)) (cond [(and i?-old i?-new) (make-conversion/integer τ_old τ_new stx)] [(or i?-old i?-new) (make-conversion/real+integer τ_old τ_new stx)] [else (make-conversion/real-floating τ_old τ_new stx)])) (define-for-syntax (make-conversion/basic τ_old τ_new stx) (cond [(void? τ_new) #`(r:void #,stx)] [(void? τ_old) (raise-syntax-error #f stx "invalid conversion from void")] [else (make-conversion/arithmetic τ_old τ_new stx)])) (define-for-syntax (common-real-type τ1 τ2) (define real-τ1 (corresponding-real-type τ1)) (define real-τ2 (corresponding-real-type τ2)) (cond [(|long double?| real-τ1) real-τ1] [(|long double?| real-τ2) real-τ2] [(double? real-τ1) real-τ1] [(double? real-τ2) real-τ2] [(float? real-τ1) real-τ1] [(float? real-τ2) real-τ2] [else (let ([p1 (integer-promote τ1)] [p2 (integer-promote τ2)]) (cond [(type=? p1 p2) p1] [(eq? (signed-integer-type? p1) (signed-integer-type? p2)) (if (integer-rank<? p1 p2) p2 p1)] [else (let-values ([(τu τs) (if (signed-integer-type? p1) (values p1 p2) (values p2 p1))]) (cond [(integer-rank<? τs τu) τu] [(integer-type⊂? τu τs) τs] [else (error "TODO: signed->unsigned type")]))]))])) (define-for-syntax (usual-arithmetic-conversion-types τ1 τ2) (define crt (common-real-type τ1 τ2)) ; TODO: complex (values crt crt crt)) (define-typed-syntax (decay-array v) ≫ [⊢ v ≫ v- ⇒ (~Array τ_e _)] #:with τ^ #'(Pointer τ_e) #:with v^ #'(array->pointer v-) -------- [⊢ v^ ⇒ τ^])
true
5cea3e1e1e3ac9fbccdffdddec1576df4fdc68e5
e29bd9096fb059b42b6dde5255f39d443f69caee
/metapict/pen-and-brush.rkt
3e16599c81d4edf10a66fd99f1318026ecda9bf0
[]
no_license
soegaard/metapict
bfe2ccdea6dbc800a6df042ec00c0c77a4915ed3
d29c45cf32872f8607fca3c58272749c28fb8751
refs/heads/master
2023-02-02T01:57:08.843234
2023-01-25T17:06:46
2023-01-25T17:06:46
16,359,210
52
12
null
2023-01-25T17:06:48
2014-01-29T21:11:46
Racket
UTF-8
Racket
false
false
556
rkt
pen-and-brush.rkt
#lang racket/base (provide find-white-transparent-brush find-white-transparent-pen) (require racket/draw racket/class) (define (find-white-transparent-brush) (send the-brush-list find-or-create-brush "white" 'transparent)) (define (find-white-transparent-pen) (send the-pen-list find-or-create-pen "white" 0 'transparent)) (module+ test (require rackunit "def.rkt") (def c (send (find-white-transparent-brush) get-color)) (check-true (and (= (send c red) (send c green) (send c blue) 255) (= (send c alpha) 1.0))))
false
a4d2e72cf42ccfd6a1fc6c25d75c3c438be354cd
099418d7d7ca2211dfbecd0b879d84c703d1b964
/whalesong/examples/sierpinski-carpet.rkt
3e6ba2c706ebb470ee652ce44ac45189bab6aba2
[]
no_license
vishesh/whalesong
f6edd848fc666993d68983618f9941dd298c1edd
507dad908d1f15bf8fe25dd98c2b47445df9cac5
refs/heads/master
2021-01-12T21:36:54.312489
2015-08-19T19:28:25
2015-08-19T20:34:55
34,933,778
3
0
null
2015-05-02T03:04:54
2015-05-02T03:04:54
null
UTF-8
Racket
false
false
1,518
rkt
sierpinski-carpet.rkt
#lang whalesong/base (require whalesong/image) ;; Sierpenski carpet. ;; http://rosettacode.org/wiki/Sierpinski_carpet#Scheme (define SQUARE (square 5 "solid" "red")) (define SPACE (square 5 "solid" "white")) (define (carpet n) (local [(define (in-carpet? x y) (cond ((or (zero? x) (zero? y)) #t) ((and (= 1 (remainder x 3)) (= 1 (remainder y 3))) #f) (else (in-carpet? (quotient x 3) (quotient y 3)))))] (letrec ([outer (lambda (i) (cond [(< i (expt 3 n)) (local ([define a-row (letrec ([inner (lambda (j) (cond [(< j (expt 3 n)) (cons (if (in-carpet? i j) SQUARE SPACE) (inner (add1 j)))] [else empty]))]) (inner 0))]) (cons (apply beside a-row) (outer (add1 i))))] [else empty]))]) (apply above (outer 0))))) (carpet 4)
false
7a69bdb20908e7d2fc471518a3449d741c09cb6e
d8c2b2aeffdd518c7836ddcd3228a05a22d8d2b9
/json-sourcery-lib/basics.rkt
064384df95d299fe85bc4a56f25e923ea238b6d6
[ "MIT" ]
permissive
adjkant/json-sourcery
18b1149fb7ecaf79991c5bf0dda8ac93816746c1
c6ee9a5de2f8a85dc58159dedeb1d2bb9a3f710f
refs/heads/master
2021-06-29T16:33:20.835017
2020-12-03T08:13:33
2020-12-03T08:13:33
174,752,672
2
1
MIT
2020-12-03T08:13:34
2019-03-09T22:24:34
CSS
UTF-8
Racket
false
false
679
rkt
basics.rkt
#lang racket (provide (all-defined-out)) (require (for-syntax syntax/parse racket/syntax)) ;; Any -> Any ;; displayln and return any value (define (tee x) (displayln x) x) ;; [List-of X] [List-of Y] -> [List-of (list X Y)] ;; zip two equal sized lists together, erroring if the lists are not equal (define (zip l1 l2) (map list l1 l2)) ;; Boolean Any -> Any U #false ;; return a value if a condition is true, otherwise false (define-syntax when/f (syntax-parser [(_ condition if-true) #'(if condition if-true #false)])) ;; [Syntax-of Id] -> String ;; Convert an identifier to a string (define (id->string id) (symbol->string (syntax-e id)))
true
ff7285147ecbf5cb918eafae2507518fbaee5a98
ddae9f912790ca2fb5eb271ce54a156560ea526e
/cs275/lab4/TreeDatatype.rkt
79a7f70a30b175b3b0f228cfedb5854a364e2bf3
[]
no_license
cmccahil/Classwork
489658e06a4f88ac56297a980494a0ced7613184
1ed775acfd6e0a9d511ad3bb795e76039d2fbb5a
refs/heads/master
2020-07-31T18:22:26.034292
2020-01-27T19:26:21
2020-01-27T19:26:21
210,707,952
0
0
null
null
null
null
UTF-8
Racket
false
false
1,737
rkt
TreeDatatype.rkt
#lang racket ; definition of tree datatype (provide tree? empty-tree? non-empty-tree? empty-tree non-empty-tree value list-of-children number-of-children leaf? makeTree) (provide Empty T1 T2 T3 T4 T5 T6 T7 T8) ; recognizers (define tree? (lambda (t) (or (empty-tree? t) (non-empty-tree? t)))) (define empty-tree? (lambda (x) (null? x))) (define non-empty-tree? (lambda (x) (cond [(list? x) (eq? (car x) 'tree)] [else #f]))) ; constructors (define empty-tree (lambda () null)) (define non-empty-tree (lambda (value list-of-children) (list 'tree value list-of-children))) ; Convenience constructor (define makeTree (lambda l (non-empty-tree (car l) (cdr l)))) ; utilty functions (define value (lambda (tree) (cond [(empty-tree? tree) 'error] [else (cadr tree)]))) (define list-of-children (lambda (tree) (cond [(empty-tree? tree) 'error] [else (caddr tree)]))) (define number-of-children (lambda (tr) (cond [(empty-tree? tr) 'error] [else (length (list-of-children tr))]))) (define leaf? (lambda (tr) (cond [(empty-tree? tr) 'error] [else (zero? (number-of-children tr))]))) ; example trees (define Empty (empty-tree)) (define T1 (makeTree 50)) (define T2 (makeTree 22)) (define T3 (makeTree 10)) (define T4 (makeTree 5)) (define T5 (makeTree 17)) (define T6 (makeTree 73 T1 T2 T3)) (define T7 (makeTree 100 T4 T5)) (define T8 (makeTree 16 T6 T7))
false
bd90a694a69095f72496763f6d62d5d8e749afd6
5fa722a5991bfeacffb1d13458efe15082c1ee78
/src/set_balanced_tree.rkt
63ea16b44698608466264ffcd24333b2532aef7d
[]
no_license
seckcoder/sicp
f1d9ccb032a4a12c7c51049d773c808c28851c28
ad804cfb828356256221180d15b59bcb2760900a
refs/heads/master
2023-07-10T06:29:59.310553
2013-10-14T08:06:01
2013-10-14T08:06:01
11,309,733
3
0
null
null
null
null
UTF-8
Racket
false
false
1,489
rkt
set_balanced_tree.rkt
#lang racket (require "set_tree.rkt") (require "c2_63.rkt") (require "c2_64.rkt") (define (union-ordered-list-set set1 set2) (cond ((null? set1) set2) ((null? set2) set1) ((< (car set1) (car set2)) (cons (car set1) (union-ordered-list-set (cdr set1) set2))) ((> (car set1) (car set2)) (cons (car set2) (union-ordered-list-set set1 (cdr set2)))) (else (cons (car set1) (union-ordered-list-set (cdr set1) (cdr set2)))))) (define (intersection-ordered-list-set set1 set2) (cond ((or (null? set1) (null? set2)) null) ((< (car set1) (car set2)) (intersection-ordered-list-set (cdr set1) set2)) ((> (car set1) (car set2)) (intersection-ordered-list-set set1 (cdr set2))) (else (cons (car set1) (intersection-ordered-list-set (cdr set1) (cdr set2)))))) ; set1/set2 is tree (define (union-set set1 set2) (let ((list1 (tree->list-2 set1)) (list2 (tree->list-2 set2))) (let ((unioned-list (union-ordered-list-set list1 list2))) (list->tree unioned-list)))) (define (intersection-set set1 set2) (let ((list1 (tree->list-2 set1)) (list2 (tree->list-2 set2))) (let ((intersected-list (intersection-ordered-list-set list1 list2))) (list->tree intersected-list)))) (provide (all-defined-out))
false
52b1db58193ecccf1b191fd5ae074da2266dde74
66ee0dd65a25484c064b09edb360a9b2a0217883
/lex_parser.rkt
c8c9ff6b3e9dae2dc4a2d726db1ba592524b372b
[]
no_license
Liudx1985/Lisp-Scheme-Haskell
337c1faceed9318905a7235379163bbe258d0bd0
f874b92b86cabc09ead4f6c711e7550561a9d628
refs/heads/master
2016-09-06T03:37:02.977060
2015-02-02T02:17:53
2015-02-02T02:17:53
18,743,986
2
0
null
null
null
null
UTF-8
Racket
false
false
4,545
rkt
lex_parser.rkt
#lang scheme (require parser-tools/lex (prefix-in : parser-tools/lex-sre) parser-tools/yacc) (provide (all-defined-out)) ; brace {} ; bracket [] ; Parentheses () (define-tokens value-tokens (NUM VAR STRING CHAR ASSIGN EXPLST DEFLST)) ; Ignored Gramma. (define-empty-tokens op-tokens (newline = OP CP OB CB QUOT SIG_QUOT ;[" '] COMMA SEMICOLON COLON COLON2;; [, ; :] + - * / ^ < > EOF NEG COMMENTC COMMENT INCLUDE ENUM STRUCT CLASS)) #| alphabetic lower-case upper-case title-case numeric symbolic punctuation graphic whitespace blank iso-control |# (define-lex-abbrevs (lower-letter (:/ "a" "z")) (upper-letter (:/ #\A #\Z)) ;; (:/ 0 9) would not work because the lexer does not understand numbers. (:/ #\0 #\9) is ok too. (digit (:/ "0" "9")) (alpha (:/ "A" "z")) (variable (:: (:or "_" alpha) (:* (:or "_" alpha digit))) ) (space (:? #\space)) (assign (:: space variable space "=" space (:or variable digit) space)) (def (:: space variable space variable space ";" space)) ) (define cxx-lexer (lexer [(eof) 'EOF] ["{" 'OB] ["}" 'CB] ["(" 'OP] [")" 'CP] ["\"" 'QUOT] ["'" 'SIG_QUOT] ["," 'COMMA] [";" 'SEMICOLON] [":" 'COLON] ["::" 'COLON2] ["struct" 'STRUCT] ["class" 'CLASS] ["#include" 'INCLUDE] ["enum" 'ENUM] ["struct" 'STRUCT] [#\newline 'newline] ; (token-newline) returns 'newline ;; recursively call the lexer on the remaining input after a tab or space. Returning the ;; result of that operation. This effectively skips all whitespace. [(:or #\tab #\space) (cxx-lexer input-port)] [(:: "//" (complement (:: any-string "\n" any-string))) 'COMMENT] ; C++ stype /* COMMENTs */ [(:: "/*" (complement (:: any-string "*/" any-string)) "*/") 'COMMENTC] ; C stype /* COMMENTs */ [(:or "=" "+" "-" "*" "/" "^" "<" ">") (string->symbol lexeme)] [(:+ digit) (token-NUM (string->number lexeme))] [(:: variable) (token-VAR (string->symbol lexeme))] [(:: "'" alpha "'") (token-CHAR lexeme)] ; any char [(:: "\"" (complement (:: any-string "\"" any-string)) "\"") (token-STRING lexeme)] ; any string [(:: variable (:+ #\space) assign ";") (token-ASSIGN lexeme)] [(:: (:or assign variable) (:? (:: "," (:or assign variable))) (:? ",")) (token-EXPLST lexeme)] [(:: (:+ def)) (token-DEFLST lexeme)] )) (define cxx-parser (parser (start start) (end newline EOF) (error void) (tokens value-tokens op-tokens) (precs (right =) (left - +) (left * /) (left NEG) (right ^) ) (yacc-output "d:/cxx.y") (grammar (start [() #f] ;; If there is an error, ignore everything before the error ;; and try to start over right after the error [(error start) $2] [(exp) $1]) (exp [(COMMENT) ":COMMENT"] [(COMMENTC) ":COMMENT-C"] [(NUM) (list ":numberic" $1)] [(CHAR) (list ":char" $1)] [(STRING) (list ":string" $1)] [(VAR) (list ":variable" $1)] [(EXPLST) (list ":explst" $1)] [(DEFLST) (list ":deflst" $1)] [(ASSIGN) (list ":=" $1)] [(VAR VAR = STRING SEMICOLON) (list $1 $2 "=s" $4)] [(VAR VAR = CHAR SEMICOLON) (list $1 $2 "=c" $4)] [(INCLUDE < exp >) (list ":include<" $3 ">")] [(INCLUDE STRING) (list ":include" $2)] [(ENUM VAR OB EXPLST CB SEMICOLON) (enum_proc $2 $4)] [(STRUCT VAR OB CB SEMICOLON) (struct_proc $2 "")] [(STRUCT VAR OB DEFLST CB SEMICOLON) (struct_proc $2 $4)] )) )) ;; run the calculator on the given input-port (define (CxxParse ip) (port-count-lines! ip) (letrec ((one-line (lambda () (let ((result (cxx-parser (lambda () (cxx-lexer ip))))) (when result (printf "~a\n" result) (one-line)))))) (one-line))) (define str "520 'k' \"I LOVE YOU\" /*@param a:any param default 0;\n*/ #include \"iostream\" #include <vector> int a =1; int a =c; // Fuck; int a =\"Son of **!\"; int a ='A'; enum color {red = 1,green = 4}; struct rgba{color clr;int alpha;};") (define enum_proc (lambda (name lst) (list name (string-split lst #px",")))) (define struct_proc (lambda (name lst) (list name (string-split lst #px";")))) (CxxParse (open-input-string str))
false
515eed53e6b7692d3c836f11c02d6c5bf29c1b12
627680558b42ab91471b477467187c3f24b99082
/results/24-hr-old/stlc-1-enum.rktd
f0908965dc8099922ef5f4a993688d48b528e4be
[]
no_license
bfetscher/dissertation
2a579aa919d6173a211560e20630b3920d108412
148d7f9bb21ce29b705522f7f4967d63bffc67cd
refs/heads/master
2021-01-12T12:57:45.507113
2016-10-06T06:54:21
2016-10-06T06:54:21
70,130,350
0
1
null
2016-10-06T14:01:38
2016-10-06T06:58:19
Racket
UTF-8
Racket
false
false
154,086
rktd
stlc-1-enum.rktd
(start 2015-02-23T21:29:19 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:29:19 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T21:29:19 (#:amount 17967280 #:time 229)) (heartbeat 2015-02-23T21:29:29 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:29:39 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:29:49 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:29:59 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:30:09 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:30:19 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:30:29 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-23T21:30:37 (#:model "stlc-1" #:type enum #:counterexample (hd 7) #:iterations 5846 #:time 77449)) (new-average 2015-02-23T21:30:37 (#:model "stlc-1" #:type enum #:average 77448.0 #:stderr +nan.0)) (heartbeat 2015-02-23T21:30:39 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T21:30:46 (#:amount 90643496 #:time 273)) (heartbeat 2015-02-23T21:30:49 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:30:59 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:31:09 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:31:19 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:31:29 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:31:39 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:31:49 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:31:59 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:32:09 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T21:32:11 (#:amount 89734392 #:time 237)) (heartbeat 2015-02-23T21:32:19 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:32:29 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:32:39 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:32:49 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:32:59 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:33:09 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:33:19 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:33:29 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:33:39 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T21:33:40 (#:amount 95712968 #:time 269)) (heartbeat 2015-02-23T21:33:49 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:33:59 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:34:09 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-23T21:34:11 (#:model "stlc-1" #:type enum #:counterexample ((+ (λ (a int) a)) 205) #:iterations 16316 #:time 214327)) (new-average 2015-02-23T21:34:11 (#:model "stlc-1" #:type enum #:average 145887.0 #:stderr 68439.0)) (heartbeat 2015-02-23T21:34:19 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:34:29 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:34:39 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:34:49 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:34:59 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T21:35:06 (#:amount 88400000 #:time 291)) (heartbeat 2015-02-23T21:35:09 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:35:19 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:35:29 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:35:39 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:35:49 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:35:59 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-23T21:36:08 (#:model "stlc-1" #:type enum #:counterexample (hd -18) #:iterations 9157 #:time 117311)) (new-average 2015-02-23T21:36:08 (#:model "stlc-1" #:type enum #:average 136361.66666666666 #:stderr 40645.18276636373)) (heartbeat 2015-02-23T21:36:09 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:36:19 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:36:29 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T21:36:31 (#:amount 97839432 #:time 273)) (heartbeat 2015-02-23T21:36:39 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:36:49 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:36:59 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:37:09 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:37:19 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:37:29 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:37:39 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:37:49 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T21:37:55 (#:amount 90166632 #:time 307)) (heartbeat 2015-02-23T21:37:59 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-23T21:38:00 (#:model "stlc-1" #:type enum #:counterexample (hd -1) #:iterations 8972 #:time 111988)) (new-average 2015-02-23T21:38:00 (#:model "stlc-1" #:type enum #:average 130268.25 #:stderr 29379.332322725895)) (heartbeat 2015-02-23T21:38:09 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:38:19 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:38:29 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:38:39 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:38:49 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:38:59 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:39:09 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:39:19 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T21:39:20 (#:amount 96058512 #:time 266)) (heartbeat 2015-02-23T21:39:29 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:39:39 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:39:49 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-23T21:39:55 (#:model "stlc-1" #:type enum #:counterexample (hd 3) #:iterations 9471 #:time 115078)) (new-average 2015-02-23T21:39:55 (#:model "stlc-1" #:type enum #:average 127230.2 #:stderr 22959.025424438205)) (heartbeat 2015-02-23T21:39:59 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:40:09 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:40:19 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:40:29 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:40:39 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T21:40:41 (#:amount 89079880 #:time 289)) (heartbeat 2015-02-23T21:40:49 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:40:59 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:41:09 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:41:19 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:41:29 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-23T21:41:34 (#:model "stlc-1" #:type enum #:counterexample (hd -6) #:iterations 7767 #:time 99226)) (new-average 2015-02-23T21:41:34 (#:model "stlc-1" #:type enum #:average 122562.83333333333 #:stderr 19318.269692041376)) (heartbeat 2015-02-23T21:41:39 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:41:49 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:41:59 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:42:09 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T21:42:13 (#:amount 97828592 #:time 271)) (heartbeat 2015-02-23T21:42:19 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-23T21:42:21 (#:model "stlc-1" #:type enum #:counterexample (hd 3) #:iterations 3441 #:time 46748)) (new-average 2015-02-23T21:42:21 (#:model "stlc-1" #:type enum #:average 111732.14285714286 #:stderr 19592.654282407268)) (heartbeat 2015-02-23T21:42:29 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:42:39 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:42:49 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:42:59 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:43:09 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:43:19 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:43:29 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:43:39 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T21:43:43 (#:amount 90720616 #:time 284)) (heartbeat 2015-02-23T21:43:49 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:44:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:44:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:44:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:44:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:44:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:44:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:45:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:45:10 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T21:45:13 (#:amount 94021496 #:time 269)) (heartbeat 2015-02-23T21:45:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:45:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:45:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:45:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:46:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:46:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:46:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:46:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:46:40 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T21:46:43 (#:amount 89748648 #:time 303)) (heartbeat 2015-02-23T21:46:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:47:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:47:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:47:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:47:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:47:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:47:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:48:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:48:10 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T21:48:16 (#:amount 96042672 #:time 268)) (heartbeat 2015-02-23T21:48:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:48:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:48:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:48:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:49:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:49:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:49:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:49:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:49:40 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T21:49:47 (#:amount 89949256 #:time 306)) (heartbeat 2015-02-23T21:49:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:50:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:50:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:50:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:50:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:50:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:50:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:51:00 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T21:51:03 (#:amount 95931944 #:time 222)) (heartbeat 2015-02-23T21:51:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:51:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:51:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:51:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:51:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:52:00 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T21:52:07 (#:amount 89405536 #:time 259)) (heartbeat 2015-02-23T21:52:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:52:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:52:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:52:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:52:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:53:00 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-23T21:53:01 (#:model "stlc-1" #:type enum #:counterexample (hd 1) #:iterations 51242 #:time 639878)) (new-average 2015-02-23T21:53:01 (#:model "stlc-1" #:type enum #:average 177750.375 #:stderr 68163.85443650193)) (heartbeat 2015-02-23T21:53:10 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T21:53:19 (#:amount 96615864 #:time 224)) (heartbeat 2015-02-23T21:53:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:53:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:53:40 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-23T21:53:47 (#:model "stlc-1" #:type enum #:counterexample (hd -1) #:iterations 4494 #:time 45687)) (new-average 2015-02-23T21:53:47 (#:model "stlc-1" #:type enum #:average 163076.66666666666 #:stderr 61879.844867784785)) (heartbeat 2015-02-23T21:53:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:54:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:54:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:54:20 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T21:54:29 (#:amount 90515984 #:time 271)) (heartbeat 2015-02-23T21:54:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:54:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:54:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:55:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:55:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:55:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:55:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:55:40 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T21:55:48 (#:amount 94567776 #:time 260)) (heartbeat 2015-02-23T21:55:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:56:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:56:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:56:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:56:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:56:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:56:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:57:00 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-23T21:57:02 (#:model "stlc-1" #:type enum #:counterexample (hd 31) #:iterations 16853 #:time 195626)) (new-average 2015-02-23T21:57:02 (#:model "stlc-1" #:type enum #:average 166331.59999999998 #:stderr 55442.64380143982)) (gc-major 2015-02-23T21:57:09 (#:amount 89685672 #:time 297)) (heartbeat 2015-02-23T21:57:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:57:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:57:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:57:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:57:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:58:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:58:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:58:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:58:30 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T21:58:33 (#:amount 96167104 #:time 263)) (heartbeat 2015-02-23T21:58:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:58:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:59:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:59:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:59:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:59:30 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-23T21:59:39 (#:model "stlc-1" #:type enum #:counterexample (hd -2) #:iterations 12671 #:time 156961)) (new-average 2015-02-23T21:59:39 (#:model "stlc-1" #:type enum #:average 165479.72727272726 #:stderr 50156.992917527714)) (heartbeat 2015-02-23T21:59:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T21:59:50 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T21:59:55 (#:amount 89484736 #:time 308)) (heartbeat 2015-02-23T22:00:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:00:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:00:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:00:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:00:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:00:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:01:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:01:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:01:20 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:01:27 (#:amount 96746992 #:time 270)) (heartbeat 2015-02-23T22:01:30 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-23T22:01:34 (#:model "stlc-1" #:type enum #:counterexample (hd 1) #:iterations 8687 #:time 114543)) (new-average 2015-02-23T22:01:34 (#:model "stlc-1" #:type enum #:average 161235.0 #:stderr 45983.19611619669)) (heartbeat 2015-02-23T22:01:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:01:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:02:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:02:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:02:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:02:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:02:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:02:50 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:02:56 (#:amount 90410144 #:time 280)) (heartbeat 2015-02-23T22:03:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:03:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:03:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:03:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:03:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:03:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:04:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:04:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:04:20 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:04:28 (#:amount 94599344 #:time 223)) (heartbeat 2015-02-23T22:04:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:04:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:04:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:05:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:05:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:05:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:05:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:05:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:05:50 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:05:51 (#:amount 89492264 #:time 276)) (heartbeat 2015-02-23T22:06:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:06:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:06:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:06:30 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-23T22:06:36 (#:model "stlc-1" #:type enum #:counterexample (hd 0) #:iterations 23217 #:time 302761)) (new-average 2015-02-23T22:06:36 (#:model "stlc-1" #:type enum #:average 172121.61538461538 #:stderr 43676.90527268628)) (heartbeat 2015-02-23T22:06:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:06:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:07:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:07:10 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:07:15 (#:amount 96480424 #:time 234)) (heartbeat 2015-02-23T22:07:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:07:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:07:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:07:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:08:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:08:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:08:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:08:30 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:08:37 (#:amount 89456808 #:time 257)) (heartbeat 2015-02-23T22:08:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:08:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:09:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:09:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:09:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:09:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:09:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:09:50 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:09:58 (#:amount 96583808 #:time 224)) (heartbeat 2015-02-23T22:10:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:10:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:10:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:10:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:10:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:10:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:11:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:11:10 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:11:19 (#:amount 90404296 #:time 293)) (heartbeat 2015-02-23T22:11:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:11:30 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-23T22:11:36 (#:model "stlc-1" #:type enum #:counterexample (hd 3) #:iterations 24494 #:time 300357)) (new-average 2015-02-23T22:11:36 (#:model "stlc-1" #:type enum #:average 181281.2857142857 #:stderr 41461.39210851631)) (heartbeat 2015-02-23T22:11:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:11:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:12:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:12:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:12:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:12:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:12:41 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:12:47 (#:amount 94707560 #:time 263)) (heartbeat 2015-02-23T22:12:51 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-23T22:12:58 (#:model "stlc-1" #:type enum #:counterexample (hd 0) #:iterations 6389 #:time 81709)) (new-average 2015-02-23T22:12:58 (#:model "stlc-1" #:type enum #:average 174643.13333333333 #:stderr 39165.109870888016)) (heartbeat 2015-02-23T22:13:01 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:13:11 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:13:21 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:13:31 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:13:41 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:13:51 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:14:01 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:14:07 (#:amount 89918048 #:time 297)) (heartbeat 2015-02-23T22:14:11 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:14:21 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:14:31 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:14:41 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:14:51 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:15:01 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:15:11 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:15:21 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:15:31 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:15:33 (#:amount 95957392 #:time 264)) (heartbeat 2015-02-23T22:15:41 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:15:51 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:16:01 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-23T22:16:11 (#:model "stlc-1" #:type enum #:counterexample (hd -5) #:iterations 15344 #:time 192871)) (new-average 2015-02-23T22:16:11 (#:model "stlc-1" #:type enum #:average 175782.375 #:stderr 36653.31463693234)) (heartbeat 2015-02-23T22:16:11 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:16:21 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:16:31 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:16:41 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:16:51 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:16:57 (#:amount 89742552 #:time 290)) (heartbeat 2015-02-23T22:17:01 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:17:11 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:17:21 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:17:31 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:17:41 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:17:51 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:18:01 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:18:11 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:18:21 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:18:25 (#:amount 96117592 #:time 267)) (heartbeat 2015-02-23T22:18:31 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:18:41 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:18:51 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:19:01 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:19:11 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:19:21 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:19:31 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:19:41 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:19:46 (#:amount 89503056 #:time 256)) (heartbeat 2015-02-23T22:19:51 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:20:01 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:20:11 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:20:21 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:20:31 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:20:41 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:20:51 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:21:01 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:21:11 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:21:19 (#:amount 96689296 #:time 272)) (heartbeat 2015-02-23T22:21:21 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:21:31 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:21:41 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:21:51 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:22:01 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:22:11 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:22:21 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:22:31 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:22:39 (#:amount 90335504 #:time 271)) (heartbeat 2015-02-23T22:22:41 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:22:51 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-23T22:22:51 (#:model "stlc-1" #:type enum #:counterexample (hd 0) #:iterations 31596 #:time 401033)) (new-average 2015-02-23T22:22:51 (#:model "stlc-1" #:type enum #:average 189032.41176470587 #:stderr 36891.38363504119)) (heartbeat 2015-02-23T22:23:01 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:23:11 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:23:21 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:23:31 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:23:41 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:23:51 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:24:01 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:24:04 (#:amount 94746168 #:time 219)) (heartbeat 2015-02-23T22:24:11 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:24:21 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:24:31 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:24:41 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:24:51 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:25:01 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:25:11 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:25:21 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:25:28 (#:amount 89778792 #:time 294)) (heartbeat 2015-02-23T22:25:31 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:25:41 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:25:51 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:26:01 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:26:11 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:26:21 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:26:31 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:26:41 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:26:51 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:26:58 (#:amount 95979280 #:time 265)) (heartbeat 2015-02-23T22:27:01 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:27:11 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:27:21 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:27:31 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-23T22:27:34 (#:model "stlc-1" #:type enum #:counterexample (hd -45) #:iterations 22226 #:time 282657)) (new-average 2015-02-23T22:27:34 (#:model "stlc-1" #:type enum #:average 194233.77777777778 #:stderr 35168.2959617509)) (heartbeat 2015-02-23T22:27:41 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:27:51 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:28:01 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:28:11 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:28:20 (#:amount 89887400 #:time 294)) (heartbeat 2015-02-23T22:28:21 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:28:31 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:28:41 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:28:51 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:29:01 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:29:11 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:29:21 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:29:31 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:29:41 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:29:46 (#:amount 95893360 #:time 267)) (heartbeat 2015-02-23T22:29:51 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:30:01 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:30:11 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:30:21 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:30:31 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:30:41 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:30:51 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:31:01 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:31:10 (#:amount 89314248 #:time 303)) (heartbeat 2015-02-23T22:31:11 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:31:21 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:31:31 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:31:41 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:31:51 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:32:01 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:32:11 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:32:21 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:32:31 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:32:39 (#:amount 96873896 #:time 265)) (heartbeat 2015-02-23T22:32:41 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:32:51 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:33:01 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:33:11 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:33:21 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:33:31 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:33:41 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:33:51 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:34:01 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:34:04 (#:amount 90208480 #:time 280)) (heartbeat 2015-02-23T22:34:11 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:34:21 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:34:31 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:34:41 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:34:51 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:35:01 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:35:11 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:35:21 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:35:31 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:35:34 (#:amount 94994760 #:time 262)) (heartbeat 2015-02-23T22:35:41 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:35:51 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:36:01 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:36:11 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:36:21 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:36:31 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:36:41 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:36:51 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:37:00 (#:amount 89468104 #:time 293)) (heartbeat 2015-02-23T22:37:01 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:37:11 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:37:22 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:37:32 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:37:42 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:37:52 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:38:02 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:38:12 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:38:22 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:38:29 (#:amount 96615528 #:time 243)) (heartbeat 2015-02-23T22:38:32 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:38:42 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:38:52 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-23T22:38:56 (#:model "stlc-1" #:type enum #:counterexample (hd 3) #:iterations 52753 #:time 682608)) (new-average 2015-02-23T22:38:56 (#:model "stlc-1" #:type enum #:average 219937.68421052632 #:stderr 42039.379412686576)) (heartbeat 2015-02-23T22:39:02 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:39:12 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:39:22 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:39:32 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:39:42 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:39:52 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:39:57 (#:amount 89874312 #:time 302)) (heartbeat 2015-02-23T22:40:02 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:40:12 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:40:22 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:40:32 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:40:42 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:40:52 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:41:02 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:41:12 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:41:22 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:41:29 (#:amount 95999176 #:time 261)) (heartbeat 2015-02-23T22:41:32 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:41:42 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:41:52 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:42:02 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:42:12 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:42:22 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:42:32 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:42:42 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:42:52 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:42:59 (#:amount 89758744 #:time 299)) (heartbeat 2015-02-23T22:43:02 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:43:12 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:43:22 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:43:32 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:43:42 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:43:52 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:44:02 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-23T22:44:04 (#:model "stlc-1" #:type enum #:counterexample (hd 3) #:iterations 22984 #:time 308154)) (new-average 2015-02-23T22:44:04 (#:model "stlc-1" #:type enum #:average 224348.5 #:stderr 40125.22616998071)) (heartbeat 2015-02-23T22:44:12 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:44:22 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:44:29 (#:amount 95766528 #:time 265)) (heartbeat 2015-02-23T22:44:32 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:44:42 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:44:52 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:45:02 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:45:12 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-23T22:45:19 (#:model "stlc-1" #:type enum #:counterexample ((+ (λ (a int) a)) -374) #:iterations 5963 #:time 75047)) (new-average 2015-02-23T22:45:19 (#:model "stlc-1" #:type enum #:average 217238.90476190476 #:stderr 38823.234919611685)) (heartbeat 2015-02-23T22:45:22 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:45:32 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:45:42 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:45:52 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:45:54 (#:amount 89869704 #:time 300)) (heartbeat 2015-02-23T22:46:02 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:46:12 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:46:22 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:46:32 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:46:42 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:46:52 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:47:02 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:47:12 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:47:22 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:47:27 (#:amount 95931296 #:time 268)) (heartbeat 2015-02-23T22:47:32 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:47:42 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:47:52 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:48:02 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:48:12 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:48:22 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:48:32 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:48:42 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:48:52 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:48:58 (#:amount 90454248 #:time 278)) (heartbeat 2015-02-23T22:49:02 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:49:12 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:49:22 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:49:32 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:49:42 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:49:52 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:50:02 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:50:12 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:50:22 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:50:30 (#:amount 95056944 #:time 263)) (heartbeat 2015-02-23T22:50:32 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:50:42 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:50:52 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:51:02 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:51:12 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:51:22 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:51:32 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:51:42 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:51:44 (#:amount 89467648 #:time 257)) (heartbeat 2015-02-23T22:51:52 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:52:02 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:52:12 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:52:22 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:52:32 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:52:42 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:52:52 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-23T22:53:00 (#:model "stlc-1" #:type enum #:counterexample (hd -1) #:iterations 35959 #:time 460711)) (new-average 2015-02-23T22:53:00 (#:model "stlc-1" #:type enum #:average 228305.81818181818 #:stderr 38635.45003716384)) (heartbeat 2015-02-23T22:53:02 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:53:03 (#:amount 96535872 #:time 261)) (heartbeat 2015-02-23T22:53:12 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:53:22 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:53:32 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:53:42 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:53:52 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:54:02 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:54:12 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:54:22 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:54:23 (#:amount 90096352 #:time 292)) (heartbeat 2015-02-23T22:54:32 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:54:42 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:54:52 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:55:02 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:55:12 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-23T22:55:22 (#:model "stlc-1" #:type enum #:counterexample ((λ (a int) -4) (hd -8)) #:iterations 11967 #:time 142732)) (new-average 2015-02-23T22:55:22 (#:model "stlc-1" #:type enum #:average 224585.21739130435 #:stderr 37104.461238059055)) (heartbeat 2015-02-23T22:55:22 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:55:32 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:55:42 (#:amount 95342136 #:time 261)) (heartbeat 2015-02-23T22:55:42 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:55:52 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:56:02 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:56:12 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:56:22 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:56:32 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:56:42 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:56:52 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:57:02 (#:amount 89707264 #:time 255)) (heartbeat 2015-02-23T22:57:02 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:57:12 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:57:22 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-23T22:57:31 (#:model "stlc-1" #:type enum #:counterexample (hd -11) #:iterations 10803 #:time 129490)) (new-average 2015-02-23T22:57:31 (#:model "stlc-1" #:type enum #:average 220622.91666666666 #:stderr 35745.10386731595)) (heartbeat 2015-02-23T22:57:32 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-23T22:57:34 (#:model "stlc-1" #:type enum #:counterexample (hd 5) #:iterations 255 #:time 2503)) (new-average 2015-02-23T22:57:34 (#:model "stlc-1" #:type enum #:average 211898.12 #:stderr 35378.20701111161)) (heartbeat 2015-02-23T22:57:42 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:57:52 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:58:02 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:58:12 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:58:21 (#:amount 96214536 #:time 220)) (heartbeat 2015-02-23T22:58:22 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:58:32 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:58:42 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:58:52 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:59:02 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:59:12 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:59:22 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:59:32 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T22:59:34 (#:amount 90287760 #:time 256)) (heartbeat 2015-02-23T22:59:42 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T22:59:52 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:00:02 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:00:12 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:00:22 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:00:32 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:00:42 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:00:52 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T23:00:53 (#:amount 95010240 #:time 269)) (heartbeat 2015-02-23T23:01:02 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:01:12 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:01:22 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:01:32 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:01:42 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:01:52 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:02:02 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T23:02:10 (#:amount 90565536 #:time 297)) (heartbeat 2015-02-23T23:02:12 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:02:22 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:02:32 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:02:42 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:02:52 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:03:02 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:03:12 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:03:22 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:03:32 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T23:03:40 (#:amount 94549096 #:time 262)) (heartbeat 2015-02-23T23:03:42 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:03:52 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:04:02 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:04:12 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:04:22 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:04:32 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:04:42 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:04:52 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:05:02 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T23:05:10 (#:amount 89749344 #:time 301)) (heartbeat 2015-02-23T23:05:13 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:05:23 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:05:33 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:05:43 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:05:53 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:06:03 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:06:13 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:06:23 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:06:33 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T23:06:35 (#:amount 96158792 #:time 261)) (heartbeat 2015-02-23T23:06:43 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:06:53 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:07:03 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:07:13 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:07:23 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:07:33 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:07:43 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:07:53 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-23T23:07:58 (#:model "stlc-1" #:type enum #:counterexample (hd 13) #:iterations 50381 #:time 623958)) (new-average 2015-02-23T23:07:58 (#:model "stlc-1" #:type enum #:average 227746.5769230769 #:stderr 37503.50445656526)) (heartbeat 2015-02-23T23:08:03 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T23:08:04 (#:amount 89695784 #:time 299)) (heartbeat 2015-02-23T23:08:13 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:08:23 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:08:33 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:08:43 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:08:53 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:09:03 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:09:13 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:09:23 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:09:33 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T23:09:37 (#:amount 96060208 #:time 266)) (heartbeat 2015-02-23T23:09:43 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:09:53 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:10:03 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:10:13 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:10:23 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:10:33 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:10:43 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:10:53 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:11:03 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T23:11:05 (#:amount 89910904 #:time 292)) (heartbeat 2015-02-23T23:11:13 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:11:23 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:11:33 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:11:43 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:11:53 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:12:03 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:12:13 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:12:23 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T23:12:25 (#:amount 95945480 #:time 265)) (heartbeat 2015-02-23T23:12:33 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:12:43 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:12:53 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:13:03 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:13:13 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:13:23 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:13:33 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:13:43 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:13:53 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T23:13:55 (#:amount 90503000 #:time 285)) (heartbeat 2015-02-23T23:14:03 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:14:13 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:14:23 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:14:33 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:14:43 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:14:53 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:15:03 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:15:13 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:15:23 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T23:15:25 (#:amount 94737200 #:time 264)) (heartbeat 2015-02-23T23:15:33 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:15:43 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:15:53 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:16:03 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:16:13 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:16:23 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:16:33 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:16:43 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:16:53 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T23:16:53 (#:amount 89664256 #:time 294)) (heartbeat 2015-02-23T23:17:03 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:17:13 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:17:23 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:17:33 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:17:43 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:17:53 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:18:03 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:18:13 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:18:23 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T23:18:28 (#:amount 96121880 #:time 268)) (heartbeat 2015-02-23T23:18:33 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-23T23:18:40 (#:model "stlc-1" #:type enum #:counterexample (hd 3) #:iterations 48318 #:time 641752)) (new-average 2015-02-23T23:18:40 (#:model "stlc-1" #:type enum #:average 243080.1111111111 #:stderr 39210.25351154588)) (heartbeat 2015-02-23T23:18:43 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:18:53 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:19:03 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:19:13 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:19:23 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:19:33 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:19:43 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T23:19:52 (#:amount 89493632 #:time 305)) (heartbeat 2015-02-23T23:19:53 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:20:03 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:20:13 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:20:23 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:20:33 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:20:43 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:20:53 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:21:03 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:21:13 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T23:21:17 (#:amount 96643536 #:time 265)) (heartbeat 2015-02-23T23:21:23 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:21:33 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:21:43 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:21:53 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:22:03 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:22:13 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:22:23 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:22:33 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T23:22:42 (#:amount 89773328 #:time 293)) (heartbeat 2015-02-23T23:22:43 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:22:53 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:23:03 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:23:13 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:23:23 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:23:33 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:23:43 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:23:53 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-23T23:24:00 (#:model "stlc-1" #:type enum #:counterexample (hd -1) #:iterations 25284 #:time 320513)) (new-average 2015-02-23T23:24:00 (#:model "stlc-1" #:type enum #:average 245845.57142857142 #:stderr 37885.014504852435)) (heartbeat 2015-02-23T23:24:03 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T23:24:07 (#:amount 96003680 #:time 265)) (heartbeat 2015-02-23T23:24:13 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:24:23 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:24:33 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:24:43 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:24:53 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:25:03 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:25:13 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:25:23 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:25:33 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T23:25:35 (#:amount 90371184 #:time 289)) (heartbeat 2015-02-23T23:25:43 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:25:53 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:26:03 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:26:13 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:26:23 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:26:33 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:26:43 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:26:53 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T23:26:54 (#:amount 94904384 #:time 263)) (heartbeat 2015-02-23T23:27:03 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:27:13 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:27:23 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:27:33 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:27:43 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-23T23:27:51 (#:model "stlc-1" #:type enum #:counterexample (hd 0) #:iterations 18388 #:time 231453)) (new-average 2015-02-23T23:27:51 (#:model "stlc-1" #:type enum #:average 245349.27586206896 #:stderr 36558.66788029908)) (heartbeat 2015-02-23T23:27:53 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:28:03 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:28:13 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-23T23:28:14 (#:model "stlc-1" #:type enum #:counterexample (hd 3) #:iterations 1735 #:time 22967)) (new-average 2015-02-23T23:28:14 (#:model "stlc-1" #:type enum #:average 237936.53333333333 #:stderr 36088.53745767303)) (gc-major 2015-02-23T23:28:20 (#:amount 89697896 #:time 296)) (heartbeat 2015-02-23T23:28:23 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:28:33 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:28:43 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:28:53 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:29:03 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:29:13 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:29:23 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:29:33 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:29:43 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T23:29:50 (#:amount 96067952 #:time 263)) (heartbeat 2015-02-23T23:29:53 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:30:03 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:30:13 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:30:23 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-23T23:30:25 (#:model "stlc-1" #:type enum #:counterexample (hd 0) #:iterations 9806 #:time 130787)) (new-average 2015-02-23T23:30:25 (#:model "stlc-1" #:type enum #:average 234480.09677419355 #:stderr 35075.70113041235)) (heartbeat 2015-02-23T23:30:33 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:30:43 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:30:53 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:31:03 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:31:13 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T23:31:20 (#:amount 89732888 #:time 303)) (heartbeat 2015-02-23T23:31:23 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:31:33 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:31:43 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:31:53 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:32:03 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:32:13 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:32:23 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:32:33 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:32:44 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T23:32:44 (#:amount 96286352 #:time 267)) (heartbeat 2015-02-23T23:32:54 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:33:04 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:33:14 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:33:24 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:33:34 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:33:44 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:33:54 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:34:04 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:34:14 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T23:34:14 (#:amount 90363568 #:time 275)) (heartbeat 2015-02-23T23:34:24 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:34:34 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:34:44 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:34:54 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:35:04 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:35:14 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:35:24 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:35:34 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:35:44 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T23:35:46 (#:amount 94794200 #:time 264)) (heartbeat 2015-02-23T23:35:54 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:36:04 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-23T23:36:10 (#:model "stlc-1" #:type enum #:counterexample (hd 8) #:iterations 25937 #:time 344964)) (new-average 2015-02-23T23:36:10 (#:model "stlc-1" #:type enum #:average 237932.71875 #:stderr 34136.95003491021)) (heartbeat 2015-02-23T23:36:14 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:36:24 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:36:34 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:36:44 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:36:54 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:37:04 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-23T23:37:04 (#:model "stlc-1" #:type enum #:counterexample (hd 3) #:iterations 3965 #:time 54048)) (new-average 2015-02-23T23:37:04 (#:model "stlc-1" #:type enum #:average 232360.45454545456 #:stderr 33552.27776412738)) (heartbeat 2015-02-23T23:37:14 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T23:37:16 (#:amount 89923712 #:time 305)) (heartbeat 2015-02-23T23:37:24 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:37:34 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:37:44 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:37:54 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:38:04 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:38:14 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:38:24 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:38:34 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:38:44 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T23:38:48 (#:amount 95599056 #:time 269)) (heartbeat 2015-02-23T23:38:54 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:39:04 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:39:14 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:39:24 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:39:34 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:39:44 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:39:54 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:40:04 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:40:14 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T23:40:16 (#:amount 90504512 #:time 290)) (heartbeat 2015-02-23T23:40:24 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:40:34 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:40:44 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:40:54 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:41:04 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:41:14 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:41:24 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:41:34 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:41:44 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T23:41:49 (#:amount 94848144 #:time 268)) (heartbeat 2015-02-23T23:41:54 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:42:04 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:42:14 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:42:24 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:42:34 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:42:44 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:42:54 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:43:04 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:43:14 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T23:43:17 (#:amount 89622048 #:time 296)) (heartbeat 2015-02-23T23:43:24 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:43:34 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:43:44 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:43:54 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:44:04 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:44:14 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:44:24 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:44:34 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:44:44 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T23:44:52 (#:amount 96405176 #:time 266)) (heartbeat 2015-02-23T23:44:54 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:45:04 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:45:14 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:45:24 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:45:34 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:45:44 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:45:54 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:46:04 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:46:14 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T23:46:21 (#:amount 89498912 #:time 303)) (heartbeat 2015-02-23T23:46:24 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:46:34 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:46:44 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:46:54 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:47:04 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:47:14 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:47:24 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:47:34 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:47:44 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-23T23:47:47 (#:model "stlc-1" #:type enum #:counterexample (hd -1) #:iterations 47577 #:time 642961)) (new-average 2015-02-23T23:47:47 (#:model "stlc-1" #:type enum #:average 244436.9411764706 #:stderr 34718.524881846206)) (gc-major 2015-02-23T23:47:53 (#:amount 96600240 #:time 268)) (heartbeat 2015-02-23T23:47:54 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:48:04 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-23T23:48:11 (#:model "stlc-1" #:type enum #:counterexample (hd 15) #:iterations 1765 #:time 23530)) (new-average 2015-02-23T23:48:11 (#:model "stlc-1" #:type enum #:average 238125.3142857143 #:stderr 34297.725538641556)) (heartbeat 2015-02-23T23:48:14 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:48:24 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:48:34 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:48:44 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:48:54 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:49:04 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-23T23:49:06 (#:model "stlc-1" #:type enum #:counterexample ((+ (λ (b int) b)) 2415) #:iterations 4164 #:time 55660)) (new-average 2015-02-23T23:49:06 (#:model "stlc-1" #:type enum #:average 233056.80555555556 #:stderr 33714.56466059856)) (heartbeat 2015-02-23T23:49:14 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T23:49:22 (#:amount 89549480 #:time 298)) (heartbeat 2015-02-23T23:49:24 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:49:34 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:49:44 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:49:54 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:50:04 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:50:14 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:50:24 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:50:34 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:50:44 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T23:50:53 (#:amount 96398664 #:time 265)) (heartbeat 2015-02-23T23:50:54 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:51:04 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:51:14 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:51:24 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:51:34 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:51:44 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:51:54 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:52:04 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:52:14 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T23:52:22 (#:amount 90524408 #:time 281)) (heartbeat 2015-02-23T23:52:24 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:52:34 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:52:44 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:52:54 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:53:04 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-23T23:53:05 (#:model "stlc-1" #:type enum #:counterexample (hd -2) #:iterations 17907 #:time 238843)) (new-average 2015-02-23T23:53:05 (#:model "stlc-1" #:type enum #:average 233213.16216216216 #:stderr 32791.074927877795)) (heartbeat 2015-02-23T23:53:14 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:53:24 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:53:34 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:53:44 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T23:53:52 (#:amount 94410992 #:time 265)) (heartbeat 2015-02-23T23:53:54 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:54:04 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:54:14 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:54:24 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:54:34 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:54:44 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-23T23:54:48 (#:model "stlc-1" #:type enum #:counterexample ((+ (λ (a int) a)) 3803) #:iterations 7694 #:time 103382)) (new-average 2015-02-23T23:54:48 (#:model "stlc-1" #:type enum #:average 229796.55263157893 #:stderr 32098.839052352272)) (heartbeat 2015-02-23T23:54:54 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:55:04 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:55:14 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T23:55:21 (#:amount 89718544 #:time 306)) (heartbeat 2015-02-23T23:55:24 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:55:34 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:55:44 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:55:54 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:56:04 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:56:14 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:56:24 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:56:34 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:56:44 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T23:56:53 (#:amount 96206736 #:time 267)) (heartbeat 2015-02-23T23:56:54 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-23T23:57:01 (#:model "stlc-1" #:type enum #:counterexample (hd -3) #:iterations 9978 #:time 133128)) (new-average 2015-02-23T23:57:01 (#:model "stlc-1" #:type enum #:average 227317.87179487178 #:stderr 31363.061248310714)) (heartbeat 2015-02-23T23:57:04 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:57:14 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:57:24 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:57:34 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:57:44 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:57:54 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:58:04 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:58:15 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T23:58:21 (#:amount 89515928 #:time 306)) (heartbeat 2015-02-23T23:58:25 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:58:35 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:58:45 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:58:55 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:59:05 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:59:15 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:59:25 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:59:35 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-23T23:59:45 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-23T23:59:52 (#:amount 96481360 #:time 260)) (heartbeat 2015-02-23T23:59:55 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:00:05 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:00:15 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:00:25 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:00:35 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:00:45 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:00:55 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:01:05 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T00:01:09 (#:model "stlc-1" #:type enum #:counterexample (hd 1) #:iterations 18518 #:time 247576)) (new-average 2015-02-24T00:01:09 (#:model "stlc-1" #:type enum #:average 227824.3 #:stderr 30573.125451104504)) (heartbeat 2015-02-24T00:01:15 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:01:18 (#:amount 89478360 #:time 297)) (heartbeat 2015-02-24T00:01:25 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:01:35 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:01:45 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:01:55 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:02:05 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:02:15 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:02:25 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T00:02:27 (#:model "stlc-1" #:type enum #:counterexample ((λ (ƕ (((list int) → (list int)) → ((int → int) → (int → (list int))))) -4818) ((λ (i (int → (int → (list int)))) 8) (hd 13))) #:iterations 5862 #:time 78304)) (new-average 2015-02-24T00:02:27 (#:model "stlc-1" #:type enum #:average 224177.43902439025 #:stderr 30040.301136851842)) (heartbeat 2015-02-24T00:02:35 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:02:45 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:02:50 (#:amount 96522728 #:time 266)) (heartbeat 2015-02-24T00:02:55 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:03:05 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T00:03:09 (#:model "stlc-1" #:type enum #:counterexample (hd 19) #:iterations 3099 #:time 42028)) (new-average 2015-02-24T00:03:09 (#:model "stlc-1" #:type enum #:average 219840.54761904763 #:stderr 29635.38346554774)) (heartbeat 2015-02-24T00:03:15 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:03:25 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:03:35 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:03:45 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:03:55 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:04:05 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:04:10 (#:amount 89687616 #:time 290)) (heartbeat 2015-02-24T00:04:15 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:04:25 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:04:35 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:04:45 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:04:55 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:05:05 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:05:15 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:05:25 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:05:26 (#:amount 96229944 #:time 223)) (heartbeat 2015-02-24T00:05:35 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:05:45 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T00:05:47 (#:model "stlc-1" #:type enum #:counterexample (hd 16) #:iterations 13743 #:time 158364)) (new-average 2015-02-24T00:05:47 (#:model "stlc-1" #:type enum #:average 218410.8604651163 #:stderr 28973.278109461036)) (heartbeat 2015-02-24T00:05:55 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:06:05 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:06:15 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:06:25 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:06:35 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:06:36 (#:amount 90320264 #:time 286)) (heartbeat 2015-02-24T00:06:45 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:06:55 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:07:05 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:07:15 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:07:25 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:07:35 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T00:07:38 (#:model "stlc-1" #:type enum #:counterexample (hd 117) #:iterations 9904 #:time 111009)) (new-average 2015-02-24T00:07:38 (#:model "stlc-1" #:type enum #:average 215969.90909090912 #:stderr 28412.184559716807)) (heartbeat 2015-02-24T00:07:45 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:07:55 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:07:57 (#:amount 94768200 #:time 266)) (heartbeat 2015-02-24T00:08:05 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:08:15 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:08:25 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:08:35 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:08:45 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:08:55 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:09:05 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:09:15 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:09:17 (#:amount 89836696 #:time 300)) (heartbeat 2015-02-24T00:09:25 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:09:35 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:09:45 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:09:55 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:10:05 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:10:15 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:10:25 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:10:35 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:10:36 (#:amount 96176328 #:time 264)) (heartbeat 2015-02-24T00:10:45 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:10:55 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:11:05 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:11:15 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:11:25 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:11:35 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:11:45 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:11:55 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:11:55 (#:amount 89610336 #:time 302)) (heartbeat 2015-02-24T00:12:05 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:12:15 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:12:25 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:12:35 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:12:45 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:12:55 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:13:05 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:13:15 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:13:20 (#:amount 96449904 #:time 226)) (heartbeat 2015-02-24T00:13:25 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:13:35 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:13:45 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T00:13:50 (#:model "stlc-1" #:type enum #:counterexample (hd -5) #:iterations 31674 #:time 371777)) (new-average 2015-02-24T00:13:50 (#:model "stlc-1" #:type enum #:average 219432.28888888893 #:stderr 27988.612476635833)) (heartbeat 2015-02-24T00:13:55 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:14:05 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:14:15 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:14:25 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:14:30 (#:amount 90004280 #:time 292)) (heartbeat 2015-02-24T00:14:35 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:14:45 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:14:55 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:15:05 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:15:15 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:15:25 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:15:35 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:15:45 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:15:55 (#:amount 95502016 #:time 263)) (heartbeat 2015-02-24T00:15:55 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:16:05 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:16:15 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:16:25 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:16:35 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:16:45 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:16:55 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:17:05 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:17:15 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:17:20 (#:amount 89910600 #:time 259)) (heartbeat 2015-02-24T00:17:25 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:17:35 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:17:45 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:17:55 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:18:05 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:18:15 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:18:25 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:18:35 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T00:18:43 (#:model "stlc-1" #:type enum #:counterexample (hd 0) #:iterations 23425 #:time 293371)) (new-average 2015-02-24T00:18:43 (#:model "stlc-1" #:type enum #:average 221039.65217391308 #:stderr 27420.554499888753)) (heartbeat 2015-02-24T00:18:45 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:18:47 (#:amount 95869384 #:time 267)) (heartbeat 2015-02-24T00:18:55 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:19:05 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:19:15 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:19:25 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:19:35 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:19:45 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:19:55 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:20:05 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:20:09 (#:amount 89997064 #:time 249)) (heartbeat 2015-02-24T00:20:15 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:20:25 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:20:35 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:20:45 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:20:55 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:21:05 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:21:15 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:21:25 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:21:27 (#:amount 95434416 #:time 269)) (heartbeat 2015-02-24T00:21:35 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:21:45 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:21:55 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:22:05 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:22:15 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:22:25 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:22:35 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:22:45 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:22:47 (#:amount 89626632 #:time 306)) (heartbeat 2015-02-24T00:22:55 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:23:05 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:23:15 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:23:25 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:23:35 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:23:45 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:23:55 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:24:05 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:24:06 (#:amount 96219336 #:time 263)) (heartbeat 2015-02-24T00:24:15 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:24:25 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:24:35 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:24:45 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:24:55 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:25:05 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:25:15 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:25:25 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:25:28 (#:amount 89547760 #:time 299)) (heartbeat 2015-02-24T00:25:35 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:25:45 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:25:55 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:26:05 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:26:15 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:26:25 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:26:35 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:26:46 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:26:47 (#:amount 96539320 #:time 225)) (heartbeat 2015-02-24T00:26:56 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:27:06 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:27:16 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:27:26 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:27:36 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:27:46 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:27:56 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:28:06 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:28:07 (#:amount 89948176 #:time 252)) (heartbeat 2015-02-24T00:28:16 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:28:26 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:28:36 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:28:46 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:28:56 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:29:06 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T00:29:11 (#:model "stlc-1" #:type enum #:counterexample ((λ (a int) (λ (b int) a)) (λ (d int) 2)) #:iterations 52205 #:time 628118)) (new-average 2015-02-24T00:29:11 (#:model "stlc-1" #:type enum #:average 229700.89361702133 #:stderr 28194.12578981693)) (heartbeat 2015-02-24T00:29:16 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:29:26 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:29:35 (#:amount 95446224 #:time 269)) (heartbeat 2015-02-24T00:29:36 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:29:46 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T00:29:47 (#:model "stlc-1" #:type enum #:counterexample (hd -1) #:iterations 2737 #:time 36546)) (new-average 2015-02-24T00:29:47 (#:model "stlc-1" #:type enum #:average 225676.83333333337 #:stderr 27892.303475599514)) (heartbeat 2015-02-24T00:29:56 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:30:06 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:30:16 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:30:26 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:30:36 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:30:46 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:30:56 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:31:04 (#:amount 90330392 #:time 292)) (heartbeat 2015-02-24T00:31:06 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T00:31:14 (#:model "stlc-1" #:type enum #:counterexample (hd 1) #:iterations 6447 #:time 86665)) (new-average 2015-02-24T00:31:14 (#:model "stlc-1" #:type enum #:average 222839.8571428572 #:stderr 27464.062284279098)) (heartbeat 2015-02-24T00:31:16 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:31:26 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:31:36 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:31:46 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:31:56 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:32:06 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:32:16 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:32:26 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:32:36 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:32:36 (#:amount 94804336 #:time 267)) (heartbeat 2015-02-24T00:32:46 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:32:56 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:33:06 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:33:16 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:33:26 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:33:36 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:33:46 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:33:56 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:34:04 (#:amount 89525040 #:time 300)) (heartbeat 2015-02-24T00:34:06 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:34:16 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:34:26 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:34:36 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:34:46 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:34:56 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:35:06 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:35:16 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:35:26 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:35:36 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:35:36 (#:amount 96620720 #:time 268)) (heartbeat 2015-02-24T00:35:46 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:35:56 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:36:06 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:36:16 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:36:26 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:36:36 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:36:46 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:36:56 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:37:04 (#:amount 90044896 #:time 299)) (heartbeat 2015-02-24T00:37:06 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:37:16 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:37:26 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:37:36 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:37:46 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:37:56 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:38:06 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:38:16 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:38:26 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:38:35 (#:amount 95485608 #:time 267)) (heartbeat 2015-02-24T00:38:36 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:38:46 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:38:56 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:39:06 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:39:16 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:39:26 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:39:36 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:39:46 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:39:56 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:40:04 (#:amount 90277416 #:time 290)) (heartbeat 2015-02-24T00:40:06 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:40:16 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T00:40:26 (#:model "stlc-1" #:type enum #:counterexample (hd 1) #:iterations 41231 #:time 551442)) (new-average 2015-02-24T00:40:26 (#:model "stlc-1" #:type enum #:average 229411.90000000005 #:stderr 27700.0988407026)) (heartbeat 2015-02-24T00:40:26 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:40:36 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T00:40:41 (#:model "stlc-1" #:type enum #:counterexample (hd 11) #:iterations 1153 #:time 15340)) (new-average 2015-02-24T00:40:41 (#:model "stlc-1" #:type enum #:average 225214.41176470593 #:stderr 27474.067129056497)) (heartbeat 2015-02-24T00:40:46 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T00:40:48 (#:model "stlc-1" #:type enum #:counterexample (hd -3) #:iterations 557 #:time 7431)) (new-average 2015-02-24T00:40:48 (#:model "stlc-1" #:type enum #:average 221026.26923076928 #:stderr 27264.137546697588)) (heartbeat 2015-02-24T00:40:56 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T00:41:02 (#:model "stlc-1" #:type enum #:counterexample (hd -3) #:iterations 1038 #:time 13830)) (new-average 2015-02-24T00:41:02 (#:model "stlc-1" #:type enum #:average 217116.9056603774 #:stderr 27028.984635044984)) (heartbeat 2015-02-24T00:41:06 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:41:16 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:41:26 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:41:34 (#:amount 94996160 #:time 267)) (heartbeat 2015-02-24T00:41:36 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:41:46 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:41:56 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:42:06 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:42:16 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:42:26 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:42:36 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:42:46 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:42:56 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:43:03 (#:amount 89633928 #:time 308)) (heartbeat 2015-02-24T00:43:06 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:43:16 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:43:26 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:43:36 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:43:46 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:43:56 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:44:06 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:44:16 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:44:26 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:44:35 (#:amount 96169128 #:time 267)) (heartbeat 2015-02-24T00:44:36 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:44:46 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:44:56 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:45:06 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:45:16 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:45:26 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:45:36 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:45:46 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:45:56 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:46:05 (#:amount 90119456 #:time 293)) (heartbeat 2015-02-24T00:46:06 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:46:16 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:46:26 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:46:36 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:46:46 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:46:56 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:47:06 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:47:16 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:47:26 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:47:36 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:47:38 (#:amount 95406424 #:time 263)) (heartbeat 2015-02-24T00:47:46 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:47:56 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:48:06 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:48:16 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:48:26 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:48:36 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:48:46 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:48:56 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:48:59 (#:amount 89878840 #:time 293)) (heartbeat 2015-02-24T00:49:06 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:49:16 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T00:49:26 (#:model "stlc-1" #:type enum #:counterexample (hd 3) #:iterations 37893 #:time 503974)) (new-average 2015-02-24T00:49:26 (#:model "stlc-1" #:type enum #:average 222429.07407407413 #:stderr 27050.45550950546)) (heartbeat 2015-02-24T00:49:26 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:49:36 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:49:46 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:49:56 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:50:06 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:50:16 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:50:19 (#:amount 96051264 #:time 220)) (heartbeat 2015-02-24T00:50:26 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:50:36 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:50:46 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:50:56 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:51:06 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:51:16 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:51:26 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:51:36 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:51:42 (#:amount 89389384 #:time 296)) (heartbeat 2015-02-24T00:51:46 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:51:56 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:52:06 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:52:17 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:52:27 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:52:37 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:52:47 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:52:57 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:53:05 (#:amount 96751152 #:time 231)) (heartbeat 2015-02-24T00:53:07 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:53:17 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:53:27 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:53:37 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:53:47 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:53:57 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:54:07 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:54:17 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:54:25 (#:amount 90166464 #:time 250)) (heartbeat 2015-02-24T00:54:27 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:54:37 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:54:47 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:54:57 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:55:07 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:55:17 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:55:27 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:55:37 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:55:47 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:55:55 (#:amount 94917560 #:time 264)) (heartbeat 2015-02-24T00:55:57 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:56:07 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:56:17 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:56:27 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:56:37 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:56:47 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:56:57 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:57:07 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:57:17 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:57:25 (#:amount 89645712 #:time 302)) (heartbeat 2015-02-24T00:57:27 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:57:37 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:57:47 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:57:57 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:58:07 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:58:17 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:58:27 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:58:37 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:58:47 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T00:58:57 (#:amount 96318256 #:time 263)) (heartbeat 2015-02-24T00:58:57 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:59:07 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:59:17 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:59:27 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:59:37 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:59:47 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T00:59:57 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:00:07 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:00:17 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:00:26 (#:amount 89557096 #:time 305)) (heartbeat 2015-02-24T01:00:27 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:00:37 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:00:47 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:00:57 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:01:07 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:01:17 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:01:27 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:01:37 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:01:47 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:01:57 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:01:57 (#:amount 96373840 #:time 263)) (heartbeat 2015-02-24T01:02:07 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:02:17 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:02:27 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:02:37 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:02:47 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:02:57 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:03:07 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:03:17 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:03:22 (#:amount 89934104 #:time 290)) (heartbeat 2015-02-24T01:03:27 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:03:37 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:03:47 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:03:57 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:04:07 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:04:17 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:04:27 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:04:37 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:04:47 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:04:50 (#:amount 95741240 #:time 269)) (heartbeat 2015-02-24T01:04:57 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:05:07 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:05:17 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:05:27 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:05:37 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:05:47 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:05:57 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:06:07 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:06:16 (#:amount 89703552 #:time 308)) (heartbeat 2015-02-24T01:06:17 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:06:27 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:06:37 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:06:47 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:06:57 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T01:06:57 (#:model "stlc-1" #:type enum #:counterexample (hd 12) #:iterations 81296 #:time 1051128)) (new-average 2015-02-24T01:06:57 (#:model "stlc-1" #:type enum #:average 237496.32727272733 #:stderr 30530.98430232349)) (heartbeat 2015-02-24T01:07:07 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:07:17 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:07:27 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:07:37 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:07:47 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:07:49 (#:amount 96374152 #:time 272)) (heartbeat 2015-02-24T01:07:57 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:08:07 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:08:17 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:08:27 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:08:37 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:08:47 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:08:57 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:09:07 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:09:16 (#:amount 89282544 #:time 310)) (heartbeat 2015-02-24T01:09:17 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:09:27 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:09:37 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:09:47 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:09:57 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:10:07 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:10:17 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:10:27 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:10:37 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:10:47 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:10:48 (#:amount 96802056 #:time 268)) (heartbeat 2015-02-24T01:10:57 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:11:07 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:11:17 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T01:11:18 (#:model "stlc-1" #:type enum #:counterexample (hd 0) #:iterations 19622 #:time 260295)) (new-average 2015-02-24T01:11:18 (#:model "stlc-1" #:type enum #:average 237903.44642857148 #:stderr 29983.59548799326)) (heartbeat 2015-02-24T01:11:27 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:11:37 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:11:47 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:11:57 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:12:07 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:12:09 (#:amount 89861368 #:time 292)) (heartbeat 2015-02-24T01:12:17 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:12:27 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:12:37 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:12:47 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:12:57 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:13:07 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:13:17 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:13:27 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:13:37 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:13:38 (#:amount 95892680 #:time 266)) (heartbeat 2015-02-24T01:13:47 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:13:57 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:14:07 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:14:17 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:14:27 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:14:37 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:14:47 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:14:57 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:15:05 (#:amount 89501928 #:time 259)) (heartbeat 2015-02-24T01:15:08 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:15:18 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:15:28 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:15:38 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:15:48 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:15:58 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:16:08 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:16:18 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:16:28 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:16:28 (#:amount 96610152 #:time 267)) (heartbeat 2015-02-24T01:16:38 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:16:48 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:16:58 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:17:08 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:17:18 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:17:28 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:17:38 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:17:48 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:17:55 (#:amount 90219744 #:time 295)) (heartbeat 2015-02-24T01:17:58 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:18:08 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T01:18:08 (#:model "stlc-1" #:type enum #:counterexample (hd -39) #:iterations 32217 #:time 410214)) (new-average 2015-02-24T01:18:08 (#:model "stlc-1" #:type enum #:average 240926.43859649127 #:stderr 29607.601372601224)) (heartbeat 2015-02-24T01:18:18 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:18:28 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:18:38 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:18:48 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:18:58 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:19:08 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:19:18 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:19:18 (#:amount 95160656 #:time 266)) (heartbeat 2015-02-24T01:19:28 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:19:38 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:19:48 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:19:58 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:20:08 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:20:18 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:20:28 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:20:38 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:20:44 (#:amount 89517056 #:time 318)) (heartbeat 2015-02-24T01:20:48 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:20:58 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:21:08 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:21:18 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:21:28 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:21:38 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:21:48 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:21:58 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:22:08 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:22:12 (#:amount 96530968 #:time 266)) (heartbeat 2015-02-24T01:22:18 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:22:28 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:22:38 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:22:48 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:22:58 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:23:08 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:23:18 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:23:28 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:23:38 (#:amount 90140016 #:time 260)) (heartbeat 2015-02-24T01:23:38 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:23:48 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:23:58 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:24:08 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:24:18 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T01:24:22 (#:model "stlc-1" #:type enum #:counterexample ((λ (d (list int)) -4) (hd -11)) #:iterations 29091 #:time 374082)) (new-average 2015-02-24T01:24:22 (#:model "stlc-1" #:type enum #:average 243222.22413793107 #:stderr 29183.090261670994)) (heartbeat 2015-02-24T01:24:28 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:24:38 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:24:48 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:24:58 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:25:06 (#:amount 95348896 #:time 266)) (heartbeat 2015-02-24T01:25:08 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:25:18 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:25:28 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:25:38 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:25:48 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:25:58 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:26:08 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:26:18 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:26:28 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:26:29 (#:amount 89538336 #:time 304)) (heartbeat 2015-02-24T01:26:38 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:26:48 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:26:58 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:27:08 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:27:18 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:27:28 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:27:38 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:27:48 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:27:56 (#:amount 96397920 #:time 227)) (heartbeat 2015-02-24T01:27:58 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:28:08 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T01:28:09 (#:model "stlc-1" #:type enum #:counterexample (hd 1) #:iterations 18135 #:time 227513)) (new-average 2015-02-24T01:28:09 (#:model "stlc-1" #:type enum #:average 242955.96610169494 #:stderr 28685.432985614145)) (heartbeat 2015-02-24T01:28:18 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:28:28 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:28:38 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:28:48 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:28:58 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:29:08 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:29:14 (#:amount 90313304 #:time 252)) (heartbeat 2015-02-24T01:29:18 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:29:28 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:29:38 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:29:48 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:29:58 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:30:08 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:30:18 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:30:28 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:30:38 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:30:45 (#:amount 95005824 #:time 268)) (heartbeat 2015-02-24T01:30:48 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:30:58 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:31:08 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:31:18 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:31:28 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:31:38 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:31:48 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:31:58 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:32:08 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:32:15 (#:amount 89271752 #:time 306)) (heartbeat 2015-02-24T01:32:18 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:32:28 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:32:38 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:32:48 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:32:58 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:33:08 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:33:18 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:33:28 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:33:38 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:33:48 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:33:48 (#:amount 97059928 #:time 274)) (heartbeat 2015-02-24T01:33:58 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:34:08 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:34:18 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:34:28 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:34:38 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:34:48 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:34:58 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T01:35:01 (#:model "stlc-1" #:type enum #:counterexample (hd 2) #:iterations 30920 #:time 411714)) (new-average 2015-02-24T01:35:01 (#:model "stlc-1" #:type enum #:average 245768.60000000003 #:stderr 28343.19153104762)) (heartbeat 2015-02-24T01:35:08 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T01:35:13 (#:model "stlc-1" #:type enum #:counterexample (hd 0) #:iterations 895 #:time 12384)) (new-average 2015-02-24T01:35:13 (#:model "stlc-1" #:type enum #:average 241942.6229508197 #:stderr 28136.021479679875)) (heartbeat 2015-02-24T01:35:18 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:35:19 (#:amount 89670080 #:time 300)) (heartbeat 2015-02-24T01:35:28 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:35:38 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:35:48 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:35:58 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:36:08 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:36:18 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:36:28 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:36:38 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:36:46 (#:amount 96220184 #:time 271)) (heartbeat 2015-02-24T01:36:48 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:36:58 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T01:36:59 (#:model "stlc-1" #:type enum #:counterexample (hd 4) #:iterations 8191 #:time 106212)) (new-average 2015-02-24T01:36:59 (#:model "stlc-1" #:type enum #:average 239753.41935483873 #:stderr 27764.93618674493)) (heartbeat 2015-02-24T01:37:08 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:37:18 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:37:28 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:37:38 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:37:48 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:37:59 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:38:09 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:38:13 (#:amount 90094024 #:time 297)) (heartbeat 2015-02-24T01:38:19 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:38:29 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:38:39 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:38:49 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:38:59 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:39:09 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:39:19 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:39:29 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T01:39:33 (#:model "stlc-1" #:type enum #:counterexample (hd 2) #:iterations 11503 #:time 153805)) (new-average 2015-02-24T01:39:33 (#:model "stlc-1" #:type enum #:average 238389.14285714287 #:stderr 27354.71038091963)) (heartbeat 2015-02-24T01:39:39 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:39:44 (#:amount 95385000 #:time 270)) (heartbeat 2015-02-24T01:39:49 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:39:59 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:40:09 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:40:19 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:40:29 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:40:39 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:40:49 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:40:59 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:41:09 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:41:14 (#:amount 90192616 #:time 308)) (heartbeat 2015-02-24T01:41:19 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:41:29 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:41:39 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:41:49 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:41:59 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:42:09 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:42:19 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:42:29 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:42:38 (#:amount 95138392 #:time 265)) (heartbeat 2015-02-24T01:42:39 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:42:49 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:42:59 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:43:09 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:43:19 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:43:29 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:43:39 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:43:49 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:43:58 (#:amount 89473296 #:time 271)) (heartbeat 2015-02-24T01:43:59 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:44:09 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:44:19 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:44:29 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:44:39 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T01:44:46 (#:model "stlc-1" #:type enum #:counterexample (hd 0) #:iterations 24715 #:time 313332)) (new-average 2015-02-24T01:44:46 (#:model "stlc-1" #:type enum #:average 239560.125 #:stderr 26949.352934293856)) (heartbeat 2015-02-24T01:44:49 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:44:59 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:45:09 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:45:19 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:45:22 (#:amount 96489616 #:time 226)) (heartbeat 2015-02-24T01:45:29 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:45:39 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:45:49 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:45:59 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:46:09 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:46:19 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:46:29 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T01:46:38 (#:model "stlc-1" #:type enum #:counterexample (hd 0) #:iterations 8985 #:time 111794)) (new-average 2015-02-24T01:46:38 (#:model "stlc-1" #:type enum #:average 237594.4923076923 #:stderr 26604.222209042986)) (heartbeat 2015-02-24T01:46:39 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:46:44 (#:amount 89976416 #:time 291)) (heartbeat 2015-02-24T01:46:49 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:46:59 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:47:09 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:47:19 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:47:29 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:47:39 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T01:47:43 (#:model "stlc-1" #:type enum #:counterexample (hd -5) #:iterations 5395 #:time 64930)) (new-average 2015-02-24T01:47:43 (#:model "stlc-1" #:type enum #:average 234978.36363636362 #:stderr 26328.325985502717)) (heartbeat 2015-02-24T01:47:49 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:47:59 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:48:05 (#:amount 95462216 #:time 268)) (heartbeat 2015-02-24T01:48:09 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:48:19 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:48:29 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:48:39 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:48:49 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:48:59 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:49:09 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:49:19 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:49:29 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:49:29 (#:amount 90105384 #:time 300)) (heartbeat 2015-02-24T01:49:39 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:49:49 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:49:59 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:50:09 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:50:19 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:50:29 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:50:39 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:50:49 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:50:56 (#:amount 95336256 #:time 270)) (heartbeat 2015-02-24T01:50:59 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:51:09 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:51:19 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:51:29 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:51:39 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:51:49 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:51:59 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:52:09 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:52:19 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:52:20 (#:amount 89677976 #:time 304)) (heartbeat 2015-02-24T01:52:29 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:52:39 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:52:49 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:52:59 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:53:09 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:53:19 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:53:29 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:53:39 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:53:47 (#:amount 96185152 #:time 267)) (heartbeat 2015-02-24T01:53:49 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T01:53:52 (#:model "stlc-1" #:type enum #:counterexample ((+ (λ (a int) a)) -73) #:iterations 29084 #:time 369132)) (new-average 2015-02-24T01:53:52 (#:model "stlc-1" #:type enum #:average 236980.6567164179 #:stderr 26009.57447008077)) (heartbeat 2015-02-24T01:53:59 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:54:09 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:54:19 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:54:29 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:54:39 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:54:49 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:54:59 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T01:55:04 (#:model "stlc-1" #:type enum #:counterexample ((λ (a (int → (list int))) (λ (b (list int)) a)) (λ (a (list int)) (λ (b int) a))) #:iterations 5777 #:time 72719)) (new-average 2015-02-24T01:55:04 (#:model "stlc-1" #:type enum #:average 234565.04411764705 #:stderr 25737.83497882968)) (counterexample 2015-02-24T01:55:07 (#:model "stlc-1" #:type enum #:counterexample (hd -1) #:iterations 216 #:time 2985)) (new-average 2015-02-24T01:55:07 (#:model "stlc-1" #:type enum #:average 231208.81159420288 #:stderr 25583.185852044906)) (heartbeat 2015-02-24T01:55:09 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:55:12 (#:amount 89666736 #:time 303)) (heartbeat 2015-02-24T01:55:19 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:55:29 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:55:39 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:55:49 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:55:59 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:56:09 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:56:19 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:56:22 (#:amount 96469856 #:time 228)) (heartbeat 2015-02-24T01:56:29 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:56:39 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:56:49 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:56:59 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:57:09 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:57:19 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:57:29 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:57:39 (#:amount 90114344 #:time 292)) (heartbeat 2015-02-24T01:57:39 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:57:49 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:57:59 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:58:09 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:58:19 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T01:58:26 (#:model "stlc-1" #:type enum #:counterexample (hd -1) #:iterations 17614 #:time 199242)) (new-average 2015-02-24T01:58:26 (#:model "stlc-1" #:type enum #:average 230752.14285714284 #:stderr 25219.19827960351)) (heartbeat 2015-02-24T01:58:29 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T01:58:33 (#:model "stlc-1" #:type enum #:counterexample (hd -1) #:iterations 517 #:time 6906)) (new-average 2015-02-24T01:58:33 (#:model "stlc-1" #:type enum #:average 227599.38028169013 #:stderr 25060.569755842967)) (heartbeat 2015-02-24T01:58:39 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:58:49 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:58:59 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T01:59:07 (#:amount 95289608 #:time 270)) (heartbeat 2015-02-24T01:59:09 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:59:19 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:59:29 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:59:39 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:59:49 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T01:59:59 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:00:09 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:00:19 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T02:00:27 (#:model "stlc-1" #:type enum #:counterexample (hd 3) #:iterations 9025 #:time 114080)) (new-average 2015-02-24T02:00:27 (#:model "stlc-1" #:type enum #:average 226022.72222222222 #:stderr 24760.304308383384)) (gc-major 2015-02-24T02:00:29 (#:amount 89427960 #:time 310)) (heartbeat 2015-02-24T02:00:29 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:00:39 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:00:49 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:00:59 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:01:09 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:01:19 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:01:29 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:01:39 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:01:49 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T02:01:51 (#:amount 97287456 #:time 268)) (heartbeat 2015-02-24T02:01:59 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:02:09 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:02:19 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:02:29 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:02:39 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:02:49 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:02:59 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:03:09 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T02:03:17 (#:amount 89499496 #:time 308)) (heartbeat 2015-02-24T02:03:19 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:03:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:03:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:03:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:04:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:04:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:04:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:04:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:04:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:04:50 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T02:04:50 (#:amount 96601888 #:time 267)) (heartbeat 2015-02-24T02:05:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:05:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:05:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:05:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:05:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:05:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:06:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:06:10 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T02:06:20 (#:amount 89975872 #:time 293)) (heartbeat 2015-02-24T02:06:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:06:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:06:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:06:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:07:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:07:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:07:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:07:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:07:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:07:50 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T02:07:52 (#:amount 95476280 #:time 273)) (heartbeat 2015-02-24T02:08:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:08:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:08:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:08:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:08:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:08:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:09:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:09:10 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T02:09:10 (#:model "stlc-1" #:type enum #:counterexample (hd 6) #:iterations 39635 #:time 523082)) (new-average 2015-02-24T02:09:10 (#:model "stlc-1" #:type enum #:average 230092.02739726027 #:stderr 24755.51256911742)) (heartbeat 2015-02-24T02:09:20 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T02:09:21 (#:amount 89540968 #:time 310)) (heartbeat 2015-02-24T02:09:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:09:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:09:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:10:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:10:10 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T02:10:18 (#:model "stlc-1" #:type enum #:counterexample (hd -4) #:iterations 4933 #:time 67195)) (new-average 2015-02-24T02:10:18 (#:model "stlc-1" #:type enum #:average 227890.7162162162 #:stderr 24517.708997527065)) (heartbeat 2015-02-24T02:10:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:10:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:10:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:10:50 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T02:10:55 (#:amount 96604080 #:time 269)) (heartbeat 2015-02-24T02:11:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:11:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:11:20 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T02:11:29 (#:model "stlc-1" #:type enum #:counterexample (hd 0) #:iterations 5271 #:time 71320)) (new-average 2015-02-24T02:11:29 (#:model "stlc-1" #:type enum #:average 225803.10666666666 #:stderr 24278.51629182596)) (heartbeat 2015-02-24T02:11:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:11:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:11:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:12:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:12:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:12:20 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T02:12:24 (#:amount 90227544 #:time 302)) (heartbeat 2015-02-24T02:12:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:12:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:12:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:13:00 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T02:13:02 (#:model "stlc-1" #:type enum #:counterexample ((+ (λ (a int) a)) 335) #:iterations 6823 #:time 92713)) (new-average 2015-02-24T02:13:02 (#:model "stlc-1" #:type enum #:average 224051.92105263157 #:stderr 24020.850489666977)) (heartbeat 2015-02-24T02:13:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:13:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:13:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:13:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:13:50 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T02:13:55 (#:amount 95012104 #:time 267)) (heartbeat 2015-02-24T02:14:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:14:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:14:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:14:30 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T02:14:35 (#:model "stlc-1" #:type enum #:counterexample (hd 0) #:iterations 6871 #:time 93419)) (new-average 2015-02-24T02:14:35 (#:model "stlc-1" #:type enum #:average 222355.3896103896 #:stderr 23767.46582016472)) (heartbeat 2015-02-24T02:14:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:14:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:15:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:15:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:15:20 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T02:15:25 (#:amount 89376920 #:time 305)) (heartbeat 2015-02-24T02:15:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:15:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:15:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:16:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:16:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:16:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:16:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:16:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:16:50 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T02:16:59 (#:amount 96777008 #:time 271)) (heartbeat 2015-02-24T02:17:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:17:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:17:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:17:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:17:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:17:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:18:00 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T02:18:09 (#:model "stlc-1" #:type enum #:counterexample (hd 5) #:iterations 15639 #:time 213525)) (new-average 2015-02-24T02:18:09 (#:model "stlc-1" #:type enum #:average 222242.17948717947 #:stderr 23461.049139453607)) (heartbeat 2015-02-24T02:18:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:18:20 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T02:18:28 (#:amount 89431624 #:time 311)) (heartbeat 2015-02-24T02:18:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:18:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:18:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:19:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:19:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:19:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:19:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:19:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:19:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:20:00 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T02:20:01 (#:amount 96564128 #:time 271)) (heartbeat 2015-02-24T02:20:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:20:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:20:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:20:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:20:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:21:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:21:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:21:20 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T02:21:27 (#:amount 89951968 #:time 294)) (heartbeat 2015-02-24T02:21:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:21:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:21:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:22:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:22:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:22:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:22:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:22:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:22:50 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T02:23:00 (#:amount 95719984 #:time 266)) (heartbeat 2015-02-24T02:23:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:23:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:23:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:23:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:23:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:23:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:24:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:24:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:24:20 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T02:24:28 (#:amount 89595416 #:time 310)) (heartbeat 2015-02-24T02:24:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:24:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:24:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:25:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:25:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:25:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:25:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:25:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:25:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:26:00 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T02:26:02 (#:amount 96290552 #:time 276)) (heartbeat 2015-02-24T02:26:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:26:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:26:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:26:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:26:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:27:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:27:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:27:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:27:30 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T02:27:33 (#:amount 90325192 #:time 305)) (heartbeat 2015-02-24T02:27:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:27:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:28:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:28:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:28:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:28:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:28:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:28:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:29:00 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T02:29:08 (#:amount 97199792 #:time 274)) (heartbeat 2015-02-24T02:29:10 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T02:29:20 (#:model "stlc-1" #:type enum #:counterexample (hd 8) #:iterations 49443 #:time 671062)) (new-average 2015-02-24T02:29:20 (#:model "stlc-1" #:type enum #:average 227923.44303797468 #:stderr 23848.750025597346)) (heartbeat 2015-02-24T02:29:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:29:30 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:29:40 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:29:50 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:30:00 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:30:10 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:30:20 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:30:30 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T02:30:38 (#:amount 90159840 #:time 287)) (heartbeat 2015-02-24T02:30:41 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:30:51 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:31:01 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:31:11 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:31:21 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:31:31 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:31:41 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:31:51 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:32:01 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:32:11 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T02:32:11 (#:amount 95167720 #:time 268)) (heartbeat 2015-02-24T02:32:21 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:32:31 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:32:41 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:32:51 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:33:01 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:33:11 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:33:21 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:33:31 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T02:33:39 (#:amount 89359008 #:time 311)) (heartbeat 2015-02-24T02:33:41 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:33:51 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:34:01 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:34:11 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:34:21 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:34:31 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:34:41 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:34:51 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:35:01 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:35:11 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T02:35:12 (#:amount 96859576 #:time 278)) (heartbeat 2015-02-24T02:35:21 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:35:31 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:35:41 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:35:51 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:36:01 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:36:11 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:36:21 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:36:31 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:36:41 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T02:36:41 (#:amount 90310864 #:time 292)) (heartbeat 2015-02-24T02:36:51 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:37:01 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T02:37:04 (#:model "stlc-1" #:type enum #:counterexample (hd 1) #:iterations 34223 #:time 464063)) (new-average 2015-02-24T02:37:04 (#:model "stlc-1" #:type enum #:average 230875.1875 #:stderr 23733.02764520239)) (heartbeat 2015-02-24T02:37:11 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:37:21 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:37:31 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:37:41 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:37:51 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:38:01 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:38:11 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T02:38:12 (#:amount 95077512 #:time 268)) (heartbeat 2015-02-24T02:38:21 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:38:31 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:38:41 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:38:51 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:39:01 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:39:11 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:39:21 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:39:31 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T02:39:40 (#:amount 90108208 #:time 293)) (heartbeat 2015-02-24T02:39:41 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:39:51 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:40:01 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:40:11 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:40:21 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:40:31 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:40:41 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:40:51 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:41:01 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T02:41:11 (#:amount 95260936 #:time 271)) (heartbeat 2015-02-24T02:41:11 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:41:21 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T02:41:22 (#:model "stlc-1" #:type enum #:counterexample (hd -1) #:iterations 19094 #:time 257591)) (new-average 2015-02-24T02:41:22 (#:model "stlc-1" #:type enum #:average 231205.0 #:stderr 23440.51635721579)) (heartbeat 2015-02-24T02:41:31 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:41:41 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:41:51 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:42:01 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:42:11 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:42:21 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:42:31 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:42:41 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T02:42:41 (#:amount 90307496 #:time 292)) (heartbeat 2015-02-24T02:42:51 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:43:01 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:43:11 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:43:21 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:43:31 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:43:41 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:43:51 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:44:01 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:44:11 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T02:44:14 (#:amount 95143744 #:time 273)) (heartbeat 2015-02-24T02:44:21 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:44:31 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:44:41 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:44:51 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:45:01 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:45:11 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:45:21 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:45:31 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:45:41 (#:model "stlc-1" #:type enum)) (gc-major 2015-02-24T02:45:44 (#:amount 89538008 #:time 306)) (heartbeat 2015-02-24T02:45:51 (#:model "stlc-1" #:type enum)) (heartbeat 2015-02-24T02:46:01 (#:model "stlc-1" #:type enum)) (counterexample 2015-02-24T02:46:03 (#:model "stlc-1" #:type enum #:counterexample (hd -29) #:iterations 20622 #:time 281539)) (new-average 2015-02-24T02:46:03 (#:model "stlc-1" #:type enum #:average 231818.82926829267 #:stderr 23161.02725559509)) (finished 2015-02-24T02:46:03 (#:model "stlc-1" #:type enum #:time-ms 19009164 #:attempts 1477004 #:num-counterexamples 82 #:rate-terms/s 77.69957689880523 #:attempts/cexp 18012.243902439026))
false
74dcea6fd6d9c934cb65d8b12687bb5a968b6d3a
d3250c138e5decbc204d5b9b0898480b363dbfa6
/unity-synthesis/paxos-verilog.rkt
7f4fea2306f4d67875b4b546ff51b622afece43c
[]
no_license
chchen/comet
3ddc6b11cd176f6f3a0f14918481b78b2a0367b0
1e3a0acb21a0a8beb0998b4650278ac9991e0266
refs/heads/main
2023-04-28T13:25:01.732740
2021-05-21T07:30:23
2021-05-21T07:30:23
368,667,043
8
2
null
2021-05-21T04:57:56
2021-05-18T21:10:01
Racket
UTF-8
Racket
false
false
827
rkt
paxos-verilog.rkt
#lang rosette/safe (require "config.rkt" "paxos.rkt" "synth.rkt" "verilog/backend.rkt" "verilog/mapping.rkt" "verilog/syntax.rkt" "verilog/synth.rkt" "verilog/verify.rkt") ;; Synthesize and verify an acceptor ;; (let* ([prog acceptor] ;; [impl (time (unity-prog->verilog-module prog 'acceptor))]) ;; (time (list (verify-verilog-module prog impl) ;; impl))) ;; Synthesize and verify a proposer ;; (let* ([prog proposer] ;; [impl (time (unity-prog->verilog-module prog 'proposer))]) ;; (time (list (verify-verilog-module prog impl) ;; impl))) ;; Interpret a specification to guarded traces ;; (let* ([prog proposer] ;; [synth-map (unity-prog->synth-map prog)]) ;; (unity-prog->synth-traces prog synth-map))
false
91711480f446eb4d2ff92b6583db4a8bc3d41d85
1f9cbbfd10c5757d44cc016f59ad230a0babb9a6
/CS5010-Programming-Design-Paradigm/pdp-singhay-master/set02/editor.rkt
7b40d41a44e04ef786e735e6a3808845304c40b2
[]
no_license
singhay/ms-courses-code
95dda6d5902218b4e95bf63a5275de5c405a6a14
5f986bd66582909b306c7aabcf1c2cda261c68ba
refs/heads/master
2021-01-01T18:21:29.043344
2018-11-10T21:40:58
2018-11-10T21:40:58
98,319,843
1
1
null
null
null
null
UTF-8
Racket
false
false
8,670
rkt
editor.rkt
;; The first three lines of this file were inserted by DrRacket. They record metadata ;; about the language level of this file in a form that our tools can easily process. #reader(lib "htdp-beginner-reader.ss" "lang")((modname editor) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f () #f))) ;; editor.rkt : Example 84 from Book HtDP2e, ;; First Question of Problem Set 02. ;; Goal: Design a text editor with a cursor that can navigate left and right in the text. ;; Pressing Backspace deletes the key immediately to the left of the cursor. ;; While the tab key ("\t") and the return key ("\r") are ignored. (require rackunit) (require 2htdp/universe) (require "extras.rkt") (check-location "02" "editor.rkt") (provide make-editor editor-pre editor-post editor? edit) ;; IN-BUILT functions used from: ;; racket/base: ;; substring : (substring "Apple" 1 3) = "pp" ;; string-ith : (string-ith "hello world" 1) = "e" ;; string-length : (string-length "Apple") = 5 ;; string-append : (string-append "Apple" "Banana") = "AppleBanana" ;; cond : (cond [(> 5 9) 9][else 5]) = 5 ;; string=? : (string=? "Apple" "apple") = #false ;; racket/universe: ;; key=? : (key=? KeyEvent "left") = #true ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; DATA DEFINITIONS: (define-struct editor (pre post)) ;; Editor is a (make-editor String String) ;; INTERP: pre is the portion of string before the cursor ;; post is the portion of string after the cursor ;; ;; editor-fn : Editor -> ?? #| (define (editor-fn e) (... (editor-pre e) (editor-post e))) |# ;; ;; TEMPLATE: ;; KeyEvent is defined in the 2htdp/universe module. Every KeyEvent is a ;; string, but not every string is a legal key event. The predicate for ;; comparing mouse events is key=? . ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; string-first : String -> String ;; RETURNS: The first 1-letter substring of the GIVEN String. ;; EXAMPLES: ;; (string-first "Ayush") = "A" ;; (string-first "This is awesome") = "T" ;; DESIGN STRATEGY: Combine simpler functions (define (string-first str) (cond [(string=? str "") ""] [else (string-ith str 0)])) ;; string-rest : String -> String ;; RETURNS: New string starting from the second character ;; uptil last character of the GIVEN string ;; EXAMPLES: ;; (string-rest "Hello") = "ello" ;; DESIGN STRATEGY: Combine simpler functions (define (string-rest str) (cond [(string=? str "") ""] [else (substring str 1)])) ;; string-last : String -> String ;; RETURNS: The last 1-letter substring of the GIVEN String. ;; EXAMPLES: ;; (string-last "Ayush") = "h" ;; (string-last "This is awesome") = "e" ;; DESIGN STRATEGY: Combine Simpler Functions (define (string-last str) (cond [(string=? str "") ""] [else (string-ith str (- (string-length str) 1))])) ;; string-remove-last : String -> String ;; GIVEN: ;; RETURNS: New string formed after deleting the ;; last character of the GIVEN string. ;; EXAMPLES: ;; (string-remove-last "Hello") = "Hell" ;; (string-remove-last "") = "" ;; (string-remove-last "X") = "" ;; DESIGN STRATEGY: Combine Simpler functions (define (string-remove-last str) (cond [(string=? str "") ""] [(= (string-length str) 1) ""] [else (substring str 0 (- (string-length str) 1))])) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; move-left : Editor -> Editor ;; GIVEN: an editor ;; RETURNS: an editor like the given one, with cursor moved ;; immediately to the left of the last character ;; of the given pre field of given editor ;; EXAMPLES: ;; (move-left (make-editor "BaB" "ye")) = (make-editor "Ba" "Bye") ;; (move-left (make-editor "" "Hey")) = (make-editor "" "Hey") ;; DESIGN STRATEGY: Combine Simpler Functions (define (move-left ed) (make-editor (string-remove-last (editor-pre ed)) (string-append (string-last (editor-pre ed)) (editor-post ed)))) ;; move-right : Editor -> Editor ;; GIVEN: an editor ;; RETURNS: an editor like the given one, with cursor moved ;; immediately to the right of the first character ;; of the given post field of given editor ;; EXAMPLES: ;; (move-right (make-editor "B" "aBye")) = (make-editor "Ba" "Bye") ;; (move-right (make-editor "Hey" "")) = (make-editor "Hey" "") ;; DESIGN STRATEGY: Combine Simpler Functions (define (move-right ed) (make-editor (string-append (editor-pre ed) (string-first (editor-post ed))) (string-rest (editor-post ed)))) ;; backspace : Editor -> Editor ;; GIVEN: an editor ;; RETURNS: an editor like the given one, with a character ;; deleted immediately to the left of the ;; cursor of the pre field of given editor ;; EXAMPLES: ;; (backspace (make-editor "Hello" "World")) = (make-editor "Hell" "World") ;; (backspace (make-editor "" " Wicked")) = (make-editor "" " Wicked") ;; DESIGN STRATEGY: Combine Simpler Functions (define (backspace ed) (make-editor (string-remove-last (editor-pre ed)) (editor-post ed))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; edit : Editor KeyEvent -> String ;; GIVEN: an editor ed and a KeyEvent ke ;; RETURNS: an editor like the given one, with a single-character ;; KeyEvent ke added to the end of the pre field of ed, ;; unless ke denotes the backspace ("\b") key in that case ;; it deletes the character immediately to the left of the cursor (if any). ;; It ignores the tab key ("\t") and the return key ("\r"). ;; INTERPRETATIONS: ;; cursor: Imaginary object which divides Editor into ;; two parts namely "editor-pre" & "editor-post" ;; EXAMPLES: ;; (edit "Hello" " World" "left") -> (make-editor "Hell" "o World") ;; (edit (edit "This " "is awesome" "right") "\b") -> (make-editor "This " "s awesome") ;; DESIGN STRATEGY: Dividing into cases on KeyEvent. (define (edit ed ke) (if (editor? ed) (cond [(key=? "left" ke) (move-left ed)] [(key=? "right" ke) (move-right ed)] [(key=? "\b" ke) (backspace ed)] [else ed]) "Invalid Input")) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; TESTS (begin-for-test (check-equal? (edit (make-editor "Hello" " World!") "right") (make-editor "Hello " "World!")) (check-equal? (edit (edit (make-editor "Hello" " World!") "\b") "left") (make-editor "Hel" "l World!")) (check-equal? (edit (make-editor "Hello" " World!") "\b") (make-editor "Hell" " World!")) (check-equal? (edit (make-editor "Hello" " World!") "\r") (make-editor "Hello" " World!")) (check-equal? (edit (make-editor "Hello" " World!") "\t") (make-editor "Hello" " World!")) (check-equal? (edit (make-editor "H" " W") "left") (make-editor "" "H W")) (check-equal? (edit (make-editor "H" " W") "right") (make-editor "H " "W")) (check-equal? (edit (make-editor "H" " W") "\b") (make-editor "" " W")) (check-equal? (edit (make-editor "" " W") "left") (make-editor "" " W")) (check-equal? (edit (make-editor "H" "") "right") (make-editor "H" "")) (check-equal? (edit (make-editor "" " W") "\b") (make-editor "" " W")) (check-equal? (edit (make-editor "H" " W") "f1") (make-editor "H" " W")) (check-equal? (edit (make-editor "H" " W") "5") (make-editor "H" " W")) (check-equal? (edit (make-editor "H" " W") "\r") (make-editor "H" " W")) (check-equal? (edit (make-editor "HW" "") "\b") (make-editor "H" "")) (check-equal? (string-first "T") "T") (check-equal? (string-first "Tsasa") "T") (check-equal? (string-rest "Tsasa") "sasa") (check-equal? (string-rest "") "") (check-equal? (string-last "Tsasa") "a") (check-equal? (string-last "") "") (check-equal? (string-remove-last "Tsasa") "Tsas") (check-equal? (string-remove-last "") "") (check-equal? (move-left (make-editor "0" "sd")) (make-editor "" "0sd")) (check-equal? (move-right (make-editor "0-" "sxccd")) (make-editor "0-s" "xccd")) (check-equal? (backspace (make-editor "0" "sd")) (make-editor "" "sd"))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;END;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
false
6063ddf5e67fc36b389e8b316f64776431bcb283
e4c6743198cbd4e8a5659bf6b8a96d54467a85d4
/web-ide/evaluators/c-evaluators.rkt
9e76299f5475971f9b1effa3496e80b5db2769e9
[]
no_license
jbclements/WebIDE
c9c9f3604c08bf141699bc0e5ac5e3d1038b657a
0cd41024357a14e6f6770a692ffdddda44c9ebc5
refs/heads/master
2021-01-22T07:18:12.629063
2019-09-04T16:23:49
2019-09-04T16:23:49
1,227,356
2
1
null
null
null
null
UTF-8
Racket
false
false
22,379
rkt
c-evaluators.rkt
#lang racket (require "shared.rkt" c rackunit) ;; this file contains the definitions of the evaluators for C, most notably ;; the "c-parser-match" evaluator, that tries to guide the student toward ;; producing code that parses to the same result as the instructor's code. ;; FIXME: ;; - line breaks in user code ;; - extend to handle stmts too ;; - this parser is probably sensitive to the order of, e.g., "const" & "volatile" (provide any-c-int any-c-addition c-parser-match c-stmt-parser-match) ;; this structure is raised to allow an exception handler to exit with a response (define-struct abort-with (response)) ;; this has to be early: ;; a simple memoizer for non-recursive, one-arg functions: (define (memoize-one fun) (define ht (make-hash)) (lambda (arg) (hash-ref ht arg (lambda () (define result (fun arg)) (hash-set! ht arg result) result)))) ;; abstract over patterns before trying to do a better job... ;; take the text supplied by the user, ;; check that it parses to an int (define (any-c-int usertext) (with-handlers ([abort-with? abort-with-response]) (catch-reader-parser-errors usertext (lambda () (cond [(equal? usertext "") (failure empty-input-msg)] [(parses-as-int? usertext) (success)] [else (failure (format "~v doesn't parse as an integer" usertext))]))))) (define (parses-as-int? str) (match (parse-expression str) [(struct expr:int (src value qualifiers)) #t] [other #f])) ;; abstraction needed here... (define (any-c-addition usertext) (with-handlers ([abort-with? abort-with-response]) (catch-reader-parser-errors usertext (lambda () (cond [(equal? usertext "") (failure empty-input-msg)] [(parses-as-addition? usertext) (success)] [else (failure (format "~v doesn't parse as the sum of two integers" usertext))]))))) ;; does this string parse as (+ (int) (int)) ? ;; what to do on a parse error? (define (parses-as-addition? str) (match (parse-expression str) [(struct expr:binop (src_1 (struct expr:int (dc_1 dc_2 dc_3)) (struct id:op (src2 '+)) (struct expr:int (dc_4 dc_5 dc_6)))) #t] [other #f])) ;; does the given text match the pattern? (define (c-parser-match pattern usertext) (with-handlers ([abort-with? abort-with-response]) ;; patterns are just going to be strings, for now. ((exp-pattern->matcher pattern) usertext))) ;; does the given statement match the pattern statement? (define (c-stmt-parser-match pattern usertext) (with-handlers ([abort-with? abort-with-response]) ((stmt-pattern->matcher pattern) usertext))) (define exp-pattern->matcher (memoize-one (lambda (pat) (pattern->matcher parse-expression pat)))) (define stmt-pattern->matcher (memoize-one (lambda (pat) (pattern->matcher parse-statement pat)))) ;; for now, a "pattern" is just a string containing a parsable C expression (define (pattern->matcher parser pat) (catch-reader-parser-pattern-errors pat (lambda () (let ([parsed-pattern (parser pat)]) (lambda (usertext) (catch-reader-parser-errors usertext (lambda () (compare-parsed parsed-pattern usertext parser)))))))) ;; catch exn:fail:read and exn:fail:syntax, turn them into failures (define (catch-reader-parser-errors usertext thunk) (with-handlers ([exn:fail:read? (lambda (exn) (match (exn:fail:read-srclocs exn) [`() (log-warning "internal error, no source position given (2011-04)") (failure `(div (p ,(exn-message exn))))] [(? list? l) (when (not (= (length l) 1)) (log-warning "more than one source position given 20110411")) ;; we hope there's only one... (define srcloc (first l)) (posn-span->fail (srcloc-position srcloc) (srcloc-span srcloc) usertext (exn-message exn))]))] [exn:fail:syntax? (lambda (exn) (match (exn:fail:syntax-exprs exn) [`() (log-warning "internal error, no source position given") (failure `(div (p ,(exn-message exn))))] [other (define most-specific (last other)) (posn-span->fail (syntax-position most-specific) (syntax-span most-specific) usertext (exn-message exn))]))]) (thunk))) ;; catch exn:fail:read and exn:fail:syntax, turn them into callerfails (for use on patterns) (define (catch-reader-parser-pattern-errors patterntext thunk) (with-handlers ([exn:fail:read? (lambda (exn) (raise (abort-with (callerfail (format "problem while parsing pattern: ~s on ~s with srclocs ~s" (exn-message exn) patterntext (exn:fail:read-srclocs exn))))))] [exn:fail:syntax? (lambda (exn) (raise (abort-with (callerfail (format "problem while parsing pattern: ~s on ~s at ~s" (exn-message exn) patterntext (map syntax->datum (exn:fail:syntax-exprs exn)))))))]) (thunk))) ;; given position and span and message, produce a fail message: (define (posn-span->fail posn span usertext message) (match (list posn span) [`(,(? number? p) ,(? number? s)) (fail-msg p (+ p s) usertext #:msg message)] ;; oh dear, fallback: [other (log-warning (format "parse/read error with no source or span: ~s" (list posn span))) (failure `(div (p ,message)))])) ;; compare-parsed : correct-parsed user-parsed -> (or/c success? failure?) (define (compare-parsed correct-parsed usertext parser) (cond [(equal? usertext "") (failure empty-input-msg)] [else (define user-parsed (parser usertext)) (with-handlers ([procedure? (lambda (fail-maker) (fail-maker usertext))]) (begin (unless (struct? user-parsed) (error 'compare-parsed "internal error 20110321-19:44, expected user parsed to be a struct")) (parsed-exp-equal? correct-parsed user-parsed #f) (success)))])) ;; parsed-exp-equal? : parsed parsed src-offset src-offset -> boolean ;; determine whether two parsed structures are the same up to source positions ;; NB: uses a coarse def'n of parseds as either ;; structs whose first element is a source position and whose remaining positions are ;; - parseds, or ;; - #f, or ;; - lists of parseds, or ;; - values comparable with equal? ;; ** okay,right now I'm going off the deep end and special-casing things as they come ;; up, to give better error messages. We'll see where this ends.... ;; the parent-src is used to report error positions for source terms that are not ;; structs. Because of the data definition we're using, this must be the immediate ;; parent node. ;; EFFECT: uses 'raise' to exit quickly when a difference is detected. ;; INVARIANT: should never *return* anything other than #t. ('raise' otherwise.) ;; NOTE: if 'user-parsed' is a struct, then 'parent-src' is unused (can be #f). (define (parsed-exp-equal? correct-parsed user-parsed parent-src) (cond [(and (struct? user-parsed) (struct? correct-parsed)) (define user-vec (struct->vector user-parsed)) (define correct-vec (struct->vector correct-parsed)) (define user-src (vector-ref user-vec 1)) (unless (equal? (vector-ref user-vec 0) (vector-ref correct-vec 0)) (fail-jump user-src #:msg wrong-struct-kind-msg)) ;; below here we know the two are the same kind of struct. ;; the fall-through procedure: (define (check-subfields) (unless (= (vector-length user-vec) (vector-length correct-vec)) (error 'parsed-exp-equal? "internal error 20110322: two expressions with struct type ~a have different numbers of fields (~a and ~a)" (vector-ref correct-vec 0) (vector-length correct-vec) (vector-length user-vec))) ;; ignore the struct type & source posn, recur on the rest: (for/and ([i (in-range 2 (vector-length user-vec))]) (parsed-exp-equal? (vector-ref correct-vec i) (vector-ref user-vec i) user-src))) ;; is the user field missing in this slot? (closed over vectors) (define (missing-piece slot) (define vector-index (+ 1 slot)) (and (false? (vector-ref user-vec vector-index)) (struct? (vector-ref correct-vec vector-index)))) ;; special-cases for better error messages: (match (vector-ref correct-vec 0) ;; check operator before other elements in binops: ['struct:expr:binop (unless (eq? (id:op-name (expr:binop-op user-parsed)) (id:op-name (expr:binop-op correct-parsed))) (fail-jump (id-src (expr:binop-op user-parsed)) #:msg wrong-operator-msg)) (check-subfields)] ;; special-cases for missing expressions ['struct:stmt:if (cond [(missing-piece 3) (fail-jump user-src #:msg missing-if-alt-msg)] [else (check-subfields)])] ['struct:stmt:for (cond [(missing-piece 1) (fail-jump user-src #:msg missing-for-init-msg)] [(missing-piece 2) (fail-jump user-src #:msg missing-for-test-msg)] [(missing-piece 3) (fail-jump user-src #:msg missing-for-update-msg)] [else (check-subfields)])] ['struct:stmt:return (cond [(missing-piece 1) (fail-jump user-src #:msg missing-return-exp-msg)] [else (check-subfields)])] [other (check-subfields)])] [(and (struct? user-parsed) (false? correct-parsed)) (fail-jump (vector-ref (struct->vector user-parsed) 1) #:msg should-be-absent-msg)] [(and (false? user-parsed) (struct? correct-parsed)) (error 'parsed-exp-equal? "internal error 201110181111: should have been caught higher up")] [(or (struct? user-parsed) (struct? correct-parsed)) (error 'parsed-exp-equal? "internal error 201103221829: one struct, one non-struct: ~a and ~a" correct-parsed user-parsed)] ;; handle lists (as e.g. in argument lists) [(and (list? user-parsed) (list? correct-parsed)) (cond [(< (length user-parsed) (length correct-parsed)) ;; if user-parsed is empty, take source position ;; from parent: (cond [(empty? user-parsed) (fail-jump parent-src #:msg missing-elements-msg)] [else (fail-jump (join-srcs (map expr-or-stmt-src user-parsed)) #:msg missing-elements-msg)])] [(< (length correct-parsed) (length user-parsed)) (fail-jump (join-srcs (map expr-or-stmt-src user-parsed)) #:msg extra-elements-msg)] [else (for/and ([c (in-list correct-parsed)] [u (in-list user-parsed)]) (parsed-exp-equal? c u parent-src))])] [(or (list? user-parsed) (list? correct-parsed)) (error 'parsed-exp-equal? "internal error 201103221830: one list, one non-list: ~a and ~a" correct-parsed user-parsed)] ;; handle everything else [else (fail-wrap (equal? user-parsed correct-parsed) parent-src)])) ;; get the source of either an expr or stmt: (define (expr-or-stmt-src expr-or-stmt) (vector-ref (struct->vector expr-or-stmt) 1)) ;; fail-wrap : bool src-posn -> #t ;; EFFECT: uses "raise" to exit if the bool is #f (define (fail-wrap b src) (or b (fail-jump src))) ;; raise a procedure which will take the user text and return a failure (define (fail-jump src #:msg [fail-message default-error-msg]) (raise (lambda (usertext) (fail-msg (src-start-offset src) (src-end-offset src) usertext #:msg fail-message)))) ;; fail-msg : integer integer optional-message -> string - > failure (define (fail-msg start end usertxt #:msg [message-text default-error-msg]) (define pre (substring usertxt 0 (- start 1))) (define middle (substring usertxt (- start 1) (- end 1))) (define post (substring usertxt (- end 1) (string-length usertxt))) (failure `(div (p ,message-text) (p (span (|@| (style "font-family: monospace;")) ,pre (span (|@| (style "border: 1px solid rgb(50, 50, 50); background-color : rgb(250,200,200);")) ,middle) ,post))))) ;; join-srcs : create a new synthetic source expression that spans a ;; list of existing ones, use #f for the path (define (join-srcs losrcs) (define f (argmin src-start-offset losrcs)) (define l (argmax src-end-offset losrcs)) (src (src-start-offset f) (src-start-line f) (src-start-col f) (src-end-offset l) (src-end-line l) (src-end-col l) #f)) (define wrong-struct-kind-msg "I wasn't expecting this kind of thing here:") (define should-be-absent-msg "I didn't expect to find anything here. Try taking out this expression or statement:") (define missing-if-alt-msg "This 'if' is missing its 'else' case:") (define missing-for-init-msg "This 'for' is missing its initialization expression:") (define missing-for-test-msg "This 'for' is missing its test expression:") (define missing-for-update-msg "This 'for' is missing its update expression:") (define missing-return-exp-msg "This 'return' is missing its argument:") (define default-error-msg "It looks like you need to fix the boxed part:") (define wrong-operator-msg "I expected a different operator here:") (define extra-elements-msg "I found more elements than I expected, here:") (define missing-elements-msg "I found fewer elements than I expected, here:") (define empty-input-msg "This box is empty.") (define parse-fail-msg "I got confused while parsing this token:") ;; TESTING (check-equal? (fail-wrap #true (src 1 2 3 4 5 6 7)) #t) (check-exn procedure? (lambda () (fail-wrap #false (src 1 2 3 4 5 6 7)))) (check-equal? (parses-as-addition? " /* abc */ 3 + // \n 4") #t) (check-equal? (parses-as-addition? "4 - 6") #f) (check-equal? (parses-as-addition? "3 + 4 + 6") #f) (check-equal? (parses-as-addition? "4") #f) (check-equal? (any-c-addition "234 2987") (fail-msg 5 9 "234 2987" #:msg "parse: unexpected integer literal")) (check-equal? (any-c-addition "098732") (fail-msg 1 7 "098732" #:msg "bad number literal: 098732")) (check-equal? (parses-as-int? " 34") #t) (check-equal? (parses-as-int? " a") #f) (check-equal? (parses-as-int? " 3 // zappa") #t) (check-equal? (parses-as-int? " 3.4 // zappa") #f) (check-equal? (any-c-int "098273") (fail-msg 1 7 "098273" #:msg "bad number literal: 098273")) ;; GENERAL PARSER MATCH TESTS (define (p-test str-a str-b) (compare-parsed (parse-expression str-a) str-b parse-expression)) (check-equal? (p-test "234" " 234 /*oth*/") (success)) (check-equal? (p-test "234" " 235 /*oth*/") (fail-msg 3 6 " 235 /*oth*/")) (check-equal? (p-test "(2342 + 22)" "2342 + 22") (success)) (check-equal? (p-test "(2342 + 22)" "2343 + 22") (fail-msg 1 5 "2343 + 22")) (check-equal? (p-test "((x + 34) + 22)" "x+34+22") (success)) (check-equal? (p-test "((x + 34) + 22)" "x+(34+22)") (fail-msg 1 2 "x+(34+22)" #:msg wrong-struct-kind-msg)) (check-equal? (p-test "((x + 34) + 22)" "y+34+22") (fail-msg 1 2 "y+34+22")) ;; wrong type of expression: (check-equal? (p-test "3 + 4" "f(x)") (fail-msg 1 5 "f(x)" #:msg wrong-struct-kind-msg)) ;; check operators first: (check-equal? (p-test "3 + 4" "5 * 7") (fail-msg 3 4 "5 * 7" #:msg wrong-operator-msg)) ;; missing arguments in funcalls: (check-equal? (p-test "f(3,4,6)" "f(x)") (fail-msg 3 4 "f(x)" #:msg missing-elements-msg)) ;; extra arguments in funcalls: (check-equal? (p-test "f(3,4)" "f(0,0,0,0)") (fail-msg 3 10 "f(0,0,0,0)" #:msg extra-elements-msg)) ;; decent error message on empty string: (check-equal? (p-test "f(3,4)" "") (failure empty-input-msg)) ;; this level can catch syntactic errors: (check-equal? ((pattern->matcher parse-expression "((x + 34) + 22)") "x+34+22") (success)) (check-equal? ((pattern->matcher parse-expression "((x + 34) + 22)") "x+35+22") (fail-msg 3 5 "x+35+22")) (check-equal? ((pattern->matcher parse-expression "((x + 34) + 22)") "x+35+ +22;") (fail-msg 10 11 "x+35+ +22;" #:msg "parse: unexpected semi-colon (`;')")) ;; test the wrapper function: (check-equal? (c-parser-match "((x + 34) + 22)" "x+34+22") (success)) (check-equal? (failure? (c-parser-match "((x + 34) + 22)" "x+34+029")) #t) ;; Parse failures: (check-equal? (c-parser-match "123413" "234 123") (fail-msg 5 8 "234 123" #:msg "parse: unexpected integer literal")) ;; read failures (check-equal? (c-parser-match "abc" "091823740") (fail-msg 1 10 "091823740" #:msg "bad number literal: 091823740")) ;; once again on statements: (define (s-test str-a str-b) (compare-parsed (parse-statement str-a) str-b parse-statement)) (check-equal? (s-test "234;" " 234 /*oth*/;") (success)) (check-equal? (s-test "234;" " 235 /*oth*/;") (fail-msg 3 6 " 235 /*oth*/;")) (check-equal? (s-test "if (3 < 4) { return 4; } else {return 2;}" "if ((3 < 4)) {return 4;} else {return 2;}") (success)) (check-equal? (s-test "if (3 < 4) { return 4; } else {return 2;}" "if ((3 < 4)) {return 4+3;} else return 2;") (fail-msg 25 28 "if ((3 < 4)) {return 4+3;} else return 2;" #:msg wrong-struct-kind-msg)) (check-equal? (s-test "return f(x,15);" "return f();") (fail-msg 8 11 "return f();" #:msg missing-elements-msg)) (check-equal? (s-test "return;" "return 3;") (fail-msg 8 9 "return 3;" #:msg should-be-absent-msg)) (check-equal? (s-test "return f(x,15);" "return;") (fail-msg 1 8 "return;" #:msg missing-return-exp-msg)) (check-equal? (s-test "if (3) 4; else return 5;" "if (3) 4;") (fail-msg 1 10 "if (3) 4;" #:msg missing-if-alt-msg)) (check-equal? (s-test "for (3;4;5) 6;" "for (;4;5) 6;") (fail-msg 1 14 "for (;4;5) 6;" #:msg missing-for-init-msg)) (check-equal? (s-test "for (3;4;5) 6;" "for (3;;5) 6;") (fail-msg 1 14 "for (3;;5) 6;" #:msg missing-for-test-msg)) (check-equal? (s-test "for (3;4;5) 6;" "for (3;4;) 6;") (fail-msg 1 14 "for (3;4;) 6;" #:msg missing-for-update-msg)) (check-equal? (c-stmt-parser-match "if (3 < 4) { return 4; } else {return 2;}" "if ((3 < 4)) {return 4+3;} else return 2;") (fail-msg 25 28 "if ((3 < 4)) {return 4+3;} else return 2;" #:msg wrong-struct-kind-msg)) (check-equal? (c-stmt-parser-match "if (3 < 4) { return 4; } else {return 2;}" "") (failure empty-input-msg)) ;; another bug: (check-equal? (s-test "if (3) {4;} else {5;6;}" "if (3) {4;} else {5;}") (fail-msg 19 21 "if (3) {4;} else {5;}" #:msg missing-elements-msg)) (check-equal? (s-test "if (3) {4;} else {5;6;}" "if (3) {4;} else {5;6;7;}") (fail-msg 19 25 "if (3) {4;} else {5;6;7;}" #:msg extra-elements-msg)) ;; bad pattern: (check-equal? (callerfail? (c-stmt-parser-match "not a c expression" "1234;")) #t) (check-equal? (c-stmt-parser-match "if (( color == 'B' ) || ( color == 'V')) { dark = 'Y'; } else { dark = 'N'; }" "if (( color == 'B' ) || ( color == 'V')) { dark = 'Y'; } else { dark = 'N'; }" ) #s(success)) (check-equal? (c-parser-match "foo" "foo") #s(success)) (check-equal? (c-parser-match "3 + 4" "6 + 4") (fail-msg 1 2 "6 + 4")) (check-equal? (join-srcs (list (src 8 1 7 12 1 11 #f) (src 3 1 2 4 1 3 #f) (src 5 1 4 6 1 5 #f))) (src 3 1 2 12 1 11 #f))
false
f4b492726bd699e1bc7ed2d012dd7c1078264b48
6ba4dce1cec4e67626afb09276181c80460dbb57
/megaparsack-lib/megaparsack/text.rkt
61907e4a7d6af437760da48a77dd3b95776f5152
[ "ISC" ]
permissive
lexi-lambda/megaparsack
cf6a920791552acc3d4e183c278f468ccad59ec3
0ccdee4270da0337700ac62aa106735d0d879695
refs/heads/master
2022-02-24T06:31:56.386670
2022-02-08T21:47:08
2022-02-08T21:55:19
57,872,653
78
13
ISC
2021-01-10T16:50:44
2016-05-02T07:34:47
Racket
UTF-8
Racket
false
false
3,664
rkt
text.rkt
#lang curly-fn racket/base (require data/applicative data/monad megaparsack/base megaparsack/combinator racket/contract racket/list racket/function) (provide (contract-out [parse-string (->* [parser? string?] [any/c] any/c)] [parse-syntax-string (-> parser? (syntax/c string?) any/c)] [char/p (char? . -> . (parser/c char? char?))] [char-not/p (char? . -> . (parser/c char? char?))] [char-ci/p (char? . -> . (parser/c char? char?))] [char-between/p (char? char? . -> . (parser/c char? char?))] [char-in/p (string? . -> . (parser/c char? char?))] [char-not-in/p (string? . -> . (parser/c char? char?))] [any-char/p (parser/c char? char?)] [letter/p (parser/c char? char?)] [digit/p (parser/c char? char?)] [symbolic/p (parser/c char? char?)] [space/p (parser/c char? char?)] [integer/p (parser/c char? integer?)] [string/p (string? . -> . (parser/c char? string?))] [string-ci/p (string? . -> . (parser/c char? string?))])) (define (chars->syntax-boxes chars name pos line col) (if (empty? chars) '() (let ([c (first chars)]) (cons (syntax-box c (srcloc name line col pos 1)) (if (char=? c #\newline) (chars->syntax-boxes (rest chars) name (add1 pos) (add1 line) 0) (chars->syntax-boxes (rest chars) name (add1 pos) line (add1 col))))))) (define (parse-string p input [name 'string]) (parse p (chars->syntax-boxes (string->list input) name 1 1 0))) (define (parse-syntax-string p stx-string) (parse p (chars->syntax-boxes (string->list (syntax->datum stx-string)) (syntax-source stx-string) (syntax-position stx-string) (syntax-line stx-string) (syntax-column stx-string)))) (define (char/p c) (label/p (format "'~a'" c) (satisfy/p #{char=? c}))) (define (char-not/p c) (label/p (format "not '~a'" c) (satisfy/p #{char=/? c}))) (define (char-ci/p c) (label/p (format "'~a'" c) (satisfy/p #{char-ci=? c}))) (define letter/p (label/p "letter" (satisfy/p char-alphabetic?))) (define digit/p (label/p "number" (satisfy/p char-numeric?))) (define symbolic/p (label/p "symbolic" (satisfy/p char-symbolic?))) (define space/p (label/p "whitespace" (satisfy/p (disjoin char-whitespace? char-blank?)))) (define any-char/p (label/p "any character" (satisfy/p (lambda (_) #t)))) (define integer/p (label/p "integer" (do [digits <- (many+/p digit/p)] (pure (string->number (apply string digits)))))) (define (chars/p str char-parser) (if (zero? (string-length str)) (pure "") (label/p str (do (char-parser (string-ref str 0)) (string/p (substring str 1)) (pure str))))) (define (string/p str) (chars/p str char/p)) (define (string-ci/p str) (chars/p str char-ci/p)) (define (char-between/p low high) (label/p (format "a character between '~a' and '~a'" low high) (satisfy/p #{char<=? low % high}))) (define (char-in/p str) (apply or/p (map char/p (string->list str)))) (define (char-not-in/p str) (satisfy/p #{string-not-member? str})) ;;; ;; char and string utility functions (define (char=/? c k) (not (char=? c k))) (define (char-ci=/? c k) (not (char-ci=? c k))) (define (string-member? str c) (for/or ([k str]) (char=? k c))) (define (string-not-member? str c) (not (string-member? str c)))
false
c6e8afec7ffd3733076a07e1c4d36caf4011d121
32ec46d862e6433fe64d72522dacc6096489b73c
/fontpict.rkt
6e40dc35843902b9509d56fedb3c87477379d0f6
[ "MIT" ]
permissive
davelab6/sfont
627da298d2a832d8e5413a486fb9f27d4e43acc9
f7f08d6e648d0892a7ee42a78753547d52e6389a
refs/heads/master
2021-01-18T03:09:34.179472
2013-09-11T13:22:15
2013-09-11T13:22:15
null
0
0
null
null
null
null
UTF-8
Racket
false
false
7,308
rkt
fontpict.rkt
#lang slideshow (require racket/draw "vec.rkt" "bezier.rkt" "utilities.rkt") (provide *size* *text* set-sample-size! set-sample-text! set-contour-view! show-kerning! hide-kerning! string->text with-sample-text pictf:font pictf:glyph unique-letters) ;;; Global variables (define *pen* (new pen% [style 'transparent])) (define *size* 100) (define *text* '((a b c d e f g h i j k l m n o p q r s t u v w x y z))) (define *show-kerning* #t) (define (set-sample-size! s) (set! *size* s)) (define (set-sample-text! t) (set! *text* t)) (define (show-kerning!) (set! *show-kerning* #t)) (define (hide-kerning!) (set! *show-kerning* #f)) (define (set-contour-view! b) (if b (set! *pen* (new pen% [color "red"])) (set! *pen* (new pen% [style 'transparent])))) ;;; Line is one of: ;;; - nil ;;; - (cons Symbol Line) ;;; Text ;;; Text is one of: ;;; - nil ;;; - (cons Line Text) ;;; The text to be displayed ; Text -> Boolean ; True if it is a multiline text (define (multiline? t) (> (length t) 1)) ; Text -> Natural ; produce the total number of lines in text (define (lines t) (length t)) ; Text -> Line ; produce a line with all the glyph used in text without duplicates (define (unique-letters t) (remove-duplicates (flatten t))) ; String -> Line ; produce a line from a string (define (string->line s) (letrec ([m-read (lambda (loc acc) (cond [(null? loc) (reverse acc)] [(eq? #\space (car loc)) (m-read (cdr loc) (cons 'space acc))] [(eq? #\newline (car loc)) (m-read (cdr loc) (cons 'space acc))] [(eq? #\/ (car loc)) (read-name (cdr loc) acc '())] [else (m-read (cdr loc) (cons (string->symbol (list->string (list (car loc)))) acc))]))] [read-name (lambda (loc acc n) (cond [(null? loc) (m-read loc (cons (string->symbol (list->string (reverse n))) acc))] [(eq? #\space (car loc)) (m-read (cdr loc) (cons (string->symbol (list->string (reverse n))) acc))] [else (read-name (cdr loc) acc (cons (car loc) n))]))]) (m-read (string->list s) '()))) ; String -> Text ; produce a text from a string (define (string->text s) (map string->line (string-split s "\n"))) (define-syntax-rule (with-sample-text (text size) body) (let ([t *text*] [s *size*]) (begin (set-sample-text! text) (set-sample-size! size) body (set-sample-text! t) (set-sample-size! s)))) (define (name glyph) (car glyph)) (define (advance glyph) (cadr glyph)) (define (contours glyph) (cddr glyph)) (define (draw-contour path c) (define (aux pts) (match pts [(list-rest (list-rest (list 'move _ _) _) _) (for-each (lambda (c) (draw-contour path c)) pts)] [(list) (send path close)] [(list-rest (list 'move x y) rest) (begin (send path move-to x y) (aux rest))] [(list-rest (list 'off x1 y1) (list 'off x2 y2) (list x3 y3) rest) (begin (send path curve-to x1 y1 x2 y2 x3 y3) (aux rest))] [(list-rest (list x y) rest) (begin (send path line-to x y) (aux rest))])) (aux c)) (define (pictf:draw-glyph dc glyph [kv 0]) (begin (send dc translate kv 0) (define path (new dc-path%)) (for-each (lambda (c) (bezier->path c path)) (contours glyph)) (send dc draw-path path 0 0 'winding) (send dc translate (advance glyph) 0))) (define (calculate-length glyphs) (foldr + 0 (map advance glyphs))) ; DC Number Number Number (listOf DrawableGlyph) ((Symbol Symbol) -> Number) -> void ; draw the font in the drawing context (define (draw-font-dc dc ascender descender leading glyphs [kerning (lambda (p) 0)]) (let ([f (/ *size* (+ ascender (- descender)))]) (begin (send dc set-brush "black" 'solid) (send dc set-pen *pen*) (send dc scale f (- f)) (send dc translate 0 (- (/ (* *size* -0.5) f) ascender)) (for-each (lambda (l) (begin (pictf:draw-line dc l (- (/ (* *size* leading) f)) glyphs (if *show-kerning* kerning (lambda (p) 0))) (let ([current-x (vector-ref (vector-ref (send dc get-transformation) 0) 4)]) (send dc translate (/ (- current-x) f) 0)))) *text*)))) ; Number Number (listOf DrawableGlyph) ((Symbol Symbol) -> Number) -> pict ; draw the current *text* (define (pictf:font ascender descender glyphs [kerning (lambda (p) 0)]) (let* ([leading 1.2] [n-lines (lines *text*)] [area-height (* *size* (+ 1 n-lines (* (- leading 1) (- n-lines 1))))]) (dc (lambda (dc dx dy) (draw-font-dc dc ascender descender leading glyphs kerning)) 1300 area-height))) ; DC Line Number (listOf DrawableGlyph) ((Symbol Symbol) -> Number) -> void ; draw the line to the dc (define (pictf:draw-line dc l leading glyphs [kerning (lambda (p) 0)]) (let* ([glyphs-to-display (filter identity (map (lambda (g) (assoc g glyphs)) l))] [k (cons 0 (map kerning (n-groups (map name glyphs-to-display) 2)))]) (begin ;(print (send dc get-transformation)) (for-each (lambda (g kv) (pictf:draw-glyph dc g kv)) glyphs-to-display k) (send dc translate 0 leading)))) #; (define (pictf:font ascender descender . glyphs) (let* ([letters *text*] [f (/ *size* (+ ascender (- descender)))] [glyphs-to-display (filter identity (map (lambda (g) (assoc g glyphs)) letters))]) (dc (lambda (dc dx dy) (begin (send dc set-brush "black" 'solid) (send dc set-pen *pen*) (send dc scale f (- f)) (send dc translate 0 (- (/ (* *size* -0.5) f) ascender)) (for-each (lambda (g) (pictf:draw-glyph dc g)) glyphs-to-display ))) 1300 (* *size* 2)))) (define (draw-glyph-dc dc g f x-min y-max) (begin (send dc set-brush "black" 'solid) (send dc set-pen *pen*) (send dc scale f (- f)) (send dc translate (- x-min) (- y-max)) (pictf:draw-glyph dc g))) ; Glyph BoundingBox (Number or False) (Number or False) -> pict ; Draw the glyph (define (pictf:glyph g bb [ascender #f] [upm #f]) (let* ([vbb (vec- (cdr bb) (car bb))] [w (vec-x vbb)] [h (vec-y vbb)] [x-min (vec-x (car bb))] [by-max (vec-y (cdr bb))] [y-max (if ascender (max by-max ascender) by-max)] [f (cond [upm (/ 400 upm)] [(> h 0) (/ 400 h)] [else 1])]) (dc (lambda (dc dx dy) (draw-glyph-dc dc g f x-min y-max)) (* f w) (* f (if upm upm h)))))
true
e7f2767591edd6aeaaa39ce6e05853a790e09a5a
c86a68a8b8664e6def1e072448516b13d62432c2
/markdown/xexpr.rkt
da311bab575ef78bea70ad723023e2591f6d2f78
[ "BSD-3-Clause", "BSD-2-Clause" ]
permissive
greghendershott/markdown
97e9317aed13bfc7d48f9c88ca9b726774d7911d
34ada7458fad51d3a5e0516352f8bd399c517140
refs/heads/master
2022-12-05T13:35:32.353364
2022-11-25T18:06:09
2022-11-25T18:09:38
8,568,669
89
27
null
2021-03-25T14:21:20
2013-03-05T00:42:54
Racket
UTF-8
Racket
false
false
3,484
rkt
xexpr.rkt
;; Copyright (c) 2013-2022 by Greg Hendershott. ;; SPDX-License-Identifier: BSD-2-Clause #lang racket/base (require racket/match racket/string) (provide normalize normalize-xexprs) (module+ test (require rackunit)) ;; normalize : xexpr? -> xexpr? ;; ;; Do some recursive normalizations on the xexpr: ;; 0. Splice any (SPLICE ...) elements like unquote-splicing. ;; 1. Append consecutive string? elements in the xexpression. ;; 2. Delete any "" elements left after 1. ;; 3. Unless pre element, delete any trailing \\s in the LAST element. (define (normalize x) (match x [`(,tag ,as . ,es) `(,tag ,as ,@(normalize-elements tag es))] [x x])) (define pre-level (make-parameter 0)) (define (normalize-elements tag es) (parameterize ([pre-level (match tag ['pre (add1 (pre-level))] [_ (pre-level)])]) (let loop ([es (splice es)]) ;; 0 (match es [(list* (? string? this) (? string? next) more) ;; 1 (loop (cons (string-append this next) more))] [(cons "" more) ;; 2 (loop more)] [(cons (? string? this) more) (cond [(and (zero? (pre-level)) (not (eq? tag 'HTML-COMMENT))) (let ([this (match more ['() (string-trim this #:left? #f)] ;; 3 [_ this])]) (match this ["" (loop more)] [this (cons this (loop more))]))] [else (cons this (loop more))])] [(cons this more) (cons (normalize this) (loop more))] ['() '()])))) (module+ test (check-equal? (normalize `(p () "a" "b" "c" "d" "e" (p () "1" "2" "3 "))) '(p () "abcde" (p () "123"))) (check-equal? (normalize `(p () "empty space at end ")) '(p () "empty space at end")) (check-equal? (normalize `(p () " ")) '(p ())) ;; pre elements (check-equal? (normalize `(pre () " x " " y ")) '(pre () " x y ")) (check-equal? (normalize `(pre () "foo" " " "\t" "\n" " " "bar")) '(pre () "foo \t\n bar")) (check-equal? (normalize `(pre () (code () " x " " y "))) '(pre () (code () " x y "))) (check-equal? (normalize `(pre () (code () "foo" " " "\t" "\n" " " "bar"))) '(pre () (code () "foo \t\n bar")))) ;; normalize-xexprs : (listof xexpr?) -> (listof xexpr?) ;; ;; Like normalize but for a (listof xexpr?) not just one. (define (normalize-xexprs xs) (match (normalize `(_ () ,@xs)) [`(_ () . ,xs) xs])) ;; splice : (listof xexpr?) -> (listof xexpr?) ;; ;; Do the equivalent of ,@ a.k.a. unquote-splicing recursively on all ;; `(@SPLICE es ...)` elements, such that the `es` get lifted/spliced. (define (splice xs) (let loop ([xs xs]) (match xs [`((SPLICE . ,es) . ,more) (loop (append es more))] [(cons this more) (cons this (loop more))] ['() '()]))) (module+ test (check-equal? (splice `((p () "A") (SPLICE "a" "b") (p () "B"))) `((p () "A") "a" "b" (p () "B"))) (check-equal? (normalize `(p () "a" "b" (SPLICE "c" "d") "e" "f")) `(p () "abcdef")) (check-equal? (normalize `(p () "a" (SPLICE "b" (SPLICE "c") "d") "e")) `(p () "abcde")))
false