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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1bc668d99d697457393d2f67e0f5e0ba9f89d696 | b43e36967e36167adcb4cc94f2f8adfb7281dbf1 | /scheme/swl1.3/src/swl/scale.ss | 4c5d6b7cb4e32d82d9bb0480adcb7340b60a71de | [
"SWL",
"TCL"
]
| permissive | ktosiu/snippets | 79c58416117fa646ae06a8fd590193c9dd89f414 | 08e0655361695ed90e1b901d75f184c52bb72f35 | refs/heads/master | 2021-01-17T08:13:34.067768 | 2016-01-29T15:42:14 | 2016-01-29T15:42:14 | 53,054,819 | 1 | 0 | null | 2016-03-03T14:06:53 | 2016-03-03T14:06:53 | null | UTF-8 | Scheme | false | false | 10,248 | ss | scale.ss | ;; Copyright (c) 1996 Oscar Waddell
;;
;; See the file "Notice" for information on usage and redistribution
;; of this file, and for a DISCLAIMER OF ALL WARRANTIES.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Scale
;;
;; skipping the label option -- easy to get from compound widget
;; OTOH may be less efficient to do that
;; yet, it would certainly be more flexible,
;; and we eventually want labels etc to be as efficient as possible
(swl:api-class (<scale> parent) (<proto-slider> parent 'scale)
;% \swlapi{class}{<scale>}{(create <scale> parent)}
;* \ret{instance}
;;
;* A scale allows the user to interactively select a value
;* from a range of integer or floating point
;* values by dragging a slider bar along a trough whose length
;* represents the range.
;* The slider can be moved by
;* clicking or dragging the mouse or using the arrow keys
;* when the slider has keyboard focus.
;* When the slider's value changes, the value is passed to the
;* procedure specified by \scheme{set-action!}.
;*
;* A scale can display the currently selected value underneath the slider
;* and can also show tick marks. Scales can be oriented horizontally
;* or vertically.
(ivars (old-value #f))
(inherited handle drag action)
(inheritable handle)
(private)
(protected
[small-slide (fn)
(let ([v (get-value self)]
[from (get-min self)]
[to (get-max self)]
[res (get-resolution self)])
(let ([newv (fn v res)])
(set-value! self
(cond [(< newv from) from] [(> newv to) to] [else newv]))))]
[big-slide (fn)
(let ((v (get-value self))
(from (get-min self))
(to (get-max self))
(skip (get-skip-increment self)))
(let ([newv (fn v skip)])
(set-value! self
(cond [(< newv from) from] [(> newv to) to] [else newv]))))]
[slider-hit (x y)
(let ([hit (identify x y)])
(cond
[(string=? hit "slider")
(set-drag! x y)
(set-slider-relief! 'sunken)]
[(or (string=? hit "arrow1") (string=? hit "trough1"))
(begin-slide (lambda () (small-slide -)))]
[(or (string=? hit "arrow2") (string=? hit "trough2"))
(begin-slide (lambda () (small-slide +)))]))]
[set-drag! (x y)
(set! drag
(let ([old-val (get-value self)]
[padding (+ (get-slider-length self)
(* 2 (get-traversal-thickness self))
(* 4 (get-border-width self)))])
(case (get-orientation self)
[(vertical)
(let ([d (/ (- (get-max self) (get-min self))
(- (get-height self) padding))]
[old-y y])
(lambda (x y)
(set-value! self (- old-val (* d (- old-y y))))))]
[(horizontal)
(let ([d (/ (- (get-max self) (get-min self))
(- (get-width self) padding))]
[old-x x])
(lambda (x y)
(set-value! self (- old-val (* d (- old-x x))))))])))]
[activate (x y)
(swl:tcl-eval handle 'config '-state
(if (string=? "slider" (identify x y)) 'active 'normal))
(void)]
[deactivate (x y)
(swl:tcl-eval handle 'config '-state 'normal)
(void)]
[set-slider-relief! (relief)
; once we go to tk4.1
; (swl:tcl-eval handle 'config '-sliderrelief relief)
(void)])
(public
[key-press (key modifiers)
;% \ret{unspecified}
(event-case ((key= key) (modifier= modifiers))
(([home]) (set-value! self (get-min self)))
(([end]) (set-value! self (get-max self)))
(else (send-base self key-press key modifiers)))]
[mouse-press (x y modifiers)
;% \ret{unspecified}
(event-case ((modifier= modifiers))
(([control left-button])
(let ([hit (identify x y)])
(cond
[(string=? hit "trough1") (set-value! self (get-min self))]
[(string=? hit "trough2") (set-value! self (get-max self))])))
(else (send-base self mouse-press x y modifiers)))]
[set-digits! (val)
;* \ret{unspecified}
;* Sets the number of significant digits in the value of the scale.
;* If zero, then the scale chooses the smallest value that distinguishes
;* each position of the slider.
(set-tk-option '-digits val (lambda (x) (and (fixnum? x) (not (fxnegative? x))))
'set-digits!)]
[get-digits ()
;* \ret{see below}
;* Returns the number of significant digits in the value of the scale.
;* If zero, then the scale chooses the smallest value that distinguishes
;* each position of the slider.
(get-tk-option '-digits string->number 'get-digits)]
[set-show-value! (val)
;* \ret{unspecified}
;* \var{val} is a boolean indicating whether or not the scale should
;* show its current value beside the slider.
(set-tk-option '-showvalue val boolean? 'set-show-value!)]
[get-show-value ()
;* \ret{see below}
;* returns a boolean indicating whether or not the scale
;* shows its current value beside the slider.
(get-tk-option '-showvalue tk->boolean 'get-show-value)]
[set-min! (val)
;* \ret{unspecified}
;* sets the low value of the range represented by the scale
;* to the integer or floating point number \var{val}.
(set-tk-option '-from val swl:oknum? 'set-min!)]
[get-min ()
;* \ret{see below}
;* returns the low value of the range represented by the scale.
(get-tk-option '-from string->number 'get-min)]
[set-max! (val)
;* \ret{unspecified}
;* sets the high value of the range represented by the scale
;* to the integer or floating point number \var{val}.
(set-tk-option '-to val swl:oknum? 'set-max!)]
[get-max ()
;* \ret{see below}
;* returns the high value of the range represented by the scale.
(get-tk-option '-to string->number 'get-max)]
[set-resolution! (val)
;* \ret{unspecified}
;* sets the resolution of the scale's value to \var{val}. If greater than
;* zero, the value of the scale will be rounded to an even multiple
;* of \var{val}.
(set-tk-option '-resolution val swl:oknum? 'set-resolution!)]
[get-resolution ()
;* \ret{see below}
;* returns the resolution of the scale's value.
(get-tk-option '-resolution string->number 'get-resolution)]
[set-slider-length! (val)
;* \ret{unspecified}
;* sets the length of the slider along its long dimension to \var{val}
;* pixels.
(set-tk-option '-sliderlength val swl:distance-unit? 'set-slider-length!)]
[get-slider-length ()
;* \ret{see below}
;* returns the length in pixels of the slider along its long dimension.
(get-tk-option '-sliderlength string->number 'get-slider-length)]
[set-skip-increment! (val)
;* \ret{unspecified}
;* sets the size of the skips made when the scale is clicked on in
;* a way that jumps.
(set-tk-option '-bigincrement val swl:oknum? 'set-skip-increment!)]
[get-skip-increment ()
;* \ret{see below}
;* returns the size of the skips made when the scale is clicked on in
;* a way that jumps.
(get-tk-option '-bigincrement string->number 'get-skip-increment)]
[set-length! (val)
;* \ret{unspecified}
;* sets the length in pixels of the long dimension of the scale.
;; shouldn't let the length be set smaller than slider length, or should
;; adjust slider length to match...
(set-tk-option '-length val swl:distance-unit? 'set-length!)]
[get-length ()
;* \ret{see below}
;* returns the length in pixels of the long dimension of the scale.
(get-tk-option '-length string->number 'get-length)]
[set-value! (value)
;* \ret{unspecified}
;* sets the current value of the scale to \var{value}.
;* The \var{action} procedure, if any, is invoked with the instance
;* and the new value.
(swl:tcl-eval handle 'set value)
;; call Tcl/Tk to get the result of applying the min, max, and resolution
;; settings to this value, could handle on Scheme side trading some hair
;; for performance.
(let ((newval (get-value self)))
(when (not (and old-value (= newval old-value))) (action self newval))
(set! old-value newval))
(void)]
[set-action! (val)
;* \ret{unspecified}
;* \var{val} specifies a procedure to be called when
;* the value of the scale is changed.
;* The procedure is passed two arguments: the instance and the
;* current value of the scale.
(swl:safety-check
(unless (procedure? val)
(assertion-violationf 'set-action! "~s is not a procedure" val)))
(set! action val)
(action self (get-value self))]
[get-value ()
;* \ret{see below}
;* returns the current value of the scale.
(string->number (swl:tcl-eval handle 'get))]
[set-foreground-color! (val)
;* \ret{unspecified}
;* Sets the default foreground color for the scale to \var{val},
;* which is either a symbol naming a color in
;* \mytt{/usr/lib/X11/rgb.txt} or an instance of \scheme{<rgb>}.
(set-tk-option '-foreground val swl:color? 'set-foreground-color!)]
[get-foreground-color ()
;* \ret{see below}
;* Returns the default foreground color for the scale.
;* The value returned is either a symbol naming a color in
;* \mytt{/usr/lib/X11/rgb.txt} or an instance of \scheme{<rgb>}.
(get-tk-option '-foreground tk->color 'get-foreground-color)]
[set-font! (val)
;* \ret{unspecified}
;; could have gotten this by inheritance with more effort
;* Sets the default font for text displayed by the scale.
;* \var{val} is an instance of \scheme{<font>} (see the description
;* of the \scheme{make-font} macro).
;* This affects the display of the scale's value.
(set-tk-option '-font val swl:font? 'set-font!)]
[get-font ()
;* \ret{see below}
;* Returns an instance of \scheme{<font>} describing the default font
;* for text displayed by the scale.
(get-tk-option '-font tk->font 'get-font)]))
| false |
67a6ae539d38388a29df15fcd83ad5ae4ccb567f | 648776d3a0d9a8ca036acaf6f2f7a60dcdb45877 | /queries/rnoweb/folds.scm | f451a3f3b7f75e2029b38064abbff1cb2cf28f3b | [
"Apache-2.0"
]
| permissive | nvim-treesitter/nvim-treesitter | 4c3c55cbe6ff73debcfaecb9b7a0d42d984be3e6 | f8c2825220bff70919b527ee68fe44e7b1dae4b2 | refs/heads/master | 2023-08-31T20:04:23.790698 | 2023-08-31T09:28:16 | 2023-08-31T18:19:23 | 256,786,531 | 7,890 | 980 | Apache-2.0 | 2023-09-14T18:07:03 | 2020-04-18T15:24:10 | Scheme | UTF-8 | Scheme | false | false | 20 | scm | folds.scm | [
(rchunk)
] @fold
| false |
8e5bdaefaf9cddb34c13908ae9bd7f87fe573295 | 5a05fab297275b592ccd554d3f086bf1ccf7956d | /back/experiment/testcase/abs/5_sform.scm | 72fcea37ff5fd10074b275499f56b4ed438a3b00 | []
| no_license | mkiken/x-scala | 643af77b7f9f31a32631007d56f5f1be796aed3e | daebc81d36d9f8a69393f02c3241a0c20ed0b864 | refs/heads/master | 2016-09-06T13:21:29.879990 | 2014-02-26T13:14:04 | 2014-02-26T13:14:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 55,962 | scm | 5_sform.scm | (begin (define-syntax Abs-Macro (syntax-rules () ((_ V-num) (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "BlockExpression" ("Scala" "Block" (letrec* () (("Scala" "AssignmentExpression" #\nul V-num ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 10 #\nul) #\nul)))) #\nul))) #\nul)))))) #\nul))))) ("Scala" "TopStat" #\nul #\nul ("Scala" "ObjectTemplateDefinition" #\nul ("Scala" "ObjectDefinition" V-Abs_Hygienic ("Scala" "ClassTemplateOpt" #\nul ("Scala" "TemplateBody" (letrec* ((R-main- ((lambda () (function FunctionDefinition) (#\nul #\nul) ("Scala" "FunctionSignature" R-main- #\nul ("Scala" "ParamClauses" (("Scala" "ParamClause" ("Scala" "Params" (("Scala" "Param" #\nul R-args- ("Scala" "RepeatedParamType" ("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-Array-)) (("Scala" "TypeArgs" ("Scala" "Types" (("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-String-)) #\nul) #\nul) #\nul #\nul) #\nul #\nul))))))) #\nul) #\nul #\nul) #\nul #\nul)) #\nul) #\nul))))) #\nul)) ("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-Unit-)) #\nul) #\nul) #\nul #\nul) #\nul #\nul)) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "BlockExpression" ("Scala" "Block" (letrec* ((V-b ((val variable) (#\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 10 #\nul) #\nul)))) #\nul) (#\nul #\nul))) (V-id ((lambda () (function Procedure) (#\nul #\nul) ("Scala" "FunctionSignature" V-id #\nul ("Scala" "ParamClauses" (("Scala" "ParamClause" ("Scala" "Params" (("Scala" "Param" #\nul V-a ("Scala" "RepeatedParamType" ("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-Int-)) #\nul) #\nul) #\nul #\nul) #\nul #\nul)) #\nul) #\nul))))) #\nul)) #\nul ("Scala" "Block" (letrec* () (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-println ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-a #\nul) #\nul)))) #\nul)))) #\nul)) #\nul)))) #\nul) ("Scala" "AssignmentExpression" #\nul V-b ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-b #\nul) #\nul)) V-+ ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 1 #\nul) #\nul)))))) #\nul)) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-id ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-a #\nul) #\nul)) V-+ ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 1 #\nul) #\nul)))))) #\nul)))) #\nul)) #\nul)))) #\nul)) #\nul))))) (V-tmp ((val variable) (#\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" ("Scala" "Keyword" "-") ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 100 #\nul) #\nul)))) #\nul) (#\nul #\nul))) (V-a ((val variable) (#\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 3 #\nul) #\nul)))) #\nul) (#\nul #\nul)))) (#\nul #\nul #\nul #\nul ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-println ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" ((#\nul (Abs-Macro V-tmp) #\nul)))) #\nul)) #\nul)))) #\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-id ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 3 #\nul) #\nul)))) #\nul)))) #\nul)) #\nul)))) #\nul)) #\nul)))))) #\nul))))) #\nul (#\nul #\nul))))))) #\nul)
(begin (define-syntax Abs-Macro (syntax-rules (V-[object Object]) ((_ V-num) (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "BlockExpression" ("Scala" "Block" (letrec* () (("Scala" "AssignmentExpression" #\nul V-num ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 10 #\nul) #\nul)))) #\nul))) #\nul)))))) #\nul))))) ("Scala" "TopStat" #\nul #\nul ("Scala" "ObjectTemplateDefinition" #\nul ("Scala" "ObjectDefinition" V-Abs_Hygienic ("Scala" "ClassTemplateOpt" #\nul ("Scala" "TemplateBody" (letrec* ((R-main- ((lambda () (function FunctionDefinition) (#\nul #\nul) ("Scala" "FunctionSignature" R-main- #\nul ("Scala" "ParamClauses" (("Scala" "ParamClause" ("Scala" "Params" (("Scala" "Param" #\nul R-args- ("Scala" "RepeatedParamType" ("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-Array-)) (("Scala" "TypeArgs" ("Scala" "Types" (("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-String-)) #\nul) #\nul) #\nul #\nul) #\nul #\nul))))))) #\nul) #\nul #\nul) #\nul #\nul)) #\nul) #\nul))))) #\nul)) ("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-Unit-)) #\nul) #\nul) #\nul #\nul) #\nul #\nul)) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "BlockExpression" ("Scala" "Block" (letrec* ((V-b ((val variable) (#\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 10 #\nul) #\nul)))) #\nul) (#\nul #\nul))) (V-id ((lambda () (function Procedure) (#\nul #\nul) ("Scala" "FunctionSignature" V-id #\nul ("Scala" "ParamClauses" (("Scala" "ParamClause" ("Scala" "Params" (("Scala" "Param" #\nul V-a ("Scala" "RepeatedParamType" ("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-Int-)) #\nul) #\nul) #\nul #\nul) #\nul #\nul)) #\nul) #\nul))))) #\nul)) #\nul ("Scala" "Block" (letrec* () (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-println ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-a #\nul) #\nul)))) #\nul)))) #\nul)) #\nul)))) #\nul) ("Scala" "AssignmentExpression" #\nul V-b ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-b #\nul) #\nul)) V-+ ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 1 #\nul) #\nul)))))) #\nul)) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-id ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-a #\nul) #\nul)) V-+ ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 1 #\nul) #\nul)))))) #\nul)))) #\nul)) #\nul)))) #\nul)) #\nul))))) (V-tmp ((val variable) (#\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" ("Scala" "Keyword" "-") ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 100 #\nul) #\nul)))) #\nul) (#\nul #\nul))) (V-a ((val variable) (#\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 3 #\nul) #\nul)))) #\nul) (#\nul #\nul)))) (#\nul #\nul #\nul #\nul ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-println ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" ((#\nul (Abs-Macro V-tmp) #\nul)))) #\nul)) #\nul)))) #\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-id ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 3 #\nul) #\nul)))) #\nul)))) #\nul)) #\nul)))) #\nul)) #\nul)))))) #\nul))))) #\nul (#\nul #\nul))))))) #\nul)
(begin (define-syntax Abs-Macro (syntax-rules (V-[object Object]) ((_ V-num) (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "BlockExpression" ("Scala" "Block" (letrec* () (("Scala" "AssignmentExpression" #\nul V-num ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 10 #\nul) #\nul)))) #\nul))) #\nul)))))) #\nul))))) ("Scala" "TopStat" #\nul #\nul ("Scala" "ObjectTemplateDefinition" #\nul ("Scala" "ObjectDefinition" V-Abs_Hygienic ("Scala" "ClassTemplateOpt" #\nul ("Scala" "TemplateBody" (letrec* ((R-main- ((lambda () (function FunctionDefinition) (#\nul #\nul) ("Scala" "FunctionSignature" R-main- #\nul ("Scala" "ParamClauses" (("Scala" "ParamClause" ("Scala" "Params" (("Scala" "Param" #\nul R-args- ("Scala" "RepeatedParamType" ("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-Array-)) (("Scala" "TypeArgs" ("Scala" "Types" (("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-String-)) #\nul) #\nul) #\nul #\nul) #\nul #\nul))))))) #\nul) #\nul #\nul) #\nul #\nul)) #\nul) #\nul))))) #\nul)) ("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-Unit-)) #\nul) #\nul) #\nul #\nul) #\nul #\nul)) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "BlockExpression" ("Scala" "Block" (letrec* ((V-b ((val variable) (#\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 10 #\nul) #\nul)))) #\nul) (#\nul #\nul))) (V-id ((lambda () (function Procedure) (#\nul #\nul) ("Scala" "FunctionSignature" V-id #\nul ("Scala" "ParamClauses" (("Scala" "ParamClause" ("Scala" "Params" (("Scala" "Param" #\nul V-a ("Scala" "RepeatedParamType" ("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-Int-)) #\nul) #\nul) #\nul #\nul) #\nul #\nul)) #\nul) #\nul))))) #\nul)) #\nul ("Scala" "Block" (letrec* () (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-println ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-a #\nul) #\nul)))) #\nul)))) #\nul)) #\nul)))) #\nul) ("Scala" "AssignmentExpression" #\nul V-b ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-b #\nul) #\nul)) V-+ ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 1 #\nul) #\nul)))))) #\nul)) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-id ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-a #\nul) #\nul)) V-+ ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 1 #\nul) #\nul)))))) #\nul)))) #\nul)) #\nul)))) #\nul)) #\nul))))) (V-tmp ((val variable) (#\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" ("Scala" "Keyword" "-") ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 100 #\nul) #\nul)))) #\nul) (#\nul #\nul))) (V-a ((val variable) (#\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 3 #\nul) #\nul)))) #\nul) (#\nul #\nul)))) (#\nul #\nul #\nul #\nul ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-println ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" ((#\nul (Abs-Macro V-tmp) #\nul)))) #\nul)) #\nul)))) #\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-id ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 3 #\nul) #\nul)))) #\nul)))) #\nul)) #\nul)))) #\nul)) #\nul)))))) #\nul))))) #\nul (#\nul #\nul))))))) #\nul)
(begin (define-syntax Abs-Macro (syntax-rules (V-[object Object]) ((_ V-num) (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "BlockExpression" ("Scala" "Block" (letrec* () (("Scala" "AssignmentExpression" #\nul V-num ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 10 #\nul) #\nul)))) #\nul))) #\nul)))))) #\nul))))) ("Scala" "TopStat" #\nul #\nul ("Scala" "ObjectTemplateDefinition" #\nul ("Scala" "ObjectDefinition" V-Abs_Hygienic ("Scala" "ClassTemplateOpt" #\nul ("Scala" "TemplateBody" (letrec* ((R-main- ((lambda () (function FunctionDefinition) (#\nul #\nul) ("Scala" "FunctionSignature" R-main- #\nul ("Scala" "ParamClauses" (("Scala" "ParamClause" ("Scala" "Params" (("Scala" "Param" #\nul R-args- ("Scala" "RepeatedParamType" ("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-Array-)) (("Scala" "TypeArgs" ("Scala" "Types" (("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-String-)) #\nul) #\nul) #\nul #\nul) #\nul #\nul))))))) #\nul) #\nul #\nul) #\nul #\nul)) #\nul) #\nul))))) #\nul)) ("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-Unit-)) #\nul) #\nul) #\nul #\nul) #\nul #\nul)) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "BlockExpression" ("Scala" "Block" (letrec* ((V-b ((val variable) (#\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 10 #\nul) #\nul)))) #\nul) (#\nul #\nul))) (V-id ((lambda () (function Procedure) (#\nul #\nul) ("Scala" "FunctionSignature" V-id #\nul ("Scala" "ParamClauses" (("Scala" "ParamClause" ("Scala" "Params" (("Scala" "Param" #\nul V-a ("Scala" "RepeatedParamType" ("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-Int-)) #\nul) #\nul) #\nul #\nul) #\nul #\nul)) #\nul) #\nul))))) #\nul)) #\nul ("Scala" "Block" (letrec* () (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-println ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-a #\nul) #\nul)))) #\nul)))) #\nul)) #\nul)))) #\nul) ("Scala" "AssignmentExpression" #\nul V-b ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-b #\nul) #\nul)) V-+ ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 1 #\nul) #\nul)))))) #\nul)) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-id ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-a #\nul) #\nul)) V-+ ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 1 #\nul) #\nul)))))) #\nul)))) #\nul)) #\nul)))) #\nul)) #\nul))))) (V-tmp ((val variable) (#\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" ("Scala" "Keyword" "-") ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 100 #\nul) #\nul)))) #\nul) (#\nul #\nul))) (V-a ((val variable) (#\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 3 #\nul) #\nul)))) #\nul) (#\nul #\nul)))) (#\nul #\nul #\nul #\nul ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-println ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" ((#\nul (Abs-Macro V-tmp) #\nul)))) #\nul)) #\nul)))) #\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-id ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 3 #\nul) #\nul)))) #\nul)))) #\nul)) #\nul)))) #\nul)) #\nul)))))) #\nul))))) #\nul (#\nul #\nul))))))) #\nul)
(begin (define-syntax Abs-Macro (syntax-rules (V-[object Object]) ((_ V-num) (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "BlockExpression" ("Scala" "Block" (letrec* () (("Scala" "AssignmentExpression" #\nul V-num ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 10 #\nul) #\nul)))) #\nul))) #\nul)))))) #\nul))))) ("Scala" "TopStat" #\nul #\nul ("Scala" "ObjectTemplateDefinition" #\nul ("Scala" "ObjectDefinition" V-Abs_Hygienic ("Scala" "ClassTemplateOpt" #\nul ("Scala" "TemplateBody" (letrec* ((R-main- ((lambda () (function FunctionDefinition) (#\nul #\nul) ("Scala" "FunctionSignature" R-main- #\nul ("Scala" "ParamClauses" (("Scala" "ParamClause" ("Scala" "Params" (("Scala" "Param" #\nul R-args- ("Scala" "RepeatedParamType" ("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-Array-)) (("Scala" "TypeArgs" ("Scala" "Types" (("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-String-)) #\nul) #\nul) #\nul #\nul) #\nul #\nul))))))) #\nul) #\nul #\nul) #\nul #\nul)) #\nul) #\nul))))) #\nul)) ("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-Unit-)) #\nul) #\nul) #\nul #\nul) #\nul #\nul)) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "BlockExpression" ("Scala" "Block" (letrec* ((V-b ((val variable) (#\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 10 #\nul) #\nul)))) #\nul) (#\nul #\nul))) (V-id ((lambda () (function Procedure) (#\nul #\nul) ("Scala" "FunctionSignature" V-id #\nul ("Scala" "ParamClauses" (("Scala" "ParamClause" ("Scala" "Params" (("Scala" "Param" #\nul V-a ("Scala" "RepeatedParamType" ("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-Int-)) #\nul) #\nul) #\nul #\nul) #\nul #\nul)) #\nul) #\nul))))) #\nul)) #\nul ("Scala" "Block" (letrec* () (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-println ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-a #\nul) #\nul)))) #\nul)))) #\nul)) #\nul)))) #\nul) ("Scala" "AssignmentExpression" #\nul V-b ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-b #\nul) #\nul)) V-+ ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 1 #\nul) #\nul)))))) #\nul)) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-id ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-a #\nul) #\nul)) V-+ ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 1 #\nul) #\nul)))))) #\nul)))) #\nul)) #\nul)))) #\nul)) #\nul))))) (V-tmp ((val variable) (#\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" ("Scala" "Keyword" "-") ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 100 #\nul) #\nul)))) #\nul) (#\nul #\nul))) (V-a ((val variable) (#\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 3 #\nul) #\nul)))) #\nul) (#\nul #\nul)))) (#\nul #\nul #\nul #\nul ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-println ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" ((#\nul (Abs-Macro V-tmp) #\nul)))) #\nul)) #\nul)))) #\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-id ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 3 #\nul) #\nul)))) #\nul)))) #\nul)) #\nul)))) #\nul)) #\nul)))))) #\nul))))) #\nul (#\nul #\nul))))))) #\nul)
(begin (define-syntax Abs-Macro (syntax-rules (V-[object Object]) ((_ V-num) (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "BlockExpression" ("Scala" "Block" (letrec* () (("Scala" "AssignmentExpression" #\nul V-num ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 10 #\nul) #\nul)))) #\nul))) #\nul)))))) #\nul))))) ("Scala" "TopStat" #\nul #\nul ("Scala" "ObjectTemplateDefinition" #\nul ("Scala" "ObjectDefinition" V-Abs_Hygienic ("Scala" "ClassTemplateOpt" #\nul ("Scala" "TemplateBody" (letrec* ((R-main- ((lambda () (function FunctionDefinition) (#\nul #\nul) ("Scala" "FunctionSignature" R-main- #\nul ("Scala" "ParamClauses" (("Scala" "ParamClause" ("Scala" "Params" (("Scala" "Param" #\nul R-args- ("Scala" "RepeatedParamType" ("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-Array-)) (("Scala" "TypeArgs" ("Scala" "Types" (("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-String-)) #\nul) #\nul) #\nul #\nul) #\nul #\nul))))))) #\nul) #\nul #\nul) #\nul #\nul)) #\nul) #\nul))))) #\nul)) ("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-Unit-)) #\nul) #\nul) #\nul #\nul) #\nul #\nul)) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "BlockExpression" ("Scala" "Block" (letrec* ((V-b ((val variable) (#\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 10 #\nul) #\nul)))) #\nul) (#\nul #\nul))) (V-id ((lambda () (function Procedure) (#\nul #\nul) ("Scala" "FunctionSignature" V-id #\nul ("Scala" "ParamClauses" (("Scala" "ParamClause" ("Scala" "Params" (("Scala" "Param" #\nul V-a ("Scala" "RepeatedParamType" ("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-Int-)) #\nul) #\nul) #\nul #\nul) #\nul #\nul)) #\nul) #\nul))))) #\nul)) #\nul ("Scala" "Block" (letrec* () (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-println ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-a #\nul) #\nul)))) #\nul)))) #\nul)) #\nul)))) #\nul) ("Scala" "AssignmentExpression" #\nul V-b ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-b #\nul) #\nul)) V-+ ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 1 #\nul) #\nul)))))) #\nul)) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-id ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-a #\nul) #\nul)) V-+ ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 1 #\nul) #\nul)))))) #\nul)))) #\nul)) #\nul)))) #\nul)) #\nul))))) (V-tmp ((val variable) (#\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" ("Scala" "Keyword" "-") ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 100 #\nul) #\nul)))) #\nul) (#\nul #\nul))) (V-a ((val variable) (#\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 3 #\nul) #\nul)))) #\nul) (#\nul #\nul)))) (#\nul #\nul #\nul #\nul ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-println ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" ((#\nul (Abs-Macro V-tmp) #\nul)))) #\nul)) #\nul)))) #\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-id ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 3 #\nul) #\nul)))) #\nul)))) #\nul)) #\nul)))) #\nul)) #\nul)))))) #\nul))))) #\nul (#\nul #\nul))))))) #\nul)
(begin (define-syntax Abs-Macro (syntax-rules (V-[object Object]) ((_ V-num) (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "BlockExpression" ("Scala" "Block" (letrec* () (("Scala" "AssignmentExpression" #\nul V-num ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 10 #\nul) #\nul)))) #\nul))) #\nul)))))) #\nul))))) ("Scala" "TopStat" #\nul #\nul ("Scala" "ObjectTemplateDefinition" #\nul ("Scala" "ObjectDefinition" V-Abs_Hygienic ("Scala" "ClassTemplateOpt" #\nul ("Scala" "TemplateBody" (letrec* ((R-main- ((lambda () (function FunctionDefinition) (#\nul #\nul) ("Scala" "FunctionSignature" R-main- #\nul ("Scala" "ParamClauses" (("Scala" "ParamClause" ("Scala" "Params" (("Scala" "Param" #\nul R-args- ("Scala" "RepeatedParamType" ("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-Array-)) (("Scala" "TypeArgs" ("Scala" "Types" (("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-String-)) #\nul) #\nul) #\nul #\nul) #\nul #\nul))))))) #\nul) #\nul #\nul) #\nul #\nul)) #\nul) #\nul))))) #\nul)) ("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-Unit-)) #\nul) #\nul) #\nul #\nul) #\nul #\nul)) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "BlockExpression" ("Scala" "Block" (letrec* ((V-b ((val variable) (#\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 10 #\nul) #\nul)))) #\nul) (#\nul #\nul))) (V-id ((lambda () (function Procedure) (#\nul #\nul) ("Scala" "FunctionSignature" V-id #\nul ("Scala" "ParamClauses" (("Scala" "ParamClause" ("Scala" "Params" (("Scala" "Param" #\nul V-a ("Scala" "RepeatedParamType" ("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-Int-)) #\nul) #\nul) #\nul #\nul) #\nul #\nul)) #\nul) #\nul))))) #\nul)) #\nul ("Scala" "Block" (letrec* () (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-println ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-a #\nul) #\nul)))) #\nul)))) #\nul)) #\nul)))) #\nul) ("Scala" "AssignmentExpression" #\nul V-b ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-b #\nul) #\nul)) V-+ ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 1 #\nul) #\nul)))))) #\nul)) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-id ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-a #\nul) #\nul)) V-+ ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 1 #\nul) #\nul)))))) #\nul)))) #\nul)) #\nul)))) #\nul)) #\nul))))) (V-tmp ((val variable) (#\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" ("Scala" "Keyword" "-") ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 100 #\nul) #\nul)))) #\nul) (#\nul #\nul))) (V-a ((val variable) (#\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 3 #\nul) #\nul)))) #\nul) (#\nul #\nul)))) (#\nul #\nul #\nul #\nul ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-println ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" ((#\nul (Abs-Macro V-tmp) #\nul)))) #\nul)) #\nul)))) #\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-id ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 3 #\nul) #\nul)))) #\nul)))) #\nul)) #\nul)))) #\nul)) #\nul)))))) #\nul))))) #\nul (#\nul #\nul))))))) #\nul)
(begin (define-syntax Abs-Macro (syntax-rules (V-[object Object]) ((_ V-num) (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "BlockExpression" ("Scala" "Block" (letrec* () (("Scala" "AssignmentExpression" #\nul V-num ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 10 #\nul) #\nul)))) #\nul))) #\nul)))))) #\nul))))) ("Scala" "TopStat" #\nul #\nul ("Scala" "ObjectTemplateDefinition" #\nul ("Scala" "ObjectDefinition" V-Abs_Hygienic ("Scala" "ClassTemplateOpt" #\nul ("Scala" "TemplateBody" (letrec* ((R-main- ((lambda () (function FunctionDefinition) (#\nul #\nul) ("Scala" "FunctionSignature" R-main- #\nul ("Scala" "ParamClauses" (("Scala" "ParamClause" ("Scala" "Params" (("Scala" "Param" #\nul R-args- ("Scala" "RepeatedParamType" ("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-Array-)) (("Scala" "TypeArgs" ("Scala" "Types" (("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-String-)) #\nul) #\nul) #\nul #\nul) #\nul #\nul))))))) #\nul) #\nul #\nul) #\nul #\nul)) #\nul) #\nul))))) #\nul)) ("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-Unit-)) #\nul) #\nul) #\nul #\nul) #\nul #\nul)) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "BlockExpression" ("Scala" "Block" (letrec* ((V-b ((val variable) (#\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 10 #\nul) #\nul)))) #\nul) (#\nul #\nul))) (V-id ((lambda () (function Procedure) (#\nul #\nul) ("Scala" "FunctionSignature" V-id #\nul ("Scala" "ParamClauses" (("Scala" "ParamClause" ("Scala" "Params" (("Scala" "Param" #\nul V-a ("Scala" "RepeatedParamType" ("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-Int-)) #\nul) #\nul) #\nul #\nul) #\nul #\nul)) #\nul) #\nul))))) #\nul)) #\nul ("Scala" "Block" (letrec* () (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-println ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-a #\nul) #\nul)))) #\nul)))) #\nul)) #\nul)))) #\nul) ("Scala" "AssignmentExpression" #\nul V-b ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-b #\nul) #\nul)) V-+ ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 1 #\nul) #\nul)))))) #\nul)) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-id ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-a #\nul) #\nul)) V-+ ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 1 #\nul) #\nul)))))) #\nul)))) #\nul)) #\nul)))) #\nul)) #\nul))))) (V-tmp ((val variable) (#\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" ("Scala" "Keyword" "-") ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 100 #\nul) #\nul)))) #\nul) (#\nul #\nul))) (V-a ((val variable) (#\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 3 #\nul) #\nul)))) #\nul) (#\nul #\nul)))) (#\nul #\nul #\nul #\nul ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-println ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" ((#\nul (Abs-Macro V-tmp) #\nul)))) #\nul)) #\nul)))) #\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-id ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 3 #\nul) #\nul)))) #\nul)))) #\nul)) #\nul)))) #\nul)) #\nul)))))) #\nul))))) #\nul (#\nul #\nul))))))) #\nul)
(begin (define-syntax Abs-Macro (syntax-rules (V-[object Object]) ((_ V-num) (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "BlockExpression" ("Scala" "Block" (letrec* () (("Scala" "AssignmentExpression" #\nul V-num ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 10 #\nul) #\nul)))) #\nul))) #\nul)))))) #\nul))))) ("Scala" "TopStat" #\nul #\nul ("Scala" "ObjectTemplateDefinition" #\nul ("Scala" "ObjectDefinition" V-Abs_Hygienic ("Scala" "ClassTemplateOpt" #\nul ("Scala" "TemplateBody" (letrec* ((R-main- ((lambda () (function FunctionDefinition) (#\nul #\nul) ("Scala" "FunctionSignature" R-main- #\nul ("Scala" "ParamClauses" (("Scala" "ParamClause" ("Scala" "Params" (("Scala" "Param" #\nul R-args- ("Scala" "RepeatedParamType" ("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-Array-)) (("Scala" "TypeArgs" ("Scala" "Types" (("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-String-)) #\nul) #\nul) #\nul #\nul) #\nul #\nul))))))) #\nul) #\nul #\nul) #\nul #\nul)) #\nul) #\nul))))) #\nul)) ("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-Unit-)) #\nul) #\nul) #\nul #\nul) #\nul #\nul)) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "BlockExpression" ("Scala" "Block" (letrec* ((V-b ((val variable) (#\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 10 #\nul) #\nul)))) #\nul) (#\nul #\nul))) (V-id ((lambda () (function Procedure) (#\nul #\nul) ("Scala" "FunctionSignature" V-id #\nul ("Scala" "ParamClauses" (("Scala" "ParamClause" ("Scala" "Params" (("Scala" "Param" #\nul V-a ("Scala" "RepeatedParamType" ("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-Int-)) #\nul) #\nul) #\nul #\nul) #\nul #\nul)) #\nul) #\nul))))) #\nul)) #\nul ("Scala" "Block" (letrec* () (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-println ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-a #\nul) #\nul)))) #\nul)))) #\nul)) #\nul)))) #\nul) ("Scala" "AssignmentExpression" #\nul V-b ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-b #\nul) #\nul)) V-+ ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 1 #\nul) #\nul)))))) #\nul)) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-id ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-a #\nul) #\nul)) V-+ ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 1 #\nul) #\nul)))))) #\nul)))) #\nul)) #\nul)))) #\nul)) #\nul))))) (V-tmp ((val variable) (#\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" ("Scala" "Keyword" "-") ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 100 #\nul) #\nul)))) #\nul) (#\nul #\nul))) (V-a ((val variable) (#\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 3 #\nul) #\nul)))) #\nul) (#\nul #\nul)))) (#\nul #\nul #\nul #\nul ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-println ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" ((#\nul (Abs-Macro V-tmp) #\nul)))) #\nul)) #\nul)))) #\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-id ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 3 #\nul) #\nul)))) #\nul)))) #\nul)) #\nul)))) #\nul)) #\nul)))))) #\nul))))) #\nul (#\nul #\nul))))))) #\nul)
(begin (define-syntax Abs-Macro (syntax-rules (V-[object Object]) ((_ V-num) (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "BlockExpression" ("Scala" "Block" (letrec* () (("Scala" "AssignmentExpression" #\nul V-num ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 10 #\nul) #\nul)))) #\nul))) #\nul)))))) #\nul))))) ("Scala" "TopStat" #\nul #\nul ("Scala" "ObjectTemplateDefinition" #\nul ("Scala" "ObjectDefinition" V-Abs_Hygienic ("Scala" "ClassTemplateOpt" #\nul ("Scala" "TemplateBody" (letrec* ((R-main- ((lambda () (function FunctionDefinition) (#\nul #\nul) ("Scala" "FunctionSignature" R-main- #\nul ("Scala" "ParamClauses" (("Scala" "ParamClause" ("Scala" "Params" (("Scala" "Param" #\nul R-args- ("Scala" "RepeatedParamType" ("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-Array-)) (("Scala" "TypeArgs" ("Scala" "Types" (("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-String-)) #\nul) #\nul) #\nul #\nul) #\nul #\nul))))))) #\nul) #\nul #\nul) #\nul #\nul)) #\nul) #\nul))))) #\nul)) ("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-Unit-)) #\nul) #\nul) #\nul #\nul) #\nul #\nul)) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "BlockExpression" ("Scala" "Block" (letrec* ((V-b ((val variable) (#\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 10 #\nul) #\nul)))) #\nul) (#\nul #\nul))) (V-id ((lambda () (function Procedure) (#\nul #\nul) ("Scala" "FunctionSignature" V-id #\nul ("Scala" "ParamClauses" (("Scala" "ParamClause" ("Scala" "Params" (("Scala" "Param" #\nul V-a ("Scala" "RepeatedParamType" ("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-Int-)) #\nul) #\nul) #\nul #\nul) #\nul #\nul)) #\nul) #\nul))))) #\nul)) #\nul ("Scala" "Block" (letrec* () (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-println ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-a #\nul) #\nul)))) #\nul)))) #\nul)) #\nul)))) #\nul) ("Scala" "AssignmentExpression" #\nul V-b ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-b #\nul) #\nul)) V-+ ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 1 #\nul) #\nul)))))) #\nul)) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-id ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-a #\nul) #\nul)) V-+ ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 1 #\nul) #\nul)))))) #\nul)))) #\nul)) #\nul)))) #\nul)) #\nul))))) (V-tmp ((val variable) (#\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" ("Scala" "Keyword" "-") ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 100 #\nul) #\nul)))) #\nul) (#\nul #\nul))) (V-a ((val variable) (#\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 3 #\nul) #\nul)))) #\nul) (#\nul #\nul)))) (#\nul #\nul #\nul #\nul ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-println ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" ((#\nul (Abs-Macro V-tmp) #\nul)))) #\nul)) #\nul)))) #\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-id ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 3 #\nul) #\nul)))) #\nul)))) #\nul)) #\nul)))) #\nul)) #\nul)))))) #\nul))))) #\nul (#\nul #\nul))))))) #\nul)
(begin (define-syntax Abs-Macro (syntax-rules (V-[object Object]) ((_ V-num) (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "BlockExpression" ("Scala" "Block" (letrec* () (("Scala" "AssignmentExpression" #\nul V-num ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 10 #\nul) #\nul)))) #\nul))) #\nul)))))) #\nul))))) ("Scala" "TopStat" #\nul #\nul ("Scala" "ObjectTemplateDefinition" #\nul ("Scala" "ObjectDefinition" V-Abs_Hygienic ("Scala" "ClassTemplateOpt" #\nul ("Scala" "TemplateBody" (letrec* ((R-main- ((lambda () (function FunctionDefinition) (#\nul #\nul) ("Scala" "FunctionSignature" R-main- #\nul ("Scala" "ParamClauses" (("Scala" "ParamClause" ("Scala" "Params" (("Scala" "Param" #\nul R-args- ("Scala" "RepeatedParamType" ("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-Array-)) (("Scala" "TypeArgs" ("Scala" "Types" (("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-String-)) #\nul) #\nul) #\nul #\nul) #\nul #\nul))))))) #\nul) #\nul #\nul) #\nul #\nul)) #\nul) #\nul))))) #\nul)) ("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-Unit-)) #\nul) #\nul) #\nul #\nul) #\nul #\nul)) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "BlockExpression" ("Scala" "Block" (letrec* ((V-b ((val variable) (#\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 10 #\nul) #\nul)))) #\nul) (#\nul #\nul))) (V-id ((lambda () (function Procedure) (#\nul #\nul) ("Scala" "FunctionSignature" V-id #\nul ("Scala" "ParamClauses" (("Scala" "ParamClause" ("Scala" "Params" (("Scala" "Param" #\nul V-a ("Scala" "RepeatedParamType" ("Scala" "Type" #\nul ("Scala" "InfixType" ("Scala" "CompoundType" ("Scala" "AnnotType" ("Scala" "SimpleType" ("Scala" "StableId" (R-Int-)) #\nul) #\nul) #\nul #\nul) #\nul #\nul)) #\nul) #\nul))))) #\nul)) #\nul ("Scala" "Block" (letrec* () (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-println ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-a #\nul) #\nul)))) #\nul)))) #\nul)) #\nul)))) #\nul) ("Scala" "AssignmentExpression" #\nul V-b ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-b #\nul) #\nul)) V-+ ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 1 #\nul) #\nul)))))) #\nul)) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-id ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-a #\nul) #\nul)) V-+ ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 1 #\nul) #\nul)))))) #\nul)))) #\nul)) #\nul)))) #\nul)) #\nul))))) (V-tmp ((val variable) (#\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" ("Scala" "Keyword" "-") ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 100 #\nul) #\nul)))) #\nul) (#\nul #\nul))) (V-a ((val variable) (#\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 3 #\nul) #\nul)))) #\nul) (#\nul #\nul)))) (#\nul #\nul #\nul #\nul ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-println ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" ((#\nul (Abs-Macro V-tmp) #\nul)))) #\nul)) #\nul)))) #\nul) ("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "idSeqSimpleExpression" V-id ("Scala" "FunctionApplicationPostfix" ("Scala" "ArgumentExpression" ("Scala" "Exprs" (("Scala" "PostfixExpression" ("Scala" "InfixExpression" (("Scala" "PrefixExpression" #\nul ("Scala" "SimpleExpression" ("Scala" "literalSimpleExpression" 3 #\nul) #\nul)))) #\nul)))) #\nul)) #\nul)))) #\nul)) #\nul)))))) #\nul))))) #\nul (#\nul #\nul))))))) #\nul)
| true |
76c8f72c6f21cfcd22b44c3dcf454788dfff6fbd | 404313517ba0846313af5226e05d9092d99a38b3 | /Scheme/Preparation for Exam 1/meet-twice.scm | a93f600c249e5b14312946fa17bb0c18466c4a7e | []
| no_license | georgistoilov8/Functional-Programming | 00fab1d97a1ea66d0e63c55ed9ead5d309118514 | 38837b571c7e8b4ecef462d85e2ae47b316050f7 | refs/heads/master | 2020-08-29T00:39:31.773279 | 2020-01-12T17:00:31 | 2020-01-12T17:00:31 | 217,867,904 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 627 | scm | meet-twice.scm | ;;; Да се напише функция (meetTwice? f g a b), която проверява дали
;;; в целочисления интервал [a, b] съществуват две различни цели числа
;;; х и у такива, че f(x) = g(x) и f(y) = g(y)
;;; Пример: (meetTwice? (lambda(x)x) (lambda(x) (- x)) -3 1) → #f
;;; (meetTwice? (lambda(x)x) sqrt 0 5) → #t
(define (doesMeet? f g n)
(if (= (f n) (g n)) 1 0))
(define (check f g a b)
(if (> a b) 0
(+ (doesMeet? f g a) (check f g (+ a 1) b))))
(define (meetTwice? f g a b)
(if (< (check f g a b) 2) #f #t)) | false |
603fd1d4d9a420b2231067d4aa920dabe9c1c227 | 9ff2abf87c905f4056e769fd3fc0a392904ac9e8 | /ClassMaterials/CPSDatatypesInterpreter/32-DS-solution.ss | d0fafd2ab8c0d0734408b3d7681d12dd63d9095a | []
| no_license | hernanre/csse304-1 | b3cbc605aa4720bed1c16cab6da2385be6305d9b | 4ae64ccd9858ead8a94245d4e20c4149fb4275f1 | refs/heads/main | 2023-08-30T04:03:02.067571 | 2021-10-23T21:55:01 | 2021-10-23T21:55:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 1,073 | ss | 32-DS-solution.ss | (load "chez-init.ss")
;(define apply-k (lambda (k v) (k v)))
(define make-k (lambda (v) v))
(define-datatype kontinuation kontinuation?
[init-k]
)
(define apply-k
(lambda (k v)
(if (procedure? k)
(k v))
(cases kontinuation k
(define read-flatten-print
(lambda ()
(display "enter slist to flatten: ")
(let ([slist (read)])
(unless (eq? slist 'exit)
(flatten-cps slist
(make-k (lambda (val)
(pretty-print val)
(read-flatten-print))))))))
(define flatten-cps
(lambda (ls k)
(if (null? ls)
(apply-k k ls)
(flatten-cps (cdr ls)
(make-k (lambda (v) (if (list? (car ls))
(flatten-cps (car ls)
(make-k (lambda (u) (append-cps u v k))))
(apply-k k (cons (car ls) v)))))))))
(define append-cps
(lambda (L1 L2 k)
(if (null? L1)
(apply-k k L2)
(append-cps (cdr L1)
L2
(make-k (lambda (appended-cdr)
(apply-k k (cons (car L1)
appended-cdr))))))))
;(trace append-cps flatten-cps apply-k)
| false |
afb25d0e4e3202444dc5cb552cb46bbed4946db5 | 2c01a6143d8630044e3629f2ca8adf1455f25801 | /xitomatl/htmlprag-0-16.sls | 735b4a65d5ea3f71c421f51942993cf85b69cc1e | [
"X11-distribute-modifications-variant"
]
| permissive | stuhlmueller/scheme-tools | e103fac13cfcb6d45e54e4f27e409adbc0125fe1 | 6e82e873d29b34b0de69b768c5a0317446867b3c | refs/heads/master | 2021-01-25T10:06:33.054510 | 2017-05-09T19:44:12 | 2017-05-09T19:44:12 | 1,092,490 | 5 | 1 | null | null | null | null | UTF-8 | Scheme | false | false | 685 | sls | htmlprag-0-16.sls | #!r6rs
;; Copyright 2009 Derick Eddington. My MIT-style license is in the file named
;; LICENSE from the original collection this file is distributed with.
(library (xitomatl htmlprag (0 16))
(export
shtml-named-char-id
shtml-numeric-char-id
make-shtml-entity
shtml-entity-value
make-html-tokenizer
tokenize-html
shtml-token-kind
parse-html/tokenizer
html->sxml-0nf
html->sxml-1nf
html->sxml-2nf
html->sxml
html->shtml
write-shtml-as-html
shtml->html)
(import
(rnrs)
(rnrs mutable-pairs)
(xitomatl include)
(srfi :6 basic-string-ports))
(include/resolve ("xitomatl" "htmlprag") "htmlprag.scm")
)
| false |
17008b4b4d55c7c2473d4e1bed7bf0e5a3b66dd8 | e358b0cf94ace3520adff8d078a37aef260bb130 | /simple/2.40.scm | 22e10983c6e75dc4097b8b0cc30f9f84e4d5bb79 | []
| no_license | dzhus/sicp | 784766047402db3fad4884f7c2490b4f78ad09f8 | 090fa3228d58737d3558f2af5a8b5937862a1c75 | refs/heads/master | 2021-01-18T17:28:02.847772 | 2020-05-24T19:15:57 | 2020-05-24T20:56:00 | 22,468,805 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 730 | scm | 2.40.scm | (define (accumulate op initial sequence)
(if (null? sequence)
initial
(op (car sequence)
(fold-right op
initial
(cdr sequence)))))
(define (flatmap proc seq)
(accumulate append (list) (map proc seq)))
(define (enumerate-interval low high)
(if (> low high)
(list)
(cons low (enumerate-interval (+ low 1) high))))
(define (enumerate-n n)
(enumerate-interval 1 n))
(define (unique-pairs n)
(flatmap
(lambda (i)
(map (lambda (j)
(list j i))
(enumerate-n (- i 1))))
(enumerate-n n)))
;; Untested
(define (prime-sum-pairs n)
(map (make-pair-sum
(filter prime-sum?
(unique-pairs n))))) | false |
73dafb84630476379167c0f6dfc7ce6b215ba6ec | fb9a1b8f80516373ac709e2328dd50621b18aa1a | /ch1/exercise1-31.scm | bc8b2e3556b086ef9b4482dd85ab7b9aa1802835 | []
| no_license | da1/sicp | a7eacd10d25e5a1a034c57247755d531335ff8c7 | 0c408ace7af48ef3256330c8965a2b23ba948007 | refs/heads/master | 2021-01-20T11:57:47.202301 | 2014-02-16T08:57:55 | 2014-02-16T08:57:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 1,073 | scm | exercise1-31.scm | ;; 問題1.31
;;a. sum手続きは高階手続きとして書ける抽象の中でも最も単純なものに過ぎない
;; 与えられた範囲の点での関数値の積を返すproductという似た手続きを書け.
;; productを使ってfactorialを定義せよ
;; πの近似値を計算せよ
(load "./ch1/1-3_Formulating_Abstractings_with_Higher-Order_Procedures.scm")
(load "./utils.scm")
(define (product term a next b)
(if (> a b)
1
(* (term a)
(product term (next a) next b))))
(define (factorial n)
(product identity 1 inc n))
(factorial 0)
(factorial 1)
(factorial 2)
(factorial 3)
(factorial 4)
(define (pi-product n)
(define (pi-next x) (+ x 1))
(define (pi-term x)
(if (even? x)
(/ (+ x 2) (+ x 1))
(/ (+ x 1) (+ x 2))))
(product pi-term 1 pi-next n))
(* 4.0 (pi-product 10))
(* 4.0 (pi-product 100))
(* 4.0 (pi-product 1000))
;; b. 反復プロセス版
(define (product term a next b)
(define (iter a result)
(if (> a b)
result
(iter (next a) (* result (term a)))))
(iter a 1))
| false |
58c817d526eda1bedf72da65be7a1f5dba6ed028 | b43e36967e36167adcb4cc94f2f8adfb7281dbf1 | /scheme/swl1.3/apps/common/scheme-text.ss | 6a3f99440def445a36ddbb86c59065b054c07296 | [
"SWL",
"TCL"
]
| permissive | ktosiu/snippets | 79c58416117fa646ae06a8fd590193c9dd89f414 | 08e0655361695ed90e1b901d75f184c52bb72f35 | refs/heads/master | 2021-01-17T08:13:34.067768 | 2016-01-29T15:42:14 | 2016-01-29T15:42:14 | 53,054,819 | 1 | 0 | null | 2016-03-03T14:06:53 | 2016-03-03T14:06:53 | null | UTF-8 | Scheme | false | false | 42,152 | ss | scheme-text.ss | ;; Copyright (c) 1996 John Zuckerman
;;
;; See the file "Notice" for information on usage and redistribution
;; of this file, and for a DISCLAIMER OF ALL WARRANTIES.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;
;; Defines <scheme-text>, a text widget for applications the edit/manipulate
;; Scheme code.
;;
;;
;;
;; Marks and Indexes
;; -----------------
;;
;; A mark denotes the char immediately to the right of the mark
;; location (mark locations lie between characters).
;;
;; All marks move when text is inserted before them.
;;
;; Note: _all_ methods that operate on a range of locations, and that
;; take an end location as an argument, perform their operations
;; _exclusive_ of the end location. (e.g., get-string returns a string
;; up to but not including the end location.)
;;
;; end-mk always points just past the last inserted buffer char.
;; We define end-mk because the official Tk end mark (named 'end in swl)
;; always points one past an extra newline character (yecch!). 'end is
;; not a valid index for the <scheme-text> widget class.
;;
;; insert is a predefined mark for the insertion point. The text-widget
;; "cursor" is really the insert mark.
;;
(require "../common/app-text.ss" 'once)
(define-swl-class (<scheme-text> parent) (<app-text> parent)
(ivars
(paren-markup (create <markup> with (background-color: 'gold)))
(box-markup (create <markup> with
(border-width: 2)
(relief: 'ridge)
(background-color: 'gainsboro)
))
(highlight-markup (create <markup> with (background-color: 'gold)))
(paren-markup-removal-proc #f)
(flash-removal-thread #f)
(end-exp #f)
(show-the-box? #f)
(auto-indent? #t)
(outline-mode? #t)
(outline-cursor #f)
;;; (collapsoids '())
;;; (collapsoid-pressed #f)
; (mouse-press-ix #f)
)
(inherited mini-buffer key-prefix end-mk handle edit-action begin-exp)
(inheritable mini-buffer box-markup paren-markup highlight-markup
key-prefix begin-exp end-exp end-mk handle)
(private
[do-paren-markup (beg end)
(let ([procs (if (and show-the-box? (<= (- (cdr end) (cdr beg)) 100))
(compute-the-box beg end box-markup)
(compute-pairing beg (idx1- end)))])
(let ([apply-show (car procs)] [remove-show (cdr procs)])
(apply-show)
(set! paren-markup-removal-proc remove-show)))]
[compute-show-coords ()
(let ((be begin-exp) (ee end-exp))
(when (send self pos<? (cursor) begin-exp)
;; hack to permit the box and paren matching above entry area
(set! end-exp begin-exp)
(set! begin-exp '(0 . 0)))
;;
;; returns the range of a match, or #f if none.
;;
(let
((ans
(let* ((csr (cursor))
(csr1- (idx1- csr))
(csr2- (idx1- csr1-))
(csr3- (idx1- csr2-))
(chr (send self get-char csr1-)))
(if (send self pos=? begin-exp csr)
#f
(and
(or (eqv? chr #\() (eqv? chr #\[) (eqv? chr #\))
(eqv? chr #\]))
;; paren must not be part of a char constant
(not (and (eqv? (send self get-char csr2-) #\\)
(eqv? (send self get-char csr3-) #\#)))
(let* ((forward? (if (memv chr '( #\( #\[ )) #t #f))
(b-pos (if forward? csr1- begin-exp))
(e-pos (if forward? end-exp csr))
(idx (find-matching-paren b-pos e-pos forward?)))
(and idx
(if forward?
;; return a pair of indexes as a range
;; (end is exclusive)
(cons csr1- (idx1+ idx))
(cons idx csr)
))))))))
(set! begin-exp be)
(set! end-exp ee)
ans))]
[compute-flash-coords ()
;;
;; returns exact coords of an enclosing match, or a left-hand match,
;; or a right-hand match, or #f.
;;
(define find-enclosing-match
(lambda ()
(let* ((idx-beg (find-unmatched-open-paren (cursor))))
(and idx-beg
(let ((idx-end (find-matching-paren idx-beg end-exp #t)))
(and idx-end (cons idx-beg (idx1+ idx-end))))))))
(define find-left-match
(lambda ()
(let ((idx-beg (find-matching-paren begin-exp (cursor) #f)))
(and idx-beg
(let ((idx-end (find-matching-paren idx-beg end-exp #t)))
(and idx-end (cons idx-beg (idx1+ idx-end)))
)))))
(define find-right-match
(lambda ()
(let ((idx-end (find-matching-paren (cursor) end-exp #t)))
(and idx-end
(let ((idx-beg
(find-matching-paren begin-exp (idx1+ idx-end) #f)))
(and idx-beg (cons idx-beg (idx1+ idx-end)))
)))))
(let ((be begin-exp) (ee end-exp))
(when (send self pos<? (cursor) begin-exp)
;; hack to permit the box and paren matching above entry area
(set! end-exp begin-exp)
(set! begin-exp '(0 . 0)))
(let ((ans (or (find-enclosing-match)
(find-left-match)
(find-right-match))))
(set! begin-exp be)
(set! end-exp ee)
ans))]
[compute-pairing (pos1 pos2)
;;
;; returns pair of procedures: one to apply markup, one to remove it.
;;
;; note that pos1 and pos2 are independent positions, not a range
;; (hence pos2 points to the actual char to be marked up).
;;
(cons
(lambda () ;;; apply pairing
(send paren-markup apply-markup self pos1 (idx1+ pos1))
(send paren-markup apply-markup self pos2 (idx1+ pos2)))
(lambda () ;;; remove pairing
(send paren-markup remove-markup self pos1 (idx1+ pos1))
(send paren-markup remove-markup self pos2 (idx1+ pos2))
))]
[find-unmatched-open-paren (end-idx)
;;
;; Returns the index of the first unmatched open paren or #f if none.
;;
;; end-idx is the end coordinate of a range (and hence is
;; exclusive of the last range character).
;;
(define paren-char car)
(define paren-index cdr)
(define backward-aux
(lambda (idx ofs)
(let ((new-idx (send self add-offset idx ofs)))
(if (send self pos<? new-idx begin-exp)
begin-exp
new-idx))))
(define find-aux
(lambda (beg-idx)
(let* ([parens (find-parens beg-idx end-idx)]
[pairings '([ #\( . #\) ] [ #\[ . #\] ])])
(let loop ([parens parens] [stack '()])
(if (not (pair? parens))
#f
(let* ([paren-top (car parens)]
[ch (paren-char paren-top)])
(case ch
[(#\( #\[)
(if (null? stack)
(paren-index paren-top)
(let ((paired-char (cdr (assv ch pairings)))
(stack-top-char (paren-char (car stack))))
(if (eqv? stack-top-char paired-char)
(loop (cdr parens) (cdr stack))
(paren-index paren-top))))]
[(#\) #\])
(loop (cdr parens) (cons paren-top stack))])))))))
;;
;; do stepwise search for beginning index. This takes about 2n time
;; in the worst case but wins big for the most frequent (closest)
;; cases. Initial distance (128) must be enough to cover a whole
;; line in order to avoid problems with character constants.
;;
(let ((icnt -128))
(let loop ((bx (backward-aux end-idx icnt)) (count icnt))
;;; (fprintf (swl:bug-port) "find-unmatched-open-paren count=~s~n" count)
(let ((open-paren (find-aux bx)))
(if open-paren
open-paren
(if (send self pos=? bx begin-exp)
#f
(loop (backward-aux bx count) (+ count count)))))))]
[flash-the-box ()
;;; (fprintf (swl:bug-port) "flash-the-box~n")
(assertion-violationf 'flash-the-box "disabled in favor of undo/redo")
#;
(unless flash-removal-thread
(let ((coords (compute-flash-coords)))
(when coords
(let* ((idx-beg (car coords))
(idx-end (cdr coords))
(procs (compute-the-box idx-beg idx-end box-markup))
(apply-flash (car procs))
(remove-flash (cdr procs)))
(when paren-markup-removal-proc ;;; avoid c-s in general case
(critical-section
(when paren-markup-removal-proc
(paren-markup-removal-proc)
(set! paren-markup-removal-proc #f))))
(set! paren-markup-removal-proc remove-flash)
(apply-flash)
(set! flash-removal-thread
(thread-fork
(lambda ()
(thread-name "flash")
(thread-sleep 1200)
(critical-section
(set! flash-removal-thread #f)
(remove-paren-markup)
(show-paren-markup) ;;; restore show markup, if any
))
(thread-default-quantum)
(thread-highest-priority)))
(thread-yield) ;;; need flash remover to be sleeping
))))]
[scan-until-token (str i)
(let ([len (string-length str)])
(let loop ([i i] [ofs 0])
(cond
[(fx>= i len) #f]
[(char=? (string-ref str i) #\;)
(let ((ofs (scan-until-newline str (fx1+ i))))
(if ofs
(loop (fx+ i ofs 2) (fx+ ofs 2))
#f))]
[(char-whitespace? (string-ref str i)) (loop (fx1+ i) (fx1+ ofs))]
[else ofs])))]
[get-length-of-line (line) (car (send self line-end (cons 0 line)))]
[str->spans (str start-line start-col)
;;
;; Returns list of spans, one span per line, in reverse order, where
;; each span is a pair of indexes: (span-start . span-end).
;;
;; If a line contains non-whitespace chars, the start span points to
;; the first character and end span points one past the last character.
;;
;; If a line contains only whitespace, the start span will point
;; one past the last char and the end span will point to the first
;; char (this makes sense for subsequently applying min and max
;; operations).
;;
(define make-span
(lambda (lr lc rr rc) (cons (cons lc lr) (cons rc rr))))
;;; (fprintf (swl:bug-port) "str->spans str=~s sl=~s sc=~s~n" str start-line start-col)
(let* ([len (string-length str)])
(let loop ([i 0]
[line start-line] [col start-col]
[c1 start-col] [c2 start-col]
[seen-non-ws? #f] [ls '()])
(cond
[(fx>= i len)
(cons (make-span line c1 line c2) ls)]
[else
(let ([c (string-ref str i)]
[col+1 (fx1+ col)]
[i+1 (fx1+ i)]
)
(cond
[(eqv? c #\newline)
(loop i+1 (fx1+ line) 0 0 0 #f
(cons (make-span line c1 line c2) ls))]
[seen-non-ws? ;;; already seen non-whitespace?
(if (char-whitespace? c)
(loop i+1 line col+1 c1 c2 #t ls)
(loop i+1 line col+1 c1 col+1 #t ls))]
[else ;;; only whitespace seen so far
(if (char-whitespace? c)
(loop i+1 line col+1 col+1 0 #f ls)
(loop i+1 line col+1 col col+1 #t ls))]))])))]
[find-parens (beg-idx end-idx)
;;
;; returns a parse list of (paren-char . index) pairs or #f if
;; the str doesn't scan. list is in right-to-left (reverse) order.
;;
;;; (fprintf (swl:bug-port) " find-parens bpos=~s epos=~s~n" beg-idx end-idx)
(let* ([str (get-string self beg-idx end-idx)]
[len (string-length str)]
[comment? #f]
)
(let loop ([i 0]
[x (get-x/char beg-idx)]
[y (get-y/char beg-idx)]
[ls '()])
(if (fx>= i len)
(begin
;;; (fprintf (swl:bug-port) " find-parens return=~s~n" ls)
ls)
(let ([ch (string-ref str i)])
(cond
[(eqv? ch #\;)
(set! comment? #t)
(loop (fx1+ i) (fx1+ x) y ls)
]
[(memv ch '(#\( #\) #\[ #\]))
(loop (fx1+ i) (fx1+ x) y (cons (cons ch (cons x y)) ls))]
[(eqv? ch #\newline)
(set! comment? #f)
(loop (fx1+ i) 0 (fx1+ y) ls)]
[comment? (loop (fx1+ i) (fx1+ x) y ls)]
[(eqv? ch #\\)
(loop (fx+ i 2) (fx+ x 2) y ls)]
[(eqv? ch #\#)
(if (and (fx< (fx+ i 2) len)
(char=? (string-ref str (fx1+ i)) #\\))
(loop (fx+ i 3) (fx+ x 3) y ls)
(loop (fx1+ i) (fx1+ x) y ls))]
[(memv ch '(#\" #\|))
(let loop2 ([i (fx1+ i)] [x (fx1+ x)] [y y])
(if (fx>= i len)
#f
(let ((ch2 (string-ref str i)))
(cond
[(eqv? ch2 #\newline)
(loop2 (fx1+ i) 0 (fx1+ y))]
[(eqv? ch2 #\\)
(loop2 (fx+ i 2) (fx+ x 2) y)]
[(eqv? ch2 ch)
(loop (fx1+ i) (fx1+ x) y ls)]
[else (loop2 (fx1+ i) (fx1+ x) y)]))))]
[else (loop (fx1+ i) (fx1+ x) y ls)])))))]
[with-match (pos dir handler)
(define scan
(lambda (pos)
(if (eq? dir 'forward)
(let f ([inc 128] [last pos])
(let ([end (add-offset self last inc)])
(let ([ps (find-parens last end)])
(or (and (pair? ps)
(not (null? ps))
(cdr (car (last-pair ps))))
(and (send self pos<? end end-exp)
(f (* inc 2) end))))))
(let f ([inc -128] [last pos])
(let ([start (add-offset self last inc)])
(let ([ps (find-parens start last)])
(or (and (pair? ps)
(not (null? ps))
(cdr (car ps)))
(and (send self pos>? start begin-exp)
(f (* inc 2) start))))))) ))
(let ([pos (or pos (get-cursor-pos self))])
(case dir
[(forward)
(let ([new (or (and (memv (send self get-char pos) '(#\) #\])) pos)
(find-matching-paren pos end-exp #t)
(scan pos))])
(when new (handler (add-offset self new 1))))]
[(backward)
(let ([new (or (find-matching-paren begin-exp pos #f) (scan pos))])
(when new (handler new)))]
[else (assertion-violationf 'with-match "unrecognized direction ~s" dir)]))]
) ;;; end private
(protected ;;; ** ** PROTECTED ** **
[compute-the-box (box-beg box-end mkup)
(assertion-violationf 'compute-the-box "disabled in favor of undo/redo")
#|
;;
;; returns pair of procedures: one to apply the box, one to remove it.
;;
(define make-span
(lambda (ly lx ry rx) (cons (cons lx ly) (cons rx ry))))
(define span-start car) (define span-end cdr)
(define get-x car) (define get-y cdr)
(define span-start-x (lambda (x) (get-x (span-start x))))
(define span-end-x (lambda (x) (get-x (span-end x))))
(define span-start-y (lambda (x) (get-y (span-start x))))
(define span-end-y (lambda (x) (get-y (span-end x))))
(define spans->the-box
(lambda (spans)
(if (= (length spans) 1)
spans
(let* ((last-span (car spans)) ;;; spans are in reverse order
(first-spans (reverse (cdr spans)))
(first-span (car first-spans))
(mid-spans (cdr first-spans))
(bx (span-start-x first-span))
(by (span-start-y first-span))
(ex (span-end-x last-span))
(ey (span-end-y last-span))
(min-x (apply min (map span-start-x spans)))
(max-x+1 (apply max (map span-end-x spans))) ;; 1 past max x
)
;;
;; if not too many lines, add spaces needed for a
;; smooth-sided box.
;;
(when (<= (- ey by) 100)
(let loop ((y (1- ey)) (spans (cdr spans)))
(when (>= y by)
(let ((span (car spans))
(extra (- max-x+1 (get-length-of-line y))))
(when (positive? extra)
(let ((old-csr (cursor)))
(if (< (span-start-x span) (span-end-x span))
(send-base self insert-at (span-end span)
(make-string extra #\space))
;; special case: line is empty or all white-space
(send self insert-at (cons 0 y)
(make-string extra #\space)))
;; insert-at may have moved cursor
(send self set-cursor-pos! old-csr)))
(loop (1- y) (cdr spans))))))
(cons (make-span by bx by max-x+1)
(cons (make-span ey min-x ey ex)
(map (lambda (span)
(let ((y (span-start-y span)))
(make-span y min-x y max-x+1)))
mid-spans)))))))
(let* ((spans (str->spans
(send self get-string box-beg box-end)
(get-y/char box-beg)
(get-x/char box-beg)))
(the-box (spans->the-box spans)))
(cons
(lambda () ;;; apply the box
;;; (fprintf (swl:bug-port) "applying the box!!~n")
(for-each
(lambda (span)
(send mkup apply-markup self
(span-start span) (span-end span)))
the-box))
(lambda () ;;; remove the box
(for-each
(lambda (span)
(send mkup remove-markup self
(span-start span) (span-end span)))
the-box))))
|#
]
[find-matching-paren (beg-idx end-idx forward?)
;;
;; Finds the paren that matches the one at the beginning of the string
;; (end of string if forward? = #f) denoted by the position range.
;;
;; Returns: index of matching char #f if no match.
;;
(define top-char caar)
(define opposing-chars (if forward? '(#\) #\]) '(#\( #\[)))
(define pairings (if forward?
'([ #\) . #\( ] ( #\] . #\[ ))
'([ #\( . #\) ] ( #\[ . #\] ))))
(define forward-aux
(lambda (idx ofs)
(let ((new-idx (send self add-offset idx ofs)))
(if (send self pos>? new-idx end-idx)
end-idx
new-idx))))
(define backward-aux
(lambda (idx ofs)
(let ((new-idx (send self add-offset idx ofs)))
(if (send self pos<? new-idx beg-idx)
beg-idx
new-idx))))
(define find-aux
(lambda (beg-idx end-idx)
(let ([parens (find-parens beg-idx end-idx)])
(if (not (pair? parens))
#f
(let* ([parens (if forward? (reverse! parens) parens)]
[cursor-char (top-char parens)])
(let loop ([parens (cdr parens)] [stack '()])
(if (null? parens)
#f
(let ([opposing-char (top-char parens)])
(if (memv opposing-char opposing-chars)
(let ((paired-char
(cdr (assv opposing-char pairings))))
(if (null? stack)
(if (eqv? cursor-char paired-char)
(cdar parens)
#f)
(if (eqv? (top-char stack) paired-char)
(loop (cdr parens) (cdr stack))
#f)))
(loop (cdr parens) (cons (car parens) stack)))))))))))
;;; (fprintf (swl:bug-port) "find-matching-paren!!! beg=~s end=~s~n" beg-idx end-idx)
;;
;; do stepwise search for other index. This takes 2n time
;; in the worst case but wins big for the most frequent (closest)
;; cases. Initial distance (128) must be enough to cover a whole
;; line in order to avoid problems with character constants.
;;
(if forward?
(let loop ((ex (forward-aux beg-idx 128)) (count 128))
;;; (fprintf (swl:bug-port) "find-matching-paren count=~s~n" count)
(let ((match (find-aux beg-idx ex)))
(if match
(begin
;;; (fprintf (swl:bug-port) " **forward match found: ~s~n" match)
match)
(if (send self pos=? ex end-idx)
#f
(loop (forward-aux ex count) (+ count count))))))
(let loop ((bx (backward-aux end-idx -128)) (count -128))
;;; (fprintf (swl:bug-port) "find-matching-paren count=~s~n" count)
(let ((match (find-aux bx end-idx)))
(if match
(begin
;;; (fprintf (swl:bug-port) " **backward match found: ~s~n" match)
match)
(if (send self pos=? bx beg-idx)
#f
(loop (backward-aux bx count) (+ count count)))))))]
[idx1+ (idx) (send self add-offset idx 1)]
[idx1- (idx) (send self add-offset idx -1)]
[scan-until-newline (str i)
;;; (fprintf (swl:bug-port) "scan-until-newline str=~s i=~s~n" str i)
(let ([len (string-length str)])
(let loop ([i i] [ofs 0])
(cond
[(fx>= i len) #f]
[(char=? (string-ref str i) #\newline) ofs]
[else (loop (fx1+ i) (fx1+ ofs))])))]
[compute-lines (str)
(let ((len (string-length str)))
(let loop ((lines 1) (i 0))
(if (fx= i len)
lines
(if (char=? (string-ref str i) #\newline)
(loop (fx1+ lines) (fx1+ i))
(loop lines (fx1+ i))))))]
[str-whitespace? (str)
(let ((len (string-length str)))
(and (> len 0)
(let loop ([i 0])
(if (fx= i len)
#t
(if (char-whitespace? (string-ref str i))
(loop (fx1+ i))
#f)))))]
[remove-paren-markup ()
;;; (fprintf (swl:bug-port) "remove paren markup~n")
(when flash-removal-thread ;;; avoid critical section in general case.
(critical-section
(when flash-removal-thread
(thread-wake flash-removal-thread)
(thread-reschedule flash-removal-thread (thread-highest-priority))
(thread-yield)
)))
(when paren-markup-removal-proc
(paren-markup-removal-proc)
(set! paren-markup-removal-proc #f))]
[show-paren-markup ()
(let ((coords (compute-show-coords)))
(when coords
(do-paren-markup (car coords) (cdr coords))))]
[new-cursor-mark (kind)
(case kind
[(fixed) (send self fixed-mark (cursor))]
[(floating) (send self floating-mark (cursor))]
[else (assertion-violationf 'new-cursor-mark "bad kind ~s" kind)])]
[move-to-char (n)
;;;(fprintf (swl:bug-port) "move-to-char n=~s~n" n)
(let* ((ins (cursor))
(new-ins (send self add-offset ins (- n (get-x/char ins)))))
(cond
[(send self pos<? new-ins begin-exp)
(send self set-cursor-pos! begin-exp)]
[(send self pos>? new-ins end-exp)
(send self set-cursor-pos! end-exp)]
[else (send self set-cursor-pos! new-ins)]))]
) ;;; end protected
(public
[init (parent)
(send-base self init parent)
(set! begin-exp (send self fixed-mark '(0 . 0)))
(set! end-exp (send self floating-mark '(0 . 0)))
]
[cursor-bol () (move-to-char 0)]
[show-sexpression-at (pos bfp efp)
(let ([start (send self offset->index bfp)]
[end (send self offset->index efp)])
(when pos
(set-cursor-pos! self
(case pos
[(start) start]
[(end) end]
[else (assertion-violationf 'show-sexpression-at "invalid position ~s, expected start, end, or #f" pos)])))
(remove-paren-markup)
(send paren-markup apply-markup self start end)
(set! paren-markup-removal-proc
(lambda ()
(send self clear-mini)
(send paren-markup remove-markup self start end))))]
[set-auto-indent! (v) (set! auto-indent? v)]
[get-auto-indent () auto-indent?]
[destroy ()
(if flash-removal-thread (thread-kill flash-removal-thread))
(send-base self destroy)
]
[move-char (n)
(let* ((csr (cursor))
(new-csr (send self add-offset csr n)))
(cond
[(and (send self pos>=? csr begin-exp)
(send self pos<? new-csr begin-exp))
(send self set-cursor-pos! begin-exp)]
[(send self pos>? new-csr end-exp)
(send self set-cursor-pos! end-exp)]
[else (send self set-cursor-pos! new-csr)]))]
[delete-char (disp)
(let ([new-csr (send self add-offset (cursor) disp)])
(when (and (send self pos>=? new-csr begin-exp)
(send self pos<=? new-csr end-exp))
(send-base self delete-char disp)))]
[move-line (n)
(let* ((csr (cursor))
(lin (get-y/char csr))
(new-lin (+ lin n))
(new-csr (cons (get-x/char csr)
(if (positive? new-lin) new-lin 0))))
(cond
[(and (send self pos>=? csr begin-exp)
(send self pos<? new-csr begin-exp))
#f]
[(send self pos>? new-csr end-exp)
#f]
[else (send self set-cursor-pos! new-csr)]))]
[raw-indent-current-line ()
(let* ((csr (cursor))
(csr-y (get-y/char csr))
(csr-x (get-x/char csr))
(open-pos (find-unmatched-open-paren (cons 0 csr-y)))
)
(when (and (positive? csr-y) open-pos)
(let* ((str (send self get-string open-pos csr))
(tok (scan-until-token str 1))
(indent (cond
[(not tok) 1]
[(substring-match-anchored "if " str (1+ tok)) 4]
[(substring-match-anchored "or " str (1+ tok)) 4]
[(substring-match-anchored "and " str (1+ tok)) 5]
[(char-alphabetic? (string-ref str (1+ tok))) 2]
[else 1]))
(cur-line (send self get-string-at-line csr-y))
(cur-span (car (str->spans cur-line csr-y 0)))
(left-x (get-x/char (car cur-span)))
(right-x (get-x/char (cdr cur-span)))
(nonblank-line? (< left-x right-x))
(new-start (+ indent (get-x/char open-pos)))
(idx0 (cons 0 csr-y))
(delta (- new-start left-x))
)
(when (positive? delta)
(send self insert-at idx0 (make-string delta #\space)))
(when (negative? delta)
(send self delete idx0 (send self add-offset idx0 (- delta))))
(when (not (zero? delta))
(if (and nonblank-line? (nonnegative? (+ csr-x delta)))
(send self set-cursor-pos! (cons (+ csr-x delta) csr-y))
(send self set-cursor-pos! (cons new-start csr-y))))
)))]
[indent-current-line ()
(fluid-let ([edit-action 'indenting]) ; kludgey now that this code has moved outside the class where this ivar originates
(send self raw-indent-current-line))]
[show-the-box (v)
(remove-paren-markup)
(set! show-the-box? v)
(show-paren-markup)]
[key-press-prefix (key mods)
(define old-key-prefix key-prefix)
(set! key-prefix #f)
(case old-key-prefix
[(escape)
(event-case ((key= key) (modifier= mods))
[([control #\e]) (send self set-cursor-pos! end-exp)]
[([control #\a]) (send self set-cursor-pos! begin-exp)]
[([shift_l] [shift_r] [control_l] [control_r])
(set! key-prefix 'escape) ;;; doesn't undo an escape
]
[else
(send self display-mini "unknown escape prefix")])]
[else
(send self display-mini "unknown prefix command")
]
)
]
[key-press-no-prefix (key mods)
(define pass-it-on
(lambda ()
(send-base self key-press-no-prefix key mods)))
(event-case ((key= key) (modifier= mods))
[([alt] [control])
(event-case ((key= key) (modifier= mods))
[([alt #\<] [control home]) (send self set-cursor-pos! begin-exp)]
[([alt #\>] [control end]) (send self set-cursor-pos! end-exp)]
[([control #\0]) (send self move-to-match 'forward)]
[([control #\9]) (send self move-to-match 'backward)]
[([control #\)]) (send self select-to-match 'forward)]
[([control #\(]) (send self select-to-match 'backward)]
[else (pass-it-on)]
)]
[([control] [#\backspace] [delete])
(event-case ((key= key) (modifier= mods))
[([control #\d] [delete])
(let ([sel (send self get-selected-range)])
(if sel
(send self delete (car sel) (cdr sel))
(send self delete (cursor))))]
[([control #\h] [#\backspace])
(let ([sel (send self get-selected-range)])
(if sel
(send self delete (car sel) (cdr sel))
(when (send self pos>? (cursor) begin-exp)
(delete-char self -1))))]
[([control #\q])
(set! key-prefix 'c-q)
(send self display-mini "Key prefix: C-q")]
[else (pass-it-on)])]
[([#\return] [#\newline])
(pass-it-on)
(when auto-indent? (send self indent-current-line))
(when (str-whitespace? (send self get-string (cursor) end-exp))
(send self delete (cursor) end-exp))
(send self make-visible (cursor))]
[([#\tab])
(if auto-indent? (send self indent-current-line) (pass-it-on))]
[else (pass-it-on)])
]
[insert-at (idx what)
(when (send self pos<=? begin-exp idx end-exp)
(remove-paren-markup)
(send-base self insert-at idx what)
(show-paren-markup))]
[unrestricted-insert-at (idx what)
(remove-paren-markup)
(send-base self raw-insert-at idx what)
(show-paren-markup)]
[raw-insert-at (idx what)
; fix unrestricted-insert-at if you modify this
(send-base self raw-insert-at idx what)
]
[delete-eol ()
(remove-paren-markup)
(send-base self delete-eol)
(show-paren-markup)]
[delete (idx)
(remove-paren-markup)
(send-base self delete idx)
(show-paren-markup)]
[delete (idx1 idx2)
(remove-paren-markup)
(send-base self delete idx1 idx2)
(show-paren-markup)]
[raw-delete (idx1 idx2)
(send-base self raw-delete idx1 idx2)]
[get-begin-exp () begin-exp]
[get-end-exp () end-exp]
;;; [get-collapsoids () collapsoids]
;;; [set-collapsoids! (cs) (set! collapsoids cs)]
[set-cursor-pos! (pos)
(remove-paren-markup)
(send-base self set-cursor-pos! pos)
(show-paren-markup)]
; [mouse-press (x y mods)
; (remove-paren-markup)
; ; (set! mouse-press-ix (send self xy->index x y))
; ;;; (fprintf (swl:bug-port) "mouse-press-ix: ~s~n" mouse-press-ix)
; ;;; (set! collapsoid-pressed (send self collapsoid-at mouse-press-ix))
; (send-base self mouse-press x y mods)
; ]
;
; [mouse-release (x y mods)
; (send-base self mouse-release x y mods)
; ;;; (when outline-mode?
; ;;; (let ((ix (send self xy->index x y)))
; ;;; (if collapsoid-pressed
; ;;; (event-case ((modifier= mods))
; ;;; [([shift right-button])
; ;;; (if (send self pos=? ix (send collapsoid-pressed get-mk))
; ;;; (send collapsoid-pressed expand-all)
; ;;; (send collapsoid-pressed move-to ix))
; ;;; ]
; ;;; [([right-button])
; ;;; (if (send self pos=? ix (send collapsoid-pressed get-mk))
; ;;; (send collapsoid-pressed expand)
; ;;; (send collapsoid-pressed move-to ix))
; ;;; ]
; ;;; )
; ;;; (event-case ((modifier= mods))
; ;;; [([right-button])
; ;;; (let ((ch (send self get-char ix)))
; ;;; (when (and ch
; ;;; (or (char=? ch #\()
; ;;; (char=? ch #\[)))
; ;;; (let ((match (find-matching-paren ix end-exp #t)))
; ;;; (when match
; ;;; (let ((cloid (create <collapsoid> with
; ;;; (background-color: 'blue)
; ;;; )))
; ;;; (send cloid collapse self ix match <collapsoid>)
; ;;; (set! collapsoids (cons cloid collapsoids))
; ;;; )))))
; ;;; ]))))
; (show-paren-markup)
; ]
;
; [mouse-motion (x y mods)
; ;;; (if outline-mode?
; ;;; (let* ((ix (send self xy->index x y))
; ;;; (ch (send self get-char ix)))
; ;;; (if (and ch
; ;;; (or (char=? ch #\()
; ;;; (char=? ch #\[)
; ;;; (and (char=? ch #\$)
; ;;; (send self collapsoid-at ix)
; ;;; )))
; ;;; (event-case ((modifier= mods))
; ;;; [([right-button])
; ;;; (if collapsoid-pressed
; ;;; (send self set-mouse-cursor! 'right_ptr)
; ;;; (send-base self mouse-motion x y mods))
; ;;; ]
; ;;; [else
; ;;; (unless outline-cursor
; ;;; (set! outline-cursor (send self get-mouse-cursor))
; ;;; (send self set-mouse-cursor! 'left_ptr))
; ;;; (send-base self mouse-motion x y mods)
; ;;; ])
; ;;; (event-case ((modifier= mods))
; ;;; [([right-button])
; ;;; (if collapsoid-pressed
; ;;; (send self set-mouse-cursor! 'right_ptr)
; ;;; (send-base self mouse-motion x y mods))
; ;;; ]
; ;;; [else
; ;;; (when outline-cursor
; ;;; (send self set-mouse-cursor! outline-cursor)
; ;;; (set! outline-cursor #f))
; ;;; (send-base self mouse-motion x y mods)])))
; (send-base self mouse-motion x y mods)
; ;;; )
; ]
;
; ;;; [collapsoid-at (ix)
; ;;; (let ((mkups (send self markups-at ix)))
; ;;; (ormap (lambda (o) (if (isa? o <collapsoid>) o #f)) mkups))
; ;;; ]
[get-string-at-line (line)
(send self get-string (cons 0 line) (idx1- (cons 0 (1+ line))))]
[move-to-match (dir)
(with-match #f dir (lambda (pos) (set-cursor-pos! self pos)))]
[select-to-match (dir)
(with-match #f dir
(lambda (pos)
(case dir
[(forward)
(with-match pos 'backward
(lambda (start)
(set-cursor-pos! self pos)
(select-range self start pos)))]
[(backward)
(with-match pos 'forward
(lambda (end)
(set-cursor-pos! self pos)
(select-range self pos end)))]
[else
(assertion-violationf 'select-to-match "unrecognized direction ~s" dir)])))]
[undo ()
(remove-paren-markup)
(send-base self undo)
(show-paren-markup)]
[redo ()
(remove-paren-markup)
(send-base self redo)
(show-paren-markup)]
) ;;; end public
)
#!eof
(require "../common/scrollframe.ss" 'once)
(define new-scheme-text
(case-lambda
[(top height width)
(let* ((frame
(create <frame> top with
(background-color: 'white)))
(mini-frame (create <frame> top))
(scrolled-frame
(create <scrollframe> frame with
(default-vscroll: #t) (sticky-hscroll: #t)))
(scheme-text
(create <scheme-text> scrolled-frame with
(height/char: height) (width/char: width)
(background-color: 'white)
(wrap: 'none)
)))
(pack mini-frame (expand: #f) (fill: 'x))
(pack scrolled-frame (expand: #t) (fill: 'both))
(pack scheme-text)
(pack frame)
(send scheme-text realize)
scheme-text)]
[(top)
(new-scheme-text top 24 80)]))
(define-swl-class (<collapsoid>) (<markup>)
(ivars
(text #f)
(nested-collapsoids #f)
(nesting-offset #f)
(mk #f)
(text-wgt #f)
)
(inherited)
(inheritable)
(private)
(protected
[class-name () '<collapsoid>] ;;; johnz - kludge: oscar to remove
[idx1+ (ix) (send text-wgt add-offset ix 1)]
)
(public
[get-mk () mk]
[set-mk! (v)
(if (pair? v)
(set! mk (send text-wgt fixed-mark v))
(set! mk v))]
[collapse (twgt ix match collapsoid-class)
(define iota
(lambda (a b)
(if (send text-wgt pos<? a b)
(cons a (iota (idx1+ a) b))
(list b))))
(set! text-wgt twgt)
(let* ((all-cloids (send text-wgt get-collapsoids))
(cloids
(let f ((cloids all-cloids) (in '()) (out '()))
(if (null? cloids)
(cons in out)
(let ((cloid (car cloids)))
(if (send text-wgt pos<=? ix (send cloid get-mk) match)
(f (cdr cloids) (cons cloid in) out)
(f (cdr cloids) in (cons cloid out))))))))
(let ((cloids-in (car cloids))
(cloids-out (cdr cloids)))
(for-each
(lambda (cloid) (send cloid change-to-nested ix))
cloids-in)
(set! nested-collapsoids cloids-in)
(send text-wgt set-collapsoids! cloids-out)
(set! text (send text-wgt get-string ix (idx1+ match)))
(send text-wgt delete ix (idx1+ match))
(send text-wgt raw-insert-at ix "$")
(send self apply-markup text-wgt ix (idx1+ ix))
(set! mk (send text-wgt fixed-mark ix))
))
]
[reapply (ix)
(let ((new-ix (send text-wgt add-offset ix nesting-offset)))
(send self apply-markup text-wgt new-ix (idx1+ new-ix))
(set! mk (send text-wgt fixed-mark new-ix)))
]
[move-to (ix)
(send self remove-markup text-wgt mk (idx1+ mk))
(send text-wgt delete mk)
(set! mk (send text-wgt fixed-mark ix))
(send text-wgt insert-at mk #\$)
(send self apply-markup text-wgt mk (idx1+ mk))
]
[change-to-nested (ix)
(set! nesting-offset
(- (send text-wgt index->offset mk) (send text-wgt index->offset ix)))
(set! mk 'nested)
]
[expand ()
;;
;; Fast clicking may cause multiple activations of this method.
;; The when expression guards against this.
;;
(when nested-collapsoids
(let ((csr (send text-wgt get-cursor-pos)))
(send self remove-markup text-wgt mk (idx1+ mk))
(send text-wgt delete mk)
(send text-wgt raw-insert-at mk text)
(for-each
(lambda (cloid) (send cloid reapply mk))
nested-collapsoids)
(send text-wgt set-cursor-pos! csr)
(send text-wgt set-collapsoids!
(append nested-collapsoids
(remq self (send text-wgt get-collapsoids))))
(set! nested-collapsoids #f)))
]
[expand-all ()
;;
;; Fast clicking may cause multiple activations of this method.
;; The when expression guards against this.
;;
(when nested-collapsoids
(let ((ncloids nested-collapsoids))
(send self expand)
(for-each
(lambda (cloid) (send cloid expand-all))
ncloids)))
]
)
)
| false |
30624de8f743ec747a8bcc2bd8e9664b59bee02e | ac2a3544b88444eabf12b68a9bce08941cd62581 | /gsc/tests/04-pair/cxxxxr.scm | 13410888e2f10cde3166b27d06d194d610a855a2 | [
"Apache-2.0",
"LGPL-2.1-only"
]
| permissive | tomelam/gambit | 2fd664cf6ea68859d4549fdda62d31a25b2d6c6f | d60fdeb136b2ed89b75da5bfa8011aa334b29020 | refs/heads/master | 2020-11-27T06:39:26.718179 | 2019-12-15T16:56:31 | 2019-12-15T16:56:31 | 229,341,552 | 1 | 0 | Apache-2.0 | 2019-12-20T21:52:26 | 2019-12-20T21:52:26 | null | UTF-8 | Scheme | false | false | 1,225 | scm | cxxxxr.scm | (declare (extended-bindings) (not constant-fold) (not safe))
(define x01 '(1 2 3 4))
(define x02 '((1 2) 3 4))
(define x03 '(((1 2)) 3 4))
(define x04 '(1 (2) 3 4))
(define x05 '((1 2 3) 4))
(define x06 '((((1 2 3))) 4))
(define x07 '(1 ((2 3)) 4))
(define x08 '((1 ((2))) 3 4))
(define x09 '(1 2 (3) 4))
(define x10 '(((1 2)) 3 4))
(define x11 '(1 (2 (3 4))))
(define x12 '((1 (2 3) 4)))
(define x13 '(1 2 ((3)) 4))
(define x14 '(1 (2 3 4)))
(define x15 '((1 2 3 4)))
(define x16 '(1 2 3 4 5))
(println (##car x01))
(println (##cdr x01))
(println (##caar x02))
(println (##cadr x01))
(println (##cdar x02))
(println (##cddr x01))
(println (##caaar x03))
(println (##caadr x04))
(println (##cadar x02))
(println (##caddr x01))
(println (##cdaar x03))
(println (##cdadr x04))
(println (##cddar x05))
(println (##cdddr x01))
(println (##caaaar x06))
(println (##caaadr x07))
(println (##caadar x08))
(println (##caaddr x09))
(println (##cadaar x10))
(println (##cadadr x11))
(println (##caddar x05))
(println (##cadddr x01))
(println (##cdaaar x06))
(println (##cdaadr x07))
(println (##cdadar x12))
(println (##cdaddr x13))
(println (##cddaar x03))
(println (##cddadr x14))
(println (##cdddar x15))
(println (##cddddr x16))
| false |
c83f328aa1e54a5c5e8ab42aec16b21a595d321d | 000dbfe5d1df2f18e29a76ea7e2a9556cff5e866 | /sitelib/srfi/%3a115/regexp.scm | d05b4b078939b2aa59d49d05eecc1b6cf8ebf6b2 | [
"BSD-3-Clause",
"LicenseRef-scancode-other-permissive",
"MIT",
"BSD-2-Clause"
]
| permissive | ktakashi/sagittarius-scheme | 0a6d23a9004e8775792ebe27a395366457daba81 | 285e84f7c48b65d6594ff4fbbe47a1b499c9fec0 | refs/heads/master | 2023-09-01T23:45:52.702741 | 2023-08-31T10:36:08 | 2023-08-31T10:36:08 | 41,153,733 | 48 | 7 | NOASSERTION | 2022-07-13T18:04:42 | 2015-08-21T12:07:54 | Scheme | UTF-8 | Scheme | false | false | 6,638 | scm | regexp.scm | ;;; -*- mode:scheme; coding:utf-8; -*-
;;;
;;; regexp.scm - SRFI-115 Scheme Regular Expressions
;;;
;;; Copyright (c) 2014-2017 Takashi Kato <[email protected]>
;;;
;;; Redistribution and use in source and binary forms, with or without
;;; modification, are permitted provided that the following conditions
;;; are met:
;;;
;;; 1. Redistributions of source code must retain the above copyright
;;; notice, this list of conditions and the following disclaimer.
;;;
;;; 2. Redistributions in binary form must reproduce the above copyright
;;; notice, this list of conditions and the following disclaimer in the
;;; documentation and/or other materials provided with the distribution.
;;;
;;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
;;; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
;;; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
;;; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
;;; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
;;; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
;;; TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
;;; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
;;; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;;;
#!nounbound
(library (srfi :115 regexp)
(export regexp regexp? valid-sre? rx regexp->sre char-set->sre
regexp-matches regexp-matches? regexp-search
regexp-replace regexp-replace-all
regexp-fold regexp-extract regexp-split regexp-partition
regexp-match? regexp-match-count
regexp-match-submatch
regexp-match->list
regexp-match-submatch-start regexp-match-submatch-end)
(import (rnrs)
(sagittarius)
(sagittarius regex)
(text sre)
(srfi :14))
(define regexp? regex-pattern?)
(define (regexp sre)
(if (regexp? sre)
sre
(sre->regex sre)))
(define (valid-sre? sre) (guard (e (else #f)) (sre-parse sre) #t))
(define regexp->sre regex->sre)
(define (char-set->sre cs) (list (char-set->string cs)))
(define (regexp-matches re str :optional (start 0) (end (string-length str)))
(let ((m (regex-matcher (regexp re) str start end)))
(and (regex-matches m) m)))
(define (regexp-matches? re str :optional (start 0) (end (string-length str)))
(regex-matches (regex-matcher (regexp re) str start end)))
(define (regexp-search re str :optional (start 0) (end (string-length str)))
(let ((m (regex-matcher (regexp re) str start end)))
(and (regex-looking-at m) m)))
(define (default-finish from md str acc) acc)
(define (regexp-fold rx kons knil str
:optional (finish default-finish)
(start 0) (end (string-length str)))
(regex-fold (regexp rx) kons knil str finish start end))
(define (regexp-partition rx str
:optional (start 0) (end (string-length str)))
(define (kons from md str a)
(let ((i (regexp-match-submatch-start md 0))
(j (regexp-match-submatch-end md 0)))
(if (eqv? i j)
a
(let ((left (substring str (car a) i)))
(cons j
(cons (regexp-match-submatch md 0)
(cons left (cdr a))))))))
(define (final from md str a)
(if (or (< from end) (null? (cdr a)))
(cons (substring str (car a) end) (cdr a))
(cdr a)))
(reverse! (regexp-fold rx kons (cons start '()) str final start end)))
(define (regexp-extract rx str :optional (start 0) (end (string-length str)))
(regexp-fold rx
(lambda (from md str a)
(let ((s (md 0)))
(if (string=? s "") a (cons s a))))
'()
str
(lambda (from md str a) (reverse! a))
start end))
(define (regexp-split rx str :optional (start 0) (end (string-length str)))
(regexp-fold
rx
(lambda (from md str a)
(let ((i (regexp-match-submatch-start md 0))
(j (regexp-match-submatch-end md 0)))
(if (= i j)
a
(cons j (cons (substring str (car a) i) (cdr a))))))
(cons start '())
str
(lambda (from md str a)
(reverse! (cons (substring str (car a) end) (cdr a))))
start
end))
(define (compile-subst m subst)
(define (resolve-integer i) (format "$~a" i))
(define (resolve-symbol sym)
(case sym
((pre) "$p")
((post) "$P")
(else
(cond ((regex-group m sym) => resolve-integer)
(else (error 'compile-subst "invalid symbol" sym))))))
(define (compile subst)
;; TODO 'pre and 'post
(call-with-string-output-port
(lambda (out)
(let loop ((subst subst))
(unless (null? subst)
(let ((item (car subst)))
(cond ((integer? item) (display (resolve-integer item) out))
((string? item) (display item out))
((symbol? item) (display (resolve-symbol item) out))
(else
(error 'compile-subst "not supported" item subst)))
(loop (cdr subst))))))))
(cond ((pair? subst) (compile subst))
((integer? subst) (resolve-integer subst))
;; symbol 'pre and 'post
((symbol? subst) (resolve-symbol subst))
(else subst)))
(define (regexp-replace rx str subst :optional (start 0) (end #f) (count 0))
(let ((m (regex-matcher (regexp rx) str start
(or end (string-length str)))))
;; TODO we need to make subst a bit modified
(regex-replace m (compile-subst m subst) count)))
(define (regexp-replace-all rx str subst :optional (start 0) (end #f))
(let ((m (regex-matcher (regexp rx) str start
(or end (string-length str)))))
;; TODO we need to make subst a bit modified
(regex-replace-all m (compile-subst m subst))))
(define regexp-match? regex-matcher?)
(define (regexp-match-count m) (- (regex-capture-count m) 1))
(define (regexp-match-submatch m i) (regex-group m i))
;; for compatibility...
(define (regexp-match-submatch-start m i)
(let ((s (regex-group-start m i))
(e (regex-group-end m i)))
(+ s (if (= s e) 1 0))))
(define (regexp-match-submatch-end m i)
(let ((s (regex-group-start m i))
(e (regex-group-end m i)))
(+ e (if (= s e) 1 0))))
(define (regexp-match->list m)
(let ((count (regex-capture-count m)))
(let loop ((i 0) (r '()))
(if (= i count)
(reverse! r)
(loop (+ i 1) (cons (regex-group m i) r))))))
)
| false |
4d9079a4ca29ca24fb0ebbd351d0cf66208a7dbe | d369542379a3304c109e63641c5e176c360a048f | /brice/Chapter1/exercise-1.7.scm | 8e22bd4b8bc98c97a0ecd094091c2b0f4829ce0d | []
| no_license | StudyCodeOrg/sicp-brunches | e9e4ba0e8b2c1e5aa355ad3286ec0ca7ba4efdba | 808bbf1d40723e98ce0f757fac39e8eb4e80a715 | refs/heads/master | 2021-01-12T03:03:37.621181 | 2017-03-25T15:37:02 | 2017-03-25T15:37:02 | 78,152,677 | 1 | 0 | null | 2017-03-25T15:37:03 | 2017-01-05T22:16:07 | Scheme | UTF-8 | Scheme | false | false | 3,480 | scm | exercise-1.7.scm | ; Exercise 1.7
(define (sqrt-iter guess x)
(if (good-enough? guess x) guess
(sqrt-iter (improve guess x) x)))
; Statement: `good-enough?` will not be very effective
; for the root of small numbers
;
; Reasoning: Root will be smaller or close to the order of
; the threshold in the test, which means that the
; `good-enough?` function will return true prematurely.
; For example:
(sqrt-iter 0.0001 0.0004) ;-> 0.0001
;
; Statement: Real calculations are almost always performed with
; limited precision
;
; Reasoning: We are usually limited by the register size of the
; floating point unit in the processor. Performing
; arbitrary precision calculation is expensive.
;
; Statement: The `good-enough?` test is inadequate for large numbers.
;
; Reasoning: The `improve` function will improve the guess to a limited
; precision inherent to the divide operation (depending on
; platform, etc...).
; If the precision of the improvement is below the threshold
; of the `good-enough?` test, then a new improvement will be
; attempted. The precision of this will also be below the
; threshold of the `good-enough?` test, causing infinite
; recursion.
(define THRESHOLD 0.001)
; Old test relies on the answer being within THRESHOLD of the solution
(define (original-good-enough? previous-guess guess x)
(< (abs (- (square guess) x)) THRESHOLD))
; New test relies on the difference between the previous and current
; guess being a very small fraction of the current guess (less than THRESHOLD)
(define (new-good-enough? previous-guess guess x)
(< (/ (abs (- previous-guess guess)) guess) THRESHOLD))
; For some reason, this alternative version of `good-enough?` seems to
; give better results for small roots.
; For example,
;
; (new-sqrt-iter new-good-enough? 0 1 9e-4) ;-> 0.030000012746348552
; (new-sqrt-iter alternative-good-enough? 0 1 9e-4) ;-> 0.030000000000002705
;
; This is due to the fact that the alternative function iterates one more
; than the new function. This can be seen by instrumenting the `new-sqrt-iter`
; function with the following code:
;
; (printf "[~a] old: ~a new: ~a\n" x old-guess guess)
;
; and looking at the iteration sequence for both test functions
(define (alternative-good-enough? previous-guess guess x)
(< (/ (abs (- previous-guess guess)) x) THRESHOLD))
(define (new-sqrt-iter end-predicate old-guess guess x)
;(printf "[~a] old: ~a new: ~a\n" x old-guess guess)
(if (end-predicate old-guess guess x) guess
(new-sqrt-iter end-predicate guess (improve guess x) x)))
; However, the `alternative-good-enough?` function fails for
; large numbers as the fractional guess difference becomes small
; relative to the x value and the function returns true too early.
; With the original `good-enough?` function, we get incorrect results
; for small numbers, however the `new-good-enough?` function returns the
; correct values.
;
; (new-sqrt-iter original-good-enough? 0 1 4e-4) ;-> 0.0354008825558513
; (new-sqrt-iter new-good-enough? 0 1 4e-4) ;-> 0.02
;
; For large numbers the new predicate will give worse results, as the
; relative difference of the guesses is used to stop the iteration, and this
; will lead to reduced absolute accuracy compared to using a fixed test to
; stop the iteration.
| false |
e6688fc6ebdb056f9722e1185201ef0bc339c7d5 | 4b480cab3426c89e3e49554d05d1b36aad8aeef4 | /chapter-03/ex3.29-falsetru.scm | b42c2f6d625ce46d96d4d08a2131b4dae08a7250 | []
| no_license | tuestudy/study-sicp | a5dc423719ca30a30ae685e1686534a2c9183b31 | a2d5d65e711ac5fee3914e45be7d5c2a62bfc20f | refs/heads/master | 2021-01-12T13:37:56.874455 | 2016-10-04T12:26:45 | 2016-10-04T12:26:45 | 69,962,129 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 307 | scm | ex3.29-falsetru.scm | (define (or-gate a b c)
(define na (make-wire))
(define nb (make-wire))
(define nanb (make-wire))
(inverter a na)
(inverter b na)
(and-gate na nb nanb)
(inverter nanb c))
; or-gate-delay = inverter-delay + and-gate-delay + inverter-delay
; = 2 * inverter-delay + and-gate-delay
| false |
ae87ff92aa028a71e3194a40d3731579a87c83c7 | def26f110cf94581c6e0523383cec8c56c779d51 | /srfi/61.sld | dfe5b6b3e98738a144dea9a17b9a0f03045373cb | [
"MIT"
]
| permissive | TaylanUB/scheme-srfis | f86649e4a71e8af59d2afd71bd33e96aaae4760f | 7c4ba635c9829a35ce7134fa12db9959e4d1982a | refs/heads/master | 2021-07-06T00:29:53.807790 | 2021-06-01T00:41:31 | 2021-06-01T00:41:31 | 37,764,520 | 39 | 4 | null | 2015-08-25T10:09:16 | 2015-06-20T09:20:04 | Scheme | UTF-8 | Scheme | false | false | 2,981 | sld | 61.sld | ;;; Copyright (C) 2004 Taylor Campbell. All rights reserved.
;;; Made an R7RS library by Taylan Ulrich Bayırlı/Kammer, Copyright (C) 2014.
;;; Permission is hereby granted, free of charge, to any person obtaining a copy
;;; of this software and associated documentation files (the "Software"), to
;;; deal in the Software without restriction, including without limitation the
;;; rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
;;; sell copies of the Software, and to permit persons to whom the Software is
;;; furnished to do so, subject to the following conditions:
;;; The above copyright notice and this permission notice shall be included in
;;; all copies or substantial portions of the Software.
;;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
;;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
;;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
;;; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
;;; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
;;; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
;;; IN THE SOFTWARE.
(define-library (srfi 61)
(export cond)
(import (except (scheme base) cond))
(begin
(define-syntax cond
(syntax-rules (=> else)
((cond (else else1 else2 ...))
;; The (if #t (begin ...)) wrapper ensures that there may be no
;; internal definitions in the body of the clause. R5RS mandates
;; this in text (by referring to each subform of the clauses as
;; <expression>) but not in its reference implementation of `cond',
;; which just expands to (begin ...) with no (if #t ...) wrapper.
(if #t (begin else1 else2 ...)))
((cond (test => receiver) more-clause ...)
(let ((t test))
(cond/maybe-more t
(receiver t)
more-clause ...)))
((cond (generator guard => receiver) more-clause ...)
(call-with-values (lambda () generator)
(lambda t
(cond/maybe-more (apply guard t)
(apply receiver t)
more-clause ...))))
((cond (test) more-clause ...)
(let ((t test))
(cond/maybe-more t t more-clause ...)))
((cond (test body1 body2 ...) more-clause ...)
(cond/maybe-more test
(begin body1 body2 ...)
more-clause ...))))
(define-syntax cond/maybe-more
(syntax-rules ()
((cond/maybe-more test consequent)
(if test
consequent))
((cond/maybe-more test consequent clause ...)
(if test
consequent
(cond clause ...)))))
))
| true |
f4249d43d9333e3053b2422cdbe9af37dc4ff622 | 382706a62fae6f24855ab689b8b2d87c6a059fb6 | /0.2/src/eval/special.scm | 7608c15aa8e04c34f53cc84aae0ef12095413846 | [
"Apache-2.0"
]
| permissive | mstram/bard | ddb1e72a78059617403bea1842840bb9e979198e | 340d6919603a30c7944fb66e04df0562180bc0bb | refs/heads/master | 2021-01-21T00:12:27.174597 | 2014-07-10T13:20:39 | 2014-07-10T13:20:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 15,956 | scm | special.scm | ;;;; ***********************************************************************
;;;; FILE IDENTIFICATION
;;;;
;;;; Name: special.scm
;;;; Project: Bard
;;;; Purpose: bard special forms
;;;; Author: mikel evins
;;;; Copyright: 2012 by mikel evins
;;;;
;;;; ***********************************************************************
(define $special-forms-table (make-table test: eq?))
(define (%defspecial nm eval-fn)
(table-set! $special-forms-table nm eval-fn))
(define (%special-evaluator nm)
(table-ref $special-forms-table nm #f))
(define (%special-form? expr)
(and (table-ref $special-forms-table (%car expr) #f)
#t))
(define (%eval-special-form expr env)
(let* ((op (%car expr))
(evaluator (table-ref $special-forms-table op #f)))
(if evaluator
(evaluator expr env)
(error (string-append "unrecognized special form" (%as-string (%car expr)))))))
;;; ----------------------------------------------------------------------
;;; special forms defined
;;; ----------------------------------------------------------------------
;;; and
;;; ----------------------------------------------------------------------
;;; begin
;;; ----------------------------------------------------------------------
(%defspecial 'begin
(lambda (expr env)
(%eval-sequence (%cdr expr) env)))
;;; cond
;;; ----------------------------------------------------------------------
(%defspecial 'cond
(lambda (expr env)
(let loop ((clauses (%cdr expr)))
(if (%null? clauses)
(%nothing)
(let* ((clause (%car clauses))
(test (%car clause))
(conseq (%cdr clause)))
(if (eq? 'else test)
(%eval-sequence conseq env)
(if (%true? (%eval test env))
(%eval-sequence conseq env)
(loop (%cdr clauses)))))))))
;;; define
;;; ----------------------------------------------------------------------
(%defspecial 'define
(lambda (expr env)
(%defglobal (%list-ref expr 1) (%eval (%list-ref expr 2) env))
(%list-ref expr 1)))
;;; define-function
;;; ----------------------------------------------------------------------
;;; (show (%eval (bard:read-from-string "(define-function (always-true) true)")))
;;; (show (%eval (bard:read-from-string "(define-function (itself x) x)")))
;;; (show (%eval (bard:read-from-string "(define-function (my-list & args) args)")))
;;; (show (%eval (bard:read-from-string "(define-function (foo {a: 1 b: 2}) (list a b))")))
;;; (show (%eval (bard:read-from-string "(define-function (elt (ls <list>)(i <fixnum>)) (%list-ref ls i))")))
;;; (show (%eval (bard:read-from-string "(define-function (frob (x <list>)(y <fixnum>) & more-args) (%list-ref ls i))")))
(define %fparams %list)
(define (%parse-function-parameters params env)
(let loop ((params params)
(param-names %nil)
(param-types %nil)
(rest-arg #f)
(frame-arg #f))
(if (%null? params)
(%fparams param-names param-types rest-arg frame-arg)
(let ((next (%car params))
(more (%cdr params)))
(cond
((eq? '& next) (loop %nil
param-names
param-types
(%cadr params)
frame-arg))
((symbol? next) (loop (%cdr params)
(%append param-names (%list next))
(%append param-types (%list 'Anything))
rest-arg
frame-arg))
((%list? next) (if (eq? 'frame (%car next))
(loop %nil
param-names
param-types
rest-arg
next)
(loop (%cdr params)
(%append param-names (%list (%car next)))
(%append param-types (%list (%cadr next)))
rest-arg
frame-arg)))
(else (error (string-append "Invalid parameter: " (object->string next)))))))))
(define (%parse-function-prototype proto env)
(let* ((name (%car proto))
(params (%cdr proto)))
(%cons name (%parse-function-parameters params env))))
(define (%fproto-name fp)(%list-ref fp 0))
(define (%fproto-formals fp)(%list-ref fp 1))
(define (%fproto-types fp)(%list-ref fp 2))
(define (%fproto-restarg fp)(%list-ref fp 3))
(define (%fproto-framearg fp)(%list-ref fp 4))
;;; TODO: define-function can now parse frame args, e.g.:
;;; (define-function (x y {a: "default1" b: "default2"})...)
;;; but functions do not yet handle them
(define (%define-function expr #!optional (env (%null-environment)))
(let* ((prototype (%parse-function-prototype (%list-ref expr 1) env))
(fname (%fproto-name prototype))
(fn (or (table-ref $bard-global-variables fname #f)
(let ((f (%make-function name: fname)))
(%defglobal fname f)
f)))
(formals (%fproto-formals prototype))
(types (%map (lambda (p)(%eval p env))
(%fproto-types prototype)))
(restarg (%fproto-restarg prototype))
(framearg (%fproto-framearg prototype))
(required-count (%length types))
(body (%cons 'begin (%drop 2 expr)))
(method-signature types)
(method (%make-interpreted-method formals body
environment: env
name: fname
required-count: required-count
restarg: restarg)))
(%add-method! fn method-signature method)
fname))
(%defspecial 'define-function %define-function)
;;; function
;;; ----------------------------------------------------------------------
(%defspecial 'function
(lambda (expr env)
(if (> (%length expr) 1)
(%make-function name: (%list-ref expr 1))
(%make-function))))
;;; generate
;;; ----------------------------------------------------------------------
;;; (generate ((x 1))
;;; (yield (* x x))
;;; (then (+ x 1)))
(%defspecial 'generate
(lambda (expr env)
(let* ((env (%copy-environment env))
(bindings (map (lambda (binding)
(%list (%car binding)
(%eval (%cadr binding) env)))
(%list-ref expr 1)))
(yield-expr (let ((xp (%list-ref expr 2)))
(if (eq? 'yield (car xp))
(cdr xp)
(error (string-append "Invalid yield form in generate: "
(object->string xp))))))
(then-expr (let ((xp (%list-ref expr 3)))
(if (eq? 'then (car xp))
(cdr xp)
(error (string-append "Invalid then form in generate: "
(object->string xp)))))))
(%make-generator yield-expr then-expr env bindings))))
;;; if
;;; ----------------------------------------------------------------------
(%defspecial 'if
(lambda (expr env)
(let ((test (%list-ref expr 1))
(conseq (%list-ref expr 2))
(alt? (> (%length expr) 3)))
(if (%true? (%eval test env))
(%eval conseq env)
(if alt?
(%eval (%list-ref expr 3) env)
(%nothing))))))
;;; let
;;; ----------------------------------------------------------------------
(%defspecial 'let
(lambda (expr env)
(let ((bindings (%list-ref expr 1))
(body (%drop 2 expr)))
(%eval-sequence body (%add-let-bindings env bindings)))))
;;; method
;;; ----------------------------------------------------------------------
;;; method-form => (method-name formals restarg body)
;;; (method (x y) (+ x y)) => (#f (x y) #f (begin (+ x y)))
;;; (method foo (x y) (+ x y)) => (foo (x y) #f (begin (+ x y)))
;;; (method foo (x y) (begin (+ x y))) => (foo (x y) #f (begin (+ x y)))
;;; (method foo (x y) (+ x y)(* x y)) => (foo (x y) #f (begin (+ x y)(* x y)))
;;; (method (x y & more) (+ x y)) => (#f (x y) more (begin (+ x y)))
(define (%parse-method-parameters params)
(let loop ((ps params)
(formals %nil))
(if (%null? ps)
(values formals #f)
(if (eq? '& (%car ps))
(let* ((ps (%cdr ps))
(len (%length ps)))
(case len
((0)(error "An ampersand must be followed by a parameter name"))
((1)(values formals (%car ps)))
(else (error "Too many parameters following an ampersand"))))
(loop (%cdr ps)(%append formals (%list (%car ps))))))))
(define (%parse-method-form m)
(let* ((form (%cdr m))
(first (%car form))
(mname (if (symbol? first) first #f))
(params (if mname (%list-ref form 1)(%list-ref form 0)))
(body (%cons 'begin (if mname (%drop 2 form)(%drop 1 form)))))
(receive (formals restarg)(%parse-method-parameters params)
(%list mname formals restarg body))))
(define (%mdesc-get-name mdesc)(%list-ref mdesc 0))
(define (%mdesc-get-formals mdesc)(%list-ref mdesc 1))
(define (%mdesc-get-restarg mdesc)(%list-ref mdesc 2))
(define (%mdesc-get-body mdesc)(%list-ref mdesc 3))
(%defspecial 'method
(lambda (expr env)
(let* ((mdesc (%parse-method-form expr))
(mname (%mdesc-get-name mdesc))
(formals (%mdesc-get-formals mdesc))
(restarg (%mdesc-get-restarg mdesc))
(body (%mdesc-get-body mdesc)))
(%make-interpreted-method formals body
environment: env
name: mname
required-count: (%length formals)
restarg: restarg))))
;;; not
;;; ----------------------------------------------------------------------
(%defspecial 'not
(lambda (expr env)
(if (%true? (%eval (%car (%cdr expr)) env))
(%false)
(%true))))
;;; quasiquote
;;; ----------------------------------------------------------------------
;;; after norvig
(define (constant? exp)
(if (pair? exp)
(eq? (car exp) 'quote)
(not (symbol? exp))))
(define (combine-skeletons left right exp)
(cond
((and (constant? left) (constant? right))
(if (and (eqv? (%eval left) (car exp))
(eqv? (%eval right) (cdr exp)))
(list 'quote exp)
(list 'quote (cons (%eval left) (%eval right)))))
((null? right) (list 'list left))
((and (pair? right) (eq? (car right) 'list))
(cons 'list (cons left (cdr right))))
(else (list 'add-first left right))))
(define (%expand-quasiquote exp nesting)
(cond
((not (pair? exp))
(if (constant? exp) exp (list 'quote exp)))
((and (eq? (car exp) 'unquote) (= (length exp) 2))
(if (= nesting 0)
(%cadr exp)
(combine-skeletons ''unquote
(%expand-quasiquote (cdr exp) (- nesting 1))
exp)))
((and (eq? (car exp) 'quasiquote) (= (length exp) 2))
(combine-skeletons ''quasiquote
(%expand-quasiquote (cdr exp) (+ nesting 1))
exp))
((and (pair? (car exp))
(eq? (caar exp) 'unquote-splicing)
(= (length (car exp)) 2))
(if (= nesting 0)
(list 'append (%cadr (%car exp))
(%expand-quasiquote (cdr exp) nesting))
(combine-skeletons (%expand-quasiquote (car exp) (- nesting 1))
(%expand-quasiquote (cdr exp) nesting)
exp)))
(else (combine-skeletons (%expand-quasiquote (car exp) nesting)
(%expand-quasiquote (cdr exp) nesting)
exp))))
(%defspecial 'quasiquote
(lambda (expr env)
(%eval (%expand-quasiquote (%cadr expr) 0) env)))
(%defspecial 'unquote (lambda (expr env) (error "invalid context for unquote")))
(%defspecial 'unquote-splicing (lambda (expr env) (error "invalid context for unquote-splicing")))
;;; quote
;;; ----------------------------------------------------------------------
(%defspecial 'quote
(lambda (expr env)
(if (= 2 (%length expr))
(%car (%cdr expr))
(error (string-append "Wrong number of arguments to quote: " (%as-string (%cdr expr)))))))
;;; repeat
;;; ----------------------------------------------------------------------
(%defspecial 'repeat
(lambda (expr env)
(let ((form (%cdr expr)))
(let loop ()
(%eval-sequence form env)
(loop)))))
;;; set!
;;; ----------------------------------------------------------------------
(%defspecial 'set!
(lambda (expr env)
(%set-variable! (%list-ref expr 1)
(%eval (%list-ref expr 2)
env)
env)))
;;; time
;;; ----------------------------------------------------------------------
(%defspecial 'time
(lambda (expr env)
(time (%eval (%car (%cdr expr)) env))))
;;; with-open-file
;;; ----------------------------------------------------------------------
;;; (with-open-file (var path {direction: 'input}) (do-stuff-to-file-stream var))
(%defspecial 'with-open-file
(lambda (expr env)
(let* ((spec (%list-ref expr 1))
(var (%car spec))
(path (%eval (%cadr spec) env))
(keyargs (%drop 2 spec))
(direction (let ((keylen (%length keyargs)))
(if (<= keylen 0)
'input
(if (and (= 2 keylen)
(eq? direction:))
(%eval (%cadr keyargs) env)
(error (string-append "Invalid keyword arguments to with-open-file: "
(%as-string keyargs)))))))
(body (%cons 'begin (%drop 2 expr))))
(case direction
((input in) (call-with-input-file path
(lambda (in)
(let ((env (%add-binding env var in)))
(%eval body env)))))
((output out) (call-with-output-file path
(lambda (out)
(let ((env (%add-binding env var out)))
(%eval body env)))))
(else (error (string-append "Invalid value for direction: argument: "
(object->string direction))))))))
| false |
536e7037a4c007c1aae344818e1479596f6cec04 | 5a68949704e96b638ca3afe335edcfb65790ca20 | /cps-interpreter/tests/test-callcc4.scm | 032e3f1fc914488d43e0c8c94568e7f1fa4e9586 | []
| no_license | terryc321/lisp | 2194f011f577d6b941a0f59d3c9152d24db167b2 | 36ca95c957eb598facc5fb4f94a79ff63757c9e5 | refs/heads/master | 2021-01-19T04:43:29.122838 | 2017-05-24T11:53:06 | 2017-05-24T11:53:06 | 84,439,281 | 2 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 123 | scm | test-callcc4.scm |
(begin
(define a 1)
(define k1 #f)
(set! k1 (call/cc (lambda (k) k)))
(format #t "hello world a = ~a ~%" a)
(k1 0)
)
| false |
f73be961163dcff092d57546f27a626f53738ab6 | 169a5122284459b36ea040407e44ada125318636 | /net/twitter/v1.1.scm | ab5c84ce41cc4616632f2f76a0dd90a5aecf965b | []
| no_license | ktakashi/Sagittarius-net-twitter | 26a89f335b4b3d3f845833eea2d8470be6b8d9f3 | 67750159e6ffb30b88dabee0a85539d29184e393 | refs/heads/master | 2020-05-17T02:38:32.521780 | 2017-11-10T16:20:30 | 2017-11-10T16:20:30 | 4,771,205 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 13,657 | scm | v1.1.scm | ;;; -*- mode:scheme; coding:utf-8; -*-
;;;
;;; net/twitter/v1.1.scm - Twitter 1.1 API library.
;;;
;;; Copyright (c) 2012-2013 Takashi Kato <[email protected]>
;;;
;;; Redistribution and use in source and binary forms, with or without
;;; modification, are permitted provided that the following conditions
;;; are met:
;;;
;;; 1. Redistributions of source code must retain the above copyright
;;; notice, this list of conditions and the following disclaimer.
;;;
;;; 2. Redistributions in binary form must reproduce the above copyright
;;; notice, this list of conditions and the following disclaimer in the
;;; documentation and/or other materials provided with the distribution.
;;;
;;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
;;; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
;;; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
;;; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
;;; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
;;; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
;;; TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
;;; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
;;; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;;;
(library (net twitter v1.1)
(export
;; Timeline
twitter-mentions-timeline
twitter-user-timeline
twitter-home-timeline
twitter-retweets-of-me
;; Tweet
twitter-retweets
twitter-show
twitter-destroy
twitter-update
twitter-retweet
twitter-update-with-media
twitter-oembed
twitter-retweeters-ids
;; Search
twitter-search-tweets
;; Friends & Followers
twitter-friendships-no-retweeets-ids
twitter-friends-ids
twitter-followers-ids
twitter-friendships-lookup
twitter-friendships-create
twitter-friendships-destroy
;; Users
twitter-account-settings
twitter-verify-credentials
twitter-update-account-settings
twitter-update-profile
twitter-update-profile-background-image
twitter-update-profile-colors
twitter-users-lookup
twitter-users-show
twitter-users-search
)
(import (rnrs)
(sagittarius)
(net oauth)
(net twitter util))
(define-syntax check-at-least-one
(syntax-rules ()
((_ who params ...)
(unless (or params ...)
(assertion-violation 'who "must specify at least one of the parameters"
'(params ...))))))
;; Twitter APIs
;; timeline related
(define (twitter-mentions-timeline token
:key (count #f)
(since-id #f)
(max-id #f)
(trim-user #f)
(contributor-details #f)
(include-entities #f)
:allow-other-keys opts)
(apply call/twitter-api token 'GET "/1.1/statuses/mentions_timeline"
(make-query-params count since-id max-id
trim-user contributor-details
include-entities) opts))
(define (twitter-user-timeline token
:key (user-id #f)
(screen-name #f)
(count #f)
(since-id #f)
(max-id #f)
(trim-user #f)
(exclude-entities #f)
(contributor-details #f)
(include-rts #f)
:allow-other-keys opts)
(check-at-least-one twitter-user-timeline user-id screen-name)
(apply call/twitter-api token 'GET "/1.1/statuses/user_timeline"
(make-query-params user-id screen-name count since-id max-id
trim-user contributor-details
exclude-entities include-rts) opts))
(define (twitter-home-timeline token
:key (count #f)
(since-id #f)
(max-id #f)
(trim-user #f)
(exclude-replies #f)
(contributor-details #f)
(include-entities #f)
:allow-other-keys opts)
(apply call/twitter-api token 'GET "/1.1/statuses/home_timeline"
(make-query-params count since-id max-id
trim-user include-entities
exclude-replies contributor-details) opts))
(define (twitter-retweets-of-me token
:key (count #f)
(since-id #f)
(max-id #f)
(trim-user #f)
(include-entities #f)
(include-user-entities #f)
:allow-other-keys opts)
(apply call/twitter-api token 'GET "/1.1/statuses/retweets_of_me"
(make-query-params count since-id max-id
trim-user include-entities
include-user-entities) opts))
;; Tweets
(define (twitter-retweets token id
:key (count #f) (trim-user #f)
:allow-other-keys opts)
(apply call/twitter-api token 'GET (format "/1.1/statuses/retweets/~a" id)
(make-query-params count trim-user) opts))
(define (twitter-show token id
:key (trim-user #f)
(include-my-retweet #f)
(include-entities #f)
:allow-other-keys opts)
(apply call/twitter-api token 'GET (format "/1.1/statuses/show/~a" id)
(make-query-params trim-user include-my-retweet
include-entities) opts))
(define (twitter-destroy token id
:key (trim-user #f)
:allow-other-keys opts)
(apply call/twitter-api token 'POST (format "/1.1/statuses/destroy/~a" id)
(make-query-params trim-user) opts))
(define (twitter-update token message
:key (in-reply-to-status-id #f)
(lat #f)
(long #f)
(place-id #f)
(display-coordinates #f)
(trim-user #f)
:allow-other-keys opts)
(apply call/twitter-api token 'POST "/1.1/statuses/update"
(make-query-params in-reply-to-status-id
lat long place-id display-coordinates
trim-user)
:body (string-append "status=" message)
:content-type "application/x-www-form-urlencoded"
opts))
(define (twitter-retweet token id
:key (trim-user #f)
:allow-other-keys opts)
(apply call/twitter-api token 'POST (format "/1.1/statuses/retweet/~a" id)
(make-query-params trim-user) opts))
(define (twitter-update-with-media token message media
:key (possibly-sensitive #f)
(in-reply-to-status-id #f)
(lat #f)
(long #f)
(place-id #f)
(display-coordinates #f)
:allow-other-keys opts)
(apply call/twitter-api token 'POST "/1.1/statuses/update_with_media"
(make-query-params possibly-sensitive in-reply-to-status-id
lat long place-id display-coordinates)
:use-user-parameters-for-auth #f
:body `(("status" ,message)
,@(map (lambda (m)
`("media[]" :file ,m
:content-transfer-encoding "base64")) media))
opts))
(define (twitter-oembed token
:key (id #f)
(url #f)
(maxwidth #f)
(hide-media #t)
(hide-thread #t)
(omit-script #t)
(align #f)
(related #f)
(lang #f)
:allow-other-keys opts)
(check-at-least-one twitter-oembed id url)
(apply call/twitter-api token 'GET "/1.1/statuses/oembed"
(make-query-params id url maxwidth hide-thread hide-thread
omit-script align related lang) opts))
(define (twitter-retweeters-ids token id
:key (cursor #f) (stringify-ids #f)
:allow-other-keys opts)
(apply call/twitter-api token 'GET "/1.1/statuses/retweetters/ids"
(make-query-params id cursor stringify-ids) opts))
;; Search
(define (twitter-search-tweets token q
:key (geocode #f)
(lang #f)
(locale #f)
(result-type #f)
(count #f)
(until #f)
(since-id #f)
(max-id #f)
(include-entities #f)
(callback #f)
:allow-other-keys opts)
(apply call/twitter-api token 'GET "/1.1/search/tweets"
(make-query-params q geocode lang locale count since-id max-id
include-entities callback) opts))
;; Friends & Followers
(define (twitter-friendships-no-retweeets-ids token :key (stringify-ids #f)
:allow-other-keys opts)
(apply call/twitter-api token 'GET "/1.1/friendships/no_retweets/ids"
(make-query-params stringify-ids) opts))
(define (twitter-friends-ids token
:key (user-id #f)
(screen-name #f)
(cursor #f)
(stringify-ids #f)
(count #f)
:allow-other-keys opts)
(check-at-least-one twitter-friends-ids user-id screen-name)
(apply call/twitter-api token 'GET "/1.1/friends/ids"
(make-query-params user-id screen-name cursor stringify-ids count)
opts))
(define (twitter-followers-ids token
:key (user-id #f)
(screen-name #f)
(cursor #f)
(stringify-ids #f)
(count #f)
:allow-other-keys opts)
(apply call/twitter-api token 'GET "/1.1/followers/ids"
(make-query-params user-id screen-name cursor stringify-ids count)
opts))
(define (twitter-friendships-lookup token
:key (user-id #f)
(screen-name #f)
:allow-other-keys opts)
(check-at-least-one twitter-friendships-lookup user-id screen-name)
(apply call/twitter-api token 'GET "/1.1/friendships/lookup"
(make-query-params user-id screen-name)
opts))
(define (twitter-friendships-create token
:key (user-id #f)
(screen-name #f)
(follow #f)
:allow-other-keys opts)
(check-at-least-one twitter-friendships-lookup user-id screen-name)
(apply call/twitter-api token 'POST "/1.1/friendships/create"
(make-query-params user-id screen-name follow)
opts))
(define (twitter-friendships-destroy token
:key (user-id #f)
(screen-name #f)
:allow-other-keys opts)
(check-at-least-one twitter-friendships-lookup user-id screen-name)
(apply call/twitter-api token 'POST "/1.1/friendships/destroy"
(make-query-params user-id screen-name)
opts))
;; TODO the rest...
;; Users
(define (twitter-account-settings token . opts)
(apply call/twitter-api token 'GET "/1.1/account/settings"
'() opts))
(define (twitter-verify-credentials token
:key (include-entities #f)
(skip-status #f)
:allow-other-keys opts)
(apply call/twitter-api token 'GET "/1.1/account/verify_credentials"
(make-query-params include-entities skip-status) opts))
(define (twitter-update-account-settings token
:key (trend-location-woeid #f)
(sleep-time-enabled #f)
(start-sleep-time #f)
(end-sleep-time #f)
(time-zone #f)
(lang #f)
:allow-other-keys opts)
(check-at-least-one twitter-update-account-settings
trend-location-woeid sleep-time-enabled
start-sleep-time end-sleep-time time-zone lang)
(apply call/twitter-api token 'POST "/1.1/account/settings"
(make-query-params trend-location-woeid sleep-time-enabled
start-sleep-time end-sleep-time time-zone lang)
opts))
(define (twitter-update-profile token
:key (name #f)
(url #f)
(location #f)
(description #f)
(include-entities #f)
(skip-status #f)
:allow-other-keys opts)
(check-at-least-one twitter-update-profile
name url location description
include-entities skip-status)
(apply call/twitter-api token 'POST "/1.1/account/update_profile"
(make-query-params name url location description
include-entities skip-status)
opts))
(define (twitter-update-profile-background-image token
:key (image #f)
(tile #f)
(include-entities #f)
(skip-status #f)
(use #f)
:allow-other-keys opts)
(check-at-least-one twitter-update-profile-background-image
image image tile use)
(apply call/twitter-api token 'POST
"/1.1/account/update_profile_background_image"
(make-query-params tile include-entities skip-status use)
:body (and image
`(("image" :file ,image
:content-transfer-encoding "base64")))
opts))
(define (twitter-update-profile-colors token
:key (profile-background-color #f)
(profile-link-color #f)
(profile-sidebar-border-color #f)
(profile-text-color #f)
(include-entities #f)
(skip-status #f)
:allow-other-keys opts)
(apply call/twitter-api token 'POST "/1.1/account/update_profile_colors"
(make-query-params profile-background-color
profile-link-color
profile-sidebar-border-color
profile-text-color
include-entities skip-status)
opts))
(define (twitter-users-lookup token
:key (screen-name #f) (user-id #f)
(include-entities #f)
:allow-other-keys opts)
(check-at-least-one twitter-users-lookup user-id screen-name)
(apply call/twitter-api token 'GET "/1.1/users/lookup"
(make-query-params user-id screen-name include-entities) opts))
(define (twitter-users-show token
:key (user-id #f)
(screen-name #f)
(include-entities #f)
:allow-other-keys opts)
(check-at-least-one twitter-users-show user-id screen-name)
(apply call/twitter-api token 'GET "/1.1/users/show"
(make-query-params user-id screen-name include-entities) opts))
(define (twitter-users-search token q
:key (page #f)
(count #f)
(include-entities #f)
:allow-other-keys opts)
(apply call/twitter-api token 'GET "/1.1/users/search"
(make-query-params q page count include-entities) opts))
) | true |
9df516cc3d05dd0ae7ec04dc39c92246955fe24b | 404799b4b2d5f83ee5304392826a69defc25da77 | /ex1-31.scm | 7ce2641bab9510e29d87b33427fb02467376b8d6 | []
| no_license | WuzhangFang/SICP-exercise | 38ae650c63e74bb7c6639bf984285e06743db925 | d9977009ec3e32a74edb13b4f13f6ebbbc44ab32 | refs/heads/master | 2020-04-16T16:01:18.058287 | 2019-10-01T21:52:40 | 2019-10-01T21:52:40 | 165,722,260 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 578 | scm | ex1-31.scm | ;;; Exercise 1.31
; recursive
(define (product-r term a next b)
(if (> a b)
1
(* (term a) (product-r term (next a) next b))))
; iterative
(define (product-i term a next b)
(define (iter a result)
(if (> a b)
result
(iter (next a) (* result (term a)))))
(iter a 1))
; calculate pi
(load "even.scm")
(define (next x) (+ x 1))
(define (term n)
(if (even? n)
(/ (+ n 2.0) (+ n 1.0))
(/ (+ n 1.0) (+ n 2.0))))
(define (pi n)
(* 4 (product-r term 1 next n)))
(pi 6)
(pi 100)
(pi 1000)
| false |
cde15beff7eb6323db6ce63c07c0073d10442ffd | defeada37d39bca09ef76f66f38683754c0a6aa0 | /System/system/diagnostics/boolean-switch.sls | fedb174edfe082dd39718dc01bf1e4f295f91f5b | []
| no_license | futsuki/ironscheme-port | 2dbac82c0bda4f4ff509208f7f00a5211d1f7cd5 | 4e7a81b0fbeac9a47440464988e53fb118286c54 | refs/heads/master | 2016-09-06T17:13:11.462593 | 2015-09-26T18:20:40 | 2015-09-26T18:20:40 | 42,757,369 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 656 | sls | boolean-switch.sls | (library (system diagnostics boolean-switch)
(export new
is?
boolean-switch?
enabled?-get
enabled?-set!
enabled?-update!)
(import (ironscheme-clr-port))
(define-syntax new
(lambda (e)
(syntax-case e ()
((_ a ...)
#'(clr-new System.Diagnostics.BooleanSwitch a ...)))))
(define (is? a) (clr-is System.Diagnostics.BooleanSwitch a))
(define (boolean-switch? a)
(clr-is System.Diagnostics.BooleanSwitch a))
(define-field-port
enabled?-get
enabled?-set!
enabled?-update!
(property:)
System.Diagnostics.BooleanSwitch
Enabled
System.Boolean))
| true |
f7a3bdab9fd188b5e8a70db3726277b7f8b6164d | 648776d3a0d9a8ca036acaf6f2f7a60dcdb45877 | /queries/haskell_persistent/highlights.scm | afb32f11dd928ab355ae590a82de1f574038a7ac | [
"Apache-2.0"
]
| permissive | nvim-treesitter/nvim-treesitter | 4c3c55cbe6ff73debcfaecb9b7a0d42d984be3e6 | f8c2825220bff70919b527ee68fe44e7b1dae4b2 | refs/heads/master | 2023-08-31T20:04:23.790698 | 2023-08-31T09:28:16 | 2023-08-31T18:19:23 | 256,786,531 | 7,890 | 980 | Apache-2.0 | 2023-09-14T18:07:03 | 2020-04-18T15:24:10 | Scheme | UTF-8 | Scheme | false | false | 757 | scm | highlights.scm | ;; ----------------------------------------------------------------------------
;; Literals and comments
(integer) @number
(float) @float
(char) @character
(string) @string
(attribute_name) @attribute
(attribute_exclamation_mark) @attribute
(con_unit) @symbol ; unit, as in ()
(comment) @comment @spell
;; ----------------------------------------------------------------------------
;; Keywords, operators, includes
[
"Id"
"Primary"
"Foreign"
"deriving"
] @keyword
"=" @operator
;; ----------------------------------------------------------------------------
;; Functions and variables
(variable) @variable
;; ----------------------------------------------------------------------------
;; Types
(type) @type
(constructor) @constructor
| false |
13dd772f5d0fc7609a27ff5f2d9b4c0d887f4334 | 29fdc68ecadc6665684dc478fc0b6637c1293ae2 | /src/wiliki/scr-macros.scm | e39988ec0d095fada629d064ec396670f4a813f2 | [
"MIT"
]
| permissive | shirok/WiLiKi | 5f99f74551b2755cb4b8deb4f41a2a770138e9dc | f0c3169aabd2d8d410a90033d44acae548c65cae | refs/heads/master | 2023-05-11T06:20:48.006068 | 2023-05-05T18:29:48 | 2023-05-05T18:30:12 | 9,766,292 | 20 | 6 | MIT | 2018-10-07T19:15:09 | 2013-04-30T07:40:21 | Scheme | UTF-8 | Scheme | false | false | 11,869 | scm | scr-macros.scm | ;;
;; Macros used in SchemeCrossReference site
;; included for the reference
;;
(select-module wiliki.macro)
(use scheme.list)
(use srfi.13)
;;---------------------------------------------------------------
;; SRFI-related macros
(define-reader-macro (srfis . numbers)
`((p "Implementing " ,@(wiliki:format-wikiname "SRFI") "s: "
,@(append-map (lambda (num)
(cons " " (wiliki:format-wikiname #"SRFI-~num")))
numbers))))
(define (pick-srfis-macro page-record)
(cond ((#/\[\[$$srfis ([\s\d]+)\]\]/ page-record)
=> (lambda (m)
(map x->integer (string-tokenize (m 1)))))
(else #f)))
(define-reader-macro (srfi-implementors-map)
(let1 tab (make-hash-table 'eqv?)
(wiliki:db-for-each
(lambda (pagename record)
(cond ((pick-srfis-macro record)
=> (cut map (cut hash-table-push! tab <> pagename) <>)))))
(list
`(table
(@ (style "border-width: 0"))
,@(map (lambda (srfi-num&title)
(let* ((num (car srfi-num&title))
(title (cdr srfi-num&title))
(popularity (length (hash-table-get tab num '())))
(bgcolor (case popularity
((0) "#ffffff")
((1) "#fff8f8")
((2) "#fff0f0")
((3 4) "#ffe0e0")
((5 6) "#ffcccc")
((7 8) "#ffaaaa")
(else "#ff8888"))))
`(tr
(td (@ (style ,#"background-color: ~bgcolor"))
,@(wiliki:format-wikiname #"SRFI-~num")
": ")
(td (@ (style ,#"background-color: ~bgcolor"))
,title)
(td (@ (style ,#"background-color: ~bgcolor ; font-size: 60%"))
,(format "[~a implementation~a]"
popularity
(if (= popularity 1) "" "s"))))))
*final-srfis*)))))
(define-reader-macro (srfi-implementors . maybe-num)
(let* ((num (x->integer
(get-optional maybe-num
(or (and-let* ((p (wiliki-current-page))
(t (ref p 'title))
(m (#/SRFI-(\d+)/ t)))
(m 1))
"-1"))))
(impls (sort (wiliki:db-fold
(lambda (pagename record seed)
(cond ((pick-srfis-macro record)
=> (lambda (srfis)
(if (memv num srfis)
(cons pagename seed)
seed)))
(else seed)))
'()))))
`((p "SRFI-" ,(x->string num) " is implemented in "
,@(if (null? impls)
'("(none)")
(append-map (lambda (impl)
(cons " " (wiliki:format-wikiname impl)))
impls))))))
;;; The SRFI table below can be obtained by the following code snippet.
#|
(use rfc.http)
(define (get-srfi-info kind) ; kind := final | withdrawn | draft
(receive (s h c) (http-get "srfi.schemers.org" #"/?statuses=~|kind|")
(unless (string=? s "200")
(errorf "couldn't retrieve ~a srfi data (~a)" kind s))
(with-input-from-string c
(^[]
(port-fold (^[line seed]
(if-let1 m (#/<li class=\"card (\w+)\"/ line)
(if (equal? (m 1) (x->string kind))
(if-let1 m (#/<a href=\"srfi-\d+\/\"><span[^>]*>(\d+)<\/span><\/a>: <span[^>]*>(.*?)<\/span>/ line)
(acons (x->integer (m 1))
(regexp-replace-all #/<\/?\w+>/ (m 2)
"")
seed)
seed)
seed)
seed))
'()
read-line)))))
|#
(define *final-srfis*
'((0 . "Feature-based conditional expansion construct")
(1 . "List Library")
(2 . "AND-LET*: an AND with local bindings, a guarded LET* special form")
(4 . "Homogeneous numeric vector datatypes")
(5 . "A compatible let form with signatures and rest arguments")
(6 . "Basic String Ports")
(7 . "Feature-based program configuration language")
(8 . "receive: Binding to multiple values")
(9 . "Defining Record Types")
(10 . "#, external form")
(11 . "Syntax for receiving multiple values")
(13 . "String Libraries")
(14 . "Character-set Library")
(16 . "Syntax for procedures of variable arity")
(17 . "Generalized set!")
(18 . "Multithreading support")
(19 . "Time Data Types and Procedures")
(21 . "Real-time multithreading support")
(22 . "Running Scheme Scripts on Unix")
(23 . "Error reporting mechanism")
(25 . "Multi-dimensional Array Primitives")
(26 . "Notation for Specializing Parameters without Currying")
(27 . "Sources of Random Bits")
(28 . "Basic Format Strings")
(29 . "Localization")
(30 . "Nested Multi-line Comments")
(31 . "A special form `rec' for recursive evaluation")
(34 . "Exception Handling for Programs")
(35 . "Conditions")
(36 . "I/O Conditions")
(37 . "args-fold: a program argument processor")
(38 . "External Representation for Data With Shared Structure")
(39 . "Parameter objects")
(41 . "Streams")
(42 . "Eager Comprehensions")
(43 . "Vector library")
(44 . "Collections")
(45 . "Primitives for Expressing Iterative Lazy Algorithms")
(46 . "Basic Syntax-rules Extensions")
(47 . "Array")
(48 . "Intermediate Format Strings")
(49 . "Indentation-sensitive syntax")
(51 . "Handling rest list")
(54 . "Formatting")
(55 . "require-extension")
(57 . "Records")
(58 . "Array Notation")
(59 . "Vicinity")
(60 . "Integers as Bits")
(61 . "A more general cond clause")
(62 . "S-expression comments")
(63 . "Homogeneous and Heterogeneous Arrays")
(64 . "A Scheme API for test suites")
(66 . "Octet Vectors")
(67 . "Compare Procedures")
(69 . "Basic hash tables")
(70 . "Numbers")
(71 . "Extended LET-syntax for multiple values")
(72 . "Hygienic macros")
(74 . "Octet-Addressed Binary Blocks")
(78 . "Lightweight testing")
(86 .
"MU and NU simulating VALUES & CALL-WITH-VALUES, and their related LET-syntax"
)
(87 . "=> in case clauses")
(88 . "Keyword objects")
(89 . "Optional positional and named parameters")
(90 . "Extensible hash table constructor")
(94 . "Type-Restricted Numerical Functions")
(95 . "Sorting and Merging")
(96 . "SLIB Prerequisites")
(97 . "SRFI Libraries")
(98 . "An interface to access environment variables")
(99 . "ERR5RS Records")
(100 . "define-lambda-object")
(101 . "Purely Functional Random-Access Pairs and Lists")
(105 . "Curly-infix-expressions")
(106 . "Basic socket interface")
(107 . "XML reader syntax")
(108 . "Named quasi-literal constructors")
(109 . "Extended string quasi-literals")
(110 . "Sweet-expressions (t-expressions)")
(111 . "Boxes")
(112 . "Environment Inquiry")
(113 . "Sets and bags")
(115 . "Scheme Regular Expressions")
(116 . "Immutable List Library")
(117 . "Queues based on lists")
(118 . "Simple adjustable-size strings")
(119 . "wisp: simpler indentation-sensitive scheme")
(120 . "Timer APIs")
(123 . "Generic accessor and modifier operators")
(124 . "Ephemerons")
(125 . "Intermediate hash tables")
(126 . "R6RS-based hashtables")
(127 . "Lazy Sequences")
(128 . "Comparators (reduced)")
(129 . "Titlecase procedures")
(130 . "Cursor-based string library")
(131 . "ERR5RS Record Syntax (reduced)")
(132 . "Sort Libraries")
(133 . "Vector Library (R7RS-compatible)")
(134 . "Immutable Deques")
(135 . "Immutable Texts")
(136 . "Extensible record types")
(137 . "Minimal Unique Types")
(138 . "Compiling Scheme programs to executables")
(139 . "Syntax parameters")
(140 . "Immutable Strings")
(141 . "Integer division")
(143 . "Fixnums")
(144 . "Flonums")
(145 . "Assumptions")
(146 . "Mappings")
(147 . "Custom macro transformers")
(148 . "Eager syntax-rules")
(149 . "Basic Syntax-rules Template Extensions")
(150 . "Hygienic ERR5RS Record Syntax (reduced)")
(151 . "Bitwise Operations")
(152 . "String Library (reduced)")
(154 . "First-class dynamic extents")
(155 . "Promises")
(156 . "Syntactic combiners for binary predicates")
(157 . "Continuation marks")
(158 . "Generators and Accumulators")
(160 . "Homogeneous numeric vector libraries")
(161 . "Unifiable Boxes")
(162 . "Comparators sublibrary")
(163 . "Enhanced array literals")
(164 . "Enhanced multi-dimensional Arrays")
(165 . "The Environment Monad")
(166 . "Monadic Formatting")
(167 . "Ordered Key Value Store")
(168 . "Generic Tuple Store Database")
(169 . "Underscores in numbers")
(170 . "POSIX API")
(171 . "Transducers")
(172 . "Two Safer Subsets of R7RS")
(173 . "Hooks")
(174 . "POSIX Timespecs")
(175 . "ASCII character library")
(176 . "Version flag")
(178 . "Bitvector library")
(179 . "Nonempty Intervals and Generalized Arrays (Updated)")
(180 . "JSON")
(181 . "Custom ports (including transcoded ports)")
(185 . "Linear adjustable-length strings")
(188 . "Splicing binding constructs for syntactic keywords")
(189 . "Maybe and Either: optional container types")
(190 . "Coroutine Generators")
(192 . "Port Positioning")
(193 . "Command line")
(194 . "Random data generators")
(195 . "Multiple-value boxes")
(196 . "Range Objects")
(197 . "Pipeline Operators")
(201 . "Syntactic Extensions to the Core Scheme Bindings")
(202 .
"Pattern-matching Variant of the and-let* Form that Supports Multiple Values")
(203 . "A Simple Picture Language in the Style of SICP")
(206 . "Auxiliary Syntax Keywords")
(207 . "String-notated bytevectors")
(208 . "NaN procedures")
(209 . "Enums and Enum Sets")
(210 . "Procedures and Syntax for Multiple Values")
(211 . "Scheme Macro Libraries")
(212 . "Aliases")
(213 . "Identifier Properties")
(214 . "Flexvectors")
(215 . "Central Log Exchange")
(216 . "SICP Prerequisites (Portable)")
(217 . "Integer Sets")
(219 . "Define higher-order lambda")
(221 . "Generator/accumulator sub-library")
(222 . "Compound Objects")
(223 . "Generalized binary search procedures")
(224 . "Integer Mappings")
(225 . "Dictionaries")
(227 . "Optional Arguments")
(228 . "Composing Comparators")
(229 . "Tagged Procedures")
(230 . "Atomic Operations")
(231 . "Intervals and Generalized Arrays")
(232 . "Flexible curried procedures")
(233 . "INI files")
(236 . "Evaluating expressions in an unspecified order")))
;;---------------------------------------------------------------
;; Category macros
(define-reader-macro (category . xs)
`((div (@ (class category-display))
,(format "Categor~a:" (match xs [(_) "ys"][_ "ies"]))
,@(intersperse
","
(map (lambda (x)
;; we'll add link later.
`(a ,x))
xs)))))
| false |
df1e4ef52544a444c29023a386d09fe2f4cedea0 | 03de0e9f261e97d98f70145045116d7d1a664345 | /scheme-cml/misc.chezscheme.sls | 9d99a7aa6294167df6536d7a70e7c365ed7acab0 | []
| no_license | arcfide/riastradh | 4929cf4428307b926e4c16e85bc39e5897c14447 | 9714b5c8b642f2d6fdd94d655ec5d92aa9b59750 | refs/heads/master | 2020-05-26T06:38:54.107723 | 2010-10-18T16:52:23 | 2010-10-18T16:52:23 | 3,235,881 | 2 | 1 | null | null | null | null | UTF-8 | Scheme | false | false | 3,203 | sls | misc.chezscheme.sls | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Miscellaneous Needs of Scheme CML
;;; Version: 1
;;;
;;; Copyright (c) 2009 Aaron W. Hsu <[email protected]>
;;;
;;; Permission to use, copy, modify, and distribute this software for
;;; any purpose with or without fee is hereby granted, provided that the
;;; above copyright notice and this permission notice appear in all
;;; copies.
;;;
;;; THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
;;; WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
;;; WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
;;; AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
;;; DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
;;; OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
;;; TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
;;; PERFORMANCE OF THIS SOFTWARE.
(library (riastradh scheme-cml misc)
(export spawn sleep compose-nullary compose-unary)
(import (chezscheme))
(define (spawn thunk . rest)
(fork-thread thunk))
(define sleep
(let ([$sleep (foreign-procedure "usleep" (unsigned) int)])
(lambda (dur)
(unless (zero? ($sleep (* dur 1000)))
(error 'sleep "Error in foreign usleep()")))))
(define (compose-nullary procedure nullary-procedure)
(lambda ()
(call-with-values nullary-procedure procedure)))
(define (compose-unary procedure unary-procedure)
(lambda (argument)
(call-with-values (lambda () (unary-procedure argument)) procedure)))
)
;;;; The following applies to the compose procedures
;;;; Concurrent ML for Scheme
;;;; Scheme48: Package Definitions
;;; Copyright (c) 2009, Taylor R. Campbell
;;;
;;; Redistribution and use in source and binary forms, with or without
;;; modification, are permitted provided that the following conditions
;;; are met:
;;;
;;; * Redistributions of source code must retain the above copyright
;;; notice, this list of conditions and the following disclaimer.
;;;
;;; * Redistributions in binary form must reproduce the above copyright
;;; notice, this list of conditions and the following disclaimer in
;;; the documentation and/or other materials provided with the
;;; distribution.
;;;
;;; * Neither the names of the authors nor the names of contributors
;;; may be used to endorse or promote products derived from this
;;; software without specific prior written permission.
;;;
;;; THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
| false |
3725db95bc10e6445031b11599b0de45bb6d606f | cb8cccd92c0832e056be608063bbec8fff4e4265 | /chapter3/Exercises/3.1.scm | d12cbaf0a27e36bbdb8304de158ecd3a11be025e | []
| no_license | JoseLGF/SICP | 6814999c5fb15256401acb9a53bd8aac75054a14 | 43f7a8e6130095e732c6fc883501164a48ab2229 | refs/heads/main | 2023-07-21T03:56:35.984943 | 2021-09-08T05:19:38 | 2021-09-08T05:19:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 577 | scm | 3.1.scm | #lang scheme
; Exercise 3.1
; An accumulator is a procedure that is called repeatedly
; with a single numeric argument and accumulates its arg-
; uments into a sum.
; Each time it is called, it returns the currently accum-
; ulated sum.
; Write a procedure make-accumulator that generates accum-
; ulators, each maintaining an independent sum.
; The input to make-accumulator should specify the initial
; value of the sum.
(define (make-accumulator sum)
(lambda (amount)
(begin (set! sum (+ sum amount))
sum)))
(define A (make-accumulator 5))
(A 10)
(A 10) | false |
d1d0630917ae8f17df64ad21c67fafb407731d6d | ec5b4a92882f80b3f62eac8cbd059fb1f000cfd9 | /imperative/sps/!plots/make-plots.ss | f5c98e475f5e3c39d10468dbd28a700fa65075e9 | []
| no_license | ggem/alpa | ee35ffc91d9f4b1d540ce8b2207595813e488e5f | 4f53b888b5a5b4ffebd220c6e0458442325fbff2 | refs/heads/master | 2019-01-02T03:12:17.899768 | 2005-01-04T03:43:12 | 2005-01-04T03:43:12 | 42,612,681 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 2,129 | ss | make-plots.ss | ;
(define procs '((insertsort . "insert sort")
(list-mergesort . "merge sort (list)")
(mergesort . "merge sort (vector)")
(reverse! . "reverse")
(selectsort . "select sort")
(vector-sum . "vector sum")))
(define kinds '(measured computed computed2))
(define make-plot-files
(lambda ()
(do ([kinds kinds (cdr kinds)])
[(null? kinds) 'done]
(do ([procs procs (cdr procs)])
[(null? procs) 'done]
(let ([kind (car kinds)]
[proc (caar procs)])
(let ([command (format
(string-append
"sed -n 's/(~a[ \t]*\\([0-9]*\\)[ \t]*\\([0-9.]*\\))/\\1 \\2/p'"
" < ../\\!timing/~a.txt"
" > ~a.~a.txt")
proc kind proc kind)])
(system command)))))))
(define (make-plots)
(let ([pr (process "gnuplot")])
(let ([gnuplot
(cadr pr)
;(current-output-port)
])
(display "set xlabel \"input size\" \"Times\"\n" gnuplot)
(display "set ylabel \"time (millisecconds)\" \"Times\"\n" gnuplot)
(display "set data style linespoints\n" gnuplot)
(display "set size 0.5,0.5\n" gnuplot)
(display "set terminal postscript eps\n" gnuplot)
(do ([procs procs (cdr procs)])
[(null? procs)
(close-input-port (car pr))
(close-output-port (cadr pr))]
(let ([name (caar procs)]
[title (cdar procs)])
(fprintf gnuplot "set title ~s \"Times\"\n" title)
(fprintf gnuplot "set output \"~a-sps.eps\"\n" name)
(fprintf gnuplot "plot [0:1000] \"~a.measured.txt\" t \"measured\" , \"~a.computed.txt\" t \"computed\"\n"
name name)
(fprintf gnuplot "set output \"~a-direct.eps\"\n" name)
(fprintf gnuplot "plot [0:1000] \"~a.measured.txt\" t \"measured\" , \"~a.computed2.txt\" t \"computed (direct)\" , \"~a.computed.txt\" t \"computed (sps)\"\n"
name name name))))))
(make-plots) | false |
84162e5f48bc8d81a98e176dce1dcd6ac0becbb4 | 58381f6c0b3def1720ca7a14a7c6f0f350f89537 | /Chapter 1/1.2/Ex1.22.scm | 42a9b93464cc30574e2ca29670da2e0fd913aacb | []
| no_license | yaowenqiang/SICPBook | ef559bcd07301b40d92d8ad698d60923b868f992 | c8a0228ebf66d9c1ddc5ef1fcc1d05d8684f090a | refs/heads/master | 2020-04-19T04:03:15.888492 | 2015-11-02T15:35:46 | 2015-11-02T15:35:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 1,574 | scm | Ex1.22.scm | #lang planet neil/sicp
(define (timed-prime-test n)
(start-prime-test n (runtime)))
(define (start-prime-test n start-time)
(if (prime? n)
(report-prime n (- (runtime) start-time))
false))
(define (report-prime n elapsed-time)
(display n)
(display " *** ")
(display elapsed-time)
(newline))
(define (smallest-divisor n)
(find-divisor n 2))
(define (find-divisor n test-divisor)
(cond ((> (square test-divisor) n) n)
((divides? test-divisor n) test-divisor)
(else (find-divisor n (+ test-divisor 1)))))
(define (divides? x y)
(= (remainder y x) 0))
(define (square n) (* n n))
(define (prime? n) (= (smallest-divisor n) n))
(define (search-for-primes startNum primesCount)
(cond ((= primesCount 0) (values))
((even? startNum) (search-for-primes (+ startNum 1) primesCount))
(else (if (timed-prime-test startNum)
(search-for-primes (+ startNum 2) (- primesCount 1))
(search-for-primes (+ startNum 2) primesCount)))))
(search-for-primes 1000 3) ;;1009, 1013, 1019
(newline)
(search-for-primes 10000 3) ;;10007, 10009, 10037
(newline)
(search-for-primes 100000 3) ;; 100003, 100019, 100043
(newline)
(search-for-primes 1000000 3) ;; 1000003, 1000033, 1000037
(newline)
;;These are still too fast so using larger numbers
(search-for-primes 100000000 2); approximately 1000
(newline)
(search-for-primes 1000000000 2); approximately 3000
(newline)
(search-for-primes 10000000000 2); approximately 10000
;;For a factor of 10 increase, runtime increases by approx (sqrt 10) ~ 3.16...
| false |
d2532c343c729c8d721a6b32aae9b80d11d5af6b | e28e5bd06f08ba86edcdfcf5d50de37a90e1cd19 | /scheme/graph-search.scm | 8bb65d321afbe5eb3d91fa4f2a1575e7c1f58bb8 | []
| no_license | edoardo90/swKnights-plp | 4384a9dedc6c3ec15181b5e201d66207b331579a | 870b3f4f37c73bfe4a913b8da079a778314117c9 | refs/heads/master | 2021-01-18T01:43:48.024605 | 2016-03-19T20:37:51 | 2016-03-19T20:37:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 1,424 | scm | graph-search.scm | #lang racket
;) the node struct
(struct node
(name
(sons #:mutable)
(color #:mutable)))
;) A test graph
(define graph1
(let ((a (node #\a '() 'white))
(b (node #\b '() 'white))
(c (node #\c '() 'white))
(d (node #\d '() 'white))
(e (node #\e '() 'white)))
(set-node-sons! a (list b c))
(set-node-sons! b (list d e))
(set-node-sons! e (list d))
(list a b c d e)))
;) deep-first loop
(define (depth-first n)
(for-each (λ (x)
(when (eq? (node-color x) 'white)
(begin
(display (node-name x))
(newline)
(set-node-color! x 'black)
(depth-first x))))
(node-sons n)))
;) breadth-first loop
(define (breadth-first l)
(unless (null? l)
(if (eq? (node-color (car l)) 'white)
(begin
(set-node-color! (car l) 'black)
(display (node-name (car l)))
(newline)
(breadth-first (append (cdr l) (node-sons (car l)))))
(breadth-first (cdr l)))))
;) Breadth first algorithm
(define (breadth-first-search g)
(breadth-first (list (car g))))
;) Depth first algorithm
(define (depth-first-search g)
(set-node-color! (car g) 'black)
(display (node-name (car g)))
(newline)
(depth-first (car g)))
;(depth-first-search graph1)
(breadth-first-search graph1)
| false |
4a10263d0e37e162fa65d0b47be393ca46942e90 | ecc64f06b59d01680c312066af53b3e79e1b1f7a | /mockery.scm | c18ed9fadad23bb15813990609726e335eca78f0 | [
"0BSD"
]
| permissive | SourceReviver/s7-scheme | fd27942e9c16f48d7e7e968f122a0eb64f898e2e | a3d4824bac4f85a09710ad26075294a12c34b700 | refs/heads/master | 2023-08-18T19:52:49.400284 | 2021-09-26T09:32:15 | 2021-09-26T09:32:15 | 410,752,737 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 44,863 | scm | mockery.scm | (provide 'mockery.scm)
;;; the exported mock data classes
(define *mock-vector* #f)
(define *mock-pair* #f)
(define *mock-string* #f)
(define *mock-hash-table* #f)
(define *mock-symbol* #f)
(define *mock-c-pointer* #f)
(define *mock-random-state* #f)
(define *mock-char* #f)
(define *mock-number* #f)
(define *mock-iterator* #f)
(define *mock-port* #f)
(let () ; rest of file is in this let
(define (->value obj)
(if (and (let? obj)
(symbol? (obj 'mock-type)))
(obj 'value)
obj))
(define (mock? obj)
(and (let? obj)
(symbol? (obj 'mock-type))))
(define (with-mock-wrapper func)
(lambda (obj)
(cond ((mock? obj)
(let-temporarily (((*s7* 'openlets) #f))
(func (obj 'value))))
((not (openlet? obj))
(func obj))
((procedure? obj) ; TODO: and c-pointer? c-object?
(let-temporarily (((*s7* 'openlets) #f))
(func obj)))
(else
(let ((func-name (string->symbol (object->string func))))
(if (procedure? (obj func-name))
((obj func-name) obj)
(func obj)))))))
(define (with-mock-wrapper* func)
(lambda args
(let ((unknown-openlets #f)
(new-args ()))
(for-each (lambda (arg) ; not map here because (values) should not be ignored: (+ (mock-number 4/3) (values))
(set! new-args
(cons (if (mock? arg)
(arg 'value)
(begin
(if (and (openlet? arg)
(not (procedure? arg))
(not (macro? arg))
(not (c-pointer? arg)))
(set! unknown-openlets #t))
arg))
new-args)))
args)
(if unknown-openlets
(apply func (reverse! new-args))
(let-temporarily (((*s7* 'openlets) #f))
(apply func (reverse! new-args)))))))
;; one tricky thing here is that a mock object can be the let of with-let: (with-let (mock-port ...) ...)
;; so a mock object's method can be called even when no argument is a mock object. Even trickier
;; (display (openlet (with-let (mock-c-pointer 0) (lambda () 1))))
;; --------------------------------------------------------------------------------
(set! *mock-vector*
(let* ((mock-vector? #f)
(mock-vector-class
(inlet 'local-set! (lambda (obj i val) ; reactive-vector uses this as a hook into vector-set!
(if (mock-vector? i)
(error 'wrong-type-arg "stray mock-vector? ~S" i))
(#_vector-set! (->value obj) i val))
'vector-set! (lambda (obj i val) ((obj 'local-set!) obj i val) val)
'let-set-fallback (lambda (obj i val)
(if (and (integer? i)
(defined? 'value obj))
(begin
((obj 'local-set!) obj i val)
val)
(error 'out-of-range "unknown field: ~S" i)))
'let-ref-fallback (lambda (obj i)
(if (and (integer? i)
(defined? 'value obj))
(#_vector-ref (obj 'value) i) ; the implicit case
(error 'out-of-range "unknown field: ~S" i)))
'equivalent? (with-mock-wrapper* #_equivalent?)
'vector-ref (with-mock-wrapper* #_vector-ref)
'vector-length (if (provided? 'pure-s7)
(lambda (vect)
(if (vector? vect)
(length vect)
(error 'wrong-type-arg "vector-length argument should be a vector: ~A" vect)))
(with-mock-wrapper #_vector-length))
'reverse (with-mock-wrapper #_reverse)
'sort! (with-mock-wrapper* #_sort!)
'make-iterator (with-mock-wrapper #_make-iterator)
'arity (with-mock-wrapper #_arity)
'object->string (with-mock-wrapper* #_object->string)
'format (with-mock-wrapper* #_format)
'write (with-mock-wrapper* #_write)
'display (with-mock-wrapper* #_display)
'vector-dimension (with-mock-wrapper #_vector-dimension)
'vector-dimensions (with-mock-wrapper #_vector-dimensions)
'vector-rank (with-mock-wrapper #_vector-rank)
'fill! (with-mock-wrapper* #_fill!)
'vector-fill! (with-mock-wrapper* #_vector-fill!)
'vector->list (with-mock-wrapper* #_vector->list)
'subvector (with-mock-wrapper* #_subvector)
'copy (with-mock-wrapper* #_copy)
'vector? (with-mock-wrapper #_vector?)
'int-vector? (with-mock-wrapper #_int-vector?)
'byte-vector? (with-mock-wrapper #_byte-vector?)
'float-vector? (with-mock-wrapper #_float-vector?)
'length (with-mock-wrapper #_length)
'vector-append (with-mock-wrapper* #_vector-append)
'append (with-mock-wrapper* #_append)
'class-name '*mock-vector*)))
(define (make-mock-vector len . rest)
(openlet
(sublet mock-vector-class
'value (apply #_make-vector len rest)
'mock-type 'mock-vector?)))
(define (mock-vector . args)
(openlet
(sublet mock-vector-class
'value (apply #_vector args)
'mock-type 'mock-vector?)))
(set! mock-vector? (lambda (obj)
(and (let? obj)
(defined? 'mock-type obj #t)
(eq? (obj 'mock-type) 'mock-vector?))))
(curlet)))
#|
;; vector that grows to accommodate vector-set!
(define (stretchable-vector)
(let ((local-ref (lambda (obj index)
(if (>= index (length (obj 'value)))
(obj 'initial-element)
(#_vector-ref (obj 'value) index))))
(local-set! (lambda (obj index val)
(if (>= index (length (obj 'value)))
(set! (obj 'value) (copy (obj 'value) (make-vector (+ index 8) (obj 'initial-element)))))
(#_vector-set! (obj 'value) index val))))
(openlet
(sublet (*mock-vector* 'mock-vector-class)
'value (vector)
'mock-type 'mock-vector?
'initial-element #f
'vector-ref local-ref
'let-ref-fallback local-ref
'vector-set! local-set!
'let-set-fallback local-set!))))
;; vector with data (mimicking Clojure):
(define (meta-vector v data)
(openlet
(sublet (*mock-vector* 'mock-vector-class)
'value v
'mock-type 'mock-vector?
'meta-data data)))
(define v (meta-vector #(0 1 2) "hiho"))
(v 1): 1
(v 'meta-data): "hiho"
v: #(0 1 2)
(vector? v): #t
|#
;; --------------------------------------------------------------------------------
(set! *mock-hash-table*
(let* ((mock-hash-table? #f)
(mock-hash-table-class
(inlet 'let-ref-fallback (lambda (obj key)
(if (defined? 'value obj)
(#_hash-table-ref (obj 'value) key)))
'let-set-fallback (lambda (obj key val)
(if (defined? 'value obj)
(#_hash-table-set! (obj 'value) key val)))
;; the fallbacks are needed because hash-tables and lets use exactly the same syntax in implicit indexing:
;; (x 'y) but s7 can't tell that in this one case, we actually want the 'y to be a key not a field.
;; So, to avoid infinite recursion in let-ref (implicit index), if let-ref can't find the let field,
;; and the let has 'let-ref|set!-fallback, let-ref|set! passes the argument to that function rather than
;; return #<undefined>.
;;
;; (round (openlet (inlet 'round (lambda (obj) (#_round (obj 'value))) 'let-ref-fallback (lambda args 3)))) -> 3
'hash-table-ref (with-mock-wrapper* #_hash-table-ref)
'hash-table-set! (with-mock-wrapper* #_hash-table-set!)
'equivalent? (with-mock-wrapper* #_equivalent?)
'hash-table-entries (with-mock-wrapper #_hash-table-entries)
'make-iterator (with-mock-wrapper #_make-iterator)
'fill! (with-mock-wrapper* #_fill!)
'object->string (with-mock-wrapper* #_object->string)
'format (with-mock-wrapper* #_format)
'write (with-mock-wrapper* #_write)
'display (with-mock-wrapper* #_display)
'reverse (with-mock-wrapper #_reverse)
'arity (with-mock-wrapper #_arity)
'copy (with-mock-wrapper* #_copy)
'hash-table? (with-mock-wrapper #_hash-table?)
'length (with-mock-wrapper #_length)
'append (with-mock-wrapper* #_append)
'class-name '*mock-hash-table*)))
(define (make-mock-hash-table . rest)
(openlet
(sublet mock-hash-table-class
'value (apply #_make-hash-table rest)
'mock-type 'mock-hash-table?)))
(define (mock-hash-table . args)
(openlet
(sublet mock-hash-table-class
'value (apply #_hash-table args)
'mock-type 'mock-hash-table?)))
(set! mock-hash-table? (lambda (obj)
(and (let? obj)
(defined? 'mock-type obj #t)
(eq? (obj 'mock-type) 'mock-hash-table?))))
(curlet)))
#|
;; hash-table that returns a special identifier when key is not in the table
(define (gloomy-hash-table)
(openlet
(sublet (*mock-hash-table* 'mock-hash-table-class) ; ideally this would be a separate (not copied) gloomy-hash-table-class
'value #f
'mock-type 'mock-hash-table?
'false (gensym)
'not-a-key #f
'hash-table-ref (lambda (obj key)
(let ((val (#_hash-table-ref (obj 'value) key)))
(if (eq? val (obj 'false))
#f
(or val (obj 'not-a-key)))))
'hash-table-key? (lambda (obj key)
(#_hash-table-ref (obj 'value) key)))))
(define (hash-table-key? obj key)
((obj 'hash-table-key?) obj key))
(define* (make-gloomy-hash-table (len 511) not-a-key)
(let ((ht (gloomy-hash-table)))
(set! (ht 'value) (make-hash-table len))
(set! (ht 'not-a-key) not-a-key)
ht))
|#
;; --------------------------------------------------------------------------------
(set! *mock-string*
(let* ((mock-string? #f)
(mock-string-class
(inlet 'equivalent? (with-mock-wrapper* #_equivalent?)
'reverse (with-mock-wrapper #_reverse)
'arity (with-mock-wrapper #_arity)
'make-iterator (with-mock-wrapper* #_make-iterator)
'let-ref-fallback (lambda (obj i)
(if (and (integer? i)
(defined? 'value obj))
(#_string-ref (obj 'value) i) ; these are the implicit cases
(error 'out-of-range "unknown field: ~S" i)))
'let-set-fallback (lambda (obj i val)
(if (and (integer? i)
(defined? 'value obj))
(#_string-set! (obj 'value) i val)
(error 'out-of-range "unknown field: ~S" i)))
'string-length (if (provided? 'pure-s7)
(lambda (str)
(if (string? str)
(length str)
(error 'wrong-type-arg "string-length argument should be a string: ~A" str)))
(with-mock-wrapper #_length))
'string-append (with-mock-wrapper* #_string-append)
'string-copy (with-mock-wrapper #_copy) ; new form -> with-mock-wrapper* ?
'string=? (with-mock-wrapper* #_string=?)
'string<? (with-mock-wrapper* #_string<?)
'string>? (with-mock-wrapper* #_string>?)
'string<=? (with-mock-wrapper* #_string<=?)
'string>=? (with-mock-wrapper* #_string>=?)
'string-downcase (with-mock-wrapper #_string-downcase)
'string-upcase (with-mock-wrapper #_string-upcase)
'string->symbol (with-mock-wrapper #_string->symbol)
'symbol (with-mock-wrapper #_symbol)
'string->keyword (with-mock-wrapper #_string->keyword)
'open-input-string (with-mock-wrapper #_open-input-string)
'directory? (with-mock-wrapper #_directory?)
'file-exists? (with-mock-wrapper #_file-exists?)
'getenv (with-mock-wrapper #_getenv)
'delete-file (with-mock-wrapper #_delete-file)
'string->byte-vector (with-mock-wrapper #_string->byte-vector)
'object->string (with-mock-wrapper* #_object->string)
'format (with-mock-wrapper* #_format)
'write (with-mock-wrapper* #_write)
'display (with-mock-wrapper* #_display)
'char-position (with-mock-wrapper* #_char-position)
'string-fill! (with-mock-wrapper* #_string-fill!)
'gensym (with-mock-wrapper* #_gensym)
'call-with-input-string (with-mock-wrapper* #_call-with-input-string)
'with-input-from-string (with-mock-wrapper* #_with-input-from-string)
'system (with-mock-wrapper* #_system)
'load (with-mock-wrapper* #_load)
'eval-string (with-mock-wrapper* #_eval-string)
'string->list (with-mock-wrapper* #_string->list)
'bignum (with-mock-wrapper #_bignum)
'fill! (with-mock-wrapper* #_fill!)
'write-string (with-mock-wrapper* #_write-string)
'copy (with-mock-wrapper* #_copy)
'substring (with-mock-wrapper* #_substring)
'string->number (with-mock-wrapper* #_string->number)
'string-position (with-mock-wrapper* #_string-position)
'string-ref (with-mock-wrapper* #_string-ref)
'string-set! (with-mock-wrapper* #_string-set!)
'string-ci=? (with-mock-wrapper* #_string-ci=?)
'string-ci<? (with-mock-wrapper* #_string-ci<?)
'string-ci>? (with-mock-wrapper* #_string-ci>?)
'string-ci<=? (with-mock-wrapper* #_string-ci<=?)
'string-ci>=? (with-mock-wrapper* #_string-ci>=?)
'string? (with-mock-wrapper #_string?)
'length (with-mock-wrapper (if (provided? 'pure-s7) #_length #_string-length))
'append (with-mock-wrapper* #_append)
'class-name '*mock-string*)))
(define* (make-mock-string len (init #\null))
(openlet
(sublet mock-string-class
'value (#_make-string len init)
'mock-type 'mock-string?)))
(define (mock-string . args)
(let ((v (make-mock-string 0)))
(set! (v 'value)
(if (string? (car args))
(car args)
(apply #_string args)))
v))
(set! mock-string? (lambda (obj)
(and (let? obj)
(defined? 'mock-type obj #t)
(eq? (obj 'mock-type) 'mock-string?))))
(curlet)))
#|
;; string that is always the current time of day
(require libc.scm)
(define time-string
(let ((daytime (lambda args
(with-let (sublet *libc*)
(let ((timestr (make-string 64)))
(let ((len (strftime timestr 64 "%a %d-%b-%Y %H:%M %Z"
(localtime
(time.make (time (c-pointer 0)))))))
(substring timestr 0 len)))))))
(openlet
(sublet (*mock-string* 'mock-string-class) ; the mock-string isn't really needed here
'let-ref-fallback daytime
'object->string daytime))))
;; similarly ("JIT data"):
(define ? (openlet
(inlet 'object->string (lambda (obj . args)
(apply #_object->string (owlet) args)))))
|#
;; --------------------------------------------------------------------------------
(set! *mock-char*
(let* ((mock-char? #f)
(mock-char-class
(inlet 'equivalent? (with-mock-wrapper* #_equivalent?)
'char-upcase (with-mock-wrapper #_char-upcase)
'char-downcase (with-mock-wrapper #_char-downcase)
'char->integer (with-mock-wrapper #_char->integer)
'char-upper-case? (with-mock-wrapper #_char-upper-case?)
'char-lower-case? (with-mock-wrapper #_char-lower-case?)
'char-alphabetic? (with-mock-wrapper #_char-alphabetic?)
'char-numeric? (with-mock-wrapper #_char-numeric?)
'char-whitespace? (with-mock-wrapper #_char-whitespace?)
'char=? (with-mock-wrapper* #_char=?)
'char<? (with-mock-wrapper* #_char<?)
'char>? (with-mock-wrapper* #_char>?)
'char<=? (with-mock-wrapper* #_char<=?)
'char>=? (with-mock-wrapper* #_char>=?)
'char-ci=? (with-mock-wrapper* #_char-ci=?)
'char-ci<? (with-mock-wrapper* #_char-ci<?)
'char-ci>? (with-mock-wrapper* #_char-ci>?)
'char-ci<=? (with-mock-wrapper* #_char-ci<=?)
'char-ci>=? (with-mock-wrapper* #_char-ci>=?)
'string (with-mock-wrapper* #_string)
'string-fill! (with-mock-wrapper* #_string-fill!)
'fill! (with-mock-wrapper* #_fill!)
'object->string (with-mock-wrapper* #_object->string)
'format (with-mock-wrapper* #_format)
'write (with-mock-wrapper* #_write)
'display (with-mock-wrapper* #_display)
'arity (with-mock-wrapper #_arity)
'make-string (with-mock-wrapper* #_make-string)
'char-position (with-mock-wrapper* #_char-position)
'write-char (with-mock-wrapper* #_write-char)
'string-set! (with-mock-wrapper* #_string-set!)
'copy (with-mock-wrapper* #_copy)
'char? (with-mock-wrapper #_char?)
'class-name '*mock-char*
'length (lambda (obj) #f))))
(define (mock-char c)
(if (and (char? c)
(not (let? c)))
(immutable!
(openlet
(sublet (*mock-char* 'mock-char-class)
'value c
'mock-type 'mock-char?)))
(error 'wrong-type-arg "mock-char arg ~S is not a char" c)))
(set! mock-char? (lambda (obj)
(and (let? obj)
(defined? 'mock-type obj #t)
(eq? (obj 'mock-type) 'mock-char?))))
(curlet)))
;; eventually I'll conjure up unichars like (define lambda (byte-vector #xce #xbb)) via mock-char,
;; then combine those into unistring via mock-string
;;
;; (string-length obj)->g_utf8_strlen etc
;; (g_unichar_isalpha (g_utf8_get_char (byte-vector #xce #xbb))) -> #t
;; (g_utf8_strlen (byte-vector #xce #xbb #xce #xba) 10) -> 2
;; (g_utf8_normalize (byte-vector #xce #xbb #xce #xba) 4 G_NORMALIZE_DEFAULT)
;; but the ones that return gunichar (toupper) currently don't return a byte-vector or a string
;; maybe gunichar->byte-vector?
;; need glib.scm, or unicode.scm to load the stuff
;; --------------------------------------------------------------------------------
(set! *mock-number*
(let* ((mock-number? #f)
(mock-number-class
(inlet
'equivalent? (with-mock-wrapper* #_equivalent?)
'arity (with-mock-wrapper #_arity)
'real-part (with-mock-wrapper #_real-part)
'imag-part (with-mock-wrapper #_imag-part)
'numerator (with-mock-wrapper #_numerator)
'denominator (with-mock-wrapper #_denominator)
'even? (with-mock-wrapper #_even?)
'odd? (with-mock-wrapper #_odd?)
'zero? (with-mock-wrapper #_zero?)
'positive? (with-mock-wrapper #_positive?)
'negative? (with-mock-wrapper #_negative?)
'infinite? (with-mock-wrapper #_infinite?)
'nan? (with-mock-wrapper #_nan?)
;'append (with-mock-wrapper* #_append) ;?? (append ... 3 ...) is an error
'magnitude (with-mock-wrapper #_magnitude)
'angle (with-mock-wrapper #_angle)
'rationalize (with-mock-wrapper* #_rationalize)
'abs (with-mock-wrapper #_abs)
'exp (with-mock-wrapper #_exp)
'log (with-mock-wrapper* #_log)
'sin (with-mock-wrapper #_sin)
'cos (with-mock-wrapper #_cos)
'tan (with-mock-wrapper #_tan)
'asin (with-mock-wrapper #_asin)
'acos (with-mock-wrapper #_acos)
'atan (with-mock-wrapper* #_atan)
'sinh (with-mock-wrapper #_sinh)
'cosh (with-mock-wrapper #_cosh)
'tanh (with-mock-wrapper #_tanh)
'asinh (with-mock-wrapper #_asinh)
'acosh (with-mock-wrapper #_acosh)
'atanh (with-mock-wrapper #_atanh)
'sqrt (with-mock-wrapper #_sqrt)
'expt (with-mock-wrapper* #_expt)
'floor (with-mock-wrapper #_floor)
'ceiling (with-mock-wrapper #_ceiling)
'truncate (with-mock-wrapper #_truncate)
'round (with-mock-wrapper #_round)
'integer->char (with-mock-wrapper #_integer->char)
'inexact->exact (with-mock-wrapper #_inexact->exact)
'exact->inexact (with-mock-wrapper #_exact->inexact)
'integer-length (with-mock-wrapper #_integer-length)
'integer-decode-float (with-mock-wrapper #_integer-decode-float)
'number? (with-mock-wrapper #_number?)
'integer? (with-mock-wrapper #_integer?)
'real? (with-mock-wrapper #_real?)
'complex? (with-mock-wrapper #_complex?)
'rational? (with-mock-wrapper #_rational?)
'exact? (with-mock-wrapper #_exact?)
'inexact? (with-mock-wrapper #_inexact?)
'lognot (with-mock-wrapper #_lognot)
'logior (with-mock-wrapper* #_logior)
'logxor (with-mock-wrapper* #_logxor)
'logand (with-mock-wrapper* #_logand)
'number->string (with-mock-wrapper* #_number->string)
'lcm (with-mock-wrapper* #_lcm)
'gcd (with-mock-wrapper* #_gcd)
'+ (with-mock-wrapper* #_+)
'- (with-mock-wrapper* #_-)
'* (with-mock-wrapper* #_*)
'/ (with-mock-wrapper* #_/)
'max (with-mock-wrapper* #_max)
'min (with-mock-wrapper* #_min)
'= (with-mock-wrapper* #_=)
'< (with-mock-wrapper* #_<)
'> (with-mock-wrapper* #_>)
'<= (with-mock-wrapper* #_<=)
'>= (with-mock-wrapper* #_>=)
'make-polar (if (provided? 'pure-s7)
(lambda (mag ang) (#_complex (* mag (cos ang)) (* mag (sin ang))))
(lambda (mag ang) (#_make-polar (->value mag) (->value arg))))
'make-rectangular (with-mock-wrapper* #_complex)
'complex (with-mock-wrapper* #_complex)
'random-state (with-mock-wrapper* #_random-state)
'ash (with-mock-wrapper* #_ash)
'logbit? (with-mock-wrapper* #_logbit?)
'quotient (with-mock-wrapper* #_quotient)
'remainder (with-mock-wrapper* #_remainder)
'modulo (with-mock-wrapper* #_modulo)
'random (with-mock-wrapper* #_random)
'write-byte (with-mock-wrapper* #_write-byte)
'make-list (with-mock-wrapper* #_make-list)
'make-vector (with-mock-wrapper* #_make-vector)
'make-float-vector (with-mock-wrapper* #_make-float-vector)
'make-int-vector (with-mock-wrapper* #_make-int-vector)
'make-byte-vector (with-mock-wrapper* #_make-byte-vector)
'make-hash-table (with-mock-wrapper* #_make-hash-table)
'object->string (with-mock-wrapper* #_object->string)
'format (with-mock-wrapper* #_format)
'write (with-mock-wrapper* #_write)
'display (with-mock-wrapper* #_display)
'string-fill! (with-mock-wrapper* #_string-fill!)
'copy (with-mock-wrapper* #_copy)
'vector->list (with-mock-wrapper* #_vector->list)
'string->list (with-mock-wrapper* #_string->list)
'substring (with-mock-wrapper* #_substring)
'vector-fill! (with-mock-wrapper* #_vector-fill!)
'fill! (with-mock-wrapper* #_fill!)
'make-string (with-mock-wrapper* #_make-string)
'string-ref (with-mock-wrapper* #_string-ref)
'string-set! (with-mock-wrapper* #_string-set!)
'string->number (with-mock-wrapper* #_string->number)
'list-ref (with-mock-wrapper* #_list-ref)
'list-set! (with-mock-wrapper* #_list-set!)
'list-tail (with-mock-wrapper* #_list-tail)
'vector-ref (with-mock-wrapper* #_vector-ref)
'float-vector-ref (with-mock-wrapper* #_float-vector-ref)
'int-vector-ref (with-mock-wrapper* #_int-vector-ref)
'byte-vector-ref (with-mock-wrapper* #_byte-vector-ref)
'vector-set! (with-mock-wrapper* #_vector-set!)
'float-vector-set! (with-mock-wrapper* #_float-vector-set!)
'int-vector-set! (with-mock-wrapper* #_int-vector-set!)
'byte-vector-set! (with-mock-wrapper* #_byte-vector-set!)
'float-vector (with-mock-wrapper* #_float-vector)
'int-vector (with-mock-wrapper* #_int-vector)
'byte-vector (with-mock-wrapper* #_byte-vector)
'subvector (with-mock-wrapper* #_subvector)
'read-string (with-mock-wrapper* #_read-string)
'length (with-mock-wrapper #_length)
'number? (with-mock-wrapper #_number?)
'class-name '*mock-number*)))
(define (mock-number x)
(if (and (number? x)
(not (let? x)))
(immutable!
(openlet
(sublet (*mock-number* 'mock-number-class)
'value x
'mock-type 'mock-number?)))
(error 'wrong-type-arg "mock-number ~S is not a number" x)))
(set! mock-number? (lambda (obj)
(and (let? obj)
(defined? 'mock-type obj #t)
(eq? (obj 'mock-type) 'mock-number?))))
(curlet)))
#|
;; fuzzy number
(define fuzzy-number
(let ((fuzz (lambda (fx)
(#_* fx (#_- 1.05 (#_random .1))))))
(lambda (fx)
(openlet
(sublet
(*mock-number* 'mock-number-class)
'let-ref-fallback (lambda (obj sym) (fuzz fx))
'object->string (lambda (obj . args) (#_number->string (fuzz fx))))))))
;; interval arithmetic
;;
;; from Wikipedia:
;; x + y = [a+c, b+d]
;; x - y = [a-d, b-c]
;; x / y = [min(a/c, a/d, b/c, b/d), max(a/c, a/d, b/c, b/d)]
(define *interval*
(let* ((make-interval #f)
(low (lambda (z) (z 'low)))
(high (lambda (z) (z 'high)))
(interval-class
(openlet (sublet (*mock-number* 'mock-number-class)
'+ (lambda args
(let ((lo 0)
(hi 0))
(for-each
(lambda (z)
(if (let? z)
(begin
(set! lo (+ lo (low z)))
(set! hi (+ hi (high z))))
(begin
(set! lo (+ lo z))
(set! hi (+ hi z)))))
args)
(make-interval lo hi)))
'* (lambda args
(let ((lo 1)
(hi 1))
(for-each
(lambda (z)
(let ((zlo (if (let? z) (low z) z))
(zhi (if (let? z) (high z) z)))
(let ((ac (* lo zlo))
(ad (* lo zhi))
(bc (* hi zlo))
(bd (* hi zhi)))
(set! lo (min ac ad bc bd))
(set! hi (max ac ad bc bd)))))
args)
(make-interval lo hi)))
'- (lambda args
(let ((z (car args)))
(if (null? (cdr args)) ; negate (must be let? else how did we get here?)
(make-interval (- (high z)) (- (low z)))
(let ((lo (low z))
(hi (high z)))
(for-each
(lambda (z)
(if (let? z)
(begin
(set! lo (- lo (high z)))
(set! hi (- hi (low z))))
(begin
(set! lo (- lo z))
(set! hi (- hi z)))))
(cdr args))
(make-interval lo hi)))))
'/ (lambda args
(let ((z (car args)))
(if (null? (cdr args)) ; invert
(make-interval (/ (high z)) (/ (low z)))
(let ((lo (low z))
(hi (high z)))
(for-each
(lambda (z)
(let ((zlo (if (let? z) (low z) z))
(zhi (if (let? z) (high z) z)))
(let ((ac (/ lo zlo))
(ad (/ lo zhi))
(bc (/ hi zlo))
(bd (/ hi zhi)))
(set! lo (min ac ad bc bd))
(set! hi (max ac ad bc bd)))))
(cdr args))
(make-interval lo hi)))))
'abs (lambda (z)
(if (positive? (low z))
(make-interval (low z) (high z))
(if (negative? (high z))
(make-interval (abs (high z)) (abs (low z)))
(make-interval 0 (max (abs (low z)) (abs (high z)))))))
'object->string (lambda (obj . args)
(format #f "#<interval: ~S ~S>" (low obj) (high obj)))
))))
(set! make-interval (lambda (low high)
(if (> low high) (format *stderr* "~A ~A~%" low high))
(openlet (sublet interval-class 'low low 'high high))))
(curlet)))
(define x ((*interval* 'make-interval) 3.0 4.0))
|#
;; --------------------------------------------------------------------------------
(set! *mock-pair*
(let* ((mock-pair? #f)
(mock-pair-class
(inlet 'equivalent? (with-mock-wrapper* #_equivalent?)
'pair-line-number (with-mock-wrapper #_pair-line-number)
'list->string (with-mock-wrapper #_list->string)
'object->string (with-mock-wrapper* #_object->string)
'format (with-mock-wrapper* #_format)
'write (with-mock-wrapper* #_write)
'display (with-mock-wrapper* #_display)
'list? (with-mock-wrapper #_list?)
'car (with-mock-wrapper #_car)
'cdr (with-mock-wrapper #_cdr)
'set-car! (with-mock-wrapper* #_set-car!)
'set-cdr! (with-mock-wrapper* #_set-cdr!)
'caar (with-mock-wrapper #_caar)
'cadr (with-mock-wrapper #_cadr)
'cdar (with-mock-wrapper #_cdar)
'cddr (with-mock-wrapper #_cddr)
'caaar (with-mock-wrapper #_caaar)
'caadr (with-mock-wrapper #_caadr)
'cadar (with-mock-wrapper #_cadar)
'cdaar (with-mock-wrapper #_cdaar)
'caddr (with-mock-wrapper #_caddr)
'cdddr (with-mock-wrapper #_cdddr)
'cdadr (with-mock-wrapper #_cdadr)
'cddar (with-mock-wrapper #_cddar)
'caaaar (with-mock-wrapper #_caaaar)
'caaadr (with-mock-wrapper #_caaadr)
'caadar (with-mock-wrapper #_caadar)
'cadaar (with-mock-wrapper #_cadaar)
'caaddr (with-mock-wrapper #_caaddr)
'cadddr (with-mock-wrapper #_cadddr)
'cadadr (with-mock-wrapper #_cadadr)
'caddar (with-mock-wrapper #_caddar)
'cdaaar (with-mock-wrapper #_cdaaar)
'cdaadr (with-mock-wrapper #_cdaadr)
'cdadar (with-mock-wrapper #_cdadar)
'cddaar (with-mock-wrapper #_cddaar)
'cdaddr (with-mock-wrapper #_cdaddr)
'cddddr (with-mock-wrapper #_cddddr)
'cddadr (with-mock-wrapper #_cddadr)
'cdddar (with-mock-wrapper #_cdddar)
'assoc (with-mock-wrapper* #_assoc)
'assq (with-mock-wrapper* #_assq)
'assv (with-mock-wrapper* #_assv)
'member (with-mock-wrapper* #_member)
'memq (with-mock-wrapper* #_memq)
'memv (with-mock-wrapper* #_memv)
'let-ref-fallback (lambda (obj ind)
(if (eq? ind 'value)
#<undefined>
(if (integer? ind)
(let ((val (begin
(coverlet obj)
(#_list-ref (obj 'value) ind))))
(openlet obj)
val)
(error "let-ref mock-pair index is not an integer: ~S" ind))))
'let-set-fallback (lambda (obj ind val)
(if (eq? ind 'value)
#<undefined>
(if (integer? ind)
(let ((val (begin
(coverlet obj)
(#_list-set! (obj 'value) ind val))))
(openlet obj)
val)
(error "let-set! mock-pair index is not an integer: ~S" ind))))
'reverse! (lambda (obj)
(if (mock-pair? obj)
(set! (obj 'value) (#_reverse (obj 'value)))
(#_reverse! obj)))
'list-tail (with-mock-wrapper* #_list-tail)
'sort! (with-mock-wrapper* #_sort!)
'reverse (with-mock-wrapper #_reverse)
'arity (with-mock-wrapper #_arity)
'make-iterator (with-mock-wrapper #_make-iterator)
'eval (with-mock-wrapper #_eval)
'list->vector (with-mock-wrapper #_list->vector)
'fill! (with-mock-wrapper* #_fill!)
'copy (with-mock-wrapper* #_copy)
'subvector (with-mock-wrapper* #_subvector)
'make-vector (with-mock-wrapper* #_make-vector)
'list-ref (with-mock-wrapper* #_list-ref)
'list-set! (with-mock-wrapper* #_list-set!)
'pair? (with-mock-wrapper #_pair?)
'length (with-mock-wrapper #_length)
'append (with-mock-wrapper* #_append)
'class-name '*mock-pair*)))
(define (mock-pair . args)
(openlet
(sublet (*mock-pair* 'mock-pair-class)
'value (copy args)
'mock-type 'mock-pair?)))
(set! mock-pair? (lambda (obj)
(and (let? obj)
(defined? 'mock-type obj #t)
(eq? (obj 'mock-type) 'mock-pair?))))
(curlet)))
#|
(let ((immutable-list-class
(sublet (*mock-pair* 'mock-pair-class)
'let-set-fallback (lambda (obj i val)
(set! (obj 'value) (append (copy (obj 'value) (make-list (+ i 1))) (list-tail (obj 'value) (+ i 1))))
(list-set! (obj 'value) i val))
'list-set! (lambda (obj i val)
(set! (obj 'value) (append (copy (obj 'value) (make-list (+ i 1))) (list-tail (obj 'value) (+ i 1))))
(list-set! (obj 'value) i val))
'set-car! (lambda (obj val)
(set! (obj 'value) (cons val (cdr (obj 'value)))))
'set-cdr! (lambda (obj val)
(set! (obj 'value) (cons (car (obj 'value)) val)))
'fill! (lambda (obj val)
(set! (obj 'value) (fill! (copy (obj 'value)) val)))
'reverse! (lambda (obj)
(set! (obj 'value) (reverse (obj 'value))))
'sort! (lambda (obj func)
(set! (obj 'value) (sort! (copy (obj 'value)) func))))))
(define (immutable-list lst)
(openlet
(sublet immutable-list-class
'value lst
'mock-type 'mock-pair?)))
|#
;; since a mock-pair prints itself as if a list, you can get some strange printout results:
;; (cons 'a ((*mock-pair* 'mock-pair) 'b 'c)) -> '(a . (b c))
;; --------------------------------------------------------------------------------
(set! *mock-symbol*
(let* ((mock-symbol? #f)
(mock-symbol-class
(inlet 'equivalent? (with-mock-wrapper* #_equivalent?)
'gensym? (with-mock-wrapper #_gensym?)
;'append (with-mock-wrapper* #_append) ;? (append ... 'a ...) is an error
'fill! (with-mock-wrapper* #_fill!)
'symbol->string (with-mock-wrapper #_symbol->string)
'symbol->value (with-mock-wrapper* #_symbol->value)
'symbol->dynamic-value (with-mock-wrapper #_symbol->dynamic-value)
'setter (with-mock-wrapper #_setter)
'provided? (with-mock-wrapper #_provided?)
'provide (with-mock-wrapper #_provide)
'defined? (with-mock-wrapper #_defined?)
'symbol->keyword (with-mock-wrapper #_symbol->keyword)
'keyword? (with-mock-wrapper #_keyword?)
'keyword->symbol (with-mock-wrapper #_keyword->symbol)
'object->string (with-mock-wrapper* #_object->string)
'format (with-mock-wrapper* #_format)
'write (with-mock-wrapper* #_write)
'display (with-mock-wrapper* #_display)
'symbol? (with-mock-wrapper #_symbol?)
'class-name '*mock-symbol*
)))
(define (mock-symbol s)
(if (symbol? s)
(immutable!
(openlet
(sublet (*mock-symbol* 'mock-symbol-class)
'value s
'mock-type 'mock-symbol?)))
(error 'wrong-type-arg "mock-symbol ~S is not a symbol" s)))
(set! mock-symbol? (lambda (obj)
(and (let? obj)
(defined? 'mock-type obj #t)
(eq? (obj 'mock-type) 'mock-symbol?))))
(curlet)))
;; --------------------------------------------------------------------------------
(set! *mock-c-pointer*
(let* ((mock-c-pointer? #f)
(mock-c-pointer-class
(inlet 'c-pointer? (with-mock-wrapper #_c-pointer?)
'c-pointer-type (with-mock-wrapper #_c-pointer-type)
'c-pointer-info (with-mock-wrapper #_c-pointer-info)
'c-pointer-weak1 (with-mock-wrapper #_c-pointer-weak1)
'c-pointer-weak2 (with-mock-wrapper #_c-pointer-weak2)
'c-pointer->list (with-mock-wrapper #_c-pointer->list)
'object->string (with-mock-wrapper* #_object->string)
'format (with-mock-wrapper* #_format)
'write (with-mock-wrapper* #_write)
'display (with-mock-wrapper* #_display)
'fill! (with-mock-wrapper* #_fill!)
)))
(define* (mock-c-pointer (int 0) type info weak1 weak2)
(immutable!
(openlet
(sublet (*mock-c-pointer* 'mock-c-pointer-class)
'value (#_c-pointer (->value int) (->value type) (->value info) (->value weak1) (->value weak2))
'mock-type 'mock-c-pointer?))))
(set! mock-c-pointer?
(lambda (obj)
(and (let? obj)
(defined? 'mock-type obj #t)
(eq? (obj 'mock-type) 'mock-c-pointer?))))
(curlet)))
;; --------------------------------------------------------------------------------
(set! *mock-random-state*
(let* ((mock-random-state? #f)
(mock-random-state-class
(inlet 'random-state? (with-mock-wrapper #_random-state?)
'random-state->list (with-mock-wrapper #_random-state->list)
'random (with-mock-wrapper* #_random)
'object->string (with-mock-wrapper* #_object->string)
'format (with-mock-wrapper* #_format)
'write (with-mock-wrapper* #_write)
'display (with-mock-wrapper* #_display)
)))
(define* (mock-random-state seed (carry 1675393560))
(immutable!
(openlet
(sublet (*mock-random-state* 'mock-random-state-class)
'value (#_random-state seed carry)
'mock-type 'mock-random-state?))))
(set! mock-random-state?
(lambda (obj)
(and (let? obj)
(defined? 'mock-type obj #t)
(eq? (obj 'mock-type) 'mock-random-state?))))
(curlet)))
;; --------------------------------------------------------------------------------
(set! *mock-iterator*
(let* ((mock-iterator? #f)
(mock-iterator-class
(inlet 'iterator? (with-mock-wrapper #_iterator?)
'iterate (with-mock-wrapper #_iterate)
'iterator-at-end? (with-mock-wrapper #_iterator-at-end?)
'iterator-sequence (with-mock-wrapper #_iterator-sequence)
'object->string (with-mock-wrapper* #_object->string)
'format (with-mock-wrapper* #_format)
'write (with-mock-wrapper* #_write)
'display (with-mock-wrapper* #_display)
)))
(define (make-mock-iterator . args)
(immutable!
(openlet
(sublet (*mock-iterator* 'mock-iterator-class)
'value (apply #_make-iterator args)
'mock-type 'mock-iterator?))))
(set! mock-iterator?
(lambda (obj)
(and (let? obj)
(defined? 'mock-type obj #t)
(eq? (obj 'mock-type) 'mock-iterator?))))
(curlet)))
;; --------------------------------------------------------------------------------
(set! *mock-port*
(let* ((mock-port? #f)
(mock-port-class
(inlet 'input-port? (with-mock-wrapper #_input-port?)
'output-port? (with-mock-wrapper #_output-port?)
'port-closed? (with-mock-wrapper #_port-closed?)
'equivalent? (with-mock-wrapper* #_equivalent?)
;'append (with-mock-wrapper* #_append) ; ?? (append (open-input-string "asdf")...) is an error
'set-current-output-port (with-mock-wrapper #_set-current-output-port)
'set-current-input-port (with-mock-wrapper #_set-current-input-port)
'set-current-error-port (with-mock-wrapper #_set-current-error-port)
'close-input-port (with-mock-wrapper #_close-input-port)
'close-output-port (with-mock-wrapper #_close-output-port)
'flush-output-port (with-mock-wrapper* #_flush-output-port)
'get-output-string (with-mock-wrapper* #_get-output-string)
'newline (with-mock-wrapper* #_newline)
'read-char (with-mock-wrapper* #_read-char)
'peek-char (with-mock-wrapper* #_peek-char)
'read-byte (with-mock-wrapper* #_read-byte)
'read-line (with-mock-wrapper* #_read-line)
'read (with-mock-wrapper* #_read)
'char-ready? (with-mock-wrapper* #_char-ready?)
'port-line-number (with-mock-wrapper* #_port-line-number)
'port-filename (with-mock-wrapper* #_port-filename)
'object->string (with-mock-wrapper* #_object->string)
'display (with-mock-wrapper* #_display)
'write (with-mock-wrapper* #_write)
'format (with-mock-wrapper* #_format)
'write-char (with-mock-wrapper* #_write-char)
'write-string (with-mock-wrapper* #_write-string)
'write-byte (with-mock-wrapper* #_write-byte)
'read-string (with-mock-wrapper* #_read-string)
'class-name '*mock-port*
)))
(define (mock-port port)
(if (and (or (input-port? port)
(output-port? port))
(not (let? port)))
(openlet
(sublet (*mock-port* 'mock-port-class)
'value port
'mock-type 'mock-port?))
(error 'wrong-type-arg "mock-port ~S is not a port" port)))
(set! mock-port? (lambda (obj)
(and (let? obj)
(defined? 'mock-type obj #t)
(eq? (obj 'mock-type) 'mock-port?))))
(curlet)))
;; sublet of any of these needs to include the value field or a let-ref-fallback
#|
(require libc.scm)
(define *input-file*
(let ((file-write-date (lambda (file)
(with-let (sublet *libc* :file file)
(let ((buf (stat.make)))
(stat file buf)
(let ((date (stat.st_mtime buf)))
(free buf)
date)))))
(file-size (lambda (file)
(with-let (sublet *libc* :file file)
(let ((buf (stat.make)))
(stat file buf)
(let ((size (stat.st_size buf)))
(free buf)
size)))))
(file-owner (lambda (file)
(with-let (sublet *libc* :file file)
(let ((buf (stat.make)))
(stat file buf)
(let ((uid (stat.st_uid buf)))
(free buf)
(let ((pwd (getpwuid uid)))
(passwd.pw_name pwd))))))))
(openlet
(sublet (*mock-port* 'mock-port-class)
'value #f
'mock-type 'mock-port?
'length (lambda (obj) (file-size (obj 'file-name)))
'owner (lambda (obj) (file-owner (obj 'file-name)))
'write-date (lambda (obj) (file-write-date (obj 'file-name)))))))
(define (open-a-file file)
(let ((p (openlet
(sublet *input-file*
'file-name file))))
(set! (p 'value) (open-input-file file))
p))
(define p (open-a-file "oboe.snd"))
(length p) -> 101684
((p 'owner) p) -> "bil"
|#
#f) ; end of outer let
| false |
a292bda3844a1b117042c2bf8f6237fda34dba4a | 5355071004ad420028a218457c14cb8f7aa52fe4 | /2.5/e-2.80.scm | 4421db816bbf13e3a1872943b4c5af8bd0c7ed43 | []
| no_license | ivanjovanovic/sicp | edc8f114f9269a13298a76a544219d0188e3ad43 | 2694f5666c6a47300dadece631a9a21e6bc57496 | refs/heads/master | 2022-02-13T22:38:38.595205 | 2022-02-11T22:11:18 | 2022-02-11T22:11:18 | 2,471,121 | 376 | 90 | null | 2022-02-11T22:11:19 | 2011-09-27T22:11:25 | Scheme | UTF-8 | Scheme | false | false | 1,153 | scm | e-2.80.scm | ; Exercise 2.80.
;
; Define a generic predicate =zero? that tests if its argument
; is zero, and install it in the generic arithmetic package. This operation
; should work for ordinary numbers, rational numbers, and complex numbers.
; ------------------------------------------------------------
(load "2.5.scm")
(load "e-2.78.scm") ; to use normal scheme numbers instead of typed
; Similar to the previous taks, now we just have operation on one operand.
(define (=zero? x) (apply-generic '=zero? x))
; and to update packages
(define (update-scheme-number-package)
(put '=zero? '(scheme-number) (lambda (x) (= 0 x))))
(update-scheme-number-package)
; this needs access to internal procedures of the package which is
; different story
(define (update-rational-package)
(put '=zero? '(rational)
(lambda (x) (= 0 (car x)))))
(update-rational-package)
(define (update-complex-package)
(put '=zero? '(complex)
(lambda (c1) (and (= 0 (real-part c1)) (= 0 (imag-part c1))))))
(update-complex-package)
; and some tests
(output (=zero? 0))
(output (=zero? (make-rational 0 5)))
(output (=zero? (make-complex-from-real-imag 0 0)))
| false |
5ccd6c4b37336f5133e08a19f0d2fbd29dab2583 | 408a2b292dcb010e67632e15aa9c6d6d76b9402d | /experiment-transition.scm | 9dbc0d94ee871f4f6c80c91ff8cc03bcc5b6857c | []
| no_license | shanecelis/mc-2013 | f0e4832bca1fcbb1cd1c9c79ffcef7872488d50b | 19fc6e42ca47a779ea1565148caa1ffa5febe129 | refs/heads/master | 2021-01-10T19:01:47.043317 | 2013-12-17T20:10:26 | 2013-12-17T20:10:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 17,428 | scm | experiment-transition.scm | (define-module (experiment-transition)
#:use-module (beer-parameters)
#:use-module (oop goops)
#:use-module (experiment)
#:use-module (emacsy emacsy)
#:use-module (optimize-transition)
#:use-module (beer-initial-conditions)
#:use-module (experiment-gen-count-vs-select-attn)
#:use-module (physics)
#:use-module (stats)
#:use-module (bullet-physics-car)
#:use-module (fode-physics)
#:use-module (guile-user)
#:use-module (ice-9 match)
#:use-module (ice-9 getopt-long)
#:use-module (eval-robot)
#:use-module (fitness)
#:use-module (nsga-ii)
#:use-module (mathematica-plot plot)
#:use-module (phenotype)
#:use-module (brain)
#:use-module (float-equality)
#:use-module ((vector-math) #:select (vector->string range))
#:use-module (minimal-cognition ctrnn)
#:export (left-IC
right-IC
<experiment-transition-trial>
exp:ICs
exp:mc-genome
exp:max-gen
exp:gen-count
exp:eval-count
exp:wall-clock-time
exp:succeeded?
<experiment-transition-parent>
<experiment-fode->bullet-trial>
<experiment-fode->bullet-trial-no-sandwich>
<experiment-fode->bullet-trial-fixed-brain-genome>
exp:transition-params
run-individual
install-individual
to-experiment-fode->bullet-trial
exp:fitness-time-series
exp:stop-when-succeeded?
get-gene-count)
#:re-export (exp:physics-class))
(define-class <experiment-transition-trial> (<physics-experiment>)
(ICs #:accessor exp:ICs)
(max-gen #:accessor exp:max-gen #:init-keyword #:max-gen)
(gen-count #:accessor exp:gen-count #:init-value 0)
(eval-count #:accessor exp:eval-count #:init-value 0)
(wall-clock-time #:accessor exp:wall-clock-time)
(succeeded? #:accessor exp:succeeded? #:init-value #f)
(fitness-time-series #:accessor exp:fitness-time-series #:init-value '())
(genome-time-series #:accessor exp:genome-time-series #:init-value '())
(stop-when-succeeded? #:accessor exp:stop-when-succeeded? #:init-value #t))
(define-class <experiment-fode->bullet-trial> (<experiment-transition-trial>)
(mc-genome #:accessor exp:mc-genome #:init-keyword #:mc-genome) ;; minimal cognition genome
(transition-params #:accessor exp:transition-params #:init-keyword #:transition-params))
(define-method (read-experiment-cleanup (exp <experiment-fode->bullet-trial>))
(unless (transition-params? (exp:transition-params exp))
(set! (exp:transition-params exp)
(eval (exp:transition-params exp) (interaction-environment)))))
;; We do an experiment without sandwiches, we just seed the population with evolved CTRNNs.
(define-class <experiment-fode->bullet-trial-no-sandwich>
(<experiment-fode->bullet-trial>))
(define-class <experiment-fode->bullet-trial-fixed-brain-genome>
(<experiment-fode->bullet-trial-no-sandwich>))
(define-method (to-experiment-fode->bullet-trial
(expmt <experiment-transition-trial>))
(change-class expmt <experiment-fode->bullet-trial>)
expmt)
(define-method (update-instance-for-different-class
(old-instance <experiment-transition-trial>)
(new-instance <experiment-fode->bullet-trial>))
"Update from one class to another. Yay!"
(set! (exp:mc-genome new-instance) (caar (exp:results old-instance)))
(set! (exp:results new-instance) '())
(set! (exp:transition-params new-instance) (make-transition-params 2 2 #f)))
(define-method (to-experiment-fode->bullet-trial
(expmt <experiment-fode->bullet-trial>))
expmt)
(define-method (initialize (exp <experiment-transition-trial>) initargs)
(next-method)
(set! (exp:save-modules exp)
(append (exp:save-modules exp)
'((experiment-transition)
(physics)
(fode-physics)
(bullet-physics-skateboard)
(bullet-physics-car)
(bullet-physics)))))
(define object-x-distance-from-origin 50.)
(define (left-IC)
`((position . (#(0 0) #(,(- object-x-distance-from-origin) ,max-height)))
(velocity . (#(0 0) #(0. -8.)))))
(define (right-IC)
`((position . (#(0 0) #(,(+ object-x-distance-from-origin) ,max-height)))
(velocity . (#(0 0) #(0. -8.)))))
(define-interactive (switch-to-left-IC)
(set! choose-initial-conditions (make-apply-IC (left-IC)))
(reset-fode))
(define-interactive (switch-to-right-IC)
(set! choose-initial-conditions (make-apply-IC (right-IC)))
(reset-fode))
(define-method (generate-parameters! (exp <experiment-transition-trial>))
(set! (exp:ICs exp) (list (left-IC) (right-IC))))
#;(define-method (run-experiment! (exp <experiment-transition-trial>))
(define (my-any-individual-succeeded? generation results)
(let ((result (any-individual-succeeded? generation results)))
(if result
(set! (exp:succeeded? exp) #t))
result))
(set! (exp:succeeded? exp) #f)
(if (exp:physics-class exp)
(set! physics-class (exp:physics-class exp)))
(let ((start-time (emacsy-time)))
(match (generation-count-to-do3
(map make-apply-IC (exp:ICs exp))
(exp:max-gen exp)
'()
(compose not my-any-individual-succeeded?))
((myresults gen-count eval-count)
(set! (exp:results exp) (get-results-that-succeeded myresults))
(set! (exp:gen-count exp) gen-count)
(set! (exp:eval-count exp) eval-count)
(set! (exp:wall-clock-time exp) (- (emacsy-time) start-time)))))
(if (exp:succeeded? exp)
(run-individual exp 0)))
(define-method (run-individual (exp <experiment-transition-trial>) index)
(let ((recalc-fitness (left-right-task (car (list-ref (exp:results exp) index))
(map make-apply-IC (exp:ICs exp))))
(recorded-fitness (cdr (list-ref (exp:results exp) index))))
(format #t "Recorded fitness ~a and recalculated fitness ~a.~%"
(vector->string recorded-fitness)
(vector->string recalc-fitness))
(unless (=? recorded-fitness recalc-fitness)
(format (current-error-port) "Recorded and recalculated are not the same!~%"))
recalc-fitness))
(define-method (run-individual (exp <experiment-fode->bullet-trial>) index)
(let ((ctrnn (make <ctrnn-brain>))
(transition-genome (car (list-ref (exp:results exp) index))))
(init-from-genome! ctrnn (exp:mc-genome exp))
(set! brain-class (get-brain-class exp))
(next-method)))
(define-method (install-individual (exp <experiment-transition-trial>) index)
(set! current-genome (car (list-ref (exp:results exp) index)))
(set! initial-conditions (map make-apply-IC (exp:ICs exp))))
(define-method (install-individual (exp <experiment-fode->bullet-trial>) index)
;(set! current-genome (exp:mc-genome exp))
;(format #t "HERE!!!!!~%")
(let ((ctrnn (make <ctrnn-brain>))
(transition-genome (car (list-ref (exp:results exp) index))))
(init-brain-from-genome! ctrnn (exp:mc-genome exp))
(set! current-genome transition-genome)
(set! brain-class (get-brain-class exp)
#;(list <matrix-sandwich>
#:old-brain ctrnn
#:transition-params
(eval (exp:transition-params exp)
(interaction-environment))
#:matrix-sandwich transition-genome)))
(set! initial-conditions (map make-apply-IC (exp:ICs exp))))
(define-method (get-brain-class (exp <experiment-fode->bullet-trial>))
(let ((ctrnn (make <ctrnn-brain>)))
(init-from-genome! ctrnn (exp:mc-genome exp))
(list <matrix-sandwich>
#:old-brain ctrnn
#:transition-params
(eval (exp:transition-params exp)
(interaction-environment)))))
(define-method (get-brain-class (exp <experiment-transition-trial>))
<ctrnn-brain>)
(define-method (get-brain-class (exp <experiment-fode->bullet-trial-no-sandwich>))
<ctrnn-brain>)
#;(define-method (get-gene-count (exp <experiment-fode->bullet-trial>))
(tp:gene-count (exp:transition-params exp)))
(define-method (get-gene-count (exp <experiment-transition-trial>))
(gene-count-required (make-phenotype exp))
#;(gene-count-for-n-ctrnn node-count))
(define-method (process-arguments! (exp <experiment-fode->bullet-trial>) args)
(let* ((leftover-args (next-method))
(fode-exp (begin
(when (null? leftover-args)
(format (current-error-port)
"error: require a success experiment file for genome.~%")
(exit 3))
(read-experiment (car leftover-args))))
(fode-genome (begin
(when (null? (exp:results fode-exp))
(format (current-error-port)
"error: no successful results available in ~a.~%" (car leftover-args))
(exit 1))
(caar (exp:results fode-exp)))))
(set! (exp:mc-genome exp) fode-genome)
(format #t "mc-genome ~a~%" (array? (exp:mc-genome exp)))
(set! (exp:transition-params exp) (make-transition-params 2 2 #f))))
(define-method (process-arguments! (exp <experiment-transition-trial>) args)
(let* ((option-spec
'((generation-count (single-char #\g) (value #t))
(stop-when-succeeded? (single-char #\S) (value #t))
(physics-class (single-char #\p) (value #t))))
(options (getopt-long args option-spec #:stop-at-first-non-option #t))
(args (option-ref options '() '()))
(argc (length args))
(physics-class (eval (read-from-string
(option-ref options 'physics-class "<fode-physics>"))
(interaction-environment)))
(stop-when-succeeded?
(read-from-string
(option-ref options 'stop-when-succeeded? "#t")))
(generation-count
(string->number (option-ref options 'generation-count "100"))))
(set! (exp:physics-class exp) physics-class)
(set! (exp:stop-when-succeeded? exp) stop-when-succeeded?)
(set! (exp:max-gen exp) generation-count)
(format #t "physics-class ~a~%" (exp:physics-class exp))
(format #t "stop-when-succeeded? ~a~%" (exp:stop-when-succeeded? exp))
(format #t "max-generation ~a~%" (exp:max-gen exp))
args))
(define-method (exp:seed-population
(exp <experiment-transition-trial>))
'())
(define-method (exp:seed-population
(exp <experiment-fode->bullet-trial-no-sandwich>))
(format #t "Seeding the population with CTRNNs.")
(map (lambda (i)
(exp:mc-genome exp)) (range 1 population-count)))
(define-method (make-phenotype (exp <experiment-transition-trial>))
(let ((phenotype (make <composite-phenotype>
#:phenotypes (list (make-brain (get-brain-class exp))
(make (or (exp:physics-class exp)
physics-class)
#:object-count body-count)))))
(format #t "phenotype gene count ~a~%" (gene-count-required phenotype))
phenotype))
(define-method (get-brain-class
(exp <experiment-fode->bullet-trial-fixed-brain-genome>))
(match (next-method)
((brain-class . args)
(apply list (make-fixed-phenotype-class brain-class)
#:fixed-genome (exp:mc-genome exp) args))
(brain-class
(list (make-fixed-phenotype-class brain-class)
#:fixed-genome (exp:mc-genome exp)))))
#;(define-method (make-phenotype (exp <experiment-fode->bullet-trial-fixed-brain-genome>))
(throw 'blah)
(if (exp:physics-class exp)
(set! physics-class (exp:physics-class exp)))
;(format #t "physics class ~a~%" physics-class)
(set! brain-class (get-brain-class exp))
#;(make <composite-phenotype>
#:phenotypes (list (make-brain)
(make physics-class
#:object-count body-count)))
(make physics-class
#:object-count body-count)
)
(define-method (run-experiment! (exp <experiment-transition-trial>))
(define (my-any-individual-succeeded? generation results)
(let ((result (any-individual-succeeded? generation results)))
(if result
(set! (exp:succeeded? exp) #t))
result))
(if (exp:physics-class exp)
(set! physics-class (exp:physics-class exp)))
;(format #t "physics class ~a~%" physics-class)
(set! brain-class (get-brain-class exp))
;(format #t "brain class ~a~%" brain-class)
;(format #t "brain class ~a makes a brain that looks like ~a~%" brain-class (make-brain))
(let ((eval-count 0)
(generation-count 0)
(myresults #f)
(start-time (emacsy-time))
(fitness-collector (make-fitness-collector))
(genome-collector (make-genome-collector))
(phenotype (make-phenotype exp)))
(define-fitness
((minimize "left distance")
(minimize "right distance"))
(fitness-fn genome)
(incr! eval-count)
(left-right-task genome (map make-apply-IC (exp:ICs exp))))
#;(init-from-genome! phenotype
(make-random-genome (gene-count-required phenotype)))
(set! myresults (nsga-ii-search fitness-fn
#:gene-count (gene-count-required phenotype)
#:objective-count 2
; #:real-mutation-rate 0
; #:real-crossover-rate 0
#:population-count population-count
#:generation-count (exp:max-gen exp)
#:seed-population (exp:seed-population exp)
#:generation-tick-func
(lambda args
(incr! generation-count)
(apply fitness-collector args)
(apply genome-collector args)
(if (exp:stop-when-succeeded? exp)
(apply (compose not my-any-individual-succeeded?) args)
#t))))
(set! (exp:results exp) (get-results-that-succeeded myresults))
(set! (exp:gen-count exp) generation-count)
(set! (exp:eval-count exp) eval-count)
(set! (exp:wall-clock-time exp) (- (emacsy-time) start-time))
(set! (exp:fitness-time-series exp) (fitness-collector))
(set! (exp:genome-time-series exp) (genome-collector)))
(when (exp:succeeded? exp)
(run-individual exp 0)))
(define-method (analyze-data! (exp <experiment-transition-trial>))
#f)
(define-class <experiment-transition-parent> (<parent-experiment>))
(define-method (analyze-data! (exp <experiment-transition-parent>))
(let* ((exps (exp:child-experiments exp))
(gen-counts (map exp:gen-count exps))
(eval-counts (map exp:eval-count exps))
(wall-clock-times (map exp:wall-clock-time exps))
(succeeded (map (lambda (exp) (if (exp:succeeded? exp) 1. 0.)) exps))
(fitness-time-series (map exp:fitness-time-series exps)))
(define (show-stats lst name)
(format #t "~a~/ median ~1,2f~/ mean ~1,2f~/ ste ~1,2f~%" name (median lst) (mean lst) (ste lst)))
(show-stats gen-counts "gen-counts ")
(show-stats eval-counts "eval-counts ")
(show-stats wall-clock-times "wall-clock-times (s)")
(show-stats succeeded "success ")))
(define-method (export-data (exp <experiment-transition-parent>) port)
;; only deal with experiments that have some results.
(let* ((exps (filter (lambda (experiment)
(and experiment (pair? (exp:results experiment))))
(exp:child-experiments exp)))
;(exps (exp:child-experiments exp))
(gen-counts (map exp:gen-count exps))
(eval-counts (map exp:eval-count exps))
(wall-clock-times (map exp:wall-clock-time exps))
(succeeded (map (lambda (exp) (if (exp:succeeded? exp) 1. 0.)) exps))
(fitness-time-series (map exp:fitness-time-series exps))
(genome-time-series (map exp:genome-time-series exps))
(fitness (map (compose cdr exp:results) exps))
(genes (map (compose car exp:results) exps)))
(define (show-stats lst name)
(format port "~a -> ~a~%" name (sexp->mathematica lst)))
(format port "{~%")
(show-stats gen-counts "genCounts")
(show-stats eval-counts ", evalCounts")
(show-stats wall-clock-times ", wallClockTimes")
(show-stats succeeded ", success")
(show-stats fitness-time-series ", fitnessTimeSeries")
(show-stats genome-time-series ", genomeTimeSeries")
;(show-stats genes ", genes")
; (show-stats succeeded ", fitness")
(format port "}~%")))
(define-method (initialize (exp <experiment-transition-parent>) initargs)
(next-method)
(set! (exp:save-modules exp)
(append (exp:save-modules exp)
'((experiment-transition)
(optimize-transition)
(physics)
(fode-physics)
(bullet-physics-car)
(bullet-physics-skateboard)
(bullet-physics)))))
| false |
ecf84f9066556956faf4913cd156796b24f27a0c | b14c18fa7a4067706bd19df10f846fce5a24c169 | /Chapter2/2.16.scm | d3ace3fc758a6e9fe04d6632e68f87c972589657 | []
| no_license | silvesthu/LearningSICP | eceed6267c349ff143506b28cf27c8be07e28ee9 | b5738f7a22c9e7967a1c8f0b1b9a180210051397 | refs/heads/master | 2021-01-17T00:30:29.035210 | 2016-11-29T17:57:16 | 2016-11-29T17:57:16 | 19,287,764 | 3 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 25 | scm | 2.16.scm | #lang scheme
; see 2.14 | false |
fc0dd3a7d77dd22674a45d0f0140e598249ee420 | a8216d80b80e4cb429086f0f9ac62f91e09498d3 | /lib/chibi/reload.scm | d65187f181508fddc8a72ce8dcd256b1c4101b47 | [
"BSD-3-Clause"
]
| permissive | ashinn/chibi-scheme | 3e03ee86c0af611f081a38edb12902e4245fb102 | 67fdb283b667c8f340a5dc7259eaf44825bc90bc | refs/heads/master | 2023-08-24T11:16:42.175821 | 2023-06-20T13:19:19 | 2023-06-20T13:19:19 | 32,322,244 | 1,290 | 223 | NOASSERTION | 2023-08-29T11:54:14 | 2015-03-16T12:05:57 | Scheme | UTF-8 | Scheme | false | false | 2,537 | scm | reload.scm | ;; reload.scm -- automatic module reloading
;; Copyright (c) 2012 Alex Shinn. All rights reserved.
;; BSD-style license: http://synthcode.com/license.txt
(define last-modified-time (current-seconds))
(define reload-verbose? (make-parameter #f))
(define (warn msg . args)
(let ((err (current-error-port)))
(display msg err)
(display ":" err)
(for-each (lambda (a)
(display " " err)
(if (string? a) (display a err) (write a err)))
args)
(newline err)))
(define (reload module-name)
(if (reload-verbose?)
(warn "Reloading module" module-name))
(let ((old-module (find-module module-name)))
;; Remove old entry in modules list.
(delete-module! module-name)
(protect (exn (else (warn "Error loading module definition" module-name)
(print-exception exn)
(print-stack-trace)
(add-module! module-name old-module)))
(load-module-definition module-name)
(let ((module (find-module module-name)))
(cond
((not module) (warn "Couldn't find module" module-name))
(else
(protect (exn (else (warn "Error loading module" module-name)
(print-exception exn)
(print-stack-trace)
(delete-module! module-name)
(add-module! module-name old-module)))
(let ((env (eval-module module-name module)))
(%import (module-env module) env (env-exports env) #f)))))))))
(define (file-modified? path)
(and path (> (file-modification-time path) last-modified-time)))
(define (module-definition-modified? module-name module)
(file-modified? (find-module-file (module-name->file module-name))))
(define (module-includes-modified? module-name module)
(let ((dir (module-name-prefix module-name)))
(any
(lambda (x)
(and (pair? x) (memq (car x) '(include include-ci))
(any file-modified?
(map (lambda (f) (find-module-file (string-append dir f)))
(cdr x)))))
(module-meta-data module))))
(define (module-modified? module-name module)
(or (module-definition-modified? module-name module)
(module-includes-modified? module-name module)))
(define (reload-modified-modules)
(for-each
(lambda (x)
(if (module-modified? (car x) (cdr x))
(reload (car x))))
*modules*)
(set! last-modified-time (current-seconds)))
| false |
fdd044d5e8e68e46ecaa13455f7a07f1f9210c23 | 0b1826093fb47c0a7293573d80f03a28e859640f | /chapter-2/ex-2.49.scm | 67dc2a708206824eb296a1d97b4959decd4a3945 | [
"MIT"
]
| permissive | yysaki/sicp | 253ef8ef52a330af6c2107ca7063773e63f1a4aa | 36d2964c980c58ba13a2687e0af773a5e12d770d | refs/heads/master | 2021-01-20T11:50:20.648783 | 2017-12-10T03:43:38 | 2017-12-10T08:08:18 | 56,677,496 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 2,394 | scm | ex-2.49.scm | (load "./ex-2.48")
(define (frame-coord-map frame)
(lambda (v)
(add-vect
(origin-frame frame)
(add-vect (scale-vect (xcor-vect v)
(edge1-frame frame))
(scale-vect (ycor-vect v)
(edge2-frame frame))))))
(define (segments->painter segment-list)
(lambda (frame)
(for-each
(lambda (segment)
(draw-line
((frame-coord-map frame) (start-segment segment))
((frame-coord-map frame) (end-segment segment))))
segment-list)))
(define a
(segments->painter
(list (make-segment (make-vect 0 0) (make-vect 0 1))
(make-segment (make-vect 0 1) (make-vect 1 1))
(make-segment (make-vect 1 1) (make-vect 1 0))
(make-segment (make-vect 1 0) (make-vect 0 0)))))
(define b
(segments->painter
(list (make-segment (make-vect 0 0) (make-vect 1 1))
(make-segment (make-vect 0 1) (make-vect 1 0)))))
(define c
(segments->painter
(list (make-segment (make-vect 0 0.5) (make-vect 0.5 1))
(make-segment (make-vect 0.5 1) (make-vect 1 0.5))
(make-segment (make-vect 1 0.5) (make-vect 0.5 0))
(make-segment (make-vect 0.5 0) (make-vect 0 0.5)))))
(define wave
(segments->painter
(list (make-segment (make-vect 0.2 0.0) (make-vect 0.4 0.4))
(make-segment (make-vect 0.4 0.4) (make-vect 0.3 0.5))
(make-segment (make-vect 0.3 0.5) (make-vect 0.1 0.3))
(make-segment (make-vect 0.1 0.3) (make-vect 0.0 0.6))
(make-segment (make-vect 0.0 0.8) (make-vect 0.1 0.5))
(make-segment (make-vect 0.1 0.5) (make-vect 0.3 0.6))
(make-segment (make-vect 0.3 0.6) (make-vect 0.4 0.6))
(make-segment (make-vect 0.4 0.6) (make-vect 0.3 0.8))
(make-segment (make-vect 0.3 0.8) (make-vect 0.4 1.0))
(make-segment (make-vect 0.6 1.0) (make-vect 0.7 0.8))
(make-segment (make-vect 0.7 0.8) (make-vect 0.6 0.6))
(make-segment (make-vect 0.6 0.6) (make-vect 0.8 0.6))
(make-segment (make-vect 0.8 0.6) (make-vect 1.0 0.4))
(make-segment (make-vect 1.0 0.2) (make-vect 0.6 0.4))
(make-segment (make-vect 0.6 0.4) (make-vect 0.8 0.0))
(make-segment (make-vect 0.7 0.0) (make-vect 0.5 0.3))
(make-segment (make-vect 0.5 0.3) (make-vect 0.3 0.0)))))
| false |
c6b6da2137d3c5aa50f0efd87bede9838dea693c | b43e36967e36167adcb4cc94f2f8adfb7281dbf1 | /scheme/swl1.3/tests/error-help/test59.ss | a0aebe03bcfba6e64d7db3ed516b55761d697b14 | [
"SWL",
"TCL"
]
| permissive | ktosiu/snippets | 79c58416117fa646ae06a8fd590193c9dd89f414 | 08e0655361695ed90e1b901d75f184c52bb72f35 | refs/heads/master | 2021-01-17T08:13:34.067768 | 2016-01-29T15:42:14 | 2016-01-29T15:42:14 | 53,054,819 | 1 | 0 | null | 2016-03-03T14:06:53 | 2016-03-03T14:06:53 | null | UTF-8 | Scheme | false | false | 107 | ss | test59.ss | ; Test error "unexpected end-of-file reading list"
(lambda (x y z
(cond
[(< x 1) y]
[else z]))
| false |
af7eff9bbf86b4717c789959e10f7a4ca025ddd8 | 069111ccfe6585670fb7bc2047ff968c3d1ba86f | /win/ole.scm | 45ccc4d2e23c41202ce059ae0a265e0f1ceb73d4 | [
"MIT"
]
| permissive | SaitoAtsushi/Gauche-OLE | 431eb9c2116592f2ccf1e71dbf09ffe10b45028b | 10ad8c54faaa7c0368eb0295cd99de3e0ebc7a8e | refs/heads/master | 2020-05-19T10:26:46.881876 | 2019-05-05T03:10:12 | 2019-05-05T03:10:12 | 184,971,684 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 1,911 | scm | ole.scm | ;;;
;;; ole
;;;
(define-module win.ole
(export make-ole ole-connect ole-call-method ole?
ole-set! ole-ref ole-release! <ole> <ole-condition> <ole-collection>
ole-condition? ole-condition-number ole-const ole-methods
! ?))
(select-module win.ole)
(use gauche.collection)
(use gauche.array)
(dynamic-load "ole")
(define-condition-type <ole-condition> <message-condition> ole-condition?
(number ole-condition-number))
(define-method object-apply ((obj <ole>) (method <symbol>) . args)
(apply ole-call-method obj method args))
(define-method ref ((obj <ole>) (prop <symbol>))
(ole-ref obj prop))
(set! (setter ole-ref) (lambda(obj prop val) (ole-set! obj prop val)))
(define-method (setter ref) ((obj <ole>) (prop <symbol>) val)
(ole-set! obj prop val))
(define-method call-with-iterator ((obj <ole-collection>) proc :allow-other-keys)
(let* ((iter (make-ole-iterator obj))
(buf (ole-iterator-next iter)))
(let ((end? (lambda()(eof-object? buf)))
(next (lambda()(rlet1 r buf (set! buf (ole-iterator-next iter))))))
(proc end? next))
(ole-iterator-release iter)))
;; method chain
(define-syntax !
(syntax-rules ()
((_ x ...)
(!-helper () x ...))))
(define-syntax !-helper
(syntax-rules (! ?)
((_ (as ...))
(as ...))
((_ (as ...) ! rest ...)
(!-helper ((as ...)) rest ...))
((_ (as ...) ? rest ...)
(!-helper (ole-ref (as ...)) rest ...))
((_ (as ...) a rest ...)
(!-helper (as ... a) rest ...))
))
(define-syntax ?
(syntax-rules ()
((_ x ...)
(?-helper (ole-ref) x ...))))
(define-syntax ?-helper
(syntax-rules (? !)
((_ (as ...))
(as ...))
((_ (as ...) ? rest ...)
(?-helper (ole-ref (as ...)) rest ...))
((_ (as ...) ! rest ...)
(?-helper ((as ...)) rest ...))
((_ (as ...) a rest ...)
(?-helper (as ... a) rest ...))
))
| true |
27c405008ae707c35f572224dae286ac945248d9 | a74932f6308722180c9b89c35fda4139333703b8 | /edwin48/unix.scm | d0d98ae5a3ba4ce296d99447b74b114ce4392662 | []
| no_license | scheme/edwin48 | 16b5d865492db5e406085e8e78330dd029f1c269 | fbe3c7ca14f1418eafddebd35f78ad12e42ea851 | refs/heads/master | 2021-01-19T17:59:16.986415 | 2014-12-21T17:50:27 | 2014-12-21T17:50:27 | 1,035,285 | 39 | 10 | null | 2022-02-15T23:21:14 | 2010-10-29T16:08:55 | Scheme | UTF-8 | Scheme | false | false | 22,715 | scm | unix.scm | #| -*-Scheme-*-
$Id: unix.scm,v 1.124 2008/01/30 20:02:06 cph Exp $
Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
2006, 2007, 2008 Massachusetts Institute of Technology
This file is part of MIT/GNU Scheme.
MIT/GNU Scheme is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at
your option) any later version.
MIT/GNU Scheme is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with MIT/GNU Scheme; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
USA.
|#
;;;; Unix Customizations for Edwin
(define-variable backup-by-copying-when-symlink
"#T means use copying to create backups for a symbolic name.
This causes the actual names to refer to the latest version as edited.
'QUERY means ask whether to backup by copying and write through, or rename.
This variable is relevant only if backup-by-copying is #F."
#f
(lambda (object) (memq object '(#F #T QUERY))))
(define-variable backup-by-copying-when-linked
"#T means use copying to create backups for files with multiple names.
This causes the alternate names to refer to the latest version as edited.
This variable is relevant only if backup-by-copying is false."
#f
boolean?)
(define-variable backup-by-copying-when-mismatch
"#T means create backups by copying if this preserves owner or group.
Renaming may still be used (subject to control of other variables)
when it would not result in changing the owner or group of the file;
that is, for files which are owned by you and whose group matches
the default for a new file created there by you.
This variable is relevant only if Backup By Copying is false."
#f
boolean?)
(define-variable version-control
"Control use of version numbers for backup files.
#T means make numeric backup versions unconditionally.
#F means make them for files that have some already.
'NEVER means do not make them."
#f
(lambda (object) (memq object '(#F #T NEVER))))
(define-variable kept-old-versions
"Number of oldest versions to keep when a new numbered backup is made."
2
exact-nonnegative-integer?)
(define-variable kept-new-versions
"Number of newest versions to keep when a new numbered backup is made.
Includes the new backup. Must be > 0."
2
(lambda (n) (and (exact-integer? n) (> n 0))))
(define (os/trim-pathname-string string prefix)
(let ((index (string-match-forward prefix string)))
(if (and index
(or (fix:= index (string-length prefix))
(and (fix:> index 0)
(char=? (string-ref prefix (fix:- index 1)) #\/)))
(re-substring-match "[/$~]" string index (string-length string)))
(string-tail string index)
string)))
(define (os/pathname->display-string pathname)
;; This code is more thorough than ENOUGH-PATHNAME, in that it
;; checks to see if one of the ancestor directories of PATHNAME is
;; an alias for the homedir. ENOUGH-PATHNAME only does syntactic
;; comparison, and will not notice aliases.
(let ((homedir (user-homedir-pathname)))
(let loop ((directory (directory-pathname pathname)))
(cond ((file-test-no-errors file-eq? directory homedir)
(string-append
"~/"
(->namestring (enough-pathname pathname directory))))
((equal? (pathname-directory directory) '(ABSOLUTE))
(->namestring pathname))
(else
(loop
(directory-pathname (directory-pathname-as-file directory))))))))
(define (os/auto-save-pathname pathname buffer)
(let ((wrap
(lambda (name directory)
(merge-pathnames (string-append "#" name "#") directory))))
(if (not pathname)
(wrap (string-append "%" (buffer-name buffer))
(buffer-default-directory buffer))
(wrap (file-namestring pathname)
(directory-pathname pathname)))))
(define (os/precious-backup-pathname pathname)
(let ((directory (directory-pathname pathname)))
(let loop ((i 0))
(let ((pathname
(merge-pathnames (string-append "#tmp#" (number->string i))
directory)))
(if (allocate-temporary-file pathname)
pathname
(loop (+ i 1)))))))
(define (os/backup-buffer? truename)
(memv (string-ref (file-attributes/mode-string (file-attributes truename)) 0)
'(#\- #\l)))
(define (os/default-backup-filename)
"~/%backup%~")
(define (os/truncate-filename-for-modeline filename width)
(let ((length (string-length filename)))
(if (< 0 width length)
(let ((result
(substring
filename
(let ((index (- length width)))
(or (and (not (char=? #\/ (string-ref filename index)))
(string-index filename #\/ index length))
(1+ index)))
length)))
(string-set! result 0 #\$)
result)
filename)))
(define (os/backup-by-copying? truename buffer)
(let ((attributes (file-attributes truename)))
(or (and (ref-variable backup-by-copying-when-linked buffer)
(> (file-attributes/n-links attributes) 1))
(let ((flag (ref-variable backup-by-copying-when-symlink buffer)))
(and flag
(string? (file-attributes/type attributes))
(or (not (eq? flag 'QUERY))
(prompt-for-confirmation?
(string-append "Write through symlink to "
(->namestring
(enough-pathname
(pathname-simplify
(merge-pathnames
(file-attributes/type attributes)
(buffer-pathname buffer)))
(buffer-default-directory buffer))))))))
(and (ref-variable backup-by-copying-when-mismatch buffer)
(not (and (= (file-attributes/uid attributes)
(unix/current-uid))
(= (file-attributes/gid attributes)
(unix/current-gid))))))))
(define (os/newest-numeric-backup pathname)
(define (first-loop filenames)
(if (null? filenames)
#f
(cond ((os/numeric-backup-filename? (car filenames))
=> (lambda (root.version)
(max-loop (cdr filenames)
(car filenames)
(cdr root.version))))
(else (first-loop (cdr filenames))))))
(define (max-loop filenames filename version)
(if (null? filenames)
filename
(cond ((os/numeric-backup-filename? (car filenames))
=> (lambda (root.version)
(if (> (cdr root.version) version)
(max-loop (cdr filenames)
(car filenames)
(cdr root.version))
(max-loop (cdr filenames) filename version))))
(else (max-loop (cdr filenames) filename version)))))
(first-loop (os/directory-list-completions
(directory-namestring pathname)
(string-append (file-namestring pathname) ".~"))))
(define (os/newest-backup pathname)
(or (os/newest-numeric-backup pathname)
(find os/backup-filename?
(os/directory-list-completions
(directory-namestring pathname)
(string-append (file-namestring pathname) "~")))))
(define (os/buffer-backup-pathname truename buffer)
(call-with-values
(lambda ()
(let ((type (pathname-type truename)))
(if (member type os/encoding-pathname-types)
(values (pathname-new-type truename #f)
(string-append "~." type))
(values truename "~"))))
(lambda (truename suffix)
(if (eq? 'NEVER (ref-variable version-control buffer))
(values (unix/make-backup-pathname truename #f suffix) '())
(let ((prefix (string-append (file-namestring truename) ".~")))
(let ((backups
(let loop
((filenames
(os/directory-list-completions
(directory-namestring truename)
prefix))
(backups '()))
(if (null? filenames)
(list-sort (lambda (x y) (< (cdr x) (cdr y))) backups)
(loop (cdr filenames)
(let ((root.version
(os/numeric-backup-filename?
(car filenames))))
(if root.version
(cons (cons (car filenames)
(cdr root.version))
backups)
backups)))))))
(if (null? backups)
(values (unix/make-backup-pathname
truename
(and (ref-variable version-control buffer) 1)
suffix)
'())
(values (unix/make-backup-pathname
truename
(+ (apply max (map cdr backups)) 1)
suffix)
(let ((start (ref-variable kept-old-versions buffer))
(end
(- (length backups)
(- (ref-variable kept-new-versions buffer)
1))))
(if (< start end)
(map (let ((dir (directory-pathname truename)))
(lambda (entry)
(merge-pathnames (car entry) dir)))
(sublist backups start end))
'()))))))))))
(define (unix/make-backup-pathname pathname version suffix)
(string-append (->namestring pathname)
(if version
(string-append ".~" (number->string version) suffix)
suffix)))
(define (os/directory-list directory)
(let ((channel (directory-channel-open directory)))
(let loop ((result '()))
(let ((name (directory-channel-read channel)))
(if name
(loop (cons name result))
(begin
(directory-channel-close channel)
result))))))
(define (os/directory-list-completions directory prefix)
(let ((channel (directory-channel-open directory)))
(let loop ((result '()))
(let ((name (directory-channel-read-matching channel prefix)))
(if name
(loop (cons name result))
(begin
(directory-channel-close channel)
result))))))
(define os/encoding-pathname-types
'("Z" "gz" "bz2" "bf"))
(define unix/backup-suffixes
(cons "~"
(map (lambda (type) (string-append "~." type))
os/encoding-pathname-types)))
(define (os/backup-filename? filename)
(let ((end (string-length filename)))
(let loop ((suffixes unix/backup-suffixes))
(and (not (null? suffixes))
(or (let ((suffix (car suffixes)))
(let ((start (fix:- end (string-length suffix))))
(and (fix:> start 0)
(let loop ((suffix-index 0) (index start))
(if (fix:= index end)
start
(and (char=? (string-ref suffix suffix-index)
(string-ref filename index))
(loop (fix:+ suffix-index 1)
(fix:+ index 1))))))))
(loop (cdr suffixes)))))))
(define (os/numeric-backup-filename? filename)
(let ((suffix (os/backup-filename? filename)))
(and suffix
(fix:>= suffix 4)
(let loop ((index (fix:- suffix 2)))
(and (fix:>= index 2)
(if (char-numeric? (string-ref filename index))
(loop (fix:- index 1))
(and (char=? (string-ref filename index) #\~)
(char=? (string-ref filename (fix:- index 1)) #\.)
(cons (string-head filename (fix:- index 1))
(substring->number filename
(fix:+ index 1)
suffix)))))))))
(define (os/completion-ignore-filename? filename)
(and (not (file-test-no-errors file-directory? filename))
(any (lambda (extension)
(string-suffix? extension filename))
(ref-variable completion-ignored-extensions))))
(define (os/completion-ignored-extensions)
(append (list ".bin" ".com" ".ext"
".inf" ".bif" ".bsm" ".bci" ".bcs"
".psb" ".moc" ".fni"
".bco" ".bld" ".bad" ".glo" ".fre"
".o" ".elc" ".bin" ".lbin" ".fasl"
".dvi" ".toc" ".log" ".aux"
".lof" ".blg" ".bbl" ".glo" ".idx" ".lot")
(list-copy unix/backup-suffixes)))
(define-variable completion-ignored-extensions
"Completion ignores filenames ending in any string in this list."
(os/completion-ignored-extensions)
(lambda (extensions)
(and (list? extensions)
(every (lambda (extension)
(and (string? extension)
(not (string-null? extension))))
extensions))))
(define (os/init-file-name) "~/.edwin")
(define (os/abbrev-file-name) "~/.abbrev_defs")
(define (os/find-file-initialization-filename pathname)
(or (and (equal? "scm" (pathname-type pathname))
(let ((pathname (pathname-new-type pathname "ffi")))
(and (file-exists? pathname)
pathname)))
(let ((pathname
(merge-pathnames ".edwin-ffi" (directory-pathname pathname))))
(and (file-exists? pathname)
pathname))))
(define (os/auto-save-filename? filename)
;; This could be more sophisticated, but is what the edwin
;; code was originally doing.
(and (string? filename)
(string-index filename #\#)))
(define (os/read-file-methods)
`((,read/write-compressed-file?
. ,(lambda (pathname mark visit?)
visit?
(let ((type (pathname-type pathname)))
(cond ((equal? "gz" type)
(read-compressed-file "gzip -d" pathname mark))
((equal? "bz2" type)
(read-compressed-file "bzip2 -d" pathname mark))
((equal? "Z" type)
(read-compressed-file "uncompress" pathname mark))))))
,@(os-independent/read-file-methods)))
(define (os/write-file-methods)
`((,read/write-compressed-file?
. ,(lambda (region pathname visit?)
visit?
(let ((type (pathname-type pathname)))
(cond ((equal? "gz" type)
(write-compressed-file "gzip" region pathname))
((equal? "bz2" type)
(write-compressed-file "bzip2" region pathname))
((equal? "Z" type)
(write-compressed-file "compress" region pathname))))))
,@(os-independent/write-file-methods)))
(define (os/alternate-pathnames group pathname)
(if (ref-variable enable-compressed-files group)
(append (map (let ((filename (->namestring pathname)))
(lambda (suffix)
(string-append filename "." suffix)))
unix/compressed-file-suffixes)
(os-independent/alternate-pathnames group pathname))
'()))
;;;; Compressed Files
(define-variable enable-compressed-files
"If #T, compressed files are automatically uncompressed when read,
and recompressed when written. A compressed file is identified by one
of the filename suffixes \".gz\", \".bz2\", or \".Z\"."
#t
boolean?)
(define (read/write-compressed-file? group pathname)
(and (ref-variable enable-compressed-files group)
(member (pathname-type pathname) unix/compressed-file-suffixes)))
(define unix/compressed-file-suffixes
'("gz" "bz2" "Z"))
(define (read-compressed-file program pathname mark)
((message-wrapper #f "Uncompressing file " (->namestring pathname))
(lambda ()
(call-with-temporary-file-pathname
(lambda (temporary)
(if (not (equal? '(EXITED . 0)
(shell-command #f #f
(directory-pathname pathname)
#f
(string-append
program
" < "
(file-namestring pathname)
" > "
(->namestring temporary)))))
(error:file-operation pathname
program
"file"
"[unknown]"
read-compressed-file
(list pathname mark)))
(group-insert-file! (mark-group mark)
(mark-index mark)
temporary))))))
(define (write-compressed-file program region pathname)
((message-wrapper #f "Compressing file " (->namestring pathname))
(lambda ()
(if (not (equal?
'(EXITED . 0)
(shell-command region
#f
(directory-pathname pathname)
#f
(string-append program
" > "
(file-namestring pathname)))))
(error:file-operation pathname
program
"file"
"[unknown]"
write-compressed-file
(list region pathname))))))
;;;; Dired customization
(define-variable dired-listing-switches
"Switches passed to ls for dired. MUST contain the 'l' option.
CANNOT contain the 'F' option."
"-al"
string?)
(define-variable list-directory-brief-switches
"Switches for list-directory to pass to `ls' for brief listing,"
"-CF"
string?)
(define-variable list-directory-verbose-switches
"Switches for list-directory to pass to `ls' for verbose listing,"
"-l"
string?)
(define-variable insert-directory-program
"Absolute or relative name of the `ls' program used by `insert-directory'."
"ls"
string?)
(define (insert-directory! file switches mark type)
;; Insert directory listing for FILE, formatted according to SWITCHES.
;; The listing is inserted at MARK.
;; TYPE can have one of three values:
;; 'WILDCARD means treat FILE as shell wildcard.
;; 'DIRECTORY means FILE is a directory and a full listing is expected.
;; 'FILE means FILE itself should be listed, and not its contents.
;; SWITCHES must not contain "-d".
(let ((directory (directory-pathname (merge-pathnames file)))
(program (ref-variable insert-directory-program mark))
(switches
(if (eq? 'DIRECTORY type)
switches
(string-append-separated "-d" switches))))
(if (eq? 'WILDCARD type)
(shell-command #f mark directory #f
(string-append program
" "
switches
" "
(file-namestring file)))
(apply run-synchronous-process
#f mark directory #f
(os/find-program program #f (ref-variable exec-path))
(append
(split-unix-switch-string switches)
(list
(if (eq? 'DIRECTORY type)
;; If FILE is a symbolic link, this reads the
;; directory that it points to.
(->namestring
(pathname-new-directory file
(append (pathname-directory file)
(list "."))))
(file-namestring file))))))))
(define (split-unix-switch-string switches)
(let ((end (string-length switches)))
(let loop ((start 0))
(if (fix:< start end)
(let ((space (string-index switches #\space start end)))
(if space
(cons (substring switches start space)
(loop (fix:+ space 1)))
(list (substring switches start end))))
'()))))
(define (dired-pathname-wild? pathname)
(let ((namestring (file-namestring pathname)))
(or (string-index index namestring #\*)
(string-index index namestring #\?)
(string-index index namestring #\[))))
;;;; Subprocess/Shell Support
(define (os/shell-name pathname)
(file-namestring pathname))
(define (os/default-shell-args)
'("-i"))
(define-variable explicit-csh-args
"Args passed to inferior shell by M-x shell, if the shell is csh.
Value is a list of strings."
(if (string=? microcode-id/operating-system-variant "HP-UX")
;; -T persuades HP's csh not to think it is smarter
;; than us about what terminal modes to use.
'("-i" "-T")
'("-i")))
(define (os/default-shell-prompt-pattern)
"^[^#$>]*[#$>] *")
(define (os/comint-filename-region start point end)
(let ((chars "~/A-Za-z0-9---_.$#,"))
(let ((start (skip-chars-backward chars point start)))
(make-region start (skip-chars-forward chars start end)))))
(define (os/shell-command-separators)
";&|")
(define (os/shell-command-regexp)
(string-append "[^" (os/shell-command-separators) "\n]+"))
;;;; POP Mail
(define-variable rmail-pop-delete
"If #T, messages are deleted from the POP server after being retrieved.
Otherwise, messages remain on the server and will be re-fetched later."
#t
boolean?)
(define-variable rmail-popclient-is-debian
"If #T, the popclient running on this machine is Debian popclient.
Otherwise, it is the standard popclient. Debian popclient differs from
standard popclient in that it does not accept the -p <password>
option, instead taking -P <filename>."
#f
boolean?)
(define (os/rmail-pop-procedure)
(and (os/find-program "popclient" #f (ref-variable exec-path) #f)
(lambda (server user-name password directory)
(unix/pop-client server user-name password directory))))
(define (unix/pop-client server user-name password directory)
(let ((target (->namestring (merge-pathnames ".popmail" directory))))
(let ((buffer (temporary-buffer "*popclient*")))
(cleanup-pop-up-buffers
(lambda ()
(pop-up-buffer buffer #f)
(let ((status.reason
(unix/call-with-pop-client-password-options password
(lambda (password-options)
(let ((args
(append (list "-u" user-name)
password-options
(list "-o" target server))))
(apply run-synchronous-process
#f (cons (buffer-end buffer) #t) #f #f
"popclient"
"-3"
(if (ref-variable rmail-pop-delete)
args
(cons "-k" args))))))))
(if (and (eq? 'EXITED (car status.reason))
(memv (cdr status.reason) '(0 1)))
(kill-pop-up-buffer buffer)
(begin
(keep-pop-up-buffer buffer)
(editor-error "Error getting mail from POP server.")))))))
target))
(define (unix/call-with-pop-client-password-options password receiver)
(cond ((eq? password 'KERBEROS-V4)
(receiver (list "-K")))
((ref-variable rmail-popclient-is-debian)
(cond ((string? password)
(call-with-temporary-filename
(lambda (temporary-file)
(set-file-modes! temporary-file #o600)
(call-with-output-file temporary-file
(lambda (port)
(write-string password port)
(newline port)))
(receiver (list "-P" temporary-file)))))
((and (pair? password) (eq? 'FILE (car password)))
(receiver (list "-P" (cadr password))))
(else
(error "Illegal password:" password))))
(else
(cond ((string? password)
(receiver (list "-p" password)))
((and (pair? password) (eq? 'FILE (car password)))
(receiver
(list "-p"
(call-with-input-file (cadr password)
(lambda (port)
(read-string (char-set #\newline) port))))))
(else
(error "Illegal password:" password))))))
;;;; Miscellaneous
(define (os/scheme-can-quit?)
(subprocess-job-control-available?))
(define (os/quit dir)
dir ; ignored
(%quit))
(define (os/set-file-modes-writeable! pathname)
(set-file-modes! pathname #o777))
(define os/restore-modes-to-updated-file!
set-file-modes!)
(define (os/rmail-spool-directory)
(or (find file-directory?
'("/var/spool/mail/" "/var/mail/" "/usr/spool/mail/" "/usr/mail/"))
"/usr/spool/mail/"))
(define (os/rmail-primary-inbox-list system-mailboxes)
(cons "~/mbox" system-mailboxes))
(define (os/sendmail-program)
(or (os/find-program "sendmail" #f (ref-variable exec-path) #f)
(find file-executable?
'("/usr/sbin/sendmail" "/usr/lib/sendmail" "/usr/ucblib/sendmail"))
"fakemail"))
(define (os/newsrc-file-name server)
(let ((homedir (user-homedir-pathname)))
(let ((specific
(merge-pathnames (string-append ".newsrc-" server) homedir)))
(if (file-exists? specific)
specific
(merge-pathnames ".newsrc" homedir)))))
(define (os/info-default-directory-list)
(list "/usr/local/lib/info"
"/usr/local/info"
"/usr/share/info"
"/usr/info")) | false |
313f6fd2ae517fbe95f526c3fa1c443bebb4f257 | 6488db22a3d849f94d56797297b2469a61ad22bf | /check-errors/type-checks.scm | 7f9f66acd22727978049a8218bed747c02ce283e | []
| no_license | bazurbat/chicken-eggs | 34d8707cecbbd4975a84ed9a0d7addb6e48899da | 8e741148d6e0cd67a969513ce2a7fe23241df648 | refs/heads/master | 2020-05-18T05:06:02.090313 | 2015-11-18T16:07:12 | 2015-11-18T16:07:12 | 22,037,751 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 8,508 | scm | type-checks.scm | ;;;; type-checks.scm
;;;; Kon Lovett, Apr '09
; Chicken Generic Arithmetic!
(module type-checks
(;export
define-check-type
define-check+error-type
check-defined-value
check-bound-value
check-number
check-fixnum
check-flonum
check-integer
check-real
check-complex
check-rational
check-exact
check-inexact
check-positive-fixnum
check-natural-fixnum
check-positive-integer
check-natural-integer
check-positive-number
check-natural-number
check-procedure check-closure
check-input-port
check-output-port
check-list
check-pair
check-blob
check-vector
check-structure
check-record
check-record-type
check-symbol
check-keyword
check-string
check-char
check-boolean
check-alist
check-minimum-argument-count check-argument-count
check-closed-interval check-open-interval
check-half-closed-interval check-half-open-interval
;
check-cardinal-fixnum
check-cardinal-integer
check-cardinal-number)
(import chicken scheme type-errors)
(require-library type-errors)
(declare (bound-to-procedure ##sys#structure?))
;;
; maybe a problem with expansion environment namespace pollution
(define-for-syntax (symbolize . elts)
(string->symbol (apply conc (map strip-syntax elts))) )
;;
(cond-expand
(unsafe
(define-syntax define-check-type
(er-macro-transformer
(lambda (frm rnm cmp)
(let ((_define (rnm 'define)))
(let* ((typ (cadr frm))
(nam (string->symbol (string-append "check-" (symbol->string typ)))) )
`(,_define (,nam loc obj . _) obj) ) ) ) ) )
;; Backwards
(define (check-cardinal-fixnum . _) (begin))
(define (check-cardinal-integer . _) (begin))
(define (check-cardinal-number . _) (begin))
(define (check-positive-fixnum . _) (begin))
(define (check-natural-fixnum . _) (begin))
(define (check-positive-integer . _) (begin))
(define (check-natural-integer . _) (begin))
(define (check-positive-number . _) (begin))
(define (check-natural-number . _) (begin))
(define (check-structure . _) (begin))
(define (check-record . _) (begin))
(define (check-record-type . _) (begin))
(define (check-minimum-argument-count . _) (begin))
(define (check-argument-count . _) (begin))
(define (check-closed-interval . _) (begin))
(define (check-open-interval . _) (begin))
(define (check-half-closed-interval . _) (begin))
(define (check-half-open-interval . _) (begin)) )
(else
;; These are weak predicates. Only check for structure.
(export alist? plist?)
(define (alist? obj)
(or (null? obj)
(and (list? obj)
(let loop ((ls obj))
(or (null? ls)
(and (pair? (car ls))
(loop (cdr ls) ) ) ) ) ) ) )
(define (plist? obj)
;since anything can be a key no stronger check possible
(and (list? obj) (even? (length obj))) )
;;
; <symbol> : <pred> is '<symbol>?'
; <symbol> <symbol> : <pred> is <symbol>
; ->
; (define (check-<symbol> loc obj . args)
; (unless (<pred> obj)
; (error-<symbol> loc obj (optional args)))
; obj )
(define-syntax define-check-type
(er-macro-transformer
(lambda (frm rnm cmp)
(let ((_define (rnm 'define))
(_unless (rnm 'unless))
(_optional (rnm 'optional)) )
(let* ((typ (cadr frm))
(typstr (symbol->string typ))
(pred (if (not (null? (cddr frm))) (caddr frm)
(string->symbol (string-append typstr "?"))))
(nam (string->symbol (string-append "check-" typstr)))
(errnam (string->symbol (string-append "error-" typstr))) )
`(,_define (,nam loc obj . args)
(,_unless (,pred obj)
(,errnam loc obj (,_optional args)))
obj ) ) ) ) ) )
;; Is the object non-void?
(define (defined-value? obj) (not (eq? (void) obj)))
;; Is the object bound to value?
; is obj the value from the de-ref of an unbound variable.
; could only occur in a rather unsafe calling environnment.
(define (bound-value? obj) (##core#inline "C_unboundvaluep" obj))
;;
(define (check-positive-fixnum loc obj . args)
(unless (and (fixnum? obj) (fx< 0 obj))
(error-positive-fixnum loc obj (optional args)))
obj )
(define (check-natural-fixnum loc obj . args)
(unless (and (fixnum? obj) (fx<= 0 obj))
(error-natural-fixnum loc obj (optional args)))
obj )
;;
(define (check-positive-integer loc obj . args)
(unless (and (integer? obj) (positive? obj))
(error-positive-integer loc obj (optional args)))
obj )
(define (check-natural-integer loc obj . args)
(unless (and (integer? obj) (<= 0 obj))
(error-natural-integer loc obj (optional args)))
obj )
;;
(define (check-positive-number loc obj . args)
(unless (and (number? obj) (positive? obj))
(error-positive-number loc obj (optional args)))
obj )
(define (check-natural-number loc obj . args)
(unless (and (number? obj) (<= 0 obj))
(error-natural-number loc obj (optional args)))
obj )
;;
(define (check-structure loc obj tag . args)
(unless (##sys#structure? obj tag)
(error-structure loc obj tag (optional args)))
obj )
(define (check-record loc obj tag . args)
(unless (##sys#structure? obj tag)
(error-record loc obj tag (optional args)))
obj )
(define (check-record-type loc obj tag . args)
(unless (##sys#structure? obj tag)
(error-record-type loc obj tag (optional args)))
obj ) ) )
;;
(define-check-type defined-value)
(define-check-type bound-value)
(define-check-type fixnum)
(define-check-type flonum)
(define-check-type integer)
(define-check-type real)
(define-check-type complex)
(define-check-type rational)
(define-check-type exact)
(define-check-type inexact)
(define-check-type number)
(define-check-type symbol)
(define-check-type keyword)
(define-check-type string)
(define-check-type char)
(define-check-type boolean)
(define-check-type procedure)
(define check-closure check-procedure)
(define-check-type input-port)
(define-check-type output-port)
(define-check-type list)
(define-check-type pair)
(define-check-type blob)
(define-check-type vector)
(define-check-type plist)
(define-check-type alist)
; closed interval
(define (check-closed-interval loc num min max . args)
(unless (and (<= min num) (<= num max))
(error-closed-interval loc num min max (optional args)))
num )
; open interval
(define (check-open-interval loc num min max . args)
(unless (and (< min num) (< num max))
(error-open-interval loc num min max (optional args)))
num )
; closed+open interval
(define (check-half-open-interval loc num min max . args)
(unless (and (< min num) (<= num max))
(error-half-open-interval loc num min max (optional args)))
num )
; open+closed interval
(define (check-half-closed-interval loc num min max . args)
(unless (and (<= min num) (< num max))
(error-half-closed-interval loc num min max (optional args)))
num)
(define (check-minimum-argument-count loc argc minargc)
(unless (fx<= minargc argc)
(error-minimum-argument-count loc argc minargc))
argc )
(define (check-argument-count loc argc maxargc)
(unless (fx<= argc maxargc)
(error-argument-count loc argc maxargc))
argc )
;;
; <type-symbol> [<type-predicate> [<message-string>]]
(define-syntax define-check+error-type
(er-macro-transformer
(lambda (frm rnm cmp)
(let ((_define-check-type (rnm 'define-check-type))
(_define-error-type (rnm 'define-error-type)) )
(let* ((typ (cadr frm))
(pred (and (not (null? (cddr frm))) (caddr frm)))
(mesg (and pred (not (null? (cdddr frm))) (cadddr frm))) )
`(begin
(,_define-error-type ,typ ,@(if mesg `(,mesg) '()))
(,_define-check-type ,typ ,@(if pred `(,pred) '())) ) ) ) ) ) )
;; Backwards
(define check-cardinal-fixnum check-natural-fixnum)
(define check-cardinal-integer check-natural-integer)
(define check-cardinal-number check-natural-number)
) ;module type-checks
| true |
0acc0176837e5f25e15c8c071985b294cc7f1001 | 92a8acf308f7dfcefa2e3e83b8658b0c305cc374 | /InClass/class-14.ss | 2ab6aefefa1e06be786668a85a1cecc8f862bd28 | []
| no_license | cbudo/PLC-Assignments | 0b9ea344e45edae3a55ef4ef318504b97ee4b588 | 91ab84d081ddae5548d72b94768fe72f760e068d | refs/heads/master | 2021-01-25T05:21:57.630870 | 2015-10-13T00:48:04 | 2015-10-13T00:48:04 | 42,824,506 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 161 | ss | class-14.ss | (define (lexical-address lexp)
)
(lexical-address
'((lambda (x y)
(((lambda (z)
(lambda (w y)
(+ x z w y)))
(list w x y z))
(+ x y z)))
(y z))) | false |
35912cc7da94b386e4a53f8d642c4c2f3223d0f9 | 0ffe5235b0cdac3846e15237c2232d8b44995421 | /src/scheme/Section_2.1/2.1.scm | 5ddf18356886adf78b325b205f0acef5765a848f | []
| no_license | dawiedotcom/SICP | 4d05014ac2b075b7de5906ff9a846e42298fa425 | fa6ccac0dad8bdad0645aa01197098c296c470e0 | refs/heads/master | 2020-06-05T12:36:41.098263 | 2013-05-16T19:41:38 | 2013-05-16T19:41:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 1,137 | scm | 2.1.scm | ; SICP Exercise 2.1
; Dawie de Klerk
; 2012-08-15
(define (make-rat n d)
;;; Make a rational number, accounting for sign and
;;; reducing to lowest terms.
(let ((g (gcd n d)))
(if (< d 0)
(cons (/ (* n -1) g) (/ (* d -1) g))
(cons (/ n g) (/ d g)))))
; (sign (if (negative? (* n d)) -1 1)))
; (let ((num (* sign (abs n)))
; (den (abs d)))
; (cons (/ num g)
; (/ den g)))))
(define (numer x)
(car x))
(define (denom x)
(cdr x))
(define (add-rat x y)
(make-rat (+ (* (numer x) (denom y))
(* (numer y) (denom x)))
(* (denom x) (denom y))))
(define (sub-rat x y)
(make-rat (- (* (numer x) (denom y))
(* (numer y) (denom x)))
(* (denom x) (denom y))))
(define (mul-rat x y)
(make-rat (* (numer x) (numer y))
(* (denom x) (denom y))))
(define (div-rat x y)
(make-rat (* (numer x) (denom y))
(* (denom x) (numer y))))
(define (equal-rat? x y)
(= (* (numer x) (denom y))
(* (numer y) (denom x))))
(define (print-rat x)
(display (numer x))
(display "/")
(display (denom x)))
| false |
bfeaa3128e0d310f57eff287f72974de66cf4423 | 6f7df1f0361204fb0ca039ccbff8f26335a45cd2 | /scheme/tests/recursion-learn.scm | 309b75f55a1c824ef3443c4bf3a629d5ac80167f | []
| no_license | LFY/bpm | f63c050d8a2080793cf270b03e6cf5661bf3599e | a3bce19d6258ad42dce6ffd4746570f0644a51b9 | refs/heads/master | 2021-01-18T13:04:03.191094 | 2012-09-25T10:31:25 | 2012-09-25T10:31:25 | 2,099,550 | 2 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 973 | scm | recursion-learn.scm | (import (dearguments)
(query-learn)
(prob-logic)
(program)
(util)
(sym)
(printing)
(_srfi :1))
(define (mk-prog-body p) (list 'lambda '() p))
(define test1 (make-program
(list
(make-named-abstraction 'F1 '(node (data (A0 V0)) V1) '(V0 V1)))
(mk-prog-body '(node (data)
(F1 1 (F1 2 (F1 3 (F1 4 (node (data (A0 5)))))))
))
))
(define test1-noisy (make-program
(list
(make-named-abstraction 'F1 '(node (data (A0 V0)) V1) '(V0 V1)))
(mk-prog-body '(node (data)
(F1 0.9 (F1 1.1 (F1 2 (F1 3.3 (node (data (A0 5)))))))
))
))
(define test1-dearg (noisy-arith-recursion-dearguments test1-noisy 'nofilter))
(pretty-print test1-dearg)
| false |
5fac5997a7e2e0a03ba96284d301073e11b7e458 | cb8cccd92c0832e056be608063bbec8fff4e4265 | /chapter1/Examples/1.2.1_LinearRecursion_Factorial.scm | 4e96eef1f2da6359e2b93e6f38a6aba2ba0deb1d | []
| no_license | JoseLGF/SICP | 6814999c5fb15256401acb9a53bd8aac75054a14 | 43f7a8e6130095e732c6fc883501164a48ab2229 | refs/heads/main | 2023-07-21T03:56:35.984943 | 2021-09-08T05:19:38 | 2021-09-08T05:19:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 448 | scm | 1.2.1_LinearRecursion_Factorial.scm | #lang scheme
; Linear Recursion and Iteration
; Factorial function:
; n! = n * (n-1) * (n-2) * ... * 3 * 2 * 1
; We can use the following rule:
; n! = n * (n-1)!
(define (factorial n)
(if (= n 1)
1
(* n (factorial (- n 1)))))
(factorial 6)
; It can be rewritten by using a running product:
(define (factorial2 n)
(fact-iter n 1))
(define (fact-iter n p)
(if (= n 1)
p
(fact-iter (- n 1) (* p n))))
(factorial2 6) | false |
ab40f7bdd8165c2b811e8a01a53c8e5cd9e4e96b | db0567d04297eb710cd4ffb7af094d82b2f66662 | /scheme/ikarus.lists.ss | 2064df3fb8120c1335c17346fa4c12a1e804f951 | []
| no_license | xieyuheng/ikarus-linux | 3899e99991fd192de53c485cf429bfd208e7506a | 941b627e64f30af60a25530a943323ed5c78fe1b | refs/heads/master | 2021-01-10T01:19:05.250392 | 2016-02-13T22:21:24 | 2016-02-13T22:21:24 | 51,668,773 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 39,714 | ss | ikarus.lists.ss | (library (ikarus lists)
(export $memq list? list cons* make-list append length list-ref reverse
last-pair memq memp memv member find assq assp assv assoc
remq remv remove remp filter map for-each andmap ormap list-tail
partition for-all exists fold-left fold-right)
(import
(ikarus system $fx)
(ikarus system $pairs)
(except (ikarus) list? list cons* make-list append reverse
last-pair length list-ref memq memp memv member find
assq assp assv assoc remq remv remove remp filter
map for-each andmap ormap list-tail partition
for-all exists fold-left fold-right))
(define $memq
(lambda (x ls)
(let f ([x x] [ls ls])
(and (pair? ls)
(if (eq? x (car ls))
ls
(f x (cdr ls)))))))
(define list (lambda x x))
(define cons*
(lambda (fst . rest)
(let f ([fst fst] [rest rest])
(cond
[(null? rest) fst]
[else
(cons fst (f ($car rest) ($cdr rest)))]))))
(define list?
(letrec ([race
(lambda (h t)
(if (pair? h)
(let ([h ($cdr h)])
(if (pair? h)
(and (not (eq? h t))
(race ($cdr h) ($cdr t)))
(null? h)))
(null? h)))])
(lambda (x) (race x x))))
(module (make-list)
(define f
(lambda (n fill ls)
(cond
[($fxzero? n) ls]
[else
(f ($fxsub1 n) fill (cons fill ls))])))
(define make-list
(case-lambda
[(n)
(if (and (fixnum? n) ($fx>= n 0))
(f n (void) '())
(die 'make-list "not a valid length" n))]
[(n fill)
(if (and (fixnum? n) ($fx>= n 0))
(f n fill '())
(die 'make-list "not a valid length" n))])))
(define length
(letrec ([race
(lambda (h t ls n)
(if (pair? h)
(let ([h ($cdr h)])
(if (pair? h)
(if (not (eq? h t))
(race ($cdr h) ($cdr t) ls ($fx+ n 2))
(die 'length "circular list" ls))
(if (null? h)
($fx+ n 1)
(die 'length "not a proper list" ls))))
(if (null? h)
n
(die 'length "not a proper list" ls))))])
(lambda (ls)
(race ls ls ls 0))))
(define list-ref
(lambda (list index)
(define f
(lambda (ls i)
(cond
[($fxzero? i)
(if (pair? ls)
($car ls)
(die 'list-ref "index is out of range" index list))]
[(pair? ls)
(f ($cdr ls) ($fxsub1 i))]
[(null? ls)
(die 'list-rec "index is out of range" index list)]
[else (die 'list-ref "not a list" list)])))
(unless (and (fixnum? index) ($fx>= index 0))
(die 'list-ref "not a valid index" index))
(f list index)))
(define list-tail
(lambda (list index)
(define f
(lambda (ls i)
(cond
[($fxzero? i) ls]
[(pair? ls)
(f ($cdr ls) ($fxsub1 i))]
[(null? ls)
(die 'list-tail "index is out of range" index list)]
[else (die 'list-tail "not a list" list)])))
(unless (and (fixnum? index) ($fx>= index 0))
(die 'list-tail "not a valid index" index))
(f list index)))
(module (append)
(define reverse
(lambda (h t ls ac)
(if (pair? h)
(let ([h ($cdr h)] [a1 ($car h)])
(if (pair? h)
(if (not (eq? h t))
(let ([a2 ($car h)])
(reverse ($cdr h) ($cdr t) ls (cons a2 (cons a1 ac))))
(die 'append "circular list" ls))
(if (null? h)
(cons a1 ac)
(die 'append "not a proper list" ls))))
(if (null? h)
ac
(die 'append "not a proper list" ls)))))
(define rev!
(lambda (ls ac)
(cond
[(null? ls) ac]
[else
(let ([ls^ ($cdr ls)])
($set-cdr! ls ac)
(rev! ls^ ls))])))
(define append1
(lambda (ls ls*)
(cond
[(null? ls*) ls]
[else
(rev! (reverse ls ls ls '())
(append1 ($car ls*) ($cdr ls*)))])))
(define append
(case-lambda
[() '()]
[(ls) ls]
[(ls . ls*)
(append1 ls ls*)])))
(define reverse
(letrec ([race
(lambda (h t ls ac)
(if (pair? h)
(let ([h ($cdr h)] [ac (cons ($car h) ac)])
(if (pair? h)
(if (not (eq? h t))
(race ($cdr h) ($cdr t) ls (cons ($car h) ac))
(die 'reverse "circular list" ls))
(if (null? h)
ac
(die 'reverse "not a proper list" ls))))
(if (null? h)
ac
(die 'reverse "not a proper list" ls))))])
(lambda (x)
(race x x x '()))))
(define last-pair
(letrec ([race
(lambda (h t ls last)
(if (pair? h)
(let ([h ($cdr h)] [last h])
(if (pair? h)
(if (not (eq? h t))
(race ($cdr h) ($cdr t) ls h)
(die 'last-pair "circular list" ls))
last))
last))])
(lambda (x)
(if (pair? x)
(let ([d (cdr x)])
(race d d x x))
(die 'last-pair "not a pair" x)))))
(define memq
(letrec ([race
(lambda (h t ls x)
(if (pair? h)
(if (eq? ($car h) x)
h
(let ([h ($cdr h)])
(if (pair? h)
(if (eq? ($car h) x)
h
(if (not (eq? h t))
(race ($cdr h) ($cdr t) ls x)
(die 'memq "circular list" ls)))
(if (null? h)
'#f
(die 'memq "not a proper list" ls)))))
(if (null? h)
'#f
(die 'memq "not a proper list" ls))))])
(lambda (x ls)
(race ls ls ls x))))
(define memv
(letrec ([race
(lambda (h t ls x)
(if (pair? h)
(if (eqv? ($car h) x)
h
(let ([h ($cdr h)])
(if (pair? h)
(if (eqv? ($car h) x)
h
(if (not (eq? h t))
(race ($cdr h) ($cdr t) ls x)
(die 'memv "circular list" ls)))
(if (null? h)
'#f
(die 'memv "not a proper list" ls)))))
(if (null? h)
'#f
(die 'memv "not a proper list" ls))))])
(lambda (x ls)
(race ls ls ls x))))
(define member
(letrec ([race
(lambda (h t ls x)
(if (pair? h)
(if (equal? ($car h) x)
h
(let ([h ($cdr h)])
(if (pair? h)
(if (equal? ($car h) x)
h
(if (not (eq? h t))
(race ($cdr h) ($cdr t) ls x)
(die 'member "circular list" ls)))
(if (null? h)
'#f
(die 'member "not a proper list" ls)))))
(if (null? h)
'#f
(die 'member "not a proper list" ls))))])
(lambda (x ls)
(race ls ls ls x))))
(define memp
(letrec ([race
(lambda (h t ls p)
(if (pair? h)
(if (p ($car h))
h
(let ([h ($cdr h)])
(if (pair? h)
(if (p ($car h))
h
(if (not (eq? h t))
(race ($cdr h) ($cdr t) ls p)
(die 'memp "circular list" ls)))
(if (null? h)
'#f
(die 'memp "not a proper list" ls)))))
(if (null? h)
'#f
(die 'memp "not a proper list" ls))))])
(lambda (p ls)
(unless (procedure? p)
(die 'memp "not a procedure" p))
(race ls ls ls p))))
(define find
(letrec ([race
(lambda (h t ls p)
(if (pair? h)
(let ([a ($car h)])
(if (p a)
a
(let ([h ($cdr h)])
(if (pair? h)
(let ([a ($car h)])
(if (p a)
a
(if (not (eq? h t))
(race ($cdr h) ($cdr t) ls p)
(die 'find "circular list" ls))))
(if (null? h)
'#f
(die 'find "not a proper list" ls))))))
(if (null? h)
'#f
(die 'find "not a proper list" ls))))])
(lambda (p ls)
(unless (procedure? p)
(die 'find "not a procedure" p))
(race ls ls ls p))))
(define assq
(letrec ([race
(lambda (x h t ls)
(if (pair? h)
(let ([a ($car h)] [h ($cdr h)])
(if (pair? a)
(if (eq? ($car a) x)
a
(if (pair? h)
(if (not (eq? h t))
(let ([a ($car h)])
(if (pair? a)
(if (eq? ($car a) x)
a
(race x ($cdr h) ($cdr t) ls))
(die 'assq "malformed alist"
ls)))
(die 'assq "circular list" ls))
(if (null? h)
#f
(die 'assq "not a proper list" ls))))
(die 'assq "malformed alist" ls)))
(if (null? h)
#f
(die 'assq "not a proper list" ls))))])
(lambda (x ls)
(race x ls ls ls))))
(define assp
(letrec ([race
(lambda (p h t ls)
(if (pair? h)
(let ([a ($car h)] [h ($cdr h)])
(if (pair? a)
(if (p ($car a))
a
(if (pair? h)
(if (not (eq? h t))
(let ([a ($car h)])
(if (pair? a)
(if (p ($car a))
a
(race p ($cdr h) ($cdr t) ls))
(die 'assp "malformed alist"
ls)))
(die 'assp "circular list" ls))
(if (null? h)
#f
(die 'assp "not a proper list" ls))))
(die 'assp "malformed alist" ls)))
(if (null? h)
#f
(die 'assp "not a proper list" ls))))])
(lambda (p ls)
(unless (procedure? p)
(die 'assp "not a procedure" p))
(race p ls ls ls))))
(define assv
(letrec ([race
(lambda (x h t ls)
(if (pair? h)
(let ([a ($car h)] [h ($cdr h)])
(if (pair? a)
(if (eqv? ($car a) x)
a
(if (pair? h)
(if (not (eq? h t))
(let ([a ($car h)])
(if (pair? a)
(if (eqv? ($car a) x)
a
(race x ($cdr h) ($cdr t) ls))
(die 'assv "malformed alist"
ls)))
(die 'assv "circular list" ls))
(if (null? h)
#f
(die 'assv "not a proper list" ls))))
(die 'assv "malformed alist" ls)))
(if (null? h)
#f
(die 'assv "not a proper list" ls))))])
(lambda (x ls)
(race x ls ls ls))))
(define assoc
(letrec ([race
(lambda (x h t ls)
(if (pair? h)
(let ([a ($car h)] [h ($cdr h)])
(if (pair? a)
(if (equal? ($car a) x)
a
(if (pair? h)
(if (not (eq? h t))
(let ([a ($car h)])
(if (pair? a)
(if (equal? ($car a) x)
a
(race x ($cdr h) ($cdr t) ls))
(die 'assoc "malformed alist"
ls)))
(die 'assoc "circular list" ls))
(if (null? h)
#f
(die 'assoc "not a proper list" ls))))
(die 'assoc "malformed alist" ls)))
(if (null? h)
#f
(die 'assoc "not a proper list" ls))))])
(lambda (x ls)
(race x ls ls ls))))
(module (remq remv remove remp filter)
(define-syntax define-remover
(syntax-rules ()
[(_ name cmp check)
(define name
(letrec ([race
(lambda (h t ls x)
(if (pair? h)
(if (cmp ($car h) x)
(let ([h ($cdr h)])
(if (pair? h)
(if (not (eq? h t))
(if (cmp ($car h) x)
(race ($cdr h) ($cdr t) ls x)
(cons ($car h) (race ($cdr h) ($cdr t) ls x)))
(die 'name "circular list" ls))
(if (null? h)
'()
(die 'name "not a proper list" ls))))
(let ([a0 ($car h)] [h ($cdr h)])
(if (pair? h)
(if (not (eq? h t))
(if (cmp ($car h) x)
(cons a0 (race ($cdr h) ($cdr t) ls x))
(cons* a0 ($car h) (race ($cdr h) ($cdr t) ls x)))
(die 'name "circular list" ls))
(if (null? h)
(list a0)
(die 'name "not a proper list" ls)))))
(if (null? h)
'()
(die 'name "not a proper list" ls))))])
(lambda (x ls)
(check x ls)
(race ls ls ls x))))]))
(define-remover remq eq? (lambda (x ls) #t))
(define-remover remv eqv? (lambda (x ls) #t))
(define-remover remove equal? (lambda (x ls) #t))
(define-remover remp (lambda (elt p) (p elt))
(lambda (x ls)
(unless (procedure? x)
(die 'remp "not a procedure" x))))
(define-remover filter (lambda (elt p) (not (p elt)))
(lambda (x ls)
(unless (procedure? x)
(die 'filter "not a procedure" x)))))
(module (map)
(define who 'map)
(define len
(lambda (h t n)
(if (pair? h)
(let ([h ($cdr h)])
(if (pair? h)
(if (eq? h t)
(die who "circular list")
(len ($cdr h) ($cdr t) ($fx+ n 2)))
(if (null? h)
($fxadd1 n)
(die who "improper list"))))
(if (null? h)
n
(die who "improper list")))))
(define map1
(lambda (f a d n)
(cond
[(pair? d)
(if ($fxzero? n)
(die who "list was altered!")
(cons (f a) (map1 f ($car d) ($cdr d) ($fxsub1 n))))]
[(null? d)
(if ($fxzero? n)
(cons (f a) '())
(die who "list was altered"))]
[else (die who "list was altered")])))
(define map2
(lambda (f a1 a2 d1 d2 n)
(cond
[(pair? d1)
(cond
[(pair? d2)
(if ($fxzero? n)
(die who "list was altered")
(cons (f a1 a2)
(map2 f
($car d1) ($car d2)
($cdr d1) ($cdr d2)
($fxsub1 n))))]
[(null? d2) (die who "length mismatch")]
[else (die who "not a proper list")])]
[(null? d1)
(cond
[(null? d2)
(if ($fxzero? n)
(cons (f a1 a2) '())
(die who "list was altered"))]
[else
(die who
(if (list? d2) "length mismatch" "not a proper list"))])]
[else (die who "list was altered")])))
(define cars
(lambda (ls*)
(cond
[(null? ls*) '()]
[else
(let ([a (car ls*)])
(cond
[(pair? a)
(cons (car a) (cars (cdr ls*)))]
[else
(die 'map "length mismatch")]))])))
(define cdrs
(lambda (ls*)
(cond
[(null? ls*) '()]
[else
(let ([a (car ls*)])
(cond
[(pair? a)
(cons (cdr a) (cdrs (cdr ls*)))]
[else
(die 'map "length mismatch")]))])))
(define (err-mutated all-lists)
(apply die 'map "some lists were mutated during operation" all-lists))
(define (err-mismatch all-lists)
(apply die 'map "length mismatch" all-lists))
(define (err-invalid all-lists)
(apply die 'map "invalid arguments" all-lists))
(define mapm
(lambda (f ls ls* n all-lists)
(cond
[(null? ls)
(if (andmap null? ls*)
(if (fxzero? n)
'()
(err-mutated all-lists))
(err-mismatch all-lists))]
[(fxzero? n) (err-mutated all-lists)]
[else
(cons
(apply f (car ls) (cars ls*))
(mapm f (cdr ls) (cdrs ls*) (fxsub1 n) all-lists))])))
(define map
(case-lambda
[(f ls)
(unless (procedure? f)
(die who "not a procedure" f))
(cond
[(pair? ls)
(let ([d ($cdr ls)])
(map1 f ($car ls) d (len d d 0)))]
[(null? ls) '()]
[else (err-invalid (list ls))])]
[(f ls ls2)
(unless (procedure? f)
(die who "not a procedure" f))
(cond
[(pair? ls)
(if (pair? ls2)
(let ([d ($cdr ls)])
(map2 f ($car ls) ($car ls2) d ($cdr ls2) (len d d 0)))
(err-invalid (list ls ls2)))]
[(and (null? ls) (null? ls2)) '()]
[else (err-invalid (list ls ls2))])]
[(f ls . ls*)
(unless (procedure? f)
(die who "not a procedure" f))
(cond
[(pair? ls)
(let ([n (len ls ls 0)])
(mapm f ls ls* n (cons ls ls*)))]
[(and (null? ls) (andmap null? ls*)) '()]
[else (err-invalid (cons ls ls*))])])))
(module (for-each)
(define who 'for-each)
(define len
(lambda (h t n)
(if (pair? h)
(let ([h ($cdr h)])
(if (pair? h)
(if (eq? h t)
(die who "circular list")
(len ($cdr h) ($cdr t) ($fx+ n 2)))
(if (null? h)
($fxadd1 n)
(die who "improper list"))))
(if (null? h)
n
(die who "improper list")))))
(define for-each1
(lambda (f a d n)
(cond
[(pair? d)
(if ($fxzero? n)
(die who "list was altered!")
(begin
(f a)
(for-each1 f ($car d) ($cdr d) ($fxsub1 n))))]
[(null? d)
(if ($fxzero? n)
(f a)
(die who "list was altered"))]
[else (die who "list was altered")])))
(define for-each2
(lambda (f a1 a2 d1 d2 n)
(cond
[(pair? d1)
(cond
[(pair? d2)
(if ($fxzero? n)
(die who "list was altered")
(begin
(f a1 a2)
(for-each2 f
($car d1) ($car d2)
($cdr d1) ($cdr d2)
($fxsub1 n))))]
[else (die who "length mismatch")])]
[(null? d1)
(cond
[(null? d2)
(if ($fxzero? n)
(f a1 a2)
(die who "list was altered"))]
[else (die who "length mismatch")])]
[else (die who "list was altered")])))
(define for-each
(case-lambda
[(f ls)
(unless (procedure? f)
(die who "not a procedure" f))
(cond
[(pair? ls)
(let ([d ($cdr ls)])
(for-each1 f ($car ls) d (len d d 0)))]
[(null? ls) (void)]
[else (die who "improper list")])]
[(f ls ls2)
(unless (procedure? f)
(die who "not a procedure" f))
(cond
[(pair? ls)
(if (pair? ls2)
(let ([d ($cdr ls)])
(for-each2 f
($car ls) ($car ls2) d ($cdr ls2) (len d d 0)))
(die who "length mismatch"))]
[(null? ls)
(if (null? ls2)
(void)
(die who "length mismatch"))]
[else (die who "not a list")])]
[(f ls . ls*)
(unless (procedure? f)
(die 'for-each "not a procedure" f))
(unless (list? ls)
(die 'for-each "not a list" ls))
(let ([n (length ls)])
(for-each
(lambda (x)
(unless (and (list? x) (= (length x) n))
(die 'for-each "not a list" x)))
ls*)
(let loop ([n (length ls)] [ls ls] [ls* ls*])
(cond
[($fx= n 0)
(unless (and (null? ls) (andmap null? ls*))
(die 'for-each "list modified" f))]
[else
(unless (and (pair? ls) (andmap pair? ls*))
(die 'for-each "list modified" f))
(apply f (car ls) (map car ls*))
(loop (fx- n 1) (cdr ls) (map cdr ls*))])))])))
(module (andmap)
(define who 'andmap)
(define len
(lambda (h t n)
(if (pair? h)
(let ([h ($cdr h)])
(if (pair? h)
(if (eq? h t)
(die who "circular list")
(len ($cdr h) ($cdr t) ($fx+ n 2)))
(if (null? h)
($fxadd1 n)
(die who "improper list"))))
(if (null? h)
n
(die who "improper list")))))
(define andmap1
(lambda (f a d n)
(cond
[(pair? d)
(if ($fxzero? n)
(die who "list was altered!")
(and (f a)
(andmap1 f ($car d) ($cdr d) ($fxsub1 n))))]
[(null? d)
(if ($fxzero? n)
(f a)
(die who "list was altered"))]
[else (die who "list was altered")])))
(define andmap2
(lambda (f a1 a2 d1 d2 n)
(cond
[(pair? d1)
(cond
[(pair? d2)
(if ($fxzero? n)
(die who "list was altered")
(and
(f a1 a2)
(andmap2 f
($car d1) ($car d2)
($cdr d1) ($cdr d2)
($fxsub1 n))))]
[else (die who "length mismatch")])]
[(null? d1)
(cond
[(null? d2)
(if ($fxzero? n)
(f a1 a2)
(die who "list was altered"))]
[else (die who "length mismatch")])]
[else (die who "list was altered")])))
(define andmap
(case-lambda
[(f ls)
(unless (procedure? f)
(die who "not a procedure" f))
(cond
[(pair? ls)
(let ([d ($cdr ls)])
(andmap1 f ($car ls) d (len d d 0)))]
[(null? ls) #t]
[else (die who "improper list")])]
[(f ls ls2)
(unless (procedure? f)
(die who "not a procedure" f))
(cond
[(pair? ls)
(if (pair? ls2)
(let ([d ($cdr ls)])
(andmap2 f
($car ls) ($car ls2) d ($cdr ls2) (len d d 0)))
(die who "length mismatch"))]
[(null? ls)
(if (null? ls2)
#t
(die who "length mismatch"))]
[else (die who "not a list")])]
[(f ls . ls*)
(unless (procedure? f)
(die who "not a procedure" f))
(die who "vararg not yet supported")])))
(module (ormap)
(define who 'ormap)
(define len
(lambda (h t n)
(if (pair? h)
(let ([h ($cdr h)])
(if (pair? h)
(if (eq? h t)
(die who "circular list")
(len ($cdr h) ($cdr t) ($fx+ n 2)))
(if (null? h)
($fxadd1 n)
(die who "improper list"))))
(if (null? h)
n
(die who "improper list")))))
(define ormap1
(lambda (f a d n)
(cond
[(pair? d)
(if ($fxzero? n)
(die who "list was altered!")
(or (f a)
(ormap1 f ($car d) ($cdr d) ($fxsub1 n))))]
[(null? d)
(if ($fxzero? n)
(f a)
(die who "list was altered"))]
[else (die who "list was altered")])))
(define ormap
(case-lambda
[(f ls)
(unless (procedure? f)
(die who "not a procedure" f))
(cond
[(pair? ls)
(let ([d ($cdr ls)])
(ormap1 f ($car ls) d (len d d 0)))]
[(null? ls) #f]
[else (die who "improper list")])]
[_ (die who "vararg not supported yet")])))
(define partition
(letrec ([race
(lambda (h t ls p)
(if (pair? h)
(let ([a0 ($car h)] [h ($cdr h)])
(if (pair? h)
(if (eq? h t)
(die 'partition "circular list" ls)
(let ([a1 ($car h)])
(let-values ([(a* b*) (race ($cdr h) ($cdr t) ls p)])
(if (p a0)
(if (p a1)
(values (cons* a0 a1 a*) b*)
(values (cons a0 a*) (cons a1 b*)))
(if (p a1)
(values (cons a1 a*) (cons a0 b*))
(values a* (cons* a0 a1 b*)))))))
(if (null? h)
(if (p a0)
(values (list a0) '())
(values '() (list a0)))
(die 'parititon "not a proper list" ls))))
(if (null? h)
(values '() '())
(die 'parition "not a proper list" ls))))])
(lambda (p ls)
(unless (procedure? p)
(die 'partition "not a procedure" p))
(race ls ls ls p))))
(define-syntax define-iterator
(syntax-rules ()
[(_ name combine)
(module (name)
(define who 'name)
(define (null*? ls)
(or (null? ls) (and (null? (car ls)) (null*? (cdr ls)))))
(define (err* ls*)
(if (null? ls*)
(die who "length mismatch")
(if (list? (car ls*))
(err* (cdr ls*))
(die who "not a proper list" (car ls*)))))
(define (cars+cdrs ls ls*)
(cond
[(null? ls) (values '() '())]
[else
(let ([a (car ls)])
(if (pair? a)
(let-values ([(cars cdrs) (cars+cdrs (cdr ls) (cdr ls*))])
(values (cons (car a) cars) (cons (cdr a) cdrs)))
(if (list? (car ls*))
(die who "length mismatch")
(die who "not a proper list" (car ls*)))))]))
(define (loop1 f a h t ls)
(if (pair? h)
(let ([b (car h)] [h (cdr h)])
(combine (f a)
(if (pair? h)
(if (eq? h t)
(die who "circular" ls)
(let ([c (car h)] [h (cdr h)])
(combine (f b) (loop1 f c h (cdr t) ls))))
(if (null? h)
(f b)
(combine (f b) (die who "not a proper list" ls))))))
(if (null? h)
(f a)
(combine (f a) (die who "not a proper list" ls)))))
(define (loopn f a a* h h* t ls ls*)
(if (pair? h)
(let-values ([(b* h*) (cars+cdrs h* ls*)])
(let ([b (car h)] [h (cdr h)])
(combine (apply f a a*)
(if (pair? h)
(if (eq? h t)
(die who "circular" ls)
(let-values ([(c* h*) (cars+cdrs h* ls*)])
(let ([c (car h)] [h (cdr h)])
(combine (apply f b b*)
(loopn f c c* h h* (cdr t) ls ls*)))))
(if (and (null? h) (null*? h*))
(apply f b b*)
(combine (apply f b b*) (err* (cons ls ls*))))))))
(if (and (null? h) (null*? h*))
(apply f a a*)
(combine (apply f a a*) (err* (cons ls ls*))))))
(define name
(case-lambda
[(f ls)
(unless (procedure? f)
(die who "not a procedure" f))
(if (pair? ls)
(loop1 f (car ls) (cdr ls) (cdr ls) ls)
(if (null? ls)
(combine)
(die who "not a list" ls)))]
[(f ls . ls*)
(unless (procedure? f)
(die who "not a procedure" f))
(if (pair? ls)
(let-values ([(cars cdrs) (cars+cdrs ls* ls*)])
(loopn f (car ls) cars (cdr ls) cdrs (cdr ls) ls ls*))
(if (and (null? ls) (null*? ls*))
(combine)
(err* ls*)))])))]))
(define-iterator for-all and)
(define-iterator exists or)
(module (fold-left)
(define who 'fold-left)
(define (null*? ls)
(or (null? ls) (and (null? (car ls)) (null*? (cdr ls)))))
(define (err* ls*)
(if (null? ls*)
(die who "length mismatch")
(if (list? (car ls*))
(err* (cdr ls*))
(die who "not a proper list" (car ls*)))))
(define (cars+cdrs ls ls*)
(cond
[(null? ls) (values '() '())]
[else
(let ([a (car ls)])
(if (pair? a)
(let-values ([(cars cdrs) (cars+cdrs (cdr ls) (cdr ls*))])
(values (cons (car a) cars) (cons (cdr a) cdrs)))
(if (list? (car ls*))
(die who "length mismatch")
(die who "not a proper list" (car ls*)))))]))
(define (loop1 f nil h t ls)
(if (pair? h)
(let ([a (car h)] [h (cdr h)])
(if (pair? h)
(if (eq? h t)
(die who "circular" ls)
(let ([b (car h)] [h (cdr h)] [t (cdr t)])
(loop1 f (f (f nil a) b) h t ls)))
(if (null? h)
(f nil a)
(die who "not a proper list" ls))))
(if (null? h)
nil
(die who "not a proper list" ls))))
(define (loopn f nil h h* t ls ls*)
(if (pair? h)
(let-values ([(a* h*) (cars+cdrs h* ls*)])
(let ([a (car h)] [h (cdr h)])
(if (pair? h)
(if (eq? h t)
(die who "circular" ls)
(let-values ([(b* h*) (cars+cdrs h* ls*)])
(let ([b (car h)] [h (cdr h)] [t (cdr t)])
(loopn f
(apply f (apply f nil a a*) b b*)
h h* t ls ls*))))
(if (and (null? h) (null*? h*))
(apply f nil a a*)
(err* (cons ls ls*))))))
(if (and (null? h) (null*? h*))
nil
(err* (cons ls ls*)))))
(define fold-left
(case-lambda
[(f nil ls)
(unless (procedure? f)
(die who "not a procedure" f))
(loop1 f nil ls ls ls)]
[(f nil ls . ls*)
(unless (procedure? f)
(die who "not a procedure" f))
(loopn f nil ls ls* ls ls ls*)])))
(module (fold-right)
(define who 'fold-right)
(define (null*? ls)
(or (null? ls) (and (null? (car ls)) (null*? (cdr ls)))))
(define (err* ls*)
(if (null? ls*)
(die who "length mismatch")
(if (list? (car ls*))
(err* (cdr ls*))
(die who "not a proper list" (car ls*)))))
(define (cars+cdrs ls ls*)
(cond
[(null? ls) (values '() '())]
[else
(let ([a (car ls)])
(if (pair? a)
(let-values ([(cars cdrs) (cars+cdrs (cdr ls) (cdr ls*))])
(values (cons (car a) cars) (cons (cdr a) cdrs)))
(if (list? (car ls*))
(die who "length mismatch")
(die who "not a proper list" (car ls*)))))]))
(define (loop1 f nil h t ls)
(if (pair? h)
(let ([a (car h)] [h (cdr h)])
(if (pair? h)
(if (eq? h t)
(die who "circular" ls)
(let ([b (car h)] [h (cdr h)] [t (cdr t)])
(f a (f b (loop1 f nil h t ls)))))
(if (null? h)
(f a nil)
(die who "not a proper list" ls))))
(if (null? h)
nil
(die who "not a proper list" ls))))
(define (loopn f nil h h* t ls ls*)
(if (pair? h)
(let-values ([(a* h*) (cars+cdrs h* ls*)])
(let ([a (car h)] [h (cdr h)])
(if (pair? h)
(if (eq? h t)
(die who "circular" ls)
(let-values ([(b* h*) (cars+cdrs h* ls*)])
(let ([b (car h)] [h (cdr h)] [t (cdr t)])
(apply f a
(append a*
(list
(apply f
b (append b*
(list (loopn f nil h h* t ls ls*))))))))))
(if (and (null? h) (null*? h*))
(apply f a (append a* (list nil)))
(err* (cons ls ls*))))))
(if (and (null? h) (null*? h*))
nil
(err* (cons ls ls*)))))
(define fold-right
(case-lambda
[(f nil ls)
(unless (procedure? f)
(die who "not a procedure" f))
(loop1 f nil ls ls ls)]
[(f nil ls . ls*)
(unless (procedure? f)
(die who "not a procedure" f))
(loopn f nil ls ls* ls ls ls*)]
)))
)
| true |
ce2828c0f97b9fa28770f39040c2f345aa599347 | 57d99d82b79aac8be54c0557fe1854fa6c88a0f8 | /main.ss | 98497a78eb5ca1b89c65e88f63904008c4d92a8f | []
| no_license | zhoutwo/Fragile | d4c6ceb7ff28123e70cf4b234ce4b8b2579067bd | d89d60240823612fddcd08a34bceccd3e60e2f13 | refs/heads/master | 2021-01-21T12:58:27.498461 | 2016-05-07T23:34:14 | 2016-05-07T23:34:14 | 55,728,235 | 0 | 1 | null | null | null | null | UTF-8 | Scheme | false | false | 20,551 | ss | main.ss | ; Fred Zhang and Zhou zhou
;: Single-file version of the interpreter.
;; Easier to submit to server, probably harder to use in the development process
(define (implist-of pred?)
(lambda(implst)
(let helper ([ls implst])
(or (null? ls) (pred? ls)
(and (pred? (car ls)) (helper (cdr ls)))))))
(define slist-contain?
(lambda (slist x)
(if (pair? slist)
(or (slist-contain? (car slist) x)
(slist-contain? (cdr slist) x))
(eq? x slist))))
(load "chez-init.ss")
(load "syntax.ss")
(load "utilities.ss")
(load "procedure_init.ss")
(load "syntax_expansion_init.ss")
;-------------------+
; |
; DATATYPES |
; |
;-------------------+
; parsed expression
; the core expression of scheme. Syntax expansion should convert all code to core scheme.
(define-datatype cexpression cexpression?
[var-cexp (id symbol?)]
[lit-cexp
(datum (lambda (x)
(ormap (lambda (pred) (pred x))
(list number? vector? boolean? symbol? string? pair? null?))))]
[app-cexp (rator cexpression?)
(rands (list-of cexpression?))]
[lambda-cexp
(vars (implist-of symbol?))
(ref-map (implist-of boolean?))
(body (list-of cexpression?))]
[if-cexp
(test cexpression?)
(then-op cexpression?)
(else-op cexpression?)]
[set!-cexp (var symbol?)
(val cexpression?)]
[define-cexp (var symbol?)
(val cexpression?)])
; environment type definitions
(define-datatype environment environment?
(empty-env-record)
(extended-env-record
(syms (list-of (lambda(x) (or (not x)(symbol? x)))))
(vals list?)
(env environment?)))
; datatype for procedures. At first there is only one
; kind of procedure, but more kinds will be added later.
(define-datatype proc-val proc-val?
[prim-proc
(name symbol?)]
[special-proc
(name symbol?)]
[closure
(vars (implist-of symbol?))
(ref-map (implist-of boolean?))
(body (list-of cexpression?))
(env environment?)])
;-------------------+
; |
; ENVIRONMENTS |
; |
;-------------------+
; Environment definitions for CSSE 304 Scheme interpreter. Based on EoPL section 2.3
(define empty-env
(lambda ()
(empty-env-record)))
(define extend-env
(lambda (syms vals env)
(if (not (= (length syms)(length vals)))
(eopl:error 'extend-env "syms and vals has different length syms ~s vals" syms vals))
(if (null? syms)
(extended-env-record (list #f) (list #f) env)
(extended-env-record syms vals env))))
(define list-find-position
(lambda (sym los)
(list-index (lambda (xsym) (eqv? sym xsym)) los)))
(define list-index
(lambda (pred ls)
(cond
((null? ls) #f)
((pred (car ls)) 0)
(else (let ((list-index-r (list-index pred (cdr ls))))
(if (number? list-index-r)
(+ 1 list-index-r)
#f))))))
(define apply-env
(lambda (env sym succeed fail) ; succeed and fail are procedures applied if the var is or isn't found, respectively.
(cases environment env
(empty-env-record ()
(fail))
(extended-env-record (syms vals env)
(let ((pos (list-find-position sym syms)))
(if (number? pos)
(succeed (list-ref vals pos))
(apply-env env sym succeed fail)))))))
(define add-to-env!
(letrec ([helper! (lambda (ls val)
(if (null? (cdr ls))
(if (car ls) ; if the list is initially empty, which has a #f in it
(set-cdr! ls (list val))
(set-car! ls val))
(helper! (cdr ls) val)))])
(lambda (env sym val)
(cases environment env
(empty-env-record ()
(eopl:error 'add-to-env! "Cannot add to the end of an empty environment"))
(extended-env-record (syms vals env)
(helper! syms sym)
(helper! vals val))))))
(define change-env!
(lambda (env sym val)
(cases environment env
(empty-env-record () (change-env! global-env sym val)) ; At top level
(extended-env-record (syms vals encl_env)
(let ((pos (list-find-position sym syms)))
(if (number? pos)
(list-set-at-index! vals pos val) ; Value is found
(if (eq? env global-env)
(add-to-env! env sym val)
(change-env! encl_env sym val))))))))
(define define-in-env!
(lambda (env sym val)
(cases environment env
(empty-env-record () (define-in-env! global-env sym val)) ; At top level
(extended-env-record (syms vals encl_env)
(let ((pos (list-find-position sym syms)))
(if (number? pos)
; (list-set-at-index! vals pos val) ; I honestly don't know why this doesn't work, but it works in define.
(modify! (list-ref vals pos) (de-refer val)) ; Value is found
(add-to-env! env sym val) ; We don't care if it is in global; if it's not found in the current scope, it just needs to be added.
))))))
(define set-in-env!
(lambda (env sym val)
(cases environment env
(empty-env-record () (set-in-env! global-env sym val)) ; At top level
(extended-env-record (syms vals encl_env)
(let ((pos (list-find-position sym syms)))
(if (number? pos)
; (list-set-at-index! vals pos val) ; I honestly don't know why this doesn't work, but it works in define.
(modify! (list-ref vals pos) (de-refer val)) ; Value is found
(if (eq? env global-env)
(add-to-env! env sym val) ; We only add new entry in global if value not found;
(set-in-env! encl_env sym val))
))))))
;-------------------+
; |
; PARSER |
; |
;-------------------+
; This is a parser for simple Scheme expressions, such as those in EOPL, 3.1 thru 3.3.
; You will want to replace this with your parser that includes more expression types, more options for these types, and error-checking.
; Procedures to make the parser a little bit saner.
(define 1st car)
(define 2nd cadr)
(define 3rd caddr)
(define parse-exp
(lambda (datum boundVars)
(let ([curlev-parse (lambda (exp) (parse-exp exp boundVars))])
(cond
[(symbol? datum) (var-cexp datum)]
[(number? datum) (lit-cexp datum)]
[(vector? datum) (lit-cexp datum)]
[(boolean? datum) (lit-cexp datum)]
[(string? datum) (lit-cexp datum)]
[(null? datum) (lit-cexp datum)]
[(pair? datum)
(let ([rator (car datum)][rands (cdr datum)])
(if (symbol? rator)
(if (slist-contain? rator boundVars)
(app-cexp (var-cexp rator) (map curlev-parse rands)) ; occur bound
(apply-env global-syntax-env rator ; occur free
(lambda (expanRules) (apply-syntax expanRules datum
(lambda(x)(curlev-parse x))
(lambda() (apply-env core-syntax-env rator
(lambda(coreRules) (apply-core-syntax coreRules datum boundVars)) ; does proper syntax exapnsion
(lambda() (eopl:error 'syntax-expansion "Invalid sytanx ~s" datum)))))) ; try syntax exapnsion but failed
(lambda() (apply-env core-syntax-env rator
(lambda(coreRules) (apply-core-syntax coreRules datum boundVars))
(lambda() (app-cexp (var-cexp rator) (map curlev-parse rands)))))))
(app-cexp (curlev-parse rator) (map curlev-parse rands))))]
[else (eopl:error 'parse-exp "bad expression: ~s" datum)]))))
(define apply-syntax
(lambda (syntaxList exp succeed fail)
(let ([try (ormap (lambda(x) (matchRule (car x) (cdr x) (cdr exp))) syntaxList)])
(if try
(succeed try)
(fail)))))
(define apply-core-syntax
(lambda (coreSyntax exp boundVars)
(let ([sym (car exp)][body (cdr exp)]
[curlev-parse (lambda (exp) (parse-exp exp boundVars))])
(or (ormap (lambda(x) (matchpattern x body)) coreSyntax)
(eopl:error 'apply-core-syntax "Invalid core expression format ~s" exp))
(case sym
[(quote)
(lit-cexp
(car body))]
[(lambda)
(let* ([vars-list (car body)]
[ref? (lambda (obj)
(cond
[(symbol? obj) #f]
[(and (list? obj) (eqv? 'ref (car obj)) (symbol? (cadr obj))) #t]
[else (eopl:error 'apply-core-syntax "Invalid argument declaration: ~s" vars-list)]))]
[extr-var (lambda (obj)
(if (symbol? obj) obj (cadr obj)))])
(let ([ref-map (implst-map ref? vars-list)]
[boundVars (implst-map extr-var vars-list)])
(let ([innerboundVars (cons (car body) boundVars)])
(lambda-cexp
boundVars
ref-map
(map (lambda(exp) (parse-exp exp innerboundVars)) (cdr body))))))]
[(if)
(if-cexp
(curlev-parse (car body))
(curlev-parse (cadr body))
(curlev-parse (caddr body)))]
[(set!)
(set!-cexp
(car body)
(curlev-parse (cadr body)))]
[(define)
(define-cexp
(car body)
(curlev-parse (cadr body)))]
[else (eopl:error 'apply-core-syntax "not implemented core expression ~s" exp)]))))
;-----------------------+
; |
; SYNTAX EXPANSION |
; |
;-----------------------+
(define global-syntax-env
(extend-env '() '() (empty-env)))
; To be added with define-syntax
(define core-syntax-env
(extend-env
'(quote lambda if set! define)
(list
(list ; quote
(listpt (exprpt 'e) (emptpt)))
(list ; lambda
(listpt (multpt (exprpt 'v) (sympt 'l))
(multpt (exprpt 'e) (emptpt)))
(listpt (multpt (exprpt 'v) (emptpt))
(multpt (exprpt 'e) (emptpt))))
(list ; if
(listpt (exprpt 'p)
(listpt (exprpt 't)
(listpt (exprpt 'e) (emptpt)))))
(list ; set!
(listpt (sympt 'v)
(listpt (exprpt 'e) (emptpt))))
(list ; define
(listpt (sympt 'v)
(listpt (exprpt 'e) (emptpt)))))
(empty-env)))
;-------------------+
; |
; INTERPRETER |
; |
;-------------------+
; the shell entry
(define rep ; "read-eval-print" loop.
(lambda ()
(display "--> ")
(let ([answer (top-level-eval (read))])
(if (reference? answer)
(begin
(eopl:pretty-print (de-refer answer))
(rep))
(let displayLoop ([answers (map de-refer answer)])
(if (null? answers)
(rep)
(begin
(eopl:pretty-print (car answers))
(displayLoop (cdr answers)))))))))
; the separate interpreter entry
(define eval-one-exp
(lambda (x)
(let ([result (top-level-eval x)])
(if (reference? result)
(de-refer result)
(map de-refer result)))))
(define eval-many-exps
(lambda (ls)
(for-each top-level-eval ls)))
; top-level-eval evaluates a form in the global environment
(define top-level-eval
(lambda (form)
(cond
[(and (pair? form) (eq? (car form) 'define-syntax)
(eval-define-syntax (cdr form)))]
[else (eval-exp (parse-exp form '()) (empty-env))])))
; these three functions define ADT reference, the return value of eval-exp
(define refer box)
(define de-refer unbox)
(define reference? box?)
(define modify! set-box!)
; eval-exp is the main component of the interpreter
; eval-exp should return a list of result.
; this well help the implementation of multiple return value
; It also makes reference easier
(define eval-exp
(lambda (exp env)
(cases cexpression exp
[lit-cexp (datum) (refer datum)]
[var-cexp (id)
(apply-env env id ; look up its value.
(lambda (x) x) ; procedure to call if id is in the environment
(lambda ()
(apply-env global-env id
(lambda (x) x)
(lambda () (eopl:error 'apply-env ; procedure to call if id not in env
"variable not found in environment: ~s" id)))))]
[if-cexp (test then-op else-op)
(if (de-refer (eval-exp test env))
(eval-exp then-op env)
(eval-exp else-op env))]
[lambda-cexp (vars ref-map body)
(refer (closure vars ref-map body env))]
[set!-cexp (var val)
(set-in-env! env var (eval-exp val env))
(refer (void))]
[define-cexp (var val)
(define-in-env! env var (eval-exp val env))
(refer (void))]
[app-cexp (rator rands)
(let ([procref (eval-exp rator env)]
[argsref (map (lambda(x) (let ([result (eval-exp x env)])
(cond
[(reference? result) result]
[(and (pair? result) (null? (cdr result))) (car result)]
[else (eopl:error 'eval-exp "returned ~d values to single value return context" (length result))]))) rands)])
(apply-proc procref argsref))]
[else (eopl:error 'eval-exp "Bad abstract syntax: ~a" exp)])))
; evaluate the list of operands, putting results into a list
; Apply a procedure to its arguments.
; At this point, we only have primitive procedures.
; User-defined procedures will be added later.
; arguments:
; proc-r: reference of a procedure, not de-referred
; args: list of arguments, the list is not referred, but each arg is referred
(define apply-proc
(lambda (proc-r args) ; args should not have been de-referred
(let ([proc-v (de-refer proc-r)])
(cases proc-val proc-v
[prim-proc (op) (refer (apply-prim-proc op (map de-refer args)))]
[special-proc (op)
(case op
[(apply)
(if (null? (cdr args))
(eopl:error 'apply "with no argument ~s" proc-v))
(apply-proc (car args)
(let loop ([nextarg (cadr args)] [leftarg (cddr args)])
(if (null? leftarg)
(if (list? (de-refer nextarg))
(map refer (de-refer nextarg))
(eopl:error 'apply "The last argument of apply should be a proper list of arguments ~s" nextarg))
(cons nextarg (loop (car leftarg) (cdr leftarg))))))]
[(call-with-values)
(if (not (= 2 (length args)))
(eopl:error 'call-with-values "call-with-values takes two parameters: a producer and a consumer: ~s" args))
(let ([ret (apply-proc (car args) '())])
(if (reference? ret)
(apply-proc (cadr args) (list ret))
(apply-proc (cadr args) ret)))]
[(values) args])]
[closure (vars ref-map body env)
(let lambdaEval ([code body]
[env
(if (list? vars)
(if (= (length vars) (length args))
(extend-env vars (map
(lambda (ref? x) (if ref? x (refer (de-refer x)))) ; Do not de-refer if (ref x)
ref-map args) env)
(eopl:error 'apply-proc "incorrect number of argument: closure ~a ~a" proc-v args))
(extend-env (implst->list vars)
(let loop ([ref-map ref-map] [args args])
(if (pair? ref-map)
(if (pair? ref-map)
(cons
(if (car ref-map) (car args) (refer (de-refer (car args))))
(loop (cdr ref-map) (cdr args))))
(if ref-map
(list (refer args))
(list (refer (map (lambda (arg) (de-refer arg)) args))))))
; (map (lambda (ref? x) (if ref? x (refer (de-refer x)))) ref-map
; (let loop ([vars vars][args args]) ; match all parts of args to vars
; (if (pair? vars)
; (if (pair? args)
; (cons (car args) (loop (cdr vars) (cdr args)))
; (eopl:error 'apply-proc "not enough arguments: closure ~a ~a" proc-v args))
; (list (map (lambda (ref? x) (if ref? x (refer (de-refer x)))) args)))))
env))])
(if (null? (cdr code))
(eval-exp (car code) env)
(begin (eval-exp (car code) env)
(lambdaEval (cdr code) env))))]
[else (eopl:error 'apply-proc "Attempt to apply bad procedure: ~s" proc-v)]))))
(define *spec-proc-names* '(apply values call-with-values))
(define *prim-proc-names* '(+ - * / add1 sub1 zero? not = < > <= >= cons list null? assq eq?
eqv? equal? atom? car caar caaar caadr cadar cdaar caddr cdadr cddar cdddr cadr cdar
cddr cdr length list->vector list? pair? append list-tail procedure?
vector->list vector make-vector vector-ref vector? number? symbol? set-car! set-cdr!
vector-set! display newline void quotient))
(define (reset-global-env)
(set! global-env
(extend-env
(append *spec-proc-names* *prim-proc-names* '()) ; Removes the pointer to each element in *prim-proc-names*
(append
(map (lambda(x) (refer (special-proc x))) *spec-proc-names*)
(map (lambda(x) (refer (prim-proc x))) *prim-proc-names*))
(empty-env)))
(set! global-syntax-env
(extend-env '() '() (empty-env)))
(syntax_expansion_init)
(procedure_init))
; Usually an interpreter must define each
; built-in procedure individually. We are "cheating" a little bit.
; arguments:
; prim-proc: the primitive procedure, de-referred
; args: the list of arguments, de-referred
; returns:
; single value, not referred
(define apply-prim-proc
(lambda (prim-proc args)
(case prim-proc
[(+) (apply + args)]
[(-) (apply - args)]
[(*) (apply * args)]
[(/) (apply / args)]
[(add1) (+ (1st args) 1)] ; Error-handling for more than 1 args?
[(sub1) (- (1st args) 1)]
[(zero?) (zero? (1st args))]
[(not) (not (1st args))]
[(=) (= (1st args) (2nd args))]
[(<) (apply < args)]
[(>) (apply > args)]
[(<=) (apply <= args)]
[(>=) (apply >= args)]
[(cons) (cons (1st args) (2nd args))]
[(list) (apply list args)]
[(null?) (apply null? args)]
[(assq) (apply assq args)]
[(eq?) (apply eq? args)]
[(eqv?) (apply eqv? args)]
[(equal?) (apply equal? args)]
[(atom?) (apply atom? args)]
[(car) (apply car args)]
[(caar) (apply caar args)]
[(caaar) (apply caaar args)]
[(caadr) (apply caadr args)]
[(cadar) (apply cadar args)]
[(cdaar) (apply cdaar args)]
[(caddr) (apply caddr args)]
[(cdadr) (apply cdadr args)]
[(cddar) (apply cddar args)]
[(cdddr) (apply cdddr args)]
[(cadr) (apply cadr args)]
[(cdar) (apply cdar args)]
[(cddr) (apply cddr args)]
[(cdr) (apply cdr args)]
[(length) (apply length args)]
[(list->vector) (apply list->vector args)]
[(list?) (apply list? args)]
[(pair?) (apply pair? args)]
[(append) (apply append args)]
[(list-tail) (apply list-tail args)]
[(procedure?) (apply proc-val? args)]
[(vector->list) (apply vector->list args)]
[(vector) (apply vector args)]
[(make-vector) (apply make-vector args)]
[(vector-ref) (apply vector-ref args)]
[(vector?) (apply vector? args)]
[(number?) (apply number? args)]
[(symbol?) (apply symbol? args)]
[(set-car!) (apply set-car! args)]
[(set-cdr!) (apply set-cdr! args)]
[(vector-set!) (apply vector-set! args)]
[(display) (apply display args)]
[(newline) (apply newline args)]
[(void) (apply void args)]
[(quotient) (apply quotient args)]
[else (error 'apply-prim-proc
"Bad primitive procedure name: ~s"
prim-proc)])))
; Initialize interpreter
(reset-global-env) | true |
3806716b311efd7034e1410752b3fc0da3ee2d78 | d369542379a3304c109e63641c5e176c360a048f | /brice/Chapter1/exercise-1.23.scm | cd2c63671072a39316b541e12625c58b9afaee51 | []
| no_license | StudyCodeOrg/sicp-brunches | e9e4ba0e8b2c1e5aa355ad3286ec0ca7ba4efdba | 808bbf1d40723e98ce0f757fac39e8eb4e80a715 | refs/heads/master | 2021-01-12T03:03:37.621181 | 2017-03-25T15:37:02 | 2017-03-25T15:37:02 | 78,152,677 | 1 | 0 | null | 2017-03-25T15:37:03 | 2017-01-05T22:16:07 | Scheme | UTF-8 | Scheme | false | false | 1,339 | scm | exercise-1.23.scm | ; Excercise 1.23
(display "\nEXCERCISE 1.23\n")
(define (next n)
(if (= 2 n)
3
(+ n 2)))
(define (smallest-divisor2 n)
(find-divisor n 2))
(define (find-divisor2 n test-divisor)
(cond ((> (square test-divisor) n) n)
((divides? test-divisor n) test-divisor)
(else (find-divisor n (next test-divisor)))))
(define (divides2? a b)
(= (remainder b a) 0))
(define (prime2? n)
(= n (smallest-divisor n)))
(search-for-primes (timed-test prime2?) 1000 10000000 3) ;-> '(1019 1013 1009)
(search-for-primes (timed-test prime2?) 10000 10000000 3) ;-> '(10037 10009 10007)
(search-for-primes (timed-test prime2?) 100000 10000000 3) ;-> '(100043 100019 100003)
(search-for-primes (timed-test prime2?) 1000000 10000000 3) ;-> '(1000037 1000033 1000003)
; for 'prime?'
; testing @ 1000: 0.00277 ms
; testing @ 10000: 0.00903 ms
; testing @ 100000: 0.02808 ms
; testing @ 1000000: 0.08960 ms
; for 'prime2?'
; testing @ 1000: 0.00260 ms
; testing @ 10000: 0.00863 ms
; testing @ 100000: 0.02637 ms
; testing @ 1000000: 0.08268 ms
; As can be seen by comparison to 'prime?' above, there is a slight systematic difference
; with between the 'prime?' and 'prime2?' functions. However, the ratio is not 2 as expected,
; but closer to (/ (+ 1.065 1.046 1.065 1.84) 4) -> 1.3
; XXXX -> Why is this? | false |
3c5ef2a11e2a26cb91a9b3084ac29e7bdb4796e4 | 8981787979ca36cfb38070afec4c53a7dc7a3126 | /9.ss | 305c1077ea6b77a324bb433b599e812b80f3e841 | []
| no_license | hernanre/CSSE304 | c52750004bb981b0bbbca20ba3341945b9dcb5e6 | 26e88a35f136aa4bb9c76539cb706958db1db0bb | refs/heads/master | 2021-12-15T08:30:35.067405 | 2017-08-05T15:28:12 | 2017-08-05T15:28:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 2,019 | ss | 9.ss | ;Han Wei Assignment9
;#1
(define snlist-recur
(letrec ([helper (lambda (proc1 proc2 ls bs)
(cond [(null? ls) bs]
[(list? (car ls)) (proc2 (helper proc1 proc2 (car ls) bs) (helper proc1 proc2 (cdr ls) bs))]
[else (proc1 (car ls) (helper proc1 proc2 (cdr ls) bs))]
))])
(lambda (proc1 proc2 ls bs)
(helper proc1 proc2 ls bs))))
;#a
(define sn-list-sum
(lambda (ls)
(snlist-recur + + ls 0)))
;#b
(define sn-list-map
(lambda (proc ls)
(snlist-recur (lambda (a b) (cons (proc a) b)) cons ls '())))
;#c
(define sn-list-paren-count
(lambda (ls)
(snlist-recur (lambda (a b) b) + ls 2)))
;#d
(define sn-list-reverse
(lambda (ls)
(snlist-recur (lambda (a b) (append b (list a))) (lambda (a b) (append b (list a))) ls '())))
;#e
(define sn-list-occur
(lambda (s ls)
(snlist-recur (lambda (a b) (if (equal? a s) (add1 b) b)) + ls 0)))
;#f
(define sn-list-depth
(lambda (ls)
(snlist-recur (lambda (a b) b) (lambda (a b) (max (add1 a) b)) ls 1)))
;#2
(define bt-recur
(letrec ([helper (lambda (proc1 proc2 ls bs)
(cond [(null? ls) bs]
[(list? ls) (proc1 (car ls) (helper proc1 proc2 (cadr ls) bs) (helper proc1 proc2 (caddr ls) bs))]
[else (proc2 ls)]
))])
(lambda (proc1 proc2 ls bs)
(helper proc1 proc2 ls bs))))
(define bt-sum
(lambda (ls)
(bt-recur (lambda (a b c) (+ b c)) (lambda (x) x) ls 0)))
(define bt-inorder
(lambda (ls)
(bt-recur (lambda (a b c) (append b (cons a c))) (lambda (a) '()) ls '())))
;#3
(define make-c...r
(lambda (ls)
(lambda (x)
((make-cr (string->list ls)) x))))
(define make-cr
(lambda (ls)
(cond[(null? ls) (lambda (x) x)]
[(equal? (car ls) '#\d) (lambda (x) (cdr ((make-cr (cdr ls)) x)))]
[(equal? (car ls) '#\a) (lambda (x) (car ((make-cr (cdr ls)) x)))]))) | false |
2838293e81b9e66c46df10097060824abc8bf881 | 7aa05653286e7320ed5935f66975eab19beb09f0 | /tcpcgi/trunk/src/lib/tcpcgi/execute.scm | 71b95e0e5d355fc063c5558185e8e5137cbc6a26 | [
"MIT"
]
| permissive | haruyama/copy-of-svn.tir.jp | 61af01554bcee074e5f05df986a5fce11184254c | 3863f8ceeaeb2e3c340097f6ffbf493f84030548 | refs/heads/master | 2021-01-15T23:36:04.609231 | 2012-04-28T18:45:38 | 2012-04-28T18:45:38 | null | 0 | 0 | null | null | null | null | EUC-JP | Scheme | false | false | 11,054 | scm | execute.scm | ;;; coding: euc-jp
;;; -*- scheme -*-
;;; vim:set ft=scheme ts=8 sts=2 sw=2 et:
;;; $Id$
;;; ToDo : filer回りの実装
;;; ToDo : filer自体は遅延実行するが、事前に他の情報を返す為の
;;; インターフェースを用意する
;;; ToDo : nphと同じように遅延実行するが、
;;; CGI/1.1の結果をHTTP/1.1に変換するexecute-typeを用意する。あとで。
;;; これには、vportの使用が必須となる(クライアント直結に見せかける為)
;;; また、クライアントへは、chunkedで送信する必要がある。
;;; (そうしないとpersistent connectionを維持出来ない)
;;; apacheは既にコレを実装している(pipeでだが)。
;;; note : filerのみ、ディレクトリを扱える。
;;; それ以外のasis-file等はディレクトリを扱えない(直接ファイル指定のみ)
;;; ToDo : 余裕が出来たら、file, directoryは細分化させる?
;;; ToDo : filer以外のファイル出力の404対応
;;; - filerは遅延実行なので、どの時点で404を返すかが微妙
(define-module tcpcgi.execute
(use gauche.parameter)
(use gauche.regexp) ; regexp-quote
(use srfi-1) ; filter-map
(use srfi-2) ; and-let*
(use file.util)
(use rfc.uri)
(use text.tree)
(use util.list) ; alist->hash-table intersperse
(use www.cgi)
(use tcpcgi.execute.filer)
(export
*execute-type-canonical-table*
<tcpcgi.execute>
lazy-execute?
always-connection-close?
filer?
execute ; (必要なら、実行して)各種情報を得る
lazy-execute ; (遅延実行タイプのみ)遅延実行する
))
(select-module tcpcgi.execute)
(define *execute-type-canonical-table*
(hash-table
'eq?
;; type-name(alias ok) -> true-type-name(alias ng)
'(script . script) ; 通常のcgi
'(cgi . script) ; alias
'(cgi-thunk . script) ; alias
'(cgi-script . script) ; alias
'(redirect . redirect) ; path-infoを利用する302リダイレクト
'(path-redirect . redirect) ; alias
'(location . location) ; path-info無視の302リダイレクト
'(filer . filer) ; ディレクトリ/ファイル表示
'(file . filer) ; alias
'(directory . filer) ; alias
'(mount . filer) ; alias
'(asis-file . asis-file) ; asisファイル表示
'(asis . asis-file) ; alias
'(nph-script . nph-script) ; nph動作のcgi
'(nph . nph-script) ; alias
'(nph-cgi-script . nph-script) ; alias
'(pc-nph-script . pc-nph-script) ; persistent connectionを維持するnph
'(pc-nph . pc-nph-script) ; alias
;; 以下は、path-dispatchやvhost-dispatchに直指定された時用
'(host-redirect . host-redirect) ; ホスト名での302リダイレクト
'(vhost-redirect . host-redirect) ; alias
))
;; ToDo : execute-listスロットが更新される毎にexecute-slot-update!を呼ぶ
(define-class <tcpcgi.execute> ()
(
;; '(symbol target . keywords) ; 形式のリスト。
;; symbolは動作タイプ(その場合はtargetの型で動作が決定する)。省略可能。
;; targetには通常、cgi-thunkまたはpath文字列を指定する。
;; keywordsには認証パラメータ等を設定可能(未実装)。
(execute-list :accessor execute-list-of
:init-keyword :execute-list
:init-value #f)
;; 以下のスロットは、execute-listスロットから自動生成される。
;; 動作タイプ。symbol。
(execute-type :accessor execute-type-of
:init-value #f)
;; 動作ターゲット。以下のどれか。
;; proc, 文字列, <tcpcgi.execute.filer>
(execute-target :accessor execute-target-of
:init-value #f)
;; 指定キーワード。execute-listから取得。
(execute-keywords :accessor execute-keywords-of
:init-value '())
))
(define-method execute-slot-update! ((self <tcpcgi.execute>))
(define (make-filer path . keywords)
(apply
make <tcpcgi.execute.filer>
:root-path (sys-normalize-pathname
path
:absolute #t
:expand #t
:canonicalize #t)
keywords))
(let1 pre-execute-list (execute-list-of self)
(when pre-execute-list ; #fの場合は何もしない
(let* (
;; execute-listは、listではなくthunkや文字列一個だけの場合がある
(execute-list (if (list? pre-execute-list)
pre-execute-list
(list pre-execute-list)))
(car-execute-list (car execute-list))
(pre-execute-type (cond
((symbol? car-execute-list) car-execute-list)
((procedure? car-execute-list) 'script)
((string? car-execute-list) 'filer)
(else (error "invalid execute-list"))))
(execute-type (hash-table-get
*execute-type-canonical-table* pre-execute-type))
(cdr-execute-list (if (symbol? car-execute-list)
(cdr execute-list)
execute-list))
(car-cdr-execute-list (car cdr-execute-list))
(execute-target (case execute-type
('filer (apply make-filer cdr-execute-list))
(else car-cdr-execute-list)))
(execute-keywords (cdr cdr-execute-list))
)
(set! (ref self 'execute-type) execute-type)
(set! (ref self 'execute-target) execute-target)
(set! (ref self 'execute-keywords) execute-keywords)
))))
(define-method initialize ((self <tcpcgi.execute>) initargs)
(next-method)
(execute-slot-update! self))
(define-method lazy-execute? ((self <tcpcgi.execute>))
(memq
(execute-type-of self)
'(filer
nph-script
pc-nph-script
)))
(define-method always-connection-close? ((self <tcpcgi.execute>))
(memq
(execute-type-of self)
'(nph-script
)))
(define-method filer? ((self <tcpcgi.execute>))
(eq? 'filer (execute-type-of self)))
(define (execute-script self input-port)
(with-output-to-string
(lambda ()
(with-input-from-port
input-port
(execute-target-of self))))) ; thunkが返り、それが実行される
(define (execute-redirect self input-port)
(list
302
:location (string-append
(execute-target-of self)
(or (cgi-get-metavariable "PATH_INFO") ""))))
(define (execute-location self input-port)
(list
302
:location (execute-target-of self)))
(define (execute-host-redirect self input-port)
(list
302
:location (let* ((scheme (if (cgi-get-metavariable "HTTPS")
"https"
"http"))
(host (execute-target-of self))
(default-port (if (string=? "http" scheme)
80 443))
(port (and-let* ((server-port-string
(cgi-get-metavariable "SERVER_PORT"))
(server-port
(x->number server-port-string))
)
(and
(not (eqv? default-port server-port))
server-port)))
(path* (or (cgi-get-metavariable "REQUEST_URI") "/"))
)
(uri-compose
:scheme scheme
:host host
:port port
:path* path*
))))
(define (execute-asis-file self input-port)
(let1 file (execute-target-of self)
(cond
((not (file-exists? file)) (list 404))
((not (file-is-readable? file)) (list 401))
;; ToDo : request-methodのチェック等を行う必要がある
(else (file->string file)))))
;; nph-script系。遅延実行される。直にクライアントにコンテンツを返す。
(define (execute-filer self input-port)
;; filerのmethodを呼び出し、適切に200, 404, 301等を返すようにする
;; ToDo : まだ
;; ToDo : asis-fileと共通化可能な部分は共通化する
(let1 file (execute-target-of self)
(cond
((not (file-exists? file)) (list 404))
((not (file-is-readable? file)) (list 401))
;; ToDo : request-methodのチェック等を行う必要がある
(else (list 200)))))
(define (execute-nph-script self input-port)
(list #f))
;; note : 以下のテーブルは各procedureの定義後で定義する必要がある
(define *execute-table*
(hash-table
'eq?
;; type-name -> procedure
`(script . ,execute-script)
`(redirect . ,execute-redirect)
`(location . ,execute-location)
`(host-redirect . ,execute-host-redirect)
`(asis-file . ,execute-asis-file)
`(filer . ,execute-filer)
`(nph-script . ,execute-nph-script)
`(pc-nph-script . ,execute-nph-script)
))
;; このmethodで得られる情報は、次のどちらか
;; - cgi/1.1-response (文字列)
;; - (cons response-code response-keywords)
;; -- response-keywordsは、各response-codeに固有な必要情報
;; cgi-thunk実行時にエラー例外が発生した場合、そのまま例外が投げられるので
;; 適切にキャッチする事が必要。
(define-method execute ((self <tcpcgi.execute>) . optional)
(let* (
(input-port (get-optional optional (current-input-port)))
(execute-type (execute-type-of self))
(proc (hash-table-get *execute-table* execute-type))
)
(proc self input-port)))
(define (lazy-execute-filer self)
;;;; ToDo : まだ
#f)
(define (lazy-execute-nph-script self)
;; thunkを実行するだけ
((execute-target-of self)))
;; note : 以下のテーブルは各procedureの定義後で定義する必要がある
(define *lazy-execute-table*
(hash-table
'eq?
;; type-name -> procedure
`(filer . ,lazy-execute-filer)
`(nph-script . ,lazy-execute-nph-script)
`(pc-nph-script . ,lazy-execute-nph-script) ; 接続維持の有無が違うだけ
))
(define-method lazy-execute ((self <tcpcgi.execute>) . optional)
(and
(lazy-execute? self)
(let* (
(input-port (get-optional optional (current-input-port)))
(execute-type (execute-type-of self))
(proc (hash-table-get *lazy-execute-table* execute-type))
)
(with-input-from-port
input-port
(lambda ()
;; 遅延実行時には、stdoutに直接結果を返す
(proc self)
#t))))) ; 遅延実行時には、返り値は意味を持たないが、一応
(provide "tcpcgi/execute")
| false |
fd99c087bcc2a0c021c275897ccf50b2db84fbf3 | ab3a7c16247679bb8c46f588e360ff47d03d03fa | /syntax-rules-lambda-calculus.ss | 8183487e0366f10d966bba5c2618be85622f3a7e | []
| no_license | eholk/scheme-fun | 01a67f359dd918c4763bb861fa22d86a9f2af496 | 5a8b37d37155f0f3d03a3fe75d58d0a207006a97 | refs/heads/master | 2021-01-01T17:21:37.087003 | 2014-02-26T23:43:57 | 2014-02-26T23:43:57 | 8,096,997 | 6 | 1 | null | null | null | null | UTF-8 | Scheme | false | false | 1,032 | ss | syntax-rules-lambda-calculus.ss | (trace-define-syntax value-of-k
(syntax-rules (lambda)
;; lambda
((_ (lambda (x) b) k)
(apply-k k (syntax-rules ()
((_ v k^)
(let-syntax ((x (syntax-rules ()
((_ k^^)
(apply-k k^^ v)))))
(value-of-k b k^))))))
;; application
((_ (e1 e2) k)
(value-of-k e1 (syntax-rules ()
((_ v1)
(value-of-k e2 (syntax-rules ()
((_ v2)
(apply-k v1 v2 k))))))))
;; variable
((_ x k)
(x k))))
(trace-define-syntax apply-k
(syntax-rules ()
((_ k v ...)
(let-syntax ((t k))
(t v ...)))))
(trace-define-syntax value-of
(syntax-rules ()
((_ e) (value-of-k e (syntax-rules ()
((_ v) 'v))))))
'((lambda (z) (z z)) (lambda (y) (lambda (x) (y x))))
;;=>
'(lambda (x) ((lambda (y) (lambda (x) (y x))) x))
| true |
710486b4ed1085efa7cdb7faa3ebbb9b8dd4a240 | 8a0660bd8d588f94aa429050bb8d32c9cd4290d5 | /test/tests/json.scm | 81d72a0a0586a548d2d8c189f35d3313b8e50166 | [
"BSD-2-Clause"
]
| permissive | david135/sagittarius-scheme | dbec76f6b227f79713169985fc16ce763c889472 | 2fbd9d153c82e2aa342bfddd59ed54d43c5a7506 | refs/heads/master | 2016-09-02T02:44:31.668025 | 2013-12-21T07:24:08 | 2013-12-21T07:24:08 | 32,497,456 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 2,326 | scm | json.scm | ;; -*- scheme -*-
#!compatible
(import (rnrs)
(json)
(pp)
(srfi :26 cut)
(srfi :64 testing))
(test-begin "JSON tests")
(define synopsis-data (string-append (current-directory)
"/test/data/json-synopsis.json"))
;; basic test
(test-equal "synopsis (read)"
'#(("some" . #(("partial" 42)))
("other" . #(("partial" . "a string")))
("more" . #(("more" . "stuff"))))
(call-with-input-file synopsis-data
(cut json-read <>)))
(test-equal "synopsis (write)"
"{\"some\": {\"partial\": [42]}, \
\"other\": {\"partial\": \"a string\"}, \
\"more\": {\"more\": \"stuff\"}}"
(call-with-string-output-port
(cut json-write
'#(("some" . #(("partial" 42)))
("other" . #(("partial" . "a string")))
("more" . #(("more" . "stuff"))))
<>)))
(define (parse-json-string str)
(call-with-port
(open-string-input-port str)
(cut json-read <>)))
;; test cases are from Gauche
(let ()
(define (t str val)
(test-equal (string-append "primitive " str)
`#(("x" . ,val)) (parse-json-string str)))
(t "{\"x\": 100 }" 100)
(t "{\"x\" : -100}" -100)
(t "{\"x\": +100 }" 100)
(t "{\"x\": 12.5} " 12.5)
(t "{\"x\":-12.5}" -12.5)
(t "{\"x\":+12.5}" 12.5)
(t "{\"x\": 1.25e1 }" 12.5)
(t "{\"x\":125e-1}" 12.5)
(t "{\"x\":1250.0e-2}" 12.5)
(t "{\"x\": false }" #f)
(t "{\"x\":true}" #t)
(t "{\"x\":null}" 'null)
(t "{\"x\": \"abc\\\"\\\\\\/\\b\\f\\n\\r\\t\\u0040abc\"}"
"abc\"\\/\x0008;\x000c;\x000a;\x000d;\x0009;@abc")
)
(let ()
(define (t str)
(test-error (string-append "parse error " str)
(parse-json-string str)))
(t "{\"x\": 100")
(t "{x : 100}}"))
(define two-objects-data (string-append (current-directory)
"/test/data/json-two-objects.json"))
(test-equal "parsing an array containing two objects"
'(#(("precision" . "zip")
("Latitude" . 37.7668)
("Longitude" . -122.3959)
("Address" . "")
("City" . "SAN FRANCISCO")
("State" . "CA")
("Zip" . "94107")
("Country" . "US"))
#(("precision" . "zip")
("Latitude" . 37.371991)
("Longitude" . -122.026020)
("Address" . "")
("City" . "SUNNYVALE")
("State" . "CA")
("Zip" . "94085")
("Country" . "US")))
(call-with-input-file two-objects-data
(cut json-read <>)))
(test-end) | false |
c4efe93bf6ab6a64b1c79537453720c06ff33a81 | 784dc416df1855cfc41e9efb69637c19a08dca68 | /src/std/text/json-test.ss | 72e3ca18cc8f817dcd6287cf9c1c28bd10e32156 | [
"LGPL-2.1-only",
"Apache-2.0",
"LGPL-2.1-or-later"
]
| permissive | danielsz/gerbil | 3597284aa0905b35fe17f105cde04cbb79f1eec1 | e20e839e22746175f0473e7414135cec927e10b2 | refs/heads/master | 2021-01-25T09:44:28.876814 | 2018-03-26T21:59:32 | 2018-03-26T21:59:32 | 123,315,616 | 0 | 0 | Apache-2.0 | 2018-02-28T17:02:28 | 2018-02-28T17:02:28 | null | UTF-8 | Scheme | false | false | 1,563 | ss | json-test.ss | ;;; -*- Gerbil -*-
;;; (C) vyzo at hackzen.org
;;; :std/text/json unit test
(import :std/test
:std/text/json
:std/sugar)
(export json-test)
(def json-test
(test-suite "test :std/text/json"
(def (check-encode-decode obj)
(let (p (open-output-u8vector))
(write-json obj p)
(let (q (open-input-u8vector (get-output-u8vector p)))
(check (read-json q) => obj))))
(def (check-encode-decode= obj)
(let (p (open-output-u8vector))
(write-json obj p)
(let (q (open-input-u8vector (get-output-u8vector p)))
(checkf = (read-json q) obj))))
(def (check-encode-decode-number num)
(check-encode-decode= num)
(check-encode-decode= (- num)))
(test-case "test object encoding and decoding"
(check-encode-decode #t)
(check-encode-decode #f)
(check-encode-decode (void))
(check-encode-decode 0)
(for-each check-encode-decode-number
'(1 2 3 4 5 10 20 50 101
0.0 0.5 1.0 1.337 2.0 3.5 1e6 1.3337e6 1.234e9))
(for-each check-encode-decode-number
'(10. 100. 1e3 1e4 1e5 1e6 1e7 1e8 1e9 1e10
.1 .01 1e-3 1e-4 1e-5 1e-6 1e-7 1e-8 1e-9 1e-10))
(check-encode-decode "a string")
(check-encode-decode [1 2 3 [4 5] ["six" "seven"]])
(check-encode-decode (hash-eq (a 1) (b 2) (c (hash-eq (d 3) (e 4) (f 5)))))
(parameterize ((json-symbolic-keys #f))
(check-encode-decode (hash ("a" 1) ("b" 2) ("c" (hash ("d" 3) ("e" 4) ("f" 5)))))))
))
| false |
df38b55dce57418eab07dfd6c93435555935ac38 | 5f5bf90e51b59929b5e27a12657fade4a8b7f9cd | /data_transformer.scm | 4f954bcdbb83d2172d3c6e84e857119f8f97a18b | []
| no_license | ashton314/NN_Chess | 9ddd8ebc4a3594fcfe0b127ddd7309000eaa6594 | f6c8295a622483641cdf883642723ee8e6e84e76 | refs/heads/master | 2020-04-25T04:16:00.493978 | 2014-01-01T22:24:01 | 2014-01-01T22:24:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 1,401 | scm | data_transformer.scm | (load "bin/trainer.com")
(define *input* (open-input-file "DATA/TRAINING_DATA/data_set01.scm"))
(define *output* (open-output-file "DATA/TRAINING_DATA/data_set02.scm"))
(define (transform)
(do ((line (read *input*) (read *input*)))
((eof-object? line) (flush-output *output*))
(let ((board (car line))
(side (cadr line))
(score (caddr line)))
(write-line (list (cons (if (eq? side 'white) 1 0) (patterns board)) (score-pattern score)) *output*))))
(define (patterns board)
(append
(list (pawn-compare board)
(king-compare board)
(white-advancement-potential board)
(black-advancement-potential board))
(analyze-movement board)
(list (pieces-ahead-of board 'white)
(pieces-ahead-of board 'black))))
(define-syntax in-range
(syntax-rules ()
((_ var (lower upper datum))
(if (and (>= var lower) (< var upper))
'datum
#f))
((_ var (lower upper datum) rest ...)
(if (and (>= var lower) (< var upper))
'datum
(in-range var rest ...)))))
(define (score-pattern score) ; Score is supposed to be relative to current side
(in-range score
(-1000 -6 (0 0 0 .5 1)) ; evil
(-6 -2 (0 0 0 .7 .7)) ; meh-evil
(-2 0 (0 0 .5 1 .5)) ; bad
(0 1 (0 .5 1 .5 0)) ; meh
(1 2 (.5 1 .5 0 0)) ; good
(2 6 (.7 .7 0 0 0)) ; meh-awesome
(6 1001 (1 .5 0 0 0)))) ; awesome
| true |
577cd43d96d62a0b530ca1fe68c1569e03e68c58 | 4f30ba37cfe5ec9f5defe52a29e879cf92f183ee | /src/minijava-lexer-java.scm | 6b6179a46e14ae50e6bfcbe23f756a6127559027 | [
"MIT"
]
| permissive | rtrusso/scp | e31ecae62adb372b0886909c8108d109407bcd62 | d647639ecb8e5a87c0a31a7c9d4b6a26208fbc53 | refs/heads/master | 2021-07-20T00:46:52.889648 | 2021-06-14T00:31:07 | 2021-06-14T00:31:07 | 167,993,024 | 8 | 1 | MIT | 2021-06-14T00:31:07 | 2019-01-28T16:17:18 | Scheme | UTF-8 | Scheme | false | false | 129,794 | scm | minijava-lexer-java.scm | (need regex/dfa)
(need regex/genlex)
(define minijava-lexer-dfa (build-fast-dfa (quote 282) (quote #(#t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #t #t #t #t #t #f #f #f #t #t #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #f #f #f #t #t #f #t #t #t)) (quote #(#(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 0 0 0 0 0 0 0 0 0 0 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 1 #f #f #f #f #f #f #f #f 5 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 3 #f #f #f #f #f #f #f #f 7 #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 0 0 0 0 0 0 0 0 0 0 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 1 #f #f #f #f #f #f #f #f 5 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 3 #f #f #f #f #f #f #f #f 7 #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 11 11 20 11 #f 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 16 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 11 11 20 11 #f 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 16 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 11 11 20 11 #f 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 16 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 11 11 20 11 #f 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 16 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 13 #f #f #f #f #f #f #f #f #f #f #f #f #f 13 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 13 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 13 #f #f #f 13 #f 13 #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 13 #f #f #f #f #f #f #f #f #f #f #f #f #f 13 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 13 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 13 #f #f #f 13 #f 13 #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 11 11 20 11 #f 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 16 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 25 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 23 #f #f #f #f #f #f #f #f 23 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 23 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 23 #f #f #f 23 #f 23 #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 25 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 27 27 27 27 #f 27 27 #f 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 24 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 33 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 34 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 35 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 36 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 38 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 39 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 41 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 42 212 212 212 212 212 212 212 212 40 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 44 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 45 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 43 212 212 212 212 212 212 212 212 212 46 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 56 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 57 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 59 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 61 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 63 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 65 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 66 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 67 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 68 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 70 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 71 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 72 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 73 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 74 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 76 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 77 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 78 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 79 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 80 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 81 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 84 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 83 212 212 212 212 212 212 212 85 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 90 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 91 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 92 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 94 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 95 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 96 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 97 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 98 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 104 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 105 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 107 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 108 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 106 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 110 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 111 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 113 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 114 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 115 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 116 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 117 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 112 212 212 212 212 212 212 212 212 212 212 212 118 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 120 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 121 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 122 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 123 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 124 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 126 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 127 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 128 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 129 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 131 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 132 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 133 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 130 134 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 136 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 137 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 139 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 140 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 141 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 138 212 212 212 142 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 243 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 244 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 245 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 246 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 247 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 248 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 249 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 250 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 212 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 251 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f #f #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f 252 #f 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 212 #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f 256 256 #f #f 256 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 256 256 256 256 #f 256 256 256 256 256 274 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 #f 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f 256 256 #f #f 256 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 256 256 256 256 #f 256 256 256 256 256 274 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 #f 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f 256 256 #f #f 256 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 256 256 256 256 #f 256 256 256 256 256 274 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 #f 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f 256 256 #f #f 256 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 256 256 256 256 #f 256 256 256 256 256 274 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 #f 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f 256 256 #f #f 256 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 256 256 256 256 #f 256 256 256 256 256 274 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 #f 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f 260 260 #f #f 260 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 260 260 260 260 #f 260 260 260 260 260 274 260 260 260 260 256 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 #f 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f 260 260 #f #f 260 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 260 260 260 260 #f 260 260 260 260 260 274 260 260 260 260 256 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 #f 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f 260 260 #f #f 260 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 260 260 260 260 #f 260 260 260 260 260 274 260 260 260 260 256 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 #f 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f 260 260 #f #f 260 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 260 260 260 260 #f 260 260 260 260 260 274 260 260 260 260 256 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 #f 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f 260 260 #f #f 260 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 260 260 260 260 #f 260 260 260 260 260 274 260 260 260 260 256 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 #f 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f 260 260 #f #f 260 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 260 260 260 260 #f 260 260 260 260 260 274 260 260 260 260 256 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 #f 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f 260 260 #f #f 260 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 260 260 260 260 #f 260 260 260 260 260 274 260 260 260 260 256 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 #f 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f 260 260 #f #f 260 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 260 260 260 260 #f 260 260 260 260 260 274 260 260 260 260 256 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 #f 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 260 #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f 265 265 #f #f 265 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 265 265 265 265 #f 265 265 265 265 265 267 265 265 265 265 269 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 #f 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f 265 265 #f #f 265 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 265 265 265 265 #f 265 265 265 265 265 267 265 265 265 265 269 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 #f 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f 265 265 #f #f 265 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 265 265 265 265 #f 265 265 265 265 265 267 265 265 265 265 269 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 #f 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f 265 265 #f #f 265 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 265 265 265 265 #f 265 265 265 265 265 267 265 265 265 265 269 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 #f 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 265 #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f 256 256 #f #f 256 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 256 256 256 256 #f 256 256 256 256 256 274 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 #f 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f 276 278 #f #f 276 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 276 276 276 276 #f 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 #f 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f 276 278 #f #f 276 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 276 276 276 276 #f 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 #f 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 276 #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 275 #f #f #f #f 279 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f 281 281 #f #f 281 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 281 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f) #() #()) #(#(#f #f #f #f #f #f #f #f #f 281 281 #f #f 281 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f 281 32 22 #f #f 29 62 28 103 102 53 55 31 54 52 280 9 9 9 9 9 9 9 9 9 9 30 87 60 64 58 51 #f 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 89 #f 88 48 253 #f 10 82 143 10 119 37 10 10 86 10 10 125 10 109 10 99 10 75 135 47 10 93 69 10 10 10 101 50 100 49 #f) #() #()))) (quote #(number number number number number number number number number number ident #f #f #f #f #f #f string-literal string-literal string-literal string-literal string-literal #f #f #f char-literal char-literal #f #f percent colon comma bang false ident ident ident ident throw ident ident this ident ident true ident ident ident ^ ~ pipe ? dot * - + >>> >> > << < && & == = while ident ident ident ident return ident ident ident ident ident boolean ident ident ident ident ident ident if int ident ident s-colon r-brak l-brak void ident ident ident public ident ident ident ident ident r-curl l-curl r-paren l-paren null ident ident new ident ident else ident ident extends ident ident ident ident ident ident length ident ident ident ident ident static ident ident ident ident super ident ident ident ident char ident ident class ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident ident --sasm-impl ident ident ident ident ident ident ident ident ident ident #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f *comment* *comment* *comment* *comment* #f #f #f #f *comment* *comment* #f forward-slash *whitespace* *whitespace*))))
(define minijava-lexically-analyze (let ((main-dfa minijava-lexer-dfa)) (lambda (input-port) (run-generated-lexer main-dfa (quote (*whitespace* *comment*)) input-port))))
| false |
2f27642020ebd1539e8a86c1fc72bca097f78ce1 | ece1c4300b543df96cd22f63f55c09143989549c | /Chapter3/Exercise3.37.scm | 4a5755abe6d0ace762810595640eb06a80bd7478 | []
| no_license | candlc/SICP | e23a38359bdb9f43d30715345fca4cb83a545267 | 1c6cbf5ecf6397eaeb990738a938d48c193af1bb | refs/heads/master | 2022-03-04T02:55:33.594888 | 2019-11-04T09:11:34 | 2019-11-04T09:11:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 1,801 | scm | Exercise3.37.scm | ; Exercise 3.37: The celsius-fahrenheit-converter procedure is cumbersome when compared with a more expression-oriented style of definition, such as
; (define (celsius-fahrenheit-converter x)
; (c+ (c* (c/ (cv 9) (cv 5))
; x)
; (cv 32)))
; (define C (make-connector))
; (define F (celsius-fahrenheit-converter C))
; Here c+, c*, etc. are the “constraint” versions of the arithmetic operations. For example, c+ takes two connectors as arguments and returns a connector that is related to these by an adder constraint:
; (define (c+ x y)
; (let ((z (make-connector)))
; (adder x y z)
; z))
; Define analogous procedures c-, c*, c/, and cv (constant value) that enable us to define compound constraints as in the converter example above.161
(load "/home/soulomoon/git/SICP/Chapter3/constraint.scm")
(define (c+ x y)
(let ((z (make-connector)))
(adder x y z)
z))
(define (c- x y)
(let ((z (make-connector)))
(adder z y x)
z))
(define (c* x y)
(let ((z (make-connector)))
(multiplier x y z)
z))
(define (c/ x y)
(let ((z (make-connector)))
(multiplier z y x)
z))
(define (cv x)
(let ((a (make-connector)))
(constant x a)
a))
(define (celsius-fahrenheit-converter x)
(c+ (c* (c/ (cv 9) (cv 5))
x)
(cv 32)))
(define C (make-connector))
(define F (celsius-fahrenheit-converter C))
(probe 'C C)
(probe 'F F)
(set-value! C 17.0 'user)
(forget-value! C 'user)
(set-value! F 17.0 'user)
; Welcome to DrRacket, version 6.7 [3m].
; Language: SICP (PLaneT 1.18); memory limit: 128 MB.
; #<procedure:...3/constraint.scm:102:2>
; #<procedure:...3/constraint.scm:102:2>
; Probe: F = 62.6
; Probe: C = 17.0'done
; Probe: F = ?
; Probe: C = ?'done
; Probe: C = -8.333333333333334
; Probe: F = 17.0'done
; > | false |
99d2423a7712a1ac7334e8607bacec9ad0e8c14f | ecfd9ed1908bdc4b099f034b121f6e1fff7d7e22 | /old1/sicp/2/p40.scm | 35b1f1bbde784a96e8190f607c1dab87dc916e43 | [
"MIT"
]
| permissive | sKabYY/palestra | 36d36fc3a03e69b411cba0bc2336c43b3550841c | 06587df3c4d51961d928bd8dd64810c9da56abf4 | refs/heads/master | 2021-12-14T04:45:20.661697 | 2021-11-25T08:29:30 | 2021-11-25T08:29:30 | 12,856,067 | 6 | 3 | null | null | null | null | UTF-8 | Scheme | false | false | 831 | scm | p40.scm | (load "lib.scm")
(define (prime? x)
(define (out? i) (> (* i i) x))
(define (iter i)
(cond ((out? i) x)
((= (remainder x i) 0) i)
(else (iter (+ i 1)))))
(= (iter 2) x))
(define (loop-range f low high)
(if (> low high)
(void)
(begin
(f low)
(loop-range f (+ low 1) high))))
(display "Test prime?: ")
(loop-range
(lambda (i)
(if (prime? i)
(begin
(display i)
(display #\ ))
(void)))
1
100)
(newline)
(define (pair-sum pair)
(+ (car pair) (cadr pair)))
(define (prime-sum? pair)
(prime? (pair-sum pair)))
(define (make-pair-sum pair)
(list (car pair) (cadr pair) (pair-sum pair)))
(define (prime-sum-pair n)
(map make-pair-sum
(filter prime-sum?
(unique-pairs n))))
(display (prime-sum-pair 6))
(newline)
| false |
e89b4191049b6487bcf5379a55d382806cba62ae | f3fe23cb6fb12b859d372eca82117a3fb6afd77a | /sources/csug9.ss | 3708d12fd3c01c2ea32c7cbd66fb2777c934bc38 | [
"BSD-2-Clause"
]
| permissive | qzivli/chez-help | 31db5acdbcc5598245d7303728a97366ac0fdf1a | c58ae8af63bf446ee3b0207094ea5e1ee9db12a2 | refs/heads/master | 2020-04-04T09:56:18.479591 | 2018-11-05T05:11:08 | 2018-11-05T05:11:08 | 155,836,699 | 4 | 1 | null | null | null | null | UTF-8 | Scheme | false | false | 113,095 | ss | csug9.ss | '( ;; alist of scheme index
(|!| "http://scheme.com/tspl4/./intro.html#./intro:s50")
(|"| "http://scheme.com/tspl4/./objects.html#./objects:s213")
(|#!r6rs| "http://scheme.com/tspl4/./grammar.html#./grammar:s12")
(|#| |n| )
(|#%| |$primitive| "./intro.html#./intro:s27")
(|#2%| |$primitive| "./system.html#./system:s101")
(|#3%| |$primitive| "./system.html#./system:s101")
(|#&| "./intro.html#./intro:s23")
(|#'| |syntax| "http://scheme.com/tspl4/./syntax.html#./syntax:s33")
(|#(| "./intro.html#./intro:s21")
(|#| |n| )
(|#,| |unsyntax| "http://scheme.com/tspl4/./syntax.html#./syntax:s40")
(|#,@| |unsyntax-splicing| "http://scheme.com/tspl4/./syntax.html#./syntax:s40")
(|#:| "./intro.html#./intro:s3")
(|#;| "http://scheme.com/tspl4/./grammar.html#./grammar:s8")
(|#| |n| )
(|#[| "./intro.html#./intro:s24")
(|#\\| "http://scheme.com/tspl4/./objects.html#./objects:s200")
(|#\\alarm| "./intro.html#./intro:s5")
(|#\\backspace| "./intro.html#./intro:s6")
(|#\\bel| "./intro.html#./intro:s15")
(|#\\delete| "./intro.html#./intro:s7")
(|#\\esc| "./intro.html#./intro:s8")
(|#\\linefeed| "./intro.html#./intro:s9")
(|#\\ls| "./intro.html#./intro:s16")
(|#\\nel| "./intro.html#./intro:s17")
(|#\\newline| "./intro.html#./intro:s10")
(|#\\nul| "./intro.html#./intro:s18")
(|#\\page| "./intro.html#./intro:s11")
(|#\\return| "./intro.html#./intro:s12")
(|#\\rubout| "./intro.html#./intro:s19")
(|#{| "./intro.html#./intro:s2")
(|#\\space| "./intro.html#./intro:s13")
(|#\\tab| "./intro.html#./intro:s14")
(|#\\vt| "./intro.html#./intro:s20")
(|#`| |quasisyntax| "http://scheme.com/tspl4/./syntax.html#./syntax:s40")
#;(|#|...|#| "http://scheme.com/tspl4/./grammar.html#./grammar:s10")
(|#b| "http://scheme.com/tspl4/./objects.html#./objects:s78")
(|#d| "http://scheme.com/tspl4/./objects.html#./objects:s80")
(|#f| "http://scheme.com/tspl4/./intro.html#./intro:s39")
(|#o| "http://scheme.com/tspl4/./objects.html#./objects:s79")
#;(|#| |n| )
(|#t| "http://scheme.com/tspl4/./intro.html#./intro:s38")
(|#x| "http://scheme.com/tspl4/./objects.html#./objects:s81")
(|$primitive| |#%| "./system.html#./system:s101")
(|$primitive| |#2%| "./system.html#./system:s101")
(|$primitive| |#3%| "./system.html#./system:s101")
(|$system| "./syntax.html#./syntax:s33")
(|$system| "./syntax.html#./syntax:s25")
(|&assertion| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s21")
(|&condition| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s13")
(|&continuation| "./system.html#./system:s6")
(|&error| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s22")
(|&format| "./system.html#./system:s4")
(|&i/o| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s32")
(|&i/o-decoding| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s42")
(|&i/o-encoding| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s43")
(|&i/o-file-already-exists| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s39")
(|&i/o-file-does-not-exist| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s40")
(|&i/o-file-is-read-only| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s38")
(|&i/o-file-protection| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s37")
(|&i/o-filename| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s36")
(|&i/o-invalid-position| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s35")
(|&i/o-port| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s41")
(|&i/o-read| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s33")
(|&i/o-write| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s34")
(|&implementation-restriction| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s28")
(|&irritants| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s25")
(|&lexical| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s29")
(|&message| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s24")
(|&no-infinities| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s44")
(|&no-nans| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s45")
(|&non-continuable| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s27")
(|&serious| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s19")
(|&source| "./system.html#./system:s5")
(|&syntax| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s30")
(|&undefined| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s31")
(|&violation| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s20")
(|&warning| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s23")
(|&who| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s26")
(|'| |quote| "http://scheme.com/tspl4/./start.html#./start:s15")
(|()| "http://scheme.com/tspl4/./intro.html#./intro:s33")
(|(chezscheme csv7)| "./libraries.html#./libraries:s4")
(|(chezscheme)| "./libraries.html#./libraries:s3")
(|(scheme csv7)| "./libraries.html#./libraries:s6")
(|(scheme)| "./libraries.html#./libraries:s5")
(|*| "http://scheme.com/tspl4/./start.html#./start:s8")
(|+| "http://scheme.com/tspl4/./start.html#./start:s6")
(|,| |unquote| "http://scheme.com/tspl4/./objects.html#./objects:s5")
(|,@| |unquote-splicing| "http://scheme.com/tspl4/./objects.html#./objects:s5")
(|-| "http://scheme.com/tspl4/./start.html#./start:s7")
(|--| "./use.html#./use:s90")
(|--boot| "./use.html#./use:s86")
(|--compact| "./use.html#./use:s96")
(|--compile-imported-libraries| "./use.html#./use:s77")
(|--debug-on-exception| "./use.html#./use:s3")
(|--eedisable| "./use.html#./use:s81")
(|--eehistory| "./use.html#./use:s82")
(|--enable-object-counts| "./use.html#./use:s83")
(|--heap| "./use.html#./use:s92")
(|--help| "./use.html#./use:s89")
(|--import-notify| "./use.html#./use:s20")
(|--libdirs| "./use.html#./use:s35")
(|--libexts| "./use.html#./use:s36")
(|--optimize-level| "./use.html#./use:s50")
(|--program| "./use.html#./use:s1")
(|--quiet| "./use.html#./use:s72")
(|--retain-static-relocation| "./use.html#./use:s84")
(|--saveheap| "./use.html#./use:s94")
(|--script| "./use.html#./use:s0")
(|--verbose| "./use.html#./use:s87")
(|--version| "./use.html#./use:s88")
(|->| "http://scheme.com/tspl4/./intro.html#./intro:s49")
(|-1+| "./numeric.html#./numeric:s68")
(|-b| "./use.html#./use:s85")
(|-c| "./use.html#./use:s95")
(|-h| "./use.html#./use:s91")
(|-q| "./use.html#./use:s71")
(|-s| "./use.html#./use:s93")
(|.| "http://scheme.com/tspl4/./start.html#./start:s30")
(|...| "./io.html#./io:s107")
(|...| "http://scheme.com/tspl4/./further.html#./further:s20")
(|/| "http://scheme.com/tspl4/./start.html#./start:s9")
(|;| "http://scheme.com/tspl4/./intro.html#./intro:s43")
(|<| "./numeric.html#./numeric:s67")
(|<=| "./numeric.html#./numeric:s67")
(|=| "./numeric.html#./numeric:s67")
(|=>| "http://scheme.com/tspl4/./control.html#./control:s14")
(|>| "./numeric.html#./numeric:s67")
(|>=| "./numeric.html#./numeric:s67")
(|?| "http://scheme.com/tspl4/./intro.html#./intro:s46")
(|[| "./io.html#./io:s88")
(|]| "./io.html#./io:s89")
(|_| "http://scheme.com/tspl4/./further.html#./further:s18")
(|_| "http://scheme.com/tspl4/./syntax.html#./syntax:s18")
(|`| |quasiquote| "http://scheme.com/tspl4/./objects.html#./objects:s5")
(|1+| "./numeric.html#./numeric:s68")
(|1-| "./numeric.html#./numeric:s68")
(|abort| "./system.html#./system:s160")
(|abort-handler| "./system.html#./system:s161")
(|abs| "http://scheme.com/tspl4/./start.html#./start:s98")
(|acos| "http://scheme.com/tspl4/./objects.html#./objects:s132")
(|acosh| "./numeric.html#./numeric:s77")
(|add-duration| "./system.html#./system:s187")
(|add-duration!| "./system.html#./system:s187")
(|add-prefix| "./syntax.html#./syntax:s20")
(|add1| "./numeric.html#./numeric:s68")
(|alias| "./binding.html#./binding:s13")
(|and| "./compat.html#./compat:s16")
(|andmap| "./control.html#./control:s8")
(|angle| "http://scheme.com/tspl4/./objects.html#./objects:s124")
(|annotation-expression| "./syntax.html#./syntax:s49")
(|annotation-option-set| "./syntax.html#./syntax:s66")
(|annotation-options| "./syntax.html#./syntax:s52")
(|annotation-source| "./syntax.html#./syntax:s50")
(|annotation-stripped| "./syntax.html#./syntax:s51")
(|annotation?| "./syntax.html#./syntax:s48")
(|append| "http://scheme.com/tspl4/./start.html#./start:s151")
(|append!| "./objects.html#./objects:s13")
(|apply| "http://scheme.com/tspl4/./control.html#./control:s3")
(|apropos| "./system.html#./system:s37")
(|apropos-list| "./system.html#./system:s36")
(|ash| "./numeric.html#./numeric:s52")
(|asin| "http://scheme.com/tspl4/./objects.html#./objects:s132")
(|asinh| "./numeric.html#./numeric:s77")
(|assert| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s5")
(|assertion-violation| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s4")
(|assertion-violation?| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s21")
(|assertion-violationf| "./system.html#./system:s2")
(|assoc| "http://scheme.com/tspl4/./objects.html#./objects:s58")
(|assp| "http://scheme.com/tspl4/./objects.html#./objects:s60")
(|assq| "http://scheme.com/tspl4/./objects.html#./objects:s58")
(|assv| "http://scheme.com/tspl4/./objects.html#./objects:s58")
(|atan| "http://scheme.com/tspl4/./objects.html#./objects:s133")
(|atanh| "./numeric.html#./numeric:s77")
(|atom?| "./objects.html#./objects:s2")
(|base-exception-handler| "./use.html#./use:s8")
(|be-like-begin| "http://scheme.com/tspl4/./syntax.html#./syntax:s54")
(|begin| "./binding.html#./binding:s5")
(|bignum?| "./numeric.html#./numeric:s11")
(|binary-port-input-buffer| "./io.html#./io:s14")
(|binary-port-input-count| "./io.html#./io:s16")
(|binary-port-input-index| "./io.html#./io:s14")
(|binary-port-input-size| "./io.html#./io:s14")
(|binary-port-output-buffer| "./io.html#./io:s18")
(|binary-port-output-count| "./io.html#./io:s20")
(|binary-port-output-index| "./io.html#./io:s18")
(|binary-port-output-size| "./io.html#./io:s18")
(|binary-port?| "http://scheme.com/tspl4/./io.html#./io:s45")
(|bitwise-and| "http://scheme.com/tspl4/./objects.html#./objects:s134")
(|bitwise-arithmetic-shift| "http://scheme.com/tspl4/./objects.html#./objects:s144")
(|bitwise-arithmetic-shift-left| "http://scheme.com/tspl4/./objects.html#./objects:s143")
(|bitwise-arithmetic-shift-right| "http://scheme.com/tspl4/./objects.html#./objects:s143")
(|bitwise-bit-count| "http://scheme.com/tspl4/./objects.html#./objects:s136")
(|bitwise-bit-field| "http://scheme.com/tspl4/./objects.html#./objects:s141")
(|bitwise-bit-set?| "http://scheme.com/tspl4/./objects.html#./objects:s139")
(|bitwise-copy-bit| "http://scheme.com/tspl4/./objects.html#./objects:s140")
(|bitwise-copy-bit-field| "http://scheme.com/tspl4/./objects.html#./objects:s142")
(|bitwise-first-bit-set| "http://scheme.com/tspl4/./objects.html#./objects:s138")
(|bitwise-if| "http://scheme.com/tspl4/./objects.html#./objects:s135")
(|bitwise-ior| "http://scheme.com/tspl4/./objects.html#./objects:s134")
(|bitwise-length| "http://scheme.com/tspl4/./objects.html#./objects:s137")
(|bitwise-not| "http://scheme.com/tspl4/./objects.html#./objects:s134")
(|bitwise-reverse-bit-field| "http://scheme.com/tspl4/./objects.html#./objects:s146")
(|bitwise-rotate-bit-field| "http://scheme.com/tspl4/./objects.html#./objects:s145")
(|bitwise-xor| "http://scheme.com/tspl4/./objects.html#./objects:s134")
(|#|...|#| "http://scheme.com/tspl4/./grammar.html#./grammar:s11")
(|block-read| "./io.html#./io:s63")
(|block-write| "./io.html#./io:s78")
(|boolean| "./foreign.html#./foreign:s54")
(|boolean=?| "http://scheme.com/tspl4/./objects.html#./objects:s271")
(|boolean?| "http://scheme.com/tspl4/./objects.html#./objects:s14")
(|bound-identifier=?| "http://scheme.com/tspl4/./syntax.html#./syntax:s37")
(|box| "./objects.html#./objects:s80")
(|box-cas!| "./objects.html#./objects:s83")
(|box-immutable| "./objects.html#./objects:s78")
(|box?| "./objects.html#./objects:s79")
(|[| |]| "http://scheme.com/tspl4/./intro.html#./intro:s34")
(|break| "./system.html#./system:s17")
(|break-handler| "./system.html#./system:s19")
(|buffer-mode| "http://scheme.com/tspl4/./io.html#./io:s27")
(|buffer-mode?| "http://scheme.com/tspl4/./io.html#./io:s28")
(|bwp-object?| "./smgmt.html#./smgmt:s28")
(|bytes-allocated| "./system.html#./system:s201")
(|bytes-deallocated| "./system.html#./system:s203")
(|bytevector| "./objects.html#./objects:s59")
(|bytevector->immutable-bytevector| "./objects.html#./objects:s58")
(|bytevector->s8-list| "./objects.html#./objects:s60")
(|bytevector->sint-list| "http://scheme.com/tspl4/./objects.html#./objects:s260")
(|bytevector->string| "http://scheme.com/tspl4/./io.html#./io:s91")
(|bytevector->u8-list| "http://scheme.com/tspl4/./objects.html#./objects:s252")
(|bytevector->uint-list| "http://scheme.com/tspl4/./objects.html#./objects:s260")
(|bytevector-compress| "./objects.html#./objects:s69")
(|bytevector-copy| "http://scheme.com/tspl4/./objects.html#./objects:s246")
(|bytevector-copy!| "http://scheme.com/tspl4/./objects.html#./objects:s247")
(|bytevector-fill!| "http://scheme.com/tspl4/./objects.html#./objects:s245")
(|bytevector-ieee-double-native-ref| "http://scheme.com/tspl4/./objects.html#./objects:s262")
(|bytevector-ieee-double-native-set!| "http://scheme.com/tspl4/./objects.html#./objects:s263")
(|bytevector-ieee-double-ref| "http://scheme.com/tspl4/./objects.html#./objects:s264")
(|bytevector-ieee-double-set!| "http://scheme.com/tspl4/./objects.html#./objects:s265")
(|bytevector-ieee-single-native-ref| "http://scheme.com/tspl4/./objects.html#./objects:s262")
(|bytevector-ieee-single-native-set!| "http://scheme.com/tspl4/./objects.html#./objects:s263")
(|bytevector-ieee-single-ref| "http://scheme.com/tspl4/./objects.html#./objects:s264")
(|bytevector-ieee-single-set!| "http://scheme.com/tspl4/./objects.html#./objects:s265")
(|bytevector-length| "http://scheme.com/tspl4/./objects.html#./objects:s243")
(|bytevector-s16-native-ref| "http://scheme.com/tspl4/./objects.html#./objects:s254")
(|bytevector-s16-native-set!| "http://scheme.com/tspl4/./objects.html#./objects:s255")
(|bytevector-s16-ref| "http://scheme.com/tspl4/./objects.html#./objects:s256")
(|bytevector-s16-set!| "http://scheme.com/tspl4/./objects.html#./objects:s257")
(|bytevector-s24-ref| "./objects.html#./objects:s63")
(|bytevector-s24-set!| "./objects.html#./objects:s64")
(|bytevector-s32-native-ref| "http://scheme.com/tspl4/./objects.html#./objects:s254")
(|bytevector-s32-native-set!| "http://scheme.com/tspl4/./objects.html#./objects:s255")
(|bytevector-s32-ref| "http://scheme.com/tspl4/./objects.html#./objects:s256")
(|bytevector-s32-set!| "http://scheme.com/tspl4/./objects.html#./objects:s257")
(|bytevector-s40-ref| "./objects.html#./objects:s63")
(|bytevector-s40-set!| "./objects.html#./objects:s64")
(|bytevector-s48-ref| "./objects.html#./objects:s63")
(|bytevector-s48-set!| "./objects.html#./objects:s64")
(|bytevector-s56-ref| "./objects.html#./objects:s63")
(|bytevector-s56-set!| "./objects.html#./objects:s64")
(|bytevector-s64-native-ref| "http://scheme.com/tspl4/./objects.html#./objects:s254")
(|bytevector-s64-native-set!| "http://scheme.com/tspl4/./objects.html#./objects:s255")
(|bytevector-s64-ref| "http://scheme.com/tspl4/./objects.html#./objects:s256")
(|bytevector-s64-set!| "http://scheme.com/tspl4/./objects.html#./objects:s257")
(|bytevector-s8-ref| "http://scheme.com/tspl4/./objects.html#./objects:s249")
(|bytevector-s8-set!| "http://scheme.com/tspl4/./objects.html#./objects:s251")
(|bytevector-sint-ref| "http://scheme.com/tspl4/./objects.html#./objects:s258")
(|bytevector-sint-set!| "http://scheme.com/tspl4/./objects.html#./objects:s259")
(|bytevector-truncate!| "./objects.html#./objects:s62")
(|bytevector-u16-native-ref| "http://scheme.com/tspl4/./objects.html#./objects:s254")
(|bytevector-u16-native-set!| "http://scheme.com/tspl4/./objects.html#./objects:s255")
(|bytevector-u16-ref| "http://scheme.com/tspl4/./objects.html#./objects:s256")
(|bytevector-u16-set!| "http://scheme.com/tspl4/./objects.html#./objects:s257")
(|bytevector-u24-ref| "./objects.html#./objects:s63")
(|bytevector-u24-set!| "./objects.html#./objects:s64")
(|bytevector-u32-native-ref| "http://scheme.com/tspl4/./objects.html#./objects:s254")
(|bytevector-u32-native-set!| "http://scheme.com/tspl4/./objects.html#./objects:s255")
(|bytevector-u32-ref| "http://scheme.com/tspl4/./objects.html#./objects:s256")
(|bytevector-u32-set!| "http://scheme.com/tspl4/./objects.html#./objects:s257")
(|bytevector-u40-ref| "./objects.html#./objects:s63")
(|bytevector-u40-set!| "./objects.html#./objects:s64")
(|bytevector-u48-ref| "./objects.html#./objects:s63")
(|bytevector-u48-set!| "./objects.html#./objects:s64")
(|bytevector-u56-ref| "./objects.html#./objects:s63")
(|bytevector-u56-set!| "./objects.html#./objects:s64")
(|bytevector-u64-native-ref| "http://scheme.com/tspl4/./objects.html#./objects:s254")
(|bytevector-u64-native-set!| "http://scheme.com/tspl4/./objects.html#./objects:s255")
(|bytevector-u64-ref| "http://scheme.com/tspl4/./objects.html#./objects:s256")
(|bytevector-u64-set!| "http://scheme.com/tspl4/./objects.html#./objects:s257")
(|bytevector-u8-ref| "http://scheme.com/tspl4/./objects.html#./objects:s248")
(|bytevector-u8-set!| "http://scheme.com/tspl4/./objects.html#./objects:s250")
(|bytevector-uint-ref| "http://scheme.com/tspl4/./objects.html#./objects:s258")
(|bytevector-uint-set!| "http://scheme.com/tspl4/./objects.html#./objects:s259")
(|bytevector-uncompress| "./objects.html#./objects:s70")
(|bytevector=?| "http://scheme.com/tspl4/./objects.html#./objects:s244")
(|bytevector?| "http://scheme.com/tspl4/./objects.html#./objects:s24")
(|caaaar| "http://scheme.com/tspl4/./objects.html#./objects:s42")
(|caaadr| "http://scheme.com/tspl4/./objects.html#./objects:s42")
(|caaar| "http://scheme.com/tspl4/./objects.html#./objects:s42")
(|caadar| "http://scheme.com/tspl4/./objects.html#./objects:s42")
(|caaddr| "http://scheme.com/tspl4/./objects.html#./objects:s42")
(|caadr| "http://scheme.com/tspl4/./objects.html#./objects:s42")
(|caar| "http://scheme.com/tspl4/./objects.html#./objects:s42")
(|caar, cadr, ..., cddddr| "http://scheme.com/tspl4/./start.html#./start:s97")
(|cadaar| "http://scheme.com/tspl4/./objects.html#./objects:s42")
(|cadadr| "http://scheme.com/tspl4/./objects.html#./objects:s42")
(|cadar| "http://scheme.com/tspl4/./objects.html#./objects:s42")
(|caddar| "http://scheme.com/tspl4/./objects.html#./objects:s42")
(|cadddr| "http://scheme.com/tspl4/./objects.html#./objects:s42")
(|caddr| "http://scheme.com/tspl4/./objects.html#./objects:s42")
(|cadr| "http://scheme.com/tspl4/./start.html#./start:s83")
(|call-with-bytevector-output-port| "http://scheme.com/tspl4/./io.html#./io:s38")
(|call-with-current-continuation| "http://scheme.com/tspl4/./control.html#./control:s54")
(|call-with-input-file| "./io.html#./io:s52")
(|call-with-output-file| "./io.html#./io:s70")
(|call-with-port| "http://scheme.com/tspl4/./io.html#./io:s51")
(|call-with-string-output-port| "http://scheme.com/tspl4/./io.html#./io:s39")
(|call-with-values| "http://scheme.com/tspl4/./control.html#./control:s69")
(|call/1cc| "./control.html#./control:s9")
(|call/cc| "http://scheme.com/tspl4/./further.html#./further:s62")
(|car| "http://scheme.com/tspl4/./start.html#./start:s21")
(|case| "./control.html#./control:s1")
(|case-lambda| "./debug.html#./debug:s4")
(|case-sensitive| "./io.html#./io:s101")
(|cd| "./io.html#./io:s127")
(|cdaaar| "http://scheme.com/tspl4/./objects.html#./objects:s42")
(|cdaadr| "http://scheme.com/tspl4/./objects.html#./objects:s42")
(|cdaar| "http://scheme.com/tspl4/./objects.html#./objects:s42")
(|cdadar| "http://scheme.com/tspl4/./objects.html#./objects:s42")
(|cdaddr| "http://scheme.com/tspl4/./objects.html#./objects:s42")
(|cdadr| "http://scheme.com/tspl4/./objects.html#./objects:s42")
(|cdar| "http://scheme.com/tspl4/./objects.html#./objects:s42")
(|cddaar| "http://scheme.com/tspl4/./objects.html#./objects:s42")
(|cddadr| "http://scheme.com/tspl4/./objects.html#./objects:s42")
(|cddar| "http://scheme.com/tspl4/./objects.html#./objects:s42")
(|cdddar| "http://scheme.com/tspl4/./objects.html#./objects:s42")
(|cddddr| "http://scheme.com/tspl4/./objects.html#./objects:s42")
(|cdddr| "http://scheme.com/tspl4/./objects.html#./objects:s42")
(|cddr| "http://scheme.com/tspl4/./start.html#./start:s84")
(|cdr| "http://scheme.com/tspl4/./start.html#./start:s22")
(|ceiling| "http://scheme.com/tspl4/./objects.html#./objects:s103")
(|cfl*| "./numeric.html#./numeric:s38")
(|cfl+| "./numeric.html#./numeric:s38")
(|cfl-| "./numeric.html#./numeric:s38")
(|cfl-conjugate| "./numeric.html#./numeric:s39")
(|cfl-imag-part| "./numeric.html#./numeric:s36")
(|cfl-magnitude-squared| "./numeric.html#./numeric:s41")
(|cfl-real-part| "./numeric.html#./numeric:s36")
(|cfl/| "./numeric.html#./numeric:s38")
(|cfl=| "./numeric.html#./numeric:s37")
(|cflonum?| "./numeric.html#./numeric:s13")
(|char| "./foreign.html#./foreign:s55")
(|char-| "./objects.html#./objects:s16")
(|char->integer| "http://scheme.com/tspl4/./objects.html#./objects:s210")
(|char-alphabetic?| "http://scheme.com/tspl4/./objects.html#./objects:s203")
(|char-ci<=?| "./objects.html#./objects:s15")
(|char-ci<?| "./objects.html#./objects:s15")
(|char-ci=?| "./objects.html#./objects:s15")
(|char-ci>=?| "./objects.html#./objects:s15")
(|char-ci>?| "./objects.html#./objects:s15")
(|char-downcase| "http://scheme.com/tspl4/./objects.html#./objects:s207")
(|char-foldcase| "http://scheme.com/tspl4/./objects.html#./objects:s209")
(|char-general-category| "http://scheme.com/tspl4/./objects.html#./objects:s205")
(|char-lower-case?| "http://scheme.com/tspl4/./objects.html#./objects:s204")
(|char-name| "./objects.html#./objects:s14")
(|char-numeric?| "http://scheme.com/tspl4/./objects.html#./objects:s203")
(|char-ready?| "./io.html#./io:s62")
(|char-title-case?| "http://scheme.com/tspl4/./objects.html#./objects:s204")
(|char-titlecase| "http://scheme.com/tspl4/./objects.html#./objects:s208")
(|char-upcase| "http://scheme.com/tspl4/./objects.html#./objects:s206")
(|char-upper-case?| "http://scheme.com/tspl4/./objects.html#./objects:s204")
(|char-whitespace?| "http://scheme.com/tspl4/./objects.html#./objects:s203")
(|char<=?| "./objects.html#./objects:s15")
(|char<?| "./objects.html#./objects:s15")
(|char=?| "./objects.html#./objects:s15")
(|char>=?| "./objects.html#./objects:s15")
(|char>?| "./objects.html#./objects:s15")
(|char?| "http://scheme.com/tspl4/./objects.html#./objects:s19")
(|chmod| "./io.html#./io:s138")
(|clear-input-port| "./io.html#./io:s34")
(|clear-output-port| "./io.html#./io:s35")
(|close-input-port| "http://scheme.com/tspl4/./io.html#./io:s88")
(|close-output-port| "http://scheme.com/tspl4/./io.html#./io:s88")
(|close-port| "http://scheme.com/tspl4/./io.html#./io:s46")
(|collect| "./smgmt.html#./smgmt:s3")
(|collect-generation-radix| "./smgmt.html#./smgmt:s15")
(|collect-maximum-generation| "./smgmt.html#./smgmt:s8")
(|collect-notify| "./smgmt.html#./smgmt:s11")
(|collect-rendezvous| "./smgmt.html#./smgmt:s10")
(|collect-request-handler| "./smgmt.html#./smgmt:s4")
(|collect-trip-bytes| "./smgmt.html#./smgmt:s2")
(|collections| "./system.html#./system:s207")
(|command-line| "./system.html#./system:s165")
(|command-line-arguments| "./system.html#./system:s166")
(|commonization-level| "./system.html#./system:s115")
(|compile| "./system.html#./system:s41")
(|compile-compressed| "./system.html#./system:s59")
(|compile-file| "./use.html#./use:s5")
(|compile-file-message| "./system.html#./system:s112")
(|compile-imported-libraries| "./use.html#./use:s19")
(|compile-interpret-simple| "./system.html#./system:s104")
(|compile-library| "./use.html#./use:s23")
(|compile-library-handler| "./system.html#./system:s65")
(|compile-port| "./system.html#./system:s72")
(|compile-profile| "./system.html#./system:s124")
(|compile-program| "./use.html#./use:s25")
(|compile-program-handler| "./system.html#./system:s67")
(|compile-script| "./use.html#./use:s32")
(|compile-to-file| "./system.html#./system:s66")
(|compile-to-port| "./system.html#./system:s73")
(|compile-whole-library| "./system.html#./system:s71")
(|compile-whole-program| "./use.html#./use:s67")
(|complex?| "http://scheme.com/tspl4/./objects.html#./objects:s17")
(|compose| "http://scheme.com/tspl4/./start.html#./start:s95")
(|compute-composition| "./debug.html#./debug:s31")
(|compute-size| "./debug.html#./debug:s23")
(|cond| "./compat.html#./compat:s17")
(|condition| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s15")
(|condition-accessor| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s18")
(|condition-broadcast| "./threads.html#./threads:s15")
(|condition-continuation| "./system.html#./system:s6")
(|condition-irritants| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s25")
(|condition-message| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s24")
(|condition-predicate| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s18")
(|condition-signal| "./threads.html#./threads:s14")
(|condition-wait| "./threads.html#./threads:s13")
(|condition-who| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s26")
(|condition?| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s14")
(|conjugate| "./numeric.html#./numeric:s40")
(|cons| "http://scheme.com/tspl4/./start.html#./start:s25")
(|cons*| "http://scheme.com/tspl4/./objects.html#./objects:s44")
(|console-error-port| "./io.html#./io:s67")
(|console-input-port| "./io.html#./io:s49")
(|console-output-port| "./io.html#./io:s65")
(|constructor| "./objects.html#./objects:s171")
(|continuation-condition?| "./system.html#./system:s6")
(|copy-environment| "./system.html#./system:s34")
(|copy-time| "./system.html#./system:s186")
(|cos| "http://scheme.com/tspl4/./objects.html#./objects:s131")
(|cosh| "./numeric.html#./numeric:s76")
(|cost-center-allocation-count| "./system.html#./system:s223")
(|cost-center-instruction-count| "./system.html#./system:s222")
(|cost-center-time| "./system.html#./system:s224")
(|cost-center?| "./system.html#./system:s220")
(|cp0-effort-limit| "./system.html#./system:s113")
(|cp0-outer-unroll-limit| "./system.html#./system:s113")
(|cp0-score-limit| "./system.html#./system:s113")
(|cpu-time| "./system.html#./system:s199")
(|create-exception-state| "./system.html#./system:s15")
(|critical-section| "./system.html#./system:s27")
(|current-date| "./system.html#./system:s188")
(|current-directory| "./io.html#./io:s127")
(|current-error-port| "./io.html#./io:s68")
(|current-eval| "./system.html#./system:s39")
(|current-exception-state| "./system.html#./system:s14")
(|current-expand| "./system.html#./system:s84")
(|current-input-port| "./io.html#./io:s50")
(|current-locate-source-object-source| "./syntax.html#./syntax:s72")
(|current-make-source-object| "./syntax.html#./syntax:s60")
(|current-memory-bytes| "./system.html#./system:s204")
(|current-output-port| "./io.html#./io:s66")
(|current-time| "./system.html#./system:s180")
(|current-transcoder| "./io.html#./io:s9")
(|custom-port-buffer-size| "./io.html#./io:s48")
(|d| "http://scheme.com/tspl4/./objects.html#./objects:s84")
(|date->time-utc| "./system.html#./system:s194")
(|date-and-time| "./system.html#./system:s195")
(|date-day| "./system.html#./system:s191")
(|date-dst?| "./system.html#./system:s193")
(|date-hour| "./system.html#./system:s191")
(|date-minute| "./system.html#./system:s191")
(|date-month| "./system.html#./system:s191")
(|date-nanosecond| "./system.html#./system:s191")
(|date-second| "./system.html#./system:s191")
(|date-week-day| "./system.html#./system:s192")
(|date-year| "./system.html#./system:s191")
(|date-year-day| "./system.html#./system:s192")
(|date-zone-name| "./system.html#./system:s193")
(|date-zone-offset| "./system.html#./system:s191")
(|date?| "./system.html#./system:s190")
(|datum| "./syntax.html#./syntax:s9")
(|#;| "http://scheme.com/tspl4/./grammar.html#./grammar:s9")
(|datum->syntax| "./compat.html#./compat:s30")
(|datum->syntax-object| "./syntax.html#./syntax:s10")
(|debug| "./debug.html#./debug:s16")
(|debug-condition| "./system.html#./system:s13")
(|debug-level| "./system.html#./system:s102")
(|debug-on-exception| "./use.html#./use:s2")
(|decode-float| "./numeric.html#./numeric:s30")
(|default-exception-handler| "./system.html#./system:s8")
(|default-prompt-and-read| "./system.html#./system:s154")
(|default-record-equal-procedure| "./objects.html#./objects:s144")
(|default-record-hash-procedure| "./objects.html#./objects:s150")
(|define| "./binding.html#./binding:s1")
(|define-condition-type| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s17")
(|define-enumeration| "http://scheme.com/tspl4/./objects.html#./objects:s290")
(|define-ftype| "./foreign.html#./foreign:s137")
(|define-integrable| "./syntax.html#./syntax:s2")
(|define-object| "http://scheme.com/tspl4/./examples.html#./examples:s63")
(|define-property| "./syntax.html#./syntax:s16")
(|define-record| "./objects.html#./objects:s158")
(|define-record-type| "./objects.html#./objects:s135")
(|define-structure| "./compat.html#./compat:s25")
(|define-syntax| "./binding.html#./binding:s3")
(|define-top-level-syntax| "./binding.html#./binding:s32")
(|define-top-level-value| "./binding.html#./binding:s24")
(|define-values| "./binding.html#./binding:s16")
(|delay| "http://scheme.com/tspl4/./control.html#./control:s65")
(|delete-directory| "./io.html#./io:s136")
(|delete-file| "./io.html#./io:s135")
(|delq!| "http://scheme.com/tspl4/./start.html#./start:s185")
(|denominator| "http://scheme.com/tspl4/./objects.html#./objects:s119")
(|describe-segment| "http://scheme.com/tspl4/./control.html#./control:s75")
(|directory-list| "./io.html#./io:s128")
(|directory-separator| "./io.html#./io:s141")
(|directory-separator?| "./io.html#./io:s140")
(|disable-interrupts| "./system.html#./system:s26")
(|display| "http://scheme.com/tspl4/./io.html#./io:s85")
(|display-condition| "./system.html#./system:s7")
(|display-statistics| "./system.html#./system:s198")
(|display-string| "./io.html#./io:s77")
(|div| "http://scheme.com/tspl4/./objects.html#./objects:s99")
(|div-and-mod| "http://scheme.com/tspl4/./objects.html#./objects:s99")
(|div0| "http://scheme.com/tspl4/./objects.html#./objects:s100")
(|div0-and-mod0| "http://scheme.com/tspl4/./objects.html#./objects:s100")
(|divisors| "http://scheme.com/tspl4/./control.html#./control:s24")
(|do| "./debug.html#./debug:s8")
(|.| "http://scheme.com/tspl4/./start.html#./start:s31")
(|double| "./foreign.html#./foreign:s58")
(|double-any| "http://scheme.com/tspl4/./start.html#./start:s79")
(|double-cons| "http://scheme.com/tspl4/./start.html#./start:s66")
(|double-float| "./foreign.html#./foreign:s36")
(|doubler| "http://scheme.com/tspl4/./start.html#./start:s88")
(|drop-prefix| "./syntax.html#./syntax:s20")
(|dxdy| "http://scheme.com/tspl4/./control.html#./control:s72")
(|dynamic-wind| "./control.html#./control:s11")
(|ee-accept| "./expeditor.html#./expeditor:s66")
(|ee-auto-indent| "./expeditor.html#./expeditor:s1")
(|ee-auto-paren-balance| "./expeditor.html#./expeditor:s3")
(|ee-backward-char| "./expeditor.html#./expeditor:s23")
(|ee-backward-delete-char| "./expeditor.html#./expeditor:s44")
(|ee-backward-delete-sexp| "./expeditor.html#./expeditor:s51")
(|ee-backward-page| "./expeditor.html#./expeditor:s42")
(|ee-backward-sexp| "./expeditor.html#./expeditor:s38")
(|ee-backward-word| "./expeditor.html#./expeditor:s40")
(|ee-beginning-of-entry| "./expeditor.html#./expeditor:s31")
(|ee-beginning-of-line| "./expeditor.html#./expeditor:s29")
(|ee-bind-key| "./expeditor.html#./expeditor:s10")
(|ee-command-repeat| "./expeditor.html#./expeditor:s71")
(|ee-common-identifiers| "./expeditor.html#./expeditor:s9")
(|ee-compose| "./expeditor.html#./expeditor:s12")
(|ee-default-repeat| "./expeditor.html#./expeditor:s6")
(|ee-delete-between-point-and-mark| "./expeditor.html#./expeditor:s47")
(|ee-delete-char| "./expeditor.html#./expeditor:s43")
(|ee-delete-entry| "./expeditor.html#./expeditor:s48")
(|ee-delete-line| "./expeditor.html#./expeditor:s45")
(|ee-delete-sexp| "./expeditor.html#./expeditor:s50")
(|ee-delete-to-eol| "./expeditor.html#./expeditor:s46")
(|ee-end-of-entry| "./expeditor.html#./expeditor:s32")
(|ee-end-of-line| "./expeditor.html#./expeditor:s30")
(|ee-eof| "./expeditor.html#./expeditor:s67")
(|ee-eof/delete-char| "./expeditor.html#./expeditor:s76")
(|ee-exchange-point-and-mark| "./expeditor.html#./expeditor:s36")
(|ee-flash-matching-delimiter| "./expeditor.html#./expeditor:s34")
(|ee-flash-parens| "./expeditor.html#./expeditor:s4")
(|ee-forward-char| "./expeditor.html#./expeditor:s24")
(|ee-forward-page| "./expeditor.html#./expeditor:s41")
(|ee-forward-sexp| "./expeditor.html#./expeditor:s37")
(|ee-forward-word| "./expeditor.html#./expeditor:s39")
(|ee-goto-matching-delimiter| "./expeditor.html#./expeditor:s33")
(|ee-history-bwd| "./expeditor.html#./expeditor:s28")
(|ee-history-bwd-contains| "./expeditor.html#./expeditor:s62")
(|ee-history-bwd-prefix| "./expeditor.html#./expeditor:s60")
(|ee-history-fwd| "./expeditor.html#./expeditor:s26")
(|ee-history-fwd-contains| "./expeditor.html#./expeditor:s63")
(|ee-history-fwd-prefix| "./expeditor.html#./expeditor:s61")
(|ee-history-limit| "./expeditor.html#./expeditor:s8")
(|ee-id-completion| "./expeditor.html#./expeditor:s52")
(|ee-id-completion/indent| "./expeditor.html#./expeditor:s53")
(|ee-indent| "./expeditor.html#./expeditor:s64")
(|ee-indent-all| "./expeditor.html#./expeditor:s65")
(|ee-insert-paren| "./expeditor.html#./expeditor:s14")
(|ee-insert-self| "./expeditor.html#./expeditor:s13")
(|ee-newline| "./expeditor.html#./expeditor:s18")
(|ee-newline/accept| "./expeditor.html#./expeditor:s73")
(|ee-next-id-completion| "./expeditor.html#./expeditor:s54")
(|ee-next-id-completion/indent| "./expeditor.html#./expeditor:s56")
(|ee-next-line| "./expeditor.html#./expeditor:s25")
(|ee-noisy| "./expeditor.html#./expeditor:s7")
(|ee-open-line| "./expeditor.html#./expeditor:s20")
(|ee-paren-flash-delay| "./expeditor.html#./expeditor:s5")
(|ee-previous-line| "./expeditor.html#./expeditor:s27")
(|ee-redisplay| "./expeditor.html#./expeditor:s68")
(|ee-reset-entry| "./expeditor.html#./expeditor:s49")
(|ee-set-mark| "./expeditor.html#./expeditor:s70")
(|ee-standard-indent| "./expeditor.html#./expeditor:s2")
(|ee-string-macro| "./expeditor.html#./expeditor:s11")
(|ee-suspend-process| "./expeditor.html#./expeditor:s69")
(|ee-yank-kill-buffer| "./expeditor.html#./expeditor:s21")
(|ee-yank-selection| "./expeditor.html#./expeditor:s22")
(|...| "./io.html#./io:s108")
(|...| "http://scheme.com/tspl4/./further.html#./further:s21")
(|else| "./control.html#./control:s2")
(|enable-cross-library-optimization| "./system.html#./system:s108")
(|enable-interrupts| "./system.html#./system:s26")
(|enable-object-counts| "./system.html#./system:s215")
(|endianness| "http://scheme.com/tspl4/./objects.html#./objects:s240")
(|engine-block| "./control.html#./control:s27")
(|engine-return| "./control.html#./control:s28")
(|enum-set->list| "http://scheme.com/tspl4/./objects.html#./objects:s294")
(|enum-set-complement| "http://scheme.com/tspl4/./objects.html#./objects:s299")
(|enum-set-constructor| "http://scheme.com/tspl4/./objects.html#./objects:s292")
(|enum-set-difference| "http://scheme.com/tspl4/./objects.html#./objects:s298")
(|enum-set-indexer| "http://scheme.com/tspl4/./objects.html#./objects:s301")
(|enum-set-intersection| "http://scheme.com/tspl4/./objects.html#./objects:s298")
(|enum-set-member?| "http://scheme.com/tspl4/./objects.html#./objects:s297")
(|enum-set-projection| "http://scheme.com/tspl4/./objects.html#./objects:s300")
(|enum-set-subset?| "http://scheme.com/tspl4/./objects.html#./objects:s295")
(|enum-set-union| "http://scheme.com/tspl4/./objects.html#./objects:s298")
(|enum-set-universe| "http://scheme.com/tspl4/./objects.html#./objects:s293")
(|enum-set=?| "http://scheme.com/tspl4/./objects.html#./objects:s296")
(|enum-set?| "./objects.html#./objects:s0")
(|enumerate| "./objects.html#./objects:s9")
(|environment| "http://scheme.com/tspl4/./control.html#./control:s81")
(|environment-mutable?| "./system.html#./system:s30")
(|environment-symbols| "./system.html#./system:s35")
(|environment?| "./system.html#./system:s29")
(|eof-object| "http://scheme.com/tspl4/./io.html#./io:s54")
(|eof-object?| "http://scheme.com/tspl4/./io.html#./io:s5")
(|eol-style| "http://scheme.com/tspl4/./io.html#./io:s23")
(|ephemeron-cons| "./smgmt.html#./smgmt:s26")
(|ephemeron-pair?| "./smgmt.html#./smgmt:s27")
(|eq-hashtable-cell| "./objects.html#./objects:s126")
(|eq-hashtable-contains?| "./objects.html#./objects:s124")
(|eq-hashtable-delete!| "./objects.html#./objects:s127")
(|eq-hashtable-ephemeron?| "./objects.html#./objects:s121")
(|eq-hashtable-ref| "./objects.html#./objects:s123")
(|eq-hashtable-set!| "./objects.html#./objects:s122")
(|eq-hashtable-update!| "./objects.html#./objects:s125")
(|eq-hashtable-weak?| "./objects.html#./objects:s120")
(|eq-hashtable?| "./objects.html#./objects:s119")
(|eq?| "http://scheme.com/tspl4/./objects.html#./objects:s10")
(|equal-hash| "./objects.html#./objects:s147")
(|equal-hash| "./objects.html#./objects:s146")
(|equal?| "./objects.html#./objects:s141")
(|equal?| "./objects.html#./objects:s140")
(|eqv?| "http://scheme.com/tspl4/./start.html#./start:s116")
(|error| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s4")
(|error-handling-mode| "http://scheme.com/tspl4/./io.html#./io:s25")
(|error?| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s22")
(|errorf| "./system.html#./system:s2")
(|eval| "./system.html#./system:s38")
(|eval-syntax-expanders-when| "./system.html#./system:s93")
(|eval-when| "./system.html#./system:s90")
(|even?| "http://scheme.com/tspl4/./start.html#./start:s160")
(|exact| "./numeric.html#./numeric:s27")
(|exact->inexact| "http://scheme.com/tspl4/./objects.html#./objects:s116")
(|exact-integer-sqrt| "http://scheme.com/tspl4/./objects.html#./objects:s128")
(|exact?| "http://scheme.com/tspl4/./objects.html#./objects:s73")
(|except| "./syntax.html#./syntax:s20")
(|except| "http://scheme.com/tspl4/./libraries.html#./libraries:s10")
(|!| "http://scheme.com/tspl4/./intro.html#./intro:s51")
(|exclusive-cond| "./control.html#./control:s0")
(|exists| "http://scheme.com/tspl4/./control.html#./control:s36")
(|exit| "./system.html#./system:s158")
(|exit-handler| "./system.html#./system:s159")
(|exp| "http://scheme.com/tspl4/./objects.html#./objects:s129")
(|expand| "./system.html#./system:s82")
(|expand-output| "./system.html#./system:s83")
(|expand/optimize| "./system.html#./system:s88")
(|expand/optimize-output| "./system.html#./system:s89")
;; "./libraries.html#./libraries:s17")
(|expression-editor| "./expeditor.html#./expeditor:s0")
(|expt| "http://scheme.com/tspl4/./objects.html#./objects:s111")
(|expt-mod| "./numeric.html#./numeric:s69")
(|extend-syntax| "./compat.html#./compat:s8")
(|f| "http://scheme.com/tspl4/./objects.html#./objects:s83")
(|factor| "http://scheme.com/tspl4/./further.html#./further:s51")
(|factorial| "http://scheme.com/tspl4/./further.html#./further:s46")
(|fasl-file| "./io.html#./io:s126")
(|fasl-read| "./io.html#./io:s125")
(|fasl-strip-options| "./system.html#./system:s80")
(|fasl-write| "./io.html#./io:s125")
(|fibonacci| "./control.html#./control:s22")
(|fields| "http://scheme.com/tspl4/./records.html#./records:s16")
(|file-access-time| "./io.html#./io:s133")
(|file-buffer-size| "./io.html#./io:s45")
(|file-change-time| "./io.html#./io:s133")
(|file-directory?| "./io.html#./io:s131")
(|file-exists?| "./io.html#./io:s129")
(|file-length| "./io.html#./io:s29")
(|file-modification-time| "./io.html#./io:s133")
(|file-options| "http://scheme.com/tspl4/./io.html#./io:s26")
(|file-port?| "./io.html#./io:s46")
(|file-position| "./io.html#./io:s33")
(|file-regular?| "./io.html#./io:s130")
(|file-symbolic-link?| "./io.html#./io:s132")
(|filter| "http://scheme.com/tspl4/./objects.html#./objects:s55")
(|find| "http://scheme.com/tspl4/./objects.html#./objects:s57")
(|finite?| "http://scheme.com/tspl4/./objects.html#./objects:s97")
(|fixnum| "./foreign.html#./foreign:s53")
(|fixnum->flonum| "http://scheme.com/tspl4/./objects.html#./objects:s198")
(|fixnum-width| "http://scheme.com/tspl4/./objects.html#./objects:s152")
(|fixnum?| "http://scheme.com/tspl4/./objects.html#./objects:s150")
(|fl*| "http://scheme.com/tspl4/./objects.html#./objects:s186")
(|fl+| "http://scheme.com/tspl4/./objects.html#./objects:s184")
(|fl-| "http://scheme.com/tspl4/./objects.html#./objects:s185")
(|fl-make-rectangular| "./numeric.html#./numeric:s35")
(|fl/| "http://scheme.com/tspl4/./objects.html#./objects:s187")
(|fl<| "./numeric.html#./numeric:s28")
(|fl<=| "./numeric.html#./numeric:s28")
(|fl<=?| "http://scheme.com/tspl4/./objects.html#./objects:s178")
(|fl<?| "http://scheme.com/tspl4/./objects.html#./objects:s178")
(|fl=| "./numeric.html#./numeric:s28")
(|fl=?| "http://scheme.com/tspl4/./objects.html#./objects:s178")
(|fl>| "./numeric.html#./numeric:s28")
(|fl>=| "./numeric.html#./numeric:s28")
(|fl>=?| "http://scheme.com/tspl4/./objects.html#./objects:s178")
(|fl>?| "http://scheme.com/tspl4/./objects.html#./objects:s178")
(|flabs| "http://scheme.com/tspl4/./objects.html#./objects:s192")
(|flacos| "http://scheme.com/tspl4/./objects.html#./objects:s195")
(|flasin| "http://scheme.com/tspl4/./objects.html#./objects:s195")
(|flatan| "http://scheme.com/tspl4/./objects.html#./objects:s195")
(|flceiling| "http://scheme.com/tspl4/./objects.html#./objects:s190")
(|flcos| "http://scheme.com/tspl4/./objects.html#./objects:s194")
(|fldenominator| "http://scheme.com/tspl4/./objects.html#./objects:s191")
(|fldiv| "http://scheme.com/tspl4/./objects.html#./objects:s188")
(|fldiv-and-mod| "http://scheme.com/tspl4/./objects.html#./objects:s188")
(|fldiv0| "http://scheme.com/tspl4/./objects.html#./objects:s189")
(|fldiv0-and-mod0| "http://scheme.com/tspl4/./objects.html#./objects:s189")
(|fleven?| "http://scheme.com/tspl4/./objects.html#./objects:s182")
(|flexp| "http://scheme.com/tspl4/./objects.html#./objects:s193")
(|flexpt| "http://scheme.com/tspl4/./objects.html#./objects:s197")
(|flfinite?| "http://scheme.com/tspl4/./objects.html#./objects:s181")
(|flfloor| "http://scheme.com/tspl4/./objects.html#./objects:s190")
(|flinfinite?| "http://scheme.com/tspl4/./objects.html#./objects:s181")
(|flinteger?| "http://scheme.com/tspl4/./objects.html#./objects:s180")
(|flip-flop| "http://scheme.com/tspl4/./binding.html#./binding:s31")
(|fllog| "http://scheme.com/tspl4/./objects.html#./objects:s193")
(|fllp| "./numeric.html#./numeric:s31")
(|flmax| "http://scheme.com/tspl4/./objects.html#./objects:s183")
(|flmin| "http://scheme.com/tspl4/./objects.html#./objects:s183")
(|flmod| "http://scheme.com/tspl4/./objects.html#./objects:s188")
(|flmod0| "http://scheme.com/tspl4/./objects.html#./objects:s189")
(|flnan?| "http://scheme.com/tspl4/./objects.html#./objects:s181")
(|flnegative?| "http://scheme.com/tspl4/./objects.html#./objects:s179")
(|flnonnegative?| "./numeric.html#./numeric:s29")
(|flnonpositive?| "./numeric.html#./numeric:s29")
(|flnumerator| "http://scheme.com/tspl4/./objects.html#./objects:s191")
(|float| "./foreign.html#./foreign:s59")
(|flodd?| "http://scheme.com/tspl4/./objects.html#./objects:s182")
(|flonum->fixnum| "./numeric.html#./numeric:s26")
(|flonum?| "http://scheme.com/tspl4/./objects.html#./objects:s177")
(|floor| "http://scheme.com/tspl4/./objects.html#./objects:s102")
(|flpositive?| "http://scheme.com/tspl4/./objects.html#./objects:s179")
(|flround| "http://scheme.com/tspl4/./objects.html#./objects:s190")
(|flsin| "http://scheme.com/tspl4/./objects.html#./objects:s194")
(|flsqrt| "http://scheme.com/tspl4/./objects.html#./objects:s196")
(|fltan| "http://scheme.com/tspl4/./objects.html#./objects:s194")
(|fltruncate| "http://scheme.com/tspl4/./objects.html#./objects:s190")
(|fluid-let| "./binding.html#./binding:s19")
(|fluid-let-syntax| "./syntax.html#./syntax:s0")
(|flush-output-port| "./io.html#./io:s36")
(|flzero?| "http://scheme.com/tspl4/./objects.html#./objects:s179")
(|fold-left| "http://scheme.com/tspl4/./control.html#./control:s38")
(|fold-right| "http://scheme.com/tspl4/./control.html#./control:s41")
(|for-all| "http://scheme.com/tspl4/./control.html#./control:s37")
(|for-each| "http://scheme.com/tspl4/./control.html#./control:s33")
(|force| "http://scheme.com/tspl4/./control.html#./control:s65")
(|foreign-address-name| "./foreign.html#./foreign:s159")
(|foreign-alloc| "./foreign.html#./foreign:s132")
(|foreign-callable| "./foreign.html#./foreign:s127")
(|foreign-callable-code-object| "./foreign.html#./foreign:s131")
(|foreign-callable-entry-point| "./foreign.html#./foreign:s128")
(|foreign-entry| "./foreign.html#./foreign:s158")
(|foreign-entry?| "./foreign.html#./foreign:s157")
(|foreign-free| "./foreign.html#./foreign:s133")
(|foreign-procedure| "./foreign.html#./foreign:s10")
(|foreign-ref| "./foreign.html#./foreign:s134")
(|foreign-set!| "./foreign.html#./foreign:s135")
(|foreign-sizeof| "./foreign.html#./foreign:s136")
(|fork-thread| "./threads.html#./threads:s2")
(|format| "./io.html#./io:s96")
(|format-condition?| "./system.html#./system:s4")
(|fprintf| "./io.html#./io:s98")
(|free-identifier=?| "./use.html#./use:s13")
(|frequency| "http://scheme.com/tspl4/./examples.html#./examples:s24")
(|fresh-line| "./io.html#./io:s80")
(|ftype-&ref| "./foreign.html#./foreign:s151")
(|ftype-init-lock!| "./threads.html#./threads:s17")
(|ftype-lock!| "./threads.html#./threads:s17")
(|ftype-locked-decr!| "./threads.html#./threads:s18")
(|ftype-locked-incr!| "./threads.html#./threads:s18")
(|ftype-pointer->sexpr| "./foreign.html#./foreign:s156")
(|ftype-pointer-address| "./foreign.html#./foreign:s148")
(|ftype-pointer-ftype| "./foreign.html#./foreign:s155")
(|ftype-pointer-null?| "./foreign.html#./foreign:s150")
(|ftype-pointer=?| "./foreign.html#./foreign:s149")
(|ftype-pointer?| "./foreign.html#./foreign:s147")
(|ftype-ref| "./foreign.html#./foreign:s152")
(|ftype-set!| "./foreign.html#./foreign:s152")
(|ftype-sizeof| "./foreign.html#./foreign:s142")
(|ftype-spin-lock!| "./threads.html#./threads:s17")
(|ftype-unlock!| "./threads.html#./threads:s17")
(|fx*| "./numeric.html#./numeric:s19")
(|fx*/carry| "http://scheme.com/tspl4/./objects.html#./objects:s162")
(|fx+| "./numeric.html#./numeric:s17")
(|fx+/carry| "http://scheme.com/tspl4/./objects.html#./objects:s162")
(|fx-| "./numeric.html#./numeric:s18")
(|fx-/carry| "http://scheme.com/tspl4/./objects.html#./objects:s162")
(|fx/| "./numeric.html#./numeric:s20")
(|fx<| "./numeric.html#./numeric:s15")
(|fx<=| "./numeric.html#./numeric:s15")
(|fx<=?| "http://scheme.com/tspl4/./objects.html#./objects:s153")
(|fx<?| "http://scheme.com/tspl4/./objects.html#./objects:s153")
(|fx=| "./numeric.html#./numeric:s15")
(|fx=?| "http://scheme.com/tspl4/./objects.html#./objects:s153")
(|fx>| "./numeric.html#./numeric:s15")
(|fx>=| "./numeric.html#./numeric:s15")
(|fx>=?| "http://scheme.com/tspl4/./objects.html#./objects:s153")
(|fx>?| "http://scheme.com/tspl4/./objects.html#./objects:s153")
(|fx1+| "./numeric.html#./numeric:s21")
(|fx1-| "./numeric.html#./numeric:s21")
(|fxabs| "./numeric.html#./numeric:s25")
(|fxand| "http://scheme.com/tspl4/./objects.html#./objects:s163")
(|fxarithmetic-shift| "http://scheme.com/tspl4/./objects.html#./objects:s173")
(|fxarithmetic-shift-left| "http://scheme.com/tspl4/./objects.html#./objects:s172")
(|fxarithmetic-shift-right| "http://scheme.com/tspl4/./objects.html#./objects:s172")
(|fxbit-count| "http://scheme.com/tspl4/./objects.html#./objects:s165")
(|fxbit-field| "http://scheme.com/tspl4/./objects.html#./objects:s170")
(|fxbit-set?| "http://scheme.com/tspl4/./objects.html#./objects:s168")
(|fxcopy-bit| "http://scheme.com/tspl4/./objects.html#./objects:s169")
(|fxcopy-bit-field| "http://scheme.com/tspl4/./objects.html#./objects:s171")
(|fxdiv| "http://scheme.com/tspl4/./objects.html#./objects:s160")
(|fxdiv-and-mod| "http://scheme.com/tspl4/./objects.html#./objects:s160")
(|fxdiv0| "http://scheme.com/tspl4/./objects.html#./objects:s161")
(|fxdiv0-and-mod0| "http://scheme.com/tspl4/./objects.html#./objects:s161")
(|fxeven?| "http://scheme.com/tspl4/./objects.html#./objects:s155")
(|fxfirst-bit-set| "http://scheme.com/tspl4/./objects.html#./objects:s167")
(|fxif| "http://scheme.com/tspl4/./objects.html#./objects:s164")
(|fxior| "http://scheme.com/tspl4/./objects.html#./objects:s163")
(|fxlength| "http://scheme.com/tspl4/./objects.html#./objects:s166")
(|fxlogand| "./numeric.html#./numeric:s53")
(|fxlogbit?| "./numeric.html#./numeric:s57")
(|fxlogbit0| "./numeric.html#./numeric:s59")
(|fxlogbit1| "./numeric.html#./numeric:s60")
(|fxlogior| "./numeric.html#./numeric:s54")
(|fxlognot| "./numeric.html#./numeric:s56")
(|fxlogor| "./numeric.html#./numeric:s54")
(|fxlogtest| "./numeric.html#./numeric:s58")
(|fxlogxor| "./numeric.html#./numeric:s55")
(|fxmax| "http://scheme.com/tspl4/./objects.html#./objects:s156")
(|fxmin| "http://scheme.com/tspl4/./objects.html#./objects:s156")
(|fxmod| "http://scheme.com/tspl4/./objects.html#./objects:s160")
(|fxmod0| "http://scheme.com/tspl4/./objects.html#./objects:s161")
(|fxmodulo| "./numeric.html#./numeric:s24")
(|fxnegative?| "http://scheme.com/tspl4/./objects.html#./objects:s154")
(|fxnonnegative?| "./numeric.html#./numeric:s16")
(|fxnonpositive?| "./numeric.html#./numeric:s16")
(|fxnot| "http://scheme.com/tspl4/./objects.html#./objects:s163")
(|fxodd?| "http://scheme.com/tspl4/./objects.html#./objects:s155")
(|fxpositive?| "http://scheme.com/tspl4/./objects.html#./objects:s154")
(|fxquotient| "./numeric.html#./numeric:s22")
(|fxremainder| "./numeric.html#./numeric:s23")
(|fxreverse-bit-field| "http://scheme.com/tspl4/./objects.html#./objects:s175")
(|fxrotate-bit-field| "http://scheme.com/tspl4/./objects.html#./objects:s174")
(|fxsll| "./numeric.html#./numeric:s61")
(|fxsra| "./numeric.html#./numeric:s63")
(|fxsrl| "./numeric.html#./numeric:s62")
(|fxvector| "./objects.html#./objects:s43")
(|fxvector->immutable-fxvector| "./objects.html#./objects:s41")
(|fxvector->list| "./objects.html#./objects:s49")
(|fxvector-copy| "./objects.html#./objects:s51")
(|fxvector-fill!| "./objects.html#./objects:s48")
(|fxvector-length| "./objects.html#./objects:s45")
(|fxvector-ref| "./objects.html#./objects:s46")
(|fxvector-set!| "./objects.html#./objects:s47")
(|fxvector?| "./objects.html#./objects:s42")
(|fxxor| "http://scheme.com/tspl4/./objects.html#./objects:s163")
(|fxzero?| "http://scheme.com/tspl4/./objects.html#./objects:s154")
(|gcd| "http://scheme.com/tspl4/./objects.html#./objects:s109")
(|generate-allocation-counts| "./system.html#./system:s217")
(|generate-inspector-information| "./use.html#./use:s64")
(|generate-instruction-counts| "./system.html#./system:s218")
(|generate-interrupt-trap| "./system.html#./system:s103")
(|generate-procedure-source-information| "./system.html#./system:s107")
(|generate-profile-forms| "./system.html#./system:s134")
(|generate-temporaries| "http://scheme.com/tspl4/./syntax.html#./syntax:s49")
(|generate-wpo-files| "./system.html#./system:s70")
(|gensym| "./objects.html#./objects:s90")
(|gensym->unique-string| "./objects.html#./objects:s100")
(|gensym-count| "./objects.html#./objects:s98")
(|gensym-prefix| "./objects.html#./objects:s98")
(|gensym?| "./objects.html#./objects:s101")
(|get-bytevector-all| "http://scheme.com/tspl4/./io.html#./io:s60")
(|get-bytevector-n| "http://scheme.com/tspl4/./io.html#./io:s57")
(|get-bytevector-n!| "http://scheme.com/tspl4/./io.html#./io:s58")
(|get-bytevector-some| "http://scheme.com/tspl4/./io.html#./io:s59")
(|get-bytevector-some!| "./io.html#./io:s58")
(|get-char| "http://scheme.com/tspl4/./io.html#./io:s61")
(|get-datum| "http://scheme.com/tspl4/./io.html#./io:s67")
(|get-datum/annotations| "./syntax.html#./syntax:s44")
(|get-hash-table| "./compat.html#./compat:s3")
(|get-line| "http://scheme.com/tspl4/./io.html#./io:s66")
(|get-mode| "./io.html#./io:s139")
(|get-output-string| "./io.html#./io:s43")
(|get-process-id| "./system.html#./system:s237")
(|get-property| "./syntax.html#./syntax:s17")
(|get-registry| "./system.html#./system:s240")
(|get-string-all| "http://scheme.com/tspl4/./io.html#./io:s65")
(|get-string-n| "http://scheme.com/tspl4/./io.html#./io:s63")
(|get-string-n!| "http://scheme.com/tspl4/./io.html#./io:s64")
(|get-string-some| "./io.html#./io:s56")
(|get-string-some!| "./io.html#./io:s57")
(|get-thread-id| "./threads.html#./threads:s4")
(|get-u8| "http://scheme.com/tspl4/./io.html#./io:s55")
(|getenv| "./system.html#./system:s238")
(|getprop| "./objects.html#./objects:s104")
(|getq| "http://scheme.com/tspl4/./start.html#./start:s184")
(|goodbye| "http://scheme.com/tspl4/./start.html#./start:s133")
(|greatest-fixnum| "http://scheme.com/tspl4/./objects.html#./objects:s151")
(|guard| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s8")
(|half| "./debug.html#./debug:s2")
(|hash-table-for-each| "./compat.html#./compat:s6")
(|hash-table-map| "./compat.html#./compat:s5")
(|hash-table?| "./compat.html#./compat:s1")
(|hashtable-cell| "./objects.html#./objects:s113")
(|hashtable-clear!| "http://scheme.com/tspl4/./objects.html#./objects:s287")
(|hashtable-contains?| "http://scheme.com/tspl4/./objects.html#./objects:s282")
(|hashtable-copy| "http://scheme.com/tspl4/./objects.html#./objects:s286")
(|hashtable-delete!| "http://scheme.com/tspl4/./objects.html#./objects:s284")
(|hashtable-entries| "http://scheme.com/tspl4/./objects.html#./objects:s289")
(|hashtable-ephemeron?| "./objects.html#./objects:s118")
(|hashtable-equivalence-function| "http://scheme.com/tspl4/./objects.html#./objects:s278")
(|hashtable-hash-function| "http://scheme.com/tspl4/./objects.html#./objects:s278")
(|hashtable-keys| "http://scheme.com/tspl4/./objects.html#./objects:s288")
(|hashtable-mutable?| "http://scheme.com/tspl4/./objects.html#./objects:s277")
(|hashtable-ref| "http://scheme.com/tspl4/./objects.html#./objects:s281")
(|hashtable-set!| "http://scheme.com/tspl4/./objects.html#./objects:s280")
(|hashtable-size| "http://scheme.com/tspl4/./objects.html#./objects:s285")
(|hashtable-update!| "http://scheme.com/tspl4/./objects.html#./objects:s283")
(|hashtable-values| "./objects.html#./objects:s114")
(|hashtable-weak?| "./objects.html#./objects:s117")
(|hashtable?| "http://scheme.com/tspl4/./objects.html#./objects:s25")
(|heap-reserve-ratio| "./smgmt.html#./smgmt:s19")
(|i/o-decoding-error?| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s42")
(|i/o-encoding-error-char| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s43")
(|i/o-encoding-error?| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s43")
(|i/o-error-filename| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s36")
(|i/o-error-port| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s41")
(|i/o-error-position| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s35")
(|i/o-error?| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s32")
(|i/o-file-already-exists-error?| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s39")
(|i/o-file-does-not-exist-error?| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s40")
(|i/o-file-is-read-only-error?| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s38")
(|i/o-file-protection-error?| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s37")
(|i/o-filename-error?| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s36")
(|i/o-invalid-position-error?| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s35")
(|i/o-port-error?| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s41")
(|i/o-read-error?| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s33")
(|i/o-write-error?| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s34")
(|iconv-codec| "./io.html#./io:s8")
(|identifier-syntax| "http://scheme.com/tspl4/./syntax.html#./syntax:s9")
(|identifier?| "http://scheme.com/tspl4/./syntax.html#./syntax:s35")
(|ieee| "./syntax.html#./syntax:s31")
(|ieee| "./syntax.html#./syntax:s24")
(|ieee-environment| "./syntax.html#./syntax:s32")
(|if| "http://scheme.com/tspl4/./start.html#./start:s99")
(|imag-part| "http://scheme.com/tspl4/./objects.html#./objects:s121")
(|immutable| "http://scheme.com/tspl4/./records.html#./records:s16")
(|immutable-box?| "./objects.html#./objects:s84")
(|immutable-bytevector?| "./objects.html#./objects:s65")
(|immutable-fxvector?| "./objects.html#./objects:s52")
(|immutable-string?| "./objects.html#./objects:s24")
(|immutable-vector?| "./objects.html#./objects:s34")
(|implementation-restriction-violation?| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s28")
(|begin| "http://scheme.com/tspl4/./control.html#./control:s7")
(|implicit-exports| "./libraries.html#./libraries:s19")
(|import| "./binding.html#./binding:s10")
(|import-notify| "./use.html#./use:s21")
(|import-only| "./binding.html#./binding:s11")
(|include| "./libraries.html#./libraries:s25")
(|indirect-export| "./libraries.html#./libraries:s18")
(|inexact| "http://scheme.com/tspl4/./objects.html#./objects:s112")
(|inexact->exact| "http://scheme.com/tspl4/./objects.html#./objects:s116")
(|inexact?| "http://scheme.com/tspl4/./objects.html#./objects:s74")
(|infinite?| "http://scheme.com/tspl4/./objects.html#./objects:s97")
(|initial-bytes-allocated| "./system.html#./system:s202")
(|INITLOCK| "./foreign.html#./foreign:s286")
(|input-port-ready?| "./foreign.html#./foreign:s6")
(|input-port?| "http://scheme.com/tspl4/./io.html#./io:s44")
(|inspect| "./debug.html#./debug:s22")
(|inspect/object| "./debug.html#./debug:s25")
(|int| "./foreign.html#./foreign:s40")
(|integer->char| "http://scheme.com/tspl4/./objects.html#./objects:s211")
(|integer-16| "./foreign.html#./foreign:s30")
(|integer-32| "./foreign.html#./foreign:s32")
(|integer-64| "./foreign.html#./foreign:s34")
(|integer-8| "./foreign.html#./foreign:s28")
(|integer-divide| "http://scheme.com/tspl4/./further.html#./further:s73")
(|integer-length| "./numeric.html#./numeric:s71")
(|integer-valued?| "http://scheme.com/tspl4/./objects.html#./objects:s18")
(|integer?| "http://scheme.com/tspl4/./objects.html#./objects:s17")
(|interaction-environment| "./use.html#./use:s12")
(|interactive?| "./system.html#./system:s236")
(|internal-defines-as-letrec*| "./binding.html#./binding:s15")
(|interpret| "./system.html#./system:s42")
(|iota| "./objects.html#./objects:s8")
(|iptr| "./foreign.html#./foreign:s50")
(|irritants-condition?| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s25")
(|isqrt| "./numeric.html#./numeric:s70")
(|keyboard-interrupt-handler| "./system.html#./system:s20")
(|l| "http://scheme.com/tspl4/./objects.html#./objects:s85")
(|lambda| "./debug.html#./debug:s1")
(|lambda*| "http://scheme.com/tspl4/./binding.html#./binding:s12")
(|last-pair| "./objects.html#./objects:s4")
(|latin-1-codec| "http://scheme.com/tspl4/./io.html#./io:s22")
(|lazy| "http://scheme.com/tspl4/./start.html#./start:s172")
(|lcm| "http://scheme.com/tspl4/./objects.html#./objects:s110")
(|least-fixnum| "http://scheme.com/tspl4/./objects.html#./objects:s151")
(|length| "http://scheme.com/tspl4/./start.html#./start:s136")
(|let| "./debug.html#./debug:s6")
(|let*| "./compat.html#./compat:s15")
(|let*-values| "http://scheme.com/tspl4/./binding.html#./binding:s23")
(|let| "http://scheme.com/tspl4/./start.html#./start:s53")
(|let-syntax| "./binding.html#./binding:s6")
(|let-values| "http://scheme.com/tspl4/./binding.html#./binding:s23")
(|letrec| "http://scheme.com/tspl4/./further.html#./further:s35")
(|letrec*| "http://scheme.com/tspl4/./binding.html#./binding:s22")
(|letrec-syntax| "./binding.html#./binding:s7")
(|lexical-violation?| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s29")
(|library| "./libraries.html#./libraries:s13")
(|library-directories| "./use.html#./use:s17")
(|library-exports| "./libraries.html#./libraries:s29")
(|library-extensions| "./use.html#./use:s18")
(|library-list| "./libraries.html#./libraries:s28")
(|library-object-filename| "./use.html#./use:s28")
(|library-requirements| "./use.html#./use:s27")
(|library-requirements-options| "./libraries.html#./libraries:s30")
(|library-version| "./libraries.html#./libraries:s29")
(|lisp-cdr| "http://scheme.com/tspl4/./start.html#./start:s115")
(|list| "http://scheme.com/tspl4/./start.html#./start:s33")
(|list*| "./objects.html#./objects:s6")
(|list->fxvector| "./objects.html#./objects:s50")
(|list->string| "http://scheme.com/tspl4/./objects.html#./objects:s229")
(|list->vector| "http://scheme.com/tspl4/./objects.html#./objects:s238")
(|list-copy| "./objects.html#./objects:s5")
(|list-head| "./objects.html#./objects:s3")
(|list-ref| "http://scheme.com/tspl4/./objects.html#./objects:s47")
(|list-sort| "http://scheme.com/tspl4/./objects.html#./objects:s62")
(|list-tail| "http://scheme.com/tspl4/./objects.html#./objects:s48")
(|list?| "http://scheme.com/tspl4/./start.html#./start:s200")
(|literal-identifier=?| "./syntax.html#./syntax:s14")
(|load| "./use.html#./use:s4")
(|load-compiled-from-port| "./system.html#./system:s50")
(|load-library| "./libraries.html#./libraries:s11")
(|load-program| "./libraries.html#./libraries:s9")
(|load-shared-object| "./foreign.html#./foreign:s160")
(|locate-source| "./syntax.html#./syntax:s70")
(|locate-source-object-source| "./syntax.html#./syntax:s71")
(|lock-object| "./foreign.html#./foreign:s129")
(|locked-object?| "./smgmt.html#./smgmt:s34")
(|LOCKED_DECR| "./foreign.html#./foreign:s290")
(|LOCKED_INCR| "./foreign.html#./foreign:s289")
(|log| "http://scheme.com/tspl4/./objects.html#./objects:s130")
(|logand| "./numeric.html#./numeric:s44")
(|logbit?| "./numeric.html#./numeric:s48")
(|logbit0| "./numeric.html#./numeric:s50")
(|logbit1| "./numeric.html#./numeric:s51")
(|logior| "./numeric.html#./numeric:s45")
(|lognot| "./numeric.html#./numeric:s47")
(|logor| "./numeric.html#./numeric:s45")
(|logtest| "./numeric.html#./numeric:s49")
(|logxor| "./numeric.html#./numeric:s46")
(|long| "./foreign.html#./foreign:s43")
(|long-long| "./foreign.html#./foreign:s45")
(|lookahead-char| "http://scheme.com/tspl4/./io.html#./io:s62")
(|lookahead-u8| "http://scheme.com/tspl4/./io.html#./io:s56")
(|loop| "http://scheme.com/tspl4/./syntax.html#./syntax:s46")
(|machine-type| "./system.html#./system:s81")
(|magnitude| "./numeric.html#./numeric:s43")
(|magnitude-squared| "./numeric.html#./numeric:s42")
(|make-annotation| "./syntax.html#./syntax:s38")
(|make-assertion-violation| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s21")
(|make-boot-file| "./use.html#./use:s69")
(|make-boot-header| "./system.html#./system:s78")
(|make-bytevector| "http://scheme.com/tspl4/./objects.html#./objects:s242")
(|make-compile-time-value| "./syntax.html#./syntax:s15")
(|make-condition| "./threads.html#./threads:s11")
(|make-continuation-condition| "./system.html#./system:s6")
(|make-cost-center| "./system.html#./system:s219")
(|make-counter| "http://scheme.com/tspl4/./start.html#./start:s168")
(|make-custom-binary-input-port| "http://scheme.com/tspl4/./io.html#./io:s41")
(|make-custom-binary-input/output-port| "http://scheme.com/tspl4/./io.html#./io:s41")
(|make-custom-binary-output-port| "http://scheme.com/tspl4/./io.html#./io:s41")
(|make-custom-textual-input-port| "http://scheme.com/tspl4/./io.html#./io:s42")
(|make-custom-textual-input/output-port| "http://scheme.com/tspl4/./io.html#./io:s42")
(|make-custom-textual-output-port| "http://scheme.com/tspl4/./io.html#./io:s42")
(|make-date| "./system.html#./system:s189")
(|make-engine| "./control.html#./control:s16")
(|make-enumeration| "http://scheme.com/tspl4/./objects.html#./objects:s291")
(|make-ephemeron-eq-hashtable| "./objects.html#./objects:s116")
(|make-ephemeron-eqv-hashtable| "./objects.html#./objects:s116")
(|make-eq-hashtable| "http://scheme.com/tspl4/./objects.html#./objects:s274")
(|make-eqv-hashtable| "http://scheme.com/tspl4/./objects.html#./objects:s275")
(|make-error| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s22")
(|make-format-condition| "./system.html#./system:s4")
(|make-ftype-pointer| "./foreign.html#./foreign:s143")
(|make-fxvector| "./objects.html#./objects:s44")
(|make-guardian| "./smgmt.html#./smgmt:s29")
(|make-hash-table| "./compat.html#./compat:s0")
(|make-hashtable| "http://scheme.com/tspl4/./objects.html#./objects:s276")
(|make-i/o-decoding-error| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s42")
(|make-i/o-encoding-error| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s43")
(|make-i/o-error| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s32")
(|make-i/o-file-already-exists-error| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s39")
(|make-i/o-file-does-not-exist-error| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s40")
(|make-i/o-file-is-read-only-error| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s38")
(|make-i/o-file-protection-error| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s37")
(|make-i/o-filename-error| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s36")
(|make-i/o-invalid-position-error| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s35")
(|make-i/o-port-error| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s41")
(|make-i/o-read-error| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s33")
(|make-i/o-write-error| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s34")
(|make-implementation-restriction-violation| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s28")
(|make-input-port| "./io.html#./io:s11")
(|make-input/output-port| "./io.html#./io:s11")
(|make-irritants-condition| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s25")
(|make-lexical-violation| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s29")
(|make-list| "./objects.html#./objects:s7")
(|make-message-condition| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s24")
(|make-mutex| "./threads.html#./threads:s6")
(|make-no-infinities-violation| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s44")
(|make-no-nans-violation| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s45")
(|make-non-continuable-violation| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s27")
(|make-object-finder| "./debug.html#./debug:s24")
(|make-output-port| "./io.html#./io:s11")
(|make-parameter| "./system.html#./system:s226")
(|make-pare| "./compat.html#./compat:s27")
(|make-polar| "http://scheme.com/tspl4/./objects.html#./objects:s123")
(|make-promise| "http://scheme.com/tspl4/./control.html#./control:s67")
(|make-queue| "http://scheme.com/tspl4/./start.html#./start:s182")
(|make-record-constructor-descriptor| "http://scheme.com/tspl4/./records.html#./records:s24")
(|make-record-type| "./objects.html#./objects:s159")
(|make-record-type-descriptor| "http://scheme.com/tspl4/./records.html#./records:s2")
(|make-rectangular| "http://scheme.com/tspl4/./objects.html#./objects:s122")
(|make-serious-condition| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s19")
(|make-source-condition| "./system.html#./system:s5")
(|make-source-file-descriptor| "./syntax.html#./syntax:s42")
(|make-source-object| "./syntax.html#./syntax:s40")
(|make-sstats| "./system.html#./system:s209")
(|make-stack| "http://scheme.com/tspl4/./start.html#./start:s178")
(|make-string| "http://scheme.com/tspl4/./objects.html#./objects:s218")
(|make-syntax-violation| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s30")
(|make-thread-parameter| "./threads.html#./threads:s19")
(|make-time| "./system.html#./system:s181")
(|make-transcoder| "http://scheme.com/tspl4/./io.html#./io:s19")
(|make-undefined-violation| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s31")
(|make-variable-transformer| "http://scheme.com/tspl4/./syntax.html#./syntax:s10")
(|make-vector| "http://scheme.com/tspl4/./objects.html#./objects:s232")
(|make-violation| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s20")
(|make-warning| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s23")
(|make-weak-eq-hashtable| "./objects.html#./objects:s115")
(|make-weak-eqv-hashtable| "./objects.html#./objects:s115")
(|make-who-condition| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s26")
(|map| "http://scheme.com/tspl4/./start.html#./start:s147")
(|map1| "http://scheme.com/tspl4/./start.html#./start:s148")
(|mark-port-closed!| "./io.html#./io:s22")
(|max| "http://scheme.com/tspl4/./objects.html#./objects:s107")
(|maximum-memory-bytes| "./system.html#./system:s205")
(|maybe-compile-file| "./system.html#./system:s64")
(|maybe-compile-library| "./system.html#./system:s64")
(|maybe-compile-program| "./system.html#./system:s64")
(|member| "http://scheme.com/tspl4/./objects.html#./objects:s51")
(|memp| "http://scheme.com/tspl4/./objects.html#./objects:s52")
(|memq| "http://scheme.com/tspl4/./objects.html#./objects:s51")
(|memv| "http://scheme.com/tspl4/./start.html#./start:s141")
(|merge| "./objects.html#./objects:s112")
(|merge!| "./objects.html#./objects:s112")
(|message-condition?| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s24")
(|meta| "./binding.html#./binding:s12")
(|meta-cond| "./syntax.html#./syntax:s35")
(|method| "http://scheme.com/tspl4/./syntax.html#./syntax:s67")
(|min| "http://scheme.com/tspl4/./objects.html#./objects:s108")
(|mkdir| "./io.html#./io:s134")
(|mod| "http://scheme.com/tspl4/./objects.html#./objects:s99")
(|mod0| "http://scheme.com/tspl4/./objects.html#./objects:s100")
(|module| "./binding.html#./binding:s9")
(|modulo| "http://scheme.com/tspl4/./objects.html#./objects:s98")
(|most-negative-fixnum| "./numeric.html#./numeric:s14")
(|most-positive-fixnum| "./numeric.html#./numeric:s14")
(|mul| "http://scheme.com/tspl4/./examples.html#./examples:s2")
(|multibyte->string| "./io.html#./io:s84")
(|mutable| "http://scheme.com/tspl4/./records.html#./records:s16")
(|mutable-box?| "./objects.html#./objects:s84")
(|mutable-bytevector?| "./objects.html#./objects:s65")
(|mutable-fxvector?| "./objects.html#./objects:s52")
(|mutable-string?| "./objects.html#./objects:s24")
(|mutable-vector?| "./objects.html#./objects:s34")
(|mutex-acquire| "./threads.html#./threads:s8")
(|mutex-release| "./threads.html#./threads:s9")
(|mutex?| "./threads.html#./threads:s7")
(|mvlet| "./system.html#./system:s92")
(|let| "http://scheme.com/tspl4/./further.html#./further:s41")
(|nan?| "http://scheme.com/tspl4/./objects.html#./objects:s97")
(|native-endianness| "http://scheme.com/tspl4/./objects.html#./objects:s241")
(|native-eol-style| "http://scheme.com/tspl4/./io.html#./io:s24")
(|native-transcoder| "http://scheme.com/tspl4/./io.html#./io:s21")
(|negative?| "http://scheme.com/tspl4/./objects.html#./objects:s95")
(|let| "http://scheme.com/tspl4/./binding.html#./binding:s19")
(|new-cafe| "./system.html#./system:s145")
(|newline| "http://scheme.com/tspl4/./io.html#./io:s87")
(|no-infinities-violation?| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s44")
(|no-nans-violation?| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s45")
(|nodups?| "./system.html#./system:s91")
(|non-continuable-violation?| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s27")
(|nongenerative| "http://scheme.com/tspl4/./records.html#./records:s16")
(|nonnegative?| "./numeric.html#./numeric:s73")
(|nonpositive?| "./numeric.html#./numeric:s72")
(|not| "http://scheme.com/tspl4/./start.html#./start:s100")
(|null-environment| "./syntax.html#./syntax:s30")
(|null?| "http://scheme.com/tspl4/./start.html#./start:s113")
(|number->string| "./numeric.html#./numeric:s79")
(|number?| "http://scheme.com/tspl4/./start.html#./start:s120")
(|numerator| "http://scheme.com/tspl4/./objects.html#./objects:s118")
(|object->string| "http://scheme.com/tspl4/./io.html#./io:s40")
(|object-counts| "./debug.html#./debug:s28")
(|oblist| "./objects.html#./objects:s109")
(|odd?| "http://scheme.com/tspl4/./start.html#./start:s159")
(|only| "./syntax.html#./syntax:s20")
(|only| "http://scheme.com/tspl4/./libraries.html#./libraries:s9")
(|opaque| "http://scheme.com/tspl4/./records.html#./records:s16")
(|open-bytevector-input-port| "http://scheme.com/tspl4/./io.html#./io:s34")
(|open-bytevector-output-port| "http://scheme.com/tspl4/./io.html#./io:s36")
(|open-fd-input-port| "./io.html#./io:s54")
(|open-fd-input/output-port| "./io.html#./io:s82")
(|open-fd-output-port| "./io.html#./io:s72")
(|open-file-input-port| "http://scheme.com/tspl4/./io.html#./io:s29")
(|open-file-input/output-port| "http://scheme.com/tspl4/./io.html#./io:s31")
(|open-file-output-port| "http://scheme.com/tspl4/./io.html#./io:s30")
(|open-input-file| "./io.html#./io:s51")
(|open-input-output-file| "./io.html#./io:s81")
(|open-input-string| "./io.html#./io:s38")
(|open-output-file| "./io.html#./io:s69")
(|open-output-string| "./io.html#./io:s41")
(|open-process-ports| "./foreign.html#./foreign:s5")
(|open-source-file| "./syntax.html#./syntax:s45")
(|open-string-input-port| "http://scheme.com/tspl4/./io.html#./io:s35")
(|open-string-output-port| "http://scheme.com/tspl4/./io.html#./io:s37")
(|optimize-level| "./use.html#./use:s49")
(|or| "http://scheme.com/tspl4/./start.html#./start:s101")
(|ormap| "./control.html#./control:s7")
(|output-port-buffer-mode| "http://scheme.com/tspl4/./io.html#./io:s52")
(|output-port?| "http://scheme.com/tspl4/./io.html#./io:s44")
(|pair?| "http://scheme.com/tspl4/./start.html#./start:s118")
(|parameterize| "./system.html#./system:s228")
(|parent| "http://scheme.com/tspl4/./records.html#./records:s16")
(|parent-rtd| "http://scheme.com/tspl4/./records.html#./records:s16")
(|pariah| "./system.html#./system:s120")
(|partition| "http://scheme.com/tspl4/./objects.html#./objects:s56")
(|path-absolute?| "./io.html#./io:s142")
(|path-extension| "./io.html#./io:s142")
(|path-first| "./io.html#./io:s142")
(|path-last| "./io.html#./io:s142")
(|path-parent| "./io.html#./io:s142")
(|path-rest| "./io.html#./io:s142")
(|path-root| "./io.html#./io:s142")
(|peek-char| "http://scheme.com/tspl4/./io.html#./io:s83")
(|petite?| "./system.html#./system:s234")
(|por| "./control.html#./control:s26")
(|port-bol?| "./io.html#./io:s25")
(|port-closed?| "./io.html#./io:s23")
(|port-eof?| "http://scheme.com/tspl4/./io.html#./io:s68")
(|port-file-compressed!| "./io.html#./io:s37")
(|port-file-descriptor| "./io.html#./io:s47")
(|port-handler| "./io.html#./io:s13")
(|port-has-port-length?| "./io.html#./io:s29")
(|port-has-port-nonblocking??| "./io.html#./io:s31")
(|port-has-port-position?| "http://scheme.com/tspl4/./io.html#./io:s49")
(|port-has-set-port-length!?| "./io.html#./io:s30")
(|port-has-set-port-nonblocking!?| "./io.html#./io:s32")
(|port-has-set-port-position!?| "http://scheme.com/tspl4/./io.html#./io:s50")
(|port-input-buffer| "./io.html#./io:s14")
(|port-input-count| "./io.html#./io:s16")
(|port-input-empty?| "./io.html#./io:s17")
(|port-input-index| "./io.html#./io:s14")
(|port-input-size| "./io.html#./io:s14")
(|port-length| "./io.html#./io:s29")
(|port-name| "./io.html#./io:s27")
(|port-nonblocking?| "./io.html#./io:s31")
(|port-output-buffer| "./io.html#./io:s18")
(|port-output-count| "./io.html#./io:s20")
(|port-output-full?| "./io.html#./io:s21")
(|port-output-index| "./io.html#./io:s18")
(|port-output-size| "./io.html#./io:s18")
(|port-position| "http://scheme.com/tspl4/./io.html#./io:s49")
(|port-transcoder| "http://scheme.com/tspl4/./io.html#./io:s48")
(|port?| "http://scheme.com/tspl4/./io.html#./io:s43")
(|positive?| "http://scheme.com/tspl4/./objects.html#./objects:s94")
(|predicate| "./objects.html#./objects:s171")
(|prefix| "./objects.html#./objects:s171")
(|prefix| "http://scheme.com/tspl4/./libraries.html#./libraries:s11")
(|pretty-file| "./io.html#./io:s86")
(|pretty-format| "./io.html#./io:s87")
(|pretty-initial-indent| "./debug.html#./debug:s13")
(|pretty-line-length| "./io.html#./io:s90")
(|pretty-maximum-lines| "./io.html#./io:s95")
(|pretty-one-line-limit| "./io.html#./io:s90")
(|pretty-print| "./io.html#./io:s85")
(|pretty-standard-indent| "./io.html#./io:s94")
(|print-brackets| "./io.html#./io:s117")
(|print-char-name| "./io.html#./io:s100")
(|print-extended-identifiers| "./intro.html#./intro:s28")
(|print-gensym| "./objects.html#./objects:s94")
(|print-graph| "./objects.html#./objects:s177")
(|print-length| "./objects.html#./objects:s178")
(|print-level| "./intro.html#./intro:s36")
(|print-precision| "./io.html#./io:s122")
(|print-radix| "./io.html#./io:s111")
(|print-record| "./objects.html#./objects:s180")
(|print-unicode| "./io.html#./io:s123")
(|print-vector-length| "./intro.html#./intro:s29")
(|printf| "./io.html#./io:s98")
(|procedure-arity-mask| "./objects.html#./objects:s195")
(|procedure?| "http://scheme.com/tspl4/./objects.html#./objects:s23")
(|process| "./foreign.html#./foreign:s2")
(|product| "http://scheme.com/tspl4/./further.html#./further:s63")
(|profile| "./system.html#./system:s133")
(|profile-clear| "./system.html#./system:s135")
(|profile-clear-database| "./system.html#./system:s144")
(|profile-dump| "./system.html#./system:s127")
(|profile-dump-data| "./system.html#./system:s128")
(|profile-dump-html| "./system.html#./system:s125")
(|profile-dump-list| "./system.html#./system:s126")
(|profile-line-number-color| "./system.html#./system:s139")
(|profile-load-data| "./system.html#./system:s129")
(|profile-palette| "./system.html#./system:s138")
(|profile-query-weight| "./system.html#./system:s143")
(|property-list| "./objects.html#./objects:s108")
(|protocol| "http://scheme.com/tspl4/./records.html#./records:s16")
(|ptr| "./foreign.html#./foreign:s61")
(|ptrdiff_t| "./foreign.html#./foreign:s47")
(|put-bytevector| "http://scheme.com/tspl4/./io.html#./io:s70")
(|put-bytevector-some| "./io.html#./io:s75")
(|put-char| "http://scheme.com/tspl4/./io.html#./io:s71")
(|put-datum| "http://scheme.com/tspl4/./io.html#./io:s73")
(|put-hash-table!| "./compat.html#./compat:s2")
(|put-registry!| "./system.html#./system:s240")
(|put-string| "http://scheme.com/tspl4/./io.html#./io:s72")
(|put-string-some| "./io.html#./io:s76")
(|put-u8| "http://scheme.com/tspl4/./io.html#./io:s69")
(|putenv| "./system.html#./system:s239")
(|putprop| "./objects.html#./objects:s102")
(|putq!| "http://scheme.com/tspl4/./start.html#./start:s183")
(|quadratic-formula| "http://scheme.com/tspl4/./start.html#./start:s166")
(|quasiquote| |`| "http://scheme.com/tspl4/./objects.html#./objects:s5")
(|quasisyntax| |#`| "http://scheme.com/tspl4/./syntax.html#./syntax:s40")
(|?| "http://scheme.com/tspl4/./intro.html#./intro:s47")
(|quote| |'| "http://scheme.com/tspl4/./start.html#./start:s16")
(|quotient| "http://scheme.com/tspl4/./objects.html#./objects:s98")
(|r5rs| "./syntax.html#./syntax:s27")
(|r5rs| "./syntax.html#./syntax:s22")
(|r5rs-syntax| "./syntax.html#./syntax:s29")
(|r5rs-syntax| "./syntax.html#./syntax:s23")
(|raise| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s3")
(|raise-continuable| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s3")
(|random| "./numeric.html#./numeric:s64")
(|random-seed| "./numeric.html#./numeric:s65")
(|rational-valued?| "http://scheme.com/tspl4/./objects.html#./objects:s18")
(|rational?| "http://scheme.com/tspl4/./objects.html#./objects:s17")
(|rationalize| "http://scheme.com/tspl4/./objects.html#./objects:s117")
(|ratnum?| "./numeric.html#./numeric:s12")
(|read| "./io.html#./io:s105")
(|read-char| "http://scheme.com/tspl4/./io.html#./io:s82")
(|read-token| "./io.html#./io:s64")
(|real->flonum| "http://scheme.com/tspl4/./objects.html#./objects:s198")
(|real-part| "http://scheme.com/tspl4/./objects.html#./objects:s120")
(|real-time| "./system.html#./system:s200")
(|real-valued?| "http://scheme.com/tspl4/./objects.html#./objects:s18")
(|real?| "http://scheme.com/tspl4/./objects.html#./objects:s17")
(|rec| "./binding.html#./binding:s17")
(|reciprocal| "http://scheme.com/tspl4/./start.html#./start:s4")
(|record-accessor| "http://scheme.com/tspl4/./records.html#./records:s31")
(|record-case| "./control.html#./control:s3")
(|record-constructor| "./objects.html#./objects:s184")
(|record-constructor-descriptor| "http://scheme.com/tspl4/./records.html#./records:s28")
(|record-constructor-descriptor?| "./objects.html#./objects:s1")
(|record-equal-procedure| "./objects.html#./objects:s143")
(|record-field-accessible?| "./objects.html#./objects:s186")
(|record-field-accessor| "./objects.html#./objects:s185")
(|record-field-mutable?| "./objects.html#./objects:s188")
(|record-field-mutator| "./objects.html#./objects:s187")
(|record-hash-procedure| "./objects.html#./objects:s149")
(|record-mutator| "http://scheme.com/tspl4/./records.html#./records:s32")
(|record-predicate| "http://scheme.com/tspl4/./records.html#./records:s30")
(|record-reader| "./objects.html#./objects:s175")
(|record-rtd| "http://scheme.com/tspl4/./records.html#./records:s41")
(|record-type-descriptor| "./objects.html#./objects:s194")
(|record-type-descriptor?| "http://scheme.com/tspl4/./records.html#./records:s23")
(|record-type-equal-procedure| "./objects.html#./objects:s142")
(|record-type-field-decls| "./objects.html#./objects:s192")
(|record-type-field-names| "./objects.html#./objects:s191")
(|record-type-generative?| "http://scheme.com/tspl4/./records.html#./records:s37")
(|record-type-hash-procedure| "./objects.html#./objects:s148")
(|record-type-name| "./objects.html#./objects:s189")
(|record-type-opaque?| "http://scheme.com/tspl4/./records.html#./records:s37")
(|record-type-parent| "http://scheme.com/tspl4/./records.html#./records:s35")
(|record-type-sealed?| "http://scheme.com/tspl4/./records.html#./records:s37")
(|record-type-symbol| "./objects.html#./objects:s190")
(|record-type-uid| "http://scheme.com/tspl4/./records.html#./records:s36")
(|record-writer| "./objects.html#./objects:s176")
(|record?| "./objects.html#./objects:s193")
(|register-signal-handler| "./system.html#./system:s28")
(|release-minimum-generation| "./smgmt.html#./smgmt:s18")
(|remainder| "http://scheme.com/tspl4/./objects.html#./objects:s98")
(|remove| "http://scheme.com/tspl4/./objects.html#./objects:s53")
(|remove!| "./objects.html#./objects:s10")
(|remove-foreign-entry| "./foreign.html#./foreign:s162")
(|remove-hash-table!| "./compat.html#./compat:s4")
(|remove-registry!| "./system.html#./system:s240")
(|remp| "http://scheme.com/tspl4/./objects.html#./objects:s54")
(|remprop| "./objects.html#./objects:s106")
(|remq| "http://scheme.com/tspl4/./objects.html#./objects:s53")
(|remq!| "./objects.html#./objects:s10")
(|remv| "http://scheme.com/tspl4/./start.html#./start:s143")
(|remv!| "./objects.html#./objects:s10")
(|rename| "./syntax.html#./syntax:s20")
(|rename| "http://scheme.com/tspl4/./libraries.html#./libraries:s12")
(|rename-file| "./io.html#./io:s137")
(|require-nongenerative-clause| "./objects.html#./objects:s137")
(|reset| "./system.html#./system:s156")
(|reset-cost-center!| "./system.html#./system:s225")
(|reset-handler| "./use.html#./use:s7")
(|reset-maximum-memory-bytes!| "./system.html#./system:s206")
(|retry| "http://scheme.com/tspl4/./further.html#./further:s65")
(|reverse| "http://scheme.com/tspl4/./objects.html#./objects:s50")
(|reverse!| "./objects.html#./objects:s12")
(|revisit| "./system.html#./system:s53")
(|round| "http://scheme.com/tspl4/./objects.html#./objects:s104")
(|round-robin| "./control.html#./control:s23")
(|run-cp0| "./system.html#./system:s113")
(|s| "http://scheme.com/tspl4/./objects.html#./objects:s82")
(|s8-list->bytevector| "./objects.html#./objects:s61")
(|Sactivate_thread| "./foreign.html#./foreign:s283")
(|Sbignump| "./foreign.html#./foreign:s196")
(|Sboolean| "./foreign.html#./foreign:s242")
(|Sboolean_value| "./foreign.html#./foreign:s206")
(|Sbooleanp| "./foreign.html#./foreign:s187")
(|Sbox| "./foreign.html#./foreign:s254")
(|Sboxp| "./foreign.html#./foreign:s197")
(|Sbuild_heap| "./foreign.html#./foreign:s174")
(|Sbwp_object| "./foreign.html#./foreign:s237")
(|Sbwp_objectp| "./foreign.html#./foreign:s186")
(|Sbytevector_data| "./foreign.html#./foreign:s226")
(|Sbytevector_length| "./foreign.html#./foreign:s220")
(|Sbytevector_u8_ref| "./foreign.html#./foreign:s224")
(|Sbytevector_u8_set| "./foreign.html#./foreign:s232")
(|Sbytevectorp| "./foreign.html#./foreign:s193")
(|sc-expand| "./system.html#./system:s86")
(|Scall| "./foreign.html#./foreign:s282")
(|Scall0| "./foreign.html#./foreign:s276")
(|Scall1| "./foreign.html#./foreign:s277")
(|Scall2| "./foreign.html#./foreign:s278")
(|Scall3| "./foreign.html#./foreign:s279")
(|Scar| "./foreign.html#./foreign:s214")
(|Scdr| "./foreign.html#./foreign:s215")
(|Schar| "./foreign.html#./foreign:s241")
(|Schar_value| "./foreign.html#./foreign:s205")
(|Scharp| "./foreign.html#./foreign:s183")
(|scheme| "./syntax.html#./syntax:s26")
(|scheme| "./syntax.html#./syntax:s21")
(|scheme-environment| "./system.html#./system:s31")
(|scheme-object| "./foreign.html#./foreign:s12")
(|scheme-program| "./system.html#./system:s167")
(|scheme-report-environment| "./syntax.html#./syntax:s28")
(|scheme-script| "./libraries.html#./libraries:s7")
(|scheme-start| "./use.html#./use:s66")
(|scheme-version| "./system.html#./system:s232")
(|scheme-version-number| "./system.html#./system:s233")
(|SCHEMEHEAPDIRS| "./use.html#./use:s99")
(|Scompact_heap| "./foreign.html#./foreign:s180")
(|Scons| "./foreign.html#./foreign:s253")
(|Sdeactivate_thread| "./foreign.html#./foreign:s284")
(|Sdestroy_thread| "./foreign.html#./foreign:s285")
(|sealed| "http://scheme.com/tspl4/./records.html#./records:s16")
(|segment-length| "http://scheme.com/tspl4/./control.html#./control:s73")
(|segment-slope| "http://scheme.com/tspl4/./control.html#./control:s74")
(|;| "http://scheme.com/tspl4/./intro.html#./intro:s44")
(|Senable_expeditor| "./foreign.html#./foreign:s175")
(|Seof_object| "./foreign.html#./foreign:s238")
(|Seof_objectp| "./foreign.html#./foreign:s185")
(|sequence| "http://scheme.com/tspl4/./syntax.html#./syntax:s55")
(|serious-condition?| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s19")
(|set!| "./binding.html#./binding:s28")
(|set-binary-port-input-buffer!| "./io.html#./io:s15")
(|set-binary-port-input-index!| "./io.html#./io:s15")
(|set-binary-port-input-size!| "./io.html#./io:s15")
(|set-binary-port-output-buffer!| "./io.html#./io:s19")
(|set-binary-port-output-index!| "./io.html#./io:s19")
(|set-binary-port-output-size!| "./io.html#./io:s19")
(|set-box!| "./objects.html#./objects:s82")
(|set-car!| "http://scheme.com/tspl4/./objects.html#./objects:s40")
(|set-cdr!| "http://scheme.com/tspl4/./start.html#./start:s197")
(|set-of| "http://scheme.com/tspl4/./examples.html#./examples:s15")
(|set-port-bol!| "./io.html#./io:s24")
(|set-port-eof!| "./io.html#./io:s26")
(|set-port-input-buffer!| "./io.html#./io:s15")
(|set-port-input-index!| "./io.html#./io:s15")
(|set-port-input-size!| "./io.html#./io:s15")
(|set-port-length!| "./io.html#./io:s30")
(|set-port-name!| "./io.html#./io:s28")
(|set-port-nonblocking!| "./io.html#./io:s32")
(|set-port-output-buffer!| "./io.html#./io:s19")
(|set-port-output-index!| "./io.html#./io:s19")
(|set-port-output-size!| "./io.html#./io:s19")
(|set-port-position!| "http://scheme.com/tspl4/./io.html#./io:s50")
(|set-sstats-bytes!| "./system.html#./system:s212")
(|set-sstats-cpu!| "./system.html#./system:s212")
(|set-sstats-gc-bytes!| "./system.html#./system:s212")
(|set-sstats-gc-count!| "./system.html#./system:s212")
(|set-sstats-gc-cpu!| "./system.html#./system:s212")
(|set-sstats-gc-real!| "./system.html#./system:s212")
(|set-sstats-real!| "./system.html#./system:s212")
(|set-textual-port-input-buffer!| "./io.html#./io:s15")
(|set-textual-port-input-index!| "./io.html#./io:s15")
(|set-textual-port-input-size!| "./io.html#./io:s15")
(|set-textual-port-output-buffer!| "./io.html#./io:s19")
(|set-textual-port-output-index!| "./io.html#./io:s19")
(|set-textual-port-output-size!| "./io.html#./io:s19")
(|set-time-nanosecond!| "./system.html#./system:s184")
(|set-time-second!| "./system.html#./system:s184")
(|set-time-type!| "./system.html#./system:s184")
(|set-timer| "./control.html#./control:s20")
(|set-top-level-value!| "./binding.html#./binding:s26")
(|set-virtual-register!| "./system.html#./system:s230")
(|Sexactnump| "./foreign.html#./foreign:s199")
(|Sfalse| "./foreign.html#./foreign:s236")
(|Sfixnum| "./foreign.html#./foreign:s240")
(|Sfixnum_value| "./foreign.html#./foreign:s204")
(|Sfixnump| "./foreign.html#./foreign:s182")
(|Sflonum| "./foreign.html#./foreign:s243")
(|Sflonum_value| "./foreign.html#./foreign:s207")
(|Sflonump| "./foreign.html#./foreign:s191")
(|Sforeign_callable_code_object| "./foreign.html#./foreign:s275")
(|Sforeign_callable_entry_point| "./foreign.html#./foreign:s274")
(|Sforeign_symbol| "./foreign.html#./foreign:s272")
(|Sfxvector_length| "./foreign.html#./foreign:s221")
(|Sfxvector_ref| "./foreign.html#./foreign:s225")
(|Sfxvector_set| "./foreign.html#./foreign:s233")
(|Sfxvectorp| "./foreign.html#./foreign:s194")
(|Sgetenv| "./foreign.html#./foreign:s261")
(|shhh| "http://scheme.com/tspl4/./start.html#./start:s169")
(|short| "./foreign.html#./foreign:s38")
(|shorter| "http://scheme.com/tspl4/./start.html#./start:s129")
(|shorter?| "http://scheme.com/tspl4/./start.html#./start:s157")
(|simple-conditions| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s16")
(|sin| "http://scheme.com/tspl4/./objects.html#./objects:s131")
(|Sinexactnump| "./foreign.html#./foreign:s198")
(|single-float| "./foreign.html#./foreign:s37")
(|sinh| "./numeric.html#./numeric:s76")
(|Sinitframe| "./foreign.html#./foreign:s280")
(|Sinputportp| "./foreign.html#./foreign:s201")
(|sint-list->bytevector| "http://scheme.com/tspl4/./objects.html#./objects:s261")
(|Sinteger| "./foreign.html#./foreign:s247")
(|Sinteger_value| "./foreign.html#./foreign:s208")
(|Sinteger32| "./foreign.html#./foreign:s249")
(|Sinteger32_value| "./foreign.html#./foreign:s210")
(|Sinteger64| "./foreign.html#./foreign:s251")
(|Sinteger64_value| "./foreign.html#./foreign:s212")
(|size_t| "./foreign.html#./foreign:s48")
(|Skernel_version| "./foreign.html#./foreign:s169")
(|sleep| "./system.html#./system:s196")
(|Slock_object| "./foreign.html#./foreign:s267")
(|Smake_bytevector| "./foreign.html#./foreign:s258")
(|Smake_fxvector| "./foreign.html#./foreign:s259")
(|Smake_string| "./foreign.html#./foreign:s256")
(|Smake_uninitialized_string| "./foreign.html#./foreign:s260")
(|Smake_vector| "./foreign.html#./foreign:s257")
(|Snil| "./foreign.html#./foreign:s234")
(|Snullp| "./foreign.html#./foreign:s184")
(|sort| "./objects.html#./objects:s111")
(|sort!| "./objects.html#./objects:s111")
(|source-condition-form| "./system.html#./system:s5")
(|source-condition?| "./system.html#./system:s5")
(|source-directories| "./use.html#./use:s22")
(|source-file-descriptor| "./syntax.html#./syntax:s65")
(|source-file-descriptor-checksum| "./syntax.html#./syntax:s63")
(|source-file-descriptor-path| "./syntax.html#./syntax:s64")
(|source-file-descriptor?| "./syntax.html#./syntax:s62")
(|source-object-bfp| "./syntax.html#./syntax:s56")
(|source-object-column| "./syntax.html#./syntax:s59")
(|source-object-efp| "./syntax.html#./syntax:s57")
(|source-object-line| "./syntax.html#./syntax:s58")
(|source-object-sfd| "./syntax.html#./syntax:s55")
(|source-object?| "./syntax.html#./syntax:s54")
(|Soutputportp| "./foreign.html#./foreign:s202")
(|Spairp| "./foreign.html#./foreign:s188")
(|SPINLOCK| "./foreign.html#./foreign:s287")
(|split| "http://scheme.com/tspl4/./control.html#./control:s76")
(|Sprocedurep| "./foreign.html#./foreign:s190")
(|Sput_arg| "./foreign.html#./foreign:s281")
(|sqrt| "http://scheme.com/tspl4/./objects.html#./objects:s127")
(|square| "http://scheme.com/tspl4/./start.html#./start:s2")
(|Sratnump| "./foreign.html#./foreign:s200")
(|Srecordp| "./foreign.html#./foreign:s203")
(|Sregister_boot_file| "./foreign.html#./foreign:s172")
(|Sregister_boot_file_fd| "./foreign.html#./foreign:s173")
(|Sregister_symbol| "./foreign.html#./foreign:s273")
(|Sretain_static_relocation| "./foreign.html#./foreign:s176")
(|Sscheme_deinit| "./foreign.html#./foreign:s181")
(|Sscheme_init| "./foreign.html#./foreign:s170")
(|Sscheme_program| "./foreign.html#./foreign:s179")
(|Sscheme_script| "./foreign.html#./foreign:s178")
(|Sscheme_start| "./foreign.html#./foreign:s177")
(|Sset_box| "./foreign.html#./foreign:s227")
(|Sset_car| "./foreign.html#./foreign:s228")
(|Sset_cdr| "./foreign.html#./foreign:s229")
(|Sset_top_level_value| "./foreign.html#./foreign:s265")
(|Sset_verbose| "./foreign.html#./foreign:s171")
(|ssize_t| "./foreign.html#./foreign:s49")
(|sstats-bytes| "./system.html#./system:s211")
(|sstats-cpu| "./system.html#./system:s211")
(|sstats-difference| "./system.html#./system:s213")
(|sstats-gc-bytes| "./system.html#./system:s211")
(|sstats-gc-count| "./system.html#./system:s211")
(|sstats-gc-cpu| "./system.html#./system:s211")
(|sstats-gc-real| "./system.html#./system:s211")
(|sstats-print| "./system.html#./system:s214")
(|sstats-real| "./system.html#./system:s211")
(|sstats?| "./system.html#./system:s210")
(|Sstring| "./foreign.html#./foreign:s244")
(|Sstring_length| "./foreign.html#./foreign:s218")
(|Sstring_of_length| "./foreign.html#./foreign:s245")
(|Sstring_ref| "./foreign.html#./foreign:s222")
(|Sstring_set| "./foreign.html#./foreign:s230")
(|Sstring_to_symbol| "./foreign.html#./foreign:s255")
(|Sstring_utf8| "./foreign.html#./foreign:s246")
(|Sstringp| "./foreign.html#./foreign:s195")
(|Ssymbol_to_string| "./foreign.html#./foreign:s216")
(|Ssymbolp| "./foreign.html#./foreign:s189")
(|standard-error-port| "./io.html#./io:s74")
(|standard-input-port| "./io.html#./io:s55")
(|standard-output-port| "./io.html#./io:s73")
(|statistics| "./system.html#./system:s208")
(|Stop_level_value| "./foreign.html#./foreign:s264")
(|string| "./foreign.html#./foreign:s13")
(|string->bytevector| "http://scheme.com/tspl4/./io.html#./io:s92")
(|string->immutable-string| "./objects.html#./objects:s19")
(|string->list| "http://scheme.com/tspl4/./objects.html#./objects:s228")
(|string->multibyte| "./io.html#./io:s84")
(|string->number| "./numeric.html#./numeric:s78")
(|string->symbol| "http://scheme.com/tspl4/./objects.html#./objects:s269")
(|string->utf16| "http://scheme.com/tspl4/./io.html#./io:s94")
(|string->utf32| "http://scheme.com/tspl4/./io.html#./io:s94")
(|string->utf8| "http://scheme.com/tspl4/./io.html#./io:s93")
(|string-append| "http://scheme.com/tspl4/./objects.html#./objects:s223")
(|string-ci-hash| "http://scheme.com/tspl4/./objects.html#./objects:s279")
(|string-ci<=?| "./objects.html#./objects:s20")
(|string-ci<?| "./objects.html#./objects:s20")
(|string-ci=?| "./objects.html#./objects:s20")
(|string-ci>=?| "./objects.html#./objects:s20")
(|string-ci>?| "./objects.html#./objects:s20")
(|string-copy| "http://scheme.com/tspl4/./objects.html#./objects:s222")
(|string-copy!| "./objects.html#./objects:s21")
(|string-downcase| "http://scheme.com/tspl4/./objects.html#./objects:s226")
(|string-fill!| "http://scheme.com/tspl4/./objects.html#./objects:s225")
(|string-foldcase| "http://scheme.com/tspl4/./objects.html#./objects:s226")
(|string-for-each| "http://scheme.com/tspl4/./control.html#./control:s50")
(|string-hash| "http://scheme.com/tspl4/./objects.html#./objects:s279")
(|string-length| "http://scheme.com/tspl4/./objects.html#./objects:s219")
(|string-normalize-nfc| "http://scheme.com/tspl4/./objects.html#./objects:s227")
(|string-normalize-nfd| "http://scheme.com/tspl4/./objects.html#./objects:s227")
(|string-normalize-nfkc| "http://scheme.com/tspl4/./objects.html#./objects:s227")
(|string-normalize-nfkd| "http://scheme.com/tspl4/./objects.html#./objects:s227")
(|string-ref| "http://scheme.com/tspl4/./objects.html#./objects:s220")
(|string-set!| "http://scheme.com/tspl4/./objects.html#./objects:s221")
(|string-titlecase| "http://scheme.com/tspl4/./objects.html#./objects:s226")
(|string-truncate!| "./objects.html#./objects:s23")
(|string-upcase| "http://scheme.com/tspl4/./objects.html#./objects:s226")
(|string<=?| "./objects.html#./objects:s20")
(|string<?| "./objects.html#./objects:s20")
(|string=?| "./objects.html#./objects:s20")
(|string>=?| "./objects.html#./objects:s20")
(|string>?| "./objects.html#./objects:s20")
(|string?| "http://scheme.com/tspl4/./start.html#./start:s121")
(|strip-fasl-file| "./use.html#./use:s65")
(|Strue| "./foreign.html#./foreign:s235")
(|sub1| "./numeric.html#./numeric:s68")
(|subset-mode| "./system.html#./system:s241")
(|subst| "./objects.html#./objects:s11")
(|subst!| "./objects.html#./objects:s11")
(|substq| "./objects.html#./objects:s11")
(|substq!| "./objects.html#./objects:s11")
(|substring| "http://scheme.com/tspl4/./binding.html#./binding:s15")
(|substring-fill!| "./objects.html#./objects:s22")
(|substv| "./objects.html#./objects:s11")
(|substv!| "./objects.html#./objects:s11")
(|subtract-duration| "./system.html#./system:s187")
(|subtract-duration!| "./system.html#./system:s187")
(|Sunbox| "./foreign.html#./foreign:s217")
(|Sunlock_object| "./foreign.html#./foreign:s270")
(|Sunlocked_objectp| "./foreign.html#./foreign:s271")
(|Sunsigned| "./foreign.html#./foreign:s248")
(|Sunsigned_value| "./foreign.html#./foreign:s209")
(|Sunsigned32| "./foreign.html#./foreign:s250")
(|Sunsigned32_value| "./foreign.html#./foreign:s211")
(|Sunsigned64| "./foreign.html#./foreign:s252")
(|Sunsigned64_value| "./foreign.html#./foreign:s213")
(|suppress-greeting| "./system.html#./system:s175")
(|Sutf8_to_wide| "./foreign.html#./foreign:s262")
(|Svector_length| "./foreign.html#./foreign:s219")
(|Svector_ref| "./foreign.html#./foreign:s223")
(|Svector_set| "./foreign.html#./foreign:s231")
(|Svectorp| "./foreign.html#./foreign:s192")
(|Svoid| "./foreign.html#./foreign:s239")
(|Swide_to_utf8| "./foreign.html#./foreign:s263")
(|symbol->string| "http://scheme.com/tspl4/./objects.html#./objects:s270")
(|symbol-hash| "http://scheme.com/tspl4/./objects.html#./objects:s279")
(|symbol-hashtable-cell| "./objects.html#./objects:s133")
(|symbol-hashtable-contains?| "./objects.html#./objects:s131")
(|symbol-hashtable-delete!| "./objects.html#./objects:s134")
(|symbol-hashtable-ref| "./objects.html#./objects:s130")
(|symbol-hashtable-set!| "./objects.html#./objects:s129")
(|symbol-hashtable-update!| "./objects.html#./objects:s132")
(|symbol-hashtable?| "./objects.html#./objects:s128")
(|symbol=?| "http://scheme.com/tspl4/./objects.html#./objects:s268")
(|symbol?| "http://scheme.com/tspl4/./start.html#./start:s119")
(|syntax| "http://scheme.com/tspl4/./syntax.html#./syntax:s8")
(|syntax| |#'| "http://scheme.com/tspl4/./syntax.html#./syntax:s33")
(|syntax->annotation| "./syntax.html#./syntax:s46")
(|syntax->datum| "http://scheme.com/tspl4/./syntax.html#./syntax:s44")
(|syntax->list| "./syntax.html#./syntax:s6")
(|syntax->vector| "./syntax.html#./syntax:s7")
(|syntax-case| "./compat.html#./compat:s29")
(|syntax-error| "./syntax.html#./syntax:s13")
(|syntax-object->datum| "./syntax.html#./syntax:s8")
(|syntax-rules| "./syntax.html#./syntax:s4")
(|syntax-violation| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s6")
(|syntax-violation-form| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s30")
(|syntax-violation-subform| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s30")
(|syntax-violation?| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s30")
(|system| "./foreign.html#./foreign:s4")
(|tan| "http://scheme.com/tspl4/./objects.html#./objects:s131")
(|tanh| "./numeric.html#./numeric:s76")
(|tell| "http://scheme.com/tspl4/./start.html#./start:s170")
(|textual-port-input-buffer| "./io.html#./io:s14")
(|textual-port-input-count| "./io.html#./io:s16")
(|textual-port-input-index| "./io.html#./io:s14")
(|textual-port-input-size| "./io.html#./io:s14")
(|textual-port-output-buffer| "./io.html#./io:s18")
(|textual-port-output-count| "./io.html#./io:s20")
(|textual-port-output-index| "./io.html#./io:s18")
(|textual-port-output-size| "./io.html#./io:s18")
(|textual-port?| "http://scheme.com/tspl4/./io.html#./io:s45")
(|thread-condition?| "./threads.html#./threads:s12")
(|thread?| "./threads.html#./threads:s3")
(|threaded?| "./system.html#./system:s235")
;;"./system.html#./system:s197")
(|time-difference| "./system.html#./system:s187")
(|time-difference!| "./system.html#./system:s187")
(|time-nanosecond| "./system.html#./system:s183")
(|time-second| "./system.html#./system:s183")
(|time-type| "./system.html#./system:s183")
(|time-utc->date| "./system.html#./system:s194")
(|time<=?| "./system.html#./system:s185")
(|time<?| "./system.html#./system:s185")
(|time=?| "./system.html#./system:s185")
(|time>=?| "./system.html#./system:s185")
(|time>?| "./system.html#./system:s185")
(|time?| "./system.html#./system:s182")
(|timer-interrupt-handler| "./system.html#./system:s24")
(|top-level-bound?| "./binding.html#./binding:s30")
(|top-level-mutable?| "./binding.html#./binding:s31")
(|top-level-program| "./libraries.html#./libraries:s12")
(|top-level-syntax| "./binding.html#./binding:s34")
(|top-level-syntax?| "./binding.html#./binding:s35")
(|top-level-value| "./binding.html#./binding:s29")
(|trace| "./debug.html#./debug:s9")
(|trace-case-lambda| "./debug.html#./debug:s3")
(|trace-define| "./debug.html#./debug:s14")
(|trace-define-syntax| "./debug.html#./debug:s15")
(|trace-do| "./debug.html#./debug:s7")
(|trace-lambda| "./debug.html#./debug:s0")
(|trace-let| "./debug.html#./debug:s5")
(|trace-output-port| "./debug.html#./debug:s11")
(|trace-print| "./debug.html#./debug:s12")
(|transcoded-port| "http://scheme.com/tspl4/./io.html#./io:s47")
(|transcoder-codec| "http://scheme.com/tspl4/./io.html#./io:s20")
(|transcoder-eol-style| "http://scheme.com/tspl4/./io.html#./io:s20")
(|transcoder-error-handling-mode| "http://scheme.com/tspl4/./io.html#./io:s20")
(|transcoder?| "./io.html#./io:s10")
(|transcript-cafe| "./system.html#./system:s179")
(|transcript-off| "./system.html#./system:s178")
(|transcript-on| "./system.html#./system:s177")
(|tree-copy| "http://scheme.com/tspl4/./start.html#./start:s144")
(|truncate| "http://scheme.com/tspl4/./objects.html#./objects:s101")
(|truncate-file| "./io.html#./io:s79")
(|truncate-port| "./io.html#./io:s79")
(|type-descriptor| "./objects.html#./objects:s174")
(|u16*| "./foreign.html#./foreign:s16")
(|u32*| "./foreign.html#./foreign:s17")
(|u8*| "./foreign.html#./foreign:s15")
(|u8-list->bytevector| "http://scheme.com/tspl4/./objects.html#./objects:s253")
(|uint-list->bytevector| "http://scheme.com/tspl4/./objects.html#./objects:s261")
(|unbox| "./objects.html#./objects:s81")
(|undefined-variable-warnings| "./system.html#./system:s116")
(|undefined-violation?| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s31")
(|_| "http://scheme.com/tspl4/./further.html#./further:s17")
(|_| "http://scheme.com/tspl4/./syntax.html#./syntax:s19")
(|unget-char| "./io.html#./io:s59")
(|unget-u8| "./io.html#./io:s60")
(|unify| "http://scheme.com/tspl4/./examples.html#./examples:s78")
(|unless| "http://scheme.com/tspl4/./further.html#./further:s31")
(|UNLOCK| "./foreign.html#./foreign:s288")
(|unlock-object| "./foreign.html#./foreign:s269")
(|unquote| |,| "http://scheme.com/tspl4/./objects.html#./objects:s5")
(|unquote-splicing| |,@| "http://scheme.com/tspl4/./objects.html#./objects:s5")
(|unread-char| "./io.html#./io:s59")
(|unsigned| "./foreign.html#./foreign:s41")
(|unsigned long| "./foreign.html#./foreign:s44")
(|unsigned short| "./foreign.html#./foreign:s39")
(|unsigned-16| "./foreign.html#./foreign:s31")
(|unsigned-32| "./foreign.html#./foreign:s33")
(|unsigned-64| "./foreign.html#./foreign:s35")
(|unsigned-8| "./foreign.html#./foreign:s29")
(|unsigned-int| "./foreign.html#./foreign:s42")
(|unsigned-long-long| "./foreign.html#./foreign:s46")
(|unsyntax| |#,| "http://scheme.com/tspl4/./syntax.html#./syntax:s40")
(|unsyntax-splicing| |#,@| "http://scheme.com/tspl4/./syntax.html#./syntax:s40")
(|untrace| "./debug.html#./debug:s10")
(|uptr| "./foreign.html#./foreign:s51")
(|utf-16-codec| "./io.html#./io:s7")
(|utf-16be| "./foreign.html#./foreign:s20")
(|utf-16be-codec| "./io.html#./io:s7")
(|utf-16le| "./foreign.html#./foreign:s19")
(|utf-16le-codec| "./io.html#./io:s7")
(|utf-32be| "./foreign.html#./foreign:s22")
(|utf-32le| "./foreign.html#./foreign:s21")
(|utf-8| "./foreign.html#./foreign:s18")
(|utf-8-codec| "http://scheme.com/tspl4/./io.html#./io:s22")
(|utf16->string| "http://scheme.com/tspl4/./io.html#./io:s96")
(|utf32->string| "http://scheme.com/tspl4/./io.html#./io:s96")
(|utf8->string| "http://scheme.com/tspl4/./io.html#./io:s95")
(|values| "http://scheme.com/tspl4/./control.html#./control:s68")
(|vector| "http://scheme.com/tspl4/./objects.html#./objects:s231")
(|vector->immutable-vector| "./objects.html#./objects:s30")
(|vector->list| "http://scheme.com/tspl4/./objects.html#./objects:s237")
(|vector-cas!| "./objects.html#./objects:s33")
(|vector-copy| "./objects.html#./objects:s31")
(|vector-fill!| "http://scheme.com/tspl4/./objects.html#./objects:s236")
(|vector-for-each| "http://scheme.com/tspl4/./control.html#./control:s47")
(|vector-length| "http://scheme.com/tspl4/./objects.html#./objects:s233")
(|vector-map| "http://scheme.com/tspl4/./control.html#./control:s44")
(|vector-ref| "http://scheme.com/tspl4/./objects.html#./objects:s234")
(|vector-set!| "http://scheme.com/tspl4/./objects.html#./objects:s235")
(|vector-set-fixnum!| "./objects.html#./objects:s32")
(|vector-sort| "http://scheme.com/tspl4/./objects.html#./objects:s239")
(|vector-sort!| "http://scheme.com/tspl4/./objects.html#./objects:s239")
(|vector?| "http://scheme.com/tspl4/./objects.html#./objects:s21")
(|violation?| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s20")
(|virtual-register| "./system.html#./system:s231")
(|virtual-register-count| "./system.html#./system:s229")
(|visit| "./system.html#./system:s51")
(|void| "./intro.html#./intro:s32")
(|void*| "./foreign.html#./foreign:s52")
(|waiter-prompt-and-read| "./system.html#./system:s153")
(|waiter-prompt-string| "./system.html#./system:s152")
(|waiter-write| "./system.html#./system:s155")
(|warning| "./system.html#./system:s1")
(|warning?| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s23")
(|warningf| "./system.html#./system:s2")
(|wchar| "./foreign.html#./foreign:s57")
(|wchar_t| "./foreign.html#./foreign:s56")
(|weak-cons| "./smgmt.html#./smgmt:s24")
(|weak-pair?| "./smgmt.html#./smgmt:s25")
(|when| "./compat.html#./compat:s13")
(|who-condition?| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s26")
(|with| "./compat.html#./compat:s20")
(|with-cost-center| "./system.html#./system:s221")
(|with-exception-handler| "http://scheme.com/tspl4/./exceptions.html#./exceptions:s7")
(|with-implicit| "./syntax.html#./syntax:s11")
(|with-input-from-file| "./io.html#./io:s53")
(|with-input-from-string| "./io.html#./io:s40")
(|with-interrupts-disabled| "./system.html#./system:s27")
(|with-mutex| "./threads.html#./threads:s10")
(|with-output-to-file| "./io.html#./io:s71")
(|with-output-to-string| "./io.html#./io:s44")
(|with-source-path| "./system.html#./system:s95")
(|with-syntax| "http://scheme.com/tspl4/./syntax.html#./syntax:s38")
(|write| "http://scheme.com/tspl4/./io.html#./io:s84")
(|write-char| "http://scheme.com/tspl4/./io.html#./io:s86")
(|wstring| "./foreign.html#./foreign:s14")
(|x++| "http://scheme.com/tspl4/./syntax.html#./syntax:s63")
(|zero?| "http://scheme.com/tspl4/./objects.html#./objects:s93")
;; end
)
| true |
422cda6b073938a2b53ab77e9fefc6ad2fc419d4 | 436ffe1a05d0e75f767ece1230a4b81f227a1268 | /test/stats.scm | fe5fc5bd862e3329cb7e153ce666d8537beacdfd | []
| no_license | axch/venture-pre-v1 | 92d2de8b80a5957105726187a3ca66915ae553a9 | 571aef73db6e5464937b6f46089b5c394b1f81e2 | refs/heads/master | 2021-08-09T02:30:13.561039 | 2017-11-11T21:52:31 | 2017-11-11T21:52:31 | 110,304,296 | 0 | 0 | null | 2017-11-11T00:05:54 | 2017-11-11T00:05:53 | null | UTF-8 | Scheme | false | false | 5,555 | scm | stats.scm | ;;; Copyright (c) 2014 MIT Probabilistic Computing Project.
;;;
;;; This file is part of Venture.
;;;
;;; Venture is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation, either version 3 of the License, or
;;; (at your option) any later version.
;;;
;;; Venture is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with Venture. If not, see <http://www.gnu.org/licenses/>.
(declare (usual-integrations))
;;; From http://en.wikipedia.org/wiki/Kolmogorov-Smirnov_test
(define (k-s-cdf-series-one-term x k)
(* (expt -1 (- k 1))
(exp (* -2 k k x x))))
(define (sum-series term)
(let loop ((next-k 1)
(total 0))
(let ((next-term (term next-k)))
(if (< (abs (* next-term 1e14)) (abs total))
(+ total next-term)
(loop (+ next-k 1)
(+ total next-term))))))
(define (k-s-cdf-by-series-one x)
(sum-series (lambda (k) (k-s-cdf-series-one-term x k))))
(define (kolmogorov-survivor-function-by-series-one x)
(* 2 (k-s-cdf-by-series-one x)))
(define (k-s-D-stat data cdf)
(let* ((data (sort data <))
(n (length data))
(cdfvals (map cdf data))
(D+ (scheme-apply
max (map (lambda (i cdfval)
(- (/ (+ i 1) n) cdfval))
(iota n) cdfvals)))
(D- (scheme-apply
min (map (lambda (i cdfval)
(- (/ i n) cdfval))
(iota n) cdfvals))))
(max (abs D+) (abs D-))))
(define (k-s-test data cdf)
(let* ((n (length data))
(D-stat (k-s-D-stat data cdf))
(p-value (kolmogorov-survivor-function-by-series-one (* D-stat (sqrt n)))))
; (pp (list 'program-samples (sort data <) 'D-stat D-stat 'p-value p-value))
p-value))
#|
(define (uniform-cdf low high)
(lambda (place)
(min 1
(max 0
(/ (- place low)
(- high low))))))
1 ]=> (k-s-test '(.1 .1 .2) (uniform-cdf 0 1))
;Value 20: (.8 4.2986775848567596e-2)
1 ]=> (k-s-test '(.1 .1 .2 .3) (uniform-cdf 0 1))
;Value 21: (.7 3.9681879538114403e-2)
1 ]=> (k-s-test '(.1 .2 .3) (uniform-cdf 0 1))
;Value 22: (.7 .10571583583368427)
1 ]=> (k-s-test '(.1 .2 .3 .9) (uniform-cdf 0 1))
;Value 23: (.45 .39273070794065434)
1 ]=> (k-s-test '(.1 .2 .3 .8 .9) (uniform-cdf 0 1))
;Value 24: (.3 .7590978384203949)
1 ]=> (k-s-test '(.1 .2 .3 .8 .9 .1 .2 .3 .8 .9) (uniform-cdf 0 1))
;Value 25: (.3 .32910478909781504)
1 ]=> (k-s-test '(.1 .2 .3 .8 .9 .1 .2 .3 .8 .9 .1 .2 .3 .8 .9) (uniform-cdf 0 1))
;Value 26: (.3 .13437022652861091)
1 ]=> (k-s-test '(.1 .2 .3 .8 .9 .1 .2 .3 .8 .9 .1 .2 .3 .8) (uniform-cdf 0 1))
;Value 27: (.3428571428571429 .07439750491383416)
1 ]=>
|#
;;; Chisq
(define-syntax ucode-primitive
(sc-macro-transformer
(lambda (form environment)
environment
((access apply system-global-environment)
make-primitive-procedure (cdr form)))))
(load-library-object-file (merge-pathnames "c-stats.so") #f)
(define (gsl-cdf-chisq-q x nu)
(if (> x 1e4)
0 ; TODO Poor man's underflow guard
((ucode-primitive GSL_CDF_CHISQ_Q 2)
(->flonum x) (->flonum nu))))
(define (chi-sq-test data frequencies)
(let* ((dof (length frequencies))
(n (length data))
(expected-counts (map (lambda (freq) (* n freq))
(map cdr frequencies)))
(actual-counts (map (lambda (item)
(count-matching-items data (lambda (d) (equal? d item))))
(map car frequencies)))
(stat (scheme-apply
+ (map (lambda (actual expected)
(/ (expt (- actual expected) 2)
expected))
actual-counts
expected-counts)))
(p-value (gsl-cdf-chisq-q stat (- dof 1))))
(fluid-let ((flonum-unparser-cutoff '(relative 5 normal)))
(pp `( expected ,(map exact->inexact expected-counts)
actual ,actual-counts
chi-sq ,(exact->inexact stat)
p-value ,p-value)))
p-value))
#|
1 ]=> (chi-sq-test '(#t #t #t #f #f) '((#t . 0.5) (#f . 0.5)))
;Value 18: (.2 .6547208460185772)
1 ]=> (chi-sq-test '(#t #t #t #f) '((#t . 0.5) (#f . 0.5)))
;Value 17: (1. .3173105078629138)
1 ]=> (chi-sq-test '(#t #t #t #f #t #t #t #f #t #t #t #f #t #t #t #f #t #t #t #f) '((#t . 0.5) (#f . 0.5)))
;Value 16: (5. .02534731867746824)
|#
(define (gsl-cdf-gaussian-p x sigma)
((ucode-primitive GSL_CDF_GAUSSIAN_P 2)
(->flonum x) (->flonum sigma)))
(define (gaussian-cdf x mu sigma)
(gsl-cdf-gaussian-p (- x mu) sigma))
(define (gsl-sf-lngamma x)
((ucode-primitive GSL_SF_LNGAMMA 1) (->flonum x)))
(define log-gamma gsl-sf-lngamma)
(define (gsl-ran-gamma-pdf x shape theta)
((ucode-primitive GSL_RAN_GAMMA_PDF 3)
(->flonum x) (->flonum shape) (->flonum theta)))
(define ((gamma-pdf alpha beta) x)
(gsl-ran-gamma-pdf x alpha (/ 1 beta)))
(define (gsl-cdf-gamma-p x shape theta)
((ucode-primitive GSL_CDF_GAMMA_P 3)
(->flonum x) (->flonum shape) (->flonum theta)))
(define ((gamma-cdf alpha beta) x)
(gsl-cdf-gamma-p x alpha (/ 1 beta)))
| true |
7a2d88eae3be61b733f6ef71fa50f2fa02cfa683 | f033ff2c78c89e2d7d24d7b8e711fa6d1b230142 | /ccc/sequential/benchmarks/lab/world.ss | 6e31b920b06da9df10f2d32625730d936b7eb079 | []
| no_license | zane/research | 3cb47d47bb2708f6e83ee16cef89647a47db139d | 8b4ecfe6035fe30c9113f3add380c91598f7262a | refs/heads/master | 2021-01-01T19:09:58.166662 | 2009-12-16T16:53:57 | 2009-12-16T16:53:57 | 62,193 | 1 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 4,621 | ss | world.ss | (module world scheme
(require "../../contract.ss")
(provide (all-defined-out))
;; a base is one of
;; -- 'A
;; -- 'T
;; -- 'C
;; -- 'G
;;an m-base is one of
;; -- 'X
;; -- 'Y
;;base?: symbol? -> boolean?
(define (base? b)
(or (symbol=? 'A b)
(symbol=? 'T b)
(symbol=? 'C b)
(symbol=? 'G b)))
;;m-base?: symbol? -> boolean?
(define (m-base? b)
(or (symbol=? 'X b)
(symbol=? 'Y b)))
;;complement: symbol? symbol? -> boolean?
(define (complement? b1 b2)
(and (base? b1)
(base? b2)
(or (and (symbol=? b1 'A) (symbol=? b2 'T))
(and (symbol=? b1 'T) (symbol=? b2 'A))
(and (symbol=? b1 'C) (symbol=? b2 'G))
(and (symbol=? b1 'G) (symbol=? b2 'C))
(and (symbol=? b1 'X) (symbol=? b2 'Y))
(and (symbol=? b1 'Y) (symbol=? b2 'X)))))
;;a dna-chain is a [listof base?]
;;dna-chain?: [listof symbol?] --> boolean?
(define dna-chain?
(lambda (chain)
(andmap base? chain)))
;;m-dna-chain?: [listof symbol?] --> boolean?
(define m-dna-chain?
(lambda (chain)
(andmap (lambda (b)
(or (base? b) (m-base? b))) chain)))
;;complement-dna?: dna-chain? dna-chain? --> boolean?
(define (complement-dna? d1 d2)
(andmap complement? d1 d2))
(define-struct cell (rchain lchain))
;;a cell is (make-cell dna-chain? dna-chain?)
;; where (complement-dna? rchain lchain)
;;valid-cell?: cell? --> boolean?
(define valid-cell?
(lambda (c)
(and (dna-chain? (cell-lchain c))
(complement-dna? (cell-lchain c) (cell-rchain c)))))
;;mutated-cell?: cell? --> boolean?
(define mutated-cell?
(lambda (c)
(and (m-dna-chain? (cell-lchain c))
(complement-dna? (cell-lchain c) (cell-rchain c)))))
;;dead-cell?: cell? --> boolean?
(define dead-cell?
(lambda (c)
(and
(null? (cell-lchain c))
(null? (cell-rchain c)))))
(define-struct virus (tdna ddna))
;; a virus is a (make-virus dna-chain?)
;;valid-virus?: virus? --> boolean?
(define valid-virus?
(lambda (v)
(m-dna-chain? (virus-ddna v))))
;;complement-chain: dna-chain? -> dna-chain?
(define (complement-chain chain)
(cond ((null? chain) chain)
(else
(let ((base (car chain)))
(cond ((symbol=? base 'A) (cons 'T
(complement-chain
(rest chain))))
((symbol=? base 'T) (cons 'A
(complement-chain
(rest chain))))
((symbol=? base 'C) (cons 'G
(complement-chain
(rest chain))))
((symbol=? base 'G) (cons 'C
(complement-chain
(rest chain))))
((symbol=? base 'X) (cons 'Y
(complement-chain
(rest chain))))
((symbol=? base 'Y) (cons 'X
(complement-chain
(rest chain)))))))))
;;random-dna-base: () -> base?
(define (random-dna-base j)
(let ((base (modulo j 4)))
(cond ((= base 0) 'A)
((= base 1) 'T)
((= base 2) 'G)
(else 'C))))
;;random-m-dna-base: () -> base?
(define (random-m-dna-base j)
(let ((base (modulo j 6)))
(cond ((= base 0) 'A)
((= base 1) 'T)
((= base 2) 'G)
((= base 3) 'C)
((= base 4) 'X)
(else 'Y))))
)
| false |
cea8a5324232a8b5fca972332f70062789ee0a1c | 614f19affc17608380f8c9306b1b9abc2639bae4 | /test/r7rs-test.scm | ea3153c6510611177d9c62db624c1727abd75417 | [
"Apache-2.0"
]
| permissive | drewc/gxjs | 04e744310b79fef437c7ca76deedf67a25fb067a | 4987bc66bb301b2d1d006a433888c5ad04e3f978 | refs/heads/main | 2023-04-21T01:09:10.810675 | 2021-05-09T18:48:31 | 2021-05-09T18:48:31 | 324,202,474 | 16 | 2 | null | null | null | null | UTF-8 | Scheme | false | false | 16,625 | scm | r7rs-test.scm | (define (test> name i pred j)
(let ((res (pred i j)))
(if res
(##inline-host-statement
"try {
console.log('Success!', g_scm2host(@1@), g_scm2host(@2@));
} catch {
console.log('Made it!', g_scm2host(@1@), (@2@));
};"
name i)
(##inline-host-statement
" try {
console.error('failed :(', g_scm2host(@1@), g_scm2host(@2@), 'not predicated', g_scm2host(@3@), (@3@), (@2@));
} catch {
console.error('total fail', g_scm2host(@1@), (@2@), (@3@))
}"
name i j))))
(define (test-r7rs)
(test> "1 + 1 + 1 using + =" (+ 1 1 1) = 3)
(test> "(+ 1) using + =" (+ 1) = 1)
(test> "1 + 1 + 1.5 using + =" (+ 1 1 1.5) = 3.5)
(test> "2 x 2 x 2 using * =" (* 2 2 2) = 8)
(test> "1 / 2 using / =" (/ 1 2) = 0.5)
(test> "2-1.5-.5 using - =" (- 2 1.5 .5) = 0)
(test> "0 = 0 " 0 = 0)
(test> "2 < 3 < 4 using < eq? #t " (< 2 3 4) eq? #t)
(test> "2 > 1 > 0 using > eq? #t " (> 2 1 0) eq? #t)
(test> "2 <= 3 <= 3 using <= eq? #t " (<= 2 3 3) eq? #t)
(test> "3 >= 3 >= 1 using >= eq? #t " (>= 3 3 1) eq? #t)
(test> "abs(1.5)" (abs -1.5) = 1.5)
(test> "and is auto? and #t #t 42" (and #t #t 42) = 42)
(test> "append works" (append '(1) '(4) '(2)) equal? '(1 4 2))
(test> "Assoc 1 ((1 . 42) (6 . 2))'"
(assoc 1 '((1 . 42) (6 . 2))) equal? '(1 . 42))
(test> "Assq 'one ((one . 42) (6 . 2))'"
(assq 'one '((one . 42) (6 . 2))) equal? '(one . 42))
(test> "Assv 'one ((one . 42) (6 . 2))'"
(assv 'one '((one . 42) (6 . 2))) equal? '(one . 42))
(test> "begin works" (begin '(1) '(4) 42) = 42)
(test> "boolean=?" (boolean=? #t #t #t) eq? #t)
(test> "boolean=? fail" (boolean=? #t #f #t) eq? #f)
(test> "boolean? #t" (boolean? #t) eq? #t)
(test> "boolean? #f" (boolean? #f) eq? #t)
(test> "boolean? 'foo" (boolean? 'foo) eq? #f)
(test> "bytevector" (let* ((b (bytevector 4))
(v (bytevector 2))
(bv (bytevector-append b v))
(a (bytevector-copy b))
(u (bytevector 4 0))
(_ (bytevector-copy! u 1 (bytevector 4 2 0) 1 2))
(l (bytevector-length u))
(four (bytevector-u8-ref bv 0))
(_ (bytevector-u8-set! v 0 42))
)
(list
(bytevector? bv)
(equal? bv (bytevector 4 2))
(equal? v (bytevector 42))
(equal? a b)
(equal? u bv)
(= 2 l)
(= 4 four)
))
equal? '(#t #t #t #t #t #t #t
))
(test> "caar ((42))" (caar '((42))) = 42)
(test> "cadr (41 42)" (cadr '(41 42)) = 42)
#;(##inline-host-statement "console.error(@1@)" (call-with-values (lambda (a b c) a) (values 1 2 3)))
(test> "car (42)" (car '(42)) = 42)
(test> "case?" (case 'foo
((foo) 42)
(else 0)) = 42)
(test> "cdar ((1 . 42))" (cdar '((1 . 42))) = 42)
(test> "cddr (0 1 . 42)" (cddr '(0 1 . 42)) = 42)
(test> "cdr (1 . 42)" (cdr '(1 . 42)) = 42)
(test> "ceiling 41.42" (ceiling 41.42) = 42)
(test> "char->integer #\\*" (char->integer #\*) = 42)
;; char-ready?
(test> "char<=? #\\a #\\b #\\b #\\c" (char<=? #\a #\b #\b #\c) eq? #t)
(test> "char<? #\\a #\\b #\\c" (char<? #\a #\b #\c) eq? #t)
(test> "char=? #\\a #\\b => #f" (char=? #\a #\b) eq? #f)
(test> "char=? #\\a #\\a => #t" (char=? #\a #\a) eq? #t)
(test> "char>=? #\\a #\\b #\\c => #f" (char>=? #\a #\b #\c) eq? #f)
(test> "char>? #\\a #\\b #\\c => #f" (char>? #\a #\b #\c) eq? #f)
(test> "char? #\\a" (char? #\a) eq? #t)
(test> "char? 42 => #f" (char? 42) eq? #f)
(test> "complex? 42" (complex? 42) eq? #t)
(test> "cond" (cond ((= 42 42.0) 42) (else 0))= 42)
(test> "cond else" (cond ((= 42 42.1) 42) (else 0)) equal? 0)
(test> "cond-expand" (cond-expand (foo 41) (else 42)) = 42)
(test> "cons" (cons 4 2) equal? '(4 . 2))
;;(##inline-host-statement "console.error(g_scm2host(@1@))" '(("make" . "me") ("an" . "object")))
(test> "define" ((lambda () (define n 42) (define (en) n) (en))) = 42)
;; Works but needs structs
(test> "define-record-type"
((lambda ()
(define-record-type <pare>
(kons x y)
pare?
(x kar set-kar!)
(y kdr)) (kar (kons 42 0)))
)
= 42)
(test> "define-syntax"
((lambda ()
(define-syntax %when
(syntax-rules ()
((%when test result1 result2 ...)
(if test
(begin result1 result2 ...)))))
(%when #t 42)))
= 42)
;; (test> "define-values" ((lambda () (define-values (b a) (values 42 42)) a)) eq? 42)
(test> "denominator 1/2" (denominator 1/2) = 2)
(test> "do" (do ((vec (make-vector 5))
(i 0 (+ i 1)))
((= i 5) vec)
(vector-set! vec i i))
equal? #(0 1 2 3 4))
;; (test> "dynamic-wind" (dynamic-wind (lambda () 41) (lambda () 42) (lambda () 43)) = 42)
(test> "eof object" (eof-object? (eof-object)) eq? #t)
(test> "eq? 12 12.0 => #f" (eq? 12 12.0) eq? #f)
(test> "eq? 'this 'this => #t" (eq? 'this 'this) eq? #t)
(test> "eqv? 12 12.0 => #f" (eqv? 12 12.0) eq? #f)
(test> "eqv? 12 12 => #t" (eqv? 12 12) eq? #t)
(test> "equal? 12 12.0 => #f" (equal? 12 12.0) eq? #f)
(test> "equal? \"12\" \"12\" => #t" (equal? "12" "12") eq? #t)
;; (test> "error" (error "Does error work?") eq? #t)
(test> "even? 12 => #t" (even? 12) eq? #t)
;; (test> "(exact 0.5) => 1/2)" (exact 0.5) equal? 1/2)
(test> "(exact-integer? 0.5) => #f)" (exact-integer? 0.5) eq? #f)
;; (test> "(exact-integer-sqrt r5) => #t)" (exact-integer-sqrt 5) eq? #t)
(test> "(exact? 5) => #t)" (exact? 5) eq? #t)
(test> "(exact? 42.6666) => #f)" (exact? 42.666) eq? #f)
(test> "(exact? 1/3) => #t)" (exact? 1/3) eq? #t)
(test> "(expt 2 2) => 4)" (expt 2 2) = 4)
;; (test> "(list? (features)) => #t)" (list? (features)) eq? #t)
(test> "(floor 3/2) => 1)" (floor 3/2) = 1)
(test> "(floor-quotient 5 2) => 2)" (floor-quotient 5 2) = 2)
(test> "(floor-remainder 5 2) => 1)" (floor-remainder 5 2) = 1)
(test> "for-each" ((lambda ()
(define n 0)
(for-each (lambda (k) (set! n k))
'(1 2 3 42))
n)) = 42)
(test> "(gcd 5 2) => 1)" (##gcd 5 2) = 1)
#;(test> "guard" (guard (condition
((assq ’a condition) => cdr)
((assq ’b condition)))
(raise (list (cons ’a 42))))
= 42)
(test> "integer->char" (integer->char 42) equal? #\*)
(test> "integer? 42" (integer? 42) eq? #t)
(test> "integer? 42.42" (integer? 42.42) eq? #f)
;(raise (list (cons a 42)))
(test> "lcm 2 7" (lcm 2 7) eq? 14)
(test> "let" (let ((a 20) (b 20) (c 2)) (+ a b c)) = 42)
(test> "let*" (let* ((a 20) (b (+ a 20)) (c (+ b 2))) c) = 42)
#;(test> "let*-values" (let*-values (((a b) (values 20 1))
((x y) (values a b)))
(+ a b x y)) = 42)
#;(test> "let-syntax" (let ((x ’outer))
(let-syntax ((m (syntax-rules () ((m) x))))
(let ((x ’inner))
(m)))) eq? 'outer)
(test> "letrec" (letrec ((even?
(lambda (n)
(if (zero? n)
#t
(odd? (- n 1)))))
(odd?
(lambda (n)
(if (zero? n)
#f
(even? (- n 1))))))
(even? 88))
eq? #t)
(test> "letrec*" (let ((x 5))
(letrec* ((foo (lambda (y) (bar x y)))
(bar (lambda (a b) (+ (* a b) a))))
(foo (+ x 3)))) = 45)
(test> "list" (list 4 2) equal? '(4 2))
(test> "list->string" (list->string '(#\4 #\2)) equal? "42")
(test> "list->vector" (list->vector '(4 2)) equal? (vector 4 2))
(test> "list-copy" (list-copy (list 4 2)) equal? '(4 2))
(test> "list-ref" (list-ref (list 4 2 42) 2) equal? 42)
(test> "list-set!" (let ((lst (list 4 2 3)))
(list-set! lst 2 42)
(list-ref lst 2)) equal? 42)
(test> "list-tail" (list-tail '(1 2 3) 2) equal? '(3))
(test> "list?" (list (list? '(1 2 3)) (list? '()) (list? 2)) equal? '(#t #t #f))
(test> "make-bytevector" (make-bytevector 4 2) equal? (make-bytevector 4 2))
(test> "make-list" (make-list 4 2) equal? '(2 2 2 2))
(test> "make-parameter" ((lambda () (define p (make-parameter 42))
(p))) = 42)
(test> "make-string" (make-string 4 #\2) equal? "2222")
(test> "make-vector" (make-vector 4 2) equal? #(2 2 2 2))
(test> "map" (map (lambda (n) (+ 1 n)) '(3 1)) equal? '(4 2))
(test> "max" (max 41 42 39 38) = 42)
(test> "member" (car (member "1" '("1" 3 4))) equal? "1")
(test> "memq" (car (memq 'fourtwo '("1" 3 fourtwo 4))) equal? 'fourtwo)
(test> "memv" (car (memv 4 '("1" 3 fourtwo 4))) equal? 4)
(test> "min" (min 141 42 339 358) = 42)
(test> "modulo" (modulo 4 3) = 1)
(test> "negative?" (negative? -3) eq? #t)
(test> "not" (not #f) eq? #t)
(test> "null?" (null? '()) eq? #t)
(test> "number->string" (number->string 42) equal? "42")
(test> "numerator" (numerator 1/2) = 1)
(test> "odd? 42" (odd? 42) eq? #f)
(test> "odd? 41" (odd? 41) eq? #t)
(test> "or 42" (or (odd? 40) #f 42) = 42)
(test> "pair?" (list (pair? 1) (pair? '(1))) equal? '(#f #t))
(test> "parameterize yay!" ((lambda () (define p (make-parameter 41))
(parameterize ((p 42)) (p)))) = 42)
(test> "positive?" (list (positive? -1) (positive? 42)) equal? '(#f #t))
(test> "procedure?" (list (procedure? -1) (procedure? list)) equal? '(#f #t))
(test> "quasiquote" (quasiquote (life the universe and everyhing))
equal? '(life the universe and everyhing))
(test> "quote" (quote (life the universe and everyhing))
equal? '(life the universe and everyhing))
(test> "quotient" (quotient 84 2) = 42)
;d; No raise yet
(test> "rational?" (list (rational? 1) (rational? 1/2) (rational? -inf.0)) equal? '(#t #t #f))
#;(test> "rationalize" (rationalize .3 1/10) = #t )
(test> "real?" (list (real? 1) (real? 1/2)) equal? '(#t #t))
(test> "remainder" (remainder 42 9) = 6)
(test> "reverse" (reverse '(2 4)) equal? '(4 2))
(test> "round" (round 41.7) = 42)
(test> "set!" (let ((a 1)) (set! a 42) a) = 42)
(test> "set-car!" (let ((a (list 1 2))) (set-car! a 42) a) equal? '(42 2))
(test> "set-cdr!" (let ((a (list 1 2))) (set-cdr! a 42) a) equal? '(1 . 42))
(test> "square" (square 2) = 4)
(test> "string" (string #\*) equal? "*")
(test> "string->list" (string->list "42") equal? (list #\4 #\2))
(test> "string->number" (string->number "42") = 42)
(test> "string->symbol" (string->symbol "42") eq? '|42|)
(test> "string->utf8" (bytevector-u8-ref (string->utf8 "*") 0) eq? 42)
(test> "string->vector" (string->vector "42") equal? (vector #\4 #\2))
(test> "string-append" (string-append "4" "2") equal? "42")
(test> "string-copy" (string-copy "42") equal? "42")
(test> "string-copy!" ((lambda ()
(define a "42345")
(define b (string-copy "abcde"))
(string-copy! b 1 a 0 2)
b))
equal? "a42de")
(test> "string-fill!" (let ((str "0242"))
(string-fill! str #\4 0 1) str)
equal? "4242")
(test> "string-for-each" (let ((lst '()))
(string-for-each (lambda (c) (set! lst (cons c lst)))
"24")
lst)
equal? (list #\4 #\2))
(test> "string-length" (string-length (make-string 42 #\0)) = 42)
(test> "string-ref" (string-ref "42" 0) eqv? #\4)
(test> "string-set!" ((lambda () (define str "02") (string-set! str 0 #\4) str))
equal? "42")
(test> "string<=?" (list (string<=? "42" "42") (string<=? "41" "42") (string<=? "43" "42"))
equal? '(#t #t #f))
(test> "string<?" (list (string<? "42" "42") (string<? "41" "42") (string<? "43" "42"))
equal? '(#f #t #f))
(test> "string>?" (list (string>? "42" "42") (string>? "41" "42") (string>? "43" "42"))
equal? '(#f #f #t))
(test> "string>=?" (list (string>=? "42" "42") (string>=? "41" "42") (string>=? "43" "42"))
equal? '(#t #f #t))
(test> "substring" (substring "0420" 1 3) equal? "42")
(test> "symbol->string" (symbol->string '|42|) equal? "42")
(test> "symbol=?" (list (symbol=? '|42|'|42| '|42|)
(symbol=? '|42|'|42| 'nope))
equal? '(#t #f))
(test> "symbol?" (list (symbol? '|42|)
(symbol? 42))
equal? '(#t #f))
(test> "syntax-rules" ((lambda ()
(define-syntax be-like-begin
(syntax-rules ()
((be-like-begin name)
(define-syntax name
(syntax-rules ()
((name expr (... ...))
(begin expr (... ...))))))))
(be-like-begin foo)
(foo 12 34 42)
)) = 42)
(test> "truncate" (list (truncate -4.3) (truncate 3.5)) equal? '(-4.0 3.0))
(test> "truncate-quotient" (list (truncate-quotient 4 2) (truncate-quotient 7 5)) equal? '(2 1))
(test> "truncate-remainder" (list (truncate-remainder 4 2) (truncate-remainder 7 5)) equal? '(0 2))
#;(test> "truncate/" ((lambda () 1
(let-values (((q r) (truncate/ 7 5))
(list q r))
))) equal? '( 1 2))
(test> "Unless" (unless #f 42) = 42)
(test> "unquote and splicing" (quasiquote ((unquote 4) (unquote-splicing '(2))))
equal? '(4 2))
(test> "utf8->string" (utf8->string (bytevector 52 50)) equal? "42")
(test> "values" (##values->list (values 4 2)) equal? '(4 2))
(test> "vector"
(let* ((v (vector 42 4 2))
(lst (vector->list v))
(sv (vector #\4 #\2))
(str (vector->string sv))
(lststr (vector-append v sv))
(vc (vector-copy lststr 3 4))
(u (vector 4 0))
(_ (vector-copy! u 1 (vector 4 2 0) 1 2))
(fv (vector 0 4 0))
(_ (vector-fill! fv 2 2 3))
(vl (vector-length (vector 0 1 2)))
(vm (vector-map (lambda (i) (+ 1 i)) (vector 3 1)))
(vr (vector-ref (vector 0 42 1) 1))
(vs (let ((v (vector 1 2)))
(vector-set! v 0 4)
v))
(v? (vector? #(1 2 3)))
)
(list v
lst
str
lststr
vc
u
fv
vl
vm
vr
vs
v?
))
equal?
(list #(42 4 2)
'(42 4 2)
"42"
#(42 4 2 #\4 #\2)
#(#\4)
#(4 2)
#(0 4 2)
3
#(4 2)
42
#(4 2)
#t
))
(test> "when" (when #t 42) = 42)
(test> "with-execption-handler" (with-exception-handler
(lambda (e) (write e) 5)
(lambda () (+ 1 (* 2 3) 35)))
= 42)
(test> "zero?" (list (zero? 0) (zero? 42)) equal? '(#t #f))
)
;; (##inline-host-statement "console.log(@1@)" (error "here"))
;; (##inline-host-statement "alert('r7rs')")
(test-r7rs)
(##inline-host-statement "window.string2list = @1@; window.test2list = g_scm2host(@2@);" (##string->list "asd") (lambda () (vector (equal? (##string->list "foo") (##string->list "foo")) (equal? "foo" "foo") (equal? #\f #\f))))
| true |
1168a0fa0a19d085dc6f7565115fa52e38a05f50 | 7cc14e6ab8e064fa967251e3249863e2cfbcc920 | /chapter-3/modularity.scm | ed6b0c270b4a4d1c5884d221bd2cb8e34496eced | []
| no_license | xueeinstein/sicp-code | 0bec79419286705f58175067d474169afd6ba5fe | 49602b0b13cb9c338b6af089f989c17890ba6085 | refs/heads/master | 2021-01-10T01:20:03.089038 | 2015-11-24T03:25:54 | 2015-11-24T03:25:54 | 43,536,317 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 3,084 | scm | modularity.scm | ;;; Bill Xue
;;; 2015-11-12
;;; Modularity of Functional Programs and Modularity of Objects
(load "inf-stream.scm")
(define random-init 10)
(define (rand-update x)
; generate random integer between 1 and 256
(let ((a 27) (b 26) (m 257))
(remainder (+ (* a x) b) m)))
(define random-numbers
(cons-stream random-init
(stream-map rand-update random-numbers)))
; Cesàro's theorem:
; The probability of two randomly selected integers being
; coprime is 6/(pi^2)
(define (map-successive-pairs f s)
(cons-stream
(f (stream-car s) (stream-ref s 1))
(map-successive-pairs f
(stream-cdr (stream-cdr s)))))
(define cesaro-stream
(map-successive-pairs (lambda (r1 r2) (= (gcd r1 r2) 1))
random-numbers))
; Monte-Carlo Method stream version
(define (monte-carlo-stream experiment-stream passed failed)
(define (next passed failed)
(cons-stream (/ passed (+ passed failed))
(monte-carlo-stream
(stream-cdr experiment-stream)
passed
failed)))
(if (stream-car experiment-stream)
(next (+ passed 1) failed)
(next passed (+ failed 1))))
(define pi
(stream-map (lambda (p)
(if (= p 0) 0 (sqrt (/ 6.0 p))))
(monte-carlo-stream cesaro-stream 0 0)))
;; Exercise 3.81
(define (random-numbers-gr op-stream)
(define random-numbers
(cons-stream
random-init
(stream-map-ext (lambda (num op)
(cond ((eq? op 'generate)
(rand-update num))
((and (pair? op)
(eq? (car op) 'reset))
; reset to new value
(cdr op))
(else
(error "Bad operation -- "
op))))
random-numbers
op-stream)))
random-numbers)
; test:
(define op-stream
(cons-stream 'generate
(cons-stream 'generate
(cons-stream (cons 'reset 1)
op-stream))))
(define xy1-stream
(random-numbers-gr op-stream))
;; Exercise 3.82
;; Monte-Carlo Integration stream version
(define (random-in-range low high)
(let ((range (- high low)))
(+ low (* (random 1.0) range))))
(define (estimate-integral-stream P x1 x2 y1 y2)
(define (experiment)
(let ((x (random-in-range x1 x2))
(y (random-in-range y1 y2)))
(P x y)))
(define experiment-stream
(stream-map (lambda (i) (experiment))
ones))
(let ((rectangle-size
(* (- x2 x1) (- y2 y1))))
(scale-stream
(monte-carlo-stream experiment-stream 0 0)
rectangle-size)))
; test:
; y = x^2 integral from 0 to 1
(define x2-integral-stream
(estimate-integral-stream (lambda (x y) (< y (* x x)))
0 1 0 1))
; (stream-ref x2-integral-stream 1000) ; very close to 1/3
| false |
f0bbf88f00af38cdc6bb5247f06d4109a3cfa483 | 4f30ba37cfe5ec9f5defe52a29e879cf92f183ee | /src/sasm/nasmx86/return.scm | 63b7a72102ec2a9a46e9ca1762a722fedd848824 | [
"MIT"
]
| permissive | rtrusso/scp | e31ecae62adb372b0886909c8108d109407bcd62 | d647639ecb8e5a87c0a31a7c9d4b6a26208fbc53 | refs/heads/master | 2021-07-20T00:46:52.889648 | 2021-06-14T00:31:07 | 2021-06-14T00:31:07 | 167,993,024 | 8 | 1 | MIT | 2021-06-14T00:31:07 | 2019-01-28T16:17:18 | Scheme | UTF-8 | Scheme | false | false | 1,250 | scm | return.scm | (need sasm/machdesc)
(define (nasm-x86-return)
(machine-description
;; return ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; primary
(instruction (input-pattern `(return))
(rewrite-rule ("ret")))
(instruction (input-pattern `(return (const (,intconst? val))))
(rewrite-rule ("ret ~" (val (lambda (x) (* 4 x))))))
;; assignment expressions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(instruction (input-pattern `(assign (,register? dest) (const (,(lambda (x) (or (label? x) (number? x))) c))))
(rewrite-rule "mov ~, ~"
(dest register)
(c (lambda (x) (cond ((label? x) (label x)) ((number? x) x) (else (error "bad constant")))))))
(instruction (input-pattern `(assign (,register? dest) (label (,label? label))))
(rewrite-rule "mov ~, ~"
(dest register)
(label label)))
(instruction (input-pattern `(assign (,register? dest) (,const-or-reg? src)))
(rewrite-rule "mov ~, ~"
(dest register)
(src const-or-reg)))
))
| false |
fe80209d07e90b9e50b2e46003102021b5ca83dc | 212b2592f429ab706aa4a6f9de9323d0e4e47132 | /3imp_sample/chap4.5-stack-model.scm | 417466c327d89e676168a5959ae8a03818296b4e | [
"MIT"
]
| permissive | bobuhiro11/myscheme | 36f9135001cbfe51a06e30d143cc8406c221a633 | af91ab98125a604d574fe4467ace6bd7d340bae5 | refs/heads/master | 2021-12-21T22:39:45.182376 | 2021-12-15T00:26:26 | 2021-12-15T00:26:26 | 17,799,023 | 0 | 0 | MIT | 2021-12-15T00:26:27 | 2014-03-16T12:41:05 | Scheme | UTF-8 | Scheme | false | false | 14,286 | scm | chap4.5-stack-model.scm | ;;; Chap 4.5 Stack Base Scheme Interpreter
;; (rec sum (lambda (x) (if (= x 0) 0 (+ x (sum (- x 1))))))
(define-syntax rec (syntax-rules ()
((_ a b) (let ((a '()))
(set! a b)))))
;; (recur count ((x '(a b c d e))) (if (null? x) 0 (+ (count (cdr x)) 1)))
(define-syntax recur
(syntax-rules ()
((_ f ((v i) ...) e ...)
((rec f (lambda (v ...) e ...))
i ...))))
;; (record (x y z) '(1 2 3) (+ x y z))
(define-syntax record
(syntax-rules ()
((_ (var ...) val exp ...)
(apply (lambda (var ...) exp ...) val))))
;; (record-case '(hello 1 2 3)
;; (hello (x y z)
;; (+ x y z))
;; (bye (x y z)
;; (- x y z)))
(define-syntax record-case
(syntax-rules (else)
((_ exp1 (else exp3 ...))
(begin exp3 ...))
((_ exp1 (key vars exp2 ...))
(if (eq? (car exp1) 'key) (record vars (cdr exp1) exp2 ...)))
((_ exp1 (key vars exp2 ...) c ...)
(if (eq? (car exp1) 'key)
(record vars (cdr exp1) exp2 ...)
(record-case exp1 c ...)))))
;; (extend
;; '((a b c) (u v))
;; '(x y z))
;;
;; => ((x y z) (a b c) (u v))
(define extend
(lambda (env rib)
(cons rib env)))
;; (set-member? 'a '(a b c)) => #f
;; (set-member? 'd '(a b c)) => #t
(define set-member?
(lambda (x s)
(cond
((null? s) #f)
((eq? x (car s)) #t)
(else (set-member? x (cdr s))))))
(define set-cons
(lambda (x s)
(if (set-member? x s)
s
(cons x s))))
(define set-union
(lambda (s1 s2)
(if (null? s1)
s2
(set-union (cdr s1)
(set-cons (car s1) s2)))))
(define set-minus
(lambda (s1 s2)
(if (null? s1)
'()
(if (set-member? (car s1) s2)
(set-minus (cdr s1) s2)
(cons (car s1) (set-minus (cdr s1) s2))))))
(define set-intersect
(lambda (s1 s2)
(if (null? s1)
'()
(if (set-member? (car s1) s2)
(cons (car s1) (set-intersect (cdr s1) s2))
(set-intersect (cdr s1) s2)))))
;; (find-free
;; '((lambda (x y) (if p q r)) 10 20) <- $BBP>]$N(Bs$B<0(B
;; '(p)) <- $BB+G{JQ?t%j%9%H$N=i4|CM(B
;;
;; => (r q)
(define find-free
(lambda (x b)
(cond
((symbol? x) (if (set-member? x b)
'()
(list x)))
((pair? x)
(record-case x
(quote (obj)
'())
(lambda (vars body)
(find-free body (set-union vars b)))
(if (test then else)
(set-union (find-free test b)
(set-union (find-free then b)
(find-free else b))))
(call/cc (exp)
(find-free exp b))
(else
(recur next ((x x))
(if (null? x)
'()
(set-union (find-free (car x) b)
(next (cdr x))))))))
(else
'()))))
;; (find-sets
;; '(lambda (p) (set! x y))
;; '(x y z)) <- $BD4$Y$?$$JQ?t(B
;;
;; => (x)
(define find-sets
(lambda (x v)
(cond
((symbol? x)
'())
((pair? x)
(record-case x
(quote (obj)
'())
(lambda (vars body)
(find-sets body (set-minus v vars)))
(if (test then else)
(set-union (find-sets test v)
(set-union (find-sets then v)
(find-sets else v))))
(set! (var x)
(set-union (if (set-member? var v)
(list var)
'())
(find-sets x v)))
(call/cc (exp)
(find-sets exp v))
(else
(recur next ((x x))
(if (null? x)
'()
(set-union (find-sets (car x) v)
(next (cdr x))))))))
(else
'()))))
(define collect-free
(lambda (vars e next)
(if (null? vars)
next
(collect-free (cdr vars) e
(compile-refer (car vars) e
(list 'argument next))))))
(define compile-refer
(lambda (x e next)
(compile-lookup x e
(lambda (n) (list 'refer-local n next))
(lambda (n) (list 'refer-free n next)))))
;; (compile-lookup
;; 'y
;; '((x y) . (z w)) <- ($BB+G{JQ?t(B($B%m!<%+%kJQ?t(B)$B$N%j%9%H(B . $B<+M3JQ?t$N%j%9%H(B)
;; (lambda (x) (list 'local x)) <- $BB+G{JQ?t$N=hM}(B
;; (lambda (x) (list 'free x)) <- $B<+M3JQ?t$N=hM}(B
;; )
;;
;; => (local 1) <- $B$=$l$>$l$N%j%9%H$G2?HVL\$+(B
(define compile-lookup
(lambda (x e return-local return-free)
(recur nxtlocal ((locals (car e)) (n 0))
(if (null? locals)
(recur nxtfree ((free (cdr e)) (n 0)) ; free list
(if (eq? (car free) x)
(return-free n)
(nxtfree (cdr free) (+ n 1))))
(if (eq? (car locals) x) ; local list
(return-local n)
(nxtlocal (cdr locals) (+ n 1)))))))
(define make-boxes
(lambda (sets vars next)
(recur f ((vars vars) (n 0))
(if (null? vars)
next
(if (set-member? (car vars) sets)
(list 'box n (f (cdr vars) (+ n 1)))
(f (cdr vars) (+ n 1)))))))
(define (compile x e s next)
(cond [(symbol? x)
(compile-refer x e
(if (set-member? x s)
(list 'indirect next)
next))]
[(pair? x)
(record-case x
[quote (obj) (list 'constant obj next)]
[lambda (vars body)
(let ([free (find-free body vars)]
[sets (find-sets body vars)])
(collect-free free e
(list 'close
(length free)
(make-boxes sets vars
(compile body
(cons vars free)
(set-union
sets
(set-intersect s free))
(list 'return (length vars))))
next)))]
[if (test then else)
(let ([thenc (compile then e s next)]
[elsec (compile else e s next)])
(compile test e s (list 'test thenc elsec)))]
[set! (var x)
(compile-lookup var e
(lambda (n)
(compile x e s (list 'assign-local n next)))
(lambda (n)
(compile x e s (list 'assign-free n next))))]
[call/cc (x)
(list 'frame
next
(list 'conti
(list 'argument
(compile x e s '(apply)))))]
[else
(let loop ([args (cdr x)]
[c (compile (car x) e s '(apply))])
(if (null? args)
(list 'frame next c)
(loop (cdr args)
(compile (car args)
e
s
(list 'argument c)))))])]
[else (list 'constant x next)]))
(define (find-free x b)
(cond [(symbol? x) (if (set-member? x b) '() (list x))]
[(pair? x)
(record-case x
[quote (obj) '()]
[lambda (vars body)
(find-free body (set-union vars b))]
[if (test then else)
(set-union (find-free test b)
(set-union (find-free then b)
(find-free else b)))]
[set! (var exp)
(if (set-member? var b)
(find-free exp b)
(set-cons var (find-free exp b)))]
[call/cc (exp)
(find-free exp b)]
[else
(let next ([x x])
(if (null? x)
'()
(set-union (find-free (car x) b)
(next (cdr x)))))])]
[else '()]))
(define *stack*
(make-vector 100))
;; (set! s (push 1 s))
(define push
(lambda (x s)
(vector-set! *stack* s x)
(+ s 1)))
;; (index s 0)
(define index
(lambda (s i)
(vector-ref *stack* (- (- s i) 1))))
;; (index-set! s 0 99)
(define index-set!
(lambda (s i v)
(vector-set! *stack* (- (- s i) 1) v)))
(define find-link
(lambda (n e)
(if (= n 0)
e
(find-link (- n 1) (index e -1)))))
(define save-stack
(lambda (s)
(let ((v (make-vector s)))
(recur copy ((i 0))
(unless (= i s)
(vector-set! v i (vector-ref *stack* i))
(copy (+ i 1))))
v)))
(define restore-stack
(lambda (v)
(let ((s (vector-length v)))
(recur copy ((i 0))
(unless (= i s)
(vector-set! *stack* i (vector-ref v i))
(copy (+ i 1))))
s)))
;(push 10 0)
;(push 20 1)
;(push 30 2)
;(push 40 3)
;
;(closure
; '(halt)
; 2 <- num of free variable
; 4) <- stack pointer
;
; => #( (halt) 40 30 )
(define closure
(lambda (body n s)
(let ((v (make-vector (+ n 1))))
(vector-set! v 0 body)
(recur f ((i 0))
(unless (= i n)
(vector-set! v (+ i 1) (index s i))
(f (+ i 1))))
v)))
(define closure-body
(lambda (c)
(vector-ref c 0)))
(define index-closure
(lambda (c n)
(vector-ref c (+ n 1))))
(define continuation
(lambda (s)
(closure
(list 'refer-local
0
(list 'nuate (save-stack s) (list 'return 0)))
0
'())))
(define (display-register a x f c s)
(newline)
(display "a=") (display a) (newline)
(display "x=") (display x) (newline)
(display "f=") (display f) (newline)
(display "c=") (display c) (newline)
(display "s=") (display s) (newline)
(display "---bottom---\n")
(map (lambda (x) (if (undefined? x)
'()
(begin
(display x)
(newline))))
(vector->list *stack*))
(display "--- top ----\n")
(newline))
(define (box x)
(cons 'box x))
(define (unbox x)
(cdr x))
(define (set-box! b x)
(set-cdr! b x))
(define (VM a x f c s)
(display-register a x f c s)
(record-case x
[halt () a]
[refer-local (n x)
(VM (index f n) x f c s)]
[refer-free (n x)
(VM (index-closure c n) x f c s)]
[indirect (x)
(VM (unbox a) x f c s)]
[constant (obj x)
(VM obj x f c s)]
[close (n body x)
(VM (closure body n s) x f c (- s n))]
[box (n x)
(index-set! s n (box (index s n)))
(VM a x f c s)]
[test (then else)
(VM a (if a then else) f c s)]
[assign-local (n x)
(set-box! (index f n) a)
(VM a x f c s)]
[assign-free (n x)
(set-box! (index-closure c n) a)
(VM a x f c s)]
[conti (x)
(VM (continuation s) x f c s)]
[nuate (stack x)
(VM a x f c (restore-stack stack))]
[frame (ret x)
(VM a x f c (push ret (push f (push c s))))]
[argument (x)
(VM a x f c (push a s))]
[apply ()
(VM a (closure-body a) s a s)]
[return (n)
(let1 s (- s n)
(VM a (index s 0) (index s 1) (index s 2) (- s 3)))]))
(define evaluate
(lambda (x)
(VM '() (compile x '() '() '(halt)) 0 '() 0)))
(define debug
(lambda (code)
(let ((opecode (compile code '() '() '(halt))))
(display opecode)
(newline)
(display (VM '() opecode 0 '() 0))
(newline))))
;(debug '(call/cc (lambda (k) (if (k #f) 10 20))))
;(debug '((lambda (x y) y) 1 2))
;(debug '(quote hello))
;(debug '((lambda (x) x) 3))
;(debug '(if #t 5 0))
;(debug '(((call/cc (lambda (c) c)) (lambda (x) x)) 11))
;(debug '((lambda (f x) (f x)) (lambda (x) x) 13))
;(debug 17)
;(debug '((lambda (x)
; ((lambda (y) x)
; (set! x 19)))
; 29))
| true |
aff3cd795fc08b74ee37e99b8fad3a2dcc4da953 | 9b2eb10c34176f47f7f490a4ce8412b7dd42cce7 | /lib-runtime/selfboot/common/library-walk.scm | c9844be8ec32d24f02eb50caabe39fced6a7a7bc | [
"LicenseRef-scancode-public-domain",
"CC0-1.0"
]
| permissive | okuoku/yuni | 8be584a574c0597375f023c70b17a5a689fd6918 | 1859077a3c855f3a3912a71a5283e08488e76661 | refs/heads/master | 2023-07-21T11:30:14.824239 | 2023-06-11T13:16:01 | 2023-07-18T16:25:22 | 17,772,480 | 36 | 6 | CC0-1.0 | 2020-03-29T08:16:00 | 2014-03-15T09:53:13 | Scheme | UTF-8 | Scheme | false | false | 1,803 | scm | library-walk.scm | (define (%selfboot-gen-loadorder libread libcheck initial-dep)
;; => (path libname ...)
;; (libread LIBNAME) => sexp
;; (libcheck LIBNAME) => LIBNAME(can be aliased) / #f(ignore)
(define order '())
(define (libnamestrip libname)
(if (pair? libname)
(let ((sy (car libname)))
(case sy
((rename except only for)
(libnamestrip (cadr libname)))
(else libname)))
libname))
(define (libname=? a b)
(cond
((and (null? a) (null? b)) #t)
(else
(and (pair? a)
(pair? b)
(let ((aa (car a))
(bb (car b)))
(and (eqv? aa bb)
(libname=? (cdr a) (cdr b))))))))
(define (libname=?/list lis nam)
(and (pair? lis)
(let ((a (car lis)))
(or (libname=? a nam)
(libname=?/list (cdr lis) nam)))))
(define (is-loaded? lib)
(let loop ((q order))
(and (pair? q)
(let ((n (caar q))
(next (cdr q)))
(or (libname=?/list n lib)
(loop next))))))
(define (tryload! lib)
(let* ((usagename (libnamestrip lib))
(truename (libcheck usagename)))
(when (and truename (not (is-loaded? truename)))
(let* ((code (libread truename))
(deps (%selfboot-library-depends code))
(syms (%selfboot-library-exports code))
(names (if (not (libname=? truename usagename))
(list truename usagename)
(list usagename))))
(for-each tryload! deps)
(set! order (cons (cons names (cons deps syms)) order))))))
(for-each tryload! (map libnamestrip initial-dep))
(set! order (reverse order))
;;(for-each (lambda (b) (write b) (newline)) order)
order)
| false |
1f5d6705f1c1a1b08f1fcfc6671b0ba0dcaab12f | 958488bc7f3c2044206e0358e56d7690b6ae696c | /scheme/dict/dictionary-test.scm | 5c1ea071301725e3a51dd1de93028fe6e3ecb39f | []
| no_license | possientis/Prog | a08eec1c1b121c2fd6c70a8ae89e2fbef952adb4 | d4b3debc37610a88e0dac3ac5914903604fd1d1f | refs/heads/master | 2023-08-17T09:15:17.723600 | 2023-08-11T12:32:59 | 2023-08-11T12:32:59 | 40,361,602 | 3 | 0 | null | 2023-03-27T05:53:58 | 2015-08-07T13:24:19 | Coq | UTF-8 | Scheme | false | false | 39,626 | scm | dictionary-test.scm | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; include guard ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(if (not (defined? included-dictionary-test))
(begin
(define included-dictionary-test #f)
(display "loading dictionary-test")(newline)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define (dictionary-test filename symbol)
(let ((name-encapsulation 'does-not-matter))
(display "testing dictionary class: ")(display symbol)(display " from file: ")
(display filename)(newline)
(load filename)
;;
(let ((a ((eval symbol))) ( b ((eval symbol))))
;;
(display"dictionary: starting unit test\n")
;; dictionaries should be empty
(if (not (a 'empty?)) (display "dictionary: unit test 0.1 failing\n"))
(if (not (b 'empty?)) (display "dictionary: unit test 0.2 failing\n"))
(if (not (equal? "{}" (a 'to-string)))
(display "dictionary: unit test 0.3 failing\n"))
(if (not (equal? "{}" (b 'to-string)))
(display "dictionary: unit test 0.4 failing\n"))
;; first insert
((a 'insert!) 1 10)
((b 'insert!) "abc" 100)
;; to-string (checking to-string with more than one key is
;; tricky as we have no control over the order of the key-value pairs)
(if (not (equal? "{1: 10}" (a 'to-string)))
(display "dictionary: unit test 0.5 failing\n"))
(if (not (equal? "{\"abc\": 100}" (b 'to-string)))
(display "dictionary: unit test 0.6 failing\n"))
;; dictionaries should not be empty
(if (a 'empty?) (display "dictionary: unit test 0.7 failing\n"))
(if (b 'empty?) (display "dictionary: unit test 0.8 failing\n"))
; (if(not (a 'check))(display"dictionary: unit test 1.1 failing\n"))
; (if(not (b 'check))(display"dictionary: unit test 1.2 failing\n"))
;; should fail
(if(not (eq? #f ((a 'find) 0)))(display"dictionary: unit test 1 failing\n"))
(if(not (eq? #f ((b 'find) "abd")))(display"dictionary: unit test 2 failing\n"))
;; should succeed
(let ((x ((a 'find) 1)))
(if (eq? #f x)(display"dictionary: unit test 3 failing\n"))
(if (not (equal? 1 (car x)))(display"dictionary: unit test 4 failing\n"))
(if (not (= 10 (cdr x)))(display"dictionary: unit test 5 failing\n")))
(let ((x ((b 'find) "abc")))
(if (eq? #f x)(display"dictionary: unit test 6 failing\n"))
(if (not (equal? "abc" (car x)))(display"dictionary: unit test 7 failing\n"))
(if (not (= 100 (cdr x)))(display"dictionary: unit test 8 failing\n")))
;; second insert
((a 'insert!) 2 20)
((b 'insert!) "def" 200)
; (if(not(a 'check))(display"dictionary: unit test 8.1 failing\n"))
; (if(not(b 'check))(display"dictionary: unit test 8.2 failing\n"))
;; should fail
(if(not(eq? #f ((a 'find) 0)))(display"dictionary: unit test 9 failing\n"))
(if(not(eq? #f ((b 'find) "abd")))(display"dictionary: unit test 10 failing\n"))
;; should succeed
(let ((x ((a 'find) 1)))
(if (eq? #f x)(display"dictionary: unit test 11 failing\n"))
(if (not (equal? 1 (car x)))(display"dictionary: unit test 12 failing\n"))
(if (not (= 10 (cdr x)))(display"dictionary: unit test 13 failing\n")))
(let ((x ((b 'find) "abc")))
(if(eq? #f x)(display"dictionary: unit test 14 failing\n"))
(if(not (equal? "abc" (car x)))(display"dictionary: unit test 15 failing\n"))
(if (not (= 100 (cdr x)))(display"dictionary: unit test 16 failing\n")))
(let ((x ((a 'find) 2)))
(if (eq? #f x)(display"dictionary: unit test 17 failing\n"))
(if (not (equal? 2 (car x)))(display"dictionary: unit test 18 failing\n"))
(if (not (= 20 (cdr x)))(display"dictionary: unit test 19 failing\n")))
(let ((x ((b 'find) "def")))
(if(eq? #f x)(display"dictionary: unit test 20 failing\n"))
(if(not (equal? "def" (car x)))(display"dictionary: unit test 21 failing\n"))
(if (not (= 200 (cdr x)))(display"dictionary: unit test 22 failing\n")))
;; third insert
((a 'insert!) 3 30)
((b 'insert!) "hij" 300)
; (if (not(a 'check))(display"dictionary: unit test 23 failing\n"))
; (if (not(b 'check))(display"dictionary: unit test 24 failing\n"))
;; should fail
(if(not(eq? #f ((a 'find) 0)))(display"dictionary: unit test 25 failing\n"))
(if(not(eq? #f ((b 'find) "abd")))(display"dictionary: unit test 26 failing\n"))
;; should succeed
(let ((x ((a 'find) 1)))
(if (eq? #f x)(display"dictionary: unit test 27 failing\n"))
(if (not (equal? 1 (car x)))(display"dictionary: unit test 28 failing\n"))
(if (not (= 10 (cdr x)))(display"dictionary: unit test 29 failing\n")))
(let ((x ((b 'find) "abc")))
(if(eq? #f x)(display"dictionary: unit test 30 failing\n"))
(if(not (equal? "abc" (car x)))(display"dictionary: unit test 31 failing\n"))
(if (not (= 100 (cdr x)))(display"dictionary: unit test 32 failing\n")))
(let ((x ((a 'find) 2)))
(if (eq? #f x)(display"dictionary: unit test 33 failing\n"))
(if (not (equal? 2 (car x)))(display"dictionary: unit test 34 failing\n"))
(if (not (= 20 (cdr x)))(display"dictionary: unit test 35 failing\n")))
(let ((x ((b 'find) "def")))
(if(eq? #f x)(display"dictionary: unit test 36 failing\n"))
(if(not (equal? "def" (car x)))(display"dictionary: unit test 37 failing\n"))
(if(not (= 200 (cdr x)))(display"dictionary: unit test 38 failing\n")))
(let ((x ((a 'find) 3)))
(if (eq? #f x)(display"dictionary: unit test 39 failing\n"))
(if (not (equal? 3 (car x)))(display"dictionary: unit test 40 failing\n"))
(if (not (= 30 (cdr x)))(display"dictionary: unit test 41 failing\n")))
(let ((x ((b 'find) "hij")))
(if(eq? #f x)(display"dictionary: unit test 42 failing\n"))
(if(not (equal? "hij" (car x)))(display"dictionary: unit test 43 failing\n"))
(if(not (= 300 (cdr x)))(display"dictionary: unit test 44 failing\n")))
;; fourth insert
((a 'insert!) 4 40)
((b 'insert!) "klm" 400)
; (if (not(a 'check))(display"dictionary: unit test 45 failing\n"))
; (if (not(b 'check))(display"dictionary: unit test 46 failing\n"))
;; should fail
(if(not(eq? #f ((a 'find) 0)))(display"dictionary: unit test 47 failing\n"))
(if(not(eq? #f ((b 'find) "abd")))(display"dictionary: unit test 48 failing\n"))
;; should succeed
(let ((x ((a 'find) 1)))
(if (eq? #f x)(display"dictionary: unit test 49 failing\n"))
(if (not (equal? 1 (car x)))(display"dictionary: unit test 50 failing\n"))
(if (not (= 10 (cdr x)))(display"dictionary: unit test 51 failing\n")))
(let ((x ((b 'find) "abc")))
(if(eq? #f x)(display"dictionary: unit test 52 failing\n"))
(if(not (equal? "abc" (car x)))(display"dictionary: unit test 53 failing\n"))
(if (not (= 100 (cdr x)))(display"dictionary: unit test 54 failing\n")))
(let ((x ((a 'find) 2)))
(if (eq? #f x)(display"dictionary: unit test 55 failing\n"))
(if (not (equal? 2 (car x)))(display"dictionary: unit test 56 failing\n"))
(if (not (= 20 (cdr x)))(display"dictionary: unit test 57 failing\n")))
(let ((x ((b 'find) "def")))
(if(eq? #f x)(display"dictionary: unit test 58 failing\n"))
(if(not (equal? "def" (car x)))(display"dictionary: unit test 59 failing\n"))
(if(not (= 200 (cdr x)))(display"dictionary: unit test 60 failing\n")))
(let ((x ((a 'find) 3)))
(if (eq? #f x)(display"dictionary: unit test 61 failing\n"))
(if (not (equal? 3 (car x)))(display"dictionary: unit test 62 failing\n"))
(if (not (= 30 (cdr x)))(display"dictionary: unit test 63 failing\n")))
(let ((x ((b 'find) "hij")))
(if(eq? #f x)(display"dictionary: unit test 64 failing\n"))
(if(not (equal? "hij" (car x)))(display"dictionary: unit test 65 failing\n"))
(if(not (= 300 (cdr x)))(display"dictionary: unit test 66 failing\n")))
(let ((x ((a 'find) 4)))
(if (eq? #f x)(display"dictionary: unit test 67 failing\n"))
(if (not (equal? 4 (car x)))(display"dictionary: unit test 68 failing\n"))
(if (not (= 40 (cdr x)))(display"dictionary: unit test 69 failing\n")))
(let ((x ((b 'find) "klm")))
(if(eq? #f x)(display"dictionary: unit test 70 failing\n"))
(if(not (equal? "klm" (car x)))(display"dictionary: unit test 71 failing\n"))
(if(not (= 400 (cdr x)))(display"dictionary: unit test 72 failing\n")))
;; fifth insert
((a 'insert!) 5 50)
((b 'insert!) "nop" 500)
; (if (not(a 'check))(display"dictionary: unit test 73 failing\n"))
; (if (not(b 'check))(display"dictionary: unit test 74 failing\n"))
;; should fail
(if(not(eq? #f ((a 'find) 0)))(display"dictionary: unit test 75 failing\n"))
(if(not(eq? #f ((b 'find) "abd")))(display"dictionary: unit test 76 failing\n"))
;; should succeed
(let ((x ((a 'find) 1)))
(if (eq? #f x)(display"dictionary: unit test 77 failing\n"))
(if (not (equal? 1 (car x)))(display"dictionary: unit test 78 failing\n"))
(if (not (= 10 (cdr x)))(display"dictionary: unit test 79 failing\n")))
(let ((x ((b 'find) "abc")))
(if(eq? #f x)(display"dictionary: unit test 80 failing\n"))
(if(not (equal? "abc" (car x)))(display"dictionary: unit test 81 failing\n"))
(if (not (= 100 (cdr x)))(display"dictionary: unit test 82 failing\n")))
(let ((x ((a 'find) 2)))
(if (eq? #f x)(display"dictionary: unit test 83 failing\n"))
(if (not (equal? 2 (car x)))(display"dictionary: unit test 84 failing\n"))
(if (not (= 20 (cdr x)))(display"dictionary: unit test 85 failing\n")))
(let ((x ((b 'find) "def")))
(if(eq? #f x)(display"dictionary: unit test 86 failing\n"))
(if(not (equal? "def" (car x)))(display"dictionary: unit test 87 failing\n"))
(if(not (= 200 (cdr x)))(display"dictionary: unit test 88 failing\n")))
(let ((x ((a 'find) 3)))
(if (eq? #f x)(display"dictionary: unit test 89 failing\n"))
(if (not (equal? 3 (car x)))(display"dictionary: unit test 90 failing\n"))
(if (not (= 30 (cdr x)))(display"dictionary: unit test 91 failing\n")))
(let ((x ((b 'find) "hij")))
(if(eq? #f x)(display"dictionary: unit test 92 failing\n"))
(if(not (equal? "hij" (car x)))(display"dictionary: unit test 93 failing\n"))
(if(not (= 300 (cdr x)))(display"dictionary: unit test 94 failing\n")))
(let ((x ((a 'find) 4)))
(if (eq? #f x)(display"dictionary: unit test 95 failing\n"))
(if (not (equal? 4 (car x)))(display"dictionary: unit test 96 failing\n"))
(if (not (= 40 (cdr x)))(display"dictionary: unit test 97 failing\n")))
(let ((x ((b 'find) "klm")))
(if(eq? #f x)(display"dictionary: unit test 98 failing\n"))
(if(not (equal? "klm" (car x)))(display"dictionary: unit test 99 failing\n"))
(if(not (= 400 (cdr x)))(display"dictionary: unit test 100 failing\n")))
(let ((x ((a 'find) 5)))
(if (eq? #f x)(display"dictionary: unit test 101 failing\n"))
(if (not (equal? 5 (car x)))(display"dictionary: unit test 102 failing\n"))
(if (not (= 50 (cdr x)))(display"dictionary: unit test 103 failing\n")))
(let ((x ((b 'find) "nop")))
(if(eq? #f x)(display"dictionary: unit test 104 failing\n"))
(if(not(equal? "nop" (car x)))(display"dictionary: unit test 105 failing\n"))
(if(not (= 500 (cdr x)))(display"dictionary: unit test 106 failing\n")))
;; sixth insert (partial find checks)
((a 'insert!) 6 60)
((b 'insert!) "qrs" 600)
; (if (not(a 'check))(display"dictionary: unit test 107 failing\n"))
; (if (not(b 'check))(display"dictionary: unit test 108 failing\n"))
;; should succeed
(let ((x ((a 'find) 6)))
(if (eq? #f x)(display"dictionary: unit test 109 failing\n"))
(if (not (equal? 6 (car x)))(display"dictionary: unit test 110 failing\n"))
(if (not (= 60 (cdr x)))(display"dictionary: unit test 111 failing\n")))
(let ((x ((b 'find) "qrs")))
(if(eq? #f x)(display"dictionary: unit test 112 failing\n"))
(if(not(equal? "qrs" (car x)))(display"dictionary: unit test 113 failing\n"))
(if (not (= 600 (cdr x)))(display"dictionary: unit test 114 failing\n")))
;; extra test: turns out there is a collision here on scm
(let ((x ((b 'find) "abc")))
(if(eq? #f x)(display"dictionary: unit test 115 failing\n"))
(if(not(equal? "abc" (car x)))(display"dictionary: unit test 116 failing\n"))
(if (not (= 100 (cdr x)))(display"dictionary: unit test 117 failing\n")))
;; seventh insert (partial find checks)
((a 'insert!) 7 70)
((b 'insert!) "tuv" 700)
; (if (not(a 'check))(display"dictionary: unit test 118 failing\n"))
; (if (not(b 'check))(display"dictionary: unit test 119 failing\n"))
;; should succeed
(let ((x ((a 'find) 7)))
(if (eq? #f x)(display"dictionary: unit test 120 failing\n"))
(if (not (equal? 7 (car x)))(display"dictionary: unit test 121 failing\n"))
(if (not (= 70 (cdr x)))(display"dictionary: unit test 122 failing\n")))
(let ((x ((b 'find) "tuv")))
(if(eq? #f x)(display"dictionary: unit test 123 failing\n"))
(if(not(equal? "tuv" (car x)))(display"dictionary: unit test 124 failing\n"))
(if (not (= 700 (cdr x)))(display"dictionary: unit test 125 failing\n")))
;; eighth insert (partial find checks)
((a 'insert!) 8 80)
((b 'insert!) "wxy" 800)
; (if (not(a 'check))(display"dictionary: unit test 126 failing\n"))
; (if (not(b 'check))(display"dictionary: unit test 127 failing\n"))
;; should succeed
(let ((x ((a 'find) 8)))
(if (eq? #f x)(display"dictionary: unit test 128 failing\n"))
(if (not (equal? 8 (car x)))(display"dictionary: unit test 129 failing\n"))
(if (not (= 80 (cdr x)))(display"dictionary: unit test 130 failing\n")))
(let ((x ((b 'find) "wxy")))
(if(eq? #f x)(display"dictionary: unit test 131 failing\n"))
(if(not(equal? "wxy" (car x)))(display"dictionary: unit test 132 failing\n"))
(if (not (= 800 (cdr x)))(display"dictionary: unit test 133 failing\n")))
;; ninth insert (partial find checks)
((a 'insert!) 9 90)
((b 'insert!) "zab" 900)
; (if (not(a 'check))(display"dictionary: unit test 134 failing\n"))
; (if (not(b 'check))(display"dictionary: unit test 135 failing\n"))
;; should succeed
(let ((x ((a 'find) 9)))
(if (eq? #f x)(display"dictionary: unit test 136 failing\n"))
(if (not (equal? 9 (car x)))(display"dictionary: unit test 137 failing\n"))
(if (not (= 90 (cdr x)))(display"dictionary: unit test 138 failing\n")))
(let ((x ((b 'find) "zab")))
(if(eq? #f x)(display"dictionary: unit test 139 failing\n"))
(if(not(equal? "zab" (car x)))(display"dictionary: unit test 140 failing\n"))
(if (not (= 900 (cdr x)))(display"dictionary: unit test 141 failing\n")))
;; insert of duplicate keys
((a 'insert!) 1 11)
((b 'insert!) "abc" 110)
; (if (not(a 'check))(display"dictionary: unit test 142 failing\n"))
; (if (not(b 'check))(display"dictionary: unit test 143 failing\n"))
;; should succeed
(let ((x ((a 'find) 1)))
(if (eq? #f x)(display"dictionary: unit test 144 failing\n"))
(if (not (equal? 1 (car x)))(display"dictionary: unit test 145 failing\n"))
(if (not (= 11 (cdr x)))(display"dictionary: unit test 146 failing\n")))
(let ((x ((b 'find) "abc")))
(if(eq? #f x)(display"dictionary: unit test 147 failing\n"))
(if(not(equal? "abc" (car x)))(display"dictionary: unit test 148 failing\n"))
(if (not (= 110 (cdr x)))(display"dictionary: unit test 149 failing\n")))
; (display (a 'to-string))(newline)
; (display (b 'to-string))(newline)
;; first delete
((a 'delete!) 1)
((b 'delete!) "abc")
; (if (not(a 'check))(display"dictionary: unit test 150 failing\n"))
; (if (not(b 'check))(display"dictionary: unit test 151 failing\n"))
;; should fail
(if(not(eq? #f ((a 'find) 1)))(display"dictionary: unit test 152 failing\n"))
(if(not(eq? #f ((b 'find) "abc")))(display"dictionary: unit test 153 failing\n"))
;; should succeed
(let ((x ((a 'find) 2)))
(if (eq? #f x)(display"dictionary: unit test 154 failing\n"))
(if (not (equal? 2 (car x)))(display"dictionary: unit test 155 failing\n"))
(if (not (= 20 (cdr x)))(display"dictionary: unit test 156 failing\n")))
(let ((x ((b 'find) "def")))
(if(eq? #f x)(display"dictionary: unit test 157 failing\n"))
(if(not(equal? "def" (car x)))(display"dictionary: unit test 158 failing\n"))
(if(not (= 200 (cdr x)))(display"dictionary: unit test 159 failing\n")))
(let ((x ((a 'find) 3)))
(if (eq? #f x)(display"dictionary: unit test 160 failing\n"))
(if (not (equal? 3 (car x)))(display"dictionary: unit test 161 failing\n"))
(if (not (= 30 (cdr x)))(display"dictionary: unit test 162 failing\n")))
(let ((x ((b 'find) "hij")))
(if(eq? #f x)(display"dictionary: unit test 162 failing\n"))
(if(not(equal? "hij" (car x)))(display"dictionary: unit test 163 failing\n"))
(if(not (= 300 (cdr x)))(display"dictionary: unit test 164 failing\n")))
(let ((x ((a 'find) 4)))
(if (eq? #f x)(display"dictionary: unit test 165 failing\n"))
(if (not (equal? 4 (car x)))(display"dictionary: unit test 165 failing\n"))
(if (not (= 40 (cdr x)))(display"dictionary: unit test 166 failing\n")))
(let ((x ((b 'find) "klm")))
(if(eq? #f x)(display"dictionary: unit test 167 failing\n"))
(if(not(equal? "klm" (car x)))(display"dictionary: unit test 168 failing\n"))
(if(not (= 400 (cdr x)))(display"dictionary: unit test 169 failing\n")))
(let ((x ((a 'find) 5)))
(if (eq? #f x)(display"dictionary: unit test 170 failing\n"))
(if (not (equal? 5 (car x)))(display"dictionary: unit test 171 failing\n"))
(if (not (= 50 (cdr x)))(display"dictionary: unit test 172 failing\n")))
(let ((x ((b 'find) "nop")))
(if(eq? #f x)(display"dictionary: unit test 173 failing\n"))
(if(not(equal? "nop" (car x)))(display"dictionary: unit test 174 failing\n"))
(if(not (= 500 (cdr x)))(display"dictionary: unit test 175 failing\n")))
(let ((x ((a 'find) 6)))
(if (eq? #f x)(display"dictionary: unit test 170 failing\n"))
(if (not (equal? 6 (car x)))(display"dictionary: unit test 176 failing\n"))
(if (not (= 60 (cdr x)))(display"dictionary: unit test 177 failing\n")))
(let ((x ((b 'find) "qrs")))
(if(eq? #f x)(display"dictionary: unit test 173 failing\n"))
(if(not(equal? "qrs" (car x)))(display"dictionary: unit test 178 failing\n"))
(if(not (= 600 (cdr x)))(display"dictionary: unit test 179 failing\n")))
(let ((x ((a 'find) 7)))
(if (eq? #f x)(display"dictionary: unit test 180 failing\n"))
(if (not (equal? 7 (car x)))(display"dictionary: unit test 181 failing\n"))
(if (not (= 70 (cdr x)))(display"dictionary: unit test 182 failing\n")))
(let ((x ((b 'find) "tuv")))
(if(eq? #f x)(display"dictionary: unit test 183 failing\n"))
(if(not(equal? "tuv" (car x)))(display"dictionary: unit test 184 failing\n"))
(if(not (= 700 (cdr x)))(display"dictionary: unit test 185 failing\n")))
(let ((x ((a 'find) 8)))
(if (eq? #f x)(display"dictionary: unit test 186 failing\n"))
(if (not (equal? 8 (car x)))(display"dictionary: unit test 187 failing\n"))
(if (not (= 80 (cdr x)))(display"dictionary: unit test 188 failing\n")))
(let ((x ((b 'find) "wxy")))
(if(eq? #f x)(display"dictionary: unit test 189 failing\n"))
(if(not(equal? "wxy" (car x)))(display"dictionary: unit test 190 failing\n"))
(if(not (= 800 (cdr x)))(display"dictionary: unit test 191 failing\n")))
(let ((x ((a 'find) 9)))
(if (eq? #f x)(display"dictionary: unit test 192 failing\n"))
(if (not (equal? 9 (car x)))(display"dictionary: unit test 193 failing\n"))
(if (not (= 90 (cdr x)))(display"dictionary: unit test 194 failing\n")))
(let ((x ((b 'find) "zab")))
(if(eq? #f x)(display"dictionary: unit test 195 failing\n"))
(if(not(equal? "zab" (car x)))(display"dictionary: unit test 196 failing\n"))
(if(not (= 900 (cdr x)))(display"dictionary: unit test 197 failing\n")))
;; second delete
((a 'delete!) 2)
((b 'delete!) "def")
; (if (not(a 'check))(display"dictionary: unit test 198 failing\n"))
; (if (not(b 'check))(display"dictionary: unit test 199 failing\n"))
;; should fail
(if(not(eq? #f ((a 'find) 2)))(display"dictionary: unit test 200 failing\n"))
(if(not(eq? #f ((b 'find) "def")))(display"dictionary: unit test 201 failing\n"))
;; should succeed
(let ((x ((a 'find) 3)))
(if (eq? #f x)(display"dictionary: unit test 202 failing\n"))
(if (not (equal? 3 (car x)))(display"dictionary: unit test 203 failing\n"))
(if (not (= 30 (cdr x)))(display"dictionary: unit test 204 failing\n")))
(let ((x ((b 'find) "hij")))
(if(eq? #f x)(display"dictionary: unit test 205 failing\n"))
(if(not(equal? "hij" (car x)))(display"dictionary: unit test 206 failing\n"))
(if(not (= 300 (cdr x)))(display"dictionary: unit test 207 failing\n")))
(let ((x ((a 'find) 4)))
(if (eq? #f x)(display"dictionary: unit test 208 failing\n"))
(if (not (equal? 4 (car x)))(display"dictionary: unit test 209 failing\n"))
(if (not (= 40 (cdr x)))(display"dictionary: unit test 210 failing\n")))
(let ((x ((b 'find) "klm")))
(if(eq? #f x)(display"dictionary: unit test 211 failing\n"))
(if(not(equal? "klm" (car x)))(display"dictionary: unit test 212 failing\n"))
(if(not (= 400 (cdr x)))(display"dictionary: unit test 213 failing\n")))
(let ((x ((a 'find) 5)))
(if (eq? #f x)(display"dictionary: unit test 214 failing\n"))
(if (not (equal? 5 (car x)))(display"dictionary: unit test 215 failing\n"))
(if (not (= 50 (cdr x)))(display"dictionary: unit test 216 failing\n")))
(let ((x ((b 'find) "nop")))
(if(eq? #f x)(display"dictionary: unit test 217 failing\n"))
(if(not(equal? "nop" (car x)))(display"dictionary: unit test 218 failing\n"))
(if(not (= 500 (cdr x)))(display"dictionary: unit test 219 failing\n")))
(let ((x ((a 'find) 6)))
(if (eq? #f x)(display"dictionary: unit test 220 failing\n"))
(if (not (equal? 6 (car x)))(display"dictionary: unit test 221 failing\n"))
(if (not (= 60 (cdr x)))(display"dictionary: unit test 222 failing\n")))
(let ((x ((b 'find) "qrs")))
(if(eq? #f x)(display"dictionary: unit test 223 failing\n"))
(if(not(equal? "qrs" (car x)))(display"dictionary: unit test 224 failing\n"))
(if(not (= 600 (cdr x)))(display"dictionary: unit test 225 failing\n")))
(let ((x ((a 'find) 7)))
(if (eq? #f x)(display"dictionary: unit test 226 failing\n"))
(if (not (equal? 7 (car x)))(display"dictionary: unit test 227 failing\n"))
(if (not (= 70 (cdr x)))(display"dictionary: unit test 228 failing\n")))
(let ((x ((b 'find) "tuv")))
(if(eq? #f x)(display"dictionary: unit test 229 failing\n"))
(if(not(equal? "tuv" (car x)))(display"dictionary: unit test 230 failing\n"))
(if(not (= 700 (cdr x)))(display"dictionary: unit test 231 failing\n")))
(let ((x ((a 'find) 8)))
(if (eq? #f x)(display"dictionary: unit test 232 failing\n"))
(if (not (equal? 8 (car x)))(display"dictionary: unit test 233 failing\n"))
(if (not (= 80 (cdr x)))(display"dictionary: unit test 234 failing\n")))
(let ((x ((b 'find) "wxy")))
(if(eq? #f x)(display"dictionary: unit test 235 failing\n"))
(if(not(equal? "wxy" (car x)))(display"dictionary: unit test 236 failing\n"))
(if(not (= 800 (cdr x)))(display"dictionary: unit test 237 failing\n")))
(let ((x ((a 'find) 9)))
(if (eq? #f x)(display"dictionary: unit test 238 failing\n"))
(if (not (equal? 9 (car x)))(display"dictionary: unit test 239 failing\n"))
(if (not (= 90 (cdr x)))(display"dictionary: unit test 240 failing\n")))
(let ((x ((b 'find) "zab")))
(if(eq? #f x)(display"dictionary: unit test 241 failing\n"))
(if(not(equal? "zab" (car x)))(display"dictionary: unit test 242 failing\n"))
(if(not (= 900 (cdr x)))(display"dictionary: unit test 243 failing\n")))
;; third delete
((a 'delete!) 3)
((b 'delete!) "hij")
; (if (not(a 'check))(display"dictionary: unit test 244 failing\n"))
; (if (not(b 'check))(display"dictionary: unit test 245 failing\n"))
;; should fail
(if(not(eq? #f ((a 'find) 3)))(display"dictionary: unit test 246 failing\n"))
(if(not(eq? #f ((b 'find) "hij")))(display"dictionary: unit test 247 failing\n"))
;; should succeed
(let ((x ((a 'find) 4)))
(if (eq? #f x)(display"dictionary: unit test 248 failing\n"))
(if (not (equal? 4 (car x)))(display"dictionary: unit test 249 failing\n"))
(if (not (= 40 (cdr x)))(display"dictionary: unit test 250 failing\n")))
(let ((x ((b 'find) "klm")))
(if(eq? #f x)(display"dictionary: unit test 251 failing\n"))
(if(not(equal? "klm" (car x)))(display"dictionary: unit test 252 failing\n"))
(if(not (= 400 (cdr x)))(display"dictionary: unit test 253 failing\n")))
(let ((x ((a 'find) 5)))
(if (eq? #f x)(display"dictionary: unit test 254 failing\n"))
(if (not (equal? 5 (car x)))(display"dictionary: unit test 255 failing\n"))
(if (not (= 50 (cdr x)))(display"dictionary: unit test 256 failing\n")))
(let ((x ((b 'find) "nop")))
(if(eq? #f x)(display"dictionary: unit test 257 failing\n"))
(if(not(equal? "nop" (car x)))(display"dictionary: unit test 258 failing\n"))
(if(not (= 500 (cdr x)))(display"dictionary: unit test 259 failing\n")))
(let ((x ((a 'find) 6)))
(if (eq? #f x)(display"dictionary: unit test 260 failing\n"))
(if (not (equal? 6 (car x)))(display"dictionary: unit test 261 failing\n"))
(if (not (= 60 (cdr x)))(display"dictionary: unit test 262 failing\n")))
(let ((x ((b 'find) "qrs")))
(if(eq? #f x)(display"dictionary: unit test 263 failing\n"))
(if(not(equal? "qrs" (car x)))(display"dictionary: unit test 264 failing\n"))
(if(not (= 600 (cdr x)))(display"dictionary: unit test 265 failing\n")))
(let ((x ((a 'find) 7)))
(if (eq? #f x)(display"dictionary: unit test 266 failing\n"))
(if (not (equal? 7 (car x)))(display"dictionary: unit test 267 failing\n"))
(if (not (= 70 (cdr x)))(display"dictionary: unit test 268 failing\n")))
(let ((x ((b 'find) "tuv")))
(if(eq? #f x)(display"dictionary: unit test 269 failing\n"))
(if(not(equal? "tuv" (car x)))(display"dictionary: unit test 270 failing\n"))
(if(not (= 700 (cdr x)))(display"dictionary: unit test 271 failing\n")))
(let ((x ((a 'find) 8)))
(if (eq? #f x)(display"dictionary: unit test 272 failing\n"))
(if (not (equal? 8 (car x)))(display"dictionary: unit test 273 failing\n"))
(if (not (= 80 (cdr x)))(display"dictionary: unit test 274 failing\n")))
(let ((x ((b 'find) "wxy")))
(if(eq? #f x)(display"dictionary: unit test 275 failing\n"))
(if(not(equal? "wxy" (car x)))(display"dictionary: unit test 276 failing\n"))
(if(not (= 800 (cdr x)))(display"dictionary: unit test 277 failing\n")))
(let ((x ((a 'find) 9)))
(if (eq? #f x)(display"dictionary: unit test 278 failing\n"))
(if (not (equal? 9 (car x)))(display"dictionary: unit test 279 failing\n"))
(if (not (= 90 (cdr x)))(display"dictionary: unit test 280 failing\n")))
(let ((x ((b 'find) "zab")))
(if(eq? #f x)(display"dictionary: unit test 281 failing\n"))
(if(not(equal? "zab" (car x)))(display"dictionary: unit test 282 failing\n"))
(if(not (= 900 (cdr x)))(display"dictionary: unit test 283 failing\n")))
;; fourth delete
((a 'delete!) 4)
((b 'delete!) "klm")
; (if (not(a 'check))(display"dictionary: unit test 284 failing\n"))
; (if (not(b 'check))(display"dictionary: unit test 285 failing\n"))
;; should fail
(if(not(eq? #f ((a 'find) 4)))(display"dictionary: unit test 286 failing\n"))
(if(not(eq? #f ((b 'find) "klm")))(display"dictionary: unit test 287 failing\n"))
;; should succeed
(let ((x ((a 'find) 5)))
(if (eq? #f x)(display"dictionary: unit test 288 failing\n"))
(if (not (equal? 5 (car x)))(display"dictionary: unit test 289 failing\n"))
(if (not (= 50 (cdr x)))(display"dictionary: unit test 290 failing\n")))
(let ((x ((b 'find) "nop")))
(if(eq? #f x)(display"dictionary: unit test 291 failing\n"))
(if(not(equal? "nop" (car x)))(display"dictionary: unit test 292 failing\n"))
(if(not (= 500 (cdr x)))(display"dictionary: unit test 293 failing\n")))
(let ((x ((a 'find) 6)))
(if (eq? #f x)(display"dictionary: unit test 294 failing\n"))
(if (not (equal? 6 (car x)))(display"dictionary: unit test 295 failing\n"))
(if (not (= 60 (cdr x)))(display"dictionary: unit test 296 failing\n")))
(let ((x ((b 'find) "qrs")))
(if(eq? #f x)(display"dictionary: unit test 297 failing\n"))
(if(not(equal? "qrs" (car x)))(display"dictionary: unit test 298 failing\n"))
(if(not (= 600 (cdr x)))(display"dictionary: unit test 299 failing\n")))
(let ((x ((a 'find) 7)))
(if (eq? #f x)(display"dictionary: unit test 300 failing\n"))
(if (not (equal? 7 (car x)))(display"dictionary: unit test 301 failing\n"))
(if (not (= 70 (cdr x)))(display"dictionary: unit test 302 failing\n")))
(let ((x ((b 'find) "tuv")))
(if(eq? #f x)(display"dictionary: unit test 303 failing\n"))
(if(not(equal? "tuv" (car x)))(display"dictionary: unit test 304 failing\n"))
(if(not (= 700 (cdr x)))(display"dictionary: unit test 305 failing\n")))
(let ((x ((a 'find) 8)))
(if (eq? #f x)(display"dictionary: unit test 306 failing\n"))
(if (not (equal? 8 (car x)))(display"dictionary: unit test 307 failing\n"))
(if (not (= 80 (cdr x)))(display"dictionary: unit test 308 failing\n")))
(let ((x ((b 'find) "wxy")))
(if(eq? #f x)(display"dictionary: unit test 309 failing\n"))
(if(not(equal? "wxy" (car x)))(display"dictionary: unit test 310 failing\n"))
(if(not (= 800 (cdr x)))(display"dictionary: unit test 311 failing\n")))
(let ((x ((a 'find) 9)))
(if (eq? #f x)(display"dictionary: unit test 312 failing\n"))
(if (not (equal? 9 (car x)))(display"dictionary: unit test 313 failing\n"))
(if (not (= 90 (cdr x)))(display"dictionary: unit test 314 failing\n")))
(let ((x ((b 'find) "zab")))
(if(eq? #f x)(display"dictionary: unit test 315 failing\n"))
(if(not(equal? "zab" (car x)))(display"dictionary: unit test 316 failing\n"))
(if(not (= 900 (cdr x)))(display"dictionary: unit test 317 failing\n")))
;; fifth delete
((a 'delete!) 5)
((b 'delete!) "nop")
; (if (not(a 'check))(display"dictionary: unit test 318 failing\n"))
; (if (not(b 'check))(display"dictionary: unit test 319 failing\n"))
;; should fail
(if(not(eq? #f ((a 'find) 5)))(display"dictionary: unit test 320 failing\n"))
(if(not(eq? #f ((b 'find) "nop")))(display"dictionary: unit test 321 failing\n"))
;; should succeed
(let ((x ((a 'find) 6)))
(if (eq? #f x)(display"dictionary: unit test 322 failing\n"))
(if (not (equal? 6 (car x)))(display"dictionary: unit test 323 failing\n"))
(if (not (= 60 (cdr x)))(display"dictionary: unit test 324 failing\n")))
(let ((x ((b 'find) "qrs")))
(if(eq? #f x)(display"dictionary: unit test 325 failing\n"))
(if(not(equal? "qrs" (car x)))(display"dictionary: unit test 326 failing\n"))
(if(not (= 600 (cdr x)))(display"dictionary: unit test 327 failing\n")))
(let ((x ((a 'find) 7)))
(if (eq? #f x)(display"dictionary: unit test 328 failing\n"))
(if (not (equal? 7 (car x)))(display"dictionary: unit test 329 failing\n"))
(if (not (= 70 (cdr x)))(display"dictionary: unit test 330 failing\n")))
(let ((x ((b 'find) "tuv")))
(if(eq? #f x)(display"dictionary: unit test 331 failing\n"))
(if(not(equal? "tuv" (car x)))(display"dictionary: unit test 332 failing\n"))
(if(not (= 700 (cdr x)))(display"dictionary: unit test 333 failing\n")))
(let ((x ((a 'find) 8)))
(if (eq? #f x)(display"dictionary: unit test 334 failing\n"))
(if (not (equal? 8 (car x)))(display"dictionary: unit test 335 failing\n"))
(if (not (= 80 (cdr x)))(display"dictionary: unit test 336 failing\n")))
(let ((x ((b 'find) "wxy")))
(if(eq? #f x)(display"dictionary: unit test 337 failing\n"))
(if(not(equal? "wxy" (car x)))(display"dictionary: unit test 338 failing\n"))
(if(not (= 800 (cdr x)))(display"dictionary: unit test 339 failing\n")))
(let ((x ((a 'find) 9)))
(if (eq? #f x)(display"dictionary: unit test 340 failing\n"))
(if (not (equal? 9 (car x)))(display"dictionary: unit test 341 failing\n"))
(if (not (= 90 (cdr x)))(display"dictionary: unit test 342 failing\n")))
(let ((x ((b 'find) "zab")))
(if(eq? #f x)(display"dictionary: unit test 343 failing\n"))
(if(not(equal? "zab" (car x)))(display"dictionary: unit test 344 failing\n"))
(if(not (= 900 (cdr x)))(display"dictionary: unit test 345 failing\n")))
;; sixth delete
((a 'delete!) 6)
((b 'delete!) "qrs")
; (if (not(a 'check))(display"dictionary: unit test 346 failing\n"))
; (if (not(b 'check))(display"dictionary: unit test 347 failing\n"))
;; should fail
(if(not(eq? #f ((a 'find) 6)))(display"dictionary: unit test 348 failing\n"))
(if(not(eq? #f ((b 'find) "qrs")))(display"dictionary: unit test 349 failing\n"))
;; should succeed
(let ((x ((a 'find) 7)))
(if (eq? #f x)(display"dictionary: unit test 350 failing\n"))
(if (not (equal? 7 (car x)))(display"dictionary: unit test 351 failing\n"))
(if (not (= 70 (cdr x)))(display"dictionary: unit test 352 failing\n")))
(let ((x ((b 'find) "tuv")))
(if(eq? #f x)(display"dictionary: unit test 353 failing\n"))
(if(not(equal? "tuv" (car x)))(display"dictionary: unit test 354 failing\n"))
(if(not (= 700 (cdr x)))(display"dictionary: unit test 355 failing\n")))
(let ((x ((a 'find) 8)))
(if (eq? #f x)(display"dictionary: unit test 356 failing\n"))
(if (not (equal? 8 (car x)))(display"dictionary: unit test 357 failing\n"))
(if (not (= 80 (cdr x)))(display"dictionary: unit test 358 failing\n")))
(let ((x ((b 'find) "wxy")))
(if(eq? #f x)(display"dictionary: unit test 359 failing\n"))
(if(not(equal? "wxy" (car x)))(display"dictionary: unit test 360 failing\n"))
(if(not (= 800 (cdr x)))(display"dictionary: unit test 361 failing\n")))
(let ((x ((a 'find) 9)))
(if (eq? #f x)(display"dictionary: unit test 362 failing\n"))
(if (not (equal? 9 (car x)))(display"dictionary: unit test 363 failing\n"))
(if (not (= 90 (cdr x)))(display"dictionary: unit test 364 failing\n")))
(let ((x ((b 'find) "zab")))
(if(eq? #f x)(display"dictionary: unit test 365 failing\n"))
(if(not(equal? "zab" (car x)))(display"dictionary: unit test 366 failing\n"))
(if(not (= 900 (cdr x)))(display"dictionary: unit test 367 failing\n")))
;; seventh delete
((a 'delete!) 7)
((b 'delete!) "tuv")
; (if (not(a 'check))(display"dictionary: unit test 368 failing\n"))
; (if (not(b 'check))(display"dictionary: unit test 369 failing\n"))
;; should fail
(if(not(eq? #f ((a 'find) 7)))(display"dictionary: unit test 370 failing\n"))
(if(not(eq? #f ((b 'find) "tuv")))(display"dictionary: unit test 371 failing\n"))
;; should succeed
(let ((x ((a 'find) 8)))
(if (eq? #f x)(display"dictionary: unit test 372 failing\n"))
(if (not (equal? 8 (car x)))(display"dictionary: unit test 373 failing\n"))
(if (not (= 80 (cdr x)))(display"dictionary: unit test 374 failing\n")))
(let ((x ((b 'find) "wxy")))
(if(eq? #f x)(display"dictionary: unit test 375 failing\n"))
(if(not(equal? "wxy" (car x)))(display"dictionary: unit test 376 failing\n"))
(if(not (= 800 (cdr x)))(display"dictionary: unit test 377 failing\n")))
(let ((x ((a 'find) 9)))
(if (eq? #f x)(display"dictionary: unit test 378 failing\n"))
(if (not (equal? 9 (car x)))(display"dictionary: unit test 379 failing\n"))
(if (not (= 90 (cdr x)))(display"dictionary: unit test 380 failing\n")))
(let ((x ((b 'find) "zab")))
(if(eq? #f x)(display"dictionary: unit test 381 failing\n"))
(if(not(equal? "zab" (car x)))(display"dictionary: unit test 382 failing\n"))
(if(not (= 900 (cdr x)))(display"dictionary: unit test 383 failing\n")))
;; redundant delete
((a 'delete!) 7)
((b 'delete!) "tuv")
; (if (not(a 'check))(display"dictionary: unit test 384 failing\n"))
; (if (not(b 'check))(display"dictionary: unit test 385 failing\n"))
;; should fail
(if(not(eq? #f ((a 'find) 7)))(display"dictionary: unit test 386 failing\n"))
(if(not(eq? #f ((b 'find) "tuv")))(display"dictionary: unit test 387 failing\n"))
;; should succeed
(let ((x ((a 'find) 8)))
(if (eq? #f x)(display"dictionary: unit test 388 failing\n"))
(if (not (equal? 8 (car x)))(display"dictionary: unit test 389 failing\n"))
(if (not (= 80 (cdr x)))(display"dictionary: unit test 390 failing\n")))
(let ((x ((b 'find) "wxy")))
(if(eq? #f x)(display"dictionary: unit test 391 failing\n"))
(if(not(equal? "wxy" (car x)))(display"dictionary: unit test 392 failing\n"))
(if(not (= 800 (cdr x)))(display"dictionary: unit test 393 failing\n")))
(let ((x ((a 'find) 9)))
(if (eq? #f x)(display"dictionary: unit test 394 failing\n"))
(if (not (equal? 9 (car x)))(display"dictionary: unit test 395 failing\n"))
(if (not (= 90 (cdr x)))(display"dictionary: unit test 396 failing\n")))
(let ((x ((b 'find) "zab")))
(if(eq? #f x)(display"dictionary: unit test 397 failing\n"))
(if(not(equal? "zab" (car x)))(display"dictionary: unit test 398 failing\n"))
(if(not (= 900 (cdr x)))(display"dictionary: unit test 399 failing\n")))
;; eighth delete
((a 'delete!) 8)
((b 'delete!) "wxy")
; (if (not(a 'check))(display"dictionary: unit test 400 failing\n"))
; (if (not(b 'check))(display"dictionary: unit test 401 failing\n"))
;; should fail
(if(not(eq? #f ((a 'find) 8)))(display"dictionary: unit test 402 failing\n"))
(if(not(eq? #f ((b 'find) "wxy")))(display"dictionary: unit test 403 failing\n"))
;; should succeed
(let ((x ((a 'find) 9)))
(if (eq? #f x)(display"dictionary: unit test 404 failing\n"))
(if (not (equal? 9 (car x)))(display"dictionary: unit test 405 failing\n"))
(if (not (= 90 (cdr x)))(display"dictionary: unit test 406 failing\n")))
(let ((x ((b 'find) "zab")))
(if(eq? #f x)(display"dictionary: unit test 407 failing\n"))
(if(not(equal? "zab" (car x)))(display"dictionary: unit test 408 failing\n"))
(if(not (= 900 (cdr x)))(display"dictionary: unit test 409 failing\n")))
;; ninth delete
((a 'delete!) 9)
((b 'delete!) "zab")
; (if (not(a 'check))(display"dictionary: unit test 410 failing\n"))
; (if (not(b 'check))(display"dictionary: unit test 411 failing\n"))
;; should fail
(if(not(eq? #f ((a 'find) 9)))(display"dictionary: unit test 412 failing\n"))
(if(not(eq? #f ((b 'find) "zab")))(display"dictionary: unit test 413 failing\n"))
;;
;; multiple inserts
(let loop ((i 16))
(if (> i 0)
(begin
((a 'insert!) i (* i 10))
; (if (not (a 'check))(display"dictionary: unit test 414 failing\n"))
(let loop2 ((j 16))
(if (> j i)
(begin
(let ((x ((a 'find) j)))
(if (eq? #f x) (display"dictionary: unit test 415 failing\n"))
(if (not (equal? j (car x)))
(display "dictionary: unit test 416 failing\n"))
(if (not (= (* j 10) (cdr x)))
(display "dictionary: unit test 416 failing\n")))
(loop2 (- j 1)))))
(loop (- i 1)))))
;; multiple deletes
(let loop ((i 16))
(if (> i 0)
(begin
((a 'delete!) i)
; (if (not (a 'check))(display"dictionary: unit test 417 failing\n"))
(let loop2 ((j 16))
(if (> j i)
(begin
(let ((x ((a 'find) j)))
(if (not (eq? #f x))
(display "dictionary: unit test 418 failing\n")))
(loop2 (- j 1)))))
(loop (- i 1)))))
;;
(display"dictionary: unit test complete\n"))))
)) ; include guard
| false |
2e63d55a88518bdab83d55258a5749a0fbd739c2 | b62560d3387ed544da2bbe9b011ec5cd6403d440 | /cogs/collections/cog.scm | 73aa112b9b0cc66166443ecaced0a39f9f3d9c1f | [
"LicenseRef-scancode-unknown-license-reference",
"MIT",
"Apache-2.0"
]
| permissive | mattwparas/steel | c6fb91b20c4e613e6a8db9d9310d1e1c72313df2 | 700144a5a1aeb33cbdb2f66440bbe38cf4152458 | refs/heads/master | 2023-09-04T03:41:35.352916 | 2023-09-01T03:26:01 | 2023-09-01T03:26:01 | 241,949,362 | 207 | 10 | Apache-2.0 | 2023-09-06T04:31:21 | 2020-02-20T17:39:28 | Rust | UTF-8 | Scheme | false | false | 144 | scm | cog.scm | (define package-name 'steel/collections)
(define version "0.1.0")
;; Core library, requires no dependencies
(define dependencies '(steel/test)) | false |
ebfa278bf35a6294fd468a1623a0337d39748414 | 404799b4b2d5f83ee5304392826a69defc25da77 | /ex2-79.scm | cbc7bf72e3d6df761fb8c22fd6bcd49605026a28 | []
| no_license | WuzhangFang/SICP-exercise | 38ae650c63e74bb7c6639bf984285e06743db925 | d9977009ec3e32a74edb13b4f13f6ebbbc44ab32 | refs/heads/master | 2020-04-16T16:01:18.058287 | 2019-10-01T21:52:40 | 2019-10-01T21:52:40 | 165,722,260 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 576 | scm | ex2-79.scm | ;; Exercise 2.79
;; define a generic equality predicate equ? that tests the equality
;; of two numbers (ordinary, rational, and complex)
;; scheme (ordinary) number
(load "apply-generic.scm")
(put 'equ? '(scheme-number scheme-number)
(lambda (x y) (= x y)))
;; rational number
(put 'equ? '(rational rational)
(lambda (x y) (and (= (numer x) (number y))
(= (denom x) (denom y)))))
;; complex number
(put 'equ? '(complex complex)
(lambda (x y) (and (= (magnitude x) (magnitude y))
(= (angle x) (angle y)))))
(define (equ? x y)
(apply-generic 'equ? x y))
| false |
27b6e3ea52273c3fa8c2827cab35e2872cce3477 | 665da87f9fefd8678b0635e31df3f3ff28a1d48c | /srfi/sorting/delndups.scm | 44e2c73a40af22e67d999a51f253b822082cefa3 | [
"MIT"
]
| permissive | justinethier/cyclone | eeb782c20a38f916138ac9a988dc53817eb56e79 | cc24c6be6d2b7cc16d5e0ee91f0823d7a90a3273 | refs/heads/master | 2023-08-30T15:30:09.209833 | 2023-08-22T02:11:59 | 2023-08-22T02:11:59 | 31,150,535 | 862 | 64 | MIT | 2023-03-04T15:15:37 | 2015-02-22T03:08:21 | Scheme | UTF-8 | Scheme | false | false | 6,608 | scm | delndups.scm | ;;; The sort package -- delete neighboring duplicate elts
;;; Copyright (c) 1998 by Olin Shivers.
;;; This code is open-source; see the end of the file for porting and
;;; more copyright information.
;;; Olin Shivers 11/98.
;;; Problem:
;;; vector-delete-neighbor-dups pushes N stack frames, where N is the number
;;; of elements in the answer vector. This is arguably a very efficient thing
;;; to do, but it might blow out on a system with a limited stack but a big
;;; heap. We could rewrite this to "chunk" up answers in temp vectors if we
;;; push more than a certain number of frames, then allocate a final answer,
;;; copying all the chunks into the answer. But it's much more complex code.
;;; Exports:
;;; (list-delete-neighbor-dups = lis) -> list
;;; (list-delete-neighbor-dups! = lis) -> list
;;; (vector-delete-neighbor-dups = v [start end]) -> vector
;;; (vector-delete-neighbor-dups! = v [start end]) -> end'
;;; These procedures delete adjacent duplicate elements from a list or
;;; a vector, using a given element equality procedure. The first or leftmost
;;; element of a run of equal elements is the one that survives. The list
;;; or vector is not otherwise disordered.
;;;
;;; These procedures are linear time -- much faster than the O(n^2) general
;;; duplicate-elt deletors that do not assume any "bunching" of elements.
;;; If you want to delete duplicate elements from a large list or vector,
;;; sort the elements to bring equal items together, then use one of these
;;; procedures -- for a total time of O(n lg n).
;;; LIST-DELETE-NEIGHBOR-DUPS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Below are multiple versions of the LIST-DELETE-NEIGHBOR-DUPS procedure,
;;; from simple to complex. RECUR's contract: Strip off any leading X's from
;;; LIS, and return that list neighbor-dup-deleted.
;;;
;;; The final version
;;; - shares a common subtail between the input & output list, up to 1024
;;; elements;
;;; - Needs no more than 1024 stack frames.
#;
;;; Simplest version.
;;; - Always allocates a fresh list / never shares storage.
;;; - Needs N stack frames, if answer is length N.
(define (list-delete-neighbor-dups = lis)
(if (pair? lis)
(let ((x0 (car lis)))
(cons x0 (let recur ((x0 x0) (xs (cdr lis)))
(if (pair? xs)
(let ((x1 (car xs))
(x2+ (cdr xs)))
(if (= x0 x1)
(recur x0 x2+) ; Loop, actually.
(cons x1 (recur x1 x2+))))
xs))))
lis))
;;; This version tries to use cons cells from input by sharing longest
;;; common tail between input & output. Still needs N stack frames, for ans
;;; of length N.
(define (list-delete-neighbor-dups = lis)
(if (pair? lis)
(let* ((x0 (car lis))
(xs (cdr lis))
(ans (let recur ((x0 x0) (xs xs))
(if (pair? xs)
(let ((x1 (car xs))
(x2+ (cdr xs)))
(if (= x0 x1)
(recur x0 x2+)
(let ((ans-tail (recur x1 x2+)))
(if (eq? ans-tail x2+) xs
(cons x1 ans-tail)))))
xs))))
(if (eq? ans xs) lis (cons x0 ans)))
lis))
;;; LIST-DELETE-NEIGHBOR-DUPS!
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; This code runs in constant list space, constant stack, and also
;;; does only the minimum SET-CDR!'s necessary.
(define (list-delete-neighbor-dups! = lis)
(if (pair? lis)
(let lp1 ((prev lis) (prev-elt (car lis)) (lis (cdr lis)))
(if (pair? lis)
(let ((lis-elt (car lis))
(next (cdr lis)))
(if (= prev-elt lis-elt)
;; We found the first elts of a run of dups, so we know
;; we're going to have to do a SET-CDR!. Scan to the end of
;; the run, do the SET-CDR!, and loop on LP1.
(let lp2 ((lis next))
(if (pair? lis)
(let ((lis-elt (car lis))
(next (cdr lis)))
(if (= prev-elt lis-elt)
(lp2 next)
(begin (set-cdr! prev lis)
(lp1 lis lis-elt next))))
(set-cdr! prev lis))) ; Ran off end => quit.
(lp1 lis lis-elt next))))))
lis)
(define (vector-delete-neighbor-dups elt= v . maybe-start+end)
(call-with-values
(lambda () (vector-start+end v maybe-start+end))
(lambda (start end)
(if (< start end)
(let* ((x (vector-ref v start))
(ans (let recur ((x x) (i start) (j 1))
(if (< i end)
(let ((y (vector-ref v i))
(nexti (+ i 1)))
(if (elt= x y)
(recur x nexti j)
(let ((ansvec (recur y nexti (+ j 1))))
(vector-set! ansvec j y)
ansvec)))
(make-vector j)))))
(vector-set! ans 0 x)
ans)
'#()))))
;;; Packs the surviving elements to the left, in range [start,end'),
;;; and returns END'.
(define (vector-delete-neighbor-dups! elt= v . maybe-start+end)
(call-with-values
(lambda () (vector-start+end v maybe-start+end))
(lambda (start end)
(if (>= start end)
end
;; To eliminate unnecessary copying (read elt i then write the value
;; back at index i), we scan until we find the first dup.
(let skip ((j start) (vj (vector-ref v start)))
(let ((j+1 (+ j 1)))
(if (>= j+1 end)
end
(let ((vj+1 (vector-ref v j+1)))
(if (not (elt= vj vj+1))
(skip j+1 vj+1)
;; OK -- j & j+1 are dups, so we're committed to moving
;; data around. In lp2, v[start,j] is what we've done;
;; v[k,end) is what we have yet to handle.
(let lp2 ((j j) (vj vj) (k (+ j 2)))
(let lp3 ((k k))
(if (>= k end)
(+ j 1) ; Done.
(let ((vk (vector-ref v k))
(k+1 (+ k 1)))
(if (elt= vj vk)
(lp3 k+1)
(let ((j+1 (+ j 1)))
(vector-set! v j+1 vk)
(lp2 j+1 vk k+1))))))))))))))))
;;; Copyright
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; This code is
;;; Copyright (c) 1998 by Olin Shivers.
;;; The terms are: You may do as you please with this code, as long as
;;; you do not delete this notice or hold me responsible for any outcome
;;; related to its use.
;;;
;;; Blah blah blah. Don't you think source files should contain more lines
;;; of code than copyright notice?
;;;
;;; Code porting
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; If your Scheme has a faster mechanism for handling optional arguments
;;; (e.g., Chez), you should definitely port over to it. Note that argument
;;; defaulting and error-checking are interleaved -- you don't have to
;;; error-check defaulted START/END args to see if they are fixnums that are
;;; legal vector indices for the corresponding vector, etc.
| false |
0c116c908d93fed0f6e4f0750e6b3eae05b6ef3f | c63772c43d0cda82479d8feec60123ee673cc070 | /project/1/basebot.scm | 5a72334f04c2a5069e03f40a08457b53b8c48673 | [
"Apache-2.0"
]
| permissive | liuyang1/sicp-ans | 26150c9a9a9c2aaf23be00ced91add50b84c72ba | c3072fc65baa725d252201b603259efbccce990d | refs/heads/master | 2021-01-21T05:02:54.508419 | 2017-09-04T02:48:46 | 2017-09-04T02:48:52 | 14,819,541 | 2 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 10,264 | scm | basebot.scm | ;;; Project 1, 6.001, Spring 2005
;;; idea is to simulate a baseball robot
;; imagine hitting a ball with an initial velocity of v
;; at an angle alpha from the horizontal, at a height h
;; we would like to know how far the ball travels.
;; as a first step, we can just model this with simple physics
;; so the equations of motion for the ball have a vertical and a
;; horizontal component
;; the vertical component is governed by
;; y(t) = v sin alpha t + h - 1/2 g t^2
;; where g is the gravitational constant of 9.8 m/s^2
;; the horizontal component is governed by
;; x(t) = v cos alpha t
;; assuming it starts at the origin
;; First, we want to know when the ball hits the ground
;; this is governed by the quadratic equation, so we just need to know when
;; y(t)=0 (i.e. for what t_impact is y(t_impact)= 0).
;; note that there are two solutions, only one makes sense physically
(define square
(lambda (x) (* x x)))
;; these are constants that will be useful to us
(define gravity 9.8) ;; in m/s
(define pi 3.14159)
;; Problem 1
(define position
(lambda (a v u t)
(+ (* t (+ (* t (/ a 2)) v)) u)))
;; you need to complete this procedure, then show some test cases
; (displayln (position 0 0 0 0))
; (displayln (position 0 0 20 0))
; (displayln (position 0 5 10 10))
; (displayln (position 2 2 2 2))
; (displayln (position 5 5 5 5))
(displayln "Problem 1 ok")
;; Problem 2
(define (delta a b c) (- (square b) (* 4 a c)))
(define root1
(lambda (a b c)
(/ (+ (- b) (sqrt (delta a b c))) 2 a)))
(define root2
(lambda (a b c)
(/ (- (- b) (sqrt (delta a b c))) 2 a)))
;; complete these procedures and show some test cases
;(displayln (root1 1 -5 6))
;(displayln (root2 1 -5 6))
;(displayln (root1 5 3 6))
;(displayln (root2 5 3 6))
;(displayln (root1 4.9 -9.8 0))
;(displayln (root2 4.9 -9.8 0))
(displayln "Problem 2 ok")
;; Problem 3
; initial upward velocity and initial height or elevation
; XXX gravity is a DOWNWARD acceleration. and UPWARD is positive orien.
(define time-to-impact
(lambda (vertical-velocity elevation)
(root2 (/ (- gravity) 2) vertical-velocity elevation)))
;; Note that if we want to know when the ball drops to a particular height r
;; (for receiver), we have
(define time-to-height
(lambda (vertical-velocity elevation target-elevation)
(root1 (/ (- gravity) 2) vertical-velocity (- elevation target-elevation))))
; (displayln (time-to-impact 9.8 0))
; (displayln (time-to-impact 9.8 4.9))
; (displayln (time-to-impact 9.8 5))
; (displayln (time-to-height 9.8 0 4.9))
(displayln "Problem 3 ok")
;; Problem 4
;; once we can solve for t_impact, we can use it to figure out how far the ball went
;; conversion procedure
(define degree2radian
(lambda (deg)
(/ (* deg pi) 180.)))
(define travel-distance-simple
(lambda (elevation velocity angle)
(let ((rad (degree2radian angle)))
(* (* (cos rad) velocity)
(time-to-impact (* (sin rad) velocity) elevation)))))
;; let's try this out for some example values. Note that we are going to
;; do everything in metric units, but for quaint reasons it is easier to think
;; about things in English units, so we will need some conversions.
(define meters-to-feet
(lambda (m)
(/ (* m 39.6) 12)))
(define feet-to-meters
(lambda (f)
(/ (* f 12) 39.6)))
(define hours-to-seconds
(lambda (h)
(* h 3600)))
(define seconds-to-hours
(lambda (s)
(/ s 3600)))
;; what is time to impact for a ball hit at a height of 1 meter
;; with a velocity of 45 m/s (which is about 100 miles/hour)
;; at an angle of 0 (straight horizontal)
;; at an angle of (/ pi 2) radians or 90 degrees (straight vertical)
;; at an angle of (/ pi 4) radians or 45 degrees
;; what is the distance traveled in each case?
;; record both in meters and in feet
; (displayln (travel-distance-simple 1 45 0))
; (displayln (travel-distance-simple 1 45 45))
; (displayln (travel-distance-simple 1 45 90))
(displayln "Problem 4 ok")
; liuyang1, skip feet unit
;; Problem 5
;; these sound pretty impressive, but we need to look at it more carefully
;; first, though, suppose we want to find the angle that gives the best
;; distance
;; assume that angle is between 0 and (/ pi 2) radians or between 0 and 90
;; degrees
(define alpha-increment 0.1)
(define right-angle 90)
(define find-best-angle
(lambda (velocity elevation)
(define (loopcheck angle max-dist best-angle)
(if (> angle right-angle) best-angle
(let ((new-dist (travel-distance-simple elevation velocity angle)))
(if (> new-dist max-dist)
(loopcheck (+ angle alpha-increment) new-dist angle)
(loopcheck (+ angle alpha-increment) max-dist best-angle)))))
(loopcheck 0 0 0)))
; (displayln (find-best-angle 4.9 0))
; (displayln (find-best-angle 4 3))
(displayln "Problem 5 ok")
;; find best angle
;; try for other velocities
;; try for other heights
;; Problem 6
;; problem is that we are not accounting for drag on the ball (or on spin
;; or other effects, but let's just stick with drag)
;;
;; Newton's equations basically say that ma = F, and here F is really two
;; forces. One is the effect of gravity, which is captured by mg. The
;; second is due to drag, so we really have
;;
;; a = drag/m + gravity
;;
;; drag is captured by 1/2 C rho A vel^2, where
;; C is the drag coefficient (which is about 0.5 for baseball sized spheres)
;; rho is the density of air (which is about 1.25 kg/m^3 at sea level
;; with moderate humidity, but is about 1.06 in Denver)
;; A is the surface area of the cross section of object, which is pi D^2/4
;; where D is the diameter of the ball (which is about 0.074m for a baseball)
;; thus drag varies by the square of the velocity, with a scaling factor
;; that can be computed
;; We would like to again compute distance , but taking into account
;; drag.
;; Basically we can rework the equations to get four coupled linear
;; differential equations
;; let u be the x component of velocity, and v be the y component of velocity
;; let x and y denote the two components of position (we are ignoring the
;; third dimension and are assuming no spin so that a ball travels in a plane)
;; the equations are
;;
;; dx/dt = u
;; dy/dt = v
;; du/dt = -(drag_x/m + g_x)
;; dv/dt = -(drag_y/m + g_y)
;; we have g_x = - and g_y = - gravity
;; to get the components of the drag force, we need some trig.
;; let speeed = (u^2+v^2)^(1/2), then
;; drag_x = - drag * u /speed
;; drag_y = - drag * v /speed
;; where drag = beta speed^2
;; and beta = 1/2 C rho pi D^2/4
;; note that we are taking direction into account here
;; we need the mass of a baseball -- which is about .15 kg.
;; so now we just need to write a procedure that performs a simple integration
;; of these equations -- there are more sophisticated methods but a simple one
;; is just to step along by some step size in t and add up the values
;; dx = u dt
;; dy = v dt
;; du = - 1/m speed beta u dt
;; dv = - (1/m speed beta v + g) dt
;; initial conditions
;; u_0 = V cos alpha
;; v_0 = V sin alpha
;; y_0 = h
;; x_0 = 0
;; we want to start with these initial conditions, then take a step of size dt
;; (which could be say 0.1) and compute new values for each of these parameters
;; when y reaches the desired point (<= 0) we stop, and return the distance (x)
(define drag-coeff 0.5)
(define density 1.25) ; kg/m^3
(define mass .145) ; kg
(define diameter 0.074) ; m
(define beta (* .5 drag-coeff density (* 3.14159 .25 (square diameter))))
(define integrate
(lambda (x0 y0 u0 v0 dt g m beta)
(if (< y0 0) x0
(let
((drag (- (* (/ 1 m) beta (sqrt (+ (square u0) (square v0)))))))
(integrate (+ x0 (* u0 dt))
(+ y0 (* v0 dt))
(+ u0 (* dt (* drag u0)))
(+ v0 (* dt (- (* drag v0) g)))
dt g m beta)))))
(define (travel-distance velocity elevation angle)
(integrate 0
elevation
(* (sin (degree2radian angle)) velocity)
(* (cos (degree2radian angle)) velocity)
0.01 gravity mass beta))
; (displayln (travel-distance 45 1 45))
; (displayln (travel-distance 40 1 45))
; (displayln (travel-distance 35 1 45))
; (displayln (travel-distance 45 1 60))
; (displayln (travel-distance 45 1 55))
; (displayln (travel-distance 45 1 50))
; (displayln (travel-distance 45 1 45))
; (displayln (travel-distance 45 1 40))
(displayln "Problem 6 ok")
;; RUN SOME TEST CASES
;; what about Denver?
;; Problem 7
;; now let's turn this around. Suppose we want to throw the ball. The same
;; equations basically hold, except now we would like to know what angle to
;; use, given a velocity, in order to reach a given height (receiver) at a
;; given distance
;; a cather trying to throw someone out at second has to get it roughly 36 m
;; (or 120 ft) how quickly does the ball get there, if he throws at 55m/s,
;; at 45m/s, at 35m/s?
;; try out some times for distances (30, 60, 90 m) or (100, 200, 300 ft)
;; using 45m/s
(define (radian2degree radian) (* 180 (/ radian pi)))
(define (find-best-angle distance height velocity)
(define (close dist) (abs (- dist distance)))
(define (close-enough? error) (< error 0.01))
(define (loopcheck angle best-angle best-dist-error)
(if (or (> angle right-angle) (close-enough? best-dist-error))
best-angle
(let ((dist (travel-distance velocity height angle)))
(if (< (close dist) best-dist-error)
(loopcheck (+ angle alpha-increment) angle (close dist))
(loopcheck (+ angle alpha-increment) best-angle best-dist-error)))))
(loopcheck -30 0 1000))
(define (find-best-time distance height velocity)
(/ distance
(* velocity (cos (degree2radian (find-best-angle distance height velocity))))))
(displayln (find-best-time 36 1 45))
(displayln (find-best-time 36 1 35))
(displayln (find-best-time 80 1 35))
; TODO:
;; Problem 8
;; Problem 9
| false |
1887dee24d9cf1f05d1f3bc4274d22129810977d | 9998f6f6940dc91a99e0e2acb4bc4e918f49eef0 | /js-runtime/tests/moby-programs/falling-ball.ss | be7a821e6581369ccfed6215e1ddd27d74a27c1c | []
| no_license | JessamynT/wescheme-compiler2012 | 326d66df382f3d2acbc2bbf70fdc6b6549beb514 | a8587f9d316b3cb66d8a01bab3cf16f415d039e5 | refs/heads/master | 2020-05-30T07:16:45.185272 | 2016-03-19T07:14:34 | 2016-03-19T07:14:34 | 70,086,162 | 0 | 0 | null | 2016-10-05T18:09:51 | 2016-10-05T18:09:51 | null | UTF-8 | Scheme | false | false | 1,212 | ss | falling-ball.ss | #lang s-exp "../../src/moby-lang.ss"
;; Simple falling ball example. A red ball falls down the screen
;; until hitting the bottom.
(define-struct world (radius y))
;; The dimensions of the screen:
(define WIDTH 320)
(define HEIGHT 480)
;; The radius of the red circle.
(define RADIUS 15)
;; The world is the distance from the top of the screen.
(define INITIAL-WORLD (make-world RADIUS 0))
;; tick: world -> world
;; Moves the ball down.
(define (tick w)
(make-world RADIUS (+ (world-y w) 5)))
;; hits-floor?: world -> boolean
;; Returns true when the distance reaches the screen height.
(define (hits-floor? w)
(>= (world-y w) HEIGHT))
;; We have some simple test cases.
(check-expect (hits-floor? (make-world RADIUS 0)) false)
(check-expect (hits-floor? (make-world RADIUS HEIGHT)) true)
;; render: world -> scene
;; Produces a scene with the circle at a height described by the world.
(define (render w)
(place-image (circle RADIUS "solid" "red") (/ WIDTH 2) (world-y w)
(empty-scene WIDTH HEIGHT)))
;; Start up a big bang, 15 frames a second.
(js-big-bang INITIAL-WORLD
(on-tick 1/15 tick)
(on-redraw render)
(stop-when hits-floor?))
| false |
6e08eade583e0795f14d067035f157d9ed1ba72e | f08220a13ec5095557a3132d563a152e718c412f | /logrotate/skel/usr/share/guile/2.0/ice-9/local-eval.scm | bd3588bc39dcbb271da14ecce1d24124d9d31bbe | [
"Apache-2.0"
]
| permissive | sroettger/35c3ctf_chals | f9808c060da8bf2731e98b559babd4bf698244ac | 3d64486e6adddb3a3f3d2c041242b88b50abdb8d | refs/heads/master | 2020-04-16T07:02:50.739155 | 2020-01-15T13:50:29 | 2020-01-15T13:50:29 | 165,371,623 | 15 | 5 | Apache-2.0 | 2020-01-18T11:19:05 | 2019-01-12T09:47:33 | Python | UTF-8 | Scheme | false | false | 9,946 | scm | local-eval.scm | ;;; -*- mode: scheme; coding: utf-8; -*-
;;;
;;; Copyright (C) 2012, 2013 Free Software Foundation, Inc.
;;;
;;; This library is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU Lesser General Public
;;; License as published by the Free Software Foundation; either
;;; version 3 of the License, or (at your option) any later version.
;;;
;;; This library is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;; Lesser General Public License for more details.
;;;
;;; You should have received a copy of the GNU Lesser General Public
;;; License along with this library; if not, write to the Free Software
;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
(define-module (ice-9 local-eval)
#:use-module (ice-9 format)
#:use-module (srfi srfi-9)
#:use-module (srfi srfi-9 gnu)
#:use-module (system base compile)
#:use-module (system syntax)
#:export (the-environment local-eval local-compile))
(define-record-type lexical-environment-type
(make-lexical-environment scope wrapper boxes patterns)
lexical-environment?
(scope lexenv-scope)
(wrapper lexenv-wrapper)
(boxes lexenv-boxes)
(patterns lexenv-patterns))
(set-record-type-printer!
lexical-environment-type
(lambda (e port)
(format port "#<lexical-environment ~S (~S bindings)>"
(syntax-module (lexenv-scope e))
(+ (length (lexenv-boxes e)) (length (lexenv-patterns e))))))
(define-syntax syntax-object-of
(lambda (form)
(syntax-case form ()
((_ x) #`(quote #,(datum->syntax #'x #'x))))))
(define-syntax-rule (make-box v)
(case-lambda
(() v)
((x) (set! v x))))
(define (make-transformer-from-box id trans)
(set-procedure-property! trans 'identifier-syntax-box id)
trans)
(define-syntax-rule (identifier-syntax-from-box box)
(make-transformer-from-box
(syntax-object-of box)
(identifier-syntax (id (box))
((set! id x) (box x)))))
(define (unsupported-binding name)
(make-variable-transformer
(lambda (x)
(syntax-violation
'local-eval
"unsupported binding captured by (the-environment)"
x))))
(define (within-nested-ellipses id lvl)
(let loop ((s id) (n lvl))
(if (zero? n)
s
(loop #`(#,s (... ...)) (- n 1)))))
;; Analyze the set of bound identifiers IDS. Return four values:
;;
;; capture: A list of forms that will be emitted in the expansion of
;; `the-environment' to capture lexical variables.
;;
;; formals: Corresponding formal parameters for use in the lambda that
;; re-introduces those variables. These are temporary identifiers, and
;; as such if we have a nested `the-environment', there is no need to
;; capture them. (See the notes on nested `the-environment' and
;; proxies, below.)
;;
;; wrappers: A list of procedures of type SYNTAX -> SYNTAX, used to wrap
;; the expression to be evaluated in forms that re-introduce the
;; variable. The forms will be nested so that the variable shadowing
;; semantics of the original form are maintained.
;;
;; patterns: A terrible hack. The issue is that for pattern variables,
;; we can't emit lexically nested with-syntax forms, like:
;;
;; (with-syntax ((foo 1)) (the-environment))
;; => (with-syntax ((foo 1))
;; ... #'(with-syntax ((foo ...)) ... exp) ...)
;;
;; The reason is that the outer "foo" substitutes into the inner "foo",
;; yielding something like:
;;
;; (with-syntax ((foo 1))
;; ... (with-syntax ((1 ...)) ...)
;;
;; Which ain't what we want. So we hide the information needed to
;; re-make the inner pattern binding form in the lexical environment
;; object, and then introduce those identifiers via another with-syntax.
;;
;;
;; There are four different kinds of lexical bindings: normal lexicals,
;; macros, displaced lexicals, and pattern variables. See the
;; documentation of syntax-local-binding for more info on these.
;;
;; We capture normal lexicals via `make-box', which creates a
;; case-lambda that can reference or set a variable. These get
;; re-introduced with an identifier-syntax.
;;
;; We can't capture macros currently. However we do recognize our own
;; macros that are actually proxying lexicals, so that nested
;; `the-environment' forms are possible. In that case we drill down to
;; the identifier for the already-existing box, and just capture that
;; box.
;;
;; And that's it: we skip displaced lexicals, and the pattern variables
;; are discussed above.
;;
(define (analyze-identifiers ids)
(define (mktmp)
(datum->syntax #'here (gensym "t ")))
(let lp ((ids ids) (capture '()) (formals '()) (wrappers '()) (patterns '()))
(cond
((null? ids)
(values capture formals wrappers patterns))
(else
(let ((id (car ids)) (ids (cdr ids)))
(call-with-values (lambda () (syntax-local-binding id))
(lambda (type val)
(case type
((lexical)
(if (or-map (lambda (x) (bound-identifier=? x id)) formals)
(lp ids capture formals wrappers patterns)
(let ((t (mktmp)))
(lp ids
(cons #`(make-box #,id) capture)
(cons t formals)
(cons (lambda (x)
#`(let-syntax ((#,id (identifier-syntax-from-box #,t)))
#,x))
wrappers)
patterns))))
((displaced-lexical)
(lp ids capture formals wrappers patterns))
((macro)
(let ((b (procedure-property val 'identifier-syntax-box)))
(if b
(lp ids (cons b capture) (cons b formals)
(cons (lambda (x)
#`(let-syntax ((#,id (identifier-syntax-from-box #,b)))
#,x))
wrappers)
patterns)
(lp ids capture formals
(cons (lambda (x)
#`(let-syntax ((#,id (unsupported-binding '#,id)))
#,x))
wrappers)
patterns))))
((pattern-variable)
(let ((t (datum->syntax id (gensym "p ")))
(nested (within-nested-ellipses id (cdr val))))
(lp ids capture formals
(cons (lambda (x)
#`(with-syntax ((#,t '#,nested))
#,x))
wrappers)
;; This dance is to hide these pattern variables
;; from the expander.
(cons (list (datum->syntax #'here (syntax->datum id))
(cdr val)
t)
patterns))))
((ellipsis)
(lp ids capture formals
(cons (lambda (x)
#`(with-ellipsis #,val #,x))
wrappers)
patterns))
(else
(error "what" type val))))))))))
(define-syntax the-environment
(lambda (x)
(syntax-case x ()
((the-environment)
#'(the-environment the-environment))
((the-environment scope)
(call-with-values (lambda ()
(analyze-identifiers
(syntax-locally-bound-identifiers #'scope)))
(lambda (capture formals wrappers patterns)
(define (wrap-expression x)
(let lp ((x x) (wrappers wrappers))
(if (null? wrappers)
x
(lp ((car wrappers) x) (cdr wrappers)))))
(with-syntax (((f ...) formals)
((c ...) capture)
(((pname plvl pformal) ...) patterns)
(wrapped (wrap-expression #'(begin #f exp))))
#'(make-lexical-environment
#'scope
(lambda (exp pformal ...)
(with-syntax ((exp exp)
(pformal pformal)
...)
#'(lambda (f ...)
wrapped)))
(list c ...)
(list (list 'pname plvl #'pformal) ...)))))))))
(define (env-module e)
(cond
((lexical-environment? e) (resolve-module (syntax-module (lexenv-scope e))))
((module? e) e)
(else (error "invalid lexical environment" e))))
(define (env-boxes e)
(cond
((lexical-environment? e) (lexenv-boxes e))
((module? e) '())
(else (error "invalid lexical environment" e))))
(define (local-wrap x e)
(cond
((lexical-environment? e)
(apply (lexenv-wrapper e)
(datum->syntax (lexenv-scope e) x)
(map (lambda (l)
(let ((name (car l))
(lvl (cadr l))
(scope (caddr l)))
(within-nested-ellipses (datum->syntax scope name) lvl)))
(lexenv-patterns e))))
((module? e) #`(lambda () #f #,x))
(else (error "invalid lexical environment" e))))
(define (local-eval x e)
"Evaluate the expression @var{x} within the lexical environment @var{e}."
(apply (eval (local-wrap x e) (env-module e))
(env-boxes e)))
(define* (local-compile x e #:key (opts '()))
"Compile and evaluate the expression @var{x} within the lexical
environment @var{e}."
(apply (compile (local-wrap x e) #:env (env-module e)
#:from 'scheme #:opts opts)
(env-boxes e)))
| true |
5104bf2c676feb3ca632528d8d643a4474ad8e8d | c6b8d142caf06cccf400b8c6d0154050f7037bcf | /src/intersection.scm | f0c03c678843204d290d389a9fde58d3c2b6fb70 | [
"Zlib"
]
| permissive | skilldown/sphere-geometry | ee9c138407d7c250f47953c6a18cb722030e3f48 | 817a6e4b7ca20c1ea80036683aabbf302f9b924f | refs/heads/master | 2020-04-05T18:29:28.406919 | 2013-06-05T22:45:30 | 2013-06-05T22:45:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 4,465 | scm | intersection.scm | ;;; Copyright (c) 2012 by Álvaro Castro-Castilla, All Rights Reserved.
;;; Licensed under the GPLv3 license, see LICENSE file for full description.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Intersections
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Segment-segment intersection
(define (intersect.segment-segment sg1 sg2)
(%accept (and (segment? sg1) (segment? sg2)))
(let* ((a1 (car sg1))
(a2 (cadr sg1))
(b1 (car sg2))
(b2 (cadr sg2))
(ua-t (- (* (- (point-x b2) (point-x b1))
(- (point-y a1) (point-y b1)))
(* (- (point-y b2) (point-y b1))
(- (point-x a1) (point-x b1)))))
(ub-t (- (* (- (point-x a2) (point-x a1))
(- (point-y a1) (point-y b1)))
(* (- (point-y a2) (point-y a1))
(- (point-x a1) (point-x b1)))))
(u-b (- (* (- (point-y b2) (point-y b1))
(- (point-x a2) (point-x a1)))
(* (- (point-x b2) (point-x b1))
(- (point-y a2) (point-y a1))))))
(if (= u-b #e0)
(if (or (= ua-t #e0) (= ub-t #e0))
'coincident
'parallel)
(let ((ua (/ ua-t u-b))
(ub (/ ub-t u-b)))
(if (and (<= #e0 ua)
(<= ua #e1)
(<= #e0 ub)
(<= ub #e1))
(make-point (* (+ (point-x a1) ua)
(- (point-x a2) (point-x a1)))
(* (+ (point-y a1) ua)
(- (point-y a2) (point-y a1))))
'no-intersection)))))
;;; Segment - Pseq intersection
(define (intersect.segment-pseq seg pol)
(define (append-next intersections pol-rest)
(let ((inters (intersect.segment-segment seg
(make-segment (car pol-rest)
(cadr pol-rest)))))
(if (or (null? pol-rest) (< (length pol-rest) 3))
(append intersections (list inters))
(if (point? inters)
(append-next (append intersections (list inters)) (cdr pol-rest))
(append-next intersections (cdr pol-rest))))))
(%accept (and (segment? seg) (pseq? pol)))
(append-next '() pol))
(define intersect.pseq-segment intersect.segment-pseq)
;;; Ray - Segment intersection
(define (intersect.ray-segment r s)
(error "Not implemented"))
(define intersect.segment-ray intersect.ray-segment)
;;; Ray - Infinite line intersection
(define (intersect.ray-line r l)
(error "Not implemented"))
(define intersect.line-ray intersect.ray-line)
;;; Infinite line - segment intersection
(define (intersect.line-segment line seg)
(%accept (and (line? line) (segment? seg)))
(aif int point? (intersect.line-line line (segment->line seg))
(if (segment:point-collinear&on? seg int)
int
'projection-intersection)
int))
(define intersect.segment-line intersect.line-segment)
;;; Infinite line - pseq intersections
(define (intersect.line-pseq line pseq)
(%accept (and (line? line) (pseq? pseq)))
(pair-fold-2 (lambda (tail acc)
(aif int point?
(intersect.line-segment line (make-segment (car tail)
(cadr tail)))
(cons int acc)
acc))
'()
pseq))
(define intersect.pseq-line intersect.line-pseq)
;;; Infinite line - infinite line intersection
(define (intersect.line-line l1 l2)
(%accept (and (line? l1) (line? l2)))
(let ((l1a (line-a l1))
(l1b (line-b l1))
(l1c (line-c l1))
(l2a (line-a l2))
(l2b (line-b l2))
(l2c (line-c l2)))
(aif den zero? (- (* l1a l2b)
(* l2a l1b))
(if (and (zero? (- (* l1a l2c)
(* l2a l1c)))
(zero? (- (* l1b l2c)
(* l2b l1c))))
'line
'no-intersection)
(aif nom1 finite? (- (* l1b l2c)
(* l2b l1c))
(aif nom2 finite? (- (* l2a l1c)
(* l1a l2c))
(make-point (/ nom1 den)
(/ nom2 den))
'no-intersection)
'no-intersection))))
| false |
fe0ed7217adfb38faa8d35b90608ac819cf64dc3 | d696b5c5cc0ee7032ab13b6ed486d6158646f828 | /Exercise3-8.scm | 5f65877ad805c8f2da8d8a8e16272299f1984585 | []
| no_license | senwong/SICPExercises | 4f96b1480fa30031b1fe8f44757702c0d7102d2b | 1206705162f0d18892fc70ccb7376a425b6f6534 | refs/heads/master | 2021-09-03T01:31:38.882431 | 2018-01-04T15:45:37 | 2018-01-04T15:45:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 91 | scm | Exercise3-8.scm | (define a #t)
(define (f m)
(cond (a (set! a #f) m)
(else (set! a #f) 0)
)
) | false |
00ade5ea81a29a0c20401c8016dd89242152bf17 | defeada37d39bca09ef76f66f38683754c0a6aa0 | /System/system/net/mime/media-type-names.sls | 557484309c22c2f5c26498a12fe1ac8e7913ead8 | []
| no_license | futsuki/ironscheme-port | 2dbac82c0bda4f4ff509208f7f00a5211d1f7cd5 | 4e7a81b0fbeac9a47440464988e53fb118286c54 | refs/heads/master | 2016-09-06T17:13:11.462593 | 2015-09-26T18:20:40 | 2015-09-26T18:20:40 | 42,757,369 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 251 | sls | media-type-names.sls | (library (system net mime media-type-names)
(export is? media-type-names?)
(import (ironscheme-clr-port))
(define (is? a) (clr-is System.Net.Mime.MediaTypeNames a))
(define (media-type-names? a)
(clr-is System.Net.Mime.MediaTypeNames a)))
| false |
9b5d7a6ed551d6c1e65f0d0c34840ffafdc2985a | 958488bc7f3c2044206e0358e56d7690b6ae696c | /scheme/guile/ffi/test-foreign.scm | d8f8665812c4c74823942977fcdbe6c447e3f23d | []
| no_license | possientis/Prog | a08eec1c1b121c2fd6c70a8ae89e2fbef952adb4 | d4b3debc37610a88e0dac3ac5914903604fd1d1f | refs/heads/master | 2023-08-17T09:15:17.723600 | 2023-08-11T12:32:59 | 2023-08-11T12:32:59 | 40,361,602 | 3 | 0 | null | 2023-03-27T05:53:58 | 2015-08-07T13:24:19 | Coq | UTF-8 | Scheme | false | false | 81 | scm | test-foreign.scm | (use-modules (bitcoin foreign))
(display %foreign-int)(newline)
| false |
417387e29c43f43f0a1343df6a6c12f42181aa45 | ab05b79ab17619f548d9762a46199dc9eed6b3e9 | /sitelib/ypsilon/gdk/cairo.scm | ed2a742bde7ee517c764001a04cb3eec42822201 | [
"BSD-2-Clause"
]
| permissive | lambdaconservatory/ypsilon | 2dce9ff4b5a50453937340bc757697b9b4839dee | f154436db2b3c0629623eb2a53154ad3c50270a1 | refs/heads/master | 2021-02-28T17:44:05.571304 | 2017-12-17T12:29:00 | 2020-03-08T12:57:52 | 245,719,032 | 1 | 0 | NOASSERTION | 2020-03-07T23:08:26 | 2020-03-07T23:08:25 | null | UTF-8 | Scheme | false | false | 1,911 | scm | cairo.scm | #!nobacktrace
;;; Ypsilon Scheme System
;;; Copyright (c) 2004-2009 Y.FUJITA / LittleWing Company Limited.
;;; See license.txt for terms and conditions of use.
(library (ypsilon gdk cairo)
(export gdk_cairo_create
gdk_cairo_rectangle
gdk_cairo_region
gdk_cairo_set_source_color
gdk_cairo_set_source_pixbuf
gdk_cairo_set_source_pixmap)
(import (rnrs) (ypsilon ffi))
(define lib-name
(cond (on-linux "libgdk-x11-2.0.so.0")
(on-sunos "libgdk-x11-2.0.so.0")
(on-freebsd "libgdk-x11-2.0.so.0")
(on-openbsd "libgdk-x11-2.0.so.0")
(on-darwin "Gtk.framework/Gtk")
(on-windows "libgdk-win32-2.0-0.dll")
(else
(assertion-violation #f "can not locate GDK library, unknown operating system"))))
(define lib (load-shared-object lib-name))
(define-syntax define-function
(syntax-rules ()
((_ ret name args)
(define name (c-function lib lib-name ret name args)))))
;; cairo_t* gdk_cairo_create (GdkDrawable* drawable)
(define-function void* gdk_cairo_create (void*))
;; void gdk_cairo_rectangle (cairo_t* cr, const GdkRectangle* rectangle)
(define-function void gdk_cairo_rectangle (void* void*))
;; void gdk_cairo_region (cairo_t* cr, const GdkRegion* region)
(define-function void gdk_cairo_region (void* void*))
;; void gdk_cairo_set_source_color (cairo_t* cr, const GdkColor* color)
(define-function void gdk_cairo_set_source_color (void* void*))
;; void gdk_cairo_set_source_pixbuf (cairo_t* cr, const GdkPixbuf* pixbuf, double pixbuf_x, double pixbuf_y)
(define-function void gdk_cairo_set_source_pixbuf (void* void* double double))
;; void gdk_cairo_set_source_pixmap (cairo_t* cr, GdkPixmap* pixmap, double pixmap_x, double pixmap_y)
(define-function void gdk_cairo_set_source_pixmap (void* void* double double))
) ;[end]
| true |
d29d6316ed6e6b15628c93984f73dfb644a831e0 | a6a1c8eb973242fd2345878e5a871a89468d4080 | /2.54.scm | 66389168e005c06efa8fab566f6f834e72b76fc1 | []
| no_license | takkyuuplayer/sicp | ec20b6942a44e48d559e272b07dc8202dbb1845a | 37aa04ce141530e6c9803c3c7122016d432e924b | refs/heads/master | 2021-01-17T07:43:14.026547 | 2017-02-22T03:40:07 | 2017-02-22T03:40:07 | 15,771,479 | 1 | 1 | null | null | null | null | UTF-8 | Scheme | false | false | 720 | scm | 2.54.scm | (define (my-equal? list1 list2)
(cond ((and (null? list1) (null? list2)) #t)
((or (null? list1) (null? list2)) #f)
((not (eq? (car list1) (car list2))) #f)
(else (my-equal? (cdr list1) (cdr list2)))
))
(print (my-equal? () ()))
(print (my-equal? '(this is a list) '(this is a list)))
(print (my-equal? '(this is a list) '(this (is a) list)))
(print (my-equal? '(this (is a) list) '(this (is a) list)))
;(print (my-equal? '(this is a list) ()))
;
(define (my-equal? list1 list2)
(cond ((and (null? list1) (null? list2)) #t)
((or (null? list1) (null? list2)) #f)
((not (eq? (car list1) (car list2))) #f)
(else (my-equal? (cdr list1) (cdr list2)))
))
| false |
6c166cf44605a0f542a8ad81e587ab40a49d892e | 5fa722a5991bfeacffb1d13458efe15082c1ee78 | /src/lib/r6rs/prime.scm | 9cac6288a560043152fa315f28432ed656c23b4e | []
| 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 | Scheme | false | false | 674 | scm | prime.scm | (library
(prime)
(export prime?)
(import (rnrs)
(utils))
(define (prime? n)
(= n (smallest-divisor n)))
(define (next-1 guess)
(+ 1 guess))
(define (next-2 guess)
(cond ((= guess 2) 3)
(else (+ guess 2))))
(define (smallest-divisor n)
(find-divisor n
2
; replace this as next-2 and run c1_22.rkt to see the
; performance difference
;next-1))
next-2))
(define (find-divisor n guess next-gen)
(cond ((> (square guess) n) n)
((divides? guess n) guess)
(else (find-divisor n (next-gen guess) next-gen))))
)
| false |
b14c25e50fdba97be4f0bfd46c3f89455baa3835 | 26aaec3506b19559a353c3d316eb68f32f29458e | /modules/sqlite/sqlite.scm | 2398d964b1fee0bd27250c4045fda140b0e98794 | [
"BSD-3-Clause"
]
| permissive | mdtsandman/lambdanative | f5dc42372bc8a37e4229556b55c9b605287270cd | 584739cb50e7f1c944cb5253966c6d02cd718736 | refs/heads/master | 2022-12-18T06:24:29.877728 | 2020-09-20T18:47:22 | 2020-09-20T18:47:22 | 295,607,831 | 1 | 0 | NOASSERTION | 2020-09-15T03:48:04 | 2020-09-15T03:48:03 | null | UTF-8 | Scheme | false | false | 5,994 | scm | sqlite.scm | #|
LambdaNative - a cross-platform Scheme framework
Copyright (c) 2009-2014, University of British Columbia
All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, are permitted provided that the
following conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the following
disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials
provided with the distribution.
* Neither the name of the University of British Columbia nor
the names of its contributors may be used to endorse or
promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|#
;; minimal bindings for the sqlite database library
(define sqlite:debuglevel 0)
(define (sqlite:log level . x)
(if (>= sqlite:debuglevel level) (apply log-system (append (list "sqlite: ") x))))
(c-declare #<<end-of-c-declare
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sqlite3.h>
struct sqlite_db {
sqlite3 *db;
sqlite3_stmt *pst;
};
static struct sqlite_db *_sqlite_open(char *filename)
{
struct sqlite_db* d = (struct sqlite_db *)malloc(sizeof(struct sqlite_db));
int err = sqlite3_open(filename, &d->db);
if (err!=SQLITE_OK) { free(d); d=0; }
return d;
}
static void _sqlite_close(struct sqlite_db *d)
{
sqlite3_close(d->db);
free(d);
}
static int _sqlite_column_type(struct sqlite_db *d, int i)
{
return sqlite3_column_type(d->pst, i);
}
static int _sqlite_column_integer(struct sqlite_db *d, int i)
{
const unsigned char *field;
field = sqlite3_column_text(d->pst, i);
return atoi((char*)field);
}
static double _sqlite_column_float(struct sqlite_db *d, int i)
{
const unsigned char *field;
field = sqlite3_column_text(d->pst, i);
return atof((char*)field);
}
static char *_sqlite_column_string(struct sqlite_db *d, int i)
{
const unsigned char *field;
field = sqlite3_column_text(d->pst, i);
return (char*)field;
}
static int _sqlite_data_count(struct sqlite_db *d)
{
return sqlite3_data_count(d->pst);
}
static int _sqlite_step(struct sqlite_db *d)
{
return sqlite3_step(d->pst);
}
static int _sqlite_query(struct sqlite_db *d, char* sql)
{
const char *sql2;
return sqlite3_prepare_v2(d->db, sql, strlen(sql), &d->pst, &sql2);
}
static int _sqlite_finalize(struct sqlite_db *d)
{
return sqlite3_finalize(d->pst);
}
end-of-c-declare
)
(define SQLITE_ERROR ((c-lambda () int "___result = SQLITE_ERROR;")))
(define SQLITE_OK ((c-lambda () int "___result = SQLITE_OK;")))
(define SQLITE_INTEGER ((c-lambda () int "___result = SQLITE_INTEGER;")))
(define SQLITE_FLOAT ((c-lambda () int "___result = SQLITE_FLOAT;")))
(define SQLITE_ROW ((c-lambda () int "___result = SQLITE_ROW;")))
(define sqlite:open (c-lambda (char-string) (pointer void) "_sqlite_open"))
(define sqlite:close (c-lambda ((pointer void)) void "_sqlite_close"))
(define sqlite:column-type (c-lambda ((pointer void) int) int "_sqlite_column_type"))
(define sqlite:column-integer (c-lambda ((pointer void) int) int "_sqlite_column_integer"))
(define sqlite:column-float (c-lambda ((pointer void) int) double "_sqlite_column_float"))
(define sqlite:column-string (c-lambda ((pointer void) int) char-string "_sqlite_column_string"))
(define sqlite:data-count (c-lambda ((pointer void)) int "_sqlite_data_count"))
(define sqlite:step (c-lambda ((pointer void)) int "_sqlite_step"))
(define sqlite:query (c-lambda ((pointer void) char-string) int "_sqlite_query"))
(define sqlite:finalize (c-lambda ((pointer void)) int "_sqlite_finalize"))
(define (sqlite-open dbname)
(sqlite:log 1 "sqlite-open " dbname)
(sqlite:open dbname))
(define (sqlite-close db)
(sqlite:log 1 "sqlite-close " db)
(sqlite:close db))
(define (sqlite-query db q)
(sqlite:log 1 "sqlite-query " db " " q)
(if (fx= (sqlite:query db q) SQLITE_OK)
(let loop ((res '()))
(if (not (fx= (sqlite:step db) SQLITE_ROW)) (begin (sqlite:finalize db) res)
(loop (append res (list
(let ((n (sqlite:data-count db)))
(let loop2 ((i 0)(col '()))
(if (fx= i n) col
(let* ((type (sqlite:column-type db i))
(data ((if (fx= type SQLITE_INTEGER)
sqlite:column-integer
(if (fx= type SQLITE_FLOAT)
sqlite:column-float
sqlite:column-string
)) db i)))
(loop2 (fx+ i 1) (append col (list data)))))))))))) #f))
;; simple test
(define (sqlite:test filename)
(let ((db (sqlite-open filename)))
(sqlite-query db "create table tbl1(one varchar(10), two smallint)")
(sqlite-query db "insert into tbl1 values('hello!',10)")
(sqlite-query db "insert into tbl1 values('goodbye', 20)")
(sqlite-query db "insert into tbl1 values('one more', 2.3)")
(let ((res (sqlite-query db "select * from tbl1")))
(sqlite-close db) res)))
;; eof
| false |
cbb8c1be9f0f8e27684aac911b74e57a1626c780 | b39668eccdb1b003b6f98ea6e7a92c7bb2b5e951 | /gui-bitmap-cache.ss | 1ef8327f59a9201280c10b4f2f52615959eba209 | []
| no_license | angryzor/magic-the-gathering-project | d9c1f99bfbb38a8f9850427140d72db8c691297c | a58993eae9a7b0130353735b2d09ae6c8b07b006 | refs/heads/master | 2021-01-01T17:17:16.742759 | 2013-01-12T17:32:04 | 2013-01-12T17:32:04 | 7,578,284 | 0 | 1 | null | null | null | null | UTF-8 | Scheme | false | false | 889 | ss | gui-bitmap-cache.ss | #lang scheme/gui
(provide gui-bitmap-cache%)
(require (lib "double-linked-position-list.ss" "magic"))
(define gui-bitmap-cache%
(class object%
(define cache (position-list (lambda (val str)
(string=? (send val get-path) str))))
(define gui-bitmap-cache-node%
(class object%
(init-field path)
(define bitmap (make-object bitmap% path))
(define/public (get-path)
path)
(define/public (get-bitmap)
bitmap)
(super-new)))
(define/public (access path)
(let ([pos (cache 'find path)])
(if pos
(send (cache 'value pos) get-bitmap)
(let ([new-n (make-object gui-bitmap-cache-node% path)])
(cache 'add-after! new-n)
(send new-n get-bitmap)))))
(super-new)))
| false |
8ffdb77fa1feffc350a4307e41959277896836db | 784dc416df1855cfc41e9efb69637c19a08dca68 | /src/bootstrap/gerbil/expander/core.ssxi.ss | 1b62403965eeb2ba2957f8fdcf3b97196d6a4efe | [
"LGPL-2.1-only",
"Apache-2.0",
"LGPL-2.1-or-later"
]
| permissive | danielsz/gerbil | 3597284aa0905b35fe17f105cde04cbb79f1eec1 | e20e839e22746175f0473e7414135cec927e10b2 | refs/heads/master | 2021-01-25T09:44:28.876814 | 2018-03-26T21:59:32 | 2018-03-26T21:59:32 | 123,315,616 | 0 | 0 | Apache-2.0 | 2018-02-28T17:02:28 | 2018-02-28T17:02:28 | null | UTF-8 | Scheme | false | false | 18,505 | ss | core.ssxi.ss | prelude: :gerbil/compiler/ssxi
package: gerbil/expander
(begin
(declare-type
gx#expander-context::t
(@struct-type gx#expander-context::t #f 2 :init! ()))
(declare-type gx#expander-context? (@struct-pred gx#expander-context::t))
(declare-type gx#make-expander-context (@struct-cons gx#expander-context::t))
(declare-type
gx#expander-context-id
(@struct-getf gx#expander-context::t 0 #f))
(declare-type
gx#expander-context-table
(@struct-getf gx#expander-context::t 1 #f))
(declare-type
gx#expander-context-id-set!
(@struct-setf gx#expander-context::t 0 #f))
(declare-type
gx#expander-context-table-set!
(@struct-setf gx#expander-context::t 1 #f))
(declare-type
gx#root-context::t
(@struct-type gx#root-context::t gx#expander-context::t 0 :init! ()))
(declare-type gx#root-context? (@struct-pred gx#root-context::t))
(declare-type gx#make-root-context (@struct-cons gx#root-context::t))
(declare-type
gx#phi-context::t
(@struct-type gx#context-phi::t gx#expander-context::t 3 :init! ()))
(declare-type gx#phi-context? (@struct-pred gx#phi-context::t))
(declare-type gx#make-phi-context (@struct-cons gx#phi-context::t))
(declare-type gx#phi-context-super (@struct-getf gx#phi-context::t 0 #f))
(declare-type gx#phi-context-up (@struct-getf gx#phi-context::t 1 #f))
(declare-type gx#phi-context-down (@struct-getf gx#phi-context::t 2 #f))
(declare-type
gx#phi-context-super-set!
(@struct-setf gx#phi-context::t 0 #f))
(declare-type gx#phi-context-up-set! (@struct-setf gx#phi-context::t 1 #f))
(declare-type gx#phi-context-down-set! (@struct-setf gx#phi-context::t 2 #f))
(declare-type
gx#top-context::t
(@struct-type gx#top-context::t gx#phi-context::t 0 :init! ()))
(declare-type gx#top-context? (@struct-pred gx#top-context::t))
(declare-type gx#make-top-context (@struct-cons gx#top-context::t))
(declare-type
gx#module-context::t
(@struct-type gx#module-context::t gx#top-context::t 6 :init! ()))
(declare-type gx#module-context? (@struct-pred gx#module-context::t))
(declare-type gx#make-module-context (@struct-cons gx#module-context::t))
(declare-type gx#module-context-ns (@struct-getf gx#module-context::t 0 #f))
(declare-type
gx#module-context-path
(@struct-getf gx#module-context::t 1 #f))
(declare-type
gx#module-context-import
(@struct-getf gx#module-context::t 2 #f))
(declare-type
gx#module-context-export
(@struct-getf gx#module-context::t 3 #f))
(declare-type gx#module-context-e (@struct-getf gx#module-context::t 4 #f))
(declare-type
gx#module-context-code
(@struct-getf gx#module-context::t 5 #f))
(declare-type
gx#module-context-ns-set!
(@struct-setf gx#module-context::t 0 #f))
(declare-type
gx#module-context-path-set!
(@struct-setf gx#module-context::t 1 #f))
(declare-type
gx#module-context-import-set!
(@struct-setf gx#module-context::t 2 #f))
(declare-type
gx#module-context-export-set!
(@struct-setf gx#module-context::t 3 #f))
(declare-type
gx#module-context-e-set!
(@struct-setf gx#module-context::t 4 #f))
(declare-type
gx#module-context-code-set!
(@struct-setf gx#module-context::t 5 #f))
(declare-type
gx#prelude-context::t
(@struct-type gx#prelude-context::t gx#top-context::t 3 :init! ()))
(declare-type gx#prelude-context? (@struct-pred gx#prelude-context::t))
(declare-type gx#make-prelude-context (@struct-cons gx#prelude-context::t))
(declare-type
gx#prelude-context-path
(@struct-getf gx#prelude-context::t 0 #f))
(declare-type
gx#prelude-context-import
(@struct-getf gx#prelude-context::t 1 #f))
(declare-type gx#prelude-context-e (@struct-getf gx#prelude-context::t 2 #f))
(declare-type
gx#prelude-context-path-set!
(@struct-setf gx#prelude-context::t 0 #f))
(declare-type
gx#prelude-context-import-set!
(@struct-setf gx#prelude-context::t 1 #f))
(declare-type
gx#prelude-context-e-set!
(@struct-setf gx#prelude-context::t 2 #f))
(declare-type
gx#local-context::t
(@struct-type gx#local-context::t gx#phi-context::t 0 :init! ()))
(declare-type gx#local-context? (@struct-pred gx#local-context::t))
(declare-type gx#make-local-context (@struct-cons gx#local-context::t))
(declare-type
gx#phi-context:::init!
(@case-lambda (2 gx#phi-context:::init!__0) (3 gx#phi-context:::init!__%)))
(declare-method gx#phi-context::t :init! gx#phi-context:::init! #f)
(declare-type
gx#local-context:::init!
(@case-lambda
(1 gx#local-context:::init!__0)
(2 gx#local-context:::init!__%)))
(declare-method gx#local-context::t :init! gx#local-context:::init! #f)
(declare-type gx#binding::t (@struct-type gx#binding::t #f 3 #f ()))
(declare-type gx#binding? (@struct-pred gx#binding::t))
(declare-type gx#make-binding (@struct-cons gx#binding::t))
(declare-type gx#binding-id (@struct-getf gx#binding::t 0 #f))
(declare-type gx#binding-key (@struct-getf gx#binding::t 1 #f))
(declare-type gx#binding-phi (@struct-getf gx#binding::t 2 #f))
(declare-type gx#binding-id-set! (@struct-setf gx#binding::t 0 #f))
(declare-type gx#binding-key-set! (@struct-setf gx#binding::t 1 #f))
(declare-type gx#binding-phi-set! (@struct-setf gx#binding::t 2 #f))
(declare-type
gx#runtime-binding::t
(@struct-type gx#runtime-binding::t gx#binding::t 0 #f ()))
(declare-type gx#runtime-binding? (@struct-pred gx#runtime-binding::t))
(declare-type gx#make-runtime-binding (@struct-cons gx#runtime-binding::t))
(declare-type
gx#local-binding::t
(@struct-type gx#local-binding::t gx#runtime-binding::t 0 #f ()))
(declare-type gx#local-binding? (@struct-pred gx#local-binding::t))
(declare-type gx#make-local-binding (@struct-cons gx#local-binding::t))
(declare-type
gx#top-binding::t
(@struct-type gx#top-binding::t gx#runtime-binding::t 0 #f ()))
(declare-type gx#top-binding? (@struct-pred gx#top-binding::t))
(declare-type gx#make-top-binding (@struct-cons gx#top-binding::t))
(declare-type
gx#module-binding::t
(@struct-type gx#module-binding::t gx#top-binding::t 1 #f ()))
(declare-type gx#module-binding? (@struct-pred gx#module-binding::t))
(declare-type gx#make-module-binding (@struct-cons gx#module-binding::t))
(declare-type
gx#module-binding-context
(@struct-getf gx#module-binding::t 0 #f))
(declare-type
gx#module-binding-context-set!
(@struct-setf gx#module-binding::t 0 #f))
(declare-type
gx#extern-binding::t
(@struct-type gx#extern-binding::t gx#top-binding::t 0 #f ()))
(declare-type gx#extern-binding? (@struct-pred gx#extern-binding::t))
(declare-type gx#make-extern-binding (@struct-cons gx#extern-binding::t))
(declare-type
gx#syntax-binding::t
(@struct-type gx#syntax-binding::t gx#binding::t 1 #f ((final: . #t))))
(declare-type gx#syntax-binding? (@struct-pred gx#syntax-binding::t))
(declare-type gx#make-syntax-binding (@struct-cons gx#syntax-binding::t))
(declare-type gx#syntax-binding-e (@struct-getf gx#syntax-binding::t 0 #f))
(declare-type
gx#syntax-binding-e-set!
(@struct-setf gx#syntax-binding::t 0 #f))
(declare-type
gx#import-binding::t
(@struct-type gx#import-binding::t gx#binding::t 3 #f ((final: . #t))))
(declare-type gx#import-binding? (@struct-pred gx#import-binding::t))
(declare-type gx#make-import-binding (@struct-cons gx#import-binding::t))
(declare-type gx#import-binding-e (@struct-getf gx#import-binding::t 0 #f))
(declare-type
gx#import-binding-context
(@struct-getf gx#import-binding::t 1 #f))
(declare-type
gx#import-binding-weak?
(@struct-getf gx#import-binding::t 2 #f))
(declare-type
gx#import-binding-e-set!
(@struct-setf gx#import-binding::t 0 #f))
(declare-type
gx#import-binding-context-set!
(@struct-setf gx#import-binding::t 1 #f))
(declare-type
gx#import-binding-weak?-set!
(@struct-setf gx#import-binding::t 2 #f))
(declare-type
gx#alias-binding::t
(@struct-type gx#alias-binding::t gx#binding::t 1 #f ((final: . #t))))
(declare-type gx#alias-binding? (@struct-pred gx#alias-binding::t))
(declare-type gx#make-alias-binding (@struct-cons gx#alias-binding::t))
(declare-type gx#alias-binding-e (@struct-getf gx#alias-binding::t 0 #f))
(declare-type
gx#alias-binding-e-set!
(@struct-setf gx#alias-binding::t 0 #f))
(declare-type gx#expander::t (@struct-type gx#expander::t #f 1 #f ()))
(declare-type gx#expander? (@struct-pred gx#expander::t))
(declare-type gx#make-expander (@struct-cons gx#expander::t))
(declare-type gx#expander-e (@struct-getf gx#expander::t 0 #f))
(declare-type gx#expander-e-set! (@struct-setf gx#expander::t 0 #f))
(declare-type
gx#core-expander::t
(@struct-type gx#core-expander::t gx#expander::t 2 #f ()))
(declare-type gx#core-expander? (@struct-pred gx#core-expander::t))
(declare-type gx#make-core-expander (@struct-cons gx#core-expander::t))
(declare-type gx#core-expander-id (@struct-getf gx#core-expander::t 0 #f))
(declare-type
gx#core-expander-compile-top
(@struct-getf gx#core-expander::t 1 #f))
(declare-type
gx#core-expander-id-set!
(@struct-setf gx#core-expander::t 0 #f))
(declare-type
gx#core-expander-compile-top-set!
(@struct-setf gx#core-expander::t 1 #f))
(declare-type
gx#expression-form::t
(@struct-type gx#expression-form::t gx#core-expander::t 0 #f ()))
(declare-type gx#expression-form? (@struct-pred gx#expression-form::t))
(declare-type gx#make-expression-form (@struct-cons gx#expression-form::t))
(declare-type
gx#special-form::t
(@struct-type gx#special-form::t gx#core-expander::t 0 #f ()))
(declare-type gx#special-form? (@struct-pred gx#special-form::t))
(declare-type gx#make-special-form (@struct-cons gx#special-form::t))
(declare-type
gx#definition-form::t
(@struct-type gx#definition-form::t gx#special-form::t 0 #f ()))
(declare-type gx#definition-form? (@struct-pred gx#definition-form::t))
(declare-type gx#make-definition-form (@struct-cons gx#definition-form::t))
(declare-type
gx#top-special-form::t
(@struct-type gx#top-special-form::t gx#special-form::t 0 #f ()))
(declare-type gx#top-special-form? (@struct-pred gx#top-special-form::t))
(declare-type gx#make-top-special-form (@struct-cons gx#top-special-form::t))
(declare-type
gx#module-special-form::t
(@struct-type gx#module-special-form::t gx#top-special-form::t 0 #f ()))
(declare-type
gx#module-special-form?
(@struct-pred gx#module-special-form::t))
(declare-type
gx#make-module-special-form
(@struct-cons gx#module-special-form::t))
(declare-type
gx#feature-expander::t
(@struct-type gx#feature-expander::t gx#expander::t 0 #f ()))
(declare-type gx#feature-expander? (@struct-pred gx#feature-expander::t))
(declare-type gx#make-feature-expander (@struct-cons gx#feature-expander::t))
(declare-type
gx#private-feature-expander::t
(@struct-type
gx#private-feature-expander::t
gx#feature-expander::t
0
#f
()))
(declare-type
gx#private-feature-expander?
(@struct-pred gx#private-feature-expander::t))
(declare-type
gx#make-private-feature-expander
(@struct-cons gx#private-feature-expander::t))
(declare-type
gx#reserved-expander::t
(@struct-type gx#reserved-expander::t gx#expander::t 0 #f ()))
(declare-type gx#reserved-expander? (@struct-pred gx#reserved-expander::t))
(declare-type
gx#make-reserved-expander
(@struct-cons gx#reserved-expander::t))
(declare-type
gx#macro-expander::t
(@struct-type gx#core-macro::t gx#expander::t 0 #f ()))
(declare-type gx#macro-expander? (@struct-pred gx#macro-expander::t))
(declare-type gx#make-macro-expander (@struct-cons gx#macro-expander::t))
(declare-type
gx#rename-macro-expander::t
(@struct-type gx#rename-macro-expander::t gx#macro-expander::t 0 #f ()))
(declare-type
gx#rename-macro-expander?
(@struct-pred gx#rename-macro-expander::t))
(declare-type
gx#make-rename-macro-expander
(@struct-cons gx#rename-macro-expander::t))
(declare-type
gx#user-expander::t
(@struct-type gx#macro-expander::t gx#macro-expander::t 2 #f ()))
(declare-type gx#user-expander? (@struct-pred gx#user-expander::t))
(declare-type gx#make-user-expander (@struct-cons gx#user-expander::t))
(declare-type
gx#user-expander-context
(@struct-getf gx#user-expander::t 0 #f))
(declare-type gx#user-expander-phi (@struct-getf gx#user-expander::t 1 #f))
(declare-type
gx#user-expander-context-set!
(@struct-setf gx#user-expander::t 0 #f))
(declare-type
gx#user-expander-phi-set!
(@struct-setf gx#user-expander::t 1 #f))
(declare-type
gx#expander-mark::t
(@struct-type gx#expander-mark::t #f 4 #f ()))
(declare-type gx#expander-mark? (@struct-pred gx#expander-mark::t))
(declare-type gx#make-expander-mark (@struct-cons gx#expander-mark::t))
(declare-type gx#expander-mark-subst (@struct-getf gx#expander-mark::t 0 #f))
(declare-type
gx#expander-mark-context
(@struct-getf gx#expander-mark::t 1 #f))
(declare-type gx#expander-mark-phi (@struct-getf gx#expander-mark::t 2 #f))
(declare-type gx#expander-mark-trace (@struct-getf gx#expander-mark::t 3 #f))
(declare-type
gx#expander-mark-subst-set!
(@struct-setf gx#expander-mark::t 0 #f))
(declare-type
gx#expander-mark-context-set!
(@struct-setf gx#expander-mark::t 1 #f))
(declare-type
gx#expander-mark-phi-set!
(@struct-setf gx#expander-mark::t 2 #f))
(declare-type
gx#expander-mark-trace-set!
(@struct-setf gx#expander-mark::t 3 #f))
(declare-type
gx#syntax-error::t
(@struct-type gx#syntax-error::t error::t 3 #!void ()))
(declare-type gx#syntax-error? (@struct-pred gx#syntax-error::t))
(declare-type gx#make-syntax-error (@struct-cons gx#syntax-error::t))
(declare-type gx#syntax-error-context (@struct-getf gx#syntax-error::t 0 #f))
(declare-type gx#syntax-error-marks (@struct-getf gx#syntax-error::t 1 #f))
(declare-type gx#syntax-error-phi (@struct-getf gx#syntax-error::t 2 #f))
(declare-type
gx#syntax-error-context-set!
(@struct-setf gx#syntax-error::t 0 #f))
(declare-type
gx#syntax-error-marks-set!
(@struct-setf gx#syntax-error::t 1 #f))
(declare-type
gx#syntax-error-phi-set!
(@struct-setf gx#syntax-error::t 2 #f))
(declare-type
gx#eval-syntax
(@case-lambda (1 gx#eval-syntax__0) (2 gx#eval-syntax__%)))
(declare-type
gx#core-expand
(@case-lambda (1 gx#core-expand__0) (2 gx#core-expand__%)))
(declare-type
gx#core-expand*
(@case-lambda (1 gx#core-expand*__0) (2 gx#core-expand*__%)))
(declare-type
gx#core-expand-block
(@case-lambda
(2 gx#core-expand-block__0)
(3 gx#core-expand-block__1)
(4 gx#core-expand-block__%)))
(declare-type
gx#core-expand-include%
(@case-lambda
(1 gx#core-expand-include%__0)
(2 gx#core-expand-include%__%)))
(declare-type
gx#core-apply-expander
(@case-lambda (2 gx#core-apply-expander__0) (3 gx#core-apply-expander__%)))
(declare-method
gx#expander::t
apply-macro-expander
gx#expander::apply-macro-expander
#f)
(declare-method
gx#macro-expander::t
apply-macro-expander
gx#macro-expander::apply-macro-expander
#f)
(declare-method
gx#core-expander::t
apply-macro-expander
gx#core-expander::apply-macro-expander
#f)
(declare-type
gx#top-special-form::apply-macro-expander
(@case-lambda
(2 gx#top-special-form::apply-macro-expander__0)
(3 gx#top-special-form::apply-macro-expander__%)))
(declare-method
gx#top-special-form::t
apply-macro-expander
gx#top-special-form::apply-macro-expander
#f)
(declare-method
gx#module-special-form::t
apply-macro-expander
gx#module-special-form::apply-macro-expander
#f)
(declare-method
gx#rename-macro-expander::t
apply-macro-expander
gx#rename-macro-expander::apply-macro-expander
#f)
(declare-type
gx#core-apply-user-expander
(@case-lambda
(2 gx#core-apply-user-expander__0)
(3 gx#core-apply-user-expander__%)))
(declare-type
gx#user-expander::apply-macro-expander
(@case-lambda
(2 gx#core-apply-user-expander__0)
(3 gx#core-apply-user-expander__%)))
(declare-method
gx#user-expander::t
apply-macro-expander
gx#user-expander::apply-macro-expander
#f)
(declare-type
gx#resolve-identifier
(@case-lambda
(1 gx#resolve-identifier__0)
(2 gx#resolve-identifier__1)
(3 gx#resolve-identifier__%)))
(declare-type
gx#bind-identifier!
(@case-lambda
(2 gx#bind-identifier!__0)
(3 gx#bind-identifier!__1)
(4 gx#bind-identifier!__2)
(5 gx#bind-identifier!__%)))
(declare-type
gx#core-resolve-identifier
(@case-lambda
(1 gx#core-resolve-identifier__0)
(2 gx#core-resolve-identifier__1)
(3 gx#core-resolve-identifier__%)))
(declare-type
gx#core-bind!
(@case-lambda
(2 gx#core-bind!__0)
(3 gx#core-bind!__1)
(4 gx#core-bind!__2)
(5 gx#core-bind!__%)))
(declare-type
gx#core-context-top
(@case-lambda
(0 gx#core-context-top__0)
(1 gx#core-context-top__1)
(2 gx#core-context-top__%)))
(declare-type
gx#core-context-root
(@case-lambda (0 gx#core-context-root__0) (1 gx#core-context-root__%)))
(declare-type
gx#core-context-rebind?
(@case-lambda
(0 gx#core-context-rebind?__0)
(1 gx#core-context-rebind?__%)
((1) gx#core-context-rebind?__%)))
(declare-type
gx#core-context-namespace
(@case-lambda
(0 gx#core-context-namespace__0)
(1 gx#core-context-namespace__%)))
(declare-type
gx#expander-binding?
(@case-lambda (1 gx#expander-binding?__0) (2 gx#expander-binding?__%)))
(declare-type
gx#core-bound-identifier?
(@case-lambda
(1 gx#core-bound-identifier?__0)
(2 gx#core-bound-identifier?__%)))
(declare-type
gx#core-quote-syntax
(@case-lambda
(1 gx#core-quote-syntax__0)
(2 gx#core-quote-syntax__1)
(3 gx#core-quote-syntax__2)
(4 gx#core-quote-syntax__%)))
(declare-type
gx#core-resolve-path
(@case-lambda (1 gx#core-resolve-path__0) (2 gx#core-resolve-path__%)))
(declare-type
gx#core-deserialize-mark
(@case-lambda
(1 gx#core-deserialize-mark__0)
(2 gx#core-deserialize-mark__%)))
(declare-type
gx#syntax-local-e
(@case-lambda (1 gx#syntax-local-e__0) (2 gx#syntax-local-e__%)))
(declare-type
gx#syntax-local-value
(@case-lambda (1 gx#syntax-local-value__0) (2 gx#syntax-local-value__%))))
| false |
4cf6b3efc762c73fa6819f4770aa6e62c9870be9 | defeada37d39bca09ef76f66f38683754c0a6aa0 | /System.Xml/system/xml/xml-entity-reference.sls | 79e38ff8d9b366add1862047184f7e72de347537 | []
| no_license | futsuki/ironscheme-port | 2dbac82c0bda4f4ff509208f7f00a5211d1f7cd5 | 4e7a81b0fbeac9a47440464988e53fb118286c54 | refs/heads/master | 2016-09-06T17:13:11.462593 | 2015-09-26T18:20:40 | 2015-09-26T18:20:40 | 42,757,369 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 1,689 | sls | xml-entity-reference.sls | (library (system xml xml-entity-reference)
(export is?
xml-entity-reference?
clone-node
write-content-to
write-to
base-uri
is-read-only?
local-name
name
node-type
value-get
value-set!
value-update!)
(import (ironscheme-clr-port))
(define (is? a) (clr-is System.Xml.XmlEntityReference a))
(define (xml-entity-reference? a)
(clr-is System.Xml.XmlEntityReference a))
(define-method-port
clone-node
System.Xml.XmlEntityReference
CloneNode
(System.Xml.XmlNode System.Boolean))
(define-method-port
write-content-to
System.Xml.XmlEntityReference
WriteContentTo
(System.Void System.Xml.XmlWriter))
(define-method-port
write-to
System.Xml.XmlEntityReference
WriteTo
(System.Void System.Xml.XmlWriter))
(define-field-port
base-uri
#f
#f
(property:)
System.Xml.XmlEntityReference
BaseURI
System.String)
(define-field-port
is-read-only?
#f
#f
(property:)
System.Xml.XmlEntityReference
IsReadOnly
System.Boolean)
(define-field-port
local-name
#f
#f
(property:)
System.Xml.XmlEntityReference
LocalName
System.String)
(define-field-port
name
#f
#f
(property:)
System.Xml.XmlEntityReference
Name
System.String)
(define-field-port
node-type
#f
#f
(property:)
System.Xml.XmlEntityReference
NodeType
System.Xml.XmlNodeType)
(define-field-port
value-get
value-set!
value-update!
(property:)
System.Xml.XmlEntityReference
Value
System.String))
| false |
ccc86acca8e0c683dc2ba1f69bce14c7be535bf9 | cb8cccd92c0832e056be608063bbec8fff4e4265 | /chapter2/Exercises/2.31.scm | f8b2d48bcafbd7b477a23d299805ce902c9d5091 | []
| no_license | JoseLGF/SICP | 6814999c5fb15256401acb9a53bd8aac75054a14 | 43f7a8e6130095e732c6fc883501164a48ab2229 | refs/heads/main | 2023-07-21T03:56:35.984943 | 2021-09-08T05:19:38 | 2021-09-08T05:19:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 491 | scm | 2.31.scm | #lang scheme
; Exercise 2.31
; Abstract the answer in 2.30 to produce a procedure tree-map
; such that square-tree can be defined as:
; (define (square-tree tree) (tree-map square tree))
(define (tree-map f tree)
(map (lambda (sub-tree)
(if (pair? sub-tree)
(tree-map f sub-tree)
(f sub-tree)))
tree))
(define (square x) (* x x))
(define (square-tree tree) (tree-map square tree))
(square-tree
(list 1
(list 2 (list 3 4) 5)
(list 6 7))) | false |
05fb2f271d8c2e44a6f2d7436851c77721c9463d | eeb788f85765d6ea5a495e1ece590f912bc8c657 | /profj/libs/java/lang/String.ss | aa56e865b21feccfb8f27c03b84b4123f0b8bcc8 | []
| no_license | mflatt/profj | f645aaae2b147a84b385e42f681de29535e13dd4 | bc30ab369ac92ef3859d57be5c13c9562948bb8a | refs/heads/master | 2023-08-28T14:13:17.153358 | 2023-08-08T13:08:04 | 2023-08-08T13:08:04 | 10,001,564 | 10 | 4 | null | 2020-12-01T18:41:00 | 2013-05-11T15:54:54 | Scheme | UTF-8 | Scheme | false | false | 398 | ss | String.ss | (module String scheme/base
(require "Object-composite.ss")
(provide make-java-string String String-valueOf-java.lang.Object String-valueOf-char1
String-valueOf-char1-int-int String-copyValueOf-char1-int-int String-copyValueOf-char1
String-valueOf-boolean String-valueOf-char String-valueOf-int String-valueOf-long
String-valueOf-float String-valueOf-double))
| false |
c16b124bcbd55d7f97675b1be96ebd41463d9350 | a6c4b839754b01e1b94a70ec558b631313c9df34 | /tests/interpreter-test.ss | dde9a3d9329f82250c2fac3a6102504a88b2cf21 | []
| no_license | dyoo/divascheme | b6a05f625397670b179a51e13d3cd9aac0b2e7d5 | f1a8d82989115e0d0714ce8fdbd452487de12535 | refs/heads/master | 2021-01-17T09:39:14.664809 | 2008-08-19T01:46:33 | 2008-08-19T01:46:33 | 3,205,925 | 0 | 1 | null | 2018-01-22T01:27:19 | 2012-01-18T04:11:36 | Scheme | UTF-8 | Scheme | false | false | 66,268 | ss | interpreter-test.ss | (module interpreter-test mzscheme
(require (lib "class.ss")
(lib "etc.ss")
(lib "list.ss")
(lib "struct.ss")
"test-harness.ss"
"utilities.ss"
"structures.ss"
"templates.ss"
"actions.ss"
"interpreter.ss")
(define (tests)
; empty-world : World
(define empty-world (make-World ""
empty
(index->syntax-pos 0)
#f
0
(index->syntax-pos 0)
0
(default-Next-f)
(default-Previous-f)
false
false
false
(default-Magic-f)
(default-Pass-f)
false
""))
; eval-asts : index non-negative-integer index non-negative-integer string (union string false) (ast list) -> world
(define (eval-asts cursor-index selection-length mark-index mark-length text clipboard-content asts)
(let* ([actions (make-object actions%)]
[world (copy-struct World empty-world
[World-text text]
[World-syntax-list (string->syntax-list text)]
[World-cursor-position (index->syntax-pos cursor-index)]
[World-selection-length selection-length]
[World-mark-position (index->syntax-pos mark-index)]
[World-mark-length mark-length])]
#;[_ (set-clipboard-content clipboard-content)]
[eval-PST (lambda (world ast)
(with-handlers ([voice-exn? (lambda args world)]
[voice-exn/world? (lambda (exn) (voice-exn/world-world exn))])
(parameterize ([current-actions actions])
(eval-Protocol-Syntax-Tree world ast))))])
(foldl (lambda (ast acc) (eval-PST acc ast)) world asts)))
; test/asts : index non-negative-integer string (ast list) expected -> void
(define (test/asts cursor-index selection-length text asts . expected)
(let ([world (eval-asts cursor-index selection-length 0 0 text false asts)])
(test (list [World-cursor-index world]
[World-selection-length world]
[World-text world])
expected)))
; test/ast : index non-negative-integer string ast expected -> void
(define (test/ast cursor-index selection-length text ast . expected)
(eval `(,test/asts ,cursor-index ,selection-length ,text (,list ,ast) ,@expected)))
; test/mark-asts : index non-negative-integer index non-negative-integer string (ast list) expected -> void
(define (test/mark-asts cursor-index selection-length mark-index mark-length text asts . expected)
(let ([world (eval-asts cursor-index selection-length mark-index mark-length text false asts)])
(test (list [World-cursor-index world]
[World-selection-length world]
[World-mark-index world]
[World-mark-length world]
[World-text world])
expected)))
; test/mark-ast : index non-negative-integer index non-negative-integer string ast expected -> void
(define (test/mark-ast cursor-index selection-length mark-index mark-length text ast . expected)
(eval `(,test/mark-asts ,cursor-index ,selection-length ,mark-index ,mark-length ,text (,list ,ast) ,@expected)))
; test/clip-asts : index non-negative-integer string (union false string) (ast list) expected -> void
(define (test/clip-asts cursor-index selection-length text clipboard-content asts . expected)
(let ([world (eval-asts cursor-index selection-length 0 0 text clipboard-content asts)])
(test (list [World-cursor-index world]
[World-selection-length world]
[World-text world]
(get-clipboard-content))
expected)))
; test/clip-ast : index non-negative-integer string false ast expected -> void
(define (test/clip-ast cursor-index selection-length text clipboard-content ast . expected)
(eval `(,test/clip-asts ,cursor-index ,selection-length ,text ,clipboard-content (,list ,ast) ,@expected)))
; inc/dec-what-distance : (union What false) int -> What
; test/inc/dec-what-distance : ((union What false) int -> What) -> (union What false) int expected -> void
(define ((test/inc/dec-what-distance inc/dec-what-distance) what/false x expected)
(let ([whatdn (inc/dec-what-distance what/false x)])
(test (WhatDN-distance whatdn) expected)))
; inc-what-distance : (union What false) int -> What
; test/inc-what-distance : (union What false) int expected -> void
(define test/inc-what-distance
(test/inc/dec-what-distance inc-what-distance))
; dec-what-distance : (union What false) int -> What
; test/dec-what-distance : (union What false) int expected -> void
(define test/dec-what-distance
(test/inc/dec-what-distance dec-what-distance))
; inc/dec-Loc-distance : Loc int -> Loc
; test/inc/dec-Loc-distance : (Loc int -> Loc) -> Loc int expected -> void
(define ((test/inc/dec-Loc-distance inc/dec-Loc-distance) loc n expected)
(let ([loc (inc/dec-Loc-distance loc n)])
(test (WhatDN-distance (Loc-what loc)) expected)))
; inc-Loc-distance : Loc int -> Loc
; test/inc-Loc-distance : Loc int expected -> void
(define test/inc-Loc-distance
(test/inc/dec-Loc-distance inc-Loc-distance))
; dec-Loc-distance : Loc int -> Loc
; test/dec-Loc-distance : Loc int expected -> void
(define test/dec-Loc-distance
(test/inc/dec-Loc-distance dec-Loc-distance))
; revert-cursor : World World -> World
; test/revert-cursor : cursor-index -> void
(define (test/revert-cursor cursor-index)
(let ([old-world (copy-struct World empty-world
[World-cursor-position (index->syntax-pos cursor-index)])]
[new-world empty-world])
(test (World-cursor-index (revert-cursor old-world new-world))
cursor-index)))
(print-tests true)
; test/inc-what-distance : (union What false) int expected -> void
(test/inc-what-distance (make-WhatN (make-The-Symbol 'dummy)) 76 77)
(test/inc-what-distance (make-WhatN (make-Symbol-Noun 'hips)) 89 90)
(test/inc-what-distance (make-WhatDN 0 (make-The-Symbol 'gloups)) 27 27)
(test/inc-what-distance (make-WhatDN -3 (make-Symbol-Noun 'patatra)) 12 9)
; test/dec-what-distance : (union What false) int expected -> void
(test/dec-what-distance (make-WhatN (make-The-Symbol 'singing)) 12 -11)
(test/dec-what-distance (make-WhatDN 4 (make-Symbol-Noun 'rain)) -1 5)
; test/inc-Loc-distance : Loc int expected -> void
(test/inc-Loc-distance (make-Loc (make-After) (make-WhatN (make-The-Symbol 'Numb))) 0 1)
(test/inc-Loc-distance (make-Loc (make-Before) (make-WhatN (make-Symbol-Noun '|Coma White|))) 8 9)
(test/inc-Loc-distance (make-Loc (make-After) (make-WhatDN -3 (make-Symbol-Noun '|In The End|))) -2 -5)
(test/inc-Loc-distance (make-Loc (make-Before) (make-WhatDN 4 (make-The-Symbol '|Nothing|))) -1 3)
; test/dec-Loc-distance : Loc int expected -> void
(test/dec-Loc-distance (make-Loc (make-Before) (make-WhatDN 0 (make-Symbol-Noun '|Here With Me|))) 0 0)
(test/dec-Loc-distance (make-Loc (make-After) (make-WhatDN 2 (make-The-Symbol '|Behind Blue Eyes|))) 1 1)
(test/dec-Loc-distance (make-Loc (make-Before) (make-WhatN (make-The-Symbol '|Thank You|))) 3 -2)
(test/dec-Loc-distance (make-Loc (make-After) (make-WhatN (make-Symbol-Noun '|Antechrist Superstar|))) -3 4)
; test/revert-cursor : cursor-index -> void
(test/revert-cursor 0)
(test/revert-cursor 1)
(test/revert-cursor 2)
(test/revert-cursor 3)
(test/revert-cursor 4)
(test/revert-cursor 5)
(test/revert-cursor 6)
(test/revert-cursor 7)
(test/revert-cursor 3749)
; eval-What/open : What/false -> symbol/false
(test (eval-What/open false) false)
(test (eval-What/open (make-WhatN (make-Symbol-Noun '|Disposable Teens|))) '|Disposable Teens|)
(test (eval-What/open (make-WhatDN 1 (make-Symbol-Noun '|The Dope Show|))) '|The Dope Show|)
; make-make-metric : World (pos pos -> metric) -> pos -> metric
(test ((make-make-metric empty-world (lambda (base last) `(BONG ,base ,last))) 'BANG) (list 'BONG 'BANG (index->syntax-pos 0)))
; make-metric-w/world : World (pos pos -> metric) -> metric
(test (make-metric-w/world empty-world (lambda (base last) `(BONG ,base ,last))) (list 'BONG (index->syntax-pos 0) (index->syntax-pos 0)))
; test/ast : index non-negative-integer string ast expected -> void
(test/ast 0 0 ""
(make-Verb (make-Command 'Open)
false
false)
1 6 "($expr$ ---)")
(test/ast 0 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))"
(make-Verb (make-Command 'Open)
false
false)
1 6 "($expr$ ---) (define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))")
(test/ast 0 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))"
(make-Verb (make-Command 'Open)
false
(make-WhatN (make-Symbol-Noun 'let)))
7 6 "(let ([$name$ $binding$] ***)\n $body$ +++) (define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))")
(test/ast 0 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))"
(make-Verb (make-Command 'Open)
false
(make-WhatN (make-The-Symbol 'let)))
0 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))")
(test/ast 0 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))"
(make-Verb (make-Command 'Open)
false
(make-WhatDN 1 (make-Symbol-Noun 'foo)))
5 6 "(foo $expr$ ---) (define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))")
(test/ast 0 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))"
(make-Verb (make-Command 'Open)
(make-Loc (make-After)
(make-WhatN (make-Symbol-Noun 'define)))
false)
32 6 "(define (foo x y z) (+ x y z)) ($expr$ ---) (define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))")
(test/ast 0 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))"
(make-Verb (make-Command 'Open)
(make-Loc (make-Before)
(make-WhatDN 3 (make-The-Symbol 'foo)))
(make-WhatN (make-Symbol-Noun 'id)))
73 6 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define ((id $expr$) foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))")
; test/asts : index non-negative-integer string (ast list) expected -> void
(test/asts 0 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))"
(list (make-Verb (make-Command 'Open)
false
(make-WhatDN 1 (make-Symbol-Noun 'foo)))
(make-Verb (make-Command 'Open)
false
(make-WhatN (make-Symbol-Noun 'let)))
(make-Verb (make-Command 'Open)
false
false))
13 6 "(foo (let ([($expr$ ---) $binding$]\n [$name$ $binding$] +++)\n $body$ +++) $expr$ ---) (define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))")
; test/ast : index non-negative-integer string ast expected -> void
(test/ast 0 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))"
(make-Verb (make-Command 'Open-Square)
false
false)
1 6 "[$expr$ ---] (define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))")
(test/ast 30 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))"
(make-Verb (make-Command 'Open-Square)
(make-Loc (make-Before)
(make-WhatDN 1 (make-The-Symbol '+)))
(make-WhatN (make-Symbol-Noun 'foobar)))
59 6 "(define (foo x y z) (+ x y z))(define (foo x y z) ([foobar $expr$ ---] + x y z))(define (foo x y z) (+ x y z))")
; test/ast : index non-negative-integer string ast expected -> void
(test/ast 0 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))"
(make-Verb (make-Symbol-Cmd 'foo)
false
false)
3 0 "foo (define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))")
(test/ast 0 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))"
(make-Verb (make-Symbol-Cmd 'foo)
(make-Loc (make-After) (make-WhatDN 2 (make-Symbol-Noun 'define)))
false)
64 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z)) foo (define (foo x y z) (+ x y z))")
; test/ast : index non-negative-integer string ast expected -> void
(test/ast 0 0 "(some things) (tree)"
(make-Verb (make-Command 'Close)
false
false)
0 0 "(some things) (tree)")
(test/ast 4 6 "(id $expr$)"
(make-Verb (make-Command 'Close)
false
false)
4 6 "(id $expr$)")
(test/ast 5 6 "(foo $expr$ ---)"
(make-Verb (make-Command 'Close)
false
false)
5 0 "(foo)")
(test/ast 7 6 "(cond [$test$ $expr$ ---] ---)"
(make-Verb (make-Command 'Close)
false
false)
6 0 "(cond)")
(test/ast 14 6 "(cond [$test$ $expr$ ---] ---)"
(make-Verb (make-Command 'Close)
false
false)
7 6 "(cond [$test$] ---)")
; test/asts : index non-negative-integer string (ast list) expected -> void
(test/asts 0 0 ""
(list (make-Verb (make-Symbol-Cmd 'define)
false
false)
(make-Verb (make-Symbol-Cmd 'fact)
false
false)
(make-Verb (make-Symbol-Cmd 'n)
false
false)
(make-Verb (make-Command 'Close)
false
false)
(make-Verb (make-Symbol-Cmd 'cond)
false
false)
(make-Verb (make-Command 'Open)
false
(make-WhatN (make-Symbol-Noun '=)))
(make-Verb (make-Symbol-Cmd 'n)
false
false)
(make-Verb (make-Symbol-Cmd '|0|)
false
false)
(make-Verb (make-Command 'Close)
false
false)
(make-Verb (make-Symbol-Cmd '|1|)
false
false)
(make-Verb (make-Command 'Close)
false
false)
(make-Verb (make-Command 'Close)
false
false)
(make-Verb (make-Command 'Open)
false
false)
(make-Verb (make-Symbol-Cmd '*)
false
false)
(make-Verb (make-Symbol-Cmd 'n)
false
false)
(make-Verb (make-Command 'Open)
false
(make-WhatN (make-Symbol-Noun 'fact)))
(make-Verb (make-Command 'Open)
false
(make-WhatN (make-Symbol-Noun '-)))
(make-Verb (make-Symbol-Cmd 'n)
false
false)
(make-Verb (make-Symbol-Cmd '|1|)
false
false)
(make-Verb (make-Command 'Close)
false
false)
(make-Verb (make-Command 'Close)
false
false)
(make-Verb (make-Command 'Close)
false
false)
(make-Verb (make-Command 'Close)
false
false)
(make-Verb (make-Command 'Close)
false
false)
(make-Verb (make-Command 'Open)
false
(make-WhatN (make-Symbol-Noun 'fact)))
(make-Verb (make-Symbol-Cmd '|10|)
false
false)
(make-Verb (make-Command 'Close)
false
false))
84 0 "(define (fact n)\n (cond\n [(= n 0) 1]\n [else (* n (fact (- n 1)))])) (fact 10)")
; test/ast : index non-negative-integer string ast expected -> void
(test/ast 0 0 "(define (foo x y z) (+ x y z))"
(make-Verb (make-Command 'Insert)
(make-Loc (make-Before)
(make-WhatN (make-Symbol-Noun 'define)))
false)
0 0 "(define (foo x y z) (+ x y z))")
(test/ast 0 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))"
(make-Verb (make-Command 'Insert)
(make-Loc (make-Before)
(make-WhatDN 2 (make-The-Symbol 'define)))
false)
31 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))")
(test/ast 0 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))"
(make-Verb (make-Command 'Insert)
(make-Loc (make-After)
(make-WhatDN 3 (make-The-Symbol 'y)))
false)
46 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))")
; test/asts : index non-negative-integer string (ast list) expected -> void
(test/asts 0 0 ""
(list (make-Verb (make-Command 'Open)
false
(make-WhatN (make-Symbol-Noun 'cond)))
(make-Verb (make-Command 'Insert)
(make-Loc (make-Before)
(make-WhatN (make-Symbol-Noun 'cond)))
false))
0 0 "(cond\n [$test$ $expr$ ---] +++\n [else $expr$ ---])")
; test/ast : index non-negative-integer string ast expected -> void
(test/ast 0 0 ""
(make-Verb (make-Command 'Select)
false
false)
0 0 "")
(test/ast 28 0 "(define (foo bar) (bar foo))(define (foo bar) (bar foo))(define (foo bar) (bar foo))"
(make-Verb (make-Command 'Select)
false
(make-WhatN (make-Symbol-Noun 'define)))
28 28 "(define (foo bar) (bar foo))(define (foo bar) (bar foo))(define (foo bar) (bar foo))")
(test/ast 56 0 "(define (foo bar) (bar foo))(define (foo bar) (bar foo))(define (foo bar) (bar foo))"
(make-Verb (make-Command 'Select)
false
(make-WhatN (make-Symbol-Noun 'define)))
56 28 "(define (foo bar) (bar foo))(define (foo bar) (bar foo))(define (foo bar) (bar foo))")
(test/ast 0 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))"
(make-Verb (make-Command 'Search-Forward)
false
(make-WhatDN 2 (make-Symbol-Noun '+)))
50 9 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))")
(test/ast 30 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))"
(make-Verb (make-Command 'Search-Forward)
false
(make-WhatDN 3 (make-Symbol-Noun 'define)))
90 30 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))")
(test/ast 30 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))"
(make-Verb (make-Command 'Search-Backward)
false
(make-WhatDN 3 (make-Symbol-Noun 'define)))
120 30 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))")
(test/ast 30 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))"
(make-Verb (make-Command 'Search-Backward)
(make-Loc (make-After)
(make-WhatDN 5 (make-The-Symbol 'foo)))
(make-WhatDN 3 (make-The-Symbol 'define)))
121 6 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))")
; test/ast : index non-negative-integer string ast expected -> void
(test/ast 0 0 ""
(make-Verb (make-Command 'Next)
false
false)
0 0 "")
(test/ast 32 43 "(define (foo bar) (+ (bar foo) 1 2 980 (* 4 3)))"
(make-Verb (make-Command 'Next)
false
false)
32 43 "(define (foo bar) (+ (bar foo) 1 2 980 (* 4 3)))")
(test/ast 0 0 ""
(make-Verb (make-Command 'Previous)
false
false)
0 0 "")
(test/ast 56 14 "(module test mzscheme (require (lib \"dummy.ss\")) (printf \"Be Happy!~n\"))"
(make-Verb (make-Command 'Previous)
false
false)
56 14 "(module test mzscheme (require (lib \"dummy.ss\")) (printf \"Be Happy!~n\"))")
; test/asts : index non-negative-integer string (ast list) expected -> void
(test/asts 30 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))"
(list
(make-Verb (make-Command 'Search-Backward)
(make-Loc (make-After)
(make-WhatDN 5 (make-The-Symbol 'foo)))
(make-WhatDN 3 (make-The-Symbol 'define))))
121 6 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))")
(test/asts 30 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))"
(list
(make-Verb (make-Command 'Search-Backward)
(make-Loc (make-After)
(make-WhatDN 5 (make-The-Symbol 'foo)))
(make-WhatDN 3 (make-The-Symbol 'define)))
(make-Verb (make-Command 'Next)
false
false))
91 6 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))")
(test/asts 80 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))"
(list
(make-Verb (make-Command 'Search-Backward)
(make-Loc (make-Before)
(make-WhatN (make-Symbol-Noun 'foo)))
(make-WhatN (make-The-Symbol 'z)))
(make-Verb (make-Command 'Previous)
false
false))
57 1 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))")
#;
(test/asts 80 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))"
(list
(make-Verb (make-Command 'Search-Backward)
(make-Loc (make-Before)
(make-Under-Cursor))
(make-Under-Cursor))
(make-Verb (make-Command 'Next)
false
false)
(make-Verb (make-Command 'Previous)
false
false))
80 9 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))")
#;
(test/asts 80 9 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))"
(list
(make-Verb (make-Command 'Search-Forward)
(make-Loc (make-Before)
(make-Under-Cursor))
(make-Under-Cursor))
(make-Verb (make-Command 'Next)
false
false)
(make-Verb (make-Command 'Previous)
false
false))
80 9 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))")
; test/ast : index non-negative-integer string ast expected -> void
(test/ast 0 0 ""
(make-Verb (make-Command 'Cancel)
false
false)
0 0 "")
(test/ast 47 87 "(lambda (x) x) (lambda (y) y)"
(make-Verb (make-Command 'Cancel)
false
false)
47 87 "(lambda (x) x) (lambda (y) y)")
; test/asts : index non-negative-integer string (ast list) expected -> void
(test/asts 0 0 ""
(list (make-Verb (make-Command 'Open)
false
false)
(make-Verb (make-Command 'Cancel)
false
false))
0 0 "")
(test/asts 0 0 ""
(list (make-Verb (make-Command 'Open)
false
(make-WhatN (make-Symbol-Noun 'id)))
(make-Verb (make-Command 'Cancel)
false
false))
0 0 "")
(test/asts 10 9 "(foo bar) (foo bar) (foo bar)"
(list (make-Verb (make-Command 'Open-Square)
(make-Loc (make-After)
(make-WhatDN 2 (make-Symbol-Noun 'foo)))
false)
(make-Verb (make-Command 'Cancel)
false
false))
10 9 "(foo bar) (foo bar) (foo bar)")
(test/asts 9 5 "(define (dummy x) (x x))"
(list (make-Verb (make-Command 'Open-Square)
(make-Loc (make-Before)
(make-WhatN (make-The-Symbol 'define)))
(make-WhatN (make-Symbol-Noun 'let)))
(make-Verb (make-Command 'Close)
false
false)
(make-Verb (make-Command 'Cancel)
false
false))
8 6 "([let ([$name$ $binding$] ***)\n $body$ +++] define (dummy x) (x x))")
(test/asts 6 3 "(fact $n$)"
(list (make-Verb (make-Symbol-Cmd '|100|)
false
false)
(make-Verb (make-Command 'Cancel)
false
false)
(make-Verb (make-Symbol-Cmd '|10|)
false
false))
9 0 "(fact 10)")
(test/asts 60 30 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))"
(list (make-Verb (make-Command 'Search-Forward)
false
(make-WhatN (make-Symbol-Noun '+)))
(make-Verb (make-Command 'Previous)
false
false)
(make-Verb (make-Command 'Previous)
false
false)
(make-Verb (make-Command 'Next)
false
false)
(make-Verb (make-Command 'Previous)
false
false)
(make-Verb (make-Command 'Next)
false
false)
(make-Verb (make-Command 'Next)
false
false)
(make-Verb (make-Command 'Cancel)
false
false))
60 30 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))")
(test/asts 0 0 ""
(list (make-Verb (make-Command 'Open)
false
false)
(make-Verb (make-Command 'Open)
false
false)
(make-Verb (make-Command 'Open)
false
false)
(make-Verb (make-Command 'Cancel)
false
false)
(make-Verb (make-Command 'Cancel)
false
false))
1 6 "($expr$ ---)")
; test/ast : index non-negative-integer string ast expected -> void
(test/ast 0 0 ""
(make-Verb (make-Command 'Undo)
false
false)
0 0 "")
(test/ast 42 67 "(Something some texts ...)"
(make-Verb (make-Command 'Undo)
false
false)
42 67 "(Something some texts ...)")
(test/ast 0 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))"
(make-Verb (make-Command 'Undo)
false
false)
0 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))")
(test/ast 0 0 ""
(make-Verb (make-Command 'Redo)
false
false)
0 0 "")
(test/ast 97 124 "(Other things ) ..."
(make-Verb (make-Command 'Redo)
false
false)
97 124 "(Other things ) ...")
(test/ast 0 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))"
(make-Verb (make-Command 'Redo)
false
false)
0 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))")
; test/asts : index non-negative-integer string (list ast) expected -> void
(test/asts 25 3 "(foo bar) (foo bar) (foo bar)"
(list (make-Verb (make-Command 'Search-Forward)
false
(make-WhatN (make-Symbol-Noun 'foo)))
(make-Verb (make-Command 'Undo)
false
false))
0 9 "(foo bar) (foo bar) (foo bar)")
(test/asts 25 3 "(foo bar) (foo bar) (foo bar)"
(list (make-Verb (make-Symbol-Cmd 'let)
false
false)
(make-Verb (make-Command 'Undo)
false
false))
25 3 "(foo bar) (foo bar) (foo bar)")
(test/asts 25 3 "(foo bar) (foo bar) (foo bar)"
(list (make-Verb (make-Symbol-Cmd 'let)
false
false)
(make-Verb (make-Command 'Redo)
false
false))
32 6 "(foo bar) (foo bar) (foo (let ([$name$ $binding$] ***)\n $body$ +++))")
(test/asts 25 3 "(foo bar) (foo bar) (foo bar)"
(list (make-Verb (make-Symbol-Cmd 'let)
false
false)
(make-Verb (make-Command 'Undo)
false
false)
(make-Verb (make-Command 'Redo)
false
false))
32 6 "(foo bar) (foo bar) (foo (let ([$name$ $binding$] ***)\n $body$ +++))")
(test/asts 0 0 ""
(list (make-Verb (make-Symbol-Cmd 'let)
false
false)
(make-Verb (make-Symbol-Cmd 'id)
false
false)
(make-Verb (make-Symbol-Cmd 'cond)
false
false)
(make-Verb (make-Command 'Undo)
false
false)
(make-Verb (make-Command 'Undo)
false
false)
(make-Verb (make-Command 'Redo)
false
false)
(make-Verb (make-Command 'Undo)
false
false)
(make-Verb (make-Command 'Undo)
false
false)
(make-Verb (make-Command 'Redo)
false
false)
(make-Verb (make-Command 'Redo)
false
false))
10 9 "(let ([id $binding$]\n [$name$ $binding$] +++)\n $body$ +++)")
; test/ast : index non-negative-integer string ast expected -> void
(test/ast 0 0 ""
(make-Verb (make-Command 'Out)
false
false)
0 0 "")
(test/ast 14 1 "(define (fact n) n)"
(make-Verb (make-Command 'Out)
false
false)
8 8 "(define (fact n) n)")
(test/ast 0 19 "(define (fact n) n)"
(make-Verb (make-Command 'Out)
false
false)
0 19 "(define (fact n) n)")
(test/ast 2 0 "( )"
(make-Verb (make-Command 'Out)
false
false)
0 4 "( )")
; test/asts : index non-negative-integer string (list ast) expected -> void
(test/asts 0 0 "(define (foo bar) (bar foo))"
(list (make-Verb (make-Command 'Search-Forward)
false
(make-WhatN (make-The-Symbol 'bar)))
(make-Verb (make-Command 'Out)
false
false))
8 9 "(define (foo bar) (bar foo))")
(test/asts 0 0 "(define (foo bar) (bar foo))"
(list (make-Verb (make-Command 'Search-Forward)
false
(make-WhatN (make-The-Symbol 'bar)))
(make-Verb (make-Command 'Out)
false
false)
(make-Verb (make-Command 'Cancel)
false
false))
13 3 "(define (foo bar) (bar foo))")
(test/asts 0 0 "(define (foo bar) (bar foo))"
(list (make-Verb (make-Command 'Search-Forward)
false
(make-WhatN (make-The-Symbol 'bar)))
(make-Verb (make-Command 'Out)
false
false)
(make-Verb (make-Command 'Undo)
false
false))
8 9 "(define (foo bar) (bar foo))")
(test/asts 0 0 ""
(list (make-Verb (make-Command 'Open)
false
false)
(make-Verb (make-Command 'Out)
false
false))
0 12 "($expr$ ---)")
(test/asts 0 0 ""
(list (make-Verb (make-Command 'Open)
false
false)
(make-Verb (make-Command 'Out)
false
false)
(make-Verb (make-Command 'Cancel)
false
false))
1 6 "($expr$ ---)")
(test/asts 0 0 ""
(list (make-Verb (make-Command 'Open)
false
false)
(make-Verb (make-Command 'Out)
false
false)
(make-Verb (make-Command 'Undo)
false
false))
0 0 "")
; test/ast : index non-negative-integer string ast expected -> void
(test/ast 0 0 ""
(make-Verb (make-Command 'In)
false
false)
0 0 "")
(test/ast 0 9 "(foo bar)"
(make-Verb (make-Command 'In)
false
false)
1 3 "(foo bar)")
(test/ast 0 0 "(foo bar)"
(make-Verb (make-Command 'In)
false
false)
1 3 "(foo bar)")
(test/ast 0 0 " (foo bar)"
(make-Verb (make-Command 'In)
false
false)
0 0 " (foo bar)")
; test/asts : index non-negative-integer string (ast list) expected -> void
(test/asts 0 0 "((foo bar) dummy)"
(list (make-Verb (make-Command 'In)
false
false)
(make-Verb (make-Command 'In)
false
false))
2 3 "((foo bar) dummy)")
(test/asts 0 0 "((foo bar) dummy)"
(list (make-Verb (make-Command 'In)
false
false)
(make-Verb (make-Command 'Cancel)
false
false))
0 0 "((foo bar) dummy)")
(test/asts 0 0 "((foo bar) dummy)"
(list (make-Verb (make-Command 'In)
false
false)
(make-Verb (make-Command 'Undo)
false
false))
1 9 "((foo bar) dummy)")
(test/asts 0 0 "((foo bar) dummy)"
(list (make-Verb (make-Command 'In)
false
false)
(make-Verb (make-Command 'Out)
false
false))
0 17 "((foo bar) dummy)")
; test/ast : index non-negative-integer string ast expected -> void
(test/ast 0 0 ""
(make-Verb (make-Command 'Forward)
false
false)
0 0 "")
(test/ast 0 0 ""
(make-Verb (make-Command 'Backward)
false
false)
0 0 "")
(test/ast 0 0 "foo bar"
(make-Verb (make-Command 'Forward)
false
false)
0 3 "foo bar")
(test/ast 0 0 "foo bar"
(make-Verb (make-Command 'Backward)
false
false)
0 0 "foo bar")
(test/ast 7 0 "foo bar"
(make-Verb (make-Command 'Forward)
false
false)
7 0 "foo bar")
(test/ast 7 0 "foo bar"
(make-Verb (make-Command 'Backward)
false
false)
4 3 "foo bar")
; test/asts : index non-negative-integer string (ast list) expected -> void
(test/asts 0 0 "foo bar"
(list (make-Verb (make-Command 'Forward)
false
false)
(make-Verb (make-Command 'Backward)
false
false))
0 3 "foo bar")
(test/asts 0 0 ""
(list (make-Verb (make-Symbol-Cmd 'let)
false
false)
(make-Verb (make-Command 'Forward)
false
false))
14 9 "(let ([$name$ $binding$] ***)\n $body$ +++)")
; test/ast : index non-negative-integer string ast expected -> void
(test/ast 0 0 ""
(make-Verb (make-Command 'Delete)
false
false)
0 0 "")
(test/ast 23 3 "(define (foo bar) (bar foo))"
(make-Verb (make-Command 'Delete)
false
false)
22 0 "(define (foo bar) (bar))")
(test/ast 0 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))"
(make-Verb (make-Command 'Delete)
false
false)
0 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))")
(test/ast 50 9 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))"
(make-Verb (make-Command 'Delete)
false
false)
49 0 "(define (foo x y z) (+ x y z))(define (foo x y z))(define (foo x y z) (+ x y z))")
; test/asts : index non-negative-integer string (ast list) expected -> void
(test/asts 0 0 ""
(list (make-Verb (make-Symbol-Cmd 'let)
false
false)
(make-Verb (make-Command 'Delete)
false
false))
7 0 "(let ([$binding$]\n [$name$ $binding$] +++)\n $body$ +++)")
; test/mark-ast : index non-negative-integer index non-negative-integer string ast expected -> void
(test/mark-ast 0 0 0 0 ""
(make-Verb (make-Command 'Bring)
false
false)
0 0 0 0 "")
(test/mark-ast 3 0 0 0 "(a c) b d"
(make-Verb (make-Command 'Bring)
false
false)
4 0 8 1 "(a b c) d")
(test/mark-ast 3 0 9 1 "(a c) b d"
(make-Verb (make-Command 'Bring)
false
false)
4 0 9 0 "(a d c) b")
(test/mark-ast 5 0 0 1 "b (a c)"
(make-Verb (make-Command 'Bring)
false
false)
4 0 0 7 "(a b c)")
(test/mark-ast 0 0 0 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))"
(make-Verb (make-Command 'Bring)
false
false)
0 0 0 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))")
(test/mark-ast 1 0 0 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))"
(make-Verb (make-Command 'Bring)
false
false)
32 0 61 30 "((define (foo x y z) (+ x y z)) define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))")
(test/mark-ast 0 0 8 11 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))"
(make-Verb (make-Command 'Bring)
false
false)
12 0 20 9 "(foo x y z) (define (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))")
; test/mark-asts : index non-negative-integer index non-negative-integer string (ast list) expected -> void
(test/mark-asts 3 0 0 0 "(a c) b d"
(list (make-Verb (make-Command 'Bring)
false
false)
(make-Verb (make-Command 'Bring)
false
false))
6 0 9 0 "(a b d c)")
(test/mark-asts 3 0 0 0 "(a c) b d"
(list (make-Verb (make-Command 'Bring)
false
false)
(make-Verb (make-Command 'Bring)
false
false)
(make-Verb (make-Command 'Cancel)
false
false))
4 0 8 1 "(a b c) d")
(test/mark-asts 24 3 0 0 "(function foo bar dummy $x$ $y$ $z$) a b c d e f"
(list (make-Verb (make-Command 'Bring)
false
false)
(make-Verb (make-Command 'Next)
false
false))
26 3 35 1 "(function foo bar dummy a $y$ $z$) b c d e f")
(test/mark-asts 24 3 0 0 "(function foo bar dummy $x$ $y$ $z$) a b c d e f"
(list (make-Verb (make-Command 'Bring)
false
false)
(make-Verb (make-Command 'Previous)
false
false))
26 3 35 1 "(function foo bar dummy a $y$ $z$) b c d e f")
; test/mark-ast : index non-negative-integer index non-negative-integer string ast expected -> void
(test/mark-ast 0 0 0 0 ""
(make-Verb (make-Command 'Push)
false
false)
0 0 0 0 "")
(test/mark-ast 0 0 3 0 "(a c) b d"
(make-Verb (make-Command 'Push)
false
false)
8 1 4 0 "(a b c) d")
(test/mark-ast 0 0 24 3 "(function foo bar dummy $x$ $y$ $z$) a b c d e f"
(make-Verb (make-Command 'Push)
false
false)
35 1 26 3 "(function foo bar dummy a $y$ $z$) b c d e f")
; test/mark-asts : index non-negative-integer index non-negative-integer string (ast list) expected -> void
(test/mark-asts 3 0 0 0 "(a c) b d"
(list (make-Verb (make-Command 'Bring)
false
false)
(make-Verb (make-Command 'Push)
false
false))
4 0 8 1 "(a b c) d")
; test/mark-ast : index non-negative-integer index non-negative-integer string ast expected -> void
(test/mark-ast 0 0 0 0 ""
(make-Verb (make-Command 'Exchange)
false
false)
0 0 0 0 "")
(test/mark-ast 432 435 1235 765 "(((foooooo baaaaaaar dummmmy) foooo (baaaar dummmmy foooo) baaar) ) dummmmy"
(make-Verb (make-Command 'Exchange)
false
false)
1235 765 432 435 "(((foooooo baaaaaaar dummmmy) foooo (baaaar dummmmy foooo) baaar) ) dummmmy")
; test/mark-asts : index non-negative-integer index non-negative-integer string (ast list) expected -> void
(test/mark-asts 432 435 1235 765 "(((foooooo baaaaaaar dummmmy) foooo (baaaar dummmmy foooo) baaar) ) dummmmy"
(list (make-Verb (make-Command 'Exchange)
false
false)
(make-Verb (make-Command 'Exchange)
false
false))
432 435 1235 765 "(((foooooo baaaaaaar dummmmy) foooo (baaaar dummmmy foooo) baaar) ) dummmmy")
; test/mark-ast : index non-negative-integer index non-negative-integer string ast expected -> void
(test/mark-ast 0 0 0 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))"
(make-Verb (make-Command 'Mark)
false
false)
0 0 0 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))")
(test/mark-ast 30 6 60 30 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))"
(make-Verb (make-Command 'Mark)
false
false)
30 0 30 6 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))")
(test/mark-ast 13 1 0 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))"
(make-Verb (make-Command 'Mark)
false
false)
13 0 13 1 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))")
(test/mark-ast 30 6 60 30 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))"
(make-Verb (make-Command 'Mark)
(make-Loc (make-After)
(make-WhatN (make-Symbol-Noun 'define)))
false)
30 0 30 6 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))")
(test/mark-ast 30 6 60 30 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))"
(make-Verb (make-Command 'Mark)
(make-Loc (make-After)
(make-WhatN (make-Symbol-Noun 'define)))
(make-WhatDN 2 (make-Symbol-Noun 'foo)))
30 6 8 11 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))")
#;
(test/mark-ast 1 0 0 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))"
(make-Verb (make-Command 'Mark)
(make-Loc (make-Before) (make-Under-Cursor))
false)
1 0 1 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))")
#;
(test/mark-ast 8 0 0 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))"
(make-Verb (make-Command 'Mark)
false
(make-Under-Cursor))
8 0 8 11 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))")
(test/mark-ast 33 0 0 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))"
(make-Verb (make-Command 'Mark)
(make-Loc (make-After) (make-WhatDN 3 (make-The-Symbol 'z)))
(make-WhatN (make-Symbol-Noun 'foo)))
33 0 8 11 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))")
; test/mark-asts : index non-negative-integer index non-negative-integer string (ast list) expected -> void
(test/mark-asts 0 0 0 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))"
(list
(make-Verb (make-Command 'Mark)
false
(make-WhatN (make-The-Symbol 'define)))
(make-Verb (make-Command 'Next)
false
false))
0 0 31 6 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))")
(test/mark-asts 0 0 0 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))"
(list
(make-Verb (make-Command 'Mark)
false
(make-WhatN (make-Symbol-Noun '+)))
(make-Verb (make-Command 'Next)
false
false)
(make-Verb (make-Command 'Previous)
false
false)
(make-Verb (make-Command 'UnMark)
false
false))
0 0 20 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))")
; test/clip-ast : index non-negative-integer string string ast expected -> void
(test/clip-ast 0 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))" ""
(make-Verb (make-Command 'Copy)
false
false)
0 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))" "")
(test/clip-ast 8 11 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))" ""
(make-Verb (make-Command 'Copy)
false
false)
8 11 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))" "(foo x y z)")
(test/clip-ast 0 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))" ""
(make-Verb (make-Command 'Cut)
false
false)
0 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))" "")
(test/clip-ast 20 9 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))" ""
(make-Verb (make-Command 'Cut)
false
false)
19 0 "(define (foo x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))" "(+ x y z)")
(test/clip-ast 0 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))" ""
(make-Verb (make-Command 'Paste)
false
false)
0 0 "(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))(define (foo x y z) (+ x y z))" "")
; test/mark-ast : index non-negative-integer index non-negative-integer string ast expected -> void
(test/mark-ast 0 0 0 0 ""
(make-Verb (make-Command 'Enter)
false
false)
1 0 1 0 "\n")
(test/mark-ast 18 6 0 0 "(define (foo bar) $body$ ---)"
(make-Verb (make-Command 'Enter)
false
false)
20 6 0 0 "(define (foo bar)\n $body$ ---)")
; test/mark-ast : index non-negative-integer index non-negative-integer string ast expected -> void
(test/mark-ast 0 0 0 0 ""
(make-Verb (make-Command 'Join)
false
false)
0 0 0 0 "")
(test/mark-ast 0 0 0 0 "\n"
(make-Verb (make-Command 'Join)
false
false)
0 0 0 0 "")
(test/mark-ast 1 9 0 0 "((foo bar)\n (bar foo))"
(make-Verb (make-Command 'Join)
false
false)
1 9 0 0 "((foo bar) (bar foo))")
; test/ast : index non-negative-integer string ast expected -> void
(test/ast 0 0 ""
(make-Verb (make-Command 'Transpose)
false
false)
0 0 "")
(test/ast 0 7 "(first) (last)"
(make-Verb (make-Command 'Transpose)
false
false)
0 7 "(first) (last)")
(test/ast 8 6 "(first) (last)"
(make-Verb (make-Command 'Transpose)
false
false)
14 0 "(last) (first)")
(test/ast 7 0 "(first) (last)"
(make-Verb (make-Command 'Transpose)
false
false)
14 0 "(last) (first)")
(test/ast 14 0 "(last) (first)"
(make-Verb (make-Command 'Transpose)
false
false)
14 0 "(last) (first)")
; test/asts : index non-negative-integer string (ast list) expected -> void
(test/asts 0 0 ""
(list (make-Verb (make-Command 'Magic)
false
false))
0 0 "")
(test/asts 0 0 ""
(list (make-Verb (make-Symbol-Cmd 'd)
false
false)
(make-Verb (make-Command 'Magic)
false
false))
1 0 "d")
(test/asts 28 0 "(define (foo bar) (bar foo))"
(list (make-Verb (make-Symbol-Cmd 'd)
false
false)
(make-Verb (make-Command 'Magic)
false
false))
38 6 "(define (foo bar) (bar foo)) (define ($name$ $arg$ ---)\n $body$ +++)")
; test/ast : index non-negative-integer string ast expected -> void
; test/asts : index non-negative-integer string (ast list) expected -> void
; test/ast : index non-negative-integer string ast expected -> void
; test/asts : index non-negative-integer string (ast list) expected -> void
; test/ast : index non-negative-integer string ast expected -> void
; test/asts : index non-negative-integer string (ast list) expected -> void
; test/ast : index non-negative-integer string ast expected -> void
; test/asts : index non-negative-integer string (ast list) expected -> void
(test/asts 0 0 "";(file->string "/Users/romain/engine.ss")
(list (make-Verb (make-Command 'Cancel)
false
false))
0 0 "")
)
(parameterize ([current-templates (lambda () mzscheme-templates)])
(tests))
)
| false |
0f399c2d71d2586a9f91970b2d5a3505961c2368 | 1dcae2ac82bd47eac29d8f938ec51c9b724bede0 | /examples/define.scm | 0859cc71def1706079ce1a3068c700dc2c2850da | [
"BSD-3-Clause"
]
| permissive | stjordanis/bsdscheme | 9730afab326c818daaea4ad96886ca0826320297 | ffdc0ab5e8a2cadabcc1ca394ae06072972b75de | refs/heads/master | 2021-09-21T23:30:57.615938 | 2018-09-03T02:48:41 | 2018-09-03T02:48:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 55 | scm | define.scm | (define (a b c) (- b c))
(display (a 2 1))
(newline)
| false |
d6b19041e7ceae5698bea03ae9adb5e896d29095 | 4f30ba37cfe5ec9f5defe52a29e879cf92f183ee | /src/sasm/parse/util.scm | a891bd53e4250173ee8412e8c5abada5a4fe85ed | [
"MIT"
]
| permissive | rtrusso/scp | e31ecae62adb372b0886909c8108d109407bcd62 | d647639ecb8e5a87c0a31a7c9d4b6a26208fbc53 | refs/heads/master | 2021-07-20T00:46:52.889648 | 2021-06-14T00:31:07 | 2021-06-14T00:31:07 | 167,993,024 | 8 | 1 | MIT | 2021-06-14T00:31:07 | 2019-01-28T16:17:18 | Scheme | UTF-8 | Scheme | false | false | 532 | scm | util.scm | (need sasm/sasm-tracing)
(define (sasm-parse-by-case expression . cases)
(define (iter cases)
(debug sasm-parse-by-case-iter cases)
(if (null? cases)
#f
(let* ((current (begin (debug sasm-parse-by-case-current-case (car cases))
(car cases)))
(result ((car cases) expression)))
(debug sasm-parse-by-case-result result)
(or result
(iter (cdr cases))))))
(debug sasm-parse-by-case expression)
(iter cases))
| false |
ad6a72764948fdaf6d5fcb613b3caf957a9f9c93 | 3323fb4391e76b853464a9b2fa478cd7429e9592 | /exercise-2.5.ss | ceba94609d5171a99102d63ad56b564c2fc2eda9 | []
| no_license | simpleliangsl/hello-scheme | ceb203933fb056523f5288ce716569096a71ad97 | 31434fb810475ee0e8ec2e6816995a0041c47f44 | refs/heads/master | 2023-06-16T12:07:28.744188 | 2021-07-15T06:39:32 | 2021-07-15T06:39:32 | 386,197,304 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 447 | ss | exercise-2.5.ss | (define (cons a b)
(* (exp 2 a) (exp 3 b))
)
(define (exp a b)
(define (iter result k)
(if (> k b)
result
(iter (* result a) (+ k 1))
)
)
(iter 1 1)
)
(define (number-of-a c a)
(define (iter c k)
(if (= (remainder c a) 0)
(iter (/ c a) (+ k 1))
k
)
)
(iter c 0)
)
(define (car c) (number-of-a c 2))
(define (cdr c) (number-of-a c 3)) | false |
47ac6a186447f823202d17ad779d9acc0f8286cb | 435ca18a711b537aead4a73807b206ff99f57785 | /tests/assignment_1.scm | dc1ec6855432650f68a21737fc58a81ae09a8783 | []
| no_license | mushrom/schemecc | 59c961dc8ae85a4ea8089e62d6a1e1272fe487a9 | cb3c7a48a9feaf134b297dcb9ae181909f4e1451 | refs/heads/master | 2021-01-01T05:17:44.911566 | 2016-05-18T02:58:16 | 2016-05-18T02:58:16 | 57,012,633 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 173 | scm | assignment_1.scm | (import (scheme base))
(let ((f (lambda (c)
(cons (lambda (v) (set! c v))
(lambda () c)))))
(let ((p (f 0)))
((car p) 12)
((cdr p))))
| false |
5cbfd09c7d4c41faef1cc2b6de5f92a8821212c7 | e1fc47ba76cfc1881a5d096dc3d59ffe10d07be6 | /ch2/2.58a.scm | 032c4f86f7309c301ac280c3a8c43343e14a4f02 | []
| no_license | lythesia/sicp-sol | e30918e1ebd799e479bae7e2a9bd4b4ed32ac075 | 169394cf3c3996d1865242a2a2773682f6f00a14 | refs/heads/master | 2021-01-18T14:31:34.469130 | 2019-10-08T03:34:36 | 2019-10-08T03:34:36 | 27,224,763 | 2 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 579 | scm | 2.58a.scm | (load "2.3.2.scm")
; (a)
(define (make-sum x y)
(cond
((=number? x 0) y)
((=number? y 0) x)
((and (number? x) (number? y)) (+ x y))
(else (list x '+ y))
)
)
(define (sum? s) (and (pair? s) (eq? (cadr s) '+))) ; sum-form iff start with +
(define (addend s) (car s))
(define (make-product x y)
(cond
((=number? x 0) 0)
((=number? y 0) 0)
((=number? x 1) y)
((=number? y 1) x)
((and (number? x) (number? y)) (* x y))
(else (list x '* y))
)
)
(define (product? p) (and (pair? p) (eq? (cadr p) '*)))
(define (multiplier p) (car p))
| false |
f348d66da10ee067659954fd2f76247b67db58e0 | e1fc47ba76cfc1881a5d096dc3d59ffe10d07be6 | /ch4/4.18.scm | 95fac42e19abde0d1c19e5f095e48d7268e8f17b | []
| no_license | lythesia/sicp-sol | e30918e1ebd799e479bae7e2a9bd4b4ed32ac075 | 169394cf3c3996d1865242a2a2773682f6f00a14 | refs/heads/master | 2021-01-18T14:31:34.469130 | 2019-10-08T03:34:36 | 2019-10-08T03:34:36 | 27,224,763 | 2 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 1,026 | scm | 4.18.scm | (define (solve f y0 dt)
(let ((y '*unassigned*) (dy '*unassigned*))
(let ((a (integral (delay dy) y0 dt))
(b (stream-map f y)))
(set! y a)
(set! dy b)
)
y
)
)
;; convert let -> lambda
(define (solve f y0 dt)
(let ((y '*unassigned*) (dy '*unassigned*))
((lambda (a b) ; 1. define lambda
(set! y a)
(set! dy b)
)
(integral (delay dy) y0 dt) ; 2. invoke lambda
(stream-map f y)
)
y
)
)
;; 根据具体实现不同, 实际参数 eval 的顺序也不同, 从左到右的话就会先 eval a, 即计算 (integral (delay dy) y0 dt),
;; 而此时 dy 是未赋值的, 但由于 delay 的作用, 此时 dy 的未赋值状态是被无视的, 接着 eval b, 此时 y 是未赋值并且被
;; 立即使用了(delay 并没有真正"使用"), 所以报错.
;; 而从右往左的话则是先 eval b, 并报错.
;;
;; 为何正文的版本 work?
;; 解释过程同上.
;; 可以参考这个解释: [4.18](http://d.hatena.ne.jp/tmurata/20100325/1269520114)
| false |
45863fab4b7c5baf98955358c7638f2bfc98efea | e82d67e647096e56cb6bf1daef08552429284737 | /ex3-21.scm | b640d5c039d263571def3153894a420f23b699bd | []
| no_license | ashishmax31/sicp-exercises | 97dfe101dd5c91208763dcc4eaac2c17977d1dc1 | 097f76a5637ccb1fba055839d389541a1a103e0f | refs/heads/master | 2020-03-28T11:16:28.197294 | 2019-06-30T20:25:18 | 2019-06-30T20:25:18 | 148,195,859 | 6 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 1,567 | scm | ex3-21.scm | ; constructors
(define (make-queue) (cons '() '()))
; Internal selectors
(define (front-ptr queue) (car queue))
(define (rear-ptr queue) (cdr queue))
(define (empty-queue? queue) (null? (front-ptr queue)))
; Internal mutators
(define (set-front-ptr! queue item) (set-car! queue item))
(define (set-rear-ptr! queue item) (set-cdr! queue item))
; External procedures
(define (make-queue) (cons '() '()))
(define (front-queue queue)
(if (empty-queue? queue)
(error "Front queue procedure called for an empty queue!")
(car (front-ptr queue))))
(define (insert-queue! queue item)
(let ((new-item (cons item '())))
(cond ((empty-queue? queue)
(set-front-ptr! queue new-item)
(set-rear-ptr! queue new-item)
queue)
(else
(set-cdr! (rear-ptr queue) new-item)
(set-rear-ptr! queue new-item)
queue))))
(define (delete-queue! queue)
(if (empty-queue? queue)
(error "Delete queue called on an empty queue!")
(let ((next-item-after-the-first (cdr (front-ptr queue))))
(set-front-ptr! queue next-item-after-the-first))))
(define (print-queue queue)
(define (print-queue-helper queue)
(if (null? queue)
(newline)
(begin
(display (car queue))
(print-queue-helper (cdr queue)))))
(if (empty-queue? queue)
(error "Delete queue called on an empty queue!")
(print-queue-helper (front-ptr queue)))) | false |
a1e47ae259e0a15459087d3a60c5aa53fee94f0e | 6488db22a3d849f94d56797297b2469a61ad22bf | /bind/chicken-bind.scm | 1581efb7f87d2e7114dfd4e985bf8b585f30212c | []
| no_license | bazurbat/chicken-eggs | 34d8707cecbbd4975a84ed9a0d7addb6e48899da | 8e741148d6e0cd67a969513ce2a7fe23241df648 | refs/heads/master | 2020-05-18T05:06:02.090313 | 2015-11-18T16:07:12 | 2015-11-18T16:07:12 | 22,037,751 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 3,405 | scm | chicken-bind.scm | ;;;; chicken-bind.scm - Standalone wrapper generator
(define ##compiler#debugging-chicken '())
(require-extension srfi-1 utils bind-translator extras regex)
(define (usage #!optional (status 0))
(print #<<EOF
usage: chicken-bind [OPTION | FILENAME ...]
-help show this message
-o FILENAME where to write generated code to ("-" means stdout)
-debug generate additional debug output
-export-constants add toplevel definitions for constants
-class-finalizers use finalizers for class instances
-mutable-fields instance fields are mutable
-rename FROM:TO define renaming rule
-rename-regex FROM:TO define renaming rule for matching regular expression
-prefix PREFIX prefix to be used for names
-full-specialization specialize methods on all arguments
-default-renaming PREFIX use default renaming rules
-follow-include recursively process #include'd files
-parse just emit parsed "chunks" of tokens
Reads C/C++ files and generates Scheme wrapper code.
Specifying "-" as filename reads from stdin.
EOF
) (exit status) )
(define (main args)
(let ((files '())
(chunkify-only #f)
(output #f))
(let loop ((args args))
(unless (null? args)
(let ((arg (car args))
(rest (cdr args)))
(cond ((string=? "-debug" arg)
(set! ##compiler#debugging-chicken '(C X))
(loop rest))
((string=? "-export-constants" arg)
(set-bind-options export-constants: #t)
(loop rest))
((string=? "-mutable-fields" arg)
(set-bind-options mutable-fields: #t)
(loop rest))
((string=? "-full-specialization" arg)
(set-bind-options full-specialization: #t)
(loop rest))
((string=? "-follow-include" arg)
(set-bind-options follow-include: #t)
(loop rest))
((string=? "-default-renaming" arg)
(unless (pair? rest) (usage 1))
(set-bind-options default-renaming: (car rest))
(loop (cdr rest)))
((string=? "-prefix" arg)
(unless (pair? rest) (usage 1))
(set-bind-options prefix: (car rest))
(loop (cdr rest)))
((or (string=? "-rename-regex" arg) (string=? "-rename" arg))
(unless (pair? rest) (usage 1))
(let ((m (string-match "([^:]+):(.+)" (cadr args))))
(if m
(set-renaming (cadr m) (caddr m) regex: (string=? "-rename-regex" arg))
(usage 1))))
((string=? "-o" arg)
(when (null? rest) (usage 1))
(set! output (car rest))
(loop (cdr rest)))
((string=? "-parse" arg)
(set! chunkify-only #t)
(loop rest))
((member arg '("--help" "-help" "-h"))
(usage 0) )
((and (> (string-length arg) 1)
(char=? #\- (string-ref arg 0)) )
(usage 1) )
(else
(set! files (cons arg files))
(loop rest))))))
(when (null? files) (usage 1))
(when (and output (not (string=? "-" output)))
(set! output (open-output-file output)))
(for-each
(lambda (f)
(define (process)
(print "\n;;; GENERATED BY CHICKEN-BIND FROM " f #\newline)
(pp `(begin
,@(parse-easy-ffi
(read-all
(if (string=? f "-")
(current-input-port)
f) )
identity
chunkify-only
f)))
(print "\n;;; END OF FILE"))
(cond ((equal? "-" output) (process))
((port? output)
(with-output-to-port output process))
(else
(with-output-to-file (pathname-replace-extension f "scm")
process) ) ))
(reverse files) ) ) )
(main (command-line-arguments))
| false |
0cdc79a0f86c001676b66289a360c7582603d453 | 98867a6625fc664d0dafa0668dc8f1d507a071e2 | /scheme/tpodder/tpod.scm | 833d62c0adbd922c33ada9e46cb20b6ffa8d4948 | [
"ISC"
]
| permissive | tekktonic/programming | 4b81efc115108bfdfc4a70a0d3b9157c1b91c8c0 | 139959ab9934912d4c531e5ee8b1f39094a6823c | refs/heads/master | 2021-05-11T03:24:47.507478 | 2018-01-18T01:16:38 | 2018-01-18T01:16:38 | 80,262,894 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 350 | scm | tpod.scm | (require-extension lowdown) ; markdown->html
(require-extension posix) ; changing directories mainly
(require-extension irregex) ; regex support yeah!
(define config (open-input-file
(change-directory blogs)
(define files (reverse (sort (glob "*.blog") string<=?)))
(write-string
(irregex-replace "\\${body}" template all-posts)
#f
index)
| false |
ed30e1099bd97f444643912c8259ca0dd14fac6e | ffee55543efba56a659d78cb89f417f4e44ae63f | /led/undo.scm | 2830c0b8521066020b3cb8318c84da0681083b22 | [
"MIT"
]
| permissive | pfmaggi/led | 11f4f71f11e36157434b1983a7fbfd4f304c4ef0 | 16f94efb7ac64dce3d22efdea978afd311479ae4 | refs/heads/master | 2020-11-30T12:31:08.851678 | 2017-05-09T16:53:51 | 2018-04-08T19:12:32 | 67,937,950 | 0 | 0 | null | 2016-09-11T15:33:39 | 2016-09-11T15:33:38 | null | UTF-8 | Scheme | false | false | 2,003 | scm | undo.scm | (define-library (led undo)
(export
initial-undo
empty-undo
push-undo
pop-undo
mark-saved
dirty-buffer?
unpop-undo)
(import
(owl base)
(led buffer)
(led log))
(begin
(define empty-undo
(cons null null))
(define (initial-undo buff)
(let ((type (get-buffer-meta buff 'type 'file)))
(if (eq? type 'file)
(cons (list (cons (time-ms) buff)) null) ;; initially saved
(cons (list buff) null))))
;; undo node = buffer | (save-timestamp . buffer)
;; fixme - should have current at head of undo for dirtiness, or keep track otherwise
(define (push-undo undo buff)
(log "pushing new version")
(lets ((prev new undo))
;; no way to return to future after changing the past
(cons (cons buff prev) null)))
(define (unsaved x)
(if (pair? x) (cdr x) x))
(define (mark-saved undo buff when)
(lets ((prev new undo))
(if (eq? prev buff)
(mark-saved undo (cons prev new) when)
(cons
(cons (cons when buff) (map unsaved prev))
null))))
(define (dirty-buffer? buff undo)
(let ((u (car undo)))
(cond
((null? u) #true)
((pair? (car u)) #false)
(else #true))))
(define (pop-undo undo buff)
(lets ((prev new undo))
(if (null? prev)
(values undo buff)
(values
(cons (cdr prev) (cons buff new))
(unsaved (car prev))))))
(define (unpop-undo undo buff)
(log "unpopping undo")
(lets ((prev new undo))
(if (null? new)
(values undo buff)
(values (cons (cons buff prev) (cdr new))
(unsaved (car new))))))))
| false |
218703fe78869ec03c2830d18f5e2b1ab2522a4e | 9686fd1d8c004ec241c14bbbfd8e4dfc06452a9c | /modules/stay-alive/util.scm | b70202b04f18720e2dde4a76efcff63654bf1637 | []
| no_license | mwitmer/StayAlive | edd5e5cb55cc698d033eafca1df7bbd379410d80 | 137b15ac06414adaeca0ff01750a779c89d871e0 | refs/heads/master | 2021-01-23T03:54:04.289089 | 2012-11-09T17:22:02 | 2012-11-09T17:22:02 | 5,642,903 | 7 | 1 | null | null | null | null | UTF-8 | Scheme | false | false | 5,372 | scm | util.scm | (define-module (stay-alive util)
#:use-module (srfi srfi-1)
#:export (for-each-index
make-new-location
all-directions
within-dimensions?
inside-dimensions?
locations-adjacent?
list-ref-random
random-match
percent
all-directions
pred-and
pred-not
pred-ident
pred-proc-eq
pred-eq
proc-begin
all-letters
insert-ordered
line-for-each
search-string
fold-each-index
bitvector-foreach-row-major
increase-odds
decrease-odds
e
percent
location-values
inverse-row-major
row-major))
(define e 2.71828182845894523536)
(define (percent n)
(/ n 100))
(define (increase-odds odds multiplier)
(- 1 (* (- 1 odds) (- 1 multiplier))))
(define (decrease-odds odds multiplier)
(* odds multiplier))
(define (inverse-row-major n cols)
(list (quotient n cols) (remainder n cols)))
(define (bitvector-foreach-row-major proc bv cols)
(for-each (lambda (n)
(if (bitvector-ref bv n)
(apply proc (inverse-row-major n cols))))
(iota (bitvector-length bv))))
(define all-directions '(up down left right up-right up-left down-right down-left))
(define (search-string str test-proc apply-proc fail-proc)
(let search-recur ((idx 0))
(if (test-proc str idx)
(apply-proc str idx)
(if (< idx (- (string-length str) 1))
(search-recur (+ idx 1))
(fail-proc str)))))
(define all-letters
(map! (lambda (ch) (if (char-upper-case? ch) (char-downcase ch) (char-upcase ch)))
(char-set->list (char-set-intersection char-set:letter char-set:ascii))))
(define (random-match proc lst)
(if (null? lst) #f
(let* ((el (list-ref-random lst))
(res (proc el)))
(if res res (random-match (delete el lst) proc)))))
(define (list-ref-random l) (list-ref l (random (length l))))
(define (pred-ident pred) (lambda (el) pred))
(define (pred-and pred1 pred2) (lambda (el) (and (pred1 el) (pred2 el))))
(define (pred-not pred1) (lambda (el) (not (pred1 el))))
(define (pred-eq obj) (lambda (el) (eq? el obj)))
(define (pred-proc-eq obj proc) (lambda (el) (eq? (proc el) obj)))
(define proc-begin (lambda args
(lambda (obj)
(for-each (lambda (arg) (arg obj)) args))))
(define (locations-adjacent? loc1 loc2)
(and (<= (abs (- (car loc1) (car loc2))) 1)
(<= (abs (- (cadr loc1) (cadr loc2))) 1)))
(define (for-each-index rows cols proc)
(do ((row 0 (1+ row)))
((= row rows))
(do ((col 0 (1+ col)))
((= col cols))
(proc row col))))
(define (row-major row col cols)
(+ (* row cols) col))
(define inside-dimensions?
(lambda (location squares)
(let ((dimensions (array-dimensions squares))
(row (car location))
(col (cadr location)))
(and (> row 0) (> col 0) (< col (- (cadr dimensions) 1)) (< row (- (car dimensions) 1))))))
(define within-dimensions?
(lambda (location squares)
(let ((dimensions (array-dimensions squares))
(row (car location))
(col (cadr location)))
(and (>= row 0) (>= col 0) (< col (cadr dimensions)) (< row (car dimensions))))))
(define make-new-location
(lambda (location direction)
(let ((row (car location))
(col (cadr location)))
(case direction
((up) (list (- row 1) col))
((down) (list (+ row 1) col))
((left) (list row (- col 1)))
((right) (list row (+ col 1)))
((none) (list row col))
((up-left) (list (- row 1) (- col 1)))
((up-right) (list (- row 1) (+ col 1)))
((down-left) (list (+ row 1) (- col 1)))
((down-right) (list (+ row 1) (+ col 1)))))))
(define (insert-ordered val compare lst)
(let insert-ordered-recur ((val val) (compare compare) (lst lst) (accum '()))
(if (null? lst) (append accum (list val))
(if (compare val (car lst))
(append accum (cons val lst))
(insert-ordered-recur val compare (cdr lst) (append accum (list (car lst))))))))
(define (fold-each-index rows cols proc start)
(do ((row 0 (1+ row))
(final start (do ((col 0 (1+ col))
(final-col final (proc row col final-col)))
((= col cols) final-col))))
((= row rows) final)))
(define (line-for-each origin target proc)
(letrec* ((dx (abs (- (cadr target) (cadr origin))))
(dy (abs (- (car target) (car origin))))
(sx (if (< (cadr origin) (cadr target)) 1 -1))
(sy (if (< (car origin) (car target)) 1 -1))
(start-err (- dx dy))
(plot (lambda (current previous err first? distance)
(if (or first? (not (proc current previous distance)))
(let* ((e2 (* 2 err))
(e2gndy (> e2 (- dy)))
(e2ldx (< e2 dx)))
(plot (list
(if e2ldx (+ (car current) sy) (car current))
(if e2gndy (+ (cadr current) sx) (cadr current)))
current
(+ err (if e2gndy (- dy) 0) (if e2ldx dx 0))
#f
(+ 1 distance)))))))
(plot origin #f start-err #t 0)))
(define (location-values location)
(values (car location) (cadr location)))
| false |
fd1ebdf15e38ab0034bbacc9fbcb97bec691941a | 4fd95c081ccef6afc8845c94fedbe19699b115b6 | /chapter_2/2.12.scm | cefe617cd352b509447a45fe0bc51614aa09e4bb | [
"MIT"
]
| permissive | ceoro9/sicp | 61ff130e655e705bafb39b4d336057bd3996195d | 7c0000f4ec4adc713f399dc12a0596c770bd2783 | refs/heads/master | 2020-05-03T09:41:04.531521 | 2019-08-08T12:14:35 | 2019-08-08T12:14:35 | 178,560,765 | 1 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 979 | scm | 2.12.scm | (define (make-interval x y) (cons x y))
(define (lower-bound x) (min (car x) (cdr x)))
(define (upper-bound x) (max (cdr x) (cdr x)))
(define (mul-interval x y)
(let ((p1 (* (lower-bound x) (lower-bound y)))
(p2 (* (lower-bound x) (upper-bound y)))
(p3 (* (upper-bound x) (lower-bound y)))
(p4 (* (upper-bound x) (upper-bound y))))
(make-interval (min p1 p2 p3 p4)
(max p1 p2 p3 p4))))
(define (make-center-width c w)
(make-interval (- c w) (+ c w)))
(define (center i)
(/ (+ (lower-bound i) (upper-bound i)) 2.0))
(define (width i)
(/ (- (upper-bound i) (lower-bound i)) 2.0))
(define (make-center-percent center inflecity)
(define lower (- center (* center inflecity)))
(define upper (- (* 2 center) lower))
(make-interval lower upper))
(define (percent x)
(/ (width x) (center x)))
(display (make-center-percent 5 0.1))
(newline)
(display (percent (make-interval 4.5 5.5)))
| false |
387ae0c648cc2edf0c716e7454a00a838ee7f950 | d9426bff964eead8fb4c45a016cac45799ecb404 | /src/assets/addressBook.ss | 986c85debb6c5d5bc985dabe1138097d7452e50a | []
| no_license | Glow-Lang/gloui | f4093a2fc94e94f1576957cd42e4595b88977928 | bac31fab2ff8394cf8d5e727df49baf2bb3b66a1 | refs/heads/main | 2023-07-27T19:42:13.164645 | 2021-09-09T23:21:16 | 2021-09-09T23:21:16 | 404,895,672 | 3 | 0 | null | 2021-09-09T23:21:16 | 2021-09-09T23:17:37 | JavaScript | UTF-8 | Scheme | false | false | 2,901 | ss | addressBook.ss | (import :js)
;; (js#declaration "console.log('Loaded Address Book')")
(def (random-hash) (js#expression "'Ox' + Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);"))
(def (get-FROM-address-book pkey)
[
{ name: "Alice Eat Me"
hash: (random-hash)
tags: ["foo" "bar" "rps"]
private-key: "THISISPRIVATE" }
{ name: "Alice Drink Me"
hash: (random-hash)
tags: ["baz" "rps" "moonshine"]
private-key: "THISISPRIVATE" }
{ name: "Bob"
hash: (random-hash)
tags: ["foo" "rps"] }
{ name: "Charlie Noble"
hash: (random-hash)
tags: ["bar"] }
]
)
(def (get-TO-address-book)
[
{ name: "Xavier "
hash: (random-hash)
tags: ["foo" "bar" "rps"] }
{ name: "Wyclef Jean"
hash: (random-hash)
tags: ["baz" "moonshine"] }
{ name: "Jimi Hendrix"
hash: (random-hash)
tags: ["foo" "rps"]}
{ name: "Yvonne Brown"
hash: (random-hash)
tags: ["bar" "foo" "baz"] }
]
)
(def (filter-book-using-tags book tags)
(js#expression #<<EOF
((book, tags) => {
function hasTag(address, tag) {
// console.log('Has tag?', address, tag)
return address.tags.find(t => t === tag) }
// console.log('b', book, 't', tags)
function hasAllTags(add) {
let address = add instanceof RTS.Foreign ? RTS.scm2host(add) : add;
for (const tag of tags) {
if (!hasTag(address, tag)) { return false };
}
return true;
}
return book.filter(address => hasAllTags(address))
})((@1@), RTS.scm2host(@2@));
EOF
book tags
))
(def (fees-and-totals amount unit blockchain)
{fee: 0.42 total: (* amount 3.14) })
(def (add-labels book)
(js#statement "((ab) => {
return ab.map(a => {
if (a.label === undefined) {
a.label = a.name + ' ' + a.hash
}
return a
})
})(RTS.scm2host(@1@));" book)
book)
;; (js#declaration "let findAddress = undefined")
;; (def (find-address name: (n #f) hash: (h #f) tags: (ts #f) pkey: (pkey #f))
;; (def ab (ensure-address-book))
;; (def dresses [])
;; (js#statement "console.log('Find Address in', (@1@)" ab))
;; (js#statement "findAddress = (name, opts) => {
;; }")
(js#declaration "
function findAddressesByName (name, ab) {
const needle = name.toLowerCase()
const newAdds = ab.filter( a => {
n = a.name.toLowerCase() ; return n.startsWith(needle)
});
return newAdds;
};")
(js#statement
"
let getFromAddressBook = (@2@);
let getToAddressBook = (@3@);
let filterBookUsingTags = (@4@);
let feesAndTotals = (@5@)
module.exports = {
findAddressesByName,
getFromAddressBook,
getToAddressBook,
filterBookUsingTags,
feesAndTotals
}"
#f
(js#scm->js (lambda (pk) (add-labels (get-FROM-address-book pk))))
(js#scm->js (lambda () (add-labels (get-TO-address-book))))
(js#scm->js filter-book-using-tags)
(js#scm->js fees-and-totals)
)
| false |
2443a841e83cc3b0c90f8c8fb5e308bd56825df9 | 958488bc7f3c2044206e0358e56d7690b6ae696c | /scheme/bitcoin/test-abstract.scm | 2edd0437976e2f4bffbfb8f5c0bfb04f32370220 | []
| no_license | possientis/Prog | a08eec1c1b121c2fd6c70a8ae89e2fbef952adb4 | d4b3debc37610a88e0dac3ac5914903604fd1d1f | refs/heads/master | 2023-08-17T09:15:17.723600 | 2023-08-11T12:32:59 | 2023-08-11T12:32:59 | 40,361,602 | 3 | 0 | null | 2023-03-27T05:53:58 | 2015-08-07T13:24:19 | Coq | UTF-8 | Scheme | false | false | 2,073 | scm | test-abstract.scm | (load "rand.scm")
(define test-abstract
(let ()
; object created from data is message pasing interface
(define (this data)
(lambda (m)
(cond ((eq? m 'run) (run data))
((eq? m 'self) (self data))
(else (error "test-abstract: unknown instance member" m)))))
;
; static data
(define generator (rand 'new))
;
; static interface
(define (static m . args)
(cond ((eq? m 'new) (apply new args))
((eq? m 'generator) generator)
(else (error "test-abstract: unknown static member" m))))
;
(define (self data) (cadr data)) ; concrete object
;
(define (run data)
(let ((self (self data)))
(if (equal? #f self)
(error "test-abstract: run method is abstract")
(self 'run)))) ; running concrete method
;
(define (new self) (this (list 'data self)))
;
; returning static interface
static))
(define (get-random-bytes num-bytes)
((test-abstract 'generator) 'get-random-bytes num-bytes))
(define (log-message message)
(let ((message (string-append message "\n")))
(let ((len (string-length message)))
(let ((bytes (string->bytes message)) (stderr (current-error-port)))
(write-bytes bytes len stderr)))))
; optional argument to override equality predicate
; if equality predicate is overridden, function assumes
; that objects being compared have a 'to-string method
(define (check-equals left right message . args)
(let ((predicate (if (null? args) equal? (car args)))
(show (if (null? args) object->string (lambda (x) (x 'to-string)))))
(if (not (predicate left right))
(begin
(log-message (string-append message ": check-equals failure"))
(log-message (string-append "left = " (show left)))
(log-message (string-append "right = " (show right)))
(exit 1)))))
(define (check-condition condition message)
(if (not condition)
(begin
(log-message (string-append message ": check-condition failure"))
(exit 1))))
| false |
7ee212ec113cb5547a49612a05321c4ef0400686 | 165a4ff581651cdad1bc512ec1c82cebc0ac575a | /src/SICP/3/stream_3.4.ss | f06e3133d61d098fab9db24965f466b2b2aff23c | []
| no_license | haruyama/yami | 5028e416a2caa40a0193d46018fe4be81d7820dc | 32997caecc18d9d82a28b88fabe5b414a55e0e18 | refs/heads/master | 2020-12-25T09:47:04.240216 | 2018-06-16T08:28:41 | 2018-06-16T08:28:41 | 898,824 | 1 | 1 | null | null | null | null | UTF-8 | Scheme | false | false | 3,062 | ss | stream_3.4.ss | (load "./stream_my_lib.ss")
(define (integral integrand initial-value dt)
(define int
(cons-stream initial-value
(add-streams (scale-stream integrand dt)
int)))
int)
(define (solve f y0 dt)
(define y (integral dy y0 dt))
(define dy (stream-map f y))
y)
(stream-ref (solve (lambda (y) y) 1 0.001) 1000)
(define (integral delayed-integrand initial-value dt)
(define int
(cons-stream initial-value
(let ((integrand (force delayed-integrand)))
(add-streams (scale-stream integrand dt)
int))))
int)
(define (solve f y0 dt)
(define y (integral (delay dy) y0 dt))
(define dy (stream-map f y))
y)
(stream-ref (solve (lambda (y) y) 1 0.001) 1000)
;ex3.77
(define (integral integrand initial-value dt)
(cons-stream initial-value
(if (stream-null? integrand)
the-empty-stream
(integral (stream-cdr integrand)
(+ (* dt (stream-car integrand))
initial-value)
dt)))
;(stream-ref (solve (lambda (y) y) 1 0.001) 1000)
(define (integral delayed-integrand initial-value dt)
(cons-stream initial-value
(if (stream-null? delayed-integrand)
the-empty-stream
(let ((integrand (force delayed-integrand)))
(integral (delay (stream-cdr integrand))
(+ (* dt (stream-car integrand))
initial-value)
dt)))))
(stream-ref (solve (lambda (y) y) 1 0.001) 1000)
;ex3.78
(define (solve-2nd a b dt y0 dy0)
(define y (integral (delay dy) y0 dt))
(define dy (integral (delay ddy) dy0 dt))
(define ddy (add-streams (scale-stream dy a)
(scale-stream y b)))
y)
(stream-ref (solve-2nd 4 -4 0.001 1 2) 1000)
(stream-ref (solve-2nd 4 -4 0.001 1 2) 1000)
(stream-ref (solve-2nd 3 -2 0.001 2 3) 1000)
(stream-ref (solve-2nd 3 -2 0.001 2 3) 1000)
(stream-ref (solve-2nd 1 6 0.001 3 -1) 1000)
(stream-ref (solve-2nd 0 1 0.001 1 1) 1000)
;ex3.79
(define (solve-2nd-2 f dt y0 dy0)
(define y (integral (delay dy) y0 dt))
(define dy (integral (delay ddy) dy0 dt))
(define ddy (stream-map f dy y))
y)
(stream-take (solve-2nd-2 (lambda (dy y) (+ (* 1 dy) (* 2 y) )) 0.001 1 0) 10)
(stream-ref (solve-2nd-2 (lambda (dy y) (+ (* 4 dy) (* -4 y))) 0.001 1 2) 1000)
;ex3.80
(define (RLC R L C dt)
(lambda (vC0 iL0)
(define iL (integral (delay diL) iL0 dt))
(define vC (integral (delay dvC) vC0 dt))
(define dvC (scale-stream iL (/ -1 C)))
(define diL (add-streams
(scale-stream vC (/ 1 L))
(scale-stream iL (- (/ R L)))))
(cons vC iL)
;(stream-map cons vC iL)
))
(stream-take
(car
((RLC 1 1 0.2 0.1) 10 0))
50)
(stream-take
(cdr
((RLC 1 1 0.2 0.1) 10 0))
50)
(stream-take
(cdr
((RLC 1 1 1 0.01) 1 0))
500))
| false |
4777fe66b54f3be6f0857cd842327bc81f01bf9d | 3508dcd12d0d69fec4d30c50334f8deb24f376eb | /tests/runtime/test-ephemeron.scm | 71c67b484d9e7a6f8405f64295d382de0493e68a | []
| no_license | barak/mit-scheme | be625081e92c2c74590f6b5502f5ae6bc95aa492 | 56e1a12439628e4424b8c3ce2a3118449db509ab | refs/heads/master | 2023-01-24T11:03:23.447076 | 2022-09-11T06:10:46 | 2022-09-11T06:10:46 | 12,487,054 | 12 | 1 | null | null | null | null | UTF-8 | Scheme | false | false | 15,326 | scm | test-ephemeron.scm | #| -*-Scheme-*-
Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016,
2017, 2018, 2019, 2020, 2021, 2022 Massachusetts Institute of
Technology
This file is part of MIT/GNU Scheme.
MIT/GNU Scheme is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at
your option) any later version.
MIT/GNU Scheme is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with MIT/GNU Scheme; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
USA.
|#
;;;; Test of ephemerons
(declare (usual-integrations))
;;;; Utilities
(define (assert-unbroken ephemeron key datum)
(assert-equal (ephemeron-key ephemeron) key)
(assert-equal (ephemeron-datum ephemeron) datum)
(assert-false (ephemeron-broken? ephemeron)))
(define (assert-broken ephemeron)
(assert-eqv (ephemeron-key ephemeron) #f)
(assert-eqv (ephemeron-datum ephemeron) #f)
(assert-true (ephemeron-broken? ephemeron)))
(define (repeat procedure)
(gc-flip)
(procedure)
(gc-flip)
(procedure)
(gc-flip)
(procedure))
(define (finally procedure)
(gc-flip)
(procedure))
(define-test 'NO-GC
;; Not really no GC; it's just that the ephemeron is never broken
;; because its key is never GC'd.
(lambda ()
(let ((key (list 'KEY)) (datum (list 'DATUM)))
(let ((ephemeron (make-ephemeron key datum)))
(define (check) (assert-unbroken ephemeron '(KEY) '(DATUM)))
(repeat check)
(finally check)
(reference-barrier (list key datum))))))
(define-test 'GC-KEY
(lambda ()
(let ((key (list 'KEY)) (datum (list 'DATUM)))
(let ((ephemeron (make-ephemeron key datum)))
(repeat (lambda () (assert-unbroken ephemeron '(KEY) '(DATUM))))
(reference-barrier key)
(set! key 0)
(finally (lambda () (assert-broken ephemeron)))
(reference-barrier datum)))))
(define-test 'GC-DATUM
(lambda ()
(let ((key (list 'KEY)) (datum (list 'DATUM)))
(let ((ephemeron (make-ephemeron key datum)))
(repeat (lambda () (assert-unbroken ephemeron '(KEY) '(DATUM))))
(reference-barrier datum)
(set! datum 0)
(finally (lambda () (assert-unbroken ephemeron '(KEY) '(DATUM))))
(reference-barrier key)))))
(define-test 'GC-KEY-AND-DATUM
(lambda ()
(let ((key (list 'KEY)) (datum (list 'DATUM)))
(let ((ephemeron (make-ephemeron key datum)))
(repeat (lambda () (assert-unbroken ephemeron '(KEY) '(DATUM))))
(reference-barrier (list key datum))
(set! key 0)
(set! datum 0)
(finally (lambda () (assert-broken ephemeron)))))))
(define-test 'EPHEMERON-AND-WEAK-PAIR
(lambda ()
(let ((key (list 'KEY)) (datum (list 'DATUM)))
(let ((ephemeron (make-ephemeron key datum))
(weak-pair (weak-cons datum 0)))
(define (check)
(assert-unbroken ephemeron '(KEY) '(DATUM))
(assert-equal (weak-car weak-pair) '(DATUM))
(assert-eqv (weak-car weak-pair) (ephemeron-datum ephemeron)))
(repeat check)
(reference-barrier datum)
(set! datum 0)
(repeat check)
(reference-barrier key)
(set! key 0)
(finally (lambda ()
(assert-broken ephemeron)
(assert-false (weak-pair/car? weak-pair))))))))
(define-test 'MANY-EPHEMERONS
(lambda ()
(let ((n 100))
(let* ((frobs (make-initialized-vector n (lambda (i) (cons i i))))
(ephemerons
(make-initialized-vector n
(lambda (i) (make-ephemeron (vector-ref frobs i) i)))))
(define (frob i) (vector-ref frobs i))
(define (ephemeron i) (vector-ref ephemerons i))
(define (unbroken i) (assert-unbroken (ephemeron i) (frob i) i))
(define (broken i) (assert-broken (ephemeron i)))
(repeat (lambda () (do ((i 0 (+ i 1))) ((= i n)) (unbroken i))))
(do ((i 0 (+ i 2))) ((>= i n)) (vector-set! frobs i #f))
(finally (lambda ()
(do ((i 0 (+ i 1))) ((= i n))
(if (even? i) (broken i) (unbroken i)))))))))
(define-test 'SIMPLE-EPHEMERON-CYCLE
(lambda ()
(let ((p (list 'P)) (q (list 'Q)))
(let ((a (make-ephemeron p q))
(b (make-ephemeron q p)))
(define (check)
(assert-unbroken a '(P) '(Q))
(assert-unbroken b '(Q) '(P)))
(repeat check)
(reference-barrier p)
(set! p 0)
(repeat check)
(reference-barrier q)
(set! q 0)
(finally (lambda () (assert-broken a) (assert-broken b)))))))
(define (random-cyclic-permutation n)
(let ((permutation (make-initialized-vector n identity-procedure)))
;; Does this give a uniform distribution?
(let loop ((i n))
(if (< 1 i)
(let ((i* (- i 1)))
(vector-exchange! permutation i* (random-integer i*))
(loop i*))))
permutation))
(define (cyclic-permutation? object)
(and (vector? object)
(let loop ((i 0))
(or (>= i (vector-length object))
(and (let ((vi (vector-ref object i)))
(and (integer? vi)
(exact? vi)
(<= 0 vi)
(< vi (vector-length object))
(not (= vi (vector-ref object vi)))))
(loop (+ i 1)))))))
(define (vector-exchange! v i j)
(let ((t (vector-ref v i)))
(vector-set! v i (vector-ref v j))
(vector-set! v j t)))
(define-test 'RANDOM-EPHEMERON-CYCLES
(lambda ()
(let ((n 10))
(do ((i 0 (+ i 1))) ((= i n))
(let ((permutation (random-cyclic-permutation n))
(frobs (make-initialized-vector n list)))
(define (permute i) (vector-ref permutation i))
(define (frob i) (vector-ref frobs i))
(let ((ephemerons
(make-initialized-vector n
(lambda (i) (make-ephemeron (frob i) (frob (permute i)))))))
(define (ephemeron i) (vector-ref ephemerons i))
(define (check)
(do ((i 0 (+ i 1))) ((= i n))
(assert-unbroken (ephemeron i) (list i) (list (permute i)))))
(repeat check)
(do ((i 1 (+ i 1))) ((= i n)) (vector-set! frobs (permute i) #f))
(repeat check)
(reference-barrier frobs)
(set! frobs 0)
(finally (lambda ()
(do ((i 0 (+ i 1))) ((= i n))
(assert-broken (ephemeron i)))))))))))
(define-test 'TWO-RANDOM-EPHEMERON-CYCLES
(lambda ()
(let* ((n 10) (n/2 (quotient n 2)))
(do ((i 0 (+ i 1))) ((= i n))
(let ((permutation-a (random-cyclic-permutation n/2))
(permutation-b (random-cyclic-permutation (- n n/2)))
(frobs (make-initialized-vector n list)))
(define (permute i)
(if (< i n/2)
(vector-ref permutation-a i)
(+ n/2 (vector-ref permutation-b (- i n/2)))))
(define (frob i) (vector-ref frobs i))
(let ((ephemerons
(make-initialized-vector n
(lambda (i) (make-ephemeron (frob i) (frob (permute i)))))))
(define (ephemeron i) (vector-ref ephemerons i))
(define (unbroken start end)
(do ((i start (+ i 1))) ((= i end))
(assert-unbroken (ephemeron i) (list i) (list (permute i)))))
(define (unbroken-a) (unbroken 0 n/2))
(define (unbroken-b) (unbroken n/2 n))
(define (broken start end)
(do ((i start (+ i 1))) ((= i end))
(assert-broken (ephemeron i))))
(define (broken-a) (broken 0 n/2))
(define (broken-b) (broken n/2 n))
(repeat (lambda () (unbroken-a) (unbroken-b)))
(reference-barrier frobs)
(do ((i 1 (+ i 1))) ((= i n/2)) (vector-set! frobs (permute i) #f))
(repeat (lambda () (unbroken-a) (unbroken-b)))
(reference-barrier frobs)
(do ((i (+ n/2 1) (+ i 1))) ((= i n))
(vector-set! frobs (permute i) #f))
(repeat (lambda () (unbroken-a) (unbroken-b)))
(reference-barrier frobs)
(vector-set! frobs (permute 0) #f)
(repeat (lambda () (broken-a) (unbroken-b)))
(reference-barrier frobs)
(vector-set! frobs (permute n/2) #f)
(repeat (lambda () (broken-a) (broken-b)))))))))
(define-test 'FORCE-EPHEMERON-QUEUE
;; This test forces the garbage-collector to discover an ephemeron
;; during the ephemeron-scanning phase, whose key it can't prove live
;; upon discovery. Assumes the garbage-collector processes earlier
;; elements in vectors before later ones.
(lambda ()
(let ((p (list 'P)) (q (list 'Q)) (r (list 'R)))
(let ((e (make-ephemeron p (vector (make-ephemeron q r) (list q))))
(wp (weak-cons r '())))
(define (check)
(assert-equal '(R) (weak-car wp))
(assert-equal '(P) (ephemeron-key e))
(let ((datum (ephemeron-datum e)))
(define (v i) (vector-ref datum i))
(assert-true (vector? datum))
(assert-true (ephemeron? (v 0)))
(assert-unbroken (v 0) '(Q) '(R))
(assert-eqv (ephemeron-datum (v 0)) (weak-car wp))
(assert-equal (v 1) '((Q))))
(assert-true (weak-pair/car? wp))
(assert-false (ephemeron-broken? e)))
(repeat check)
(reference-barrier r)
(set! r 0)
(repeat check)
(reference-barrier q)
(set! q 0)
(repeat check)
(reference-barrier p)
(set! p 0)
(finally (lambda ()
(assert-broken e)
(assert-false (weak-pair/car? wp))))))))
(define-test 'SET-EPHEMERON-DATUM-WITHOUT-GC
(lambda ()
(let ((p (list 'P)) (q (list 'Q)) (r (list 'R)))
(let ((e (make-ephemeron p q)))
(repeat (lambda () (assert-unbroken e '(P) '(Q))))
(set-ephemeron-datum! e r)
(finally (lambda () (assert-unbroken e '(P) '(R))))
(reference-barrier (list p q r))))))
(define-test 'SET-EPHEMERON-DATUM-BEFORE-GC
(lambda ()
(let ((p (list 'P)) (q (list 'Q)) (r (list 'R)))
(let ((e (make-ephemeron p q)))
(repeat (lambda () (assert-unbroken e '(P) '(Q))))
(set-ephemeron-datum! e r)
(repeat (lambda () (assert-unbroken e '(P) '(R))))
(reference-barrier p)
(set! p 0)
(finally (lambda () (assert-broken e)))))))
(define-test 'SET-EPHEMERON-DATUM-AFTER-GC
(lambda ()
(let ((p (list 'P)) (q (list 'Q)) (r (list 'R)))
(let ((e (make-ephemeron p q)))
(repeat (lambda () (assert-unbroken e '(P) '(Q))))
(set! p 0)
(reference-barrier p)
(repeat (lambda () (assert-broken e)))
(set-ephemeron-datum! e r)
(assert-equal (ephemeron-datum e) #f)
(finally (lambda () (assert-broken e)))))))
#|
;;; Cute idea, but doesn't work very well -- the timings are too
;;; imprecise and noisy.
(define (check-time-complexity ephemerons key datum)
(define (initialize i)
(vector-set! ephemerons i (make-ephemeron (key i) (datum i))))
(define (measure-time i)
;; Don't let other threads interfere with our timing by consing.
(with-thread-timer-stopped
(lambda ()
(gc-flip)
;; It's tempting to time the initialization too, but
;; MAKE-EPHEMERON runs in constant amortized time, not constant
;; worst-case time, so timing individual runs does no good.
(initialize i)
(gc-flip)
(let ((start-time (real-time-clock)))
(gc-flip)
(- (real-time-clock) start-time)))))
(let loop ((i 0) (times '()))
(if (< i (vector-length ephemerons))
(loop (+ i 1)
(if (zero? (modulo i 100))
(cons (measure-time i) times)
(begin (initialize i) times)))
(begin
;; (assert-false (fits-to-parabola? times))
(assert-true (fits-to-line? times))))))
(define (fits-to-line? times)
(define (sum data) (reduce + 0 data))
(define (dot u v) (sum (map * u v)))
(define (distance^2 a b) (square (- a b)))
(define (mean data) (/ (sum data) (length data)))
(define (normalize data)
(let ((mean (mean data)))
(map (lambda (datum) (- datum mean)) data)))
(let ((n (length times)))
(let ((times (normalize times))
(indices (normalize (iota n))))
(let ((slope (/ (dot indices times) (dot indices indices))))
(let ((times* (map (lambda (i) (* slope i)) indices)))
(>= 1 (mean (map distance^2 times times*))))))))
(define-test 'LINEAR-TIME-COMPLEXITY-WITHOUT-REFERENCES
(lambda ()
(let* ((n 10000) (ephemerons (make-vector n #f)))
(check-time-complexity ephemerons (lambda (i) i 0) (lambda (i) i 0)))))
(define-test 'LINEAR-TIME-COMPLEXITY-WITH-KEYS
(lambda ()
(let ((n 10000))
(let ((cells (make-initialized-vector n make-cell))
(ephemerons (make-vector n #f)))
(check-time-complexity ephemerons
(lambda (i) (vector-ref cells i))
(lambda (i) i 0))))))
(define-test 'LINEAR-TIME-COMPLEXITY-WITH-SOME-KEYS
(lambda ()
(let ((n 10000))
(define (make-even-cell i) (and (even? i) (make-cell i)))
(let ((cells (make-initialized-vector n make-even-cell))
(ephemerons (make-vector n #f)))
(check-time-complexity ephemerons
(lambda (i) (vector-ref cells i))
(lambda (i) i 0))))))
(define-test 'LINEAR-TIME-COMPLEXITY-WITH-EPHEMERON-KEYS
(lambda ()
(let* ((n 10000) (ephemerons (make-vector n #f)))
(check-time-complexity ephemerons
(lambda (i) (if (zero? i) 0 (vector-ref ephemerons (- i 1))))
(lambda (i) i 0)))))
|#
(define-test 'FASL-PRESERVES-EPHEMERONS
(lambda ()
(call-with-temporary-file-pathname
(lambda (pathname)
(let* ((pair (cons 0 0))
(ephemeron (make-ephemeron pair 0)))
(fasdump (vector ephemeron pair) pathname))
(let ((object (fasload pathname)))
(assert-true (vector? object))
(assert-eqv (vector-length object) 2)
(let ((ephemeron (vector-ref object 0))
(pair (vector-ref object 1)))
(assert-equal pair '(0 . 0))
(assert-true (ephemeron? ephemeron))
(assert-unbroken ephemeron pair 0)
(assert-eqv (ephemeron-key ephemeron) pair)))))))
;;; Commented out because the fasdumper does not, in fact, break
;;; ephemerons whose keys are not strongly referenced in the fasl.
#|
(define-test 'FASL-BREAKS-EPHEMERONS
(lambda ()
(call-with-temporary-file-pathname
(lambda (pathname)
(fasdump (make-ephemeron (cons 0 0) 0) pathname)
(let ((ephemeron (fasload pathname)))
(assert-true (ephemeron? ephemeron))
(assert-broken ephemeron))))))
|#
;;; Assumption: CONSTANT-PROCEDURE yields compiled closures.
(define-test 'COMPILED-KEY
(lambda ()
(let ((key (constant-procedure 0)) (datum (list 'DATUM)))
(let ((e (make-ephemeron key datum)))
(repeat (lambda ()
(assert-true (procedure? (ephemeron-key e)))
(assert-eqv ((ephemeron-key e)) 0)
(assert-equal (ephemeron-datum e) '(DATUM))
(assert-false (ephemeron-broken? e))))
(reference-barrier key)
(set! key 0)
(finally (lambda () (assert-broken e)))))))
(define-test 'COMPILED-DATUM
(lambda ()
(let ((key (list 'KEY)) (datum (constant-procedure 0)))
(let ((e (make-ephemeron key datum)))
(repeat (lambda ()
(assert-equal (ephemeron-key e) '(KEY))
(assert-true (procedure? (ephemeron-datum e)))
(assert-eqv ((ephemeron-datum e)) 0)
(assert-false (ephemeron-broken? e))))
(reference-barrier key)
(set! key 0)
(finally (lambda () (assert-broken e)))))))
(define-test 'COMPILED-KEY&DATUM
(lambda ()
(let ((key (constant-procedure 0)) (datum (constant-procedure 1)))
(let ((e (make-ephemeron key datum)))
(repeat (lambda ()
(assert-true (procedure? (ephemeron-key e)))
(assert-true (procedure? (ephemeron-datum e)))
(assert-eqv ((ephemeron-key e)) 0)
(assert-eqv ((ephemeron-datum e)) 1)
(assert-false (ephemeron-broken? e))))
(reference-barrier key)
(set! key 0)
(finally (lambda () (assert-broken e)))))))
| false |
53fbc74aaf10a0cafbfe9c9ec60bd5abdcb3a0d1 | a3cdbdb1ca94558ae7412829a3fd61f00987e4dc | /raisin.scm | 18dded8e883b5768e8c36843726d4ac77c9c55ff | [
"BSD-2-Clause"
]
| permissive | jyc/raisin-guile | f8322cd59ff60166733f2569e91b4efabf0804cc | 0a6362b1999956367b1523f81940f80b62a1da92 | refs/heads/master | 2020-07-30T13:33:30.233902 | 2016-02-07T03:41:39 | 2016-02-07T03:41:39 | 210,251,389 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 10,435 | scm | raisin.scm | (define-module (jyc raisin)
#:replace (peek bind async)
#:export (new-ivar ivar-fill! ivar-read
upon bind return
scheduler-start! scheduler-stop!
any all
never after
>>=
async
>>$ seq
?..
!!))
(use-modules
(srfi srfi-69)
(srfi srfi-9)
(srfi srfi-9 gnu)
(srfi srfi-26)
(ice-9 format)
(ice-9 match)
(ice-9 control)
(ice-9 threads))
#;(begin
(include "debug.scm")
(define-syntax debug
(syntax-rules ()
((_ fmt arg ...)
(print fmt arg ...)))))
(define-syntax debug
(syntax-rules ()
((_ fmt arg ...)
#t)))
;;; `(define-record name field ...)` is shorthand for:
;;; ```
;;; (define-record-type <name>
;;; (make-<name> field ...)
;;; name?
;;; (field name-field name-field-set!)
;;; ...)
;;; ```
;;; The shorthand is from CHICKEN.
(define-syntax define-record
(lambda (x)
(syntax-case x ()
((_ name field ...)
(match-let* (((_ name* . fields*) (syntax->datum x))
(% (lambda (fmt . args) (datum->syntax x (string->symbol (apply format #f fmt args)))))
(tname (% "<~a>" name*))
(constructor (% "make-~a" name*))
(predicate (% "~a?" name*))
(getter (lambda (field*) (% "~a-~a" name* field*)))
(setter (lambda (field*) (% "~a-~a-set!" name* field*)))
(field-entries (map (lambda (field*) `(,(datum->syntax x field*) ,(getter field*) ,(setter field*))) fields*)))
#`(define-record-type #,tname
(#,constructor field ...)
#,predicate
#,@field-entries))))))
(define mutex (make-recursive-mutex))
(define ready '())
(define unsuspend-condition (make-condition-variable))
(define suspended #f)
(define current #f)
(define* (funnel!)
(lock-mutex mutex))
(define* (unfunnel! #:key condition)
(if condition
(begin
(debug "unfunnel!: waiting for condition...\n")
(unlock-mutex mutex condition)
(debug "unfunnel!: waited\n"))
(unlock-mutex mutex)))
(define (unsuspend!)
(set! suspended #f)
(debug "unsuspend!: unsuspending... ~a\n" unsuspend-condition)
(broadcast-condition-variable unsuspend-condition)
(debug "unsuspend!: broadcasted...\n")
)
(define-record ivar
name ; uninterned symbol
x ; the value the ivar becomes determined to, initially #f
filled ; boolean
bound ; procedure list
)
(define-record deferred
name ; uninterned symbol
ivar
)
(set-record-type-printer! <ivar>
(match-lambda*
((out ($ <ivar> name x filled bound))
(format out "#<~A>" name))))
(set-record-type-printer! <deferred>
(match-lambda
((out ($<deferred> name ivar))
(format out "#<~A of ~A>" name (ivar-name ivar)))))
(define (new-ivar)
(make-ivar (gensym "ivar") #f #f '()))
(define (ivar-fill! i x)
(funnel!)
(if (ivar-filled i)
(throw 'raisin:ivar-stuffed "Ivar [i] was already filled."))
(ivar-x-set! i x)
(ivar-filled-set! i #t)
(set! ready (cons i ready))
(if suspended
(unsuspend!))
(unfunnel!))
(define (ivar-read i)
(make-deferred (gensym "deferred") i))
(define (upon d f)
(let ((i (deferred-ivar d)))
(funnel!)
(ivar-bound-set! i (cons f (ivar-bound i)))
(if (ivar-filled i)
(set! ready (cons i ready)))
(unfunnel!)))
(define (bind d f)
(if (not (procedure? f))
(throw 'raisin:expected-proc "Expected procedure."))
(if (not (deferred? d))
(throw 'raisin:expected-deferred "Expected deferred to bind to."))
(let ((i (new-ivar)))
(upon d
(lambda (x)
(let ((d* (f x)))
(if (not (deferred? d*))
(throw 'raisin:expected-deferred "Expected deferred result."))
(upon d* (cut ivar-fill! i <>)))))
(ivar-read i)))
(define (return x)
(let ((i (new-ivar)))
(ivar-fill! i x)
(ivar-read i)))
(define (peek d)
(let ((i (deferred-ivar d)))
(if (ivar-filled i)
(cons 'filled (ivar-x i))
'empty)))
(define* (scheduler-start! #:key on-stop)
(let ((this (gensym)))
(funnel!)
(if current
(throw 'raisin:already-scheduling "A scheduler is already running.")
(set! current this))
(let loop ()
(debug "scheduler-start!: looping\n")
(if (not (and current (eq? current this)))
;; We're no longer the current scheduler (we've been stopped /or someone else is running).
;; Shut down.
(begin
(debug "scheduer-start!: stopped\n")
(unfunnel!)
(if on-stop (on-stop)))
;; Still running!
(begin
;; Run procedures bound to things in `ready`.
;; Copy to ready* beacuse bound procedures might themselves make
;; things ready.
(let/ec exit
(let ((ready* ready))
(set! ready '())
(for-each
(lambda (i)
(for-each
(lambda (f)
(f (ivar-x i))
(unless (and current (eq? current this))
(exit #t)))
(ivar-bound i))
(ivar-bound-set! i '()))
ready*)))
;; Suspend ourselves if necessary (nothing is ready, but other
;; things running on other threads might become ready).
;; It's possible things we just ran might have made more things
;; ready, in which case we don't need to suspend at all.
(if (not (and current (eq? current this)))
(unfunnel!)
(begin
(when (null? ready)
(set! suspended #t)
(let wait ()
(when suspended
(debug "scheduler-start!: suspending ~a\n" unsuspend-condition)
(unfunnel! #:condition unsuspend-condition)
(debug "scheduler-start!: unsuspended\n")
(funnel!)
(wait))))
(loop))))))))
(define (scheduler-stop!)
(funnel!)
(unless current
(throw 'raisin:not-scheduling "No scheduler is currently running, so no scheduler can be stopped.")
(unfunnel!))
(set! current #f)
(set! ready '())
(debug "scheduler-stop!: unsuspending!\n")
(unsuspend!)
(debug "scheduler-stop!: unsuspended.\n")
(unfunnel!))
(define (any ds)
(let ((i (new-ivar))
(done #f))
(for-each
(lambda (d)
(bind d
(lambda (x)
(when (not done)
(set! done #t)
(ivar-fill! i x))
(return '()))))
ds)
(ivar-read i)))
(define (all ds)
(if (null? ds)
(return '())
(let ((d (car ds))
(ds (cdr ds)))
(bind d
(lambda (x)
(bind (all ds)
(lambda (y)
(return (cons x y)))))))))
(define-syntax >>=
(syntax-rules ()
((_ a b c ...)
(>>= (bind a b)
c ...))
((_ a)
a)))
(define-syntax try-thread
(syntax-rules ()
((_ e ...)
(begin-thread
(catch #t
(lambda () e ...)
(lambda (exn . params)
;; The default thread error handler will not do anything as of Guile 2.0.2.0.
(with-output-to-port (current-error-port)
(lambda ()
(backtrace)
(format #t "ERROR: Throw to key `~a' with args `~a'~%~" exn params)))))))))
(define-syntax async
(syntax-rules ()
((_ body ...)
(let* ((i (new-ivar))
(d (ivar-read i))
(f (lambda ()
(let ((x (begin body ...)))
(debug "async: filling ivar\n")
(ivar-fill! i x)
(debug "async: filled\n")))))
(debug "async: starting thread\n")
(try-thread (f))
(debug "async: done\n")
d))))
(define-syntax >>$
(syntax-rules ()
((_ (d f ...) ...)
(let ((i (new-ivar))
(done #f))
(bind d
(lambda (x)
(when (not done)
(set! done #t)
(bind (>>= (return x)
f ...)
(lambda (x)
(ivar-fill! i x)
(return '()))))
(return '())))
...
(ivar-read i)))))
(define-syntax seq
(syntax-rules (<- <* _ **)
((_ x <- d)
d)
((_ x <- d rest ...)
(bind d (lambda (x) (seq rest ...))))
((_ _ <- d rest ...)
d)
((_ _ <- d rest ...)
(bind d (lambda (ignored) (seq rest ...))))
((_ x <* (d ...))
(return (begin d ...)))
((_ x <* (d ...))
(return (begin d ...)))
((_ x <* (d ...) rest ...)
(bind (return (begin d ...)) (lambda (x) (seq rest ...))))
((_ _ <* (d ...))
(return (begin d ...)))
((_ ** (d ...) rest ...)
(bind (return (begin d ...)) (lambda (_) (seq rest ...))))
((_ d)
d)
((_ d rest ...)
(bind d (lambda (_) (seq rest ...))))
((_)
(return '()))))
(define (never)
(ivar-read (new-ivar)))
(define (after s)
(async
(debug "here\n")
(usleep (inexact->exact (truncate (* s 1000000))))
'()))
(define async-prompt-tag (make-prompt-tag))
(define in-async-prompt (make-fluid #f))
(define (!! d)
(if (not (fluid-ref in-async-prompt))
(throw 'raisin:!!-called-but-not-in-async-prompt "!! was called outside of a ?.. block."))
(abort-to-prompt async-prompt-tag d))
(define (async-prompt-handler k d)
(fluid-set! in-async-prompt #f)
(>>= d
(lambda (x)
(call-with-prompt async-prompt-tag
(lambda ()
(fluid-set! in-async-prompt #t)
(k x))
async-prompt-handler))))
(define-syntax ?..
(syntax-rules ()
((_ e ...)
(let ((i (new-ivar)))
(>>= (return #t)
(lambda (_)
(call-with-prompt async-prompt-tag
(lambda ()
(fluid-set! in-async-prompt #t)
(let ((x (begin e ...)))
(fluid-set! in-async-prompt #f)
(return x)))
async-prompt-handler)))))))
| true |
e6503c9ebbb4dca10b444247f6a7e9165d4e8a78 | 837a5fb8eb8418ed50448b7cfbc049c807e1266d | /syntax-rules.scm | 5fca65889f9ea0d049c6d07f6ce36a981e5e7af7 | [
"MIT"
]
| permissive | reddress/scheme-learning | afdcd358304e92ae4908ed752457fb4c3aaf0120 | beaa20d25196ce3eb756dfb6a61898a96372f895 | refs/heads/master | 2016-09-13T12:57:20.854212 | 2016-05-18T19:45:35 | 2016-05-18T19:45:35 | 56,538,721 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 962 | scm | syntax-rules.scm | ;;;; http://www.willdonnelly.net/blog/scheme-syntax-rules/
;; (do ((n 1 (+ n 1)))
;; ((> n 3))
;; (display n))
(define-syntax repeat
(syntax-rules ()
((repeat k body ...)
(do ((n 1 (+ n 1)))
((> n k))
body ...))))
;;;; silly example, prepend 'd' to procedure
(define (double x y) (* 2 x y))
;; (prepend-d (efine x 2))
;; >> (define x 2)
(define-syntax prepend-d-varargs
(syntax-rules ()
((prepend-d (proc-name . body))
(apply
(eval
(string->symbol
(string-append
"d" (symbol->string (quote proc-name))))
(interaction-environment))
(quote body)))))
(define-syntax prepend-s
(syntax-rules ()
((prepend-s (proc-name arg))
((eval
(string->symbol
(string-append
"s" (symbol->string (quote proc-name))))
(interaction-environment)) arg))))
;; ((prepend-d (proc-name arg))
;; (proc-name arg)))) ;; does nothing
| true |
922afd97c801d78e4b6d6bfef947ea14ace28c77 | fb9a1b8f80516373ac709e2328dd50621b18aa1a | /ch3/exercise3-29.scm | d48b1f070b5bd39a7fe4f0e12fbb47ca356b756d | []
| no_license | da1/sicp | a7eacd10d25e5a1a034c57247755d531335ff8c7 | 0c408ace7af48ef3256330c8965a2b23ba948007 | refs/heads/master | 2021-01-20T11:57:47.202301 | 2014-02-16T08:57:55 | 2014-02-16T08:57:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 407 | scm | exercise3-29.scm | ;; 問題3.29
;; andとinverterで作ったor-gate
;; or = nand(nand(x,x), nand(y,y))
;; nand(x,x) = not(x)
;; or = not and(not(x), not(y))
(define (or-gate a1 a2 output)
(let ((w1 (make-wire))
(w2 (make-wire))
(w3 (make-wire)))
(inverter a1 w1)
(inverter a2 w2)
(and-gate w1 w2 w3)
(invert w3 output)))
;; 遅延時間
;; (+ inverter-delay and-gate-delay inverter-delay)
| false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.