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
8a4f9ffee3a9f76176c10c6d6f4e1cb22828767c
4b2aeafb5610b008009b9f4037d42c6e98f8ea73
/2.3/section.scm
cec621d7a51d7a64f146b53f8c41798c85383823
[]
no_license
mrinalabrol/clrs
cd461d1a04e6278291f6555273d709f48e48de9c
f85a8f0036f0946c9e64dde3259a19acc62b74a1
refs/heads/master
2021-01-17T23:47:45.261326
2010-09-29T00:43:32
2010-09-29T00:43:32
null
0
0
null
null
null
null
UTF-8
Scheme
false
false
173
scm
section.scm
(require-extension syntax-case (srfi 31)) (require '../6.4/section) (module section-2.3 (sum-search) (import* section-6.4 heapsort) (include "../2.3/sum-search.scm"))
false
83dda7325bc10207b18a04a9fc9daf81b927ec58
ce567bbf766df9d98dc6a5e710a77870753c7d29
/ch8/base/cases.scm
3c9eae76c590ab6387575e767e48e1169c9b400c
[]
no_license
dott94/eopl
1cbe2d98c948689687f88e514579e66412236fc9
47fadf6f2aa6ca72c831d6e2e2eccbe673129113
refs/heads/master
2021-01-18T06:42:35.921839
2015-01-21T07:06:43
2015-01-21T07:06:43
30,055,972
1
0
null
2015-01-30T04:21:42
2015-01-30T04:21:42
null
UTF-8
Scheme
false
false
6,624
scm
cases.scm
(define the-test-suite '( ;; simple applications (apply-proc-in-rator-pos "(proc(x : int) -(x,1) 30)" int 29) (checker-doesnt-ignore-type-info-in-proc-but-interp-does "(proc(x : (int -> int)) -(x,1) 30)" error 29) (apply-simple-proc "let f = proc (x : int) -(x,1) in (f 30)" int 29) (let-to-proc-1 "(proc( f : (int -> int))(f 30) proc(x : int)-(x,1))" int 29) (nested-procs "((proc (x : int) proc (y : int) -(x,y) 5) 6)" int -1) (nested-procs2 "let f = proc (x : int) proc (y : int) -(x,y) in ((f -(10,5)) 3)" int 2) ;; simple letrecs (simple-letrec-1 "letrec int f(x : int) = -(x,1) in (f 33)" int 32) (simple-letrec-2 "letrec int double(x : int) = if zero?(x) then 0 else -((double -(x,1)), -2) in (double 4)" int 8) (simple-letrec-3 "let m = -5 in letrec int f(x : int) = if zero?(x) then 0 else -((f -(x,1)), m) in (f 4)" int 20) (double-it " letrec int double (n : int) = if zero?(n) then 0 else -( (double -(n,1)), -2) in (double 3)" int 6) ;; tests of expressions that produce procedures (build-a-proc-typed "proc (x : int) -(x,1)" (int -> int)) (build-a-proc-typed-2 "proc (x : int) zero?(-(x,1))" (int -> bool)) (bind-a-proc-typed "let f = proc (x : int) -(x,1) in (f 4)" int 3) (bind-a-proc-return-proc "let f = proc (x : int) -(x,1) in f" (int -> int)) (type-a-ho-proc-1 "proc(f : (int -> bool)) (f 3)" ((int -> bool) -> bool)) (type-a-ho-proc-2 "proc(f : (bool -> bool)) (f 3)" error) (apply-a-ho-proc "proc (x : int) proc ( f : (int -> bool)) (f x)" (int -> ((int -> bool) -> bool))) (apply-a-ho-proc-2 "proc (x : int) proc ( f : (int -> (int -> bool))) (f x)" (int -> ((int -> (int -> bool)) -> (int -> bool))) ) (apply-a-ho-proc-3 "proc (x : int) proc ( f : (int -> (int -> bool))) (f zero?(x))" error) (apply-curried-proc "((proc(x : int) proc (y : int)-(x,y) 4) 3)" int 1) (apply-a-proc-2-typed "(proc (x : int) -(x,1) 4)" int 3) (apply-a-letrec " letrec int f(x : int) = -(x,1) in (f 40)" int 39) (letrec-non-shadowing "(proc (x : int) letrec bool loop(x : bool) =(loop x) in x 1)" int 1) (letrec-return-fact " let times = proc (x : int) proc (y : int) -(x,y) % not really times in letrec int fact(x : int) = if zero?(x) then 1 else ((times x) (fact -(x,1))) in fact" (int -> int)) (letrec-apply-the-fcn " let f = proc (x : int) proc (y : int) -(x,y) in letrec int loop(x : int) = if zero?(x) then 1 else ((f x) (loop -(x,1))) in (loop 4)" int 3) (modules-declare-and-ignore " module m interface [u : int] body [u = 3] 33" int 33) (modules-take-one-value " module m interface [u : int] body [u = 3] from m take u" int 3) (modules-take-one-value-no-import "module m interface [u : int] body [u = 3] from m take u" int 3) ;; (modules-take-from-parameterized-module " ;; module m ;; interface ;; ((m1 : []) => [u : int]) ;; body ;; module-proc (m1 : []) [u = 3] ;; from m take u ;; " ;; error error) (modules-check-iface-subtyping-1 " module m interface [u : int] body [u = 3 v = 4] from m take u" int 3) ;; if the interpreter always called the typechecker, or put ;; only declared variables in the module, this would raise an ;; error. Exercise: make this modification. ;; (modules-take-one-value-but-interface-bad " ;; module m interface [] body [u = 3] ;; from m take u" ;; ; this version for permissive interp ;; error 3 ;; ; this version for strict interp ;; ; error error ;; ) (modules-take-bad-value "module m interface [] body [u = 3] from m take x" error error) (modules-two-vals " module m interface [u : int v : int] body [u = 44 v = 33] -(from m take u, from m take v)" int 11) (modules-two-vals-bad-interface-1 "module m interface [u : int v : bool] body [u = 44 v = 33] -(from m take u, from m take v)" error 11) (modules-extra-vals-are-ok-1 " module m interface [x : int] body [x = 3 y = 4] from m take x" int 3) (module-extra-vals-are-ok-2 " module m interface [y : int] body [x = 3 y = 4] from m take y" int) (modules-two-vals-bad-interface-14 "module m interface [v : int u : bool] body [v = zero?(0) u = 33] -(from m take u, from m take v)" error) (modules-check-let*-1 "module m interface [u : int v : int] body [u = 44 v = -(u,11)] -(from m take u, from m take v)" int 11) (modules-check-let*-2.0 "module m1 interface [u : int] body [u = 44] module m2 interface [v : int] body [v = -(from m1 take u,11)] -(from m1 take u, from m2 take v)" int 11) (modules-check-let*-2.05 "module m1 interface [u : int] body [u = 44] module m2 interface [v : int] body [v = -(from m1 take u,11)] 33" int 33) ; doesn't actually import anything (modules-check-let*-2.1 "module m1 interface [u : int] body [u = 44] module m2 interface [v : int] body [v = -(from m1 take u,11)] -(from m1 take u, from m2 take v)" int 11) (modules-check-let*-2.2 "module m2 interface [v : int] body [v = -(from m1 take u,11)] module m1 interface [u : int] body [u = 44] -(from m1 take u, from m2 take v)" error) )) (define tests-for-run (let loop ((lst the-test-suite)) (cond ((null? lst) '()) ((= (length (car lst)) 4) ;; (printf "creating item: ~s~%" (caar lst)) (cons (list (list-ref (car lst) 0) (list-ref (car lst) 1) (list-ref (car lst) 3)) (loop (cdr lst)))) (else (loop (cdr lst)))))) (define tests-for-parse (let loop ((lst the-test-suite)) (cond ((null? lst) '()) (else ;; (printf "creating item: ~s~%" (caar lst)) (cons (list (list-ref (car lst) 0) (list-ref (car lst) 1) #t) (loop (cdr lst))))))) ;; ok to have extra members in a test-item. (define tests-for-check the-test-suite)
false
80fb591c94f9dde195b789f07835b9e666c0eba3
8e6523e3ea1110c2e86d0e1b296ca44499295bc5
/elf/elf-write.ss
619fc561f5b74205e882c80f616c7ed3b554701a
[]
no_license
duane/xscm2
9634dddeb366a1f43152d77879f44a63a66e9e61
da62b25916474da0657e33c5df2e0b14304376fd
refs/heads/master
2023-05-11T20:40:32.257063
2020-08-16T20:34:27
2020-08-16T20:34:27
277,736,322
0
0
null
null
null
null
UTF-8
Scheme
false
false
7,806
ss
elf-write.ss
#!r6rs (import (rnrs) (struct pack)) (define elf-header-aarch64 #vu8(127 69 76 70 2 1 1 0 0 0 0 0 0 0 0 0 1 0 183 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)) (define-record-type string-table (fields (mutable length) (mutable strings))) (define (new-string-table) (make-string-table 1 '())) (define (add-string-to-table table string) (let* [(len (string-table-length table)) (strings (string-table-strings table)) (utf8-string (string->utf8 string)) (this-string-length (bytevector-length utf8-string)) (updated-length (+ len this-string-length 1))] (string-table-length-set! table updated-length) (string-table-strings-set! table (cons (cons len utf8-string) strings)) (display string) (display ": ") (display len) (display " - ") (display this-string-length) (newline) len ; starting offset of string ) ) (define (string-table->bytevector table) (let* [(len (string-table-length table)) (strings (string-table-strings table)) (buffer (make-bytevector len))] (letrec [(write-strings (lambda (lst) (cond [(null? lst) (bytevector-u8-set! buffer 0 0)] [else (let* [(offset-and-string-pair (car lst)) (offset (car offset-and-string-pair)) (string (cdr offset-and-string-pair)) (rest (cdr lst)) (str-len (bytevector-length string))] (bytevector-u8-set! buffer (+ offset str-len) 0) (bytevector-copy! string 0 buffer offset str-len) (write-strings rest))]) ))] (write-strings strings)) buffer)) (define (pack-elf-header-aarch64 binary-output-port) (put-pack binary-output-port "<L 12C 2S L 3Q L 6S" #x464C457F ; magic byte: 4 bytes 2 ; ei_class: 1 byte 1 ; ei_data: 1 byte 1 ; ei_version: 1 byte 0 ; ei_osabi: 1 byte 0 ; ei_abiversion: 1 byte 0 0 0 0 0 0 0 ; ei_pad: 7 bytes 1 ; ei_type: et_rel: 1 byte #xB7 ; ei_machine: aarch64: 1 byte 1 ; ei_version: 1 byte 0 ; e_entry: 8 bytes 0 ; e_phoff: 8 bytes 0 ; e_shoff: 8 bytes 0 ; e_flags: 4 bytes 0 ; e_ehsize: 2 bytes 0 ; e_phentsize: 2 bytes 0 ; e_phnum: 2 bytes 64 ; e_shentsize: 2 bytes 0 ; e_shnum: 2 bytes 0 ; e_shstrndx: 2 bytes ) ) (define-record-type elf-section-writer (fields sh_name sh_type sh_flags sh_addr sh_offset sh_size sh_link sh_info sh_addralign sh_entsize ) ) (define (patch-section-header-offsets-and-shstrtab-index port offset count shstrtab-index) (let [(e_shoff-patch (make-bytevector 8)) (e_shnum-patch (make-bytevector 2))] (set-port-position! port #x28) (bytevector-u64-set! e_shoff-patch 0 offset (endianness little)) (put-bytevector port e_shoff-patch) (set-port-position! port #x3C) (bytevector-u16-set! e_shnum-patch 0 count (endianness little)) (put-bytevector port e_shnum-patch) (put-pack port "<S" shstrtab-index) ) ) (define (write-section-header-64 port writer) (let [(section-header-buffer (make-bytevector #x40))] (bytevector-u32-set! section-header-buffer 0 (elf-section-writer-sh_name writer) (endianness little)) (bytevector-u32-set! section-header-buffer #x4 (elf-section-writer-sh_type writer) (endianness little)) (bytevector-u64-set! section-header-buffer #x8 (elf-section-writer-sh_flags writer) (endianness little)) (bytevector-u64-set! section-header-buffer #x10 (elf-section-writer-sh_addr writer) (endianness little)) (bytevector-u64-set! section-header-buffer #x18 (elf-section-writer-sh_offset writer) (endianness little)) (bytevector-u64-set! section-header-buffer #x20 (elf-section-writer-sh_size writer) (endianness little)) (bytevector-u32-set! section-header-buffer #x28 (elf-section-writer-sh_link writer) (endianness little)) (bytevector-u32-set! section-header-buffer #x2c (elf-section-writer-sh_info writer) (endianness little)) (bytevector-u64-set! section-header-buffer #x30 (elf-section-writer-sh_addralign writer) (endianness little)) (bytevector-u64-set! section-header-buffer #x38 (elf-section-writer-sh_entsize writer) (endianness little)) (put-bytevector port section-header-buffer) ) ) (define (write-section port section sh_name sh_type sh_flags sh_addr sh_link sh_info sh_addralign sh_entsize ) (let [(len (bytevector-length section)) (offset (port-position port))] (put-bytevector port section) (make-elf-section-writer sh_name sh_type sh_flags sh_addr offset len sh_link sh_info sh_addralign sh_entsize ) ) ) (define (write-elf-file text-bv data-bv bss-bv port) ; (put-bytevector port elf-header-aarch64) (pack-elf-header-aarch64 port) (let* [(sh-string-table (new-string-table)) (headers (vector (write-section ; NULL section port #vu8() #x0 #x0 #x0 #x0 #x0 #x0 #x0 #x0 ) (write-section port text-bv (add-string-to-table sh-string-table ".text") #x1 ; progbits #x6 ; execinstr alloc #x0 #x0 #x0 #x0 #x0 ) (write-section port data-bv (add-string-to-table sh-string-table ".data") #x1 ; progbits #b11 ; alloc write #x0 #x0 #x0 #x0 #x0 ) (write-section port bss-bv (add-string-to-table sh-string-table ".bss") #x8 ; nobits #x0 #x0 #x0 #x0 #x0 #x0) (write-section port (string-table->bytevector sh-string-table) (add-string-to-table sh-string-table ".shstrtab") #x3 #x2 #x0 #x0 #x0 #x0 #x0 ))) ] (let [(section-offset (port-position port))] (display (string-table->bytevector sh-string-table)) (vector-for-each (lambda (section-header) (write-section-header-64 port section-header)) headers) (patch-section-header-offsets-and-shstrtab-index port section-offset (vector-length headers) (- (vector-length headers) 1)) ) ) ) (define (with-binary-output-file procedure path) (let [(port (open-file-output-port path (file-options no-fail) 'block #f))] (let [(result (procedure port))] (close-port port) result ) ) )
false
f092b934112527fa6a9ab009df7a64cef356ec23
95b65c399510a7a52b7152b821b538b7a8046b3b
/2020/16/main.scm
17ef7aa2397ff737cc457c167109151cc9537f11
[]
no_license
HugoNikanor/Advent-of-code
168d708092f7a54805e93a249877add418f24f95
ff6f7c8cb2ab3e6e1fbdf9ff3ca993ef37552857
refs/heads/master
2023-04-27T16:00:15.677315
2023-04-24T09:52:38
2023-04-24T09:52:38
225,194,365
0
0
null
null
null
null
UTF-8
Scheme
false
false
4,769
scm
main.scm
#!/usr/bin/guile -s !# (import (ice-9 regex) (ice-9 rdelim) (srfi srfi-1)) (define predicates (map (lambda (line) (cond ((string-match "^([a-z ]*): ([0-9]+)-([0-9]+) or ([0-9]+)-([0-9]+)$" line) => (lambda (m) (cons (string->symbol (string-map (lambda (c) (if (char=? c #\space) #\- c)) (match:substring m 1))) (lambda (x) (or (<= (string->number (match:substring m 2)) x (string->number (match:substring m 3))) (<= (string->number (match:substring m 4)) x (string->number (match:substring m 5)))))) )) (else (throw 'match-error)))) (let loop () (let ((line (read-line))) (if (or (eof-object? line) (string-null? line)) '() (cons line (loop))))))) (read-line) (define my-ticket (map string->number (string-split (read-line) #\,))) (read-line) (read-line) (define tickets (map (lambda (line) (map string->number (string-split line #\,))) (let loop () (let ((line (read-line))) (if (or (eof-object? line) (string-null? line)) '() (cons line (loop))))))) (define numbers '()) (define valid-tickets (filter-map (lambda (ticket) ;; (display ticket) (newline) (and (every (lambda (number) ;; true if number valides ;; fales if completely wrong (fold (lambda (a b) (or a b)) #f (map (lambda (p) (p number)) (map cdr predicates)))) ticket) ticket)) tickets)) (define categories (array->list (transpose-array (list->array 2 valid-tickets) 1 0))) ;; (display categories) ;; (newline) (define valid-tags (map (lambda (category i) (cons i (filter-map (lambda (pred) (and (fold (lambda (n valid) (and valid ((cdr pred) n))) #t category) (car pred))) predicates))) categories (iota (length categories)))) (define-once pq-magic (gensym)) (define* (make-priority-queue key compare #:optional (data '())) (list pq-magic key compare data)) (define (priority-queue? pq) (eq? pq-magic (car pq))) (define (priority-queue->list pq) (list-ref pq 3)) (define (pq-insert item pq) (let ((< (list-ref pq 2)) (key (list-ref pq 1))) (make-priority-queue key < (let loop ((pq (list-ref pq 3))) (cond ((null? pq) (cons item '())) ((< (key item) (key (car pq))) (cons item pq)) (else (cons (car pq) (loop (cdr pq))))))))) (define pq (fold (lambda (item q) (pq-insert item q)) (make-priority-queue (compose length cdr) <) valid-tags)) (define field-types (let ((set '())) (map (lambda (vtags) (let ((return (lset-difference eq? vtags set))) (set! set (lset-union eq? set vtags)) return)) (priority-queue->list pq)))) (define indices (filter-map (lambda (field-type) (display field-type) (newline) (if (and (<= (string-length "departure") (string-length (symbol->string (cadr field-type)))) (string= (symbol->string (cadr field-type)) "departure" 0 (string-length "departure"))) (car field-type) #f ;; (begin (display "\x1b[1m") (display (cadr field-type)) ;; (display "\x1b[m") (newline)) ;; (begin ;; (display (cadr field-type)) (newline)) )) field-types)) (display indices) (newline) (display my-ticket) (newline) (display (apply * (map (lambda (index) (list-ref my-ticket index)) indices))) (newline) ;; (display (length valid-tags)) ;; (newline) ;; (display (length (priority-queue->list pq))) ;; (newline)
false
bec1754294895dab0515ae8b6922f09827787e11
224a6601f08e4b3f800d23436874f7d04897bebf
/appendix/parser/trace.scm
1e1a91c653421b1d549dc2630bd4793214abe5f0
[]
no_license
bmstu-iu9/scheme-labs
3356aadbb109e9c07ed3d8e839f5af2f3b51d181
106de6b30048dee8c5ee0928c8782a7bc826ff0d
refs/heads/master
2022-12-10T08:38:36.199689
2022-12-04T11:42:57
2022-12-04T11:42:57
76,261,982
26
22
null
2022-11-08T16:57:45
2016-12-12T14:06:38
Scheme
UTF-8
Scheme
false
false
178
scm
trace.scm
(define-syntax trace-ex (syntax-rules () ((trace-ex expr) (begin (write 'expr) (display " => ") (let ((v expr)) (write v) v)))))
true
2c374982a853fcd5e9128c07f400ed226bf168f3
fb9a1b8f80516373ac709e2328dd50621b18aa1a
/ch5/q519.scm
1043ed87e81bdf1e35d7631abe8ce4935da0357c
[]
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
5,131
scm
q519.scm
;; 問題5.19 ;; ブレークポイント機能 ;; (set-breakpoint <machine> <label> <n>) ;; 指定したラベルのあとn番目の命令の直前にブレークポイントを設置する ;; http://www.serendip.ws/archives/3380 (define (delete x xs) (if (null? list) '() (let ((front (car xs))) (if (equal? x front) (cdr xs) (cons front (delete x (cdr xs))))))) (define (make-new-machine) (let ((pc (make-register 'pc)) (flag (make-register 'flag)) (stack (make-stack)) (the-instruction-sequence '()) (instruction-count 0) (instruction-sequence '()) (instruction-trace-flag #f) (the-instruction-sequence '()) (label '()) (breakpoints '()) (count-from-label 0)) (let ((the-ops (list (list 'initialize-stack (lambda () (stack 'initialize))) (list 'print-stack-statistics (lambda () (stack 'print-stack-statistics))))) (register-table (list (list 'pc pc) (list 'flag flag)))) (define (allocate-register name) (if (assoc name register-table) (error "Multiply defined register:" name) (set! register-table (cons (list name (make-register name)) register-table))) 'register-allocated) (define (lookup-register name) (let ((val (assoc name register-table))) (if val (cadr val) (error "Unknown register:" name)))) (define (execute) (let ((insts (get-contents pc))) (if (null? insts) 'done (begin ((instruction-execution-proc (car insts))) (if (not (equal? (caaar insts) 'label)) (begin (set! instruction-count (+ 1 instruction-count)) (set! count-from-label (+ 1 count-from-label))) (begin (set! count-from-label 0) (set! label (cadr (caar insts))))) (print-trace (car insts) label) (if (member (cons label count-from-label) breakpoints) (print "=== breakpoint ===") (execute)))))) (define (set-bpoint label n) (if (not (memq (cons label n) (map car breakpoints))) (set! breakpoints (cons (cons label n) breakpoints)))) (define (del-bpoint label n) (if (member (cons label n) breakpoints) (set! breakpoints (delete (cons label n) breakpoints)) (error "Unknown breakpoint del-bpoint" (cons label n)))) (define (del-all-bpoint) (set! breakpoints '())) (define (get-instruction-count) instruction-count) (define (initialize-instruction-count) (set! instruction-count 0)) (define (set-instruction-trace flag) (set! instruction-trace-flag flag)) (define (print-trace inst label) (if instruction-trace-flag (begin (print "label: " label ", instruction: " (car inst))) (newline))) (define (dispatch message) (cond ((eq? message 'start) (set-contents! pc the-instruction-sequence) (execute)) ((eq? message 'install-instruction-sequence) (lambda (seq) (set! the-instruction-sequence seq))) ((eq? message 'allocate-register) allocate-register) ((eq? message 'get-register) lookup-register) ((eq? message 'install-operations) (lambda (ops) (set! the-ops (append the-ops ops)))) ((eq? message 'stack) stack) ((eq? message 'operations) the-ops) ((eq? message 'get-instruction-count) (let ((cnt (get-instruction-count))) (initialize-instruction-count) cnt)) ((eq? message 'initialize-instruction-count) (initialize-instruction-count)) ((eq? message 'trace-on) (set-instruction-trace #t)) ((eq? message 'trace-off) (set-instruction-trace #f)) ((eq? message 'set-bpoint) set-bpoint) ((eq? message 'del-bpoint) del-bpoint) ((eq? message 'del-all-bpoint) del-all-bpoint) ((eq? message 'proceed) execute) (else (error "Unknown request -- MACHINE" message)))) dispatch))) (define (set-breakpoint machine label n) ((machine 'set-bpoint) label n) 'set-breakpoint-done) (define (cancel-breakpoint machine label n) ((machine 'del-bpoint) label n) 'delete-breakpoint-done) (define (cancel-all-breakpoint machine) ((machine 'del-all-bpoint)) 'delete-all-breakpoint-done) (define (proceed-machine machine) ((machine 'proceed))) (define gcd-machine (make-machine '(a b t) (list (list 'rem remainder) (list '= =)) '(test-b (test (op =) (reg b) (const 0)) (branch (label gcd-done)) (assign t (op rem) (reg a) (reg b)) (assign a (reg b)) (assign b (reg t)) (goto (label test-b)) gcd-done))) (gcd-machine 'trace-on) (set-breakpoint gcd-machine 'test-b 4) (set-breakpoint gcd-machine 'test-b 6) (set-register-contents! gcd-machine 'a 206) (set-register-contents! gcd-machine 'b 40) (start gcd-machine) (get-register-contents gcd-machine 'a) (proceed-machine gcd-machine) (get-register-contents gcd-machine 'a) (proceed-machine gcd-machine) (get-register-contents gcd-machine 'a) (cancel-breakpoint gcd-machine 'test-b 6) (proceed-machine gcd-machine) (get-register-contents gcd-machine 'a) (cancel-all-breakpoint gcd-machine) (proceed-machine gcd-machine) (get-register-contents gcd-machine 'a)
false
21a0fab00ee5bb84630dd13c61e23ef2c27cd336
c51f6a2ddfedc49313106d935141286eb0a13256
/PAPR2/maze/test-maze/maze994.scm
851771b103ec74f766285c3c42fe03881b0d9ed6
[]
no_license
Emp3r/School
395970f68238cf4e1723241d578b17113f0412b8
0814b06931939f3d745713c16c64e5d8adc783f6
refs/heads/master
2021-01-14T08:04:25.875803
2017-03-26T13:47:13
2017-03-26T13:47:13
17,414,260
0
1
null
2017-03-26T13:47:13
2014-03-04T19:35:00
Scheme
UTF-8
Scheme
false
false
187,556
scm
maze994.scm
(define setting (quote ((78 . 4) (10 . 96) (250 . #(#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 #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #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 #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #f #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #f #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #t #t #t #t #f #f #t #f #t #f #t #f #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 #f #f #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #f #t #t #t #t #t #t #f #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #f #t #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #f #t #t #f #t #t #t #t #t #t #f #f #t #t #t #f #f #f #f #t #t #t #f #f #f #f #f #f #f #f #f #t #t #f #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 #t #f #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #f #f #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #f #t #t #f #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #f #t #t #f #t #t #t #t #t #f #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #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 #f #t #t #t #f #t #t #f #t #f #t #t #f #t #f #t #t #t #t #f #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #f #f #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #f #t #t #t #t #t #f #t #t #t #f #t #f #t #t #t #f #t #t #f #t #f #t #t #t #f #t #t #t #f #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #f #t #t #t #t #f #t #t #t #t #t #f #t #t #f #t #t #t #t #t #f #t #t #f #t #t #f #t #t #t #t #t #f #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 #f #f #t #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #f #t #f #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #f #f #f #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #f #t #f #t #t #f #t #f #t #f #f #f #f #f #f #f #f #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #f #f #f #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #t #t #t #f #f #f #f #f #f #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #f #t #t #f #t #t #t #t #f #t #t #t #f #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #f #f #f #t #f #t #t #t #t #f #t #t #t #t #t #f #t #t #t #f #t #t #t #t #f #f #t #f #f #f #f #t #t #t #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #f #t #t #t #t #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #f #f #f #f #t #f #t #f #t #f #t #t #t #t #t #t #t #t #f #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #f #f #f #t #t #t #t #f #f #t #t #t #t #t #t #f #t #t #t #f #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #f #f #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #f #f #f #t #t #t #t #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #t #f #f #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #f #f #f #f #f #f #f #t #t #t #t #t #f #f #f #f #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #f #t #f #f #f #t #f #t #t #t #t #t #t #f #t #t #f #f #f #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #f #f #t #t #t #f #t #t #t #t #t #f #f #t #t #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #f #t #t #f #t #f #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #f #f #t #t #t #t #f #t #t #t #t #t #t #f #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #f #t #t #t #f #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #f #f #f #f #f #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #f #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #f #t #f #f #f #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #f #t #t #t #f #f #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #f #t #f #t #t #f #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #t #t #t #t #f #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #t #f #t #f #t #t #t #t #f #t #t #t #t #t #f #t #t #t #f #t #t #t #f #f #t #f #t #t #t #f #t #t #f #f #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #f #t #t #f #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #f #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #f #t #t #f #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #f #f #f #f #t #t #t #t #f #t #t #t #t #t #f #f #t #t #f #t #t #t #t #t #f #f #f #f #f #f #t #t #t #f #t #t #t #t #f #t #t #t #f #t #t #f #t #f #t #t #t #t #f #t #t #t #f #t #t #t #f #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #t #t #t #t #t #f #t #t #f #t #f #f #f #f #f #t #t #t #t #t #f #t #t #f #f #t #t #t #t #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #f #f #f #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #f #t #f #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #f #f #f #f #f #f #f #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #t #t #t #t #t #f #t #t #t #f #f #f #f #f #f #t #t #t #t #t #f #t #t #t #f #f #f #f #t #f #t #f #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #f #t #f #t #t #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #f #t #t #t #t #t #f #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #t #f #f #t #t #t #t #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #f #f #f #f #f #t #f #t #t #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #f #f #t #t #t #f #f #f #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #f #t #t #t #f #t #f #f #f #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #f #t #t #f #t #t #f #f #f #t #t #t #f #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #f #t #f #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #f #t #t #f #t #t #f #t #t #f #t #f #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #t #f #f #t #t #t #t #t #f #t #f #f #f #f #t #t #t #f #t #f #t #f #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #f #t #t #f #t #f #t #t #t #t #t #f #t #t #t #t #f #t #t #f #f #f #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #f #f #t #f #t #t #t #t #t #t #t #t #f #f #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #f #f #f #f #t #t #f #t #t #f #t #t #t #t #t #f #f #f #f #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #f #t #t #t #f #f #f #t #t #t #t #f #f #f #f #f #t #f #f #f #f #f #f #f #f #t #t #t #f #f #t #t #t #t #t #f #t #t #f #t #f #f #t #t #t #t #t #t #t #f #f #f #t #t #t #f #t #f #f #f #f #f #f #t #t #t #f #t #t #t #f #t #t #t #t #f #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #f #t #f #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #f #t #t #f #t #t #f #t #t #t #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #f #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #f #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #f #f #t #t #t #t #t #f #f #f #t #f #t #f #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #t #t #t #f #t #t #t #t #t #t #f #t #t #t #f #t #t #f #t #f #t #t #t #f #t #f #f #f #f #f #f #f #t #t #t #t #f #t #f #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #f #t #t #f #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #f #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #f #t #t #t #f #t #t #t #t #t #t #t #f #t #t #f #t #f #t #f #t #f #t #t #t #t #f #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #f #t #t #t #t #f #t #t #f #t #t #f #t #f #t #f #f #t #f #f #f #f #f #t #t #t #t #f #f #f #f #f #f #f #t #t #t #t #f #t #f #f #t #t #f #f #f #f #f #f #f #t #f #t #f #t #f #f #f #f #f #f #f #t #t #t #t #f #t #t #t #f #f #f #f #f #f #t #f #f #f #f #f #t #t #t #f #f #t #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #t #f #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #f #t #f #f #t #t #f #t #t #f #t #t #t #t #f #f #t #t #f #t #t #t #t #f #t #t #t #f #t #t #f #t #t #t #f #f #f #f #f #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #f #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #f #t #t #t #f #t #t #f #t #t #t #t #f #t #f #t #f #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #t #t #f #t #t #t #f #t #t #f #t #t #f #t #f #f #f #t #f #t #t #t #t #t #t #t #f #t #t #t #f #t #t #f #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #f #t #f #f #f #f #f #f #f #f #f #t #f #f #t #t #t #f #t #t #t #t #t #t #f #f #f #t #f #t #t #t #f #t #t #f #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #f #t #t #f #t #f #f #f #f #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #f #t #t #f #t #t #f #t #t #t #t #f #t #t #t #f #f #f #f #f #t #t #t #t #f #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #f #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #f #t #f #t #f #t #f #t #t #t #t #f #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #t #t #f #t #t #t #f #t #t #f #t #t #f #f #t #f #f #f #t #t #t #f #t #t #t #t #t #t #f #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #f #f #t #t #f #t #f #t #t #t #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #f #t #f #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #f #t #t #t #t #f #t #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 #f #t #f #t #t #f #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #t #t #f #f #t #f #t #f #t #f #f #f #f #f #f #f #t #t #t #t #f #f #f #f #f #t #t #t #t #t #f #f #t #t #t #t #t #t #t #f #t #t #f #f #f #t #t #f #f #t #t #t #f #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #f #t #t #f #t #t #f #t #f #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #f #t #t #f #f #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #f #t #f #t #f #t #f #t #t #t #f #t #t #t #t #t #t #f #t #f #t #f #f #f #f #f #t #t #f #f #t #t #f #t #t #t #f #t #t #f #t #f #f #f #t #f #f #f #f #f #t #f #t #t #f #t #t #t #f #t #t #t #t #t #t #t #f #f #t #t #t #f #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #f #t #f #t #t #t #f #t #t #t #t #t #t #t #t #f #f #f #f #t #t #f #t #t #f #f #f #f #f #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #f #t #f #f #f #f #f #f #f #f #f #t #t #f #t #f #t #f #t #t #f #t #t #t #t #t #t #t #f #f #t #t #f #t #f #f #t #f #t #t #t #f #t #t #t #t #f #f #t #t #f #t #t #f #f #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #f #f #f #f #f #t #t #t #t #t #t #f #t #f #t #t #t #f #f #f #t #f #t #t #f #f #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #f #t #t #t #f #f #t #t #t #t #t #f #t #t #t #t #f #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #f #t #f #t #f #t #t #t #t #t #f #t #f #f #f #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #f #t #f #t #t #t #f #t #f #f #f #f #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #f #t #t #t #t #t #f #t #t #t #t #f #t #f #t #t #t #f #t #f #t #f #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #f #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #t #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #f #f #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #f #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #f #f #f #t #t #t #t #t #t #t #t #f #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #f #t #t #t #f #t #t #t #f #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #f #t #f #t #f #t #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #f #f #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 #f #f #f #f #t #f #t #t #t #t #t #t #t #f #t #f #f #t #t #t #t #t #f #f #f #f #f #f #f #f #t #f #t #f #t #f #t #t #t #t #t #f #t #t #f #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #f #t #t #t #f #f #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #t #t #t #t #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #f #f #f #f #f #f #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #f #f #f #t #t #f #f #f #f #f #f #f #t #t #t #t #f #t #t #t #t #f #f #f #f #f #f #f #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #f #f #f #f #f #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #f #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #f #f #f #f #f #t #t #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #f #f #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #f #t #f #t #f #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #t #t #t #t #t #t #t #f #f #f #f #f #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #f #f #f #f #t #t #t #t #t #f #t #t #t #f #f #f #f #f #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #f #t #t #t #f #t #t #f #t #t #t #f #t #f #f #t #t #t #t #t #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #t #f #t #f #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #t #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #f #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #t #t #t #t #f #t #t #f #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #f #f #f #f #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #f #t #f #t #f #t #f #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #t #t #t #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #f #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #f #f #f #f #f #t #t #t #t #f #t #t #t #f #f #f #f #t #t #t #t #f #t #f #t #f #t #t #t #t #t #t #t #f #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #f #t #t #f #t #t #f #f #t #f #f #f #f #f #t #t #t #t #t #t #t #f #t #t #t #f #f #f #f #f #t #f #t #f #t #f #t #t #t #f #f #f #f #f #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #f #f #t #t #t #t #f #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #f #t #t #t #t #t #f #t #t #f #t #t #t #f #t #f #t #t #t #t #t #t #t #t #f #f #f #t #t #t #f #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #t #f #t #f #t #f #f #f #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #f #f #t #f #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #f #t #f #t #t #f #t #t #f #t #t #f #t #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #f #f #t #t #t #t #t #t #f #t #f #t #f #t #f #t #t #f #f #f #f #f #f #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #f #t #t #f #t #t #t #t #f #f #f #f #f #f #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #t #f #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #f #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #f #f #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #f #t #f #f #f #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #f #t #t #t #t #f #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #f #t #t #f #t #f #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #f #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #f #t #f #t #f #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #f #t #f #f #f #f #f #t #t #f #t #t #f #t #t #f #t #t #t #t #t #f #t #f #t #f #t #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #t #f #f #f #f #t #t #f #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #t #t #f #t #t #f #t #t #t #f #t #f #t #t #t #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #f #t #f #t #t #f #t #t #f #t #f #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #f #t #t #t #t #f #t #t #f #t #t #f #t #t #t #f #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #f #f #f #f #f #f #f #t #f #t #t #t #t #t #f #t #f #t #f #t #f #t #t #t #t #f #t #t #f #t #t #f #t #t #t #t #t #t #f #f #f #t #t #t #t #f #t #f #t #t #t #t #f #t #f #t #t #t #f #t #f #t #f #t #t #t #f #f #f #f #f #f #f #t #t #f #f #f #f #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #f #f #f #f #f #f #t #t #t #t #f #f #f #f #f #f #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #f #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #f #t #f #t #t #t #t #t #t #f #f #f #t #f #t #t #f #t #f #t #t #f #t #t #t #t #t #t #t #f #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #f #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #f #t #t #t #t #t #f #t #f #t #t #f #t #t #f #t #f #t #t #t #t #t #t #f #f #t #t #f #t #f #t #t #t #f #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #f #t #f #t #t #t #t #t #t #f #t #t #f #t #t #f #t #f #t #t #t #t #t #t #t #f #f #f #t #f #t #t #t #f #t #t #t #f #t #t #f #t #t #t #t #f #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #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 #f #t #t #f #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #f #f #f #f #f #f #f #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #f #t #t #t #f #f #f #f #f #f #t #f #t #t #t #t #f #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #f #t #t #f #t #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #f #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #f #t #t #t #f #f #f #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #f #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #f #t #f #t #t #f #t #t #f #t #t #t #t #t #f #t #t #f #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #f #t #t #t #t #t #f #t #f #t #f #t #t #t #f #t #t #f #t #f #t #f #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #f #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 #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #f #t #t #f #f #f #t #t #t #t #t #t #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #t #f #t #f #t #f #t #t #t #t #f #t #f #t #t #t #t #t #f #t #t #f #t #f #t #t #f #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #f #f #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #f #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #t #t #t #t #f #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #f #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #f #t #f #t #f #t #f #t #t #f #t #t #f #f #f #t #f #f #f #f #t #t #t #t #t #t #f #f #t #t #t #t #f #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #t #t #f #t #t #t #t #f #t #t #f #t #t #t #t #t #f #t #t #t #t #t #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #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 #f #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #f #f #f #t #t #t #t #t #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #f #t #t #f #t #t #t #t #f #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #t #f #t #t #t #t #t #t #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #f #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 #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #f #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #f #t #f #t #f #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #f #t #f #t #f #t #f #t #t #f #t #t #f #f #f #f #f #f #t #t #t #t #f #t #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #f #t #t #t #t #t #t #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #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 #f #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #f #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #f #f #f #f #f #t #t #f #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #f #f #f #f #f #t #t #t #t #f #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #f #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #f #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #f #t #t #t #f #t #t #t #t #t #f #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #f #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #f #t #t #t #t #t #f #t #t #f #t #f #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #t #t #t #f #f #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #t #t #t #f #f #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #f #f #t #f #f #f #f #f #t #t #t #t #t #t #f #t #t #f #t #f #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #f #t #t #t #f #t #t #t #t #f #f #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #t #f #f #t #t #f #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #f #t #t #f #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #f #t #f #t #t #f #t #t #f #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #f #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #f #t #t #t #f #f #f #t #t #f #t #f #f #f #f #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #f #t #t #f #t #f #t #t #t #f #t #f #t #t #t #t #f #f #f #f #f #f #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #f #t #t #f #t #t #t #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #f #f #t #t #t #f #t #f #t #t #t #f #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #f #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #f #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #f #f #f #f #f #t #t #t #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #t #t #t #f #t #f #f #f #t #t #f #t #f #t #t #f #t #t #f #t #t #f #t #t #t #t #f #t #f #f #f #f #f #f #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #t #f #t #t #f #f #f #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #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 #f #t #f #t #t #f #t #f #f #f #f #f #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #f #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #f #f #f #f #f #t #f #t #f #t #t #t #f #f #t #t #f #t #t #t #t #t #t #t #f #t #f #t #t #f #t #f #t #t #t #f #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #f #t #f #t #f #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #f #t #t #f #t #f #t #t #t #f #t #f #t #t #t #t #f #t #f #f #f #f #f #f #f #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #f #t #f #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #t #f #t #t #t #t #t #f #f #f #f #t #t #t #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #f #f #t #f #t #t #t #f #t #f #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #f #f #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #f #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #f #t #t #f #t #t #f #t #t #f #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #f #t #t #t #t #f #t #t #t #t #f #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #f #t #f #t #t #t #f #t #f #f #f #f #f #f #t #t #t #t #t #f #f #f #t #t #t #f #t #f #t #f #t #t #t #f #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #f #t #t #f #t #f #t #f #t #t #f #t #f #t #t #f #t #t #t #t #t #f #t #f #t #t #t #t #t #f #f #t #t #f #t #t #t #t #t #f #t #f #t #f #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #f #t #f #t #f #t #t #t #f #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 #f #f #f #f #f #f #t #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #f #t #f #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #f #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #f #t #t #f #t #t #f #t #t #t #t #t #t #t #f #t #f #t #t #t #f #t #t #t #t #f #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #f #f #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #f #t #t #t #t #t #t #f #t #t #f #t #t #f #t #f #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #f #t #t #f #t #f #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #f #t #f #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #f #t #t #t #t #f #t #f #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #f #f #f #f #t #t #t #t #t #t #t #t #f #f #f #t #t #t #t #f #t #f #f #f #f #t #f #f #f #t #t #t #f #t #t #t #t #f #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #f #t #f #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #f #t #f #t #t #t #t #f #t #f #t #f #t #f #t #t #t #t #f #t #f #f #f #f #f #t #t #t #t #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #f #t #t #t #t #f #f #f #t #f #t #t #f #f #f #f #t #f #f #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #f #f #f #f #t #f #t #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #f #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #f #t #t #t #t #f #t #t #t #t #f #t #f #t #f #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #f #f #f #t #f #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #f #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #f #t #t #t #f #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #t #f #t #f #t #t #t #t #t #f #t #f #f #t #t #t #t #t #t #t #t #t #f #f #t #f #f #f #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #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 #f #t #t #f #t #t #t #t #f #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #f #t #f #t #t #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 #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #t #t #f #t #t #f #t #f #t #f #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #f #t #t #f #t #t #t #t #t #f #t #f #t #f #t #f #t #t #t #f #f #f #f #t #f #f #f #f #f #f #f #f #f #t #f #t #f #f #t #t #f #f #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #t #t #t #t #t #f #f #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #f #t #t #f #t #t #t #f #f #f #f #f #t #f #t #t #f #t #t #t #t #t #f #t #f #t #f #t #f #t #t #t #t #t #f #t #t #f #t #f #t #t #f #t #t #t #f #f #t #t #t #t #t #f #t #f #f #f #f #f #f #t #t #t #t #t #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #f #f #f #f #t #t #t #t #t #f #t #t #f #t #t #t #f #t #t #f #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #f #t #t #t #t #f #t #f #t #t #t #t #t #f #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #f #f #t #t #f #f #f #t #t #t #f #t #f #t #f #t #f #t #t #t #t #t #f #t #t #f #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #f #f #f #f #f #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #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 #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #f #t #f #t #t #f #t #t #f #t #t #t #f #t #f #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #f #t #f #t #t #t #t #t #f #t #f #t #f #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #f #t #t #t #t #t #t #f #f #f #t #t #t #t #f #t #f #t #f #f #f #t #f #f #f #f #f #f #f #t #t #t #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #f #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #f #t #f #t #f #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 #f #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #f #t #t #t #t #f #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #f #t #t #f #t #t #t #t #f #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #f #t #f #t #t #t #t #f #t #t #f #t #f #t #t #t #f #f #t #t #t #t #t #f #t #f #t #t #t #t #f #t #f #f #t #t #t #f #f #t #t #t #t #t #f #f #f #f #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #t #f #t #f #t #f #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #f #t #f #f #f #f #f #f #f #f #f #t #f #f #f #f #t #f #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #f #f #f #f #f #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #f #f #f #t #t #t #t #t #t #f #t #t #f #f #f #f #t #t #f #t #t #t #t #t #t #f #t #f #f #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #f #t #f #t #t #t #t #t #f #f #f #f #f #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #t #t #f #t #t #t #f #t #t #t #f #t #t #t #t #f #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #f #t #t #t #t #t #f #t #f #t #t #f #f #f #t #t #t #t #t #t #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #t #t #t #t #t #t #f #t #f #t #t #t #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #f #t #f #t #f #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #f #t #t #t #f #t #t #t #t #t #t #f #f #f #f #t #t #f #t #f #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 #f #f #f #f #f #f #f #f #t #t #t #f #f #f #f #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #f #t #f #t #t #t #t #t #t #f #t #f #t #t #f #t #f #t #t #t #t #t #f #f #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #f #f #t #f #t #t #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #f #t #t #f #f #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #f #t #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #f #t #f #t #t #t #f #t #f #t #t #t #f #f #f #f #f #t #t #f #t #f #t #t #t #t #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #t #f #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #f #t #f #t #t #f #t #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #f #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #t #t #t #t #t #t #f #t #f #t #t #t #t #f #f #f #f #t #t #t #f #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #f #t #f #t #t #t #t #f #t #f #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #f #f #f #f #t #f #t #t #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #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 #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #t #t #t #f #f #f #f #f #f #t #f #f #f #t #t #t #t #f #t #t #t #t #f #t #f #t #f #t #t #f #f #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #f #t #t #t #f #t #t #t #t #f #t #t #t #t #t #f #t #f #f #f #t #t #t #f #t #t #t #t #t #t #f #t #f #t #t #t #t #f #t #t #t #t #f #t #t #t #f #t #t #t #t #f #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #f #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #f #t #t #t #f #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #f #t #t #f #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #t #t #f #f #f #f #t #t #t #t #t #f #f #t #f #t #t #t #t #f #t #t #t #t #t #f #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #f #t #f #f #f #f #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #f #t #t #t #t #f #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #f #t #t #t #f #t #f #f #t #t #f #t #t #t #t #t #t #f #t #f #t #t #t #t #f #t #f #t #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #f #f #f #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #t #f #f #f #f #f #f #f #f #t #f #t #t #f #t #t #t #f #t #t #t #f #t #t #t #t #t #f #t #f #t #f #t #t #t #f #t #t #t #f #t #f #t #f #t #t #t #f #t #t #f #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #f #f #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #f #f #t #t #t #t #t #t #t #t #t #t #t #f #t #f #f #f #f #t #f #f #f #f #f #f #f #f #t #f #t #t #f #t #t #t #f #t #t #f #t #f #t #f #f #f #f #t #t #t #t #f #t #t #t #t #t #t #f #t #f #t #t #t #t #f #t #f #t #f #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #f #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #f #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #f #f #f #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #f #f #t #f #t #t #t #f #t #t #f #f #f #f #t #t #t #f #f #f #f #t #f #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #f #t #t #f #t #f #f #f #t #t #f #t #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #f #t #f #f #f #f #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #f #f #f #f #f #f #f #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #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 #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #f #t #f #t #t #t #t #f #t #t #t #f #t #t #f #f #f #f #f #f #f #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #f #f #f #f #f #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #f #f #t #t #t #t #t #t #t #f #t #t #t #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #f #f #f #f #f #f #f #f #f #t #f #t #f #t #t #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 #f #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #f #f #f #f #f #f #t #f #t #t #t #t #t #t #t #t #f #f #f #f #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #t #t #t #f #t #f #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #f #f #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #t #t #f #t #f #t #f #t #t #f #t #t #t #t #t #f #t #t #f #f #f #f #f #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #f #t #t #t #t #f #t #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #f #f #t #t #t #t #f #f #t #t #f #t #f #t #f #t #t #t #t #t #f #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #f #t #f #t #t #f #t #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #t #f #t #t #t #f #t #f #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #f #t #t #f #f #f #f #f #f #t #f #f #f #f #f #f #f #t #f #t #t #t #t #f #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #f #f #f #f #f #f #f #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #f #t #t #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #f #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #f #t #t #t #t #t #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #f #f #f #t #f #f #f #f #f #f #f #f #f #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #f #t #f #t #f #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #f #f #f #f #f #t #f #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #f #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #f #f #f #f #f #f #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #f #t #f #f #t #t #t #t #t #f #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #f #f #f #f #f #f #t #t #t #t #f #t #t #f #t #f #t #t #f #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #f #f #f #t #f #f #f #t #f #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #f #f #f #f #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #t #f #t #t #f #t #f #t #f #t #t #f #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #f #t #f #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #f #f #f #t #t #t #t #t #t #t #t #t #f #f #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #t #f #t #f #t #f #f #f #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #f #t #f #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #t #f #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #f #f #t #t #t #t #f #t #f #t #t #t #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #f #f #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #f #f #f #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #f #t #t #f #t #t #f #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #f #t #f #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 #f #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #f #t #f #t #t #f #t #f #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #f #t #t #f #f #f #f #f #f #t #t #t #t #t #t #f #t #f #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #f #t #f #t #t #t #t #t #t #t #t #t #f #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #t #t #t #f #t #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #f #t #t #f #t #f #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #f #f #f #f #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #f #t #t #t #t #f #t #t #t #t #f #t #f #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #f #t #t #f #t #f #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #f #t #t #f #t #f #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 #f #t #t #t #f #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #f #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #f #f #t #t #f #f #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #f #t #t #f #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #f #t #t #t #f #t #t #f #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #f #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #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 #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #f #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #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 #f #t #t #f #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #f #f #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #f #t #t #t #f #f #f #f #f #t #f #t #t #f #t #f #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #t #f #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #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 #f #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #f #t #t #f #t #t #f #t #t #t #f #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 #t #t #t #t #t #t #f #f #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #f #t #t #t #t #f #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #f #f #f #f #t #f #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #f #t #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #f #t #t #f #t #f #t #t #t #t #t #f #t #f #t #t #f #t #f #t #f #t #t #f #f #f #f #f #f #f #f #t #t #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #t #t #t #t #f #t #f #t #t #f #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #f #t #f #f #f #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #f #t #t #t #t #t #f #t #t #t #t #t #f #t #f #t #t #t #f #f #f #f #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #f #f #f #t #t #t #t #f #f #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #f #t #t #t #f #t #f #t #t #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #t #f #t #t #t #t #f #t #f #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #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 #f #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #f #f #t #t #t #t #t #t #f #t #t #f #t #t #t #f #t #t #t #t #f #t #t #t #t #t #f #t #f #t #t #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #t #t #f #t #f #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 #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #f #t #t #t #f #t #f #t #t #t #t #f #t #f #f #f #f #t #t #t #f #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #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 #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #t #f #f #f #f #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #f #t #t #t #t #f #t #t #f #t #f #t #t #f #f #t #t #f #t #t #t #t #t #f #t #t #t #f #t #t #f #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #f #t #f #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #f #t #t #t #f #t #t #t #f #t #t #f #t #f #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #f #f #f #f #f #t #t #f #t #t #t #t #f #f #f #f #f #t #t #f #t #f #t #t #t #t #t #t #t #t #f #f #f #f #f #t #t #f #t #t #t #f #f #f #f #f #f #f #f #t #t #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #f #t #t #f #f #f #f #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #f #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #f #t #t #t #t #t #t #f #f #f #f #f #f #t #t #f #t #t #t #f #t #f #t #t #f #t #f #t #t #t #f #t #t #t #f #t #t #f #f #f #f #t #t #t #t #t #t #t #f #f #f #f #f #t #t #t #t #t #t #t #t #f #t #t #t #f #t #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #t #f #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 #f #f #f #f #f #f #f #f #f #t #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #f #t #f #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #t #t #f #f #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #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 #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #f #f #t #t #f #f #f #f #f #f #f #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #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 #f #t #t #t #f #t #t #t #f #t #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #f #t #t #t #t #t #f #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #f #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #f #t #t #t #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #t #t #f #t #t #t #f #f #f #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #f #t #t #t #f #t #f #t #t #t #f #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #f #t #f #f #f #f #f #f #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #f #t #t #f #t #t #t #t #t #f #t #f #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #f #f #f #f #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 #f #t #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #f #t #t #f #t #t #t #f #t #t #t #t #f #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 #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #t #t #t #f #t #f #t #f #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #f #t #t #f #t #t #f #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #f #t #f #f #f #f #f #f #f #t #t #t #t #f #t #f #t #t #t #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #f #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #f #t #t #t #t #t #t #t #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #f #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 #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #f #t #f #t #t #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #f #t #t #t #t #t #t #f #t #t #t #t #t #f #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #f #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #f #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #f #t #f #t #t #t #t #f #t #t #f #t #t #f #t #t #f #t #t #f #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #f #t #t #f #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #f #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #f #t #t #f #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #f #t #f #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #f #t #f #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #f #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #f #t #t #f #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #f #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #f #f #f #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #f #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #f #t #f #t #t #t #t #t #t #t #f #t #t #f #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #f #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #t #t #t #f #t #f #t #t #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #t #f #t #f #t #t #t #t #f #t #t #f #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #f #f #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #t #t #t #t #t #t #f #t #t #t #t #f #t #f #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #f #f #f #f #f #f #f #f #t #t #t #t #t #f #t #t #f #t #t #f #t #t #t #t #t #f #t #t #f #t #t #f #t #f #t #t #f #t #f #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #f #t #t #t #t #f #f #t #f #t #t #t #t #f #f #f #t #t #t #t #t #t #t #t #f #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #t #t #f #t #f #t #t #f #t #t #t #t #t #t #f #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #f #t #f #f #f #f #f #t #f #t #t #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #f #t #t #f #t #f #t #t #t #f #f #f #t #t #f #t #t #t #t #t #t #t #t #t #f #t #f #t #t #f #t #t #t #t #t #t #f #t #f #t #t #t #t #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #f #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #f #t #t #t #t #t #f #f #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #f #t #t #f #t #t #t #f #t #t #t #t #t #f #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #t #t #f #t #f #t #t #t #t #f #t #t #f #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #f #t #t #f #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #f #f #f #f #t #t #t #t #f #t #t #t #t #t #t #f #f #f #f #f #f #f #t #t #f #f #f #f #t #t #t #t #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #f #f #f #f #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #f #t #t #t #f #t #t #t #t #t #f #t #f #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #f #t #f #f #f #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #t #t #t #f #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #f #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #f #t #f #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #f #f #t #t #f #f #f #t #f #f #f #f #f #t #t #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #f #t #f #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #f #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #f #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #f #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #f #f #t #t #t #t #t #t #f #f #f #f #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #f #t #t #t #f #t #f #f #t #t #t #t #f #t #t #f #t #f #t #t #t #f #t #t #t #f #f #f #f #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #t #f #f #f #f #f #f #f #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #f #f #t #t #f #t #f #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #f #t #t #t #f #t #t #t #t #t #t #t #f #t #t #f #t #t #f #f #f #f #f #f #f #f #t #t #f #f #t #t #f #f #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #f #t #f #t #f #t #f #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #f #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #f #t #t #t #t #t #f #f #f #t #t #t #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #t #t #t #t #f #t #f #t #f #t #t #t #t #f #f #f #f #f #f #t #t #f #t #t #t #t #f #f #f #f #t #f #t #t #f #t #t #t #t #t #t #f #t #t #t #f #t #t #t #f #t #f #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #f #t #f #t #t #t #t #f #f #f #f #f #t #t #f #f #f #f #f #f #f #f #f #t #t #t #f #f #f #f #f #f #t #t #t #f #t #f #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #f #f #t #t #t #t #f #t #t #f #t #t #t #t #t #f #t #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #t #t #t #t #t #t #t #f #f #f #t #t #t #f #t #t #t #f #f #f #f #f #f #t #t #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #f #t #t #t #t #t #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #t #t #t #t #f #f #f #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #f #t #f #t #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #f #f #t #t #t #t #t #t #t #f #t #f #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #t #t #t #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #f #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #f #f #f #t #t #f #f #t #t #f #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #f #t #f #t #f #f #f #f #f #t #f #f #f #f #f #f #f #f #f #t #f #t #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #t #t #t #t #f #f #t #t #f #t #f #t #t #t #f #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #f #f #f #f #f #f #t #f #t #t #t #t #t #t #t #t #t #f #t #f #t #f #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #f #t #f #t #f #f #f #f #f #f #t #t #t #t #t #t #t #t #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #f #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #f #t #f #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #f #t #f #t #f #t #t #t #t #t #t #t #f #t #f #t #t #t #t #f #t #t #t #f #t #f #t #t #t #t #t #t #t #f #f #f #t #t #t #t #t #f #t #f #f #t #t #f #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #t #t #t #t #f #t #f #t #f #f #f #t #f #f #t #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #f #t #f #t #t #t #t #t #t #t #f #t #f #f #f #f #f #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #f #t #f #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #f #f #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #f #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #f #f #f #t #t #f #t #f #t #t #t #t #t #t #t #f #t #f #t #t #t #t #f #f #f #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #f #t #f #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #f #f #f #f #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #f #t #t #f #t #t #t #t #t #f #t #t #f #t #t #t #t #t #f #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #f #t #f #t #f #t #t #f #t #f #t #t #t #t #t #t #f #f #t #f #t #t #t #f #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #f #f #f #f #t #f #t #t #t #t #t #t #f #f #f #f #f #t #t #f #t #f #t #t #f #t #f #t #t #f #t #t #t #f #t #f #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #t #t #f #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #f #f #t #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #t #t #t #t #f #t #t #f #t #t #f #t #t #t #f #f #f #t #t #t #t #f #t #f #t #t #f #t #t #t #f #t #t #f #t #t #t #f #t #f #f #f #f #f #f #t #t #t #t #t #t #f #f #f #f #t #t #t #f #f #f #f #t #t #t #t #t #t #t #t #t #f #f #f #t #f #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #f #t #t #t #t #f #t #t #t #t #t #f #t #f #t #t #f #t #t #t #t #t #f #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #f #t #f #t #f #t #t #t #t #t #f #t #f #t #t #t #f #t #t #t #f #t #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #f #f #t #t #t #t #t #t #f #t #t #f #t #t #t #f #t #f #t #t #t #t #f #t #t #t #t #t #t #f #t #f #t #t #t #f #f #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #f #t #t #f #f #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #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 #f #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #t #t #f #t #f #t #t #t #f #t #f #t #t #t #f #f #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #f #f #f #f #f #f #t #f #t #t #t #t #t #t #f #t #t #f #t #t #t #f #t #f #t #t #t #t #f #f #f #f #f #f #f #f #t #t #t #t #t #f #t #f #f #f #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #f #t #f #f #f #f #f #f #f #f #f #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #f #t #f #f #f #f #f #t #t #t #f #t #f #f #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #f #f #f #f #f #f #t #t #f #f #f #f #f #f #f #f #t #f #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #f #t #f #t #f #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #f #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #f #f #f #f #f #f #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #f #t #t #t #t #t #f #t #t #t #t #f #f #f #t #t #t #t #t #f #t #t #t #f #t #t #t #t #f #t #t #f #t #t #t #f #t #f #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #f #t #t #t #f #f #f #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #f #t #t #t #t #t #f #t #t #t #f #f #f #f #f #f #t #t #f #t #f #t #f #f #f #t #t #t #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #f #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #f #t #t #t #t #f #f #t #t #f #t #t #t #t #t #t #t #f #t #t #f #f #f #f #t #t #t #t #t #f #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #f #t #f #t #t #t #t #f #t #f #t #t #f #t #t #f #t #t #t #f #t #f #t #t #f #t #t #f #t #f #t #f #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #f #f #t #t #t #f #t #t #t #t #t #t #t #t #t #f #f #f #f #f #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #f #f #f #f #t #t #f #t #f #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #f #f #t #t #f #f #f #f #t #t #t #f #t #f #t #t #f #t #t #f #f #f #t #f #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #f #f #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #f #t #t #f #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #f #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #f #t #t #t #f #t #t #t #f #t #f #f #f #t #f #t #f #f #f #f #f #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #f #t #t #t #t #t #t #t #f #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #f #t #f #f #f #f #f #f #f #f #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #t #t #f #t #f #f #f #t #t #t #f #t #t #f #f #t #t #t #f #t #t #f #t #t #f #t #f #t #f #t #f #f #t #t #t #f #f #f #f #f #f #f #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #f #t #f #f #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #f #t #t #t #f #t #f #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #f #t #f #t #t #t #t #t #f #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #f #t #t #f #t #t #f #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #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 #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #f #f #f #f #t #f #f #f #f #f #f #f #f #f #t #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #f #f #f #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #f #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #f #t #t #t #t #t #t #t #t #f #t #f #t #t #f #t #t #f #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #t #t #f #f #t #t #t #t #t #t #t #t #f #t #f #f #t #f #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #f #t #t #f #t #t #t #f #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #t #f #t #t #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #f #t #t #t #t #t #t #t #t #f #t #f #t #t #f #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 #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #f #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #f #f #f #f #f #f #t #f #t #t #f #f #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #f #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #f #f #t #t #f #t #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #f #t #f #t #f #f #t #f #f #t #t #t #t #t #t #t #t #t #f #t #f #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #f #t #f #f #f #f #f #f #f #t #f #f #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #f #f #t #t #f #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #t #f #f #f #f #t #t #t #t #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #f #t #f #t #f #f #t #t #t #t #t #t #t #t #t #t #f #t #f #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 #f #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #f #f #f #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #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 #f #t #t #f #f #f #f #f #t #t #f #t #t #t #t #t #f #t #f #t #t #t #t #f #t #f #t #f #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #f #t #t #t #f #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #f #t #t #t #f #t #f #f #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #f #f #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #t #t #t #t #t #f #f #f #t #f #t #t #f #t #t #f #t #f #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #t #t #t #t #f #t #t #f #t #t #f #t #t #t #t #f #t #t #t #t #t #t #f #t #f #t #t #t #t #t #f #t #t #t #f #t #t #t #t #f #t #f #t #t #t #f #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #f #f #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #f #t #t #f #t #t #t #f #f #f #f #f #f #f #f #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 #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #f #t #f #t #f #t #t #f #t #t #f #t #f #t #t #t #t #t #t #f #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #f #t #f #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #f #t #f #t #f #f #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #f #f #f #f #t #f #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #f #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 #t #t #t #t #t #t #t #t #f #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #f #t #t #f #t #f #t #f #t #f #f #f #f #t #f #t #t #t #t #f #t #t #t #f #f #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 #t #t #f #f #f #f #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #f #t #f #t #f #t #f #t #t #f #f #f #f #f #f #t #f #f #t #t #t #t #t #f #f #f #t #t #f #t #t #t #t #t #f #t #f #t #t #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #t #f #t #f #t #t #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #t #f #t #t #t #f #t #f #t #f #f #f #f #f #f #f #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #f #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #f #f #t #t #t #f #f #f #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #f #f #f #f #f #f #t #f #t #f #t #t #f #t #f #f #f #f #f #f #t #f #f #f #f #f #f #f #t #t #f #t #t #t #t #f #t #t #t #f #t #t #t #t #f #f #t #t #t #t #t #t #t #f #t #f #t #t #t #f #t #t #t #t #t #f #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #f #t #t #f #t #t #t #t #t #f #t #f #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #f #t #f #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #f #f #t #t #f #t #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #t #f #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #f #t #t #t #t #f #t #t #t #f #t #t #f #t #t #f #t #t #t #f #f #f #f #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #f #f #t #f #t #t #f #t #f #t #t #f #f #f #f #f #f #f #f #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #f #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #f #f #t #t #f #f #f #f #t #t #f #f #f #f #f #f #f #t #f #t #t #t #t #f #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #f #t #t #t #t #t #t #f #f #f #f #f #t #t #t #t #t #f #t #t #f #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #f #t #t #t #f #t #t #t #t #t #f #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #f #t #t #f #t #t #f #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #f #t #t #t #t #t #f #f #t #f #t #f #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #t #f #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #f #t #t #t #t #f #f #f #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #f #f #t #f #t #f #t #t #f #t #f #f #f #f #f #f #f #f #f #f #t #f #t #f #t #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 #f #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #f #t #t #t #f #t #t #t #t #t #t #t #t #f #f #f #t #t #t #f #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #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 #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #f #f #f #t #t #t #f #t #t #t #t #t #t #t #t #f #t #f #f #t #f #f #f #f #f #f #f #f #f #f #t #f #t #f #t #t #t #t #f #t #f #f #f #f #f #f #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 #t #t #t #t #f #t #t #f #t #f #t #t #f #f #f #t #t #t #t #t #t #t #f #t #t #f #t #t #t #f #f #f #f #f #f #f #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #f #f #f #t #t #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #f #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #f #t #t #f #t #f #t #f #t #t #t #t #t #f #t #t #f #t #f #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #f #t #f #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #f #t #t #f #t #t #t #t #f #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 #t #t #t #f #t #t #f #f #f #f #f #f #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #f #f #f #f #f #f #f #t #t #f #t #t #t #t #t #t #f #t #f #t #t #t #f #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #f #t #t #f #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #f #t #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #f #t #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #f #t #t #t #t #f #f #t #f #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #f #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #t #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #f #f #f #f #f #f #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #f #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #f #f #f #t #f #t #t #f #t #t #f #f #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #f #t #t #t #t #f #t #t #f #t #f #t #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #f #t #t #f #f #f #f #f #f #t #t #t #t #t #f #t #t #f #t #f #t #t #f #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #f #f #f #f #f #f #t #f #t #t #f #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #f #t #f #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #f #t #t #f #t #t #f #t #t #f #t #t #t #t #f #t #t #t #f #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #f #f #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #t #t #f #t #t #f #f #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #f #f #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #f #t #f #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #f #f #f #f #f #f #f #t #t #f #t #t #t #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #t #t #f #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #f #t #t #f #t #f #t #t #f #t #f #f #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #f #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #f #t #f #t #t #t #t #f #t #f #t #t #t #f #f #f #t #t #t #t #t #t #t #t #f #f #t #f #t #f #f #f #t #f #t #f #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #f #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #f #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #f #f #f #t #t #t #f #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #t #f #f #t #t #f #f #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #t #t #f #f #t #t #f #t #f #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #f #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #f #t #t #f #t #t #f #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #t #t #f #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #f #t #t #t #f #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #t #t #f #t #f #t #f #t #t #t #f #t #t #t #t #f #f #f #f #f #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #f #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #f #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #f #f #f #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #f #f #t #t #t #f #f #f #f #f #f #f #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #f #f #f #f #t #t #f #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #f #t #t #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #f #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #f #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #t #f #t #t #t #t #f #t #f #t #t #t #f #t #t #t #t #f #t #f #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #f #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #f #f #f #t #t #f #t #t #t #t #f #t #t #t #t #t #f #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #f #t #f #t #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #t #t #t #f #t #t #f #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #f #f #f #f #f #t #f #t #t #t #f #f #f #t #f #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #f #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #f #f #f #f #t #t #t #t #t #t #t #t #t #t #f #t #f #t #f #t #t #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #f #f #f #f #t #f #t #f #t #t #t #t #t #t #t #f #f #f #f #f #t #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #f #f #f #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 #f #f #f #f #t #t #t #f #t #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #f #f #f #t #t #t #t #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #f #t #t #t #f #t #t #t #f #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #f #t #f #f #f #f #f #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #f #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #f #t #f #t #f #t #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #f #t #t #f #f #f #t #f #f #t #t #t #f #t #t #f #t #t #t #f #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #f #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #f #f #f #t #t #t #f #t #t #t #f #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #f #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #f #t #t #f #t #t #f #f #t #t #t #t #f #f #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #f #f #t #f #f #t #f #t #t #t #t #t #f #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #f #t #t #f #t #t #f #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #f #t #f #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #f #t #t #f #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #f #t #t #f #t #t #t #t #f #t #t #f #t #t #f #f #t #t #t #t #t #f #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #f #f #f #f #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #t #f #t #f #t #t #t #t #t #t #f #f #t #f #f #f #f #t #t #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #f #t #t #t #t #f #t #f #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #f #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #f #t #f #t #f #t #t #t #f #f #t #t #t #f #f #f #f #f #f #f #f #t #f #t #t #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #f #f #f #f #t #t #t #f #t #t #f #t #t #t #t #f #t #t #t #f #t #t #f #t #t #t #t #t #f #t #f #t #t #t #t #t #f #f #t #t #t #f #t #t #t #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #t #t #f #t #t #t #f #t #t #t #f #t #t #f #t #t #t #t #t #f #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #f #t #t #f #t #f #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #f #t #f #t #t #t #f #t #f #t #t #f #t #f #t #t #f #t #f #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #f #t #f #t #t #f #t #t #t #f #t #f #t #t #t #t #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #f #f #f #f #f #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #f #t #f #f #f #f #f #f #t #f #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #f #t #t #t #t #f #t #f #f #f #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #f #t #t #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #t #f #t #f #f #f #f #f #t #t #f #t #t #t #t #f #t #f #t #t #t #t #t #t #f #t #t #f #t #t #f #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #t #f #f #f #f #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #f #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #f #f #t #f #f #f #f #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #f #t #f #t #f #f #f #f #t #f #t #t #t #t #t #f #f #t #t #t #t #t #t #t #t #t #t #f #t #f #f #t #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #f #t #t #f #t #t #t #t #f #t #t #t #f #t #f #t #t #f #t #t #t #t #t #t #t #t #f #t #f #t #t #f #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #f #t #t #f #t #f #f #t #t #t #t #t #t #t #t #t #t #f #t #f #f #t #t #f #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #f #t #f #f #f #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #f #t #f #t #t #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #f #t #t #t #t #f #f #f #t #t #t #t #t #f #t #t #t #t #t #f #f #f #f #f #f #f #t #f #t #t #t #f #t #t #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #f #f #f #f #f #f #f #t #t #f #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #f #t #t #t #t #t #t #f #t #t #f #t #f #t #t #t #f #t #f #t #t #f #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #f #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #f #f #t #t #f #t #f #f #f #f #f #f #f #f #t #t #t #t #t #f #t #t #t #t #f #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #f #t #f #t #f #t #f #t #t #t #f #t #t #t #t #f #t #t #t #f #t #t #f #t #t #t #t #f #f #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #f #f #f #f #t #t #f #t #f #t #t #t #f #t #t #t #t #f #t #t #f #t #t #f #t #t #t #t #t #t #t #t #f #f #t #t #f #f #t #f #t #f #f #f #f #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #f #t #t #t #t #f #t #t #f #t #f #t #t #f #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #f #f #t #t #t #t #f #t #f #t #t #t #f #t #f #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #f #f #f #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #f #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #t #f #t #t #t #f #f #f #t #t #t #t #t #t #t #t #f #t #f #t #t #f #f #f #f #f #f #f #f #t #t #t #t #t #f #t #t #t #t #t #f #t #f #t #t #f #t #t #f #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #f #f #f #f #f #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #t #t #f #t #t #t #t #f #t #f #t #t #t #f #f #f #f #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #f #t #t #t #t #t #f #t #f #t #t #t #f #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #f #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #f #f #t #t #f #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #f #t #t #t #f #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #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 #f #f #f #f #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 #f #t #t #t #f #t #t #t #t #t #t #f #f #t #f #t #f #t #t #t #t #f #t #f #t #t #f #f #f #f #f #f #f #t #t #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #t #t #f #t #t #t #t #t #f #t #t #f #t #t #t #t #f #f #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #f #f #t #t #f #f #f #f #f #f #f #f #f #t #t #t #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #f #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 #f #f #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #f #t #f #t #t #f #t #f #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #f #t #f #t #t #t #f #t #t #f #t #t #t #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #f #t #t #t #t #f #f #f #t #t #t #t #t #t #f #t #f #t #t #t #f #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #f #t #f #t #t #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #f #f #f #f #t #t #f #t #f #f #f #f #f #f #f #t #t #f #t #t #f #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #t #t #t #t #f #f #f #f #f #t #t #t #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #f #f #f #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #f #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #f #t #t #f #f #f #t #t #f #t #t #t #t #f #t #t #f #f #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #f #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 #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #f #t #t #t #f #t #f #t #f #t #t #f #t #t #t #t #t #t #t #f #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #f #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #f #f #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #f #f #t #t #t #f #t #t #t #t #t #t #f #t #t #f #t #t #t #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #f #t #f #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #t #t #t #f #f #f #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #f #t #t #t #t #t #t #f #f #f #f #t #f #t #t #t #t #f #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #f #f #f #t #f #t #t #f #t #t #f #f #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #f #t #f #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #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 #f #f #f #f #t #t #t #t #f #t #f #t #t #t #t #f #t #t #t #t #f #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #f #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #t #t #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #f #t #t #t #t #t #t #t #f #t #f #t #t #t #f #t #t #t #f #t #t #t #t #t #f #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #f #t #t #f #t #t #f #f #f #f #t #t #t #t #t #t #f #t #t #t #t #f #f #f #f #f #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #f #t #t #f #t #t #t #t #t #f #f #f #f #f #f #f #t #t #t #f #f #t #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #f #t #t #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #f #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #t #f #t #f #f #f #f #t #f #t #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #f #f #f #f #f #f #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #f #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #f #t #f #t #t #t #t #t #f #f #f #f #f #f #f #t #t #t #t #f #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #t #t #t #t #t #t #t #t #t #f #t #f #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #f #f #t #t #t #t #t #f #f #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #f #f #f #f #f #f #t #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #f #f #f #t #t #t #t #t #t #t #t #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 #f #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #f #t #t #t #f #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #f #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #f #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #f #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #f #f #t #t #t #t #f #t #t #t #f #f #f #t #f #t #f #t #t #t #t #f #t #f #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #t #t #t #f #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #t #t #f #t #f #t #t #t #f #t #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #f #f #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #f #t #t #t #f #t #f #t #t #t #t #t #f #t #t #t #f #t #t #t #f #t #f #f #f #f #t #f #t #f #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #f #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #f #t #f #f #f #f #f #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #t #f #t #f #f #f #f #t #t #f #f #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #f #t #t #f #t #f #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #f #t #f #f #f #f #f #t #f #t #t #t #f #t #t #t #f #t #f #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #f #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #f #t #t #f #t #t #t #f #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 #t #f #t #t #t #f #f #f #t #t #t #t #f #f #t #t #t #f #f #f #f #f #f #f #f #f #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #f #f #f #f #t #t #t #t #t #t #t #f #f #f #t #f #t #f #t #t #t #t #t #t #t #f #t #t #t #t #f #f #f #t #t #t #f #f #f #f #f #f #f #f #f #t #t #t #t #f #f #t #t #t #f #f #f #f #f #f #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #f #t #t #f #f #t #f #f #f #t #f #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #f #f #f #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #f #f #f #t #t #t #t #f #f #f #f #f #f #f #f #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #f #f #f #f #t #t #f #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #t #f #t #t #f #t #f #f #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #f #t #t #t #t #f #t #f #t #t #t #f #t #t #t #f #t #f #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #f #t #f #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #f #t #f #t #f #t #t #t #t #t #t #f #t #t #t #t #f #t #t #f #t #t #t #t #t #f #t #t #f #t #t #t #t #t #f #t #f #t #t #t #f #t #t #t #t #t #t #f #t #f #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #f #f #f #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #t #f #t #t #t #t #f #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #f #f #f #t #t #t #t #t #t #t #f #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #f #t #t #t #t #f #t #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #f #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #f #f #t #f #t #t #t #t #f #t #t #t #t #t #t #t #f #t #f #t #t #f #t #t #t #t #f #t #t #t #t #f #t #f #t #t #t #t #f #t #t #t #t #t #f #t #t #f #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #f #t #t #f #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #f #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #t #f #t #t #f #f #f #f #f #f #f #t #f #t #t #f #t #t #t #t #t #t #f #t #f #t #t #t #f #t #t #t #f #t #t #t #t #f #t #t #f #t #f #f #f #f #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #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 #f #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 #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #f #t #t #t #t #t #t #t #f #f #f #t #t #t #t #f #t #f #t #f #f #f #f #f #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #f #t #t #t #t #f #t #f #f #f #f #f #f #f #t #f #t #t #t #t #t #f #t #t #t #t #t #f #f #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #f #t #t #f #t #t #f #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #f #t #t #t #f #t #t #f #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #f #t #t #t #t #f #t #t #t #t #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #f #t #f #f #f #f #t #t #f #f #t #f #f #f #f #f #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #f #t #t #t #f #t #f #t #t #t #f #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #t #f #f #f #f #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #f #f #f #f #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #t #t #t #t #t #f #t #t #f #t #t #t #t #t #f #t #t #t #t #f #f #t #f #t #t #t #t #f #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #f #f #f #t #f #t #t #t #f #t #t #t #t #t #t #f #t #t #f #t #f #t #t #t #t #t #f #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #f #f #f #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #f #t #t #t #f #t #t #t #f #t #t #t #f #t #f #t #t #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 #f #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #f #f #t #t #f #t #f #f #f #f #f #t #t #f #f #t #t #f #t #t #f #t #t #t #t #t #t #t #t #f #f #f #t #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #f #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #t #t #t #t #t #f #f #f #f #f #f #f #t #t #t #t #t #f #t #t #t #f #f #f #f #f #f #f #t #t #t #t #t #f #t #t #t #t #f #f #f #f #t #t #t #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #t #t #f #f #f #f #f #t #t #t #t #f #t #t #t #t #t #f #t #t #f #t #t #t #f #t #t #t #f #t #f #t #t #f #t #t #t #t #t #f #t #f #f #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #t #f #f #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 #f #t #t #f #t #t #f #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #f #f #f #t #f #f #f #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #f #f #f #f #f #f #f #t #t #f #f #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #f #t #t #f #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #f #f #f #f #t #t #f #f #f #f #t #t #t #t #t #t #t #f #f #t #f #f #f #f #f #t #t #t #t #t #t #t #f #f #f #t #t #f #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #t #t #t #f #t #t #f #t #t #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #t #t #f #f #f #f #f #f #f #t #t #f #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #f #t #t #f #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #f #f #f #f #f #f #f #t #f #f #f #f #f #f #t #t #t #t #t #t #f #f #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #t #f #t #f #t #t #t #f #t #t #f #t #f #t #t #f #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #f #t #f #f #f #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #t #f #t #t #t #t #t #t #f #f #t #t #t #t #f #t #t #f #f #f #f #f #f #t #f #f #t #t #t #t #t #t #t #t #f #t #t #f #t #f #t #f #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #f #t #t #f #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #f #t #t #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #t #f #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 #f #f #f #f #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #f #t #f #t #t #t #f #t #t #t #t #t #t #f #f #f #f #f #t #t #t #t #t #t #f #t #t #t #f #t #f #t #t #t #t #t #f #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #f #f #f #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #f #f #f #f #f #f #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #t #t #t #f #f #f #f #t #t #t #t #t #t #t #f #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #f #f #f #t #t #f #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #t #t #f #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #f #f #f #f #f #f #f #f #t #t #f #t #t #f #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #f #f #t #t #t #t #f #f #f #f #f #f #f #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #f #t #f #t #t #t #t #t #t #t #f #f #f #t #t #t #t #t #t #t #f #t #t #t #t #f #t #f #t #f #t #t #t #t #f #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #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 #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #t #f #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #f #f #f #f #f #f #f #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #f #f #t #t #t #t #t #t #t #t #t #t #t #t #f #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #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 #t #f #t #t #t #t #t #t #f #f #f #t #f #t #f #t #t #t #t #t #f #f #f #f #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #f #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #f #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #f #t #t #t #f #f #f #f #f #f #f #t #t #t #f #f #t #f #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #t #t #f #f #f #f #f #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #t #t #f #f #f #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #f #t #f #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #f #t #f #t #f #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #f #t #t #t #t #f #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #f #t #t #f #t #t #t #f #t #t #f #t #t #t #f #t #f #t #f #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #f #t #t #t #t #f #t #t #f #t #t #t #f #t #t #f #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #f #t #t #t #t #t #f #f #f #f #f #f #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #f #f #t #t #t #t #t #t #t #f #f #f #f #f #f #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #f #t #f #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #f #t #t #f #t #f #f #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #t #f #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #f #f #f #f #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #f #t #t #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #f #t #t #t #t #f #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #f #t #f #t #t #f #t #t #t #f #t #t #t #t #f #t #t #f #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #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 #f #t #f #t #f #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #f #f #f #f #t #f #t #t #t #f #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #t #f #t #t #t #t #t #t #f #f #f #f #f #f #f #t #t #t #t #f #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #f #f #f #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #f #t #t #f #t #t #t #t #t #f #t #f #t #t #t #f #t #t #t #t #f #t #f #t #t #t #t #f #t #t #f #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #f #f #f #t #t #t #t #t #f #f #t #t #t #f #t #t #t #t #t #f #t #f #t #t #t #t #f #f #f #f #f #f #t #t #f #f #f #f #f #f #f #f #f #f #t #f #f #f #f #f #f #t #t #t #t #f #f #f #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #f #t #t #f #t #t #f #t #t #t #t #f #f #t #t #t #t #f #t #t #t #t #t #f #f #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #f #f #f #f #f #f #f #f #t #t #t #t #t #t #f #f #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #f #t #f #f #f #t #t #t #t #t #t #t #t #t #f #t #t #t #f #f #f #f #f #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #f #t #t #f #f #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #f #f #t #f #t #f #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #f #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #f #t #f #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #t #t #t #f #t #f #f #f #f #t #t #t #t #f #f #t #t #t #t #f #f #t #t #f #t #f #t #f #t #t #t #t #t #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #t #t #f #f #f #f #f #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #f #t #t #t #t #t #f #t #t #t #f #t #f #t #t #t #t #t #f #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #f #t #t #t #f #t #t #f #t #f #t #t #f #t #f #f #f #t #t #f #t #t #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #f #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #f #f #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #f #f #f #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #t #f #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #f #f #f #t #f #f #f #f #t #t #t #t #t #t #f #f #f #f #f #t #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #f #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #f #t #t #t #f #f #t #t #t #t #f #f #f #f #f #f #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #f #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #f #t #t #t #f #t #f #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #f #t #f #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #f #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #f #t #f #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #f #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #t #t #f #t #f #t #t #t #f #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #t #t #t #f #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #f #t #t #t #t #t #f #t #t #t #f #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #f #t #f #t #t #t #t #t #f #t #t #t #f #t #f #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #f #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 #t #t #t #t #t #t #t #t #t #t #f #t #f #t #f #t #t #t #t #t #f #t #t #f #t #f #t #f #f #f #f #f #f #f #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #f #t #t #t #t #t #t #f #f #f #f #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #f #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #t #t #f #f #f #f #f #f #t #f #f #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #t #f #t #t #t #t #t #t #f #t #f #t #t #t #f #t #t #t #t #f #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #f #t #f #t #t #t #t #t #t #t #f #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #f #t #f #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #f #t #t #t #f #f #f #t #t #t #t #f #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #f #t #f #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #f #t #t #t #t #t #f #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #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)))))
false
7a1727f3a038ff88dcf9a0499a5d2665d0309eb5
c4b299ef8a2c5e063d22b40cda341b6109dcd531
/modules/tree-strings.scm
a71c94fe5d961dbcda3a6a72f5299ae4d3ced93a
[ "WTFPL" ]
permissive
edw/magic
ec2fe3e6f2abd516e1da212512c5ff71b0295f56
c1f822b1ee00247d9b5c170d44ab994213a5897a
refs/heads/master
2021-01-16T17:47:38.841220
2011-05-09T20:57:59
2011-05-09T20:57:59
1,721,049
2
0
null
null
null
null
UTF-8
Scheme
false
false
894
scm
tree-strings.scm
(define (string-copy! s i t) ; copy all of t into s at location i (let ((end (+ i (string-length t)))) (let iter ((i i) (j 0)) (cond ((= i end) (if #f #t)) (else (string-set! s i (string-ref t j)) (iter (+ i 1) (+ j 1))))))) (define (tree-string-length tree) (tree-string-walk tree (lambda (atom i) (if #f #t)))) (define (tree-string->string tree) (let ((s (make-string (tree-string-length tree)))) (tree-string-walk tree (lambda (atom i) (string-copy! s i atom))) s)) (define (tree-string-walk tree proc) (let iter ((tree tree) (sum 0)) (cond ((null? tree) sum) ((null? (car tree)) (iter (cdr tree) sum)) ((pair? (car tree)) (iter (cdr tree) (iter (car tree) sum))) (else (proc (car tree) sum) (iter (cdr tree) (+ sum (string-length (car tree))))))))
false
df5668eb820f4ba137cc66a2d68f18be191c90b8
6b9c4cb24f7d309f99b112776586987fc6fb381b
/src/sip-name-list.scm
81a5930a31e58f5996c858c8acac312347c61687
[ "MIT" ]
permissive
alxbnct/silver-paren
6af5262335f0b36c9683f898cd311013818f1a29
db239d810a6b125dcdd49c0b6d6c99e57c8dd105
refs/heads/master
2023-03-18T09:41:28.611825
2020-01-19T14:55:26
2020-01-19T14:55:38
null
0
0
null
null
null
null
UTF-8
Scheme
false
false
3,210
scm
sip-name-list.scm
(include "./sip-error.scm") (define-library (silver-paren name-list) (import (scheme base) (scheme write) (scheme cxr) (only (srfi 1) fold);scheme list (silver-paren error) ) (export silver-paren-name-list-valid-name-list? silver-paren-name-list-name silver-paren-name-list-generate-name-list-list-from-option ) (begin ;example (SOFTNAME VERSION? OPT? ...) (define (aux-name-list?-valid-name-list-option? option) (and (list? option) (symbol? (car option)) (or (and (eq? (car option) 'version) (not (null? (cdr option))) (string? (cadr option))) (eq? (car option) 'features) (eq? (car option) 'edition)))) (define (silver-paren-name-list-valid-name-list? name-list) (cond ((null? name-list) #f) ((and (list? name-list) (string? (car name-list))) (or (null? (cdr name-list));NAME ONLY (and (fold (lambda (option prev-result) (if prev-result (aux-name-list?-valid-name-list-option? option) #f)) #t (cdr name-list))))) (else #f))) (define (silver-paren-name-list-name name-list) (car name-list)) (define (%edition-delimiter? object edition-delimiter) (and (eq? object edition-delimiter ))) (define (silver-paren-name-list-generate-name-list-list-from-option option edition-delimiter) (let loop ((current-package-name '()) (current-package-modifications '()) (option option) (res '())) (cond ((and (null? option) (null? current-package-name)) (reverse res)) ((null? option) (reverse (cons (cons current-package-name current-package-modifications) res))) ((equal? (car option) edition-delimiter) (when (null? (cdr option)) (silver-paren-error (string-append "Edition delimiter " (symbol->string edition-delimiter) "requires argument."))) (loop current-package-name (cons (list 'edition (cadr option)) current-package-modifications) (cddr option) res)) ((null? current-package-name) (loop (car option) '() (cdr option) res)) (else (loop (car option) '() (cdr option) (cons (cons current-package-name current-package-modifications) res)))))) ))
false
f0afe7150ab753d46de57beb3f6d3297f7f29a94
8f0ceb57d807ba1c92846ae899736b0418003e4f
/INF2810/Assignment1a/Test-exercise/1a.scm
3abb42cbded916a021b2c1558758eb59423cb2cc
[]
no_license
hovdis/UiO
4549053188302af5202c8294a89124adb4eb981b
dcaa236314d5b0022e6be7c2cd0b48e88016475a
refs/heads/master
2020-09-16T04:04:22.283098
2020-02-26T08:21:21
2020-02-26T08:21:21
223,645,789
0
0
null
null
null
null
UTF-8
Scheme
false
false
499
scm
1a.scm
; ; Assignment 1a ; ; Exercise 1 (* (+ 2 2) 5) ; ; Output: 20 ; ; Reason: 5 * (2 + 2) = 5 * 4 = 20 (* (+ 2 2) (5)) ; ; Error ; ; Reason: (5) is not a procedure (* (2 + 2) 5) ; ; Error ; ; Reason: (2 + 2) should be (+ 2 2). The first '2' is not a procedure (define bar (/ 4 2)) bar ; ; Output: 2 ; ; Reason: bar is defined as 4/2 = 2 (- bar 2) ; ; Output: 0 ; ; Reason: bar - 2 = 2 - 2 = 0 (/ (* bar 3 4 1) bar) ; ; Output: 12 ; ; Reason: (bar * 3 * 4 * 1) / bar = (2 * 3 * 4 * 1) / 2 = 3 * 4 = 12
false
04802bda1a671a189e06d4eef32f88e240175c83
38fcd70df648a497ee1271fcdbd30e391fb310e5
/prolog1.2/prolog1.2/Interval/precision.ss
595c28c4677efb5b6df69b00bf258469430b934b
[]
no_license
liutanyu/Useful
e9b3d3699dffa21bb1425dddff7d150ab7d7aee7
11a123126833e577a76ce32c22d8563c0f2bbd7d
refs/heads/master
2021-01-19T11:34:24.259506
2013-07-17T04:13:22
2013-07-17T04:13:22
null
0
0
null
null
null
null
UTF-8
Scheme
false
false
2,004
ss
precision.ss
;;; functions (define (real x) x) ;;; (exact->inexact ...) required? (define (approx const) ;;; const is an integer/real constant ;;; of "infinite" precision (mk-interval LB-CLOSED (real const) (real const) UB-CLOSED)) ;;; bring down the precision??## (define (hack x) ;;; x is an internal real (cond ((isinf? x) INFMAX) ((is-inf? x) -INFMAX) (else x))) (define (avg x y) ;;; x, y are internal reals (let ((x~ (hack x)) (y~ (hack y))) (/_ (+_ x~ y~) TWO))) ;;; low-level primitives (define (<_ x y) ;;; EXACT < ;;; x, y are internal reals (cond ((equal? x y) #f) ((or (is-inf? x) (isinf? y)) #t) ((or (isinf? x) (is-inf? y)) #f) (else (< x y)))) (define (=_ x y) ;;; EXACT = ;;; x, y are internal reals (cond ((equal? x y) #t) ((or (isinf? x) (isinf? y) (is-inf? x) (is-inf? y)) #f) (else (= x y)))) (define (~<_ x y) (<_ x y)) ;;; INEXACT < ;;; x, y are non-infinite reals (define (~_a x y prec) ;;; INEXACT = (absolute) ;;; x, y are non-infinite reals ;;; prec is a real >= 0 (and (<= (-_ x y) prec) (<= (-_ y x) prec))) (define (~_r x y prec) ;;; INEXACT = (relative) ;;; x, y are non-infinite reals (let ((prec+ (+ 1 prec)) (prec- (- 1 prec))) (and (<= x (*_ y (if (<_ y ZERO) prec- prec+))) (<= y (*_ x (if (<_ x ZERO) prec- prec+)))))) (define (~_m x y) ;;; INEXACT = (machine relative) ;;; x, y are non-infinite reals (and (<= x (*_ y (if (<_ y ZERO) FUZZ- FUZZ+))) (<= y (*_ x (if (<_ x ZERO) FUZZ- FUZZ+))))) ;;; constants (define INFMAX (real 999999999999.999)) (define -INFMAX (real (- 0.0 999999999999.999))) (define (find-fuzz e) (let* ((x 1.0) (epsilon (/ e 2.0)) (y (* x (+ 1.0 epsilon)))) (if (equal? x y) e (find-fuzz epsilon)))) (define FUZZ (find-fuzz 1.0)) ;;; addend for fuzzing intervals (define FUZZ+ (+ 1.0 FUZZ)) ;;; multiplier for fuzzing intervals (define FUZZ- (- 1.0 FUZZ)) ;;; multiplier for fuzzing intervals
false
43f0823a70668ff5aaedf5db220cf53b78da2d63
a2d8b4843847507b02085bb8adabd818f57dd09f
/scheme/sicp/ch_2/tst-interval.scm
aead1df29b4f9c5033b0d0110c4c53b8db05c349
[]
no_license
tcharding/self_learning
df911b018fc86bd5f918394b79d2456bf51f35a8
f6bb5c6f74092177aa1b71da2ce87ca1bfc5ef3c
refs/heads/master
2022-05-13T05:09:32.284093
2022-05-02T08:25:18
2022-05-02T08:25:18
41,029,057
13
2
null
null
null
null
UTF-8
Scheme
false
false
2,748
scm
tst-interval.scm
;;;; Test suite for interval.scm (load "../test-framework.scm") (load "interval.scm") ; initial test of constructor (define i (make-interval 1 2)) #! ; should cause assertion-violation (define j (make-interval 3 1)) !# (define (test-cons-sel) (define (test-basic x y) "test constructor and selectors" (let ((tobj (make-interval x y))) (test-eq "lower-bound" (lower-bound tobj) x) (test-eq "upper-bound" (upper-bound tobj) y))) (let ((raw-data '((1 2) (3 6) (10 1000)))) (for-each (lambda (ls) (test-basic (first ls) (second ls))) raw-data))) (define (test-check-no-span-zero) (begin (unless (span-zero? (make-interval -1 1)) (fail "span-zero? failed" #f #t)) (when (span-zero? (make-interval 1 1)) (fail "span-zero? failed" #t #f)) (check-no-span-zero (make-interval 1 1)))) (define (test-mul-optimised-interval) (define (test-mul x y) (let ((mi (mul-interval x y)) (mo (mul-optimised-interval x y))) (unless (eq-interval mi mo) (fail "mul-optimised not equal to mul-interval" mo mi)))) (let ((raw-data '((-2 2) (2 3) (-3 -2)))) (for-each (lambda (ls) (test-mul (interval-from-list ls) (interval-from-list (car raw-data))) (test-mul (interval-from-list ls) (interval-from-list (cadr raw-data))) (test-mul (interval-from-list ls) (interval-from-list (caddr raw-data)))) raw-data))) (define (interval-from-list ls) (make-interval (first ls) (second ls))) (define (test-constructors) (define (check-equal x y) (when (not (eq-interval x y)) (av 'check-equal "intervals not equal" x y))) (let ((i1 (make-interval 5.4 6.6)) (i2 (make-center-percent 6 10)) (i3 (make-center-percent 6 0.10)) (i4 (make-center-width 6 0.6))) (check-equal i1 i2) (check-equal i1 i3) (check-equal i1 i4))) (define (par1 r1 r2) (div-interval (mul-interval r1 r2) (add-interval r1 r2))) (define (par2 r1 r2) (let ((one (make-interval 1 1))) (div-interval one (add-interval (div-interval one r1) (div-interval one r2))))) (define (test-par) "par1 and par2 should give the same answer" (let ((i1 (make-center-percent 6 0.01)) (i2 (make-center-percent 4 0.02))) (unless (eq-interval (par1 i1 i2) (par2 i1 i2)) (av 'test-par "par1 and par2 give differing results" (par1 i1 i2) (par2 i1 i2))))) ;;;; ;;;; Run tests ;;;; (test-cons-sel) (test-check-no-span-zero) (test-mul-optimised-interval) (test-constructors) (test-par)
false
b4797889fd69f27912fe4254bc976e58e371e36d
923adf4b9bde639a420f8d0c1ddaa891f4e95e85
/fastcgi/lib/request.sld
09d0112fff432b65f0a835da4ee21c082ce45c69
[]
no_license
justinethier/justinethier-misc
5f8dc497a6917f39e61b6eb2a5b1c5d0bfccf545
a4bc7894bb286773078b2d7052ee00e29462a9a0
refs/heads/master
2023-04-29T13:27:02.090840
2023-04-17T00:27:12
2023-04-17T00:27:12
2,954,612
1
1
null
null
null
null
UTF-8
Scheme
false
false
853
sld
request.sld
(define-library (lib request) (import (scheme base) (scheme cyclone util) (srfi 18) (lib fcgi) ) (export method body content-type ) (begin (define (req-obj) (thread-specific (current-thread))) ;; method :: string ;; Get the HTTP request method for the current request (define (method) (let ((req (req-obj))) (fcgx:get-param req "REQUEST_METHOD" "GET"))) (define (content-type) (let ((req (req-obj))) (fcgx:get-param req "CONTENT_TYPE" "GET"))) ;; params :: [string] ;; Get parameters for the current request (define (body) (let* ((req (req-obj)) (len-str (fcgx:get-param req "CONTENT_LENGTH" "0")) (len (string->number len-str)) (len-num (if len len 0))) (fcgx:get-string req len-num))) ))
false
ab8aa03c1329c88463ff314610a1e2ca5cc99224
de21ee2b90a109c443485ed2e25f84daf4327af3
/exercise/section4/4.10.scm
e900ca24ee00375b0e2e2bd379975f9900fdccc1
[]
no_license
s-tajima/SICP
ab82518bdc0551bb4c99447ecd9551f8d3a2ea1d
9ceff8757269adab850d01f238225d871748d5dc
refs/heads/master
2020-12-18T08:56:31.032661
2016-11-10T11:37:52
2016-11-10T11:37:52
18,719,524
0
0
null
null
null
null
UTF-8
Scheme
false
false
1,054
scm
4.10.scm
;= Question ============================================================================= ; ; 問題 4.10 ; ; データ抽象を使うと, 評価される言語の特定の構文と独立なeval手続きを書くことが出来る. ; これを示すため, evalとapplyを変えずに, 本節の手続きを修正し, ; Schemeの新しい構文を設計し, 実装せよ. ; ;= Prepared ============================================================================= (load "./eval.scm") ;= Answer =============================================================================== (define (while->derived exp) (define (while-condition exp) (cddr exp)) (define (while-body exp) (cadr exp)) (make-begin (list ; 1. define our loop (make-define '(loop) (list (make-if (while-condition exp) (make-begin (list (make-begin (while-body exp)) '(loop))) ; recursively call our loop "done"))) ; 2. enter our loop '(loop)))) (evaluator)
false
898216d0a94bfcda28dcfc91f9bc345dbc5f9959
bdeb8973603dd2ce97faaf59164f45fd322234c8
/exercise-4-3-stream-append-merge.scm
64579b5d9cd3a6209d0ddd40bb73805d81e7dd3e
[]
no_license
emilbaekdahl/pp-exercises
782e080c5ab0a96210cec765699f0071a4ab558b
ce9e93d03357f2aec46f648b33d18205529f775d
refs/heads/master
2020-07-28T00:50:05.001308
2019-11-13T21:44:15
2019-11-13T21:46:00
209,260,169
0
0
null
null
null
null
UTF-8
Scheme
false
false
827
scm
exercise-4-3-stream-append-merge.scm
; Exercise: Stream appending and stream merging (define-syntax cons-stream (syntax-rules () ((cons-stream x y) (cons x (delay y))))) (define head car) (define (tail stream) (force (cdr stream))) (define empty-stream? null?) (define the-empty-stream '()) (define (stream-section n stream) (cond ((= n 0) '()) (else (cons (head stream) (stream-section (- n 1) (tail stream)))))) (define (stream-append s t) (if (empty-stream? s) t (cons-stream (head s) (stream-append (tail s) t)))) (define (stream-merge s t) (cons-stream (head s) (cons-stream (head t) (stream-merge (tail s) (tail t)))))
true
60b901f634bf451e3f406e4c6ee941ed1583d2d9
557c51d080c302a65e6ef37beae7d9b2262d7f53
/workspace/comp-tester/tests/test14.ss
82e71bb9e90956d9ffc9300a2191f4ce3acb9a17
[]
no_license
esaliya/SchemeStack
286a18a39d589773d33e628f81a23bcdd0fc667b
dcfa1bbfa63b928a7ea3fc244f305369763678ad
refs/heads/master
2020-12-24T16:24:08.591437
2016-03-08T15:30:37
2016-03-08T15:30:37
28,023,003
3
4
null
null
null
null
UTF-8
Scheme
false
false
300
ss
test14.ss
;;----------------------- ;; Saliya Ekanayake ;; sekanaya ;; Test13 ;;----------------------- ; Tests mutation with pair and variable (let ([x.1 '(9)][x.2 7]) (let ([y.3 x.1] [y.4 x.2]) (begin (set-car! x.1 x.2) (set! x.2 8) (cons x.1 (cons x.2 (cons y.3 (cons y.4 '())))))))
false
7c2eb3ad5e435840b85596243f3fc875b61633c7
ab2b756cdeb5aa94b8586eeb8dd5948b7f0bba27
/src/lisp/tests/filter_test.scm
074202f258616465061720e08c8f196ef7f97363
[]
no_license
stjordanis/chalang
48ff69d8bc31da1696eae043e66c628f41035b5a
a728e6bb9a60ac6eca189ee7d6873a891825fa9a
refs/heads/master
2021-07-31T22:26:45.299432
2021-03-09T13:06:56
2021-03-09T13:06:56
142,876,387
0
0
null
2018-07-30T13:03:00
2018-07-30T13:03:00
null
UTF-8
Scheme
false
false
176
scm
filter_test.scm
(import (core/filter.scm core/tree.scm)) (define even (X) (= 0 (rem X 2))) (macro test () (filter (@ even) (tree (2 3 4 5)))) (= (test) (tree (2 4)))
false
95cbcc4b190ba138e50fe38b4edf57f9fd006b13
4b570eebce894b4373cba292f09883932834e543
/ch2/2.38.scm
2c2911b6aa190898298522d9c73783a7ea286c9b
[]
no_license
Pulkit12083/sicp
ffabc406c66019e5305ad701fbc022509319e4b1
8ea6c57d2b0be947026dd01513ded25991e5c94f
refs/heads/master
2021-06-17T13:44:06.381879
2021-05-14T16:52:30
2021-05-14T16:52:30
197,695,022
0
0
null
2021-04-14T17:04:01
2019-07-19T03:25:41
Scheme
UTF-8
Scheme
false
false
526
scm
2.38.scm
(define (fold-left op initial sequence) (define (iter result rest) (if (null? rest) result (iter (op result (car rest)) (cdr rest)))) (iter initial sequence)) ;;What are the values of (fold-right / 1 (list 1 2 3)) ; 3/2 (fold-left / 1 (list 1 2 3)) ; 1/6 (fold-right list nil (list 1 2 3)) ; (1 (2 (3 ()))) (fold-left list nil (list 1 2 3)) ; (((() 1) 2) 3) ;; property of op for fold-left/right to yield same result: ;; (= (op a b) (op b a)) ;; (= (op (op a b) c) (op a (op b c)))
false
83d601e98c2be20917605d39eb10816e079c663d
b63601b5d27a014d9258eb736eefa6b17c4ecc31
/s03-to-c/withgc/examples/ofib.scm
1c45f7b67443157bdb498addf7b303309dc74c1d
[]
no_license
hitokey/wasCm
953d3c9e6a768b940cac0b765e0c2177fe2d0646
32c7f0f25964200441f52852763ce31f725ef2e7
refs/heads/master
2023-08-17T00:56:06.969797
2021-02-10T02:20:43
2021-02-10T02:20:43
266,668,959
1
0
null
2020-06-23T22:28:59
2020-05-25T02:53:02
TeX
UTF-8
Scheme
false
false
244
scm
ofib.scm
;; Test recursivity (letrec [(fib (lambda(n) (cond [ (<fx n 2) 1] [(<fx n 3) n] [else (+fx (fib (-fx n 3)) (fib (-fx n 2)) (fib (-fx n 2))) ])) )] (display (fib 35)))
false
6dc39a90904ebf39300fd4f71844fa0b804443b3
4e2bb57118132e64e450671470c132205457d937
/programs/tls-client
b62ca57ae7a3150565dca0e535306ba53a4f4e33
[ "MIT" ]
permissive
theschemer/industria
8c4d01d018c885c0437e2575787ec987d800514f
9c9e8c2b44280d3b6bda72154a5b48461aa2aba5
refs/heads/master
2021-08-31T23:32:29.440167
2017-12-01T23:24:01
2017-12-01T23:24:01
null
0
0
null
null
null
null
UTF-8
Scheme
false
false
2,220
tls-client
#!/usr/bin/env scheme-script ;; -*- mode: scheme; coding: utf-8 -*- !# ;; Copyright © 2009, 2010 Göran Weinholt <[email protected]> ;; 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. #!r6rs (import (prefix (weinholt crypto x509) x509:) (weinholt net tls) (weinholt net tls simple) (rnrs)) (define (print . x) (for-each display x) (newline)) (let-values (((in out conn) (tls-connect (cadr (command-line)) (caddr (command-line))))) (print "Server certificate validation: " (x509:validate-certificate-path (tls-conn-remote-certs conn) (cadr (command-line)))) (print "Sending GET request.") (put-bytevector out (string->utf8 (string-append "GET / HTTP/1.1\r\n" "Host: " (cadr (command-line)) ":" (caddr (command-line)) "\r\n" "Connection: close\r\n" "\r\n\r\n"))) (flush-output-port out) (let lp () (unless (port-eof? in) (display (utf8->string (get-bytevector-n in 128))) (lp))) (close-port in) (close-port out))
false
a3b6da6e995de579cf1a1ae15400bd2b9ba9e44b
eef5f68873f7d5658c7c500846ce7752a6f45f69
/spheres/markup/internal/id/id.scm
c5ee856a5db115828fe30cd6119de718a6a316d0
[ "MIT" ]
permissive
alvatar/spheres
c0601a157ddce270c06b7b58473b20b7417a08d9
568836f234a469ef70c69f4a2d9b56d41c3fc5bd
refs/heads/master
2021-06-01T15:59:32.277602
2021-03-18T21:21:43
2021-03-18T21:21:43
25,094,121
13
3
null
null
null
null
UTF-8
Scheme
false
false
20,855
scm
id.scm
;;!!! Creation and manipulation of the ID-index ;; Provides the DTD parser for extracting ID attribute declarations ;; ;; This software is in Public Domain. ;; IT IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. ;; ;; Please send bug reports and comments to: ;; [email protected] Dmitry Lizorkin ;; ;; ID-index provides fast access to XML elements by their unique ID. ;; ID-index has the following structure: ;; id-index = ( (id . element) (id . element) ... ) ;; i.e. ;; id-index = (list ;; (cons id element) ;; (cons id element) ;; ...) ;; where ;; id - (a string) element's unique ID ;; element - an SXML presentation of an element ;; ;; Creation of an id-index generally consists of two steps. ;; On the first step, a document declaration (internal and external DTD) ;; is read and information of ID attributes is extracted. ;; This is presented in a following form: ;; id-attrs = ( (elem-name attr-name attr-name attr-name ...) ;; (elem-name attr-name attr-name attr-name ...) ... ) ;; i.e. ;; id-attrs = (list ;; (cons ;; elem-name ;; (list attr-name attr-name attr-name ...) ;; (cons ;; elem-name ;; (list attr-name attr-name attr-name ...) ;; ...) ;; where ;; elem-name - (a symbol) a name of the element ;; attr-name - (a symbol) element's attribute having an ID type ;; ;; On the second step, if an SXML presentation of the document is available, ;; 'id-attrs' are used for forming an 'id-index'. ;; If there is no SXML presentation for a document yet, both steps are ;; performed as a single function call - to a specialized SSAX parser. ;; This parser constructs an SXML presentation and an 'id-index' ;; in a single pass ;; ;; ATTENTION: ;; 1. Only non-qualified 'elem-name' and 'attr-name' are correctly supported ;; 2. Parameter entity reference (PEReference) is NOT supported ;;------------------------------------------------------------------------------- ;;!! Functions which read XML document declaration ;; Trivial functions that ignore symbols ;;! Function reads a whitespace (S production) (define (id:process-s port) (let ((symb (peek-char port))) (cond((eof-object? symb) symb) ((char=? symb #\space) (read-char port) (id:process-s port)) ((char=? symb #\return) (read-char port) (id:process-s port)) ((char=? symb #\newline)(read-char port) (id:process-s port)) ((char=? symb #\tab)(read-char port) (id:process-s port)) (else symb)))) ;;! Ignores all symbols until template-symbol (define (id:ignore-until templ-sym port) (let loop ((symb (peek-char port))) (cond((eof-object? symb) symb) ((equal? symb templ-sym) (read-char port) symb) (else (read-char port) (loop (peek-char port)))))) ;;------------------------------------------------------------------------------- ;;!! These functions perform reading from a file ;;! Read N symbols from a port (define (id:read-n num port) (id:process-s port) (let loop ((num num) (res '())) (if(= num 0) (list->string (reverse res)) (let((symb (peek-char port))) (cond((eof-object? symb) symb) (else (read-char port) (loop (- num 1) (cons symb res)))))))) ;;! This function reads a name - a sequence of characters ending with ;; a whitespace or '<'. '>', '(', ')', '[', ']', '|' (define (id:read-name port) (id:process-s port) (let loop ((res "")) (let ((symb (peek-char port))) (cond((eof-object? symb) res) ((member symb '(#\space #\tab #\return #\newline #\< #\> #\( #\) #\[ #\] #\|)) res) (else (loop (string-append res (string (read-char port))))))))) ;;! This function reads a literal ;; literal ::= ('"' [^"]* '"') | ("'" [^']* "'") ;; A string is returned (define (id:process-literal port) (id:process-s port) (let((quot (peek-char port))) (if(eof-object? quot) ; an incorrect situaltion "" (let((quot (if (char=? (read-char port) #\") #\" #\'))) (let loop ((res '())) (let((symb (peek-char port))) (cond ((eof-object? symb) (list->string (reverse res))) ((char=? symb quot) ; end of the string (read-char port) (list->string (reverse res))) (else (read-char port) (loop (cons symb res)))))))))) ;;------------------------------------------------------------------------------- ;;!! Miscellaneous ;;! Converts a string into small letters (define (id:to-small str) (let loop ((arg (string->list str)) (res '())) (cond((null? arg) (list->string (reverse res))) ((char-upper-case? (car arg)) (loop (cdr arg) (cons (char-downcase (car arg)) res))) (else (loop (cdr arg) (cons (car arg) res)))))) ;;! Takes an 'id-attrs' which can contain equal element names ;; Returns a new 'id-attrs' where all element names are unique (define (id:unite-id-attrs id-attrs) (let loop ((id-attrs id-attrs) (new '())) (if (null? id-attrs) new (let rpt ((elem-name (caar id-attrs)) (atts (cdar id-attrs)) (rest (cdr id-attrs)) (id-attrs '())) (cond ((null? rest) (loop id-attrs (cons (cons elem-name atts) new))) ((equal? (caar rest) elem-name) (rpt elem-name (append atts (cdar rest)) (cdr rest) id-attrs)) (else (rpt elem-name atts (cdr rest) (cons (car rest) id-attrs)))))))) ;;------------------------------------------------------------------------------- ;;!! Parsing XML productions concerning document declaration ;; These functions are not intendes for error detection, they assume that ;; the document is correct ;;! This function ignores information related to a PI production [16] ;; [16] PI ::= '<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>' ;; It looks for an ending '?>' template (define (id:ignore-PI port) (id:ignore-until #\? port) (let ((symb (peek-char port))) (cond((eof-object? symb) symb) ((equal? symb #\>) (read-char port) symb) (else (id:ignore-PI port))))) ;;! This function ignores information related to a Comment production [15] ;; [15] Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->' ;; The starting '<!' has been already processed ;; The function looks for an ending '-->' template (define (id:ignore-comment port) (read-char port) ; it is '-' (read-char port) ; it is '-' (id:ignore-until #\- port) (let((sym1 (peek-char port))) (cond((eof-object? sym1) sym1) ((char=? sym1 #\-) (read-char port) (let((sym2 (read-char port))) ; must be '>' sym2)) (else (id:ignore-comment port))))) ;;! This function processes AttType production ([54]-[59] in XML specification) ;; [54] AttType ::= StringType | TokenizedType | EnumeratedType ;; [55] StringType ::= 'CDATA' ;; [56] TokenizedType ::= 'ID' | 'IDREF' | 'IDREFS' | 'ENTITY' ;; | 'ENTITIES' | 'NMTOKEN' | 'NMTOKENS' ;; [57] EnumeratedType ::= NotationType | Enumeration ;; [58] NotationType ::= 'NOTATION' S '(' S? Name (S? '|' S? Name)* S? ')' ;; [59] Enumeration ::= '(' S? Nmtoken (S? '|' S? Nmtoken)* S? ')' ;; The function returnd #t if the attribute has an ID type and #f otherwise (define (id:AttType-ID? port) (let((type (id:to-small (id:read-name port)))) (cond((string=? type "id") #t) ((string=? type "notation") (id:process-s port) (read-char port) ; it is #\( (id:ignore-until #\) port) #f) ((and (string=? type "") (char=? (peek-char port) #\()) ; see [59] (id:ignore-until #\) port) #f) (else #f)))) ;;! This function processes DefaultDecl production ([60] in XML specification) ;; [60] DefaultDecl ::= '#REQUIRED' ;; | '#IMPLIED' ;; | (('#FIXED' S)? AttValue) ;; The result is always #t (define (id:process-DefaultDecl port) (let((type (id:to-small (id:read-name port)))) (cond((string=? type "#fixed") (id:read-name port) ; reads a default value #t) (else #t)))) ;;! This function processes AttDef production ([53] in XML specification) ;; [53] AttDef ::= S Name S AttType S DefaultDecl ;; If an attribute has an ID type, (list attribule-name) is returned ;; (a list of one element). Otherwise, function returns an empty list (define (id:process-AttDef port) (let((att-name (string->symbol (id:read-name port)))) (let((bool (id:AttType-ID? port))) (id:process-DefaultDecl port) (if bool (list att-name) '())))) ;;! The function processes AttlistDecl production ([52] in XML specification) ;; [52] AttlistDecl ::= '<!ATTLIST' S Name AttDef* S? '>' ;; The starting '<!ATTLIST' has been already processed ;; 'id-attrs' are returned as a result (define (id:process-AttlistDecl port) (let((element-name (string->symbol (id:read-name port)))) (let loop ((atts '())) (id:process-s port) (cond((char=? (peek-char port) #\>) ; no more attributes will be declared (read-char port) (if(null? atts) '() (list (cons element-name atts)))) (else (loop (append (id:process-AttDef port) atts))))))) ;;! This function processes a multiple markupdecl production [29] ;; [29] markupdecl ::= elementdecl | AttlistDecl | EntityDecl ;; | NotationDecl | PI | Comment ;; 'id-attrs' are returned as a result (define (id:process-markupdecl* port) (let loop ((id-attrs '())) (let ((beg (id:read-n 2 port))) (cond((eof-object? beg) id-attrs) ; the file is over ((string=? beg "]>") id-attrs) ; the end of the markupdecl ((string=? beg "<?") ; processing instruction (id:ignore-PI port) (loop id-attrs)) ((and (string=? beg "<!") (char=? (peek-char port) #\-)) ; a comment (id:ignore-comment port) (loop id-attrs)) ((string=? beg "<!") ; AttlistDecl or any other declarations (let ((name (id:to-small (id:read-name port)))) (cond((string=? name "attlist") (loop (append (id:process-AttlistDecl port) id-attrs))) (else (id:ignore-until #\> port) (loop id-attrs))))) (else ; an error condition (display (string-append "Error in markupdecl production: unexpected " beg "\n") (current-error-port)) (id:ignore-until #\> port) id-attrs))))) ;;! This function processes a doctypedecl production ([75] in XML specification) ;; [75] ExternalID ::= 'SYSTEM' S SystemLiteral ;; | 'PUBLIC' S PubidLiteral S SystemLiteral ;; The function ignores a PubidLiteral ;; 'id-attrs' are returned as a result (define (id:process-ExternalID port) (let((system-literal (let((name (id:to-small (id:read-name port)))) (cond ((string=? name "system") (id:process-literal port)) ((string=? name "public") (id:process-literal port) (id:process-literal port)) (else #f))))) (if(not system-literal) '() ; an incorrect situation (let((external-port (open-input-resource system-literal))) (if(not external-port) '() ; a failure (let((id-attrs (id:process-markupdecl* external-port))) (close-input-port external-port) id-attrs)))))) ;;! This function processes a doctypedecl production ([28] in XML specification) ;; [28] doctypedecl ::= '<!DOCTYPE' S Name (S ExternalID)? ;; S? ('[' (markupdecl | DeclSep)* ']' S?)? '>' ;; The function doesn't process a DeclSep (this is a PEReference which ;; this programme doesn't support) ;; The starting '<!DOCTYPE' has been already processed ;; 'id-attrs' are returned as a result (define (id:process-doctypedecl port) (let((name (id:read-name port))) ; root element's name (id:process-s port) (let((symb (peek-char port))) (cond ((eof-object? symb) '()) ; an incorrect situation ((char=? symb #\[) (read-char port) (id:process-markupdecl* port)) (else (let((id-attrs (id:process-ExternalID port))) (id:process-s port) (let((symb (peek-char port))) (cond ((eof-object? symb) id-attrs) ; an incorrect situation ((char=? symb #\[) (read-char port) (append id-attrs (id:process-markupdecl* port))) (else ; an incorrect situation id-attrs))))))))) ;;! This function processes a prolog production ([22] in XML specification) ;; [1] document ::= prolog element Misc* ;; [22] prolog ::= XMLDecl? Misc* (doctypedecl Misc*)? ;; [23] XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>' ;; [27] Misc ::= Comment | PI | S ;; 'id-attrs' are returned as a result (define (id:process-prolog port) (let((beg (id:read-n 2 port))) (cond((eof-object? beg) '()) ; a file is over - strange... ((string=? beg "<?") ; PI or XMLDecl (id:ignore-PI port) (id:process-prolog port)) ((and (string=? beg "<!") (char=? (peek-char port) #\-)) ; a comment (id:ignore-comment port) (id:process-prolog port)) ((string=? beg "<!") ; doctypedecl expected (let ((name (id:to-small (id:read-name port)))) (cond((string=? name "doctype") (id:process-doctypedecl port)) (else (display "doctypedecl production expected\n" (current-error-port)) '())))) (else ; element begins, there was no doctypedecl '())))) ;;------------------------------------------------------------------------------- ;;!! Two-step id-index creation (user level functions) ;; We use this variant when we already have an SXML presentation of the ;; document ;; The first step - creating 'id-attrs' ;;! Read the DTD ;; uri-string - a URI for the DTD location (a string) ;; 'id-attrs' are returned as a result (define (id:read-external-dtd uri-string) (let((port (open-input-resource uri-string))) (if(not port) '() ; a situation of an error (let((id-attrs (id:unite-id-attrs (id:process-markupdecl* port)))) (close-input-port port) id-attrs)))) ;;! Read the declaration from the document's prolog. ;; If prolog contains a reference to an external DTD, it is processed either ;; uri-string - a URI for the document location (a string) ;; 'id-attrs' are returned as a result (define (id:read-document-declaration uri-string) (let((port (open-input-resource uri-string))) (if(not port) '() ; a situation of an error (let((id-attrs (id:unite-id-attrs (id:process-prolog port)))) (close-input-port port) id-attrs)))) ;;------------------------------------------------------------------------------- ;;!! The second step - creating an 'id-index' using 'id-attrs' ;;! This function forms an 'id-index' and inserts it in the document ;; document - a root node of the document (SXML presentation) ;; id-attrs - the result of the previous step ;; A new SXML document is returned. It contains an auxiliary list with an ;; 'id-index subtree. If the source document already contains such a ;; subtree, it will be replaced. Other subtrees in an auxiliary list will ;; remain unchanged. (define (SXML->SXML+id document id-attrs) (define (cons* a1 a2 . rest) (if (null? rest) (cons a1 a2) (cons a1 (apply cons* (cons a2 rest))))) (let((aux-subtrees (let((aux ((select-kids (ntype?? '@@)) document))) (if(null? aux) '() (let rpt ((res '()) (to-see (cdar aux))) (cond ((null? to-see) (reverse res)) ((equal? (caar to-see) 'id-index) (rpt res (cdr to-see))) (else (rpt (cons (car to-see) res) (cdr to-see))))))))) (let loop ((nodeset (list document)) (id-index '())) (if(null? nodeset) (let ((kids ((select-kids (lambda (node) (not (and (pair? node) (equal? (car node) '@@))))) document))) (cons* '*TOP* (cons* '@@ (cons 'id-index id-index) aux-subtrees) kids)) (let((cur-node (car nodeset))) (cond ((not (pair? cur-node)) ; a text node (loop (cdr nodeset) id-index)) ((assoc (car cur-node) id-attrs) => (lambda (lst) (let((id-values ((select-kids (lambda (x) #t)) ((sxml:filter (lambda (x) (member (car x) (cdr lst)))) ((select-kids (lambda (x) #t)) ((select-kids (ntype?? '@)) cur-node)))))) (loop (append ((select-kids (ntype?? '*)) (car nodeset)) (cdr nodeset)) (append id-index (map (lambda (x) (cons x cur-node)) id-values)))))) (else (loop (append ((select-kids (ntype?? '*)) (car nodeset)) (cdr nodeset)) id-index)))))))) ;;------------------------------------------------------------------------------- ;;!! Some stuff for a SSAX multi parser ;; Id-related part of the seed ;; id:seed = (list id-attrs id-index) ;; id-attrs, id-index - see a head comment ;;! Mutator (define (id:make-seed id-attrs id-index) (list id-attrs id-index)) ;;! Accessors (define (id:seed-attrs id:seed) (car id:seed)) (define (id:seed-index id:seed) (cadr id:seed)) ;;------------------------------------------------------------------------------- ;;!! Handler units ;;! This function is called by the NEW-LEVEL-SEED handler ;; A new 'id:seed' is returned (define (id:new-level-seed-handler id:seed) id:seed) ;;! This function is called by the FINISH-ELEMENT handler ;; A new 'id:seed' is returned (define (id:finish-element-handler elem-gi attributes id:seed element) (cond ((assoc elem-gi (id:seed-attrs id:seed)) => (lambda (lst) (let loop ((atts attributes) (id-index (id:seed-index id:seed))) (if (null? atts) (id:make-seed (id:seed-attrs id:seed) id-index) (let((att (car atts))) (cond ((pair? (car att)) ; namespace aware (loop (cdr atts) id-index)) ((member (car att) (cdr lst)) (loop (cdr atts) (cons (cons (cdr att) element) id-index))) (else (loop (cdr atts) id-index)))))))) (else id:seed))) ;;! This function is called by the DOCTYPE handler ;; A new 'id:seed' is returned (define (id:doctype-handler port systemid internal-subset?) (let((id-attrs (if (not systemid) '() ; systemid not supplied (let((external-port (open-input-resource systemid))) (if (not external-port) '() ; a failure (let((id-attrs (id:process-markupdecl* external-port))) (close-input-port external-port) id-attrs)))))) (let((id-attrs (if internal-subset? (id:unite-id-attrs (append id-attrs (id:process-markupdecl* port))) (id:unite-id-attrs id-attrs)))) (id:make-seed id-attrs '())))) ;;! This function constructs the member of an axuiliary list (define (id:ending-action id:seed) (let((id-index (id:seed-index id:seed))) (cons 'id-index id-index)))
false
eb4667cfcfe961d536018b5c74e2fe43b7ca76f8
86092887e6e28ebc92875339a38271319a87ea0d
/Ch2/2_6.scm
4d4c0425dc48c2b26c28fc1f5c624879fe7fbeb1
[]
no_license
a2lin/sicp
5637a172ae15cd1f27ffcfba79d460329ec52730
eeb8df9188f2a32f49695074a81a2c684fe6e0a1
refs/heads/master
2021-01-16T23:55:38.885463
2016-12-25T07:52:07
2016-12-25T07:52:07
57,107,602
1
0
null
null
null
null
UTF-8
Scheme
false
false
213
scm
2_6.scm
(define one (lambda (f) (lambda (x) (f x)))) (define two (lambda (f) (lambda (x) (f (f x))))) (define (plus x y) (lambda (f) (lambda (x) ((two f) ((one f) x))))) (define (inc x) (+ x 1)) (((plus one two) inc) 0)
false
91fe6457760147256359494f650d64ec7b09c543
c157305e3b08b76c2f4b0ac4f9c04b435097d0dc
/eopl2e/code/interps/2-2-1.scm
47ba60a14bc81ff2652f6f98b5ba9488ab6c478f
[]
no_license
rstewart2702/scheme_programs
a5e91bd0e1587eac3859058da18dd9271a497721
767d019d84896569f2fc02de95925b05a38cac4d
refs/heads/master
2021-05-02T02:01:01.964797
2014-03-31T19:02:36
2014-03-31T19:02:36
13,077,035
0
1
null
null
null
null
UTF-8
Scheme
false
false
1,031
scm
2-2-1.scm
(let ((time-stamp "Time-stamp: <2000-12-11 16:29:55 wand>")) (eopl:printf "2-2-1.scm ~a~%" (substring time-stamp 13 29))) (define-datatype bintree bintree? (leaf-node (datum number?)) (interior-node (key symbol?) (left bintree?) (right bintree?))) (define-datatype s-list s-list? (empty-s-list) (non-empty-s-list (first symbol-exp?) (rest s-list?))) (define-datatype symbol-exp symbol-exp? (symbol-symbol-exp (data symbol?)) (s-list-symbol-exp (data s-list?))) ;;; This definition of s-list is not snippetized (ignore if not author) (define-datatype s-list s-list? (an-s-list (data (list-of symbol-exp?)))) (define list-of (lambda (pred) (lambda (val) (or (null? val) (and (pair? val) (pred (car val)) ((list-of pred) (cdr val))))))) (define leaf-sum (lambda (tree) (cases bintree tree (leaf-node (datum) datum) (interior-node (key left right) (+ (leaf-sum left) (leaf-sum right))))))
false
0ec6e9b930ee5311374c7cbbbf54442f7bb81b22
03e4064a7a55b5d00937e74cddb587ab09cf7af9
/nscheme/old/old-5/lib/backend-racket.scm
466e34152aa5c72d1dc15f4f31009523bb2d1031
[ "BSD-2-Clause" ]
permissive
gregr/ina
29f28396cd47aa443319147ecde5235d11e1c3d1
16188050caa510899ae22ff303a67897985b1c3b
refs/heads/master
2023-08-25T13:31:44.131598
2023-08-14T16:46:48
2023-08-14T16:46:48
40,606,975
17
0
null
null
null
null
UTF-8
Scheme
false
false
1,707
scm
backend-racket.scm
((provide ast->racket-datum)) (define (vsym p) (string-append 'v. p)) (define (datum->racket-datum datum) (cond ((pair? datum) (cons (datum->racket-datum (car datum)) (datum->racket-datum (cdr datum)))) ((vector? datum) (vector 'vector (list->vector (map datum->racket-datum (vector->list datum))))) ((string? datum) (vector 'string datum)) (#t datum))) (define (ast->racket-datum ast) (define alen (- (vector-length ast) 1)) (define (@ i) (vector-ref ast i)) (define (@^ i) (ast->racket-datum (@ i))) (define (? tag) (equal? tag (@ 0))) (define (binding n a) (list (vsym n) (ast->racket-datum a))) (define (body e) (if (and (pair? e) (equal? 'begin (car e))) (cdr e) (list e))) ;; Assume: set! param is a name; lambda param and apply arg are lists. (cond ((? 'quote ) (if (or (boolean? (@ 1)) (number? (@ 1))) (@ 1) (list 'quote (datum->racket-datum (@ 1))))) ((? 'var ) (vsym (@ 1))) ((? 'set! ) (list 'set! (vsym (@ 1)) (@^ 2))) ((? 'if ) (list 'if (@^ 1) (@^ 2) (@^ 3))) ((? 'apply ) (cons (@^ 1) (map ast->racket-datum (@ 2)))) ((? 'lambda) (list* 'lambda (map vsym (@ 1)) (body (@^ 2)))) ((? 'prim ) (cons (@ 1) (map ast->racket-datum (@ 2)))) ((? 'begin ) (cons 'begin (append (map ast->racket-datum (@ 1)) (list (ast->racket-datum (@ 2)))))) ((or (? 'let) (? 'letrec)) (list* (@ 0) (map binding (@ 1) (@ 2)) (body (@^ 3)))) (#t (error '"unknown ast:" ast))))
false
d272ee9c175b56440814d786164d836f0666572e
35f859a6933537955f878e97455cd45b312aa042
/example/processing/learning/getting-started/template.scm
097a35ea7c3834d10347964cab60302b7febbb7e
[]
no_license
podhmo/gauche-gl-processing
ebbbe2631830cb7d0e62b5e5aa0275bb176c7084
d57b9c055d2dfe199df5652e1afb0cfd1713257f
refs/heads/master
2021-01-23T08:38:44.547876
2010-10-13T08:40:19
2010-10-13T08:40:19
null
0
0
null
null
null
null
UTF-8
Scheme
false
false
211
scm
template.scm
(use gl.processing) (define draw (draw-once$ (^ () ) :save ".png")) (define main (setup$ (^ () ) :draw draw)) (main '())
false
bb589422297d07e69b0980ba5aba2e326619f8b3
defeada37d39bca09ef76f66f38683754c0a6aa0
/UnityEngine/unity-engine/wait-for-end-of-frame.sls
e41129751a5672a32816dcfb19ec5e5b6844b84f
[]
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
397
sls
wait-for-end-of-frame.sls
(library (unity-engine wait-for-end-of-frame) (export new is? wait-for-end-of-frame?) (import (ironscheme-clr-port)) (define-syntax new (lambda (e) (syntax-case e () ((_ a ...) #'(clr-new UnityEngine.WaitForEndOfFrame a ...))))) (define (is? a) (clr-is UnityEngine.WaitForEndOfFrame a)) (define (wait-for-end-of-frame? a) (clr-is UnityEngine.WaitForEndOfFrame a)))
true
1137573b697922bec52e68af1c68cf26eb7ba6a9
defeada37d39bca09ef76f66f38683754c0a6aa0
/System/system/io/kevent-data.sls
39e7cb0f3efe4967dd41dfc2ea072ec9cccf9220
[]
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,901
sls
kevent-data.sls
(library (system io kevent-data) (export new is? kevent-data? fsw-get fsw-set! fsw-update! directory-get directory-set! directory-update! file-mask-get file-mask-set! file-mask-update! include-subdirs?-get include-subdirs?-set! include-subdirs?-update! enabled?-get enabled?-set! enabled?-update! dir-entries-get dir-entries-set! dir-entries-update! ev-get ev-set! ev-update!) (import (ironscheme-clr-port)) (define-syntax new (lambda (e) (syntax-case e () ((_ a ...) #'(clr-new System.IO.KeventData a ...))))) (define (is? a) (clr-is System.IO.KeventData a)) (define (kevent-data? a) (clr-is System.IO.KeventData a)) (define-field-port fsw-get fsw-set! fsw-update! () System.IO.KeventData FSW System.IO.FileSystemWatcher) (define-field-port directory-get directory-set! directory-update! () System.IO.KeventData Directory System.String) (define-field-port file-mask-get file-mask-set! file-mask-update! () System.IO.KeventData FileMask System.String) (define-field-port include-subdirs?-get include-subdirs?-set! include-subdirs?-update! () System.IO.KeventData IncludeSubdirs System.Boolean) (define-field-port enabled?-get enabled?-set! enabled?-update! () System.IO.KeventData Enabled System.Boolean) (define-field-port dir-entries-get dir-entries-set! dir-entries-update! () System.IO.KeventData DirEntries System.Collections.Hashtable) (define-field-port ev-get ev-set! ev-update! () System.IO.KeventData ev System.IO.kevent))
true
9b8c6415405b860a4ebcf227ee12781ba792028a
8c4c89fe51548176e8dbe8a736066e6d00e09c44
/scratch/showtree.scm
65c882a9490cc37b3b614ce0ba90aa7f6ee146d9
[ "BSD-3-Clause" ]
permissive
caelia/civet
f5b59c979a035a18cba9beae2043e02ccddcbc9d
2b93395539207f7c531f89887207fcf9e3651985
refs/heads/master
2023-08-19T08:57:55.135790
2013-10-09T12:14:48
2013-10-09T12:14:48
null
0
0
null
null
null
null
UTF-8
Scheme
false
false
896
scm
showtree.scm
(use ssax) (define nsmap '((#f . "http://www.w3.org/1999/xhtml") (cvt . "http://xmlns.therebetygers.net/civet/0.1"))) (define (show-tree t) (print "[TREE]\n") (pp t) (if (or (null? t) (string? t) (symbol? t)) (print "\n==============================================\n") (let ((head (car t)) (tail (cdr t))) (print "\n----------------------------------------------\n") (print "[HEAD]\n") (pp head) (print "\n----------------------------------------------\n") (print "[TAIL]\n") (pp tail) (print "\n==============================================\n") (when (list? head) (show-tree head)) (show-tree tail)))) (define (run file) (let ((doc (with-input-from-file file (lambda () (ssax:xml->sxml (current-input-port) nsmap))))) (show-tree doc))) (run (cadr (argv)))
false
5925ecf6fc6c51b17e22aebd0649efb0b402a34b
5e493d4a30203bb6f3956c4bced78d170d3037e5
/examples/life.scm
a53f3aa67f8a43d4ecee6f71910319fe8c294b04
[ "Zlib" ]
permissive
nymacro/gerbil-sdl2
c88e9e0053fa1230124ead7bcdbe7e6a18b92761
ed03678de77807146718d4d23397ec12fd593cc0
refs/heads/master
2020-04-18T05:56:58.013319
2019-07-10T11:20:07
2019-08-31T12:01:20
167,298,892
0
0
null
null
null
null
UTF-8
Scheme
false
false
9,541
scm
life.scm
;;;; gambit-sdl2 Game of Life ;;;; Copyright (C) 2019 Aaron Marks. All Rights Reserved. (declare (r5rs-scheme) (block) (standard-bindings) (extended-bindings) (fixnum) (run-time-bindings) (not safe)) (##include "~~lib/_syntax.scm") (load "sdl2") (##include "life_shared.scm") (SDL_Init SDL_INIT_VIDEO) ;;;; helper functions (define (1+ x) (+ x 1)) (define (fx1+ x) (fx+ x 1)) (define (1- x) (- x 1)) (define (fx1- x) (fx- x 1)) (define fx/ fxquotient) (define displayln (case-lambda ((str port) (display str port)(newline port)) ((str) (display str)(newline)))) (define-syntax with-mutex (syntax-rules () ((_ mtx x xs ...) (begin (dynamic-wind (lambda () (mutex-lock! mtx)) (lambda () x xs ...) (lambda () (mutex-unlock! mtx))))))) ;;;; setup (define window-width 800) (define window-height 600) (define block-width 8) (define block-height 8) (define arena-width (fx/ window-width block-width)) (define arena-height (fx/ window-height block-height)) (define (draw-block x y renderer #!optional (intensity 0)) (SDL_SetRenderDrawColor renderer intensity 0 0 255) (SDL_RenderFillRect renderer (make-temp-rect x y block-width block-height))) (define (make-arena) (make-u8vector (fx* arena-width arena-height) 0)) (define (arena-idx* x y) (let ((xx (if (fx< x 0) (fx+ x arena-width) x)) (yy (if (fx< y 0) (fx+ y arena-height) y))) (fx+ (fx* (fxmodulo yy arena-height) arena-width) (fxmodulo xx arena-width)))) (define-syntax life-alive-p (syntax-rules () ((_ x) (fx= x 255)))) (define-syntax life-drain (syntax-rules () ((_ x) (cond ((fx> x 0) (max 0 (fx- x 16))) (else 0))))) (define-syntax for-arena (syntax-rules () ((for-arena (x y) stmt stmts ...) (for (y 0 arena-height) (for (x 0 arena-width) stmt stmts ...))))) (define (arena-ref arena x y) (u8vector-ref arena (arena-idx* x y))) (define (arena-set! arena x y v) (u8vector-set! arena (arena-idx* x y) v)) (define (arena-randomize! arena) (for-arena (x y) (let* ((random-value (random-integer 2)) (value (if (fx= 0 (modulo random-value 2)) 0 255))) (arena-set! arena x y value)))) (define (arena-clear! arena) (for-arena (x y) (arena-set! arena x y 0))) (define (arena-render arena renderer) (for-arena (x y) (let ((alive (arena-ref arena x y))) (draw-block (fx* block-width x) (fx* block-height y) renderer alive)))) (define (arena-display arena) (for (y 0 arena-height) (for (x 0 arena-width) (if (arena-ref arena x y) (display "X") (display "."))) (newline))) ;;;; Conway's Game of Life ;;;; ;;;; Events happen simultaneously ;;;; 1. Alive cells with fewer than 2 neighbours die. ;;;; 2. Alive cells with 2-3 neighbours lives. ;;;; 3. Alive cells with greater than 3 neighbours die. ;;;; 4. Dead cells with exacly three live neighbours comes to life. (define (life-tick-state alive neighbours) (let ((alivep (life-alive-p alive))) (cond ((and alivep (< neighbours 2)) (life-drain alive)) ((and alivep (> neighbours 3)) (life-drain alive)) ((and (not alivep) (= neighbours 3)) 255) (else (if (life-alive-p alive) alive (life-drain alive)))))) (define (life-tick-inner arena x y) (let* ((alive (arena-ref arena x y)) (neighbours (arena-surrounds-alive arena x y))) (life-tick-state alive neighbours))) (define (life-tick arena) (let ((new-arena (make-arena))) (for-arena (x y) (arena-set! new-arena x y (life-tick-inner arena x y))) new-arena)) (define (life-tick-pause arena) (let ((new-arena (make-arena))) (for-arena (x y) (let ((alive (arena-ref arena x y))) (arena-set! new-arena x y (if (life-alive-p alive) alive (life-drain alive))))) new-arena)) ;; return number of alive neighbours for a cell (define (arena-surrounds-alive arena x y) (let ((alive 0)) (for (yy 0 3) (for (xx 0 3) (let* ((get-x (1- (fx+ x xx))) (get-y (1- (fx+ y yy))) (self (and (= get-x x) (= get-y y))) (alivep (life-alive-p (arena-ref arena get-x get-y)))) (when (and alivep (not self)) (set! alive (1+ alive)))))) alive)) (define arena (make-arena)) (arena-randomize! arena) (let* ((window (SDL_CreateWindow "Game of Life" 0 0 window-width window-height 0)) (fullscreen #f) (toggle-fullscreen (lambda () (set! fullscreen (not fullscreen)) (SDL_SetWindowFullscreen window (if fullscreen SDL_TRUE SDL_FALSE)))) (renderer (SDL_CreateRenderer window -1 SDL_RENDERER_SOFTWARE)) (event (make-SDL_Event)) (running #t) (current-time (SDL_GetTicks)) (frame-limiter (make-frame-limiter 30 current-time)) (frame-counter (make-frame-counter current-time)) (frame-rate 0) (pause #f) (mtx (make-mutex)) (life-action (lambda () (let* ((current-time (SDL_GetTicks)) (life-counter (make-frame-counter current-time)) (life-limiter (make-frame-limiter 60 current-time)) (last-rate 0)) (let loop () (let* ((current-time (SDL_GetTicks)) (count (life-counter current-time)) (delay-time (life-limiter current-time))) (when (not (fx= last-rate count)) (displayln (string-append "life: " (object->string count))) (set! last-rate count)) (thread-sleep! (/ delay-time 1000)) (with-mutex mtx (if pause (set! arena (life-tick-pause arena)) (set! arena (life-tick arena))))) (loop))))) (life-thread (thread-start! (make-thread life-action "life-tick")))) ;; main loop (let loop () (let* ((current-time (SDL_GetTicks)) (delay-time (frame-limiter current-time)) (new-frame-rate (frame-counter current-time))) (when (not (fx= frame-rate new-frame-rate)) (displayln (string-append "fps: " (object->string new-frame-rate))) (set! frame-rate new-frame-rate)) (thread-sleep! (/ delay-time 1000)) ;; redraw (with-mutex mtx (arena-render arena renderer) (SDL_RenderPresent renderer)) (let event-loop () (let* ((e (SDL_PollEvent event)) (event-type (SDL_Event#type event))) (when (fx> e 0) (cond ((fx= event-type SDL_MOUSEBUTTONDOWN) (let* ((button-event (SDL_Event#button-ref event)) (button (SDL_MouseButtonEvent#button button-event)) (x (SDL_MouseButtonEvent#x button-event)) (y (SDL_MouseButtonEvent#y button-event)) (block-x (fx/ x block-width)) (block-y (fx/ y block-height))) (with-mutex mtx (arena-set! arena block-x block-y (if (life-alive-p (arena-ref arena block-x block-y)) 0 255))))) ((fx= event-type SDL_KEYDOWN) (let* ((keyboard-event (SDL_Event#key-ref event)) (keysym (SDL_KeyboardEvent#keysym-ref keyboard-event)) (key-code (SDL_Keysym#sym keysym))) (cond ((fx= key-code SDLK_RETURN) (with-mutex mtx (arena-randomize! arena))) ((fx= key-code SDLK_SPACE) (set! pause (not pause)) (if pause (displayln "Paused. Press space to unpause.") (displayln "Unpaused. Press space to pause."))) ((fx= key-code SDLK_c) (arena-clear! arena)) ((fx= key-code SDLK_r) ;; launch REPL on C-r (unless (zero? (bitwise-and (SDL_Keysym#mod keysym) KMOD_CTRL)) (when fullscreen toggle-fullscreen) (##continuation-capture (lambda (cont) (##repl-within cont #f #f))))) ((fx= key-code SDLK_ESCAPE) (displayln "Escape key pressed. Exiting") (set! running #f)) ((fx= key-code SDLK_f) (toggle-fullscreen)) (else (displayln (string-append "Unhandled key:" (object->string (if (< key-code 256) (integer->char key-code) key-code)))))))) ((fx= event-type SDL_QUIT) (set! running #f))) (event-loop))))) (when running (loop))) (thread-terminate! life-thread)) (##gc) (SDL_Quit) (displayln "Goodbye :(")
true
5fdf4e5ea6e7aa56709d285f90529efc51c00e47
1ed47579ca9136f3f2b25bda1610c834ab12a386
/sec5/sec5.4.scm
bcf70304f4cd7eee313dc5b6b3f21a08eff1e623
[]
no_license
thash/sicp
7e89cf020e2bf5ca50543d10fa89eb1440f700fb
3fc7a87d06eccbe4dcd634406e3b400d9405e9c4
refs/heads/master
2021-05-28T16:29:26.617617
2014-09-15T21:19:23
2014-09-15T21:19:23
3,238,591
0
1
null
null
null
null
UTF-8
Scheme
false
false
41
scm
sec5.4.scm
sec5.4-The-Explicit-Control-Evaluator.scm
false
11d8b2d952981eccf1455379d71242aa8c6690b3
de8566db6f92103165b07a24ceacf8b20a7ac542
/sc/scx2lol/scx2lol.scm
1cf1773625a1871cb5e846efabc9cf2ae0c8738b
[]
no_license
Irwin1985/cerbo
a786ab8af9e4b2f139898bd1ddf557fb6d89b5dd
559df220dc842318c4c2d81100b56bf6587c91a6
refs/heads/master
2022-09-01T15:46:17.400733
2020-05-27T19:21:37
2020-05-27T19:21:37
null
0
0
null
null
null
null
UTF-8
Scheme
false
false
1,922
scm
scx2lol.scm
(require-extension srfi-1) ;;(require-extension foof-loop) (require-extension srfi-34) ;exceptions ;;(require-extension srfi-25) ; multi-dimensional arrays (require-extension srfi-42) ; eager comprehensions ;;(require-extension srfi-47) (require-extension srfi-63) ; arrays (require-extension mccsl) ;(load "~/repos/tacc/mccsl/mccsl.scm") ;(import mccsl) ;;(define foo '()) ;;(addend! foo 12) (define (simplify-sc-entry entry) (define pos (second entry)) (define col (second pos)) (define row (third pos)) (define val (third entry)) (list row (- col 1) val)) (define (collect-unthrown func alist) (define result '()) (for-each (lambda (el) (with-exception-handler (lambda (x) #f) (lambda () (addend! result (func el))))) alist) result) (define (sc-lol p) ; make a list-of-lists from an input port (define sexpr (read p)) (define cells (collect-unthrown simplify-sc-entry sexpr)) (set! cells (filter (lambda (x) (atom? (third x))) cells)) (define nrows (+ 1 (apply max (map first cells)))) (define ncols (+ 1 (apply max (map second cells)))) ;(define ar (make-array (shape 0 nrows 0 ncols) '())) (define ar (make-array '#(()) nrows ncols)) (for-each (lambda (x) ;;(print x) (array-set! ar (third x) (first x) (second x) )) cells) ; (define lol (list-ec (: r 0 nrows) ; (list-ec (: c 0 ncols) ; (array-ref ar r c)))) (define lol (array->list ar)) lol) ;;(define result (call-with-input-file "~/repos/tacc/sc/scpt/examples/output" sc-lol)) ;;(current-input-port) (define debug #f) (if debug (begin (write (call-with-input-file "~/repos/tacc/sc/scpt/examples/output" sc-lol))) (begin (write (sc-lol (current-input-port)))))
false
492ed29762e0a3feb15b2b26ceebf01563351690
f4cf5bf3fb3c06b127dda5b5d479c74cecec9ce9
/Sources/LispKit/Resources/Libraries/srfi/217.sld
e806142f44cc4877d9d1edc36a2d54e9ec7cd288
[ "Apache-2.0" ]
permissive
objecthub/swift-lispkit
62b907d35fe4f20ecbe022da70075b70a1d86881
90d78a4de3a20447db7fc33bdbeb544efea05dda
refs/heads/master
2023-08-16T21:09:24.735239
2023-08-12T21:37:39
2023-08-12T21:37:39
57,930,217
356
17
Apache-2.0
2023-06-04T12:11:51
2016-05-03T00:37:22
Scheme
UTF-8
Scheme
false
false
52,189
sld
217.sld
;;; SRFI 217 ;;; Integer Sets ;;; ;;; Integer sets, or isets, are unordered collections of fixnums. Fixnums are ;;; exact integers within certain implementation-specified bounds. ;;; ;;; While it is perfectly practical to store integers in SRFI-113 sets, other ;;; algorithms can be used to represent sets of exact integers. This SRFI is ;;; almost a drop-in replacement for SRFI 113, except that set is replaced by ;;; iset in procedure names. However, comparators are not useful for integer sets, ;;; and in iset, iset-unfold, iset-map, and iset-copy, the comparator argument ;;; is omitted. ;;; ;;; Author of spec: John Cowan ;;; ;;; Copyright © 2020 Wolfgang Corcoran-Mathe. All rights reserved. ;;; ;;; 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. ;;; ;;; Adaptation to LispKit ;;; Copyright © 2021 Matthias Zenger. All rights reserved. (define-library (srfi 217) (export iset list->iset list->iset! iset-unfold make-range-iset iset-member iset-min iset-max iset? iset-contains? iset-empty? iset-disjoint? iset-adjoin iset-adjoin! iset-delete iset-delete! iset-delete-all iset-delete-all! iset-search iset-search! iset-delete-min iset-delete-max iset-delete-min! iset-delete-max! iset-size iset-find iset-any? iset-every? iset-count iset-fold iset-fold-right iset-map iset-for-each iset-filter iset-remove iset-partition iset-partition! iset-copy iset->list iset=? iset<? iset>? iset<=? iset>=? iset-union iset-union! iset-intersection iset-intersection! iset-difference iset-difference! iset-xor iset-xor! iset-open-interval iset-closed-interval iset-open-closed-interval iset-closed-open-interval isubset= isubset< isubset<= isubset> isubset>= ;; debug iset-trie highest-set-bit highest-bit-mask lowest-bit-mask) (import (scheme base) (scheme case-lambda) (scheme inexact) (only (srfi 1) fold every xcons) (srfi 143) (only (srfi 151) bit-count) (srfi 145)) (begin ;;; This section implements integers sets as compressed binary radix trees ;;; (AKA Patricia tries), as described by Chris Okasaki and Andrew Gill in ;;; "Fast Mergeable Integer Maps" (1998). Integers in big-endian binary encoding ;;; are stored in a trie structure which allows fast lookup, insertion, and ;;; set-theoretical operations (union, intersection, etc.) ;;; ;;; To make efficient use of space, "buddy compression" is used to store runs of ;;; adjacent integers as bitmaps in single leaves. Integers are broken up into a ;;; prefix and a string of low-order bits; the latter are represented by setting ;;; the appropriate bit in a leaf's bitmap. Since a bitmap is represented by ;;; a single fixnum, we can represent a 5-bit suffix on most 64-bit Schemes, ;;; and a 4-bit suffix on most 32-bit implementations. (We pay a tax for dynamic ;;; typing.) ;;; ;;; A trie is represented by #f (the empty trie), a leaf, or a branch. ;;; ;;; Throughout this code, the empty trie (#f) is always returned as an explicit ;;; value, not, e.g. as the default value of an (and ...) expression, to clarify ;;; its use as a trie value. ;;; ;;; The interface procedures of this library are the `trie-' forms not prefixed ;;; with '%'. This flimsy naming scheme is no substitute for a real submodule, ;;; but not every Scheme supports those. ;;;; Types and constructors ;;; Leaves and branches are constructed so as to maintain the following ;;; invariant: Every leaf and every subtrie contains at least one value. ;;; This means that the empty trie (#f) never appears as a subtrie. (define-record-type <leaf> (raw-leaf prefix bitmap) leaf? (prefix leaf-prefix) (bitmap leaf-bitmap)) ;; The primary leaf constructor creates a leaf only if `bitmap' ;; contains at least one value. (define (leaf prefix bitmap) (if (fxpositive? bitmap) (raw-leaf prefix bitmap) #f)) ;; Shorthand for extracting leaf elements. (define-syntax let*-leaf (syntax-rules () ((_ () e1 e2 ...) (begin e1 e2 ...)) ((_ (((p b) expr) . binds) . body) (let ((lf expr)) (let ((p (leaf-prefix lf)) (b (leaf-bitmap lf))) (let*-leaf binds . body)))))) (define-record-type <branch> (raw-branch prefix branching-bit left right) branch? (prefix branch-prefix) (branching-bit branch-branching-bit) (left branch-left) (right branch-right)) ;; The primary branch constructor creates a branch only if the subtrees are non-empty. (define (branch prefix mask trie1 trie2) (cond ((not trie1) trie2) ((not trie2) trie1) (else (raw-branch prefix mask trie1 trie2)))) ;; Shorthand for extracting branch elements. (define-syntax let*-branch (syntax-rules () ((_ () e1 e2 ...) (begin e1 e2 ...)) ((_ (((p m l r) expr) . binds) . body) (let ((b expr)) (let ((p (branch-prefix b)) (m (branch-branching-bit b)) (l (branch-left b)) (r (branch-right b))) (let*-branch binds . body)))))) ;;;; Bitwise constants and procedures ;; Constant. Gives the maximum number of integers storable in a single leaf. (define leaf-bitmap-size (expt 2 (exact (floor (log (- fx-width 1) 2))))) (define suffix-mask (- leaf-bitmap-size 1)) (define prefix-mask (fxnot suffix-mask)) (define (valid-integer? x) (fixnum? x)) ;; Zero the bits of k at and below (BE) the set bit of m. (define (mask k m) (if (fx=? m fx-least) 0 (fxand k (fxxor (fxnot (fx- m 1)) m)))) ;; Does the m-masked prefix of k match p? (define (match-prefix? k p m) (fx=? (mask k m) p)) (define (branching-bit p1 m1 p2 m2) (if (fxnegative? (fxxor p1 p2)) fx-least ; different signs (highest-bit-mask (fxxor p1 p2) (fxmax 1 (fx* 2 (fxmax m1 m2)))))) ;; Two's-complement trick. (define (lowest-bit-mask b) (fxand b (fxneg b))) (define (highest-bit-mask k guess-m) (let lp ((x (fxand k (fxnot (fx- guess-m 1))))) (let ((m (lowest-bit-mask x))) (if (fx=? x m) m (lp (fx- x m)))))) ;; FIXME: To improve. (define (highest-set-bit k) (fxfirst-set-bit (highest-bit-mask k 1))) (define (zero-bit? k m) (fxzero? (fxand k m))) (define (isuffix k) (fxand k suffix-mask)) (define (iprefix k) (fxand k prefix-mask)) (define (ibitmap k) (fxarithmetic-shift 1 (isuffix k))) (define (bitmap-delete bitmap key) (fxand bitmap (fxnot (ibitmap key)))) (define (bitmap-delete-min b) (fxand b (fxnot (lowest-bit-mask b)))) (define (bitmap-delete-max b) (fxand b (fxnot (highest-bit-mask b (lowest-bit-mask b))))) ;;;; Predicates and accessors (define (trie-contains? trie key) (and trie (if (leaf? trie) (and (fx=? (iprefix key) (leaf-prefix trie)) (not (fxzero? (fxand (ibitmap key) (leaf-bitmap trie))))) (let*-branch (((p m l r) trie)) (and (match-prefix? key p m) (if (zero-bit? key m) (trie-contains? l key) (trie-contains? r key))))))) (define (trie-min trie) (letrec ((search (lambda (t) (and t (if (leaf? t) (fx+ (leaf-prefix t) (fxfirst-set-bit (leaf-bitmap t))) (search (branch-left t))))))) (if (branch? trie) (if (fxnegative? (branch-branching-bit trie)) (search (branch-right trie)) (search (branch-left trie))) (search trie)))) (define (trie-max trie) (letrec ((search (lambda (t) (and t (if (leaf? t) (fx+ (leaf-prefix t) (highest-set-bit (leaf-bitmap t))) (search (branch-right t))))))) (if (branch? trie) (if (fxnegative? (branch-branching-bit trie)) (search (branch-left trie)) (search (branch-right trie))) (search trie)))) ;;;; Insert (define (%trie-insert-parts trie prefix bitmap) (letrec ((ins (lambda (t) (cond ((not t) (raw-leaf prefix bitmap)) ((leaf? t) (let*-leaf (((p b) t)) (if (fx=? prefix p) (raw-leaf prefix (fxior b bitmap)) (%trie-join prefix 0 (raw-leaf prefix bitmap) p 0 t)))) (else (let*-branch (((p m l r) t)) (if (match-prefix? prefix p m) (if (zero-bit? prefix m) (branch p m (ins l) r) (branch p m l (ins r))) (%trie-join prefix 0 (raw-leaf prefix bitmap) p m t)))))))) (ins trie))) (define (trie-insert trie key) (%trie-insert-parts trie (iprefix key) (ibitmap key))) ;;;; Iterators and filters ;; Fold trie in increasing numerical order. (define (trie-fold proc nil trie) (letrec ((cata (lambda (b t) (cond ((not t) b) ((leaf? t) (fold-left-bits (leaf-prefix t) proc b (leaf-bitmap t))) (else (cata (cata b (branch-left t)) (branch-right t))))))) (if (branch? trie) (let*-branch (((p m l r) trie)) (if (fxnegative? m) (cata (cata nil r) l) (cata (cata nil l) r))) (cata nil trie)))) (define (fold-left-bits prefix proc nil bitmap) (let loop ((bm bitmap) (acc nil)) (if (fxzero? bm) acc (let* ((mask (lowest-bit-mask bm)) (bi (fxfirst-set-bit mask))) (loop (fxxor bm mask) (proc (fx+ prefix bi) acc)))))) ;; Fold trie in decreasing numerical order. (define (trie-fold-right proc nil trie) (letrec ((cata (lambda (b t) (cond ((not t) b) ((leaf? t) (fold-right-bits (leaf-prefix t) proc b (leaf-bitmap t))) (else (cata (cata b (branch-right t)) (branch-left t))))))) (if (branch? trie) (let*-branch (((p m l r) trie)) (if (fxnegative? m) (cata (cata nil l) r) (cata (cata nil r) l))) (cata nil trie)))) ;; This might benefit from tuning. (define (fold-right-bits prefix proc nil bitmap) (let loop ((bm bitmap) (acc nil)) (if (fxzero? bm) acc (let* ((mask (highest-bit-mask bm (lowest-bit-mask bm))) (bi (fxfirst-set-bit mask))) (loop (fxxor bm mask) (proc (fx+ prefix bi) acc)))))) (define (bitmap-partition pred prefix bitmap) (let loop ((i 0) (in 0) (out 0)) (cond ((fx=? i leaf-bitmap-size) (values in out)) ((fxbit-set? i bitmap) (let ((bit (fxarithmetic-shift 1 i))) (if (pred (fx+ prefix i)) (loop (fx+ i 1) (fxior in bit) out) (loop (fx+ i 1) in (fxior out bit))))) (else (loop (fx+ i 1) in out))))) (define (trie-partition pred trie) (letrec ((part (lambda (t) (cond ((not t) (values #f #f)) ((leaf? t) (let*-leaf (((p bm) t)) (let-values (((in out) (bitmap-partition pred p bm))) (values (leaf p in) (leaf p out))))) (else (let-values (((p) (branch-prefix t)) ((m) (branch-branching-bit t)) ((il ol) (part (branch-left t))) ((ir or) (part (branch-right t)))) (values (branch p m il ir) (branch p m ol or)))))))) (part trie))) (define (bitmap-filter pred prefix bitmap) (let loop ((i 0) (res 0)) (cond ((fx=? i leaf-bitmap-size) res) ((and (fxbit-set? i bitmap) (pred (fx+ prefix i))) (loop (fx+ i 1) (fxior res (fxarithmetic-shift 1 i)))) (else (loop (fx+ i 1) res))))) (define (trie-filter pred trie) (cond ((not trie) #f) ((leaf? trie) (let*-leaf (((p bm) trie)) (leaf p (bitmap-filter pred p bm)))) (else (branch (branch-prefix trie) (branch-branching-bit trie) (trie-filter pred (branch-left trie)) (trie-filter pred (branch-right trie)))))) ;;;; Update operations (define (trie-delete trie key) (letrec* ((prefix (iprefix key)) (update (lambda (t) (cond ((not t) #f) ((leaf? t) (let*-leaf (((p bm) t)) (if (fx=? p prefix) (leaf p (bitmap-delete bm key)) t))) (else (let*-branch (((p m l r) t)) (if (match-prefix? prefix p m) (if (zero-bit? prefix m) (branch p m (update l) r) (branch p m l (update r))) t))))))) (update trie))) (define (trie-delete-min trie) (letrec ((update/min (lambda (t) (cond ((not t) (error "Empty set")) ((leaf? t) (let*-leaf (((p bm) t)) (values (+ p (fxfirst-set-bit bm)) (leaf p (bitmap-delete-min bm))))) (else (let*-branch (((p m l r) t)) (let-values (((n l*) (update/min l))) (values n (branch p m l* r))))))))) (if (branch? trie) (let*-branch (((p m l r) trie)) (if (fxnegative? m) (let-values (((n r*) (update/min r))) (values n (branch p m l r*))) (let-values (((n l*) (update/min l))) (values n (branch p m l* r))))) (update/min trie)))) (define (trie-delete-max trie) (letrec ((update/max (lambda (t) (cond ((not t) (error "Empty set")) ((leaf? t) (let*-leaf (((p bm) t)) (values (+ p (highest-set-bit bm)) (leaf p (bitmap-delete-max bm))))) (else (let*-branch (((p m l r) t)) (let-values (((n r*) (update/max r))) (values n (branch p m l r*))))))))) (if (branch? trie) (let*-branch (((p m l r) trie)) (if (fxnegative? m) (let-values (((n l*) (update/max l))) (values n (branch p m l* r))) (let-values (((n r*) (update/max r))) (values n (branch p m l r*))))) (update/max trie)))) ;; Search trie for key, and construct a new trie using the results of ;; failure and success. (define (trie-search trie key failure success) (let* ((kp (iprefix key)) (key-leaf (raw-leaf kp (ibitmap key)))) (letrec ((search (lambda (t build) (cond ((not t) (failure (lambda (obj) (build key-leaf obj)) (lambda (obj) (build #f obj)))) ((leaf? t) (leaf-search t key failure success build)) (else (let*-branch (((p m l r) t)) (if (match-prefix? key p m) (if (zero-bit? key m) (search l (lambda (l* obj) (build (branch p m l* r) obj))) (search r (lambda (r* obj) (build (branch p m l r*) obj)))) (failure (lambda (obj) (build (%trie-join kp 0 key-leaf p m t) obj)) (lambda (obj) (build t obj)))))))))) (if (branch? trie) (let*-branch (((p m l r) trie)) (if (fxnegative? m) (if (fxnegative? key) (let-values (((r* obj) (search r values))) (values (branch p m l r*) obj)) (let-values (((l* obj) (search l values))) (values (branch p m l* r) obj))) (search trie values))) (search trie values))))) (define (leaf-search lf key failure success build) (let ((kp (iprefix key)) (kb (ibitmap key))) (let*-leaf (((p bm) lf)) (if (fx=? kp p) (if (fxzero? (fxand kb bm)) (failure (lambda (obj) (build (raw-leaf p (fxior kb bm)) obj)) (lambda (obj) (build lf obj))) (success key (lambda (elt obj) (assume (eqv? key elt) "invalid new element") (build lf obj)) (lambda (obj) (build (leaf p (bitmap-delete bm key)) obj)))) (failure (lambda (obj) (build (%trie-join kp 0 (raw-leaf kp kb) p 0 lf) obj)) (lambda (obj) (build lf obj))))))) ;;;; Set-theoretical operations (define (%trie-join prefix1 mask1 trie1 prefix2 mask2 trie2) (let ((m (branching-bit prefix1 mask1 prefix2 mask2))) (if (zero-bit? prefix1 m) (raw-branch (mask prefix1 m) m trie1 trie2) (raw-branch (mask prefix1 m) m trie2 trie1)))) (define (branching-bit-higher? mask1 mask2) (if (negative? (fxxor mask1 mask2)) ; signs differ (negative? mask1) (fx>? mask1 mask2))) ;; Merge two tries. The exact contents of the result depend on the ;; `insert-leaf' function, which is used to merge leaves into branches. ;; Taking the running time of `insert-leaf' to be constant, runs in ;; O(n+m) time. (define (%trie-merge insert-leaf trie1 trie2) (letrec ((merge (lambda (s t) (cond ((not s) t) ((not t) s) ((leaf? s) (insert-leaf t s)) ((leaf? t) (insert-leaf s t)) (else (merge-branches s t))))) (merge-branches (lambda (s t) (let*-branch (((p m s1 s2) s) ((q n t1 t2) t)) (cond ((and (fx=? m n) (fx=? p q)) ;; the prefixes match, so merge the subtries (branch p m (merge s1 t1) (merge s2 t2))) ((and (branching-bit-higher? m n) (match-prefix? q p m)) ;; p is a prefix of q, so merge t with a subtrie of s. (if (zero-bit? q m) (branch p m (merge s1 t) s2) (branch p m s1 (merge s2 t)))) ((and (branching-bit-higher? n m) (match-prefix? p q n)) ;; q is a prefix of p, so merge s with a subtrie of t. (if (zero-bit? p n) (branch q n (merge s t1) t2) (branch q n t1 (merge s t2)))) (else ; the prefixes disagree (%trie-join p m s q n t))))))) (merge trie1 trie2))) (define (trie-union trie1 trie2) (%trie-merge (lambda (s t) (insert-leaf/proc fxior s t)) trie1 trie2)) (define (trie-xor trie1 trie2) (%trie-merge (lambda (s t) (insert-leaf/proc fxxor s t)) trie1 trie2)) ;; Insert the elements of `lf' into `trie', combining bitmaps with ;; the binary bitwise operation `fxcombine'. (define (insert-leaf/proc fxcombine trie lf) (let*-leaf (((p bm) lf)) (letrec ((ins (lambda (t) (cond ((not t) lf) ; a whole new leaf ((leaf? t) (let*-leaf (((q bm*) t)) (if (fx=? p q) (leaf p (fxcombine bm bm*)) (%trie-join p 0 lf q 0 t)))) (else ; branch (let*-branch (((q m l r) t)) (if (match-prefix? p q m) (if (zero-bit? p m) (raw-branch q m (ins l) r) (raw-branch q m l (ins r))) (%trie-join p 0 lf q 0 t)))))))) (ins trie)))) ;; Construct a trie which forms the intersection of the two tries. ;; Runs in O(n+m) time. (define (trie-intersection trie1 trie2) (letrec ((intersect (lambda (s t) (cond ((or (not s) (not t)) #f) ((leaf? s) (intersect/leaf s t)) ((leaf? t) (intersect/leaf t s)) (else (intersect-branches s t))))) (intersect/leaf (lambda (l t) (let*-leaf (((p bm) l)) (let lp ((t t)) (cond ((not t) #f) ((leaf? t) (if (fx=? p (leaf-prefix t)) (leaf p (fxand bm (leaf-bitmap t))) #f)) ; disjoint (else ; branch (let*-branch (((q m l r) t)) (if (match-prefix? p q m) (if (zero-bit? p m) (lp l) (lp r)) #f)))))))) ; disjoint (intersect-branches (lambda (s t) (let*-branch (((p m sl sr) s) ((q n tl tr) t)) (cond ((branching-bit-higher? m n) (and (match-prefix? q p m) (if (zero-bit? q m) (intersect sl t) (intersect sr t)))) ((branching-bit-higher? n m) (and (match-prefix? p q n) (if (zero-bit? p n) (intersect s tl) (intersect s tr)))) ((fx=? p q) (branch p m (intersect sl tl) (intersect sr tr))) (else #f)))))) (intersect trie1 trie2))) ;; Construct a trie containing the elements of trie1 not found in trie2. ;; Runs in O(n+m) time. (define (trie-difference trie1 trie2) (letrec ((difference (lambda (s t) (cond ((not s) #f) ((not t) s) ((leaf? s) (diff/leaf s t)) ((leaf? t) (%trie-delete-bitmap s (leaf-prefix t) (leaf-bitmap t))) (else (branch-difference s t))))) (diff/leaf (lambda (lf t) (let*-leaf (((p bm) lf)) (let lp ((t t)) (cond ((not t) lf) ((leaf? t) (let*-leaf (((q c) t)) (if (fx=? p q) (leaf p (fxand bm (fxnot c))) lf))) ; disjoint (else ; branch (let*-branch (((q m l r) t)) (if (match-prefix? p q m) (if (zero-bit? p m) (lp l) (lp r)) lf)))))))) (branch-difference (lambda (s t) (let*-branch (((p m sl sr) s) ((q n tl tr) t)) (cond ((and (fx=? m n) (fx=? p q)) (branch p m (difference sl tl) (difference sr tr))) ((and (branching-bit-higher? m n) (match-prefix? q p m)) (if (zero-bit? q m) (branch p m (difference sl t) sr) (branch p m sl (difference sr t)))) ((and (branching-bit-higher? n m) (match-prefix? p q n)) (if (zero-bit? p n) (difference s tl) (difference s tr))) (else s)))))) (difference trie1 trie2))) ;; Delete all values described by `bitmap' from `trie'. (define (%trie-delete-bitmap trie prefix bitmap) (cond ((not trie) #f) ((leaf? trie) (if (fx=? prefix (leaf-prefix trie)) (leaf prefix (fxand (leaf-bitmap trie) (fxnot bitmap))) trie)) ; disjoint (else ; branch (let*-branch (((p m l r) trie)) (if (match-prefix? prefix p m) (if (zero-bit? prefix m) (branch p m (%trie-delete-bitmap l prefix bitmap) r) (branch p m l (%trie-delete-bitmap r prefix bitmap))) trie))))) ;;;; Copying (define (copy-trie trie) (cond ((not trie) #f) ((leaf? trie) (raw-leaf (leaf-prefix trie) (leaf-bitmap trie))) (else (raw-branch (branch-prefix trie) (branch-branching-bit trie) (copy-trie (branch-left trie)) (copy-trie (branch-right trie)))))) ;;;; Size (define (trie-size trie) (let accum ((siz 0) (t trie)) (cond ((not t) siz) ((leaf? t) (+ siz (bit-count (leaf-bitmap t)))) (else (accum (accum siz (branch-left t)) (branch-right t)))))) ;;;; Comparisons (define (trie=? trie1 trie2) (cond ((not (or trie1 trie2)) #t) ((and (leaf? trie1) (leaf? trie2)) (and (fx=? (leaf-prefix trie1) (leaf-prefix trie2)) (fx=? (leaf-bitmap trie1) (leaf-bitmap trie2)))) ((and (branch? trie1) (branch? trie2)) (let*-branch (((p m l1 r1) trie1) ((q n l2 r2) trie2)) (and (fx=? m n) (fx=? p q) (trie=? l1 l2) (trie=? r1 r2)))) (else #f))) (define (subset-compare-leaves l1 l2) (let*-leaf (((p b) l1) ((q c) l2)) (if (fx=? p q) (if (fx=? b c) 'equal (if (fxzero? (fxand b (fxnot c))) 'less 'greater)) 'greater))) ; disjoint ;; Returns the symbol 'less' if trie1 is a proper subset of trie2, ;; 'equal' if they are the same, and 'greater' otherwise. NB that ;; disjoint sets will compare as greater. ;; ;; FIXME: Simplify this. (define (trie-subset-compare trie1 trie2) (letrec ((compare (lambda (s t) (cond ((eqv? s t) 'equal) ((not s) 'less) ((not t) 'greater) ; disjoint ((and (leaf? s) (leaf? t)) (subset-compare-leaves s t)) ((leaf? s) ; leaf / branch (let*-leaf (((p _) s)) (let*-branch (((q m l r) t)) (if (match-prefix? p q m) (case (compare s (if (zero-bit? p m) l r)) ((greater) 'greater) (else 'less)) 'greater)))) ; disjoint ((leaf? t) 'greater) ; branch / leaf (else (compare-branches s t))))) (compare-branches (lambda (s t) (let*-branch (((p m sl sr) s) ((q n tl tr) t)) (cond ((branching-bit-higher? m n) 'greater) ((branching-bit-higher? n m) (if (match-prefix? p q n) (let ((comp (if (zero-bit? p n) (compare s tl) (compare s tr)))) (if (eqv? comp 'greater) comp 'less)) 'greater)) ((fx=? p q) ; same prefix, compare subtrees (let ((cl (compare sl tl)) (cr (compare sr tr))) (cond ((or (eqv? cl 'greater) (eqv? cr 'greater)) 'greater) ((and (eqv? cl 'equal) (eqv? cr 'equal)) 'equal) (else 'less)))) (else 'greater)))))) ; disjoint (compare trie1 trie2))) (define (trie-proper-subset? trie1 trie2) (eqv? (trie-subset-compare trie1 trie2) 'less)) (define (trie-disjoint? trie1 trie2) (letrec ((disjoint? (lambda (s t) (or (not s) (not t) (cond ((and (leaf? s) (leaf? t)) (disjoint/leaf? s t)) ((leaf? s) (disjoint/leaf? s t)) ((leaf? t) (disjoint/leaf? t s)) (else (branches-disjoint? s t)))))) (disjoint/leaf? (lambda (lf t) (let*-leaf (((p bm) lf)) (let lp ((t t)) (if (leaf? t) (if (fx=? p (leaf-prefix t)) (fxzero? (fxand bm (leaf-bitmap t))) #t) (let*-branch (((q n l r) t)) (if (match-prefix? p q n) (if (zero-bit? p n) (lp l) (lp r)) #t))))))) (branches-disjoint? (lambda (s t) (let*-branch (((p m sl sr) s) ((q n tl tr) t)) (cond ((and (fx=? m n) (fx=? p q)) (and (disjoint? sl tl) (disjoint? sr tr))) ((and (branching-bit-higher? m n) (match-prefix? q p m)) (if (zero-bit? q m) (disjoint? sl t) (disjoint? sr t))) ((and (branching-bit-higher? n m) (match-prefix? p q n)) (if (zero-bit? p n) (disjoint? s tl) (disjoint? s tr))) (else #t)))))) ; the prefixes disagree (disjoint? trie1 trie2))) ;;;; Subtrie operations ;; Return a trie containing all the elements of `trie' which are ;; less than k, if `inclusive' is false, or less than or equal to ;; k if `inclusive' is true. ;; Runs in O(min(n, W)) time. (define (subtrie< trie k inclusive) (letrec ((split (lambda (t) (cond ((not t) #f) ((leaf? t) (let*-leaf (((p bm) t)) (leaf p (bitmap-split< k inclusive p bm)))) (else (let*-branch (((p m l r) t)) (if (match-prefix? k p m) (if (zero-bit? k m) (split l) (trie-union l (split r))) (and (fx<? p k) t)))))))) (if (and (branch? trie) (fxnegative? (branch-branching-bit trie))) (if (fxnegative? k) (split (branch-right trie)) (trie-union (split (branch-left trie)) (branch-right trie))) (split trie)))) ;; Return a bitmap containing all elements in `bitmap' that are ;; less than/less than or equal to k. (define (bitmap-split< k inclusive prefix bitmap) (let ((kp (iprefix k)) (kb (ibitmap k))) (cond ((fx>? kp prefix) bitmap) ((fx=? kp prefix) (fxand bitmap (fx- (if inclusive (fxarithmetic-shift kb 1) kb) 1))) (else 0)))) ;; Return a trie containing all the elements of `trie' which are ;; greater than k, if `inclusive' is false, or greater than or equal ;; to k if `inclusive' is true. ;; Runs in O(min(n, W)) time. (define (subtrie> trie k inclusive) (letrec ((split (lambda (t) (cond ((not t) #f) ((leaf? t) (let*-leaf (((p bm) t)) (leaf p (bitmap-split> k inclusive p bm)))) (else (let*-branch (((p m l r) t)) (if (match-prefix? k p m) (if (zero-bit? k m) (trie-union (split l) r) (split r)) (and (fx>? p k) t)))))))) (if (and (branch? trie) (fxnegative? (branch-branching-bit trie))) (if (fxnegative? k) (trie-union (split (branch-right trie)) (branch-left trie)) (split (branch-left trie))) (split trie)))) ;; Return a bitmap containing all elements in `bitmap' that are ;; greater than/greater than or equal to `k'. (define (bitmap-split> k inclusive prefix bitmap) (let ((kp (iprefix k)) (kb (ibitmap k))) (cond ((fx<? kp prefix) bitmap) ((fx=? kp prefix) (fxand bitmap (fxneg (if inclusive kb (fxarithmetic-shift kb 1))))) (else 0)))) ;; Return a trie containing all the elements of `trie' which are ;; greater than/greater than or equal to a and less than/less than ;; or equal to b, depending on the truth values of ;; low-/high-inclusive. (define (subtrie-interval trie a b low-inclusive high-inclusive) (letrec ((interval (lambda (t) (cond ((not t) #f) ((leaf? t) (let*-leaf (((p bm) t)) (leaf p (bitmap-interval p bm a b low-inclusive high-inclusive)))) (else (branch-interval t))))) (branch-interval (lambda (t) (let*-branch (((p m l r) t)) (if (match-prefix? a p m) (if (zero-bit? a m) (if (match-prefix? b p m) (if (zero-bit? b m) (interval l) ; all x < b is in l (trie-union (subtrie> l a low-inclusive) (subtrie< r b high-inclusive))) ;; everything or nothing is less than b (and (fx<? b p) (trie-union (subtrie> l a low-inclusive) r))) (interval r)) ; all x > b is in r ;; everything or nothing is greater than a (and (fx>? p a) (subtrie< t b high-inclusive))))))) (if (and (branch? trie) (fxnegative? (branch-branching-bit trie))) (cond ((and (fxnegative? a) (fxnegative? b)) (interval (branch-right trie))) ((and (fxpositive? a) (fxpositive? b)) (interval (branch-left trie))) ;; (a, 0) U (0, b) (else (trie-union (subtrie> (branch-right trie) a low-inclusive) (subtrie< (branch-left trie) b high-inclusive)))) (interval trie)))) ;; Return a bitmap containing the elements of bitmap that are within ;; the interval defined by a, b. (define (bitmap-interval prefix bitmap low high low-inclusive high-inclusive) (let ((lp (iprefix low)) (lb (ibitmap low)) (hp (iprefix high)) (hb (ibitmap high))) (let ((low-mask (fxneg (if low-inclusive ; mask everything above `low' lb (fxarithmetic-shift lb 1)))) (high-mask (fx- (if high-inclusive ; mask everything below `high' (fxarithmetic-shift hb 1) hb) 1))) (cond ((fx<? prefix hp) (cond ((fx<? prefix lp) 0) ((fx>? prefix lp) bitmap) (else (fxand low-mask bitmap)))) ((fx>? prefix hp) 0) (else (fxand (fxand low-mask high-mask) bitmap)))))) ) (begin (define-record-type <iset> (raw-iset trie) iset? (trie iset-trie)) ;;;; Constructors (define (iset . args) (list->iset args)) (define (pair-or-null? x) (or (pair? x) (null? x))) (define (list->iset ns) (assume (pair-or-null? ns)) (raw-iset (fold (lambda (n t) (assume (valid-integer? n)) (trie-insert t n)) #f ns))) (define (list->iset! set ns) (assume (iset? set)) (assume (pair-or-null? ns)) (raw-iset (fold (lambda (n t) (assume (valid-integer? n)) (trie-insert t n)) (iset-trie set) ns))) (define (iset-unfold stop? mapper successor seed) (assume (procedure? stop?)) (assume (procedure? mapper)) (assume (procedure? successor)) (let lp ((trie #f) (seed seed)) (if (stop? seed) (raw-iset trie) (let ((n (mapper seed))) (assume (valid-integer? n)) (lp (trie-insert trie n) (successor seed)))))) ;; TODO: Optimize step = 1 case. (define make-range-iset (case-lambda ((start end) (make-range-iset start end 1)) ; TODO: Tune this case. ((start end step) (assume (valid-integer? start)) (assume (valid-integer? end)) (assume (valid-integer? step)) (assume (if (< end start) (negative? step) (not (zero? step))) "Invalid step value.") (let ((stop? (if (positive? step) (lambda (i) (>= i end)) (lambda (i) (<= i end))))) (iset-unfold stop? values (lambda (i) (+ i step)) start))))) ;;;; Predicates (define (iset-contains? set n) (assume (iset? set)) (assume (valid-integer? n)) (trie-contains? (iset-trie set) n)) (define (iset-empty? set) (assume (iset? set)) (not (iset-trie set))) (define (iset-disjoint? set1 set2) (assume (iset? set1)) (assume (iset? set2)) (trie-disjoint? (iset-trie set1) (iset-trie set2))) ;;;; Accessors (define (iset-member set elt default) (if (iset-contains? set elt) elt default)) (define (iset-min set) (assume (iset? set)) (trie-min (iset-trie set))) (define (iset-max set) (assume (iset? set)) (trie-max (iset-trie set))) ;;;; Updaters (define iset-adjoin (case-lambda ((set n) (assume (iset? set)) (assume (valid-integer? n)) (raw-iset (trie-insert (iset-trie set) n))) ((set . ns) (raw-iset (fold (lambda (n t) (assume (valid-integer? n)) (trie-insert t n)) (iset-trie set) ns))))) (define (iset-adjoin! set . ns) (apply iset-adjoin set ns)) (define iset-delete (case-lambda ((set n) (assume (iset? set)) (assume (valid-integer? n)) (raw-iset (trie-delete (iset-trie set) n))) ((set . ns) (iset-delete-all set ns)))) (define (iset-delete! set n) (iset-delete set n)) (define (iset-delete-all set ns) (assume (iset? set)) (assume (or (pair? ns) (null? ns))) (iset-difference set (list->iset ns))) (define (iset-delete-all! set ns) (iset-delete-all set ns)) ;; Thanks to the authors of SRFI 146 for providing examples ;; of how to implement this shoggoth. (define (iset-search set elt failure success) (assume (iset? set)) (assume (valid-integer? elt)) (assume (procedure? failure)) (assume (procedure? success)) (call-with-current-continuation (lambda (return) (let-values (((trie obj) (trie-search (iset-trie set) elt (lambda (insert ignore) (failure insert (lambda (obj) (return set obj)))) (lambda (key update remove) (success key (lambda (new obj) (assume (valid-integer? new)) (if (fx=? key new) (update new obj) (return (iset-adjoin (iset-delete set key) new) obj))) remove))))) (values (raw-iset trie) obj))))) (define (iset-search! set elt failure success) (iset-search set elt failure success)) (define (iset-delete-min set) (assume (iset? set)) (let*-values (((trie) (iset-trie set)) ((n trie*) (trie-delete-min trie))) (values n (raw-iset trie*)))) (define (iset-delete-max set) (assume (iset? set)) (let*-values (((trie) (iset-trie set)) ((n trie*) (trie-delete-max trie))) (values n (raw-iset trie*)))) (define (iset-delete-min! set) (iset-delete-min set)) (define (iset-delete-max! set) (iset-delete-max set)) ;;;; The whole iset (define (iset-size set) (assume (iset? set)) (trie-size (iset-trie set))) (define (iset-find pred set failure) (assume (procedure? failure)) (call-with-current-continuation (lambda (return) (or (iset-fold (lambda (n _) (and (pred n) (return n))) #f set) (failure))))) (define (iset-count pred set) (assume (procedure? pred)) (iset-fold (lambda (n acc) (if (pred n) (+ 1 acc) acc)) 0 set)) (define (iset-any? pred set) (assume (procedure? pred)) (call-with-current-continuation (lambda (return) (iset-fold (lambda (n _) (and (pred n) (return #t))) #f set)))) (define (iset-every? pred set) (assume (procedure? pred)) (call-with-current-continuation (lambda (return) (iset-fold (lambda (n _) (or (pred n) (return #f))) #t set)))) ;;;; Mapping and folding (define (iset-map proc set) (assume (procedure? proc)) (raw-iset (iset-fold (lambda (n t) (let ((n* (proc n))) (assume (valid-integer? n*)) (trie-insert t (proc n)))) #f set))) (define (unspecified) (if #f #f)) (define (iset-for-each proc set) (assume (procedure? proc)) (iset-fold (lambda (n _) (proc n) (unspecified)) (unspecified) set)) (define (iset-fold proc nil set) (assume (procedure? proc)) (assume (iset? set)) (trie-fold proc nil (iset-trie set))) (define (iset-fold-right proc nil set) (assume (procedure? proc)) (assume (iset? set)) (trie-fold-right proc nil (iset-trie set))) (define (iset-filter pred set) (assume (procedure? pred)) (assume (iset? set)) (raw-iset (trie-filter pred (iset-trie set)))) (define (iset-remove pred set) (assume (procedure? pred)) (assume (iset? set)) (raw-iset (trie-filter (lambda (n) (not (pred n))) (iset-trie set)))) (define (iset-partition pred set) (assume (procedure? pred)) (assume (iset? set)) (let-values (((tin tout) (trie-partition pred (iset-trie set)))) (values (raw-iset tin) (raw-iset tout)))) (define (iset-partition! pred set) (iset-partition pred set)) ;;;; Copying and conversion (define (iset-copy set) (assume (iset? set)) (raw-iset (copy-trie (iset-trie set)))) (define (iset->list set) (iset-fold-right cons '() set)) ;;;; Comparison (define (iset=? set1 set2 . sets) (assume (iset? set1)) (let ((iset-eq1 (lambda (set) (assume (iset? set)) (or (eqv? set1 set) (trie=? (iset-trie set1) (iset-trie set)))))) (and (iset-eq1 set2) (or (null? sets) (every iset-eq1 sets))))) (define (iset<? set1 set2 . sets) (assume (iset? set1)) (assume (iset? set2)) (let lp ((t1 (iset-trie set1)) (t2 (iset-trie set2)) (sets sets)) (and (trie-proper-subset? t1 t2) (or (null? sets) (lp t2 (iset-trie (car sets)) (cdr sets)))))) (define (iset>? set1 set2 . sets) (assume (iset? set1)) (assume (iset? set2)) (let lp ((t1 (iset-trie set1)) (t2 (iset-trie set2)) (sets sets)) (and (trie-proper-subset? t2 t1) (or (null? sets) (lp t2 (iset-trie (car sets)) (cdr sets)))))) (define (iset<=? set1 set2 . sets) (assume (iset? set1)) (assume (iset? set2)) (let lp ((t1 (iset-trie set1)) (t2 (iset-trie set2)) (sets sets)) (and (memv (trie-subset-compare t1 t2) '(less equal)) (or (null? sets) (lp t2 (iset-trie (car sets)) (cdr sets)))))) (define (iset>=? set1 set2 . sets) (assume (iset? set1)) (assume (iset? set2)) (let lp ((t1 (iset-trie set1)) (t2 (iset-trie set2)) (sets sets)) (and (memv (trie-subset-compare t1 t2) '(greater equal)) (or (null? sets) (lp t2 (iset-trie (car sets)) (cdr sets)))))) ;;;; Set theory operations (define iset-union (case-lambda ((set1 set2) (assume (iset? set1)) (assume (iset? set2)) (raw-iset (trie-union (iset-trie set1) (iset-trie set2)))) ((set . rest) (raw-iset (fold (lambda (s t) (assume (iset? s)) (trie-union (iset-trie s) t)) (iset-trie set) rest))))) (define (iset-union! set . rest) (apply iset-union set rest)) (define iset-intersection (case-lambda ((set1 set2) (assume (iset? set1)) (assume (iset? set2)) (raw-iset (trie-intersection (iset-trie set1) (iset-trie set2)))) ((set . rest) (assume (iset? set)) (raw-iset (fold (lambda (s t) (assume (iset? s)) (trie-intersection (iset-trie s) t)) (iset-trie set) rest))))) (define (iset-intersection! set . rest) (apply iset-intersection set rest)) (define iset-difference (case-lambda ((set1 set2) ; fast path (assume (iset? set1)) (assume (iset? set2)) (raw-iset (trie-difference (iset-trie set1) (iset-trie set2)))) ((set . rest) (assume (iset? set)) (raw-iset (trie-difference (iset-trie set) (iset-trie (apply iset-union rest))))))) (define (iset-difference! set . rest) (apply iset-difference set rest)) (define (iset-xor set1 set2) (assume (iset? set1)) (assume (iset? set2)) (if (eqv? set1 set2) ; quick check (iset) (raw-iset (trie-xor (iset-trie set1) (iset-trie set2))))) (define (iset-xor! set1 set2) (iset-xor set1 set2)) ;;;; Subsets (define (isubset= set k) (if (iset-contains? set k) (iset k) (iset))) (define (iset-open-interval set low high) (assume (valid-integer? low)) (assume (valid-integer? high)) (assume (fx>=? high low)) (raw-iset (subtrie-interval (iset-trie set) low high #f #f))) (define (iset-closed-interval set low high) (assume (valid-integer? low)) (assume (valid-integer? high)) (assume (fx>=? high low)) (raw-iset (subtrie-interval (iset-trie set) low high #t #t))) (define (iset-open-closed-interval set low high) (assume (valid-integer? low)) (assume (valid-integer? high)) (assume (fx>=? high low)) (raw-iset (subtrie-interval (iset-trie set) low high #f #t))) (define (iset-closed-open-interval set low high) (assume (valid-integer? low)) (assume (valid-integer? high)) (assume (fx>=? high low)) (raw-iset (subtrie-interval (iset-trie set) low high #t #f))) (define (isubset< set k) (assume (iset? set)) (assume (valid-integer? k)) (raw-iset (subtrie< (iset-trie set) k #f))) (define (isubset<= set k) (assume (iset? set)) (assume (valid-integer? k)) (raw-iset (subtrie< (iset-trie set) k #t))) (define (isubset> set k) (assume (iset? set)) (assume (valid-integer? k)) (raw-iset (subtrie> (iset-trie set) k #f))) (define (isubset>= set k) (assume (iset? set)) (assume (valid-integer? k)) (raw-iset (subtrie> (iset-trie set) k #t))) ) )
true
340774a5ca0c6cacbffa88937e3ffdd74498cef1
923209816d56305004079b706d042d2fe5636b5a
/sitelib/http/header-field/user-agent.scm
8be467ab7c1e82a83e5301fd891d81085019d265
[ "BSD-3-Clause", "BSD-2-Clause" ]
permissive
tabe/http
4144cb13451dc4d8b5790c42f285d5451c82f97a
ab01c6e9b4e17db9356161415263c5a8791444cf
refs/heads/master
2021-01-23T21:33:47.859949
2010-06-10T03:36:44
2010-06-10T03:36:44
674,308
1
0
null
null
null
null
UTF-8
Scheme
false
false
403
scm
user-agent.scm
(library (http header-field user-agent) (export User-Agent) (import (rnrs (6)) (http abnf) (only (http basic-rule) comment) (only (http product-token) product)) ;;; 14.43 User-Agent ;; User-Agent = "User-Agent" ":" 1*( product | comment ) (define User-Agent (seq (string->rule "User-Agent") (char->rule #\:) (rep* (seq *LWS (bar product comment))))) )
false
850080a1a56d6ac6923d428c6bf14fc9901a4682
a8216d80b80e4cb429086f0f9ac62f91e09498d3
/lib/chibi/highlight.scm
862fb1c32f191f26115c0b8486536ab2cb1c8b41
[ "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
17,004
scm
highlight.scm
;; highlight.scm -- source code highlighting library ;; Copyright (c) 2011 Alex Shinn. All rights reserved. ;; BSD-style license: http://synthcode.com/license.txt ;;> Library for highlighting source code in different ;;> languages. Currently supports Scheme, C and Assembly. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define (string-concatenate-reverse ls) (string-concatenate (reverse ls))) (define (reverse-list->string ls) (list->string (reverse ls))) ;;> Returns an sxml structure representing the code from source ;;> with various language constructs wrapped in highlighting ;;> forms. \var{source} should be a string or port. The ;;> language to highlight for is auto-detected. (define (highlight source) (let ((str (if (string? source) source (port->string source)))) ((highlighter-for (highlight-detect-language str)) str))) ;;> Attempst to auto-detect which language \var{str} is code ;;> for, and returns a symbol representing that language. (define (highlight-detect-language str) (cond ((protect (exn (else #f)) (call-with-input-string str (lambda (in) (do ((x #f (read in))) ((eof-object? x))))) #t) 'scheme) (else 'c))) ;;> Return a procedure for highlighting the given language. (define (highlighter-for language) (case language ((scheme) highlight-scheme) ((asm) highlight-assembly) ((none) (lambda (x) x)) (else highlight-c))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define highlight-themes '((light (keyword . "#800080") (type . "#008000") (function . "#0000FF") (variable . "#B8860B") (comment . "#FF0000") (string . "#BC8F8F") (attribute . "#FF5000") (preprocessor . "#FF00FF") (builtin . "#FF00FF") (character . "#0055AA") (syntaxerror . "#FF0000") (diff-deleted . "#5F2121") (diff-added . "#215F21") ))) (define highlight-paren-styles ;;'("#BAFFFF" "#FFCACA" "#FFFFBA" "#CACAFF" "#CAFFCA" "FFBAFF") '("#AAAAAA" "#888888" "#666666" "#444444" "#222222" "#000000")) ;;> Returns a string representing the CSS needed for the output ;;> of \var{highlight}. This should be included in a referenced ;;> CSS file, or in a \var{<script>} section in the generated in ;;> the generated HTML output. (define (highlight-style . theme) (string-concatenate (append (map (lambda (x) (if (and (list? x) (= 3 (length x))) (string-append "." (symbol->string (car x)) " { color: " (cadr x) "; background-color: " (car (cddr x)) "; }\n") (string-append "." (symbol->string (car x)) " { color: " (if (pair? (cdr x)) (cadr x) (cdr x)) "; background-color: inherit; }\n"))) (cond ((assq (and (pair? theme) (car theme)) highlight-themes) => cdr) (else (cdar highlight-themes)))) (map (lambda (s i) (string-append ;;"span.paren" (number->string i) ;;":hover { color: inherit; background-color: " s "; }\n" "span.paren" (number->string i) " { color: " s "; background-color: inherit; }\n")) highlight-paren-styles (cdr (iota (+ 1 (length highlight-paren-styles)))))))) (define (highlight-class class x) `(span (@ (class . ,class)) ,@(if (list? x) x (list x)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define (read-whitespace in) (let lp ((res '())) (if (char-whitespace? (peek-char in)) (lp (cons (read-char in) res)) (reverse-list->string res)))) (define (read-to-whitespace in res) (let ((c (peek-char in))) (cond ((or (eof-object? c) (char-whitespace? c)) (reverse-list->string res)) (else (read-to-whitespace in (cons (read-char in) res)))))) (define (read-escaped in term ls) (let ((c (read-char in))) (cond ((eof-object? c) (reverse-list->string ls)) ((eqv? c term) (reverse-list->string (cons c ls))) (else (read-escaped in term (cons c ls)))))) (define (read-to-eol in ls) (let ((c (read-char in))) (cond ((eof-object? c) (reverse-list->string ls)) ((eqv? c #\newline) (reverse-list->string (cons c ls))) (else (read-to-eol in (cons c ls)))))) (define (collect str res) (if (pair? str) (cons (reverse-list->string str) res) res)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define (highlight-scheme-delimiter? ch) (or (eof-object? ch) (char-whitespace? ch) (memq ch '(#\; #\# #\( #\) #\[ #\] #\{ #\} #\' #\` #\, #\")))) (define (highlight-scheme-definition? id) (memq id '(define define-syntax define-module define-class define-record define-record-type))) (define (highlight-scheme-syntax? id) (memq id '(if lambda define set! cond case let let* letrec letrec* let-values let-values* let-optionals let-optionals* let-keywords let-keywords* and-let* rec receive do loop rxmatch-cond rxmatch-case begin when unless match match-lambda match-let match-let* dotimes dolist quote quasiquote unquote unquote-splicing error errorf define-syntax let-syntax letrec-syntax syntax-rules syntax-case parameterize module library require require-extension use use-modules import import-immutable define-module select-module provide autoload export only except rename prefix drop-prefix alias-for include include-ci include-shared condition-case guard protect cond-expand for with to by in-list in-lists in-string in-string-reverse in-vector in-vector-reverse in-file listing appending summing multpliying up-from down-from else ))) ;;> Highlighter for Scheme source code. (define (highlight-scheme source) (let ((in (if (string? source) (open-input-string source) source))) (define (read-identifier ls) (let ((c (peek-char in))) (cond ((highlight-scheme-delimiter? c) (reverse-list->string ls)) (else (read-char in) (read-identifier (cons c ls)))))) (define (hash-mark) (let ((c (read-char in))) (case c ((#\;) (highlight-class "comment" (highlight 0 '(#\; #\#) '()))) ((#\\) (highlight-class "string" (read-identifier (list (read-char in) #\\ #\#)))) (else (string-append "#" (if (char? c) (string c) "")))))) (define (highlight n str res) (let ((c (read-char in))) (if (eof-object? c) (reverse (collect str res)) (case c ((#\;) (let lp ((ls '())) (let ((ls (cons (read-to-eol in (list #\;)) ls))) (cond ((eqv? #\; (peek-char in)) (lp ls)) (else (highlight n '() (cons (highlight-class "comment" (string-concatenate-reverse ls)) (collect str res)))))))) ((#\") (let ((s (read-escaped in #\" (list #\")))) (highlight n '() (cons (highlight-class "string" s) (collect str res))))) ((#\() ;;(highlight-start ;; (string->symbol ;; (string-append ;; "paren" ;; (number->string ;; (+ 1 (modulo n (length highlight-paren-styles)))))) ;;out) (let ((res (collect (cons #\( str) res))) (if (highlight-scheme-delimiter? (peek-char in)) (highlight (+ n 1) '() res) (let* ((id (read-identifier '())) (sym (string->symbol id))) (cond ((highlight-scheme-definition? sym) (let* ((res (cons (highlight-class "keyword" id) res)) (res (cons (read-whitespace in) res)) (res (if (eqv? #\( (peek-char in)) (cons (string (read-char in)) res) res))) (highlight (+ n 1) '() (cons (highlight-class "function" (read-identifier '())) res)))) ((highlight-scheme-syntax? sym) (highlight (+ n 1) '() (cons (highlight-class "keyword" id) res))) (else (highlight (+ n 1) '() (cons id res)))))))) ((#\)) (cond ((zero? n) (highlight n '() (cons (highlight-class "syntaxerror" ")") (collect str res)))) (else ;;(highlight-end 'paren (highlight (- n 1) (cons c str) res)))) ((#\#) (highlight n '() (cons (hash-mark) (collect str res)))) (else (cond ((highlight-scheme-delimiter? c) (highlight n (cons c str) res)) (else (let ((id (read-identifier (list c)))) (highlight n '() (cons `(span ,id) (collect str res))))))))))) (highlight 0 '() '()))) (define (highlight-c-keyword? id) (memq id '(asm break case catch const_cast continue default delete do dynamic_cast else explicit export false for friend goto if mutable namespace new operator private protected public register reinterpret_cast return sizeof static_cast switch template this throw true try typedef typeid typename using virtual while))) (define (highlight-c-type? id) (memq id '(auto bool char class const double enum extern float inline int long short signed static struct union unsigned void volatile wchar_t sexp sexp_uint_t sexp_sint_t))) ;;> Highlighter for C source code. (define (highlight-c source) (let ((in (if (string? source) (open-input-string source) source))) (define (char-c-initial? c) (and (char? c) (or (char-alphabetic? c) (eqv? c #\_) (eqv? c #\$)))) (define (char-c-identifier? c) (and (char? c) (or (char-c-initial? c) (char-numeric? c)))) (define (read-identifier in ls) (let ((c (peek-char in))) (if (char-c-identifier? c) (read-identifier in (cons (read-char in) ls)) (reverse-list->string ls)))) (define (highlight-identifier id) (let ((sym (string->symbol id))) (cond ((highlight-c-keyword? sym) (highlight-class "keyword" id)) ((highlight-c-type? sym) (highlight-class "type" id)) (else id)))) (define (highlight-line res) (highlight '() (cond ((eqv? #\# (peek-char in)) (read-char in) (let* ((res (cons (read-whitespace in) (cons "#" res))) (id (read-identifier in '())) (res (cons (read-whitespace in) (cons (highlight-class "preprocessor" id) res)))) (case (string->symbol id) ((define) (cons (highlight-class "function" (read-to-whitespace in '())) res)) ((include import) (cons (highlight-class "string" (read-to-whitespace in '())) res)) (else res)))) ((char-c-initial? (peek-char in)) ;; line beginning w/ an identifier is probably a ;; function declaration (let ((id1 (read-identifier in '()))) (cond ((eqv? #\: (peek-char in)) (cons (highlight-class "function" id1) res)) (else (let lp ((decls '()) (id id1)) (let ((space (read-whitespace in))) (cond ((char-c-initial? (peek-char in)) (lp (cons space (cons id decls)) (read-identifier in '()))) ((eqv? #\( (peek-char in)) `(,space ,(highlight-class "function" id) ,(highlight-class "type" (reverse decls)) ,@res)) (else `(,space ,id ,@decls ,@res))))))))) (else res)))) (define (highlight str res) (let ((c (read-char in))) (if (eof-object? c) (reverse (collect str res)) (case c ((#\/) (case (peek-char in) ((#\/) (highlight '() (cons (highlight-class "comment" (read-to-eol in '(#\/ #\/))) (collect str res)))) ((#\*) (let lp ((ls (cons (read-char in) '(#\/)))) (let ((c (read-char in))) (if (not (and (eqv? (car ls) #\*) (eqv? c #\/))) (lp (cons c ls)) (highlight '() (cons (highlight-class "comment" (reverse-list->string ls)) (collect str res))))))) (else (highlight (cons c str) res)))) ((#\" #\') (let ((res (collect str res)) (s (read-escaped in c (list c)))) (highlight '() (cons (highlight-class "string" s) res)))) ((#\newline) (highlight-line (collect (cons #\newline str) res))) (else (cond ((char-c-initial? c) (highlight '() (cons (let ((id (read-identifier in (list c)))) (if (eqv? #\: (peek-char in)) (highlight-class "function" id) (highlight-identifier id))) (collect str res)))) (else (highlight (cons c str) res)))))))) (highlight-line '()))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;> Highlighter for Assembly source code. (define (highlight-assembly source) (let ((in (if (string? source) (open-input-string source) source))) (define (char-asm-initial? c) (and (char? c) (or (char-alphabetic? c) (memv c '(#\_ #\$ #\.))))) (define (char-asm-identifier? c) (and (char? c) (or (char-asm-initial? c) (char-numeric? c)))) (define (read-identifier in ls) (let ((c (peek-char in))) (if (char-asm-identifier? c) (read-identifier (cons (read-char in) ls)) (reverse-list->string ls)))) (define (highlight str res) (let ((c (read-char in))) (cond ((eof-object? c) (reverse (collect str res))) (else (case c ((#\newline) (highlight-line (collect str res))) ((#\") (let ((s (read-escaped in c (list c)))) (highlight '() (cons (highlight-class "string" s) (collect str res))))) ((#\%) (highlight '() (cons (highlight-class "variable" (read-identifier in (list c))) (collect str res)))) ((#\;) (highlight '() (cons (highlight-class "comment" (read-to-eol in (list c))) (collect str res)))) (else (highlight (cons c str) res))))))) (define (highlight-line res) (cond ((eof-object? (peek-char in)) (highlight '() res)) ((char-asm-initial? (peek-char in)) (let ((id (read-identifier in '()))) (highlight '() (cons (if (eqv? #\: (peek-char in)) (highlight-class "function" id) (highlight-class "keyword" id)) res)))) ((eqv? #\tab (peek-char in)) (highlight '() (cons (highlight-class "keyword" (read-identifier in '())) (cons "\t" res)))) (else (highlight '() res)))) (highlight-line '())))
true
2e4aa6834bdbeec4a10c844e47305dfc83c04a8c
681616420303997af5c52d5711e03c897cdba97e
/srfi-194-test.scm
843f1913d977359724977ef65470c618fa8ddfab
[]
no_license
scheme-requests-for-implementation/srfi-194
1cafcfb7ab081a3b563c2ed2eb0d9d87ca20fa05
f7ea8789aa343863b52620b113a3451bea955aa2
refs/heads/master
2023-03-08T16:01:22.829546
2023-03-06T20:38:36
2023-03-06T20:38:36
261,225,016
1
6
null
2023-03-06T20:38:37
2020-05-04T15:35:24
Scheme
UTF-8
Scheme
false
false
21,349
scm
srfi-194-test.scm
;; NOTE: for zipf tests data can be exported, this can be enabled by uncommenting appropriate lines. (import (scheme base) (scheme inexact) (scheme complex) (scheme cxr) (scheme file) (scheme write) (srfi 1) (srfi 27) (srfi 133) (srfi 194)) (cond-expand ((library (srfi 158)) (import (srfi 158))) ((library (srfi 121)) (import (srfi 121)))) (cond-expand (chibi (begin (import (except (chibi test) test-equal)) (define-syntax test-equal (syntax-rules () ((_ args ...) (test args ...)))) (define-syntax test-approximate (syntax-rules () ((_ target value max-delta) (test-assert (and (<= value (+ target max-delta)) (>= value (- target max-delta))))))))) (else (import (srfi 64)))) ;; syntax just we can plop it at top and still allow internal `define`s (define-syntax reset-source! (syntax-rules () ((_) (define _ (random-source-pseudo-randomize! (current-random-source) 0 0))))) (define (reset-source!*) (random-source-pseudo-randomize! (current-random-source) 0 0)) (define (assert-number-generator/all-in-range gen from to) (test-assert (generator-every (lambda (num) (and (>= num from) (< num to))) (gtake gen 1000)))) (define (assert-number-generator gen from to) (define range (- to from)) (define lower-quarter (+ from (* 0.25 range))) (define upper-quarter (- to (* 0.25 range))) (assert-number-generator/all-in-range gen from to) (test-assert (generator-any (lambda (num) (and (>= num from) (< num lower-quarter))) (gtake gen 1000))) (test-assert (generator-any (lambda (num) (and (>= num lower-quarter) (< num upper-quarter))) (gtake gen 1000))) (test-assert (generator-any (lambda (num) (and (>= num upper-quarter) (< num to))) (gtake gen 1000)))) (define (assert-int-generator gen byte-size signed?) (define from (if signed? (- (expt 2 (- byte-size 1))) 0)) (define to (if signed? (expt 2 (- byte-size 1)) (expt 2 byte-size))) (assert-number-generator gen from to)) (test-begin "srfi-194") (test-group "Test clamp real number" (reset-source!) (test-equal 10.0 (clamp-real-number 5.0 10.0 11)) (test-equal 5.0 (clamp-real-number 5.0 10.0 2.0)) (test-equal 7.5 (clamp-real-number 5.0 10.0 7.5))) (test-group "Test with-random-source basic syntax" (reset-source!) (with-random-source default-random-source (lambda () (make-random-integer-generator 0 10)))) ;; testing random source, which is implementation specific (cond-expand (gauche (import (gauche base) (math mt-random)) (test-group "Test with-random-source" (reset-source!) ;;create and consume generators that are made with different source ;;with various order, and check that order doesn't change the outcome (define (test-multiple-sources gen1-maker gen1-expect gen2-maker gen2-expect) ;;create gen1, consume gen1, create gen2, consume gen2 (let ((gen1 (gen1-maker))) (test-equal (generator->list gen1) gen1-expect) (let ((gen2 (gen2-maker))) (test-equal (generator->list gen2) gen2-expect))) ;;create gen1, create gen2, consume gen1, consume gen2 (let ((gen1 (gen1-maker)) (gen2 (gen2-maker))) (test-equal (generator->list gen1) gen1-expect) (test-equal (generator->list gen2) gen2-expect))) (define multiple-sources-testcase (list (lambda () (gtake (with-random-source (make <mersenne-twister> :seed 0) (lambda () (make-random-integer-generator 0 10))) 5)) '(5 5 7 8 6) (lambda () (gtake (with-random-source (make <mersenne-twister> :seed 1) (lambda () (make-random-integer-generator 0 10))) 5)) '(4 9 7 9 0))) (apply test-multiple-sources multiple-sources-testcase)))) (test-group "Test make-random-source-generator" (reset-source!) (define (make-numbers src-gen) (define gen1 (with-random-source (src-gen) (lambda () (make-random-integer-generator 0 100)))) (define gen2 (with-random-source (src-gen) (lambda () (make-random-real-generator 0. 100.)))) (generator->list (gappend (gtake gen1 10) (gtake gen2 10)))) (test-equal (make-numbers (make-random-source-generator 0)) (make-numbers (make-random-source-generator 0))) (test-assert (not (equal? (make-numbers (make-random-source-generator 0)) (make-numbers (make-random-source-generator 1)))))) (test-group "Test random int" (reset-source!) (assert-number-generator (make-random-integer-generator 1 100) 1 100) (for-each (lambda (testcase) (define make-gen (car testcase)) (define byte-size (cadr testcase)) (define signed? (caddr testcase)) (assert-int-generator (make-gen) byte-size signed?)) (list (list make-random-u8-generator 8 #f) (list make-random-s8-generator 8 #t) (list make-random-u16-generator 16 #f) (list make-random-s16-generator 16 #t) (list make-random-u32-generator 32 #f) (list make-random-s32-generator 32 #t) (list make-random-u64-generator 64 #f) (list make-random-s64-generator 64 #t))) ;;test u1 separately, since it will fail quarter checks due to small range (assert-number-generator/all-in-range (make-random-u1-generator) 0 2) (test-assert (generator-any (lambda (v) (= v 0)) (gtake (make-random-u1-generator) 100))) (test-assert (generator-any (lambda (v) (= v 1)) (gtake (make-random-u1-generator) 100)))) (test-group "Test random real" (reset-source!) (assert-number-generator (make-random-real-generator 1.0 5.0) 1.0 5.0) (test-assert (generator-any (lambda (v) (not (= v (floor v)))) (make-random-real-generator 1.0 5.0)))) (test-group "Test complex rectangular" (reset-source!) (assert-number-generator (gmap real-part (make-random-rectangular-generator -10.0 10.0 -100.0 100.0)) -10 10) (assert-number-generator (gmap imag-part (make-random-rectangular-generator -100.0 100.0 -10.0 10.0)) -10 10) (test-assert (generator-any (lambda (num) (and (not (= 0 (real-part num))) (not (= 0 (imag-part num))))) (make-random-rectangular-generator -10.0 10.0 -10.0 10.0)))) (test-group "Test complex polar" (reset-source!) (define PI (* 4 (atan 1.0))) (define (test-polar g origin mag-from mag-to angle-from angle-to test-converge-origin) (assert-number-generator (gmap (lambda (num) (angle (- num origin))) g) angle-from angle-to) (assert-number-generator (gmap (lambda (num) (magnitude (- num origin))) g) mag-from mag-to) ;; split generated area through circle at 0.5*(mag-from + mag-to) ;; and validate generated points in them proportional to their area (let* ((outter-count 0) (inner-count 0) (donut-area (lambda (r1 r2) (- (* r1 r1) (* r2 r2)))) (mag-mid (/ (+ mag-from mag-to) 2.)) (expected-fraction (/ (donut-area mag-to mag-mid) (donut-area mag-mid mag-from)))) (generator-for-each (lambda (point) (if (< (magnitude (- point origin)) mag-mid) (set! inner-count (+ 1 inner-count)) (set! outter-count (+ 1 outter-count)))) (gtake g 10000)) (test-approximate expected-fraction (/ outter-count inner-count) 0.2)) ;; test points converge to center (when test-converge-origin (let ((sum 0+0i)) (generator-for-each (lambda (point) (set! sum (+ point sum))) (gtake g 1000)) (test-approximate (real-part origin) (real-part (/ sum 1000.)) 0.1) (test-approximate (imag-part origin) (imag-part (/ sum 1000.)) 0.1)))) (test-polar (make-random-polar-generator 0. 1.) 0+0i 0. 1. (- PI) PI #t) (test-polar (make-random-polar-generator 2+5i 1. 2.) 2+5i 1. 2. (- PI) PI #t) (test-polar (make-random-polar-generator 1. 2. -1. 1.) 0+0i 1. 2. -1. 1. #f) (test-polar (make-random-polar-generator -1+3i 0. 2. (- PI) PI) -1+3i 0. 2. (- PI) PI #t)) (test-group "Test random bool" (reset-source!) (test-assert (generator-every (lambda (v) (or (eq? v #t) (eq? v #f))) (gtake (make-random-boolean-generator) 10000))) (test-assert (generator-any (lambda (v) (eq? #t v)) (make-random-boolean-generator))) (test-assert (generator-any (lambda (v) (eq? #f v)) (make-random-boolean-generator)))) (test-group "Test random char" (reset-source!) (test-assert (generator-every (lambda (v) (or (equal? v #\a) (equal? v #\b))) (gtake (make-random-char-generator "ab") 10000))) (test-assert (generator-any (lambda (v) (equal? v #\a)) (make-random-char-generator "ab"))) (test-assert (generator-any (lambda (v) (equal? v #\b)) (make-random-char-generator "ab")))) (test-group "Test random string" (reset-source!) (test-assert (generator-every (lambda (str) (and (< (string-length str) 5) (every (lambda (c) (or (equal? c #\a) (equal? c #\b))) (string->list str)))) (gtake (make-random-string-generator 5 "ab") 10000))) (test-assert (generator-any (lambda (str) (equal? "abb" str)) (make-random-string-generator 4 "ab")))) (test-group "Test Bernoulli" (reset-source!) (define g (make-bernoulli-generator 0.7)) (define expect 7000) (define actual (generator-count (lambda (i) (= i 1)) (gtake g 10000))) (define ratio (inexact (/ actual expect))) (test-assert (> ratio 0.9)) (test-assert (< ratio 1.1))) (test-group "Test categorical" (reset-source!) (define result-vec (vector 0 0 0)) (define expect-vec (vector 2000 5000 3000)) (define wvec (vector 20 50 30)) (define g (make-categorical-generator wvec)) (generator-for-each (lambda (i) (vector-set! result-vec i (+ 1 (vector-ref result-vec i)))) (gtake g 10000)) (vector-for-each (lambda (result expect) (define ratio (inexact (/ result expect))) (test-approximate 1.0 ratio 0.1)) result-vec expect-vec)) (test-group "Test poisson" (reset-source!) ;;TODO import from somewhere? (define (fact k) (cond ((<= k 1) 1) (else (* k (fact (- k 1)))))) (define (expected-fraction L k) (/ (* (exact (expt L k)) (exact (exp (- L)))) (fact k))) (define (test-poisson L poisson-gen test-points) (generator-every (lambda (k) (define expect (expected-fraction L k)) (define actual (/ (generator-count (lambda (i) (= i k)) (gtake poisson-gen 10000)) 10000)) (define ratio (/ actual expect)) (test-assert (> ratio 8/10)) (test-assert (< ratio 12/10))) (list->generator test-points))) (test-poisson 2 (make-poisson-generator 2) '(1 2 3)) (test-poisson 40 (make-poisson-generator 40) '(30 40 50)) (test-poisson 280 (make-poisson-generator 280) '(260 280 300))) (test-group "Test normal" (reset-source!) (define frac-at-1dev 0.34134) (define frac-at-2dev 0.47725) (define frac-at-3dev 0.49865) (define (test-normal-at-point gen count-from count-to expected-fraction) (define actual (/ (generator-count (lambda (n) (and (>= n count-from) (< n count-to))) (gtake gen 10000)) 10000.0)) (test-assert (and (> actual (* 0.9 expected-fraction)) (< actual (* 1.1 expected-fraction))))) (define (test-normal gen mean deviation) (test-normal-at-point gen mean (+ mean deviation) frac-at-1dev) (test-normal-at-point gen mean (+ mean (* 2 deviation)) frac-at-2dev) (test-normal-at-point gen mean (+ mean (* 3 deviation)) frac-at-3dev)) (test-normal (make-normal-generator) 0.0 1.0) (test-normal (make-normal-generator 1.0) 1.0 1.0) (test-normal (make-normal-generator 1.0 2.0) 1.0 2.0)) (test-group "Test exponential" (reset-source!) (define (expected-fraction mean x) (- 1 (exp (* (- (/ 1.0 mean)) x)))) (define (test-exp-at-point gen count-to expected) (define actual (/ (generator-count (lambda (n) (< n count-to)) (gtake gen 10000)) 10000.0)) (test-assert (> actual (* 0.9 expected))) (test-assert (< actual (* 1.1 expected)))) (define (test-exp gen mean) (test-exp-at-point gen 1 (expected-fraction mean 1)) (test-exp-at-point gen 2 (expected-fraction mean 2)) (test-exp-at-point gen 3 (expected-fraction mean 3))) (test-exp (make-exponential-generator 1) 1) (test-exp (make-exponential-generator 1.5) 1.5)) (test-group "Test geometric" (reset-source!) (define (expected-fraction p x) (* (expt (- 1 p) (- x 1)) p)) (define (test-geom-at-point gen p x) (define expected (expected-fraction p x)) (define actual (/ (generator-count (lambda (n) (= n x)) (gtake gen 100000)) 100000)) (define ratio (/ actual expected)) (test-assert (> ratio 0.9)) (test-assert (< ratio 1.1))) (define (test-geom gen p) (test-geom-at-point gen p 1) (test-geom-at-point gen p 3) (test-geom-at-point gen p 5)) (test-geom (make-geometric-generator 0.5) 0.5)) (test-group "Test uniform sampling" (reset-source!) (test-equal '() (generator->list (gsampling))) (test-equal '() (generator->list (gsampling (generator) (generator)))) (test-equal '(1 1 1) (generator->list (gsampling (generator) (generator 1 1 1)))) (test-assert (generator-any (lambda (el) (= el 1)) (gsampling (circular-generator 1) (circular-generator 2)))) (test-assert (generator-any (lambda (el) (= el 2)) (gsampling (circular-generator 1) (circular-generator 2))))) ; See zipf-test.scm (test-group "Test Zipf sampling" (reset-source!) (include "zipf-test.scm") (zipf-test-group)) (test-group "Test sphere" (include "sphere-test.scm") (reset-source!*) (test-sphere (make-sphere-generator 1) (vector 1.0 1.0) 200 #t) (test-sphere (make-sphere-generator 2) (vector 1.0 1.0 1.0) 200 #t) (test-sphere (make-sphere-generator 3) (vector 1.0 1.0 1.0 1.0) 200 #t) (reset-source!*) (test-sphere (make-ellipsoid-generator (vector 1.0 1.0)) (vector 1.0 1.0) 200 #t) (test-sphere (make-ellipsoid-generator (vector 1.0 1.0 1.0)) (vector 1.0 1.0 1.0) 200 #t) (test-sphere (make-ellipsoid-generator (vector 1.0 1.0 1.0 1.0)) (vector 1.0 1.0 1.0 1.0) 200 #t) (reset-source!*) (test-sphere (make-ellipsoid-generator (vector 1.0 3.0)) (vector 1.0 3.0) 200 #f) (test-sphere (make-ellipsoid-generator (vector 1.0 3.0 5.0)) (vector 1.0 3.0 5.0) 200 #f) (test-sphere (make-ellipsoid-generator (vector 1.0 3.0 5.0 7.0)) (vector 1.0 3.0 5.0 7.0) 200 #f) (reset-source!*) (test-ball (make-ball-generator 2) (vector 1.0 1.0)) (test-ball (make-ball-generator 3) (vector 1.0 1.0 1.0)) (test-ball (make-ball-generator (vector 1.0 3.0)) (vector 1.0 3.0)) (test-ball (make-ball-generator (vector 1.0 3.0 5.0)) (vector 1.0 3.0 5.0))) (test-group "Test binomial" (reset-source!) (define (factorial n) (if (<= n 1) 1 (* n (factorial (- n 1))))) (define (C n k) (/ (factorial n) (* (factorial k) (factorial (- n k))))) (define (expected-frac n p k) (* (C n k) (expt p k) (expt (- 1 p) (- n k)))) (define (test-binomial n p count) (define g (make-binomial-generator n p)) (define counts (make-vector (+ n 1) 0)) (generator-for-each (lambda (x) (vector-set! counts x (+ 1 (vector-ref counts x)))) (gtake g count)) (for-each (lambda (k) (define expected (* count (expected-frac n p k) )) (define actual (vector-ref counts k)) (cond ((= expected 0) (test-equal 0 actual)) ;;hacky.. testing values with very low probability fails ((> expected (* 1/1000 count)) (test-approximate 1.0 (/ actual expected) 0.2)))) (iota (+ n 1)))) (test-binomial 1 0 100) (test-binomial 1 1 100) (test-binomial 1 0. 100) (test-binomial 1 1. 100) (test-binomial 10 0 100) (test-binomial 10 1 100) (test-binomial 10 0. 100) (test-binomial 10 1. 100) (test-binomial 10 0.25 100000) (test-binomial 40 0.375 1000000)) (test-end "srfi-194")
true
8cd45332dc7bfc1111344fceb2a75c16b025a019
4f17c70ae149426a60a9278c132d5be187329422
/impl/base.sls
cc3736efc33899c34a774c49638db7165d2db77c
[]
no_license
okuoku/yuni-core
8da5e60b2538c79ae0f9d3836740c54d904e0da4
c709d7967bcf856bdbfa637f771652feb1d92625
refs/heads/master
2020-04-05T23:41:09.435685
2011-01-12T15:54:23
2011-01-12T15:54:23
889,749
2
0
null
null
null
null
UTF-8
Scheme
false
false
457
sls
base.sls
(library (yuni impl base) (export define cond case assertion-violation quote else symbol? null? pair? vector? if let or and lambda set! unless cons car cdr apply vector vector->list eq? list list? length cadr caddr cadddr map append not + = reverse display newline write ) (import (rnrs)))
false
f6cabdbed6fa4be1a5d05cba64fb02445774056a
895daaa3a466ec7f61773b892920dfbe8d78780e
/exercises/ch1.2-procedures-and-processes.scm
b05c54c886c081f7003cc1f6d6545a9c1b3718e4
[]
no_license
jwalsh/scheme-workshop-2014
feac007278a4255ccdb6c82814ea18bbf646d8fa
32718dbdc3a83d0508f7b6110c59e7e960db7b62
refs/heads/master
2016-09-05T16:18:50.247061
2015-03-25T19:17:42
2015-03-25T19:17:42
26,870,183
0
0
null
null
null
null
UTF-8
Scheme
false
false
599
scm
ch1.2-procedures-and-processes.scm
;; 1B Procedures and Processes ;; Create a mechanical model for how the machine performs the ;; substitution (define (square x) (* x x)) (define (sum-of-squares x y) (+ (square x) (square y))) (sum-of-squares 3 4) ;; Linear time and space for recursion of plus (define (inc x) (+ x 1)) (define (dec x) (- x 1)) (define (plus x y) (if (= x 0) y (plus (dec x) (inc y)))) (plus 3 4) (define (expt b n) (expt-iter b n 1)) (define (expt-iter b counter product) (if (= counter 0) product (expt-iter b (- counter 1) (* b product))))
false
cabc1b86aa91636c4bdff66bc1c2a885069c0d48
d17943098180a308ae17ad96208402e49364708f
/platforms/js-vm/private/tests/benchmarks/common/mazefun.rkt
8c2166045976274073854492409858e7aa97a3a0
[]
no_license
dyoo/benchmark
b3f4f39714cc51e1f0bc176bc2fa973240cd09c0
5576fda204529e5754f6e1cc8ec8eee073e2952c
refs/heads/master
2020-12-24T14:54:11.354541
2012-03-02T19:40:48
2012-03-02T19:40:48
1,483,546
1
0
null
null
null
null
UTF-8
Scheme
false
false
28
rkt
mazefun.rkt
(module mazefun "wrap.ss")
false
a50a3973a56296c93ead5c0aa2cd30da4069f8ac
6fe3cf1c6fabcf6020aae0df8154b1d3ffb334b1
/examples/pure-arith.scm
7a7a592b431146be41e05d7bf1ff9a4e0ec4cbb1
[]
no_license
tonyg/pgg
bd4eae9196abcca94f316e0198408b9bd90a7820
1625eba59e529b92572cb51b3749015e793d3563
refs/heads/master
2020-06-04T04:30:57.758708
2012-04-11T01:11:50
2012-04-11T01:11:50
3,988,925
5
0
null
null
null
null
UTF-8
Scheme
false
false
112
scm
pure-arith.scm
(define-primitive + - pure) (define-primitive - - pure) (define-primitive * - pure) (define-primitive / - pure)
false
ec5283207930180cea3e2a5e0151e286b4e89cba
382770f6aec95f307497cc958d4a5f24439988e6
/projecteuler/065/065.scm
e602182329011a20fd784e92926ff0dc9e55b47d
[ "Unlicense" ]
permissive
include-yy/awesome-scheme
602a16bed2a1c94acbd4ade90729aecb04a8b656
ebdf3786e54c5654166f841ba0248b3bc72a7c80
refs/heads/master
2023-07-12T19:04:48.879227
2021-08-24T04:31:46
2021-08-24T04:31:46
227,835,211
1
0
null
null
null
null
UTF-8
Scheme
false
false
552
scm
065.scm
(define get-num (lambda (a) (let* ([stra (number->string a)] [clsa (string->list stra)] [lsa (map (lambda (x) (- (char->integer x) (char->integer #\0))) clsa)]) lsa))) (define fact (lambda (n) (cond ((= n 0) 2) ((= n 1) 1) ((= n 2) 2) ((or (= (remainder n 3) 0) (= (remainder n 3) 1)) 1) (else (* (/ (+ n 1) 3) 2))))) (define neo (let f ([i 0]) (cond ((= i 99) (fact 99)) (else (+ (fact i) (/ (f (+ i 1)))))))) (apply + (get-num (numerator neo)))
false
8a255028d8a3e91c5f3ef9003ed598da481a4308
84c9e7520891b609bff23c6fa3267a0f7f2b6c2e
/2.45.scm
be359bf4820c322811c413364a7fc40287d1d4e5
[]
no_license
masaedw/sicp
047a4577cd137ec973dd9a7bb0d4f58d29ef9cb0
11a8adf49897465c4d8bddb7e1afef04876a805d
refs/heads/master
2020-12-24T18:04:01.909864
2014-01-23T11:10:11
2014-01-23T11:17:38
6,839,863
1
0
null
null
null
null
UTF-8
Scheme
false
false
792
scm
2.45.scm
(add-load-path ".") (use SICP) (define (square-of-four tl tr bl br) (lambda (painter) (let ((top (beside (tl painter) (tr painter))) (bottom (beside (bl painter) (br painter)))) (below bottom top)))) (define (flipped-pairs painter) (let ((combine4 (square-of-four identity flip-vert identity flip-vert))) (combine4 painter))) (define (square-limit painter n) (let ((combine4 (square-of-four flip-horiz identity rotate180 flip-vert))) (combine4 (corner-split painter n)))) (define (split p1 p2) (define (sub painter n) (if (= n 0) painter (let ((smaller (sub painter (- n 1)))) (p1 painter (p2 smaller smaller))))) (lambda (painter n) (sub painter n)))
false
8958fdc349efe817b761bfe636a3eb440b62644b
eef5f68873f7d5658c7c500846ce7752a6f45f69
/test/util-srfi-71.scm
38e3cba27c88576468e058f1699c2989b00cf55b
[ "MIT" ]
permissive
alvatar/spheres
c0601a157ddce270c06b7b58473b20b7417a08d9
568836f234a469ef70c69f4a2d9b56d41c3fc5bd
refs/heads/master
2021-06-01T15:59:32.277602
2021-03-18T21:21:43
2021-03-18T21:21:43
25,094,121
13
3
null
null
null
null
UTF-8
Scheme
false
false
3,604
scm
util-srfi-71.scm
(##spheres-load core: testing) (##spheres-include let-multiple-macros) ;; Based on code by [email protected], 1-Aug-2005, R5RS + SRFI-71. (check-set-mode! 'summary) ;; --- test cases for unnamed r5rs-let --- ;; form2 with one value (i.e. ordinary srfi-let) (check (srfi-let () 1) => 1) (check (srfi-let ((x1 1)) x1) => 1) (check (srfi-let ((x1 1) (y1 2)) (list x1 y1)) => '(1 2)) ;; form2 with two (check (srfi-let ((x1 x2 (values 1 2))) (list x1 x2)) => '(1 2)) (check (srfi-let ((x1 x2 x3 (values 1 2 3))) (list x1 x2 x3)) => '(1 2 3)) ;; form1 without rest arg (check (srfi-let (((values) (values))) 1) => 1) (check (srfi-let (((values x1) (values 1))) x1) => 1) (check (srfi-let (((values x1 x2) (values 1 2))) (list x1 x2)) => '(1 2)) (check (srfi-let (((values x1 x2 x3) (values 1 2 3))) (list x1 x2 x3)) => '(1 2 3)) ;; form1 with rest arg only (check (srfi-let (((values . x0+) (values))) x0+) => '()) (check (srfi-let (((values . x0+) (values 1))) x0+) => '(1)) (check (srfi-let (((values . x0+) (values 1 2))) x0+) => '(1 2)) (check (srfi-let (((values . x0+) (values 1 2 3))) x0+) => '(1 2 3)) ;; form1 with one and rest arg (check (srfi-let (((values x1 . x1+) (values 1))) (cons x1 x1+)) => '(1)) (check (srfi-let (((values x1 . x1+) (values 1 2))) (cons x1 x1+)) => '(1 2)) (check (srfi-let (((values x1 . x1+) (values 1 2 3))) (cons x1 x1+)) => '(1 2 3)) ;; form1 with two and rest arg (check (srfi-let (((values x1 x2 . x2+) (values 1 2))) (cons x1 (cons x2 x2+))) => '(1 2)) (check (srfi-let (((values x1 x2 . x2+) (values 1 2 3))) (cons x1 (cons x2 x2+))) => '(1 2 3)) ;; --- test cases for named srfi-let --- ;; ordinary form (check (srfi-let loop ((x 1)) (if (zero? x) x (loop (- x 1)))) => 0) ;; using (values x) (check (srfi-let loop (((values x) 1)) (if (zero? x) x (loop (- x 1)))) => 0) ;; --- test cases for srfi-let* --- ;; We assume that srfi-let* is defined in terms of srfi-let but check ;; if the scopes are correct. ;; simple srfi-let (check (srfi-let* () 1) => 1) (check (srfi-let* ((x1 1)) x1) => 1) (check (srfi-let* (((values x1 x2 . x2+) (values 1 2 3))) (cons x1 (cons x2 x2+))) => '(1 2 3)) ;; nested srfi-let (check (srfi-let* ((x1 1) (y1 x1)) (list x1 y1)) => '(1 1)) (check (srfi-let* (((values x1 x2 . x2+) (values 1 2 3)) ((values y1 y2 . y2+) (apply values x1 x2 x2+))) (list (cons x1 (cons x2 x2+)) (cons y1 (cons y2 y2+)))) => '((1 2 3) (1 2 3))) ;; --- test cases for srfi-letrec --- ;; original srfi-letrec (check (srfi-letrec () 1) => 1) (check (srfi-letrec ((x 1)) x) => 1) (check (srfi-letrec ((x 1) (y 2)) (list x y)) => '(1 2)) (check (srfi-letrec ((x (lambda () (y))) (y (lambda () 1))) (x)) => 1) ;; too few test cases... (check (srfi-letrec ((x y (values (lambda () (y)) (lambda () 1)))) (x)) => 1) ;; --- nasty things --- (check (srfi-let ((values 1)) values) => 1) (check (srfi-let (((values values) 1)) values) => 1) (check (srfi-let (((values bad values) (values 1 2))) (list bad values)) => '(1 2)) ;; --- values->list etc. --- (check (values->list (values)) => '()) (check (values->list (values 1)) => '(1)) (check (values->list (values 1 2)) => '(1 2)) (check (values->list (values 1 2 3)) => '(1 2 3)) (check (values->vector (values)) => '#()) (check (values->vector (values 1)) => '#(1)) (check (values->vector (values 1 2)) => '#(1 2)) (check (values->vector (values 1 2 3)) => '#(1 2 3)) (check-report)
false
752e4cf8c7831bfa32ac3068f89d4d82db84189f
6b8bee118bda956d0e0616cff9ab99c4654f6073
/schcuda/testing/cstruct.ss
124d2ff89265da28b81546857d5c54940657bda8
[]
no_license
skchoe/2012.Functional-GPU-Programming
b3456a92531a8654ae10cda622a035e65feb762d
56efdf79842fc465770214ffb399e76a6bbb9d2a
refs/heads/master
2016-09-05T23:42:36.784524
2014-05-26T17:53:34
2014-05-26T17:53:34
20,194,204
1
0
null
null
null
null
UTF-8
Scheme
false
false
599
ss
cstruct.ss
#lang scheme (require scheme/foreign) (define-struct empty ()) (define a (make-empty)) (define (check-empty a) (if (empty? a) (printf "yes empty struct\n") (error "not empty struct\n"))) (check-empty a) ; ;(define-cstruct empty-t ()) ;(define a-t (make-empty-T)) ; ;(define (check-empty-t at) ; (if (empty-t? at) (printf "yes empty type\n") ; (error "not empty type\n"))) (define am (make-cstruct-type (list))) (define al (_list-struct)) (define (check-empty-l al) (if (ctype? al) (printf "yes empty list type\n") (error "not empty list\n"))) (check-empty-l al)
false
f991c48add11c3aaec7a411537318a62e30d4c95
8c460fc27ece8523af9be0c8b6c48461ff072e94
/test-assembler.scm
d2d17fb50dc3740c21eac58e94cd574eaf35390f
[]
no_license
ssbr/dcpu16-scheme
f1bc69821a13c6cb37ffbd7c51a1b63218233b0e
f17fcab6573a6a31b39a21b76585c66cb63a079c
refs/heads/master
2020-04-07T16:11:27.452424
2012-04-07T15:11:07
2012-04-07T15:11:07
null
0
0
null
null
null
null
UTF-8
Scheme
false
false
5,002
scm
test-assembler.scm
(load "assembler.scm") (define (glue-3hex operator a b) (cond ; woe is me, copy pasta ahoy [(> a #b111111) (raise-error "> 6 bits: ~a" a)] [(> b #b111111) (raise-error "> 6 bits: ~a" b)] [(> operator #b1111) (raise-error "> 4 bits: ~a" operator)] [else (+ (bitwise-arithmetic-shift b 10) (bitwise-arithmetic-shift a 4) operator)])) ; as a sanity check, one could check that... (assert (equal? (glue-3hex #xf #x3f #x3f) #xffff)) (define (glue-hex hex) (if (list? hex) (case (length hex) [(3) (apply glue-3hex hex)] [(2) (apply glue-3hex 0 hex)] [else (raise-error "Invalid hexop: ~a" hex)]) hex)) ; apparently chez lacks define-syntax-rule -- so lame! (define-syntax hexops (syntax-rules () [(_ <hex> ...) (map glue-hex '(<hex> ...))])) (define-syntax test-assembly (syntax-rules () [(_) (begin (format #t "Done!") (newline))] [(_ (<test-name> [<left> <right>] ...) <other-tests> ...) (let ([passed (andmap (lambda (a) (apply test-two a)) `((,<left> ,<right> <left> <right>) ...))]) (and passed (begin (format #t "~a: ... PASS" <test-name>) (newline) #t)) (test-assembly <other-tests> ...))])) (define (test-two left right left-display right-display) (let ([left (incorporate-labels (fixup-labels (assemble left)))]) (if (equal? left right) #t (begin (format #t "~a: ... FAIL" <test-name>) (newline) (format #t " ~a == ~a" '<left> left) (newline) (format #t " ~a == ~a" '<right> right) (newline) #f)))) (test-assembly ("Notch's example code :)" ['( (set a #x30) (set (ref #x1000) #x20) (sub a (ref #x1000)) (ifn a #x10) (set pc crash) (set i 10) (set a #x2000) loop (set (ref (+ i #x2000)) (ref a)) (sub i 1) (ifn i 0) ;; this would be better than the actual jump ; (sub pc (relative loop)) (set pc loop) (set x #x4) (jsr testsub) (set pc crash) testsub (shl x 4) (set pc pop) crash (set pc crash)) `( #x7c01 #x0030 #x7de1 #x1000 #x0020 #x7803 #x1000 #xc00d ;; This assembler is better than Notch's. :) ;#x7dc1 #x001a ,(glue-3hex #x1 #x1c #x36) ; looks about right. #xa861 #x7c01 #x2000 #x2161 #x2000 #x8463 #x806d ,(glue-3hex #x1 #x1c #x2c) #x9031 ,(glue-3hex #x0 #x1 #x34) ,(glue-3hex #x1 #x1c #x36) #x9037 #x61c1 ,(glue-3hex #x1 #x1c #x36))]) ("registers / [registers]" ['((set a (ref a))) (hexops (#x1 #x0 #x8))] ['((set b (ref b))) (hexops (#x1 #x1 #x9))] ['((set c (ref c))) (hexops (#x1 #x2 #xa))] ['((set x (ref x))) (hexops (#x1 #x3 #xb))] ['((set y (ref y))) (hexops (#x1 #x4 #xc))] ['((set z (ref z))) (hexops (#x1 #x5 #xd))] ['((set i (ref i))) (hexops (#x1 #x6 #xe))] ['((set j (ref j))) (hexops (#x1 #x7 #xf))]) ("[next word + register] / literals" ['((set (ref (+ 1 a)) 0)) (hexops (#x1 #x10 #x20) 1)] ['((set (ref (+ 1 b)) 1)) (hexops (#x1 #x11 #x21) 1)] ['((set (ref (+ 1 c)) 2)) (hexops (#x1 #x12 #x22) 1)] ['((set (ref (+ 1 x)) 3)) (hexops (#x1 #x13 #x23) 1)] ['((set (ref (+ 1 y)) 4)) (hexops (#x1 #x14 #x24) 1)] ['((set (ref (+ 1 z)) 5)) (hexops (#x1 #x15 #x25) 1)] ['((set (ref (+ 1 i)) 6)) (hexops (#x1 #x16 #x26) 1)] ['((set (ref (+ 1 j)) 7)) (hexops (#x1 #x17 #x27) 1)]) ("[A + 1] == [1 + A]" ['((set (ref (+ 1 a)) 0)) (hexops (#x1 #x10 #x20) 1)] ['((set (ref (+ a 1)) 0)) (hexops (#x1 #x10 #x20) 1)]) ("Stack operations" ['((set pop 8)) (hexops (#x1 #x18 #x28))] ['((set peek 9)) (hexops (#x1 #x19 #x29))] ['((set push #xa)) (hexops (#x1 #x1a #x2a))]) ("Rest of the values (SP/PC/O, [next], next)" ['((set sp #xb)) (hexops (#x1 #x1b #x2b))] ['((set pc #xc)) (hexops (#x1 #x1c #x2c))] ['((set o #xd)) (hexops (#x1 #x1d #x2d))] ['((set (ref #xff) #xe)) (hexops (#x1 #x1e #x2e) #xff)] ['((set #xff #xf)) (hexops (#x1 #x1f #x2f) #xff)]) ("Basic opcodes" ['((set a #x10)) (hexops (#x1 0 #x30))] ['((add a #x11)) (hexops (#x2 0 #x31))] ['((sub a #x12)) (hexops (#x3 0 #x32))] ['((mul a #x13)) (hexops (#x4 0 #x33))] ['((div a #x14)) (hexops (#x5 0 #x34))] ['((mod a #x15)) (hexops (#x6 0 #x35))] ['((shl a #x16)) (hexops (#x7 0 #x36))] ['((shr a #x17)) (hexops (#x8 0 #x37))] ['((and a #x18)) (hexops (#x9 0 #x38))] ['((bor a #x19)) (hexops (#xa 0 #x39))] ['((xor a #x1a)) (hexops (#xb 0 #x3a))] ['((ife a #x1b)) (hexops (#xc 0 #x3b))] ['((ifn a #x1c)) (hexops (#xd 0 #x3c))] ['((ifg a #x1d)) (hexops (#xe 0 #x3d))] ['((ifb a #x1e)) (hexops (#xf 0 #x3e))]) ("Non-basic opcodes" ['((jsr a)) (hexops (#x01 #x00))]))
true
819cb6643a0bd510685bc16178c855f5ffe9449c
5927f3720f733d01d4b339b17945485bd3b08910
/hato-log.scm
4644720f516ce03e935634eabe1866a9af89c93c
[]
no_license
ashinn/hato
85e75c3b6c7ca7abca512dc9707da6db3b50a30d
17a7451743c46f29144ce7c43449eef070655073
refs/heads/master
2016-09-03T06:46:08.921164
2013-04-07T03:22:52
2013-04-07T03:22:52
32,322,276
5
0
null
null
null
null
UTF-8
Scheme
false
false
7,119
scm
hato-log.scm
;; hato-log.scm -- Apache-style logging levels ;; ;; Copyright (c) 2005-2009 Alex Shinn. All rights reserved. ;; BSD-style license: http://synthcode.com/license.txt (require-library posix) (module hato-log (define-logger log-open log-close log-display log-format log-error-message log-call-chain log-error&call-chain current-log-port) (import scheme chicken extras data-structures ports posix) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define current-log-port (current-error-port)) (define current-log-file #f) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define-syntax define-logger (er-macro-transformer (lambda (expr r c) (let* ((level-info (cadr expr)) (loggers (let lp ((ls (caddr expr)) (i 0) (res '())) (cond ((null? ls) (reverse res)) ((pair? (car ls)) (if (<= (cadar ls) i) (error "log levels must be increasing" (caddr expr)) (lp (cdr ls) (+ (cadar ls) 1) (cons (car ls) res)))) (else (lp (cdr ls) (+ i 1) (cons (list (car ls) i) res)))))) (normalize-level (lambda (desc) (let ((str (symbol->string desc))) (if (and (> (string-length str) 4) (string=? "log-" (substring str 0 4))) (string->symbol (substring str 4)) desc)))) (log-descriptions (map (lambda (x) (cons (if (pair? (cddr x)) (caddr x) (normalize-level (car x))) (cadr x))) loggers)) (level-getter (car level-info)) (level-setter (cadr level-info)) (default-level (if (pair? (cddr level-info)) (caddr level-info) (cadr (car (reverse loggers))))) (level-var '*log-level*) (level-indexer 'x->level) (_define (r 'define)) (x (r 'x))) `(,(r 'begin) (,_define (,level-indexer ,x) (,(r 'cond) ((,(r 'assq) ,x ',log-descriptions) ,(r '=>) ,(r 'cdr)) ((,(r 'integer?) ,x) ,x) (,(r 'else) (,(r' error) "invalid log level" ,x)))) (,_define ,level-var (,(r 'cons) (,level-indexer ',default-level) '())) (,_define (,level-getter) (,(r 'car) ,level-var)) (,_define (,level-setter ,x) (,(r 'set-car!) ,level-var (,level-indexer ,x))) ,@(map (lambda (logger description) (let ((name (car logger)) (level (cadr logger))) `(,(r 'define-syntax) ,name (,(r 'er-macro-transformer) (,(r 'lambda) (,x ,(r 'r2) ,(r 'c2)) (,(r 'quasiquote) ((,(r 'unquote) (,(r 'r2) 'if)) ((,(r 'unquote) (,(r 'r2) '>=)) (,(r 'car) ,level-var) ,level) ((,(r 'unquote) (,(r 'r2) 'log-format)) ,(symbol->string (car description)) (,(r 'unquote-splicing) (,(r 'cdr) ,x)))))))))) loggers log-descriptions)))))) ;;(define-constant *week-day-abbrevs* ;; (vector "Sun" "Mon" "Tue" "Wed" "Thu" "Fri" "Sat")) ;;(define (week-day-abbrev i) ;; (if (<= 0 i 6) (vector-ref *week-day-abbrevs* i) "___")) (define (current-log-date-string) (define (pad0 n len) (let* ((s (number->string n)) (diff (- len (string-length s)))) (if (> diff 0) (string-append (make-string diff #\0) s) s))) (let ((now (seconds->local-time (current-seconds)))) ;; this makes lexicographic sort == chronological sort (sprintf "~A-~A-~A ~A:~A:~A" (pad0 (+ 1900 (vector-ref now 5)) 4) (pad0 (+ 1 (vector-ref now 4)) 2) (pad0 (vector-ref now 3) 2) (pad0 (vector-ref now 2) 2) (pad0 (vector-ref now 1) 2) (pad0 (vector-ref now 0) 2)))) ;; Use file-locking to let multiple processes write to the same log ;; file. On error try to re-open the log file. We keep the port open ;; so that even if you mv the file (e.g. when rotating logs) we keep ;; writing to it in the new location. To force writing to a new file in ;; the original location, use cp+rm instead of mv, or alternately SIGHUP ;; the process after the mv. (define (log-display type str) (let* ((prefix (sprintf "[~A] [~A] " (current-log-date-string) type)) (str (string-append prefix ; prefix all lines in message (string-intersperse (string-split str "\n") (string-append "\n" prefix)) "\n"))) (condition-case (let ((lock (and (output-port? current-log-port) (file-lock current-log-port)))) ;; this is redundant with POSIX O_APPEND ;;(set-file-position! current-log-port 0 seek/end) (display str current-log-port) (flush-output current-log-port) (and lock (file-unlock lock))) (e1 () ; try to re-open log-file, use stderr as backup (condition-case (begin (log-close) (log-open) (let ((lock (file-lock current-log-port))) (display str current-log-port) (flush-output current-log-port) (file-unlock lock))) (e2 () (let ((err (current-error-port))) (if (and (output-port? err) (not (eq? err current-log-port))) (display str err))))))))) (define (log-format type fmt . args) (log-display type (apply sprintf fmt args))) (define (log-open . o) (if (pair? o) (set! current-log-file (car o))) (if current-log-file (set! current-log-port (open-output-file current-log-file append:)))) (define (log-close) (if (output-port? current-log-port) (close-output-port current-log-port))) (define (log-error-message type exn) (log-format type "~A" (call-with-output-string (lambda (out) (print-error-message exn out ""))))) (define (log-call-chain . o) (let ((call-chain (if (pair? o) (car o) (get-call-chain 1 #t)))) (for-each (lambda (info) (let ((more1 (##sys#slot info 1)) (more2 (##sys#slot info 2))) (fprintf current-log-port "\t~A\t\t" (##sys#slot info 0)) (if more2 (fprintf current-log-port "[~A] " more2)) (if more1 (##sys#with-print-length-limit 100 (lambda () (##sys#print more1 #t current-log-port)))) (newline current-log-port))) call-chain))) (define (log-error&call-chain type exn) (let ((call-chain (get-call-chain 1 #t))) (log-error-message type exn) (log-call-chain call-chain))) )
true
963ed9351029bad0cedc5c09f84c0b5b9f01780d
4e64a8ed146a67f0d35d34a3c2d7af266d35e1eb
/scheme/scheme_files/test_car.scm
a4deaa2b133dcfa343703f923efafe53634ab682
[]
permissive
svenkeidel/sturdy
0900f427f8df1731be009ee4f18051e1e93356b4
4962b9fbe0dab0a7b07f79fe843f4265c782e007
refs/heads/master
2023-07-05T22:00:22.524391
2023-06-23T04:05:50
2023-06-23T04:06:14
126,147,527
55
8
BSD-3-Clause
2023-05-22T10:18:35
2018-03-21T08:34:54
Pascal
UTF-8
Scheme
false
false
15
scm
test_car.scm
(car '(1 4 5))
false
9057f82945198cf6d1c74f40e07667949fb6f176
8a0660bd8d588f94aa429050bb8d32c9cd4290d5
/sitelib/rpc/json.scm
a7f4121358d05bef96cba5e86ba53a1855611aa4
[ "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
5,577
scm
json.scm
;;; -*- mode:scheme; coding:utf-8; -*- ;;; ;;; rpc/json - JSON-RPC library. ;;; ;;; Copyright (c) 2010-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. ;;; ;; JSON-RPC version 2.0 ;; reference: http://www.jsonrpc.org/specification (library (rpc json) (export <json-request> make-json-request json-request-method json-request-params json-request-id json-request->json-string json-string->json-request json-response->json-string json-string->json-response json-response-id json-response-jsonrpc json-response-result) (import (rnrs) (clos user) (srfi :2 and-let*) (json) (rfc uuid) (rpc message) (rpc transport http)) (define-class <json-request> () (;; fixed version. we don't support 1.0 (jsonrpc :init-value "2.0" :reader json-request-jsonrpc) (method :init-keyword :method :reader json-request-method) (params :init-keyword :params :reader json-request-params :init-value '()) (id :init-keyword :id :reader json-request-id))) (define-class <json-response> () (;; fixed version. we don't support 1.0 (jsonrpc :init-value "2.0" :reader json-response-jsonrpc) (result :init-keyword :result :reader json-response-result) (id :init-keyword :id :reader json-response-id))) (define (make-json-request method :key (params '()) (id (uuid->string (make-v4-uuid)))) (make <json-request> :method method :params params :id id)) (define (json-request->json-string request) (call-with-string-output-port (lambda (out) (let ((sjosn `#((jsonrpc . ,(json-request-jsonrpc request)) (method . ,(json-request-method request)) (id . ,(json-request-id request)) (params . ,(json-request-params request))))) (json-write sjosn out))))) (define (json-string->json-request json) (let ((sjosn (vector->list (json-read (open-string-input-port json))))) (or (and-let* ((id (assoc "id" sjosn)) (jsonrpc (assoc "jsonrpc" sjosn)) ( (string=? (cdr jsonrpc) "2.0") ) (method (assoc "method" sjosn))) (let ((params (assoc "params" sjosn))) (apply make-json-request method :id id (if params `(:params ,(cdr params)) '())))) (error 'json-string->json-request "invalid JSON-RPC request" json)))) ;; response object doesn't have error means we don't create error ;; with the procedure. (define (json-response->json-string response) (call-with-string-output-port (lambda (out) (let ((sjosn `#((jsonrpc . ,(json-response-jsonrpc response)) (id . ,(json-response-id response)) (result . ,(json-response-result response))))) (json-write sjosn out))))) (define (json-string->json-response json) ;; the result must be vector (let ((sjosn (vector->list (json-read (open-string-input-port json))))) (or (and-let* ((id (assoc "id" sjosn)) (jsonrpc (assoc "jsonrpc" sjosn)) ( (string=? (cdr jsonrpc) "2.0") )) (cond ((assoc "error" sjosn) => (lambda (slot) (let ((ejson (vector->list (cdr slot)))) (error 'json->json-response (cdr (assoc "message" ejson)) `(code ,(cdr (assoc "code" ejson))) `(data ,(or (cond ((assoc "data" ejson) => cdr) (else '())))))))) ((assoc "result" sjosn) => (lambda (slot) (make <json-response> :result (cdr slot) :id (cdr id)))) (else (error 'json-string->json-response "invalid JSON-RPC response" josn)))) (error 'json-string->json-response "invalid JSON-RPC response" json)))) (define-method rpc-http-content-type ((m <json-request>)) "application/json") ;; default rpc-http-sender is binary so make it bytevector (define-method rpc-marshall-message ((m <json-request>)) (string->utf8 (json-request->json-string m))) ;; http transport gives 3 argument request header and response ;; default response is binary (define-method rpc-unmarshall-message ((request <json-request>) header body) ;; TODO lookup encoding and decide which transcoder (json-string->json-response (utf8->string body))) )
false
2ba86fe8e4010bc6cf4fbbb19d1b07893cf5796a
7aeb920de21547a1d9c714b029bbf3a9e7df449e
/scheme/chip-remote/devices/bosch/bme280/tables.scm
ac822c93c1440f843b9fb45feb3eb8afcf1f6da1
[ "BSD-2-Clause" ]
permissive
ft/chip-remote
f8ac5a2d7597d24f44ac287836be3422a32283d4
2a64df611214f7e3eb55d4ead76e270351158cdb
refs/heads/master
2023-04-30T08:38:16.483240
2023-01-05T04:01:44
2023-01-05T04:01:44
117,028,633
2
1
null
null
null
null
UTF-8
Scheme
false
false
1,811
scm
tables.scm
;; Copyright (c) 2021 chip-remote workers, All rights reserved. ;; ;; Terms for redistribution and use can be found in LICENCE. (define-module (chip-remote devices bosch bme280 tables) #:use-module (chip-remote named-value) #:export (filter-coefficient-map mode-map oversampling-map stand-by-map)) (define-value filter-coefficient-map '((filter-off . #b000) ( 2 . #b001) ( 4 . #b010) ( 8 . #b011) ( 16 . #b100) ( 16 . #b101) ( 16 . #b110) ( 16 . #b111))) (define-value mode-map '((sleep . #b00) (forced . #b01) (forced . #b10) (normal . #b11))) (define-value oversampling-map '((disable . #b000) ( 1 . #b001) ( 2 . #b010) ( 4 . #b011) ( 8 . #b100) ( 16 . #b101) ( 16 . #b110) ( 16 . #b111))) (define-value stand-by-map '(( #e0.5e-3 . #b000) ( #e62.5e-3 . #b001) ( #e125.0e-3 . #b010) ( #e250.0e-3 . #b011) ( #e500.0e-3 . #b100) (#e1000.0e-3 . #b101) ( #e10.0e-3 . #b110) ( #e20.0e-3 . #b111)))
false
274da5736c0bba0ba8b36338d37ec6e169acc6b5
ec5b4a92882f80b3f62eac8cbd059fb1f000cfd9
/higher-order/!tests/symbdiff.ss
45878e26057e08fa1817b31224bca1b23db33049
[]
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
15,665
ss
symbdiff.ss
; This is a heavily beefed up version of an example from the ; Abelson/Sussman textbook. I included some more rules for ; taking derivatives and a lot of expression simplification. ; Also I added the possibility to handle expression in prefix, ; infix & postfix notation (default is infix). ; usage : the first parameter is the expression, the second the variable ; - known functions are : sin, cos, arctan, sqrt ; - results are simplified up to a certain degree ; (derive-x n f) calculates the n-th derivative of f where x is the variable ; (derivations-x function start end) prints all derivatives up to the n-th ; example session ; (deriv '((3 * x) + (5 * (x ** 7))) 'x) ; (3 + (35 * (x ** 6))) ; (deriv '((3 * x) + (5 * (x ** 7))) 'y) ; 0 ; (define order 'prefix) ; order ; (deriv '(+ (* 3 x) (* 5 (** x 7))) 'x) ; (+ 3 (* 35 (** x 6))) ; Comments, questions, bug reports etc. to ; Ulf Dittmer [email protected] (define order 'infix) (define (deriv exp var) (cond ((constant? exp) 0) ((variable? exp) (if (same-variable? exp var) 1 0)) ((sum? exp) (make-sum (deriv (firstop exp) var) (deriv (secondop exp) var))) ((difference? exp) (make-difference (deriv (firstop exp) var) (deriv (secondop exp) var))) ((product? exp) (make-sum (make-product (firstop exp) (deriv (secondop exp) var)) (make-product (deriv (firstop exp) var) (secondop exp)))) ((quotient? exp) (make-quotient (make-difference (make-product (secondop exp) (deriv (firstop exp) var)) (make-product (firstop exp) (deriv (secondop exp) var))) (make-exponentiation (secondop exp) 2))) ((exponentiation? exp) (if (equal? 0 (deriv (secondop exp) var)) (make-product (deriv (firstop exp) var) (make-product (secondop exp) (make-exponentiation (firstop exp) (make-difference (secondop exp) 1)))) (make-product exp (make-sum (make-product (deriv (secondop exp) var) (make-logarithm 'e (firstop exp))) (make-product (deriv (firstop exp) var) (make-quotient (secondop exp) (firstop exp))))))) ((function? exp) (case (ffunc exp) ('sin (make-product (deriv (fop exp) var) (make-function 'cos (fop exp)))) ('cos (make-product (make-product -1 (deriv (fop exp) var)) (make-function 'sin (fop exp)))) ('sqrt (make-quotient (make-product 0.5 (deriv (fop exp) var)) (make-function 'sqrt (fop exp)))) ('arctan (make-quotient (deriv (fop exp) var) (make-sum 1 (make-exponentiation (fop exp) 2)))))) ((logarithm? exp) (make-product (deriv (secondop exp) var) (make-quotient (make-logarithm (firstop exp) 'e) 'x))) (else #f))) (define (constant? x) (number? x)) (define (variable? x) (symbol? x)) (define (same-variable? v1 v2) (eq? v1 v2)) (define (make-sum a1 a2) (let ((worstcase (make-worstcase a1 '+ a2))) (cond ((and (number? a1) (number? a2)) (+ a1 a2)) ((equal? a1 a2) (make-product 2 a1)) ((number? a1) (cond ((= a1 0) a2) ((sum? a2) (cond ((number? (firstop a2)) (make-sum (+ a1 (firstop a2)) (secondop a2))) ((number? (secondop a2)) (make-sum (+ a1 (secondop a2)) (firstop a2))) (else worstcase))) ((difference? a2) (cond ((number? (firstop a2)) (make-difference (+ a1 (firstop a2)) (secondop a2))) ((number? (secondop a2)) (make-sum (- a1 (secondop a2)) (firstop a2))) (else worstcase))) (else worstcase))) ((number? a2) (cond ((= a2 0) a1) ((sum? a1) (cond ((number? (firstop a1)) (make-sum (+ a2 (firstop a1)) (secondop a1))) ((number? (secondop a1)) (make-sum (+ a2 (secondop a1)) (firstop a1))) (else worstcase))) ((difference? a1) (cond ((number? (firstop a1)) (make-difference (+ a2 (firstop a1)) (secondop a1))) ((number? (secondop a1)) (make-difference (firstop a1) (- (secondop a1) a2))) (else worstcase))) (else worstcase))) (else worstcase)))) (define (make-difference a1 a2) (let ((worstcase (make-worstcase a1 '- a2))) (cond ((and (number? a1) (number? a2)) (- a1 a2)) ((equal? a1 a2) 0) ((number? a1) (cond ((= a1 0) (make-product -1 a2)) ((sum? a2) (cond ((number? (firstop a2)) (make-difference (- a1 (firstop a2)) (secondop a2))) ((number? (secondop a2)) (make-difference (- a1 (secondop a2)) (firstop a2))) (else worstcase))) ((difference? a2) (cond ((number? (firstop a2)) (make-sum (- a1 (firstop a2)) (secondop a2))) ((number? (secondop a2)) (make-difference (+ a1 (secondop a2)) (firstop a2))) (else worstcase))) (else worstcase))) ((number? a2) (cond ((= a2 0) a1) ((sum? a1) (cond ((number? (firstop a1)) (make-sum (- (firstop a1) a2) (secondop a1))) ((number? (secondop a1)) (make-sum (- (secondop a1) a2) (firstop a1))) (else worstcase))) ((difference? a1) (cond ((number? (firstop a1)) (make-difference (- (firstop a1) a2) (secondop a1))) ((number? (secondop a1)) (make-difference (firstop a1) (+ (secondop a1) a2))) (else worstcase))) (else worstcase))) (else worstcase)))) (define (make-product m1 m2) (let ((worstcase (make-worstcase m1 '* m2))) (cond ((and (number? m1) (number? m2)) (* m1 m2)) ((number? m1) (cond ((= m1 0) 0) ((= m1 1) m2) ((product? m2) (cond ((number? (firstop m2)) (make-product (* m1 (firstop m2)) (secondop m2))) ((number? (secondop m2)) (make-product (* m1 (secondop m2)) (firstop m2))) (else worstcase))) ((quotient? m2) (cond ((number? (firstop m2)) (make-quotient (* m1 (firstop m2)) (secondop m2))) ((number? (secondop m2)) (make-product (/ m1 (secondop m2)) (firstop m2))) (else worstcase))) (else worstcase))) ((number? m2) (cond ((= m2 0) 0) ((= m2 1) m1) ((product? m1) (cond ((number? (firstop m1)) (make-product (* m2 (firstop m1)) (secondop m1))) ((number? (secondop m1)) (make-product (* m2 (secondop m1)) (firstop m1))) (else worstcase))) ((quotient? m1) (cond ((number? (firstop m1)) (make-quotient (* m2 (firstop m1)) (secondop m1))) ((number? (secondop m1)) (make-product (/ m2 (secondop m1)) (firstop m1))) (else worstcase))) (else worstcase))) ((and (quotient? m1) (equal? (firstop m1) 1)) (make-quotient m2 (secondop m1))) ((and (quotient? m2) (equal? (firstop m2) 1)) (make-quotient m1 (secondop m2))) (else worstcase)))) (define (make-quotient m1 m2) (let ((worstcase (make-worstcase m1 '/ m2))) (cond ((and (number? m1) (number? m2)) (/ m1 m2)) ((equal? m1 m2) 1) ((number? m1) (cond ((= m1 0) 0) ((product? m2) (cond ((number? (firstop m2)) (make-quotient (/ m1 (firstop m2)) (secondop m2))) ((number? (secondop m2)) (make-quotient (/ m1 (secondop m2)) (firstop m2))) (else worstcase))) ((quotient? m2) (cond ((number? (firstop m2)) (make-product (/ m1 (firstop m2)) (secondop m2))) ((number? (secondop m2)) (make-quotient (* m1 (secondop m2)) (firstop m2))) (else worstcase))) (else worstcase))) ((number? m2) (cond ((= m2 1) m1) ((product? m1) (cond ((number? (firstop m1)) (make-product (/ (firstop m1) m2) (secondop m1))) ((number? (secondop m1)) (make-product (/ (secondop m1) m2) (firstop m1))) (else worstcase))) ((quotient? m1) (cond ((number? (firstop m1)) (make-quotient (/ (firstop m1) m2) (secondop m1))) ((number? (secondop m1)) (make-quotient (firstop m1) (* m2 (secondop m1)))) (else worstcase))) (else worstcase))) (else worstcase)))) (define (make-exponentiation b e) (let ((worstcase (make-worstcase b '** e))) (cond ((and (number? b) (number? e) (expt b e))) ((and (exponentiation? b) (number? (secondop b)) (number? e)) (list (firstop b) '** (* (secondop b) e))) ((and (function? b) (eq? (ffunc b) 'sqrt) (= e 2)) (fop b)) ((number? b) (if (or (= b 0) (= b 1)) 1 worstcase)) ((number? e) (cond ((= e 0) 1) ((= e 1) b) (else worstcase))) (else worstcase)))) (define (make-logarithm b arg) (let ((worstcase (make-worstcase b 'log arg))) (cond ((and (number? b) (number? arg)) (/ (log arg) (log b))) ((equal? arg 1) 0) ((equal? b arg) 1) (else worstcase)))) (define (make-worstcase one two three) (cond ((equal? order 'prefix) (list two one three)) ((equal? order 'infix) (list one two three)) ((equal? order 'postfix) (list one three two)) (else (error "Unknown ordering.")))) (define (firstop x) (cond ((equal? order 'prefix) (cadr x)) ((equal? order 'infix) (car x)) ((equal? order 'postfix) (car x)) (else (error "Unknown ordering.")))) (define (secondop x) (cond ((equal? order 'prefix) (caddr x)) ((equal? order 'infix) (caddr x)) ((equal? order 'postfix) (cadr x)) (else (error "Unknown ordering.")))) (define (func x) (cond ((equal? order 'prefix) (car x)) ((equal? order 'infix) (cadr x)) ((equal? order 'postfix) (caddr x)) (else (error "Unknown ordering.")))) (define (sum? x) (if (not (atom? x)) (eq? (func x) '+) #f)) (define (difference? x) (if (not (atom? x)) (eq? (func x) '-) #f)) (define (product? x) (if (not (atom? x)) (eq? (func x) '*) #f)) (define (quotient? x) (if (not (atom? x)) (eq? (func x) '/) #f)) (define (exponentiation? x) (if (not (atom? x)) (eq? (func x) '**) #f)) (define (logarithm? x) (if (not (atom? x)) (eq? (func x) 'log) #f)) (define (ffunc x) (car x)) (define (fop x) (cadr x)) (define arctan atan) (define (function? x) (if (not (atom? x)) (case (ffunc x) ((sin cos sqrt arctan) #t) (else #f)))) (define (make-function f arg) (if (constant? arg) ((eval f) arg) (list f arg))) (define (derive-x n f) (if (= n 0) f (derive-x (- n 1) (deriv f 'x)))) (define (derivations-x function start end) (do ((n start (+ n 1))) ((> n end) 'done) (display n) (display " ") (display (derive-x n function)) (newline)))
false
73211bd042d9d35a201f93fca761cfd524ece002
7666204be35fcbc664e29fd0742a18841a7b601d
/code/2-47.scm
1ad74f4a357629f77ecbfebf5f09f61885d5fd17
[]
no_license
cosail/sicp
b8a78932e40bd1a54415e50312e911d558f893eb
3ff79fd94eda81c315a1cee0165cec3c4dbcc43c
refs/heads/master
2021-01-18T04:47:30.692237
2014-01-06T13:32:54
2014-01-06T13:32:54
null
0
0
null
null
null
null
UTF-8
Scheme
false
false
854
scm
2-47.scm
#lang racket (define (L2-47a) (define (make-frame origin edge1 edge2) (list origin edge1 edge2)) (define (origin-frame frame) (car frame)) (define (edge1-frame frame) (cadr frame)) (define (edge2-frame frame) (caddr frame)) (define t (make-frame 1 2 3)) (display t) (newline) (display (origin-frame t)) (newline) (display (edge1-frame t)) (newline) (display (edge2-frame t)) (newline) 'done) (L2-47a) (define (L2-47b) (define (make-frame origin edge1 edge2) (cons origin (cons edge1 edge2))) (define (origin-frame frame) (car frame)) (define (edge1-frame frame) (car (cdr frame))) (define (edge2-frame frame) (cddr frame)) (define t (make-frame 1 2 3)) (display t) (newline) (display (origin-frame t)) (newline) (display (edge1-frame t)) (newline) (display (edge2-frame t)) (newline) 'done) (L2-47b)
false
b142f70075a230d05f2c82261cf581f55c513686
a5ab112b13f9957f0d9db0f0c5ca330113fd9707
/test.scm
6777f67185aafcfb19d3a55c389f05c0c0ff2fa4
[]
no_license
ktakashi/sagittarius-soap
5df9362a59d71678099aa7ccbda8a0afc79f2bf1
6ae714ed7ed8d6ee84ace8805149a7071c54cde4
refs/heads/master
2021-01-02T09:34:40.491656
2013-04-11T11:52:29
2013-04-11T11:52:29
null
0
0
null
null
null
null
UTF-8
Scheme
false
false
1,268
scm
test.scm
(add-load-path ".") (import (rnrs) (soap lite) (text tree) (srfi :64) (pp)) (test-begin "SOAP Lite tests") (define-soap-type (:prefix order shipto) name) (test-equal "soap element" '("<" shipto () ">" (("<" name () ">" ("Name") "</" name ">")) "</" shipto ">") (order:shipto (name "Name"))) (test-equal "A request" "<soapenv:Envelope \ xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \ xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" \ xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">\ <soapenv:Header></soapenv:Header>\ <soapenv:Body><shipto><name>Name</name></shipto></soapenv:Body>\ </soapenv:Envelope>" (tree->string (soap:envelope (make-soap-context +soap-version-1.1+) (soap:body (order:shipto (name "Name")))))) (define-soap-type ;; for convenient (:namespace foo (tag1 tag2)) (:prefix bar (tag3 tag4)) (:prefix boo (:namespace brr (tag5 tag6))) (:prefix #f (:namespace brr (tag7 tag8)))) (test-equal "new APIs" "<foo:tag1>foo1</foo:tag1>" (tree->string (foo:tag1 "foo1"))) (test-equal "new APIs(2)" "<brr:tag7>brr</brr:tag7>" (tree->string (tag7 "brr"))) (test-end)
false
bf2a2b6c4a5504b9b0045e1882587dde6a9da869
0bb7631745a274104b084f6684671c3ee9a7b804
/lib/gambit/prim/f64vector#.scm
23d3e0d995c6f4a0811da264f216f707d150c22e
[ "Apache-2.0", "LGPL-2.1-only", "LicenseRef-scancode-free-unknown", "GPL-3.0-or-later", "LicenseRef-scancode-autoconf-simple-exception" ]
permissive
feeley/gambit
f87fd33034403713ad8f6a16d3ef0290c57a77d5
7438e002c7a41a5b1de7f51e3254168b7d13e8ba
refs/heads/master
2023-03-17T06:19:15.652170
2022-09-05T14:31:53
2022-09-05T14:31:53
220,799,690
0
1
Apache-2.0
2019-11-10T15:09:28
2019-11-10T14:14:16
null
UTF-8
Scheme
false
false
400
scm
f64vector#.scm
;;;============================================================================ ;;; File: "f64vector#.scm" ;;; Copyright (c) 1994-2021 by Marc Feeley, All Rights Reserved. ;;;============================================================================ ;;; F64vector operations. (##include "f64vector-gambit#.scm") ;;;============================================================================
false
1a62583204676df70e7b309681f0708def02200d
defeada37d39bca09ef76f66f38683754c0a6aa0
/System/system/net/configuration/web-request-module-element-collection.sls
67335d147f14dba9937a9053ce9005a0209cc073
[]
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
2,117
sls
web-request-module-element-collection.sls
(library (system net configuration web-request-module-element-collection) (export new is? web-request-module-element-collection? remove-at index-of add remove clear item-get item-set! item-update! item-get item-set! item-update!) (import (ironscheme-clr-port)) (define-syntax new (lambda (e) (syntax-case e () ((_ a ...) #'(clr-new System.Net.Configuration.WebRequestModuleElementCollection a ...))))) (define (is? a) (clr-is System.Net.Configuration.WebRequestModuleElementCollection a)) (define (web-request-module-element-collection? a) (clr-is System.Net.Configuration.WebRequestModuleElementCollection a)) (define-method-port remove-at System.Net.Configuration.WebRequestModuleElementCollection RemoveAt (System.Void System.Int32)) (define-method-port index-of System.Net.Configuration.WebRequestModuleElementCollection IndexOf (System.Int32 System.Net.Configuration.WebRequestModuleElement)) (define-method-port add System.Net.Configuration.WebRequestModuleElementCollection Add (System.Void System.Net.Configuration.WebRequestModuleElement)) (define-method-port remove System.Net.Configuration.WebRequestModuleElementCollection Remove (System.Void System.String) (System.Void System.Net.Configuration.WebRequestModuleElement)) (define-method-port clear System.Net.Configuration.WebRequestModuleElementCollection Clear (System.Void)) (define-field-port item-get item-set! item-update! (property:) System.Net.Configuration.WebRequestModuleElementCollection Item System.Net.Configuration.WebRequestModuleElement) (define-field-port item-get item-set! item-update! (property:) System.Net.Configuration.WebRequestModuleElementCollection Item System.Net.Configuration.WebRequestModuleElement))
true
b598d705e7b6d1ae045a76ec948fcefe1dbbba6f
a2d8b4843847507b02085bb8adabd818f57dd09f
/scheme/sicp/ch_3/arithmetic-pkg/tst-table.scm
08167e1da3ebb3f8b5a8550389c1e2cd660f514d
[]
no_license
tcharding/self_learning
df911b018fc86bd5f918394b79d2456bf51f35a8
f6bb5c6f74092177aa1b71da2ce87ca1bfc5ef3c
refs/heads/master
2022-05-13T05:09:32.284093
2022-05-02T08:25:18
2022-05-02T08:25:18
41,029,057
13
2
null
null
null
null
UTF-8
Scheme
false
false
1,180
scm
tst-table.scm
;;;; tests for table.scm (load-from-path "test-framework.scm") (load-from-path "lib.scm") (load-from-path "arithmetic-pkg/table.scm") (define t1 (make-table-1d)) ; one dimensional ((t1 'insert!) 'a 1) ((t1 'insert!) 'b 2) (test-eq "" ((t1 'lookup) 'a) 1) (test-eq "" ((t1 'lookup) 'b) 2) (define t2 (make-table-2d)) ; two dimensional ((t2 'insert!) 'foo 'a 1) ((t2 'insert!) 'bar 'a 2) ((t2 'insert!) 'foo 'b 3) ((t2 'insert!) 'bar 'b 4) (test-eq "" ((t2 'lookup) 'foo 'a) 1) (test-eq "" ((t2 'lookup) 'bar 'a) 2) (test-eq "" ((t2 'lookup) 'foo 'b) 3) (test-eq "" ((t2 'lookup) 'bar 'b) 4) (define t (make-table eqv?)) ; arbitrary dimensions (define get (t 'lookup)) (define put (t 'insert!)) (put '(a) 1) (put '(b) 2) (test-eq "" ((t 'lookup) '(a)) 1) (test-eq "" ((t 'lookup) '(b)) 2) (put '(foo a) 1) (put '(bar a) 2) (put '(foo b) 3) (put '(bar b) 4) (test-eq "" (get '(foo a)) 1) (test-eq "" (get '(bar a)) 2) (test-eq "" (get '(foo b)) 3) (test-eq "" (get '(bar b)) 4) (put '(one (two)) 1) (test-eq "nested" (get '(one (two))) 1) (put '(one (two (thee)) (four)) 1) (test-eq "more nested" (get '(one (two (thee)) (four))) 1)
false
d1cff346fc645ccfe557889079cf31e694b80caf
c181b401c23b0d5507d4e0fe845a939846f32292
/app.scm
6df3eb7d23ff031e139b14d4b2a612a277a5f3aa
[]
no_license
ngzh/ChickenWeChat
548dd20187e01602dc5cd18ab64e6a438190cacd
ca857e61f972ea3efd4ac05bbe0cb0d68033f87b
refs/heads/master
2021-05-31T04:25:31.906565
2015-08-23T03:33:35
2015-08-23T03:33:35
null
0
0
null
null
null
null
UTF-8
Scheme
false
false
3,440
scm
app.scm
(use spiffy intarweb uri-common srfi-13) (use dissector) ;; libs (include "utils") (include "dispatch") (include "crypt") (include "message") (include "response") ;; user code (include "page") (include "logic") (include "user-man") (include "persistence") (text-handler (lambda (to from content) (case (symbol<-string (string-downcase content)) [(|h| |help|) (sync-response to from (conc "HELP\n" "start:\n 开始新的计数\n" "stop: \n 停止已有的计数"))] [(|start|) (like-counter 'start from) (sync-response to from "Like Counter Start!")] [(|stop|) (like-counter 'stop from) (sync-response to from "Like Counter Stop!")] [(|fox say| |fox|) (begin1 (acknowledge-string) ; return ack("") for later async response (async-response to from "bing bing") (async-response to from "bing bing bing ~"))] [else (sync-response to from "Don't know what to say...")]))) (event-handler (lambda (to from event event-key) (case (symbol<-string event-key) [(|EVT_PULL|) (cond [(like-counter 'on-going? from) (sync-response to from (conc "投票中。。\n" "目前是" (like-counter)))] [else (sync-response to from "暂无新的消息")])] [(|EVT_LIKE|) (if (like-counter 'on-going? from) (begin (like-counter 'like from) (sync-response to from (conc "点了个赞!\n" "目前是" (like-counter)))) (sync-response to from (conc "目前没有投票。。。")))] [(|EVT_UNLIKE|) (if (like-counter 'on-going? from) (begin (like-counter 'unlike from) (sync-response to from (conc "不是很喜欢嘛。。\n" "目前是" (like-counter)))) (sync-response to from (conc "目前没有投票。。。")))] [(|EVT_ABOUT|) (sync-response to from (conc "Powered by\n" "(Spiffy (Chicken Scheme))"))] [(|EVT_HELP|) (sync-response to from (conc "点\"看看\"可以收到最新消息\n" "点\"赞\"中的两个选项均可投票,若多次投票,以最后一次为准\n" "点\"关于\"中资源页可以看到一些链接\n" "想说什么就直接发过来~~暂不支持语音"))] [else (sync-response to from "还不会处理这种事件...")]))) (parameterize ((server-port 4000) (access-log (current-output-port))) (start-server))
false
80e42e529bf1d1d354ad81cd1706a21412f0188c
660d4aad58a5dd8a304ead443a4f915b0047a579
/dispatch-table.scm
6a3d9c1ddd803e4666f1a6973c393e3d2fd5f002
[]
no_license
prophet-on-that/sicp
d9642ceebb8e885d85053ceba930282f30100879
cdb742646464f21a3c1c27c753d35f20cf0e754d
refs/heads/master
2021-07-05T12:53:14.263137
2020-08-21T08:20:27
2020-08-21T08:20:27
162,593,828
0
0
null
null
null
null
UTF-8
Scheme
false
false
659
scm
dispatch-table.scm
(define-module (sicp dispatch-table)) (use-modules (srfi srfi-1)) (define-public (create-dispatch-table) (list '())) (define (dispatch-table-alist dispatch-table) (car dispatch-table)) (define (set-dispatch-table-alist! dispatch-table alist) (set-car! dispatch-table alist)) (define-public (dispatch-table-put! dispatch-table symbol fn) (set-dispatch-table-alist! dispatch-table (alist-cons symbol fn (dispatch-table-alist dispatch-table)))) (define-public (dispatch-table-get dispatch-table symbol) (let ((pair (assoc symbol (dispatch-table-alist dispatch-table)))) (if pair (cdr pair) #f)))
false
b464acb0805121f29c6cb8403b1202760a2c8e50
defeada37d39bca09ef76f66f38683754c0a6aa0
/mscorlib/system/runtime/interop-services/default-char-set-attribute.sls
49a6a911c7fc5a7211b313e35adb4ab05e619d61
[]
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
746
sls
default-char-set-attribute.sls
(library (system runtime interop-services default-char-set-attribute) (export new is? default-char-set-attribute? char-set) (import (ironscheme-clr-port)) (define-syntax new (lambda (e) (syntax-case e () ((_ a ...) #'(clr-new System.Runtime.InteropServices.DefaultCharSetAttribute a ...))))) (define (is? a) (clr-is System.Runtime.InteropServices.DefaultCharSetAttribute a)) (define (default-char-set-attribute? a) (clr-is System.Runtime.InteropServices.DefaultCharSetAttribute a)) (define-field-port char-set #f #f (property:) System.Runtime.InteropServices.DefaultCharSetAttribute CharSet System.Runtime.InteropServices.CharSet))
true
0f0544925616039d3301fbadbcac8ead48a989e0
a09ad3e3cf64bc87282dea3902770afac90568a7
/2/3.scm
782d5dd22415a8fdbbfa6f8134aa14829aead3f4
[]
no_license
lockie/sicp-exercises
aae07378034505bf2e825c96c56cf8eb2d8a06ae
011b37387fddb02e59e05a70fa3946335a0b5b1d
refs/heads/master
2021-01-01T10:35:59.759525
2018-11-30T09:35:35
2018-11-30T09:35:35
35,365,351
0
0
null
null
null
null
UTF-8
Scheme
false
false
1,845
scm
3.scm
#lang sicp ; point boilerplate (define (make-point x y) (cons x y)) (define (x-point point) (car point)) (define (y-point point) (cdr point)) ; segment boilerplate (define (make-segment start end) (cons start end)) (define (start-segment segment) (car segment)) (define (end-segment segment) (cdr segment)) ; first implementation ;(define (make-rectangle top-left bottom-right) ; (cons top-left bottom-right)) ; ;(define (rectangle-top-left rectangle) ; (car rectangle)) ; ;(define (rectangle-bottom-right rectangle) ; (cdr rectangle)) (define (rectangle-width rectangle) (- (x-point (rectangle-bottom-right rectangle)) (x-point (rectangle-top-left rectangle)))) (define (rectangle-height rectangle) (- (y-point (rectangle-top-left rectangle)) (y-point (rectangle-bottom-right rectangle)))) (define (perimeter rectangle) (* 2 (+ (rectangle-width rectangle) (rectangle-height rectangle)))) (define (square rectangle) (* (rectangle-width rectangle) (rectangle-height rectangle))) ;(define test-rectangle (make-rectangle (make-point 0 5) (make-point 10 0))) ;(perimeter test-rectangle) ; 30 ;(square test-rectangle) ; 50 ; another implementation (define (make-rectangle base apex) (cons base apex)) (define (rectangle-base rectangle) (car rectangle)) (define (rectangle-apex rectangle) (cdr rectangle)) (define (rectangle-top-left rectangle) (end-segment (rectangle-apex rectangle))) (define (rectangle-bottom-right rectangle) (end-segment (rectangle-base rectangle))) (define test-rectangle (make-rectangle (make-segment (make-point 0 0) (make-point 10 0)) (make-segment (make-point 0 0) (make-point 0 5)))) (perimeter test-rectangle) ; 30 (square test-rectangle) ; 50
false
8dd8db2d4dd5506714f00b7cadeb2727f949faea
e1fc47ba76cfc1881a5d096dc3d59ffe10d07be6
/ch3/3.21.scm
f145ccb49ca6eb2285fc3733dc50a92994f24fa6
[]
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
458
scm
3.21.scm
(load "3.03.02.scm") (define (print-queue q) (define (iter head) (cond ((null? head) (display "nil")) (else (display (car head)) (display " - ") (iter (cdr head))) ) ) (iter (front-ptr q)) ) ; test ; (define q1 (make-queue)) ; (insert-queue! q1 'a) ; (insert-queue! q1 'b) ; (print-queue q1)(newline) ; (delete-queue! q1) ; (delete-queue! q1) ; (print-queue q1)(newline) ; another sol for REPL ; (define (print-queue q) (car q))
false
ce914303e9c03ddaaded8b301a18a39e6d7ff1e7
ce567bbf766df9d98dc6a5e710a77870753c7d29
/ch8/03.scm
6b713165390bfb33ed11bee0a5c8076a507c8d34
[]
no_license
dott94/eopl
1cbe2d98c948689687f88e514579e66412236fc9
47fadf6f2aa6ca72c831d6e2e2eccbe673129113
refs/heads/master
2021-01-18T06:42:35.921839
2015-01-21T07:06:43
2015-01-21T07:06:43
30,055,972
1
0
null
2015-01-30T04:21:42
2015-01-30T04:21:42
null
UTF-8
Scheme
false
false
5,000
scm
03.scm
(load-relative "../libs/init.scm") (load-relative "./base/test.scm") (load-relative "./base/equal-type.scm") (load-relative "./base/data-structures.scm") (load-relative "./base/cases.scm") (load-relative "./base/simplemodule-lang.scm") ;; see the new stuff ;;;;;;;;;;;;;;;; grammatical specification ;;;;;;;;;;;;;;;; (define the-lexical-spec '((whitespace (whitespace) skip) (comment ("%" (arbno (not #\newline))) skip) (identifier (letter (arbno (or letter digit "_" "-" "?"))) symbol) ;; new stuff (module-var (letter (arbno (or letter digit "_" "-" "?")) "." (arbno (or letter digit "_" "-" "?"))) symbol) (number (digit (arbno digit)) number) (number ("-" digit (arbno digit)) number) )) (define the-grammar '( (program ((arbno module-definition) expression) a-program) (module-definition ("module" identifier "interface" interface "body" module-body) a-module-definition) (interface ("[" (arbno declaration) "]") simple-iface) (declaration (identifier ":" type) val-decl) (module-body ("[" (arbno definition) "]") defns-module-body) (definition (identifier "=" expression) val-defn) ;; new expression: ;; new stuff (expression (module-var) qualified-var-exp) ;; new types (type (identifier) named-type) (type (module-var) qualified-type) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; no changes in grammar below here ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (expression (number) const-exp) (expression (identifier) var-exp) (expression ("-" "(" expression "," expression ")") diff-exp) (expression ("zero?" "(" expression ")") zero?-exp) (expression ("if" expression "then" expression "else" expression) if-exp) (expression ("let" identifier "=" expression "in" expression) let-exp) (expression ("proc" "(" identifier ":" type ")" expression) proc-exp) (expression ("(" expression expression ")") call-exp) (expression ("letrec" type identifier "(" identifier ":" type ")" "=" expression "in" expression) letrec-exp) (type ("int") int-type) (type ("bool") bool-type) (type ("(" type "->" type ")") proc-type) )) ;;;;;;;;;;;;;;;; sllgen boilerplate ;;;;;;;;;;;;;;;; (sllgen:make-define-datatypes the-lexical-spec the-grammar) (define show-the-datatypes (lambda () (sllgen:list-define-datatypes the-lexical-spec the-grammar))) (define scan&parse (sllgen:make-string-parser the-lexical-spec the-grammar)) (define just-scan (sllgen:make-string-scanner the-lexical-spec the-grammar)) ;; value-of : Exp * Env -> ExpVal (define value-of (lambda (exp env) (cases expression exp (const-exp (num) (num-val num)) (var-exp (var) (apply-env env var)) ;; new stuff, a hack (qualified-var-exp (module-var) (let ((names (string-split (symbol->string module-var) "."))) (let ((module (string->symbol (car names))) (var (string->symbol (cadr names)))) (lookup-qualified-var-in-env module var env)))) (diff-exp (exp1 exp2) (let ((val1 (expval->num (value-of exp1 env))) (val2 (expval->num (value-of exp2 env)))) (num-val (- val1 val2)))) (zero?-exp (exp1) (let ((val1 (expval->num (value-of exp1 env)))) (if (zero? val1) (bool-val #t) (bool-val #f)))) (if-exp (exp0 exp1 exp2) (if (expval->bool (value-of exp0 env)) (value-of exp1 env) (value-of exp2 env))) (let-exp (var exp1 body) (let ((val (value-of exp1 env))) (let ((new-env (extend-env var val env))) (value-of body new-env)))) (proc-exp (bvar ty body) (proc-val (procedure bvar body env))) (call-exp (rator rand) (let ((proc (expval->proc (value-of rator env))) (arg (value-of rand env))) (apply-procedure proc arg))) (letrec-exp (ty1 proc-name bvar ty2 proc-body letrec-body) (value-of letrec-body (extend-env-recursively proc-name bvar proc-body env))) ))) (run " module m interface [u : int v : int] body [u = 44 v = 33] -(m.u , m.v)")
false
3b8f6ac3c3c28c8d9e22e725ca20220870c937c1
0b1826093fb47c0a7293573d80f03a28e859640f
/chapter-2/ex-2.57.scm
3c57d2785588bb9492067ed4478aef1ad879d89a
[ "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
349
scm
ex-2.57.scm
(load "./ex-2.56") (define make-sum (lambda (a b . c) (append (list '+ a) (cons b c)))) (define make-product (lambda (a b . c) (append (list '* a) (cons b c)))) (define (augend s) (if (eq? (cdddr s) '()) (caddr s) (cons '+ (cddr s)))) (define (multiplicand p) (if (eq? (cdddr p) '()) (caddr p) (cons '* (cddr p))))
false
14bd4b4424e0120d06aa0429eb3297843438889a
9cb1626e30c6ea40b11cd3715c03d0d5b88722de
/src/riaxpander/denotation.scm
058e488d04bb625803d3643f2fcc387412b03060
[ "Zlib" ]
permissive
alvatar/sphere-core
fbc2a76ed6743cbe7be99ff0abf50a79e331bb55
09e07d8b881f6b0292a4292b8b9a30a4ab5798f7
refs/heads/master
2020-05-18T13:32:08.074184
2015-03-21T12:17:50
2015-03-21T12:17:50
976,512
9
0
null
2014-04-26T12:30:09
2010-10-10T15:43:10
Scheme
UTF-8
Scheme
false
false
993
scm
denotation.scm
;;; -*- Mode: Scheme -*- ;;;; Riaxpander ;;;; Denotations ;;; Copyright (c) 2008, Taylor R. Campbell ;;; See the LICENCE file for licence terms and warranty disclaimer. (define-record-type <classifier> (make-classifier name procedure) classifier? (name classifier/name) (procedure classifier/procedure)) (define-record-type <transformer> (make-transformer environment auxiliary-names procedure source) transformer? (environment transformer/environment) (auxiliary-names transformer/auxiliary-names) (procedure transformer/procedure) (source transformer/source)) (define-record-type <variable> (make-variable name location) variable? (name variable/name) (location variable/location)) (define (denotation=? denotation-a denotation-b) (or (eq? denotation-a denotation-b) (and (variable? denotation-a) (variable? denotation-b) (eqv? (variable/location denotation-a) (variable/location denotation-b)))))
false
b9c662965e4ec64b5b4141acf3dc2131fae4a058
bf918ffa3f2d375ce913fe60b73be9946f0ddf75
/macros_new.scm
02fccf0194411a441ff31333eade09e3d9ea3318
[]
no_license
codeasyb/Scheme
dd18ee65c6e2050f8a0ddb7a70b3a276b6960eff
989e7bd19c9ebe07901fb64a2dfa4c7547287194
refs/heads/main
2023-03-22T15:11:24.268914
2021-03-15T21:35:48
2021-03-15T21:35:48
348,129,202
1
0
null
null
null
null
UTF-8
Scheme
false
false
1,383
scm
macros_new.scm
;;; define unless macro, inspired by perl ;;; (unless b x y) is (if b y x) (define-syntax unless (syntax-rules ( ) ((_ condition false-branch true-branch) (if condition true-branch false-branch ) ))) ;;; use unless (define (safe-inverse x) (unless (= x 0) (/ 1 x) '*infinity*)) ;;; print x then space or newline ;;; (used by trace and tracem - see below) (define (disp-sp x) (display x) (display " ")) (define (disp-nl x) (display x) (newline)) ;;; a trace macro for instrumenting code. ;;; (trace label expr1 ... val) evals the exprs, then val ;;; prints label and values of exprs and val, ;;; returns value of val. ;;; (trace expr) is similar but no label (define-syntax trace (syntax-rules ( ) ((_ label expr) (let ((val expr)) (disp-sp 'label) (disp-nl val) val)) ((_ expr) (let ((val expr)) (disp-nl val) val)))) ;;; use trace (define (fact n) (trace f (if (= n 0) 1 (* n (fact (- n 1)))))) (define (fact2 n) (trace (if (= n 0) 1 (* n (fact2 (- n 1)))))) (fact 3) (fact2 3) (define-syntax tracem (syntax-rules ( ) ((_ expr ... val) (let ((result val)) (disp-sp expr) ... (disp-nl result) result)))) (define (factm n) (tracem "arg" n "val" (if (= n 0) 1 (* n (factm (- n 1)))))) (factm 3)
true
5b9de4026f032c09e1c2fa319a5c501f9af40214
cb8cccd92c0832e056be608063bbec8fff4e4265
/chapter1/Exercises/1.15_sine.scm
9e6a879660cd70058a88fdb33c76d271dff5279b
[]
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
566
scm
1.15_sine.scm
#lang scheme ; Ex 1.15 Sine of an angle ; The sine of an angle (in radians) can be computed by making ; use of the approximation sin x ~ x if x is sufficiently ; small, and the trigonometric identity ; sin x = 3 * sin (x / 3) - 4 * (sin (x/3))^3 ; to reduce the size of the argument of sin. ; An angle is considered sufficiently small if its magnitude ; is not greater than 0.1 radians. (define (cube x) (* x x x)) (define (p x) (- (* 3 x) (* 4 (cube x)))) (define (sine angle) (if (not (> (abs angle) 0.1)) angle (p (sine (/ angle 3.0))))) (sin 100.0)
false
85106638941b5298955d90b5720edd25098bcb7b
309e1d67d6ad76d213811bf1c99b5f82fa2f4ee2
/A11.ss
62a005cb61bcfdf10cf8e76c7e72a04120326719
[]
no_license
lix4/CSSE304-Programming-Language-Concept-Code
d8c14c18a1baa61ab5d3df0b1ac650bdebc59526
dd94262865d880a357e85f6def697661e11c8e7a
refs/heads/master
2020-08-06T02:50:53.307301
2016-11-12T03:03:56
2016-11-12T03:03:56
73,528,000
1
1
null
null
null
null
UTF-8
Scheme
false
false
6,893
ss
A11.ss
;Xiwen Li ;Assignment11 (load "chez-init.ss") (define-datatype expression expression? [var-exp (id symbol?)] [lambda-list-vars-exp (id (list-checker symbol?)) (body (list-checker expression?)) ] [lambda-improp-exp (id (list-checker improperlist?)) (body (list-checker expression?)) ] [lambda-sym-exp (id symbol?) (body (list-checker expression?)) ] [app-exp (rator expression?) (rand (list-checker expression?)) ] [lit-exp (id any-type?)] [if-exp (condition expression?) (true expression?) (false expression?) ] [if-no-else-exp (condition expression?) (true expression?) ] [letrec-exp (id list?) (body (list-checker expression?)) ] [let-exp (id list?) (body (list-checker expression?)) ] [let*-exp (id list?) (body (list-checker expression?)) ] [set!-exp (var symbol?) (val expression?) ] ) (define list-checker (lambda (pred) (lambda (ls) (or (null? ls) (and (pair? ls) (pred (car ls)) ((list-checker pred) (cdr ls)) )) ) ) ) (define improperlist? (lambda (x) (and (pair? x) (not (list? x))))) (define any-type? (lambda (val) (or (symbol? val) (number? val) (vector? val) (boolean? val)) ) ) (define 1st car) (define 2nd cadr) (define 3rd caddr) (define parse-exp (lambda (datum) (cond [(symbol? datum) (var-exp datum)] [(literal? datum) (lit-exp datum)] [(not (list? datum)) (eopl:error 'parse-exp "application ~s is not a proper list" datum)] [(pair? datum) (cond [(eqv? (1st datum) 'lambda) (cond [(< (length datum) 3) (eopl:error 'parse-exp "lambda-expression: incorrect length ~s" datum)] [else (cond [(list? (2nd datum)) (if (not (andmap symbol? (2nd datum))) (eopl:error 'parse-exp "lambda argument list: formals must be symbols: ~s" (2nd datum)) (lambda-list-vars-exp (2nd datum) (map parse-exp (cddr datum))) )] [(symbol? (2nd datum)) (lambda-sym-exp (2nd datum) (map parse-exp (cddr datum)))] [(improperlist (2nd datum)) (lambda-improp-exp (2nd datum)) (map parse-exp (cddr datum))] ) ] )] [(eqv? (1st datum) 'if) (cond [(> (length datum) 4) (eopl:error 'parse-exp "if-expression ~s does not have (only) test, then, and else" datum)] [(<= (length datum) 2) (eopl:error 'parse-exp "if-expression ~s does not have (only) test, then, and else" datum)] [(= (length datum) 3) (if-no-else-exp (parse-exp (2nd datum)) (parse-exp (3rd datum)))] [else (if-exp (parse-exp (2nd datum)) (parse-exp (3rd datum)) (parse-exp (cadddr datum)))] )] [(eqv? (1st datum) 'let) (cond [(<= (length datum) 2) (eopl:error 'parse-exp "~s-expression has incorrect length ~s" datum)] [(improperlist? (2nd datum)) (eopl:error 'parse-exp "Error in parse-exp decls: not a proper list: ~s" (2nd datum))] [(and (not (eqv? (2nd datum) '())) (ormap improperlist? (2nd datum))) (eopl:error 'parse-exp "Error in parse-exp: decls: not all proper lists: ~s" (2nd datum))] [(not (andmap (lambda (ls) (eqv? (length ls) 2)) (2nd datum))) (eopl:error 'parse-exp "decls: not all length 2: ~s" (2nd datum))] [(not (andmap symbol? (map car (2nd datum)))) (eopl:error 'parse-exp "decls: first members must be symbols: ~s" (2nd datum))] [else (let-exp (map l-id-process (2nd datum)) (map parse-exp (cddr datum)))] )] [(eqv? (1st datum) 'let*) (cond [(not (list? (2nd datum))) (eopl:error 'parse-exp "Error in parse-exp: let* declarations not a list" datum)] [(<= (length datum) 2) (eopl:error 'parse-exp "~s-expression has incorrect length ~s" datum)] [else (cond [(not (andmap (lambda (ls) (eqv? (length ls) 2)) (2nd datum))) (eopl:error 'parse-exp "decls: not all length 2: ~s" (2nd datum))] [(not (andmap symbol? (map car (2nd datum)))) (eopl:error 'parse-exp "decls: first members must be symbols: ~s" (2nd datum))] [else (let*-exp (map l-id-process (2nd datum)) (map parse-exp (cddr datum)))] ) ] ) ] [(eqv? (1st datum) 'letrec) (cond [(<= (length datum) 2) (eopl:error 'parse-exp "Error in parse-expression: letrec expression: incorrect length: ~s" datum)] [(not (list? (2nd datum))) (eopl:error 'parse-exp "Error in parse-exp: letrec: declarations is not a list" datum)] [(not (andmap (lambda (ls) (eqv? (length ls) 2)) (2nd datum))) (eopl:error 'parse-exp "decls: not all length 2: ~s" (2nd datum))] [(not (andmap symbol? (map car (2nd datum)))) (eopl:error 'parse-exp "decls: first members must be symbols: ~s" (2nd datum))] [else (letrec-exp (map l-id-process (2nd datum)) (map parse-exp (cddr datum)))] ) ] [(eqv? (1st datum) 'set!) (cond [(= (length datum) 3) (set!-exp (2nd datum) (parse-exp (3rd datum)))] [(<= (length datum) 2) (eopl:error 'parse-exp "set! expression ~s does not have (only) variable and expression" datum)] [(> (length datum) 3) (eopl:error 'parse-exp "set! expression ~s is too long" datum)] )] [else (app-exp (parse-exp (1st datum)) (map parse-exp (cdr datum)))] ) ] [else (eopl:error 'parse-exp "bad expression: ~s" datum)] ) ) ) (define unparse-exp (lambda (exp) (cases expression exp [var-exp (datum) datum] [lambda-sym-exp (id body) (append (list 'lambda id) (map unparse-exp body))] [lambda-list-vars-exp (id body) (append (list 'lambda id) (map unparse-exp body))] [lambda-improp-exp (id body) (list 'lambda id (map unparse-exp body))] [app-exp (rator rand) (cons (unparse-exp rator) (map unparse-exp rand))] [lit-exp (id) id] [if-exp (condition true false) (list 'if (unparse-exp condition) (unparse-exp true) (unparse-exp false))] [if-no-else-exp (condition true) (list 'if (unparse-exp condition) (unparse-exp true))] [letrec-exp (id body) (append (list 'letrec (map l-id-process-for-unparse id)) (map unparse-exp body))] [let-exp (id body) (append (list 'let (map l-id-process-for-unparse id)) (map unparse-exp body))] [let*-exp (id body) (append (list 'let* (map l-id-process-for-unparse id)) (map unparse-exp body))] [set!-exp (var val) (list var (unparse-exp val)) ] ) ) ) (define l-id-process-for-unparse (lambda (x) (list (1st x) (unparse-exp (2nd x))) ) ) (define l-id-process (lambda (x) (list (1st x) (parse-exp (2nd x))) ) ) (define literal? (lambda (val) (or (number? val) (boolean? val) (symbol? val) (vector? val) (string? val)) ) )
false
84668264dd863dbf8c3359e5631c929183a9b565
ac2a3544b88444eabf12b68a9bce08941cd62581
/gsc/tests/67-s64vector/vectorset.scm
2837cff2156a3f855ff4040a819e800d8e374c8f
[ "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,369
scm
vectorset.scm
(declare (extended-bindings) (not constant-fold) (not safe)) (define v1 (##s64vector -9223372036854775808 -111 0 111 9223372036854775807)) (define v2 (##make-s64vector 10 -9223372036854775808)) (define v3 (##make-s64vector 10 -111)) (define v4 (##make-s64vector 10)) (define v5 (##make-s64vector 10 111)) (define v6 (##make-s64vector 10 9223372036854775807)) (define (int= x y) (if (##fixnum? x) (and (##fixnum? y) (##fx= x y)) (and (##bignum? x) (##bignum? y) (let ((len (##bignum.adigit-length x))) (and (##fx= len (##bignum.adigit-length y)) (let loop ((i (##fx- len 1))) (if (##fx< i 0) (and (##bignum.adigit-= x y i) (loop (##fx- i 1))) #t))))))) (define (test v i expected) (println (##eq? v (##s64vector-set! v i 0))) (let ((val (##s64vector-ref v i))) (println (if (int= val 0) "good" "bad"))) (println (##eq? v (##s64vector-set! v i expected))) (let ((val (##s64vector-ref v i))) (println (if (int= val expected) "good" "bad")))) (test v1 0 -9223372036854775808) (test v1 1 -111) (test v1 2 0) (test v1 3 111) (test v1 4 9223372036854775807) (test v2 9 -9223372036854775808) (test v3 9 -111) (test v4 9 0) (test v5 9 111) (test v6 9 9223372036854775807)
false
bb18585d9359c9bcce37fbb2fca84eadefba9d47
be06d133af3757958ac6ca43321d0327e3e3d477
/99problems/42.scm
62815e9b0a7bba2024d5e748d02d12c24f87fbe4
[]
no_license
aoyama-val/scheme_practice
39ad90495c4122d27a5c67d032e4ab1501ef9c15
f133d9326699b80d56995cb4889ec2ee961ef564
refs/heads/master
2020-03-13T12:14:45.778707
2018-04-26T07:12:06
2018-04-26T07:12:06
131,115,150
0
0
null
null
null
null
UTF-8
Scheme
false
false
409
scm
42.scm
(define (decode lis) (apply append (map (lambda (pair) (repeat (car pair) (cdr pair))) lis))) (define (repeat x n) (let loop ((i 0) (result '())) (cond ((= i n) result) (else (loop (+ i 1) (cons x result)))))) (print (repeat 'a 0)) (print (repeat 'a 1)) (print (repeat 'a 2)) (print (repeat 'a 3)) (print (decode '((a . 3) (b . 2) (c . 1) (d . 5) (e . 1)))) ; (a a a b b c d d d d d e)
false
5153b0aab4e373cd7f12dd85e0e1790317e98a43
a8216d80b80e4cb429086f0f9ac62f91e09498d3
/lib/scheme/file.sld
a43c52ac99c5d4cf1c0b8e313a06879f7f6d03fb
[ "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
317
sld
file.sld
(define-library (scheme file) (import (chibi) (only (chibi filesystem) delete-file file-exists?)) (export call-with-input-file call-with-output-file delete-file file-exists? open-binary-input-file open-binary-output-file open-input-file open-output-file with-input-from-file with-output-to-file))
false
0e703cb28156c526c90f75f5e149dcced6be55c1
6b1b5aec0c6f9f61afcd743a2c4eaf9616170f10
/cs154/circuit-simulator.scm
7d8b2363ffaaf2f98c58116637cae80bb954a892
[]
no_license
mridulravi/personal-projects
56296fd2bdd761c9943334e6bb4b2b3f92940337
dcbde64baf0020dcfa8faf7e08ba7377ff884acd
refs/heads/master
2020-04-02T05:13:04.755512
2016-07-31T14:57:05
2016-07-31T14:57:05
64,591,612
0
0
null
null
null
null
UTF-8
Scheme
false
false
7,235
scm
circuit-simulator.scm
#lang racket (define inverter% (class object% (init-field input) (init-field output) (init-field (inverter-delay 1)) (super-new) (define (invert-input) (let ([new-value (logical-not (send input get-signal))]) (after-delay inverter-delay (lambda () (send output set-signal! new-value))))) (define (logical-not s) (cond ((equal? s 0) 1) ((equal? s 1) 0) (else `undefined))) (send input add-action! invert-input) 'ok)) (define and-gate% (class object% (init-field a1) (init-field a2) (init-field output) (init-field (and-gate-delay 3)) (super-new) (define (and-action-procedure) (let ((new-value (logical-and (send a1 get-signal) (send a2 get-signal)))) (after-delay and-gate-delay (lambda () (send output set-signal! new-value))))) (define (logical-and s1 s2) (cond ((and (equal? s1 0) (equal? s2 0)) 0) ((and (equal? s1 0) (equal? s2 1)) 0) ((and (equal? s1 1) (equal? s2 0)) 0) ((and (equal? s1 1) (equal? s2 1)) 1) (else `undefined))) (send a1 add-action! and-action-procedure) (send a2 add-action! and-action-procedure) 'ok)) (define or-gate% (class object% (init-field a1) (init-field a2) (init-field output) (init-field (or-gate-delay 2)) (super-new) (define (or-action-procedure) (let ((new-value (logical-or (send a1 get-signal) (send a2 get-signal)))) (after-delay or-gate-delay (lambda () (send output set-signal! new-value))))) (define (logical-or s1 s2) (cond ((and (equal? s1 0) (equal? s2 0)) 0) ((and (equal? s1 0) (equal? s2 1)) 1) ((and (equal? s1 1) (equal? s2 0)) 1) ((and (equal? s1 1) (equal? s2 1)) 1) (else `undefined))) (send a1 add-action! or-action-procedure) (send a2 add-action! or-action-procedure))) (define half-adder% (class object% (init-field a) (init-field b) (init-field s) (init-field c) (define d (make-object wire% "d")) (define e (make-object wire% "e")) (super-new) (make-object or-gate% a b d) (make-object and-gate% a b c) (make-object inverter% c e) (make-object and-gate% d e s))) (define wire% (class object% (init wire-name) (define name wire-name) (define signal-value `undefined) (define action-procedures '()) (super-new) (define/public (get-name) name) (define/public (get-signal) signal-value) (define/public (set-signal! new-value) (cond ((not (equal? signal-value new-value)) (begin (set! signal-value new-value) (call-each action-procedures))))) (define/public (add-action! proc) (set! action-procedures (cons proc action-procedures))) (define (call-each procedures) (if (null? procedures) 'done (begin ((car procedures)) (call-each (cdr procedures))))))) (define event-queue% (class object% (define current-time 0) (define last-event-time 0) (define queue (make-vector 20 `())) (super-new) (define/public (add-to-queue! time action) (begin (vector-set! queue time (append (vector-ref queue time) (list action))) (cond ((> time last-event-time) (set! last-event-time time))))) (define (queue-empty?) (> current-time last-event-time)) (define (increment-time!) (set! current-time (+ current-time 1))) (define (next-item-in-queue) (vector-ref queue current-time)) (define/public (get-time) current-time) (define/public (propagate!) (if (queue-empty?) 'done (let ([action-list (next-item-in-queue)]) (begin (execute! action-list) (increment-time!) (propagate!))))) (define (execute! action-list) (cond ((not (null? action-list)) (begin ((car action-list)) (execute! (cdr action-list)))))))) (define probe% (class object% (init-field wire) (init-field queue) (super-new) (send wire add-action! (lambda () (newline) (display "time = ") (display (send queue get-time )) (newline) (display "wire-name = ") (display (send wire get-name)) (newline) (display "New-value = ") (display (send wire get-signal)) (newline) (newline))))) ;(define (propagate queue) ; (if (send the-queue queue-empty?) ; 'done ; (let ((action-list (send the-queue next-item-in-queue))) ; (execute! action-list) ; (send queue increment-time!) ;; (send queue print) ; for debugging ; (propagate queue)))) ; ;(define (execute! action-list) ; (cond ((not (null? action-list)) ; (begin ; ((car action-list)) ; (execute! (cdr action-list)))))) (define (after-delay delay action) (send the-queue add-to-queue! (+ delay (send the-queue get-time)) action)) (define the-queue (make-object event-queue%)) (define a (make-object wire% "a")) (define b (make-object wire% "b")) (define s (make-object wire% "s")) (define c (make-object wire% "c")) (make-object probe% a the-queue) (make-object probe% b the-queue) (make-object probe% s the-queue) (make-object probe% c the-queue) (make-object half-adder% a b s c) (send the-queue add-to-queue! 3 (lambda () (send b set-signal! 1))) (send the-queue add-to-queue! 1 (lambda () (send a set-signal! 0))) (send the-queue propagate!) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;(define a (make-object wire% "a")) ;(define b (make-object wire% "b")) ;(define ci (make-object wire% "ci")) ;(define s (make-object wire% "s")) ;(define co (make-object wire% "co")) ;(make-object probe% "a" a the-queue) ;(make-object probe% "b" b the-queue) ;(make-object probe% "ci" ci the-queue) ;(make-object probe% "s" s the-queue) ;(make-object probe% "co" co the-queue) ;(make-object full-adder% a b ci s co) ;(send the-queue add-to-queue! 3 (lambda () (send b set-signal! 1))) ;(send the-queue add-to-queue! 1 (lambda () (send a set-signal! 0))) ;(send the-queue add-to-queue! 2 (lambda () (send ci set-signal! 1))) ;(define full-adder% ; (class object% ; ; (init-field a) ; (init-field b) ; (init-field ci) ; (init-field s) ; (init-field co) ; ; (define d (make-object wire% "d")) ; (define e (make-object wire% "e")) ; (define f (make-object wire% "f")) ; ; (super-new) ; ; (make-object half-adder% b ci d e) ; (make-object half-adder% a d s f) ; (make-object or-gate% f e co)))
false
62d3ea9754e42a8fbe9fe24a56658053c6b4f654
9b2eb10c34176f47f7f490a4ce8412b7dd42cce7
/lib/yunivm/vm/vmcore.sls
a692e8cc8c652bd8c73e72ffd8ee49d0b52aa33e
[ "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
14,341
sls
vmcore.sls
(library (yunivm vm vmcore) (export vmcore-new) (import (yuni scheme)) ;; (define (vmcore-new imm-tbl query) ;; => cycle extra ;; Machine state (define S* '()) (define S #f) (define E* '()) (define E #f) (define D* '()) (define V '()) (define IMMFRAME #f) (define link 'none) ;; none | single | values | call | multi ;; Query(call-back) (define constant (query 'CONSTANT)) ;; (imm) (define global (query 'GLOBAL)) ;; (mod pos) (define heapin (query 'HEAPIN)) (define heapout (query 'HEAPOUT)) (define make-closure (query 'MAKE-VMCLOSURE)) ;; (label env) (define make-unspecified (query 'MAKE-UNSPECIFIED)) (define vm-args-compose (query 'VM-ARGS-COMPOSE)) ;; objs (define vm-args-decompose (query 'VM-ARGS-DECOMPOSE)) ;; (obj cb) (define vm-primitive? (query 'VM-PRIMITIVE?)) ;; (obj) (define vm-primitive-id (query 'VM-PRIMITIVE-ID)) (define vm-primitive-proc (query 'VM-PRIMITIVE-PROC)) (define vm-returnpoint (query 'VM-RETURNPOINT)) (define vm-call-env (query 'VM-CALL-ENV)) ;; (obj) (define vm-call-label (query 'VM-CALL-LABEL)) ;; (obj) (define jump (query 'JUMP)) ;; (label) (define branch (query 'BRANCH)) ;; (label obj) (define set-gc-hook! (query 'HEAP-SET-GC-HOOK!)) (define gc-mark! (query 'HEAP-GC-MARK!)) (define frame-set! (query 'HEAP-FRAME-SET!)) (define frame-ref (query 'HEAP-FRAME-REF)) (define make-frame (query 'HEAP-MAKE-FRAME)) (define frame-length (query 'HEAP-FRAME-LENGTH)) (define frame->list (query 'HEAP-FRAME->LIST)) (define list->frame (query 'HEAP-LIST->FRAME)) (define chain-last (query 'HEAP-CHAIN-LAST)) (define chain-last? (query 'HEAP-CHAIN-LAST?)) (define chain-current (query 'HEAP-CHAIN-CURRENT)) (define chain-next (query 'HEAP-CHAIN-NEXT)) (define chain-cons (query 'HEAP-CHAIN-CONS)) (define chain-ref (query 'HEAP-CHAIN-REF)) (define hostkey (query 'HEAP-HOST-KEY)) (define hostfetch (query 'HEAP-HOST-FETCH)) (define (reset-vm-state!) (set! S #f) (set! S* (chain-last)) (set! E #f) (set! E* (chain-last)) (set! D* (chain-last)) (set! V #f) (set! link 'none) (set! IMMFRAME (make-frame (vector-length imm-tbl))) (set-gc-hook! gc-hook) (gc-disable) ;; Fill imm table (let loop ((idx 0)) (unless (= idx (vector-length imm-tbl)) (frame-set! IMMFRAME idx (heapin (vector-ref imm-tbl idx))) (loop (+ idx 1)))) (gc-enable)) (define (gc-enable) (set-gc-hook! #t)) (define (gc-disable) (set-gc-hook! #f)) (define (gc-hook) (when S (gc-mark! S)) (gc-mark! S*) (when E (gc-mark! E)) (gc-mark! E*) (gc-mark! D*) (gc-mark! IMMFRAME) (when V (gc-mark! V))) ;; Register stack (define (push-S! vec) (let ((curS S)) (set! S vec) (when curS (set! S* (chain-cons curS S*))))) (define (pop-S!) (cond ((chain-last? S*) (unless S (error "Stack underflow(S)")) (set! S #f)) (else (let ((a (chain-current S*)) (d (chain-next S*))) (set! S a) (set! S* d))))) (define (push-E! vec) (let ((curE E)) (set! E vec) (when curE (set! E* (chain-cons curE E*))))) (define (pop-E!) (cond ((chain-last? E*) (unless E (error "Stack underflow(E)")) (set! E #f)) (else (let ((a (chain-current E*)) (d (chain-next E*))) (set! E a) (set! E* d))))) (define (apply-env! obj) (let ((top (chain-current obj)) (next (chain-next obj))) (set! E top) (set! E* next) (set! S* (chain-last)))) ;; OP macros (define (set-value! val) (set! V val) (set! link 'single)) ;; OPs ;; Env frame (define (FRAME imm) (let ((v (make-frame imm))) (push-S! v))) (define (RECV imm) (define stack-len (frame-length S)) ;(pp (list 'RECV: S)) (case link ((call) (unless (= stack-len imm) (error "Argument count unmatch" S imm)) (push-E! S)) ((multi) (when (= 0 stack-len) (error "Null stack?? (FIXME)")) (when (< imm stack-len) (error "Argument count unmatch" S imm)) (let ((vec1 (make-frame imm)) (rest (frame-ref S (- stack-len 1)))) (vm-args-decompose rest (lambda objs (let loop ((idx 0) (cur objs)) (cond ((< idx (- stack-len 1)) (frame-set! vec1 idx (frame-ref S idx)) (loop (+ idx 1) cur)) (else (frame-set! vec1 idx (car cur)) (unless (null? (cdr cur)) (loop (+ idx 1) (cdr cur)))))))) (push-E! vec1))) (else (error "Invalid link status" link)))) (define (RECVM imm) (define stack-len (frame-length S)) ;(pp (list 'RECVM: S)) (case link ((call) (unless (<= imm stack-len) (error "Argument count unmatch" S imm)) ;; We have to use native pair to hold temporal values ;; Because we cannot hold values to VM register prevent GCs (let loop ((idx 0) (cur1 '()) (cur2 '())) (cond ((< idx imm) ;; Collect arg1 (loop (+ idx 1) (cons (frame-ref S idx) cur1) cur2)) ((= stack-len idx) ;; Push to E (push-E! (list->frame (reverse (cons (apply vm-args-compose (reverse cur2)) cur1)))) ) (else ;; Collect arg2 (loop (+ idx 1) cur1 (cons (frame-ref S idx) cur2)))))) ((multi) (cond ((= stack-len (+ imm 1)) ;; Short cut (push-E! S)) (else ;; Slow path (let* ((l (reverse (frame->list S))) (resto (car l)) (args0 (reverse (cdr l)))) (vm-args-decompose resto (lambda objs (let ((args (append args0 objs))) (unless (<= imm (length args)) (error "Argument count unmatch" S imm)) (let loop ((idx 0) (cur '()) (rest args)) (cond ((< idx imm) (when (null? rest) (error "Argument count unmatch??? (FIXME)")) (loop (+ idx 1) (cons (car rest) cur) (cdr rest))) (else (push-E! (list->frame (reverse (cons (apply vm-args-compose rest) cur)))))))))))))) (else (error "Invalid link status" link)))) (define (BIND) (push-E! S) (pop-S!)) (define (LEAVE) (pop-E!)) ;; Branch/Call (define (prepare-args type stack) (case type ((call) (frame->list stack)) ((multi) (let ((l (frame->list stack))) (cond ((null? l) '()) (else (let* ((a0 (reverse l)) (rest (car a0)) (args (reverse (cdr a0)))) (vm-args-decompose rest (lambda objs (append args objs)))))))) (else (error "Invalid call type" type)))) (define (restorectx ctx) ;; Load values (case link ((values) (push-S! V)) ((single) (FRAME 1) (MOV 0)) ((none) (FRAME 0)) (else (error "Invalid link state for call-with-values" link))) ;; Load receiver (set-value! ctx) ;; Call receiver (TCALL)) (define (call-primitive! type) (let ((l (prepare-args type S)) (id (vm-primitive-id V))) ;; Save current stack content to V to prevent premature GC collection (case id ((-1) ;; apply (set-value! S) (pop-S!) (unless (< 0 (length l)) (error "Invalid parameter for apply" l)) (let ((proc (car l)) (args (cdr l))) (let ((flen (length args))) (FRAME flen) (let loop ((idx 0) (x args)) (unless (= idx flen) (set-value! (car x)) (MOV idx) (loop (+ idx 1) (cdr x)))) (set-value! proc) (TCALLM)))) ((-2) ;; call-with-values (set-value! S) (pop-S!) (unless (= (length l) 2) (error "Invalid parameter for call-with-values" l)) (let ((send (car l)) (recv (cadr l))) (save-dump-obj! recv restorectx) ;; Push nothing (FRAME 0) ;; Load sender (set-value! send) ;; Call sender (TCALL))) (else ;; Standard primitives (let ((proc V)) ;; FIXME: We shouldn't need this as we ;; do not have callbacks any longer (set-value! S) (pop-S!) (call-with-values (lambda () (apply (vm-primitive-proc proc) l)) (lambda vals ;(pp (list 'RESULT: vals)) (case (length vals) ((0) (set! V #f) (set! link 'none)) ((1) (set! V (car vals)) (set! link 'single)) (else (set! V (list->frame vals)) (set! link 'values))) (restore-dump!)))))))) (define (call-label! type) (set! link type) (apply-env! (vm-call-env V)) (jump (hostfetch (vm-call-label V)))) (define (save-dump-obj! ctx obj) (set! D* (chain-cons (list->frame (if ctx (list S* E E* (hostkey obj) ctx) (list S* E E* (hostkey obj)))) D*))) (define (save-dump!) (save-dump-obj! #f (vm-returnpoint))) (define (restore-dump!) (let ((a (chain-current D*)) (d (chain-next D*))) (let ((ex-S* (frame-ref a 0)) (ex-E (frame-ref a 1)) (ex-E* (frame-ref a 2)) (returnpoint (hostfetch (frame-ref a 3)))) (set! S '()) (set! S* ex-S*) (pop-S!) (set! E ex-E) (set! E* ex-E*) (cond ;; Callbacks will use procedure as returnpoint ((procedure? returnpoint) (returnpoint (frame-ref a 4))) (else (jump returnpoint)))) (set! D* d))) (define (call-dispatch! type tail?) (unless (eq? link 'single) (error "Invalid object for call" V)) (let ((primitive? (vm-primitive? V))) (unless tail? (save-dump!)) (cond (primitive? (call-primitive! type)) (else (call-label! type))))) (define (CALL) (call-dispatch! 'call #f)) (define (CALLM) (call-dispatch! 'multi #f)) (define (TCALL) (call-dispatch! 'call #t)) (define (TCALLM) (call-dispatch! 'multi #t)) (define (RET) (restore-dump!)) (define (JMP label) (jump label)) (define (BRV label) (unless (eq? link 'single) (error "Invalid object for branch" V)) (branch label V)) ;; Load/Store (define (LD frm pos) (cond ((= frm 0) (set-value! (frame-ref E pos))) (else (let* ((offs (- frm 1)) (vec (chain-ref E* offs))) (set-value! (frame-ref vec pos)))))) (define (LDG mod pos) (set-value! (global mod pos))) (define (LDF label) (let* ((env (chain-cons E E*)) (key (hostkey label))) ;; chain-cons can cause GC (set-value! (make-closure key env)))) (define (LDC cnr) (set-value! (constant cnr))) (define (LDV) (case (frame-length S) ((1) (set! V (frame-ref S 0)) (set! link 'single)) ((0) (set! V #f) (set! link 'none)) (else (set! V S) (set! link 'values))) (pop-S!)) (define (LDI imm) (set-value! (frame-ref IMMFRAME imm))) (define (LDN) (set-value! (make-unspecified))) (define (LDNN) (set! link 'none)) (define (ST frm pos) (unless (eq? link 'single) (error "Invalid link status" link)) (cond ((= frm 0) (frame-set! E pos V)) (else (let* ((offs (- frm 1)) (vec (chain-ref E* offs))) (frame-set! vec pos V))))) (define (MOV loc) (unless (eq? link 'single) (error "Invalid link status" link)) (frame-set! S loc V)) ;; Machine cycle (define (cycle op arg0 arg1) ;(define (clean-V v) ; (if (pair? v) ; "pair-or-something..." ; v)) ;(write (list 'cycle: op arg0 arg1 (list 'V: (clean-V V)))) (newline) ;(gc-disable) (case op ((FRAME) (FRAME arg0)) ((RECV) (RECV arg0)) ((RECVM) (RECVM arg0)) ((BIND) (BIND)) ((LEAVE) (LEAVE)) ((CALL) (CALL)) ((CALLM) (CALLM)) ((TCALL) (TCALL)) ((TCALLM) (TCALLM)) ((RET) (RET)) ((JMP) (JMP arg0)) ((BRV) (BRV arg0)) ((LD) (LD arg0 arg1)) ((LDG) (LDG arg0 arg1)) ((LDF) (LDF arg0)) ((LDC) (LDC arg0)) ((LDV) (LDV)) ((LDI) (LDI arg0)) ((LDN) (LDN)) ((LDNN) (LDNN)) ((ST) (ST arg0 arg1)) ((MOV) (MOV arg0)) (else (error "Invalid opcode" (list op arg0 arg1)))) ;(gc-enable) ) ;; Extra query (define (extra op arg0 arg1) (case op ((RESULT) (case link ((single) (heapout V)) ((values) (apply values (map heapout (frame->list V)))) ((none) (values)) (else (error "No result available" link V)))) (else (error "Invalid extra request" (list op arg0 arg1)))) ) (reset-vm-state!) (values cycle extra)) )
false
f82d86b0c912c47ad27c5df0a875b757f639589c
ecc64f06b59d01680c312066af53b3e79e1b1f7a
/tools/tgc.scm
ce3b43acaf6f13a7e654508c80d9eec97c884ae4
[ "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
4,549
scm
tgc.scm
(set! (*s7* 'heap-size) 128000) ; old-style (load "s7test-block.so" (sublet (curlet) (cons 'init_func 'block_init))) (define (check-cyclic p1) (let ((c1 (cyclic-sequences p1)) (c2 (cyclic-sequences (copy p1))) (c3 (cyclic-sequences (object->let p1)))) (unless (and (equal? c1 c2) (equal? c2 c3)) (format *stderr* "cyclic: ~S: ~S ~S ~S~%" p1 c1 c2 c3)))) (define (tgc-cyclic tries) (let ((wait (make-vector 200 #f))) (do ((i 0 (+ i 1))) ((= i tries)) (let ((p1 (cons 1 2)) (p2 (list 1 1 1 1 1 1 1)) (p3 (list 1 2))) (set-cdr! (cdr p3) p3) (check-cyclic p1) (check-cyclic p2) (check-cyclic p3) (let ((v1 (vector 1 2)) (v2 (make-vector 7 1)) (v3 (vector 1 2 3)) (v4 (make-vector '(3 2)))) (vector-set! v3 2 v3) (check-cyclic v1) (check-cyclic v2) (check-cyclic v3) (check-cyclic v4) (check-cyclic (subvector v2 1 5)) (check-cyclic (subvector v3 1)) (let ((s1 (string #\a #\s #\d #\f))) (check-cyclic s1) (check-cyclic (substring s1 1)) (let ((iv1 (int-vector 1 2)) (iv2 (make-int-vector 7 1))) (check-cyclic iv1) (check-cyclic iv2) (check-cyclic (subvector iv2 1 5)) (let ((h1 (hash-table 'a 1)) (h2 (weak-hash-table 'b p1))) (check-cyclic h1) (check-cyclic h2) (let ((i1 (inlet 'a 1 'b 2))) (check-cyclic i1) (let ((in1 (open-output-string))) (format in1 "asdf\n") (check-cyclic in1) (let ((in2 (open-input-string "asdf\n"))) (read-line in2) (check-cyclic in2) (let ((c1 (c-pointer 0 integer? "info" (cons h1 h2) (vector p3 p2 p1)))) (check-cyclic c1) (let ((cc (call/cc (lambda (ret) ret)))) (check-cyclic cc) (let ((ex1 (call-with-exit (lambda (go) (check-cyclic go) go)))) (let ((f1 (lambda (a b c) (+ a b c)))) (check-cyclic f1) (let ((u1 #<asdf>)) (check-cyclic u1) (let ((g1 (gensym))) (check-cyclic g1) (check-cyclic ()) (check-cyclic #<unspecified) (check-cyclic when) (check-cyclic #<eof>) (check-cyclic #f) (check-cyclic #\a) (check-cyclic pi) (check-cyclic 1/2) (check-cyclic 1+i) (check-cyclic 'a) (check-cyclic (lambda (a) (+ a 1))) (let ((it1 (make-iterator '(1 2 3)))) (check-cyclic it1) (let ((b1 (block 1 2 3))) (check-cyclic b1) (for-each (lambda (a) (let ((pos (random 200))) (if (eq? (vector-ref wait pos) #\c) ; just check that it hasn't been freed (format *stderr* "~S?" (vector-ref wait pos))) (vector-set! wait pos a)) (dynamic-wind #f (lambda () (catch #t (lambda () (call-with-exit (lambda (r) (r a)))) (lambda (type info) (format *stderr* "~A: ~A~%" type (apply format #f info))))) #f)) (list p1 p2 p3 v1 v2 v3 v4 s1 iv2 iv2 h1 h2 i1 in1 in2 c1 cc ex1 u1 g1 it1 b1))))))))))))))))))))) (tgc-cyclic 25000) (define (tgc tries) (do ((wait (make-vector 200 #f)) (i 0 (+ i 1))) ((= i tries)) (let ((p1 (cons 1 2)) (p2 (list 1 1 1 1 1 1 1)) (p3 (list 1 2)) (v1 (vector 1 2)) (v2 (make-vector 7 1)) (v3 (vector 1 2 3)) (v4 (make-vector '(3 2))) (s1 (string #\a #\s #\d #\f)) (iv2 (make-int-vector 7 1)) (h1 (hash-table 'a 1)) (i1 (inlet 'a 1 'b 2)) (in1 (open-output-string)) (in2 (open-input-string "asdf\n")) (cc (call/cc (lambda (ret) ret))) (ex1 (call-with-exit (lambda (go) go))) (f1 (lambda (a b c) (+ a b c))) (u1 #<asdf>) (g1 (gensym)) (it1 (make-iterator '(1 2 3))) (b1 (block 1 2 3))) (set-cdr! (cdr p3) p3) (vector-set! v3 2 v3) (format in1 "asdf\n") (read-line in2) (let* ((h2 (weak-hash-table 'b p1)) (c1 (c-pointer 0 integer? "info" (cons h1 h2) (vector p3 p2 p1)))) (for-each (lambda (a) (let ((pos (random 200))) (if (eq? (vector-ref wait pos) #\c) ; just check that it hasn't been freed (format *stderr* "~S?" (vector-ref wait pos))) (vector-set! wait pos a)) (dynamic-wind #f (lambda () (catch #t (lambda () (call-with-exit (lambda (r) (r a)))) (lambda (type info) (format *stderr* "~A: ~A~%" type (apply format #f info))))) #f)) (list p1 p2 p3 v1 v2 v3 v4 s1 iv2 iv2 h1 h2 i1 in1 in2 c1 cc ex1 u1 g1 it1 b1)))))) (tgc 200000) ;(tgc 1000000000) (exit)
false
871c4c7e77febe4a2e6fb73dedd4368e3c1a76ed
2861d122d2f859f287a9c2414057b2768870b322
/lib/aeolus/misc/record/opaque-cell.scm
49aff6d250c1a6eec5b1f466506fc4510af35896
[ "BSD-3-Clause" ]
permissive
ktakashi/aeolus
c13162e47404ad99c4834da6677fc31f5288e02e
2a431037ea53cb9dfb5b585ab5c3fbc25374ce8b
refs/heads/master
2016-08-10T08:14:20.628720
2015-10-13T11:18:13
2015-10-13T11:18:13
43,139,534
5
0
null
null
null
null
UTF-8
Scheme
false
false
1,980
scm
opaque-cell.scm
;; Opaque cells for R6RS Records ;; Based on the SRFI implementation: ; Copyright (C) Michael Sperber (2005). All Rights Reserved. ; ; 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. ;; modified by Takashi Kato ;; - stripped library ;; - change record-name ;; - don't use assertion-violation (scheme:define-record-type <opaque-cell> (make-opaque-cell key-predicate contents) opaque-cell? (key-predicate opaque-cell-key-predicate) (contents real-opaque-cell-ref real-opaque-cell-set!)) (define (ensure-opaque-cell-access key cell) (if (not ((opaque-cell-key-predicate cell) key)) (error "access to opaque cell denied" cell key))) (define (opaque-cell-ref key cell) (ensure-opaque-cell-access key cell) (real-opaque-cell-ref cell)) (define (opaque-cell-set! key cell val) (ensure-opaque-cell-access key cell) (real-opaque-cell-set! key val)) (define (opaque-cell-key-fits? key cell) (and ((opaque-cell-key-predicate cell) key) #t))
false
5b865430569d3bc30acb265b389a220877186871
e7d3de04e42b598d01b85327c3b8a1947f0347c9
/ideas.scm
d595aac0cb81eb0c0c61b883709683beb650a9fd
[]
no_license
beoliver/belang
b8a73d9a7ebda15cab803e7d03a0fe6833005041
9a17d1ffa312b73dc3052657a1b710047c08de8a
refs/heads/master
2020-05-16T21:32:51.724350
2015-06-02T08:59:13
2015-06-02T08:59:13
35,674,665
1
0
null
null
null
null
UTF-8
Scheme
false
false
2,038
scm
ideas.scm
(fun (<pattern> -> <body>) ... (<pattern> -> <body>)) ;; currently (guard (<pattern> <body>) ... (<pattern> <body>)) (guard ((x y 10) (+ x y)) ((x y 20) (display "twenty") (* x y))) ;; this will become... (fun (x y 10 -> (+ x y)) (x y 20 -> (display "twenty") (* x y))) (define (parse-fun-clause head body) (if (eq? (car body) '->) (cons (reverse head) (cdr body)) (parse-fun-clause (cons (car body) head) (cdr body)))) (define (sf-fun x) (let* ((clauses (cdr x)) (parsed-clauses (map (lambda (clause) (parse-fun-clause (list) clause)) clauses))) (sf-guard (cons 'guard parsed-clauses)))) ;; now eval and convert to lambdas ;; we will also alow for named lambdas ;; is there a nicer way of calling a lambda ((fun (x) -> x) 1) (fun (x) -> x) 1 (define example '(lambda (n) (display n) (newline) (if (not (= n 0)) (this (- n 1))))) (define (sf-lambda lambda-exp env) (let* ((this-env (cons '() env)) (this-closure (list 'closure (cadr lambda-exp) (cddr lambda-exp) this-env))) (set-car! this-env (cons (cons 'this this-closure) (car this-env))) this-closure)) // a lambda function (<pattern> -> <body>) // would be fun if all functions were curried (def <symbol> <body>) (def add-1 (+ 1)) (+ 1) // what about functions that do not have a fixed arity? // (+ 1 2 3 4 5 ... n) == (apply + '(1 2 3 4 5 ... n)) // in belang like scheme, functions can have fixed arity or arbitrary arity... // functions that have fixed arity are curried until the point that they become callable // functions that have arbitrary arity are curried indefinitely... they are then passed to a call function (def add +) (def add' (+ 1 2 3 4)) (def add'' (add' 5 6 7 8)) ((add'')) (define (call-applied-function f) ((f))) // prolog|erlang style pattern matching? (def factorial (0 -> 1) (N -> (* N (factorial (- N 1))))) (def cons (X Y -> (SELECTOR -> (SELECTOR X Y)))) (def car (CELL -> (CELL (X Y -> X))))
false
ba483bf27e50a1f6eb0db77200292f90b8ad14d7
4b480cab3426c89e3e49554d05d1b36aad8aeef4
/chapter-02/ex2.28-falsetru-test.scm
095907d16c7f3308b33bcfe36e21615a87921739
[]
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
419
scm
ex2.28-falsetru-test.scm
(require (planet schematics/schemeunit:3)) (require (planet schematics/schemeunit:3/text-ui)) (load "ex2.28-falsetru.scm") (define x (list (list 1 2) (list 3 4))) (define ex2.28-falsetru-tests (test-suite "Test for ex2.28-falsetru" (check-equal? (fringe x) '(1 2 3 4)) (check-equal? (fringe (list x x)) '(1 2 3 4 1 2 3 4)) )) (exit (cond ((= (run-tests ex2.28-falsetru-tests) 0)) (else 1)))
false
e4a00eb93ef442eb707da014bf0c7a044ea62119
c63772c43d0cda82479d8feec60123ee673cc070
/ch1/24.scm
d42071466ca6be8675dd3908d03ac2009780d6f7
[ "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
557
scm
24.scm
#lang racket (require "prime-check.rkt") ; random function generate pseudo-random number [0, n) ; it only could generate in [0, 4294967087) ; ; don't save fermat test random value, ; when n is large, collision probablity is so low, we don't need to save it. (define (fermat-test n) (define (try-it a) (= (expmod a n n) a)) (try-it (+ 1 (random (- n 1))))) (define (fast-prime? n times) (cond ((= times 0) #t) ((fermat-test n) (fast-prime? n (- times 1))) (else #f))) (set-prime?! (lambda (n) (fast-prime? n 100))) (test-case)
false
2ddfcff21384e17f2ed59b0156ae70d7b78a2e29
be32518c6f54b0ab1eaf33f53405ac1d2e1023c2
/np/lang/macros/test/define-language/test-define-language.ss
a81a3fe82da65757562f02e0ffbabb13a92a84bd
[ "BSD-3-Clause", "BSD-2-Clause" ]
permissive
ilammy/np
7990302bc30fe7802a7f4fc33d8fa7449ef8b011
0e3cbdea0eb2583f9b272d97bc408011af6a7947
refs/heads/master
2016-09-05T17:11:03.893011
2015-06-13T16:37:39
2015-06-13T16:37:39
23,740,287
1
0
null
2015-06-13T16:39:43
2014-09-06T17:19:46
Scheme
UTF-8
Scheme
false
false
1,507
ss
test-define-language.ss
(import (scheme base) (np lang macros define-language) (np lang descriptions language) (sr ck) (sr ck kernel) (te base) (te conditions assertions) (te utils verify-test-case)) ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; (define-test-case (test:define-language "Smoke tests of the interface macro") (define (assert-defined-language language) (assert-true (language-description? language)) ) (define (assert-defined-procedure procedure) (assert-true (procedure? procedure)) ) (define-test ("Empty language") (define-language Foo) (assert-defined-language Foo) ) (define-test ("Standlone language") (define-language Foo (predicate Foo?) (parser parse-Foo) (unparser unparse-Foo) (terminals (number number? (n i j k)) (boolean boolean? (b)) ) (Pair Pair? (Pair) (n b) (n n) (b n) (b b) ) ) (assert-defined-language Foo) (assert-defined-procedure Foo?) (assert-defined-procedure parse-Foo) (assert-defined-procedure unparse-Foo) (assert-defined-procedure Pair?) ) (define-test ("Extension language") (define-language Foo (Empty (e) () ) ) (define-language Bar (extends Foo) (terminals (+ (number number? (n))) ) (! (Empty Empty? ((+ g)))) ) (assert-defined-language Foo) (assert-defined-language Bar) ) ) (verify-test-case! test:define-language)
false
89c5ebe0bef523f17e73cb3f2450a1806bed873b
f59b3ca0463fed14792de2445de7eaaf66138946
/section-4/4_57.scm
a548dc76c317fd1fd5a356fb0dc97c5148dfabcf
[]
no_license
uryu1994/sicp
f903db275f6f8c2da0a6c0d9a90c0c1cf8b1e718
b14c728bc3351814ff99ace3b8312a651f788e6c
refs/heads/master
2020-04-12T01:34:28.289074
2018-06-26T15:17:06
2018-06-26T15:17:06
58,478,460
0
1
null
2018-06-20T11:32:33
2016-05-10T16:53:00
Scheme
UTF-8
Scheme
false
false
611
scm
4_57.scm
(load "./microshaft") (query-driver-loop) (assert! (rule (same ?x ?x))) (assert! (rule (replace ?person1 ?person2) (and (or (and (job ?person1 ?job) (job ?person2 ?job)) (and (job ?person1 ?job1) (job ?person2 ?job2) (can-do-job ?job2 ?job1))) (not (same ?person1 ?person2))))) ;; a (replace (Fect Cy D) ?who) ;; b (and (salary ?person ?salary) (replace ?person ?somebody) (salary ?somebody ?somebody-salary) (lisp-value > ?somebody-salary ?salary))
false
7929ab238e4e198ecb8a714e2dadb376ac80f40d
a4512643fa4feabf7e81b62733043bfbaadb6a98
/interfaces.scm
74f3ce20bb78c66a57c7e1619b42df0083ed598e
[]
no_license
scheme/terminfo
293c8009408d5743d249b8a29504256958849971
45541fdb8ffbc51dc1c894ac447a21161688fe1e
refs/heads/master
2016-09-05T11:01:22.049064
2010-10-25T18:01:39
2010-10-25T18:01:39
6,118,942
6
3
null
null
null
null
UTF-8
Scheme
false
false
12,001
scm
interfaces.scm
;;; -*- Mode: Scheme; scheme48-package: terminfo -*- (define-interface terminfo-core-interface (export *current-terminal* *terminfo-directories* *capabilities* (capability-available? :syntax) setup-terminal console-input-port console-output-port terminal:baud-rate terminal:port terminal:capability terminal:names terminal:x-size terminal:y-size tparm tputs)) (define-interface terminfo-capabilities-interface (export auto-left-margin auto-right-margin no-esc-ctlc ceol-standout-glitch eat-newline-glitch erase-overstrike generic-type hard-copy has-meta-key has-status-line insert-null-glitch memory-above memory-below move-insert-mode move-standout-mode over-strike status-line-esc-ok dest-tabs-magic-smso tilde-glitch transparent-underline xon-xoff needs-xon-xoff prtr-silent hard-cursor non-rev-rmcup no-pad-char non-dest-scroll-region can-change back-color-erase hue-lightness-saturation col-addr-glitch cr-cancels-micro-mode has-print-wheel row-addr-glitch semi-auto-right-margin cpi-changes-res lpi-changes-res backspaces-with-bs crt-no-scrolling no-correctly-working-cr gnu-has-meta-key linefeed-is-newline has-hardware-tabs return-does-clr-eol columns init-tabs lines lines-of-memory magic-cookie-glitch padding-baud-rate virtual-terminal width-status-line num-labels label-height label-width max-attributes maximum-windows max-colors max-pairs no-color-video buffer-capacity dot-vert-spacing dot-horz-spacing max-micro-address max-micro-jump micro-col-size micro-line-size number-of-pins output-res-char output-res-line output-res-horz-inch output-res-vert-inch print-rate wide-char-size buttons bit-image-entwining bit-image-type magic-cookie-glitch-ul carriage-return-delay new-line-delay backspace-delay horizontal-tab-delay number-of-function-keys back-tab bell carriage-return change-scroll-region clear-all-tabs clear-screen clr-eol clr-eos column-address command-character cursor-address cursor-down cursor-home cursor-invisible cursor-left cursor-mem-address cursor-normal cursor-right cursor-to-ll cursor-up cursor-visible delete-character delete-line dis-status-line down-half-line enter-alt-charset-mode enter-blink-mode enter-bold-mode enter-ca-mode enter-delete-mode enter-dim-mode enter-insert-mode enter-secure-mode enter-protected-mode enter-reverse-mode enter-standout-mode enter-underline-mode erase-chars exit-alt-charset-mode exit-attribute-mode exit-ca-mode exit-delete-mode exit-insert-mode exit-standout-mode exit-underline-mode flash-screen form-feed from-status-line init-1string init-2string init-3string init-file insert-character insert-line insert-padding key-backspace key-catab key-clear key-ctab key-dc key-dl key-down key-eic key-eol key-eos key-f0 key-f1 key-f10 key-f2 key-f3 key-f4 key-f5 key-f6 key-f7 key-f8 key-f9 key-home key-ic key-il key-left key-ll key-npage key-ppage key-right key-sf key-sr key-stab key-up keypad-local keypad-xmit lab-f0 lab-f1 lab-f10 lab-f2 lab-f3 lab-f4 lab-f5 lab-f6 lab-f7 lab-f8 lab-f9 meta-off meta-on new-line pad-char parm-dch parm-delete-line parm-down-cursor parm-ich parm-index parm-insert-line parm-left-cursor parm-right-cursor parm-rindex parm-up-cursor pkey-key pkey-local pkey-xmit print-screen prtr-off prtr-on repeat-char reset-1string reset-2string reset-3string reset-file restore-cursor row-address save-cursor scroll-forward scroll-reverse set-attributes set-tab set-window tab to-status-line underline-char up-half-line init-prog key-a1 key-a3 key-b2 key-c1 key-c3 prtr-non char-padding acs-chars plab-norm key-btab enter-xon-mode exit-xon-mode enter-am-mode exit-am-mode xon-character xoff-character ena-acs label-on label-off key-beg key-cancel key-close key-command key-copy key-create key-end key-enter key-exit key-find key-help key-mark key-message key-move key-next key-open key-options key-previous key-print key-redo key-reference key-refresh key-replace key-restart key-resume key-save key-suspend key-undo key-sbeg key-scancel key-scommand key-scopy key-screate key-sdc key-sdl key-select key-send key-seol key-sexit key-sfind key-shelp key-shome key-sic key-sleft key-smessage key-smove key-snext key-soptions key-sprevious key-sprint key-sredo key-sreplace key-sright key-srsume key-ssave key-ssuspend key-sundo req-for-input key-f11 key-f12 key-f13 key-f14 key-f15 key-f16 key-f17 key-f18 key-f19 key-f20 key-f21 key-f22 key-f23 key-f24 key-f25 key-f26 key-f27 key-f28 key-f29 key-f30 key-f31 key-f32 key-f33 key-f34 key-f35 key-f36 key-f37 key-f38 key-f39 key-f40 key-f41 key-f42 key-f43 key-f44 key-f45 key-f46 key-f47 key-f48 key-f49 key-f50 key-f51 key-f52 key-f53 key-f54 key-f55 key-f56 key-f57 key-f58 key-f59 key-f60 key-f61 key-f62 key-f63 clr-bol clear-margins set-left-margin set-right-margin label-format set-clock display-clock remove-clock create-window goto-window hangup dial-phone quick-dial tone pulse flash-hook fixed-pause wait-tone user0 user1 user2 user3 user4 user5 user6 user7 user8 user9 orig-pair orig-colors initialize-color initialize-pair set-color-pair set-foreground set-background change-char-pitch change-line-pitch change-res-horz change-res-vert define-char enter-doublewide-mode enter-draft-quality enter-italics-mode enter-leftward-mode enter-micro-mode enter-near-letter-quality enter-normal-quality enter-shadow-mode enter-subscript-mode enter-superscript-mode enter-upward-mode exit-doublewide-mode exit-italics-mode exit-leftward-mode exit-micro-mode exit-shadow-mode exit-subscript-mode exit-superscript-mode exit-upward-mode micro-column-address micro-down micro-left micro-right micro-row-address micro-up order-of-pins parm-down-micro parm-left-micro parm-right-micro parm-up-micro select-char-set set-bottom-margin set-bottom-margin-parm set-left-margin-parm set-right-margin-parm set-top-margin set-top-margin-parm start-bit-image start-char-set-def stop-bit-image stop-char-set-def subscript-characters superscript-characters these-cause-cr zero-motion char-set-names key-mouse mouse-info req-mouse-pos get-mouse set-a-foreground set-a-background pkey-plab device-type code-set-init set0-des-seq set1-des-seq set2-des-seq set3-des-seq set-lr-margin set-tb-margin bit-image-repeat bit-image-newline bit-image-carriage-return color-names define-bit-image-region end-bit-image-region set-color-band set-page-length display-pc-char enter-pc-charset-mode exit-pc-charset-mode enter-scancode-mode exit-scancode-mode pc-term-options scancode-escape alt-scancode-esc enter-horizontal-hl-mode enter-left-hl-mode enter-low-hl-mode enter-right-hl-mode enter-top-hl-mode enter-vertical-hl-mode set-a-attributes set-pglen-inch termcap-init2 termcap-reset linefeed-if-not-lf backspace-if-not-bs other-non-function-keys arrow-key-map acs-ulcorner acs-llcorner acs-urcorner acs-lrcorner acs-ltee acs-rtee acs-btee acs-ttee acs-hline acs-vline acs-plus memory-lock memory-unlock box-chars-1 )) (define-interface terminfo-interface (compound-interface terminfo-core-interface terminfo-capabilities-interface))
false
ae4cb25f7bf6e8b62e932e96ccbd00570e9a2bd2
185024f40e1ceed452781a1f3f57e6d16f57d799
/bonfire/all-tests.ss
b5721ffded6917366969acc6d247e86f8696fa51
[]
no_license
noelwelsh/numeric
b82cd4ca9e4afb18df0129ec2231fc03f9b66450
ac4488cf8cc6f0558f74ca9b8faad0f198e76a84
refs/heads/master
2021-01-18T21:32:27.393991
2010-02-22T14:05:19
2010-02-22T14:05:19
275,898
1
0
null
null
null
null
UTF-8
Scheme
false
false
1,060
ss
all-tests.ss
;;; ;;; Time-stamp: <2009-06-12 16:47:13 noel> ;;; ;;; Copyright (C) by Noel Welsh. ;;; ;;; 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 2.1 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., 59 Temple ;;; Place, Suite 330, Boston, MA 02111-1307 USA ;;; Author: Noel Welsh <[email protected]> ;; ;; ;; Commentary: #lang scheme/base (require (planet schematics/schemeunit:3/test) "frame-test.ss") (define/provide-test-suite all-tests frame-tests )
false
bdcc47e4ed05e5d47673be4000fb96eb92cb0205
000dbfe5d1df2f18e29a76ea7e2a9556cff5e866
/ext/all-tests.scm
70db590d681e8d6e1de2931b50af16794a035534
[ "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
2,792
scm
all-tests.scm
;; all tests for extensions (add-load-path ".") (add-load-path "../lib") (add-load-path "../sitelib") (cond-expand (sagittarius.os.windows (add-dynamic-load-path "../build/modules")) (else (add-dynamic-load-path "../build"))) (import (rnrs) (util file) (core errors) (srfi :39 parameters) (srfi :64 testing)) (define-constant resource-file ".sagittarius-exttestrc") (define search-path #f) (if (file-exists? resource-file) (call-with-input-file resource-file (lambda (p) (let ((line (get-line p))) (unless (eof-object? line) (set! search-path line) (do ((path (get-line p) (get-line p))) ((eof-object? path)) (add-load-path path)))))) ;; to avoid to use installed time library. for ext/thread (add-load-path "./time")) (define (test-on-test-end-detail runner) (define (%test-write-result1 pair port) (display " " port) (display (car pair) port) (display ": " port) (write (cdr pair) port) (newline port)) (let ((log (test-runner-aux-value runner)) (kind (test-result-ref runner 'result-kind))) (when (memq kind '(fail)) (let* ((results (test-result-alist runner)) (source-file (assq 'source-file results)) (source-line (assq 'source-line results)) (test-name (assq 'test-name results))) (when (or source-file source-line) (if source-file (display (cdr source-file))) (display ":") (if source-line (display (cdr source-line))) (display ":")) (display (if (eq? kind 'xpass) "XPASS" "FAIL")) (when test-name (display " ")(display (cdr test-name))) (newline)) (let ((expected (test-result-ref runner 'expected-value)) (actual (test-result-ref runner 'actual-value))) (display #\tab)(display "expected value: ")(display expected)(newline) (display #\tab)(display " actual value: ")(display actual)(newline))) (when (output-port? log) (display "Test end:" log) (newline log) (let loop ((list (test-result-alist runner))) (if (pair? list) (let ((pair (car list))) ;; Write out properties not written out by on-test-begin. (if (not (memq (car pair) '(test-name source-file source-line source-form))) (%test-write-result1 pair log)) (loop (cdr list)))))))) (define (test-runner-detail) (let ((runner (test-runner-simple))) (test-runner-on-test-end! runner test-on-test-end-detail) runner)) (let* ((files (find-files (or search-path ".") :pattern "^test.scm$")) (thunks (map (lambda (file) (lambda () (load file))) files))) (for-each (lambda (file thunk) (parameterize ((test-runner-factory test-runner-detail)) (parameterize ((test-runner-current (test-runner-create))) (guard (e (else (report-error e))) (thunk)))) (newline)) files thunks))
false
783bc1144ede91959b0b48e59364b6c6204d6e9b
223f8e07bd9fd7d43e4b8a6e7413e1d53c47ce4c
/lib/chibi/iset/iterators.scm
bd43f99c0ffc01a24c6cea2bf7c015d89e4df552
[ "BSD-3-Clause" ]
permissive
norton-archive/chibi-scheme
d5092480d22396ad63aae96c58b6e8e0e99103ed
38b8a6056c0b935dc8eb0d80dd774dde871757ef
refs/heads/master
2021-06-14T22:34:12.096599
2016-09-28T14:31:06
2016-09-28T14:31:06
33,801,264
3
0
null
null
null
null
UTF-8
Scheme
false
false
6,952
scm
iterators.scm
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Cursors ;;> Returns true iff \var{iset} is empty. (define (iset-empty? iset) (and (iset? iset) (cond ((iset-bits iset) => zero?) (else #f)) (let ((l (iset-left iset))) (or (not l) (iset-empty? l))) (let ((r (iset-right iset))) (or (not r) (iset-empty? r))))) (define-record-type Iset-Cursor (make-iset-cursor node pos stack) iset-cursor? (node iset-cursor-node iset-cursor-node-set!) (pos iset-cursor-pos iset-cursor-pos-set!) (stack iset-cursor-stack iset-cursor-stack-set!)) (define (%iset-cursor iset . o) (iset-cursor-advance (make-iset-cursor iset (or (iset-bits iset) (iset-start iset)) (if (pair? o) (car o) '())))) ;;> Create a new iset cursor pointing to the first element of iset, ;;> with an optional stack argument. (define (iset-cursor iset . o) (let ((stack (if (pair? o) (car o) '()))) (if (iset-left iset) (iset-cursor (iset-left iset) (cons iset stack)) (%iset-cursor iset stack)))) ;; Continue to the next node in the search stack. (define (iset-cursor-pop cur) (let ((node (iset-cursor-node cur)) (stack (iset-cursor-stack cur))) (cond ((iset-right node) (iset-cursor (iset-right node) stack)) ((pair? stack) (%iset-cursor (car stack) (cdr stack))) (else cur)))) ;; Advance to the next node+pos that can be referenced if at the end ;; of this node's range. (define (iset-cursor-advance cur) (let ((node (iset-cursor-node cur)) (pos (iset-cursor-pos cur))) (cond ((if (iset-bits node) (zero? pos) (> pos (iset-end node))) (iset-cursor-pop cur)) (else cur)))) ;;> Return a new iset cursor pointing to the next element of ;;> \var{iset} after \var{cur}. If \var{cur} is already at ;;> \scheme{end-of-iset?}, the resulting cursor is as well. (define (iset-cursor-next iset cur) (iset-cursor-advance (let ((node (iset-cursor-node cur)) (pos (iset-cursor-pos cur)) (stack (iset-cursor-stack cur))) (let ((pos (if (iset-bits node) (bitwise-and pos (- pos 1)) (+ pos 1)))) (make-iset-cursor node pos stack))))) ;;> Return the element of iset \var{iset} at cursor \var{cur}. If the ;;> cursor is at \scheme{end-of-iset?}, raises an error. (define (iset-ref iset cur) (let ((node (iset-cursor-node cur)) (pos (iset-cursor-pos cur))) (cond ((iset-bits node) (if (zero? pos) (error "cursor reference past end of iset") (+ (iset-start node) (integer-length (- pos (bitwise-and pos (- pos 1)))) -1))) (else (if (> pos (iset-end node)) (error "cursor reference past end of iset") pos))))) ;;> Returns true iff \var{cur} is at the end of \var{iset}, such that ;;> \scheme{iset-ref} is no longer valid. (define (end-of-iset? iset cur) (let ((node (iset-cursor-node cur))) (and (if (iset-bits node) (zero? (iset-cursor-pos cur)) (> (iset-cursor-pos cur) (iset-end node))) (not (iset-right node)) (null? (iset-cursor-stack cur))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Equality (define (iset2= is1 is2) (let lp ((cur1 (iset-cursor is1)) (cur2 (iset-cursor is2))) (cond ((end-of-iset? is1 cur1) (end-of-iset? is2 cur2)) ((end-of-iset? is2 cur2) #f) ((= (iset-ref is1 cur1) (iset-ref is2 cur2)) (lp (iset-cursor-next is1 cur1) (iset-cursor-next is2 cur2))) (else #f)))) (define (iset2<= is1 is2) (let lp ((cur1 (iset-cursor is1)) (cur2 (iset-cursor is2))) (cond ((end-of-iset? is1 cur1)) ((end-of-iset? is2 cur2) #f) (else (let ((i1 (iset-ref is1 cur1)) (i2 (iset-ref is1 cur2))) (cond ((> i1 i2) (lp cur1 (iset-cursor-next is2 cur2))) ((= i1 i2) (lp (iset-cursor-next is1 cur1) (iset-cursor-next is2 cur2))) (else ;; (< i1 i2) - i1 won't occur in is2 #f))))))) ;;> Returns true iff all arguments contain the same elements. Always ;;> returns true if there are less than two arguments. (define (iset= . o) (or (null? o) (let lp ((a (car o)) (ls (cdr o))) (or (null? ls) (and (iset2= a (car ls)) (lp (car ls) (cdr ls))))))) ;;> Returns true iff the arguments are monotonically increasing, that ;;> is each argument contains every element of all preceding ;;> arguments. Always returns true if there are less than two ;;> arguments. (define (iset<= . o) (or (null? o) (let lp ((a (car o)) (ls (cdr o))) (or (null? ls) (and (iset2<= a (car ls)) (lp (car ls) (cdr ls))))))) ;;> Returns true iff the arguments are monotonically decreasing, that ;;> is each argument contains every element of all succeeding ;;> arguments. Always returns true if there are less than two ;;> arguments. (define (iset>= . o) (apply iset<= (reverse o))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Folding (define (iset-fold-node kons knil iset) (let lp ((is iset) (acc knil)) (let* ((left (iset-left is)) (acc (kons is (if left (lp left acc) acc))) (right (iset-right is))) (if right (lp right acc) acc)))) ;;> The fundamental iset iterator. Applies \var{kons} to every ;;> element of \var{iset} along with an accumulator, starting with ;;> \var{knil}. Returns \var{knil} if \var{iset} is empty. (define (iset-fold kons knil iset) (iset-fold-node (lambda (is acc) (let ((start (iset-start is)) (end (iset-end is)) (bits (iset-bits is))) (if bits (let ((limit (+ 1 (- end start)))) (do ((n1 bits n2) (n2 (bitwise-and bits (- bits 1)) (bitwise-and n2 (- n2 1))) (acc acc (kons (+ start (integer-length (- n1 n2)) -1) acc))) ((zero? n1) acc))) (do ((i start (+ i 1)) (acc acc (kons i acc))) ((> i end) acc))))) knil iset)) (define (iset-for-each-node proc iset) (iset-fold-node (lambda (node acc) (proc node)) #f iset)) ;;> Runs \var{proc} on every element of iset, discarding the results. (define (iset-for-each proc iset) (iset-fold (lambda (i acc) (proc i)) #f iset)) ;;> Returns a list of every integer in \var{iset} in sorted ;;> (increasing) order. (define (iset->list iset) (reverse (iset-fold cons '() iset))) ;;> Returns the number of elements in \var{iset}. (define (iset-size iset) (iset-fold-node (lambda (is acc) (let ((bits (iset-bits is))) (+ acc (if bits (bit-count bits) (+ 1 (- (iset-end is) (iset-start is))))))) 0 iset))
false
b532c101fd7e2cdd8c2d115f0d7b5e0cdab2678e
9b2eb10c34176f47f7f490a4ce8412b7dd42cce7
/lib/yuni/miniobj/minitype.sls
37230c14ec4a9ffb478bce250578a93241cb4d11
[ "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
2,624
sls
minitype.sls
(library (yuni miniobj minitype) (export miniobj-minitype-ref miniobj-minitype-set! miniobj-minitype-typeof miniobj-minitype-typeof-error define-minitype make-minitype make-minitype-obj minitype-predicate minitype-typeof) (import (yuni scheme) (yuni compat simple-struct)) (define (check? obj sym) (and (simple-struct? obj) (eq? sym (simple-struct-name obj)))) (define (minitype? obj) (check? obj '*yuni-minitype*)) (define (minitype-obj? obj) (check? obj '*yuni-minitype-obj*)) (define (check-minitype obj) (or (minitype? obj) (error "minitype needed" obj))) (define (check-minitype-obj obj) (or (minitype-obj? obj) (error "minitype-obj needed" obj))) (define (minitype-slot obj) (check-minitype obj) (simple-struct-ref obj 1)) (define (minitype-obj-slot obj) (check-minitype-obj obj) (simple-struct-ref obj 1)) (define (minitype-obj-type obj) (check-minitype-obj obj) (simple-struct-ref obj 0)) (define (make-minitype name slots) (make-simple-struct '*yuni-minitype* 2 (list name slots))) (define (make-minitype-obj minitype) (check-minitype minitype) (lambda () (make-simple-struct '*yuni-minitype-obj* 2 (list minitype (make-vector (length (minitype-slot minitype))))))) (define (minitype-predicate obj minitype) (check-minitype minitype) (and (minitype-obj? obj) (eq? minitype (minitype-obj-type obj)))) (define (minitype-typeof obj) (and (minitype-obj? obj) (minitype-obj-type obj))) (define (scan-slot minitype slot) (define (number cur rest) (if (pair? rest) (if (eq? (car rest) slot) cur (number (+ 1 cur) (cdr rest))) #f)) (let ((slots (minitype-slot minitype))) (number 0 slots))) (define (miniobj-minitype-typeof obj k) (if (minitype-obj? obj) (minitype-obj-type obj) (k obj))) (define (miniobj-minitype-typeof-error obj) (error "unsupported object" obj)) (define (miniobj-minitype-ref obj slot k) (if (minitype-obj? obj) (vector-ref (minitype-obj-slot obj) (scan-slot (minitype-obj-type obj) slot)) (k obj slot))) (define (miniobj-minitype-set! obj slot value k) (if (minitype-obj? obj) (vector-set! (minitype-obj-slot obj) (scan-slot (minitype-obj-type obj) slot) value) (k obj slot value))) (define-syntax define-minitype (syntax-rules () ((_ name spec) (define name (make-minitype 'name 'spec))))) )
true
84278fc89278767ea5e90467ae9df9899fa08dd4
4f30ba37cfe5ec9f5defe52a29e879cf92f183ee
/src/scheme/transforms/internal-defines.scm
fbdf2d776b09176fe72945fe2c98a20dbe8c66db
[ "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,835
scm
internal-defines.scm
;; scheme/transforms/internal-defines.scm ;; A translation pass that turns internal definitions in lambda expressions into ;; letrec expressions. (need scheme/base-syntax) (define (rewrite-defines code) (define (iter input defines code) (if (null? input) (cond ((null? defines) (map rewrite-defines (reverse code))) (else `((letrec ,(map list (map define-symbol defines) (map rewrite-defines (map define-code defines))) ,@(map rewrite-defines (reverse code)))))) (let ((expr (car input))) (if (and (pair? expr) (eqv? 'define (car expr))) (iter (cdr input) (cons expr defines) code) (iter (cdr input) defines (cons expr code)))))) (if (not (pair? code)) code (case (car code) ((quote) code) ((define) `(define ,(define-symbol code) ,(rewrite-defines (define-code code)))) ((if) `(if ,(rewrite-defines (if-predicate code)) ,(rewrite-defines (if-consequent code)) ,(rewrite-defines (if-antecedent code)))) ((begin) `(begin ,@(map rewrite-defines (begin-sequence code)))) ((set!) `(set! ,(set!-symbol code) ,(rewrite-defines (set!-code code)))) ((letrec) `(letrec ,(map (lambda (var init) (list var (rewrite-defines init))) (letrec-vars code) (letrec-exps code)) ,@(iter (letrec-body code) '() '()))) ((lambda) `(lambda ,(lambda-args code) ,@(iter (lambda-code code) '() '()))) (else (map rewrite-defines code)))))
false
f9350474a8678d01f77d2611f3138bd28f2270e0
2d868c9428b8f4772d2ede375a3492b3b6885e1d
/Streams, Part 1/lecturepart3.scm
c30f45212588e9b55806d4f1c803dbb547c3e242
[]
no_license
transducer/sicp
2428223945da87836fa2a82c02d965061717ae95
2cec377aa7805edfd7760c643c14127e344ee962
refs/heads/master
2021-06-06T20:06:47.156461
2016-09-16T22:05:02
2016-09-16T22:05:02
25,219,798
1
0
null
null
null
null
UTF-8
Scheme
false
false
6,747
scm
lecturepart3.scm
#lang scheme ; You should be starting to get suspicious. This simple elegant way is very unlike the ; traditional programs that mix up the iterator, accumulator and filter. And by mixing it up ; we don't have all these wonderful components. ; Why do all programs look like these ugly ones? ; Do computer scientists not notice? Why don't they write programs with such elegance? ; There's got to be a catch. ; It's easy to see. Here's an example. ;;; find the second prime between ;;; 10.000 and 1.000.000 (head ; head of tail is second element (tail (filter prime? (enum-interval 10000 1000000)))) ; INTERVAL 10,000, 1,000,000 -> FILTER PRIME? -> ; That is pretty ridiculous. See we don't have enough space in the machine to store all the ; integers let alone check for prime and get only the second one. ; The power of the traditional style is exactly its weakness. We don't do it all. But the ; thing that makes it conceptually ugly is the thing that makes it efficient. ; Why did I show this wonderfully way in which programming might work instead of it doesn't? ; Here is the wonderfulness. We can really have our cake and eat it too. What I mean by that ; is that we can really write stream programs just like I wrote and it can run as efficient ; as the general programming style that mixes up the generating and the test. ; The key is that streams are NOT lists. ; There is tugging on the box of the filter who is tugging on the box of the integers. ; No other computation gets done unless you tug on it. ; How do we make such a stream? ; We want to arrange for a stream to be a data structure that sorts of computes itself ; incrementally. Sort of an on-demand data structure. ; The basic idea is that there's not a firm distinction between programs and data. It is ; simultaneously a data structure and a procedure that has the method of computing it. CONS-STREAM HEAD TAIL ; you can think about it like it's CONS, CAR or CDR but it is not. Let's look at what it is. (cons-stream x y) ; abbreviation for (cons x (delay y)) (head s) -> (car s) (tail s) -> (force (cdr s)) ; Let me explain delay and force ; What delay does is take an expression and produce a PROMISE that you will get the value ; if you ask for it. It does not do any computation. ; And cons-stream puts together x and a promise to compute y. ; The tail is going to be FORCE calling the promise. ; Force says take that promise and compute it. (head (tail (filter prime? (e-l 10000 1000000)))) ; (cons 10000 ; (delay (e-l 10001 1000000))) ; (filter prime? ; (cons (cons 10000 (delay (e-l 10001 1000000)))) ; force-^ ; (e-l 10001 10000) ; (cons 10000) delay ; (e-l 10002 1000000 ; (...) ; (cons 10009 (delay (filter prime? .... ; We can use substitutation model since we do not have state. ; No more gets generated then you actually need. No more will be generated by e-l than the ; filter asks for, and no more will be asked of the filter than the head of the tail. ; You see we put that mixing of generating and test in another way than it is happening ; in the computer. (delay <exp>) abbreviation for (lambda () <exp>) (force p) = (p) ; just run it ; What have we done: ; The old style of programming is more efficient, and the stream thing is more perspicuous ; and we managed to make the stream thing run like the other procedures by using delay. ; And what delay does is decouple the apparent order of events in our programs from the ; actual order of events in the machine. ; We have given up the idea that procedures as we look at them mirror some clear notion of ; time. By giving that up we give delay the freedom to arrange the order of events in the ; computation the way it likes. ; There's one more detail... ; As you run through this recursive programs unwinding you see a lot of things like: (tail (tail (tail .... ))) ; If each time I am doing that I have to evaluate a procedure that then has to recompute ; its own tail who recomputes its own tail et cetera you see that is very inefficient. ; There's one little hack to slightly change the abbreviation and make delay a thing. (delay <exp>) } (memo-proc abbreviation for (lambda () <exp>)) ; memo-proc is something that makes delay only have to do its calculation once. ; You give it a procedure and the result of memo-proc will be that the first time you call ; it it will run the original procedure, remember what result it got and for every run after ; it it will have cached that result some place. (define (memo-proc proc) ; memo-proc transform a procedure of no arguments (let ((already-run? nil) ; Two little flags, both null: Have I already run? (result nil)) ; And what was the result the last time I run? (lambda () ; It returns a new procedure of no arguments. (if (not already-run?) ; If I have not already run (sequence ; I am going to do a sequence of things: (set! result (proc)) ; I am going to compute proc and save that in result (set! already-run? (not nil)); and I make a note to myself that I have run result) ; and I return the result. result)))) ; If I have already run I just return the result. ; That's a little hack that's called memoization. This case it short-circuits having to ; recompute the tail of the tail of the tail. ; This makes streams run with the same efficiency as the other programs precisely. ; The fact that there is no clear dividing line between data and procedures has allowed us ; to write data structures that are like procedures. What we did is take an example of ; a common control structure, in this case iteration, and we built a data structure that ; acts like a procedure and therefore has this control structure in it. ; That is what streams are. ; Questions: ; Does memoization not only work if the result is always the same? ; => Yeah, sure. Once I found the tail of the tail I should not have to recompute the tail. ; We are able to ues the substitution model because there are no side effects. What if we ; have a procedure that has side effects? Could we practically use the stream model? ; => Maybe, that's a hard question. Substitution and side effects don't mix very well. ; In general any amount of side effects is going to mess up everything.
false
588478713dc43de93a3837f17cc5da7c41d4a3b3
6b288a71553cf3d8701fe7179701d100c656a53c
/unicode/unicode-data.ss
dd77e0fe1fb385a958f1bc23619d8cf46bb19b8a
[ "Apache-2.0" ]
permissive
cisco/ChezScheme
03e2edb655f8f686630f31ba2574f47f29853b6f
c048ad8423791de4bf650fca00519d5c2059d66e
refs/heads/main
2023-08-26T16:11:15.338552
2023-08-25T14:17:54
2023-08-25T14:17:54
56,263,501
7,763
1,410
Apache-2.0
2023-08-28T22:45:52
2016-04-14T19:10:25
Scheme
UTF-8
Scheme
false
false
2,882
ss
unicode-data.ss
;;; Ikarus Scheme -- A compiler for R6RS Scheme. ;;; Copyright (C) 2006,2007,2008 Abdulaziz Ghuloum ;;; 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. (library (unicode-data) (export get-unicode-data) (import (rnrs)) (define (find-semi/hash str i n) (cond [(or (fx=? i n) (memv (string-ref str i) '(#\; #\#))) i] [else (find-semi/hash str (+ i 1) n)])) (define (cleanup str) (let ([lo (let f ([i 0] [n (string-length str)]) (cond [(= i n) n] [(char=? #\space (string-ref str i)) (f (+ i 1) n)] [else i]))] [hi (let f ([i (- (string-length str) 1)]) (cond [(< i 0) i] [(char=? #\space (string-ref str i)) (f (- i 1))] [else (+ i 1)]))]) (if (> hi lo) (substring str lo hi) ""))) (define (split str) (let f ([i 0] [n (string-length str)]) (cond [(or (= i n) (memv (string-ref str i) '(#\#))) '("")] [else (let ([j (find-semi/hash str i n)]) (cond [(or (= j n) (memv (string-ref str i) '(#\#))) (list (cleanup (substring str i j)))] [else (cons (cleanup (substring str i j)) (f (+ j 1) n))]))]))) (define (extract-uni-data) (let f ([ls '()]) (let ([line (get-line (current-input-port))]) (cond [(eof-object? line) (reverse ls)] [else (let ([fields (split line)]) (if (or (null? fields) (equal? fields '(""))) (f ls) (f (cons fields ls))))])))) (define (get-unicode-data filename) (with-input-from-file filename extract-uni-data)))
false
e422008e7fbc965d8e27b3c97c39c0c746d715b1
b62560d3387ed544da2bbe9b011ec5cd6403d440
/crates/steel-core/src/tests/success/set_tail_call.scm
b6d2dfdcca33cf98d97b09d3b8634ea2bf72faf1
[ "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
136
scm
set_tail_call.scm
(define (test x) (set! test (lambda (x) 100)) (if (= x 10) x (test (+ x 1)))) (assert! (equal? (test 0) 100))
false
a9accdb99f3a5049daff1f7634b279b2660b808e
defeada37d39bca09ef76f66f38683754c0a6aa0
/mscorlib/system/value-type.sls
14fd60e54efb07567dc69a9c7c82bb71dcb5def5
[]
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
514
sls
value-type.sls
(library (system value-type) (export is? value-type? get-hash-code to-string equals?) (import (ironscheme-clr-port)) (define (is? a) (clr-is System.ValueType a)) (define (value-type? a) (clr-is System.ValueType a)) (define-method-port get-hash-code System.ValueType GetHashCode (System.Int32)) (define-method-port to-string System.ValueType ToString (System.String)) (define-method-port equals? System.ValueType Equals (System.Boolean System.Object)))
false
056c89c768e4180754a117bfd9b5625790dc52c7
fb9a1b8f80516373ac709e2328dd50621b18aa1a
/ch3/exercise3-57.scm
e1f00a3a4a5b089e2d6507d9973d0fc4e894a0e6
[]
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
872
scm
exercise3-57.scm
;; 問題3.57 ;; n 番目のfibsを計算するときの加算の実行回数を示せ ;; メモ化してあれば,n番目を計算するのに,n-1番目に1回足すだけ.n回で済む ;; メモ化なしだと,ストリームを作るたびに計算しなおすので大量に計算する必要がある. (define-macro (delay x) `(lambda () ,x)) (define (force x) (x)) (load "./ch3/3-5-2_Infinite_Streams.scm") (define count 0) (define (reset) (set! count 0)) (define (add x y) (begin (set! count (+ count 1)) (+ x y))) (define (add-streams s1 s2) (stream-map add s1 s2)) (define fibs (cons-stream 0 (cons-stream 1 (add-streams (stream-cdr fibs) fibs)))) (define (show-fib n) (reset) (print (stream-ref fibs n)) (print count) 'done) (show-fib 10)
false
3de13d3986ddd317eeeda15ea9c7fa1692ffa2ce
ec5b4a92882f80b3f62eac8cbd059fb1f000cfd9
/functional/scheme/counter.ss
67a8dfde27c68dbd38440e283e5fda41f14abce1
[]
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
6,663
ss
counter.ss
;;; ;;; counter. interpreter that counts each of the primitive operations ;;; (define count (lambda (definitions call) ((lambda (x) '(pretty-print x) (eval x)) `(let ([counts (make-vector 10 0)]) (let ([inc (lambda (i) (vector-set! counts i (+ 1 (vector-ref counts i))))]) (let ([eq? (lambda (x y) (inc 1) (eq? x y))] [< (lambda (x y) (inc 1) (< x y))] [car (lambda (x) (inc 2) (car x))] [cdr (lambda (x) (inc 3) (cdr x))] [cons (lambda (x y) (inc 5) (cons x y))] [null? (lambda (x) (inc 8) (null? x))]) ,@(map make-counter definitions) ,call (#%cons '+ (reverse (map (lambda (n name) (list '* n name)) (vector->list counts) '(cost_binding cost_booleanop cost_car cost_cdr cost_cond cost_cons cost_constant cost_funcall cost_null cost_varref)))))))))) (define make-counter (lambda (exp) (cond [(symbol? exp) `(begin (inc 9) ,exp)] [(null? exp) `(begin (inc 6) ,exp)] [(number? exp) `(begin (inc 6) ,exp)] [(boolean? exp) `(begin (inc 6) ,exp)] [(atom? exp) (error 'count "unknown type: ~s" exp)] [(eq? (car exp) 'lambda) `(lambda ,(cadr exp) . ,(map make-counter (cddr exp)))] [(eq? (car exp) 'define) `(define ,(cadr exp) ,(make-counter (caddr exp)))] [(eq? (car exp) 'quote) `(begin (inc 6) ,exp)] [(eq? (car exp) 'if) `(begin (inc 4) (if ,(make-counter (cadr exp)) ,(make-counter (caddr exp)) ,(make-counter (cadddr exp))))] [(eq? (car exp) 'let) `(let ((,(caaadr exp) ,(make-counter (car (cdaadr exp))))) (inc 0) . ,(map make-counter (cddr exp)))] [(memq (car exp) '(eq? car cdr cons null? <)) `(,(car exp) . ,(map make-counter (cdr exp)))] [else `(begin (inc 7) (,(car exp) . ,(map make-counter (cdr exp))))]))) (define iota (letrec ([iota (lambda (n answ) (if (zero? n) answ (iota (- n 1) (cons (- n 1) answ))))]) (lambda (n) (iota n '())))) ;;;; ;;;; test cases ;;;; (define lists (vector (make-list 10 -1) (make-list 20 -1) (make-list 50 -1) (make-list 100 -1) (make-list 200 -1) (make-list 300 -1) (make-list 500 -1) (make-list 1000 -1) (make-list 2000 -1))) (define iotas (vector (reverse (iota 10)) (reverse (iota 20)) (reverse (iota 50)) (reverse (iota 100)) (reverse (iota 200)) (reverse (iota 300)) (reverse (iota 500)) (reverse (iota 1000)) (reverse (iota 2000)))) (define sizes '(10 20 50 100 200 300 500 1000 2000)) (define procedures (list ;;;; ;;;; insertion sort ;;;; (list 'insertsort '(iotas) '(define insertsort (lambda (lst) (if (null? lst) '() (insert (car lst) (insertsort (cdr lst)))))) '(define insert (lambda (a lst) (if (null? lst) (cons a '()) (if (< a (car lst)) (cons a lst) (cons (car lst) (insert a (cdr lst)))))))) ;;;; ;;;; union ;;;; (list 'union '(lists iotas) '(define union (lambda (l1 l2) (if (null? l1) l2 (let ([rr (union (cdr l1) l2)]) (if (member? (car l1) l2) rr (cons (car l1) rr)))))) '(define member? (lambda (a l) (if (null? l) #f (if (eq? (car l) a) #t (member? a (cdr l))))))) ;;;; ;;;; reverse ;;;; (list 'reverse '(lists) '(define reverse (lambda (ls) (reverse2 ls '()))) '(define reverse2 (lambda (ls answ) (if (null? ls) answ (reverse2 (cdr ls) (cons (car ls) answ)))))) ;;;; ;;;; nontail-reverse ;;;; (list 'nreverse '(lists) '(define nreverse (lambda (ls) (if (null? ls) '() (append (nreverse (cdr ls)) (cons (car ls) '()))))) '(define append (lambda (l1 l2) (if (null? l1) l2 (cons (car l1) (append (cdr l1) l2)))))) ;;;; ;;;; product ;;;; (list 'product '(lists iotas) '(define product (lambda (set1 set2) (if (null? set1) '() (append (pair (car set1) set2) (product (cdr set1) set2))))) '(define pair (lambda (item set) (if (null? set) '() (cons (cons item (cons (car set) '())) (pair item (cdr set)))))) '(define append (lambda (l1 l2) (if (null? l1) l2 (cons (car l1) (append (cdr l1) l2)))))) ;;;; ;;;; select sort ;;;; (list 'selectsort '(iotas) '(define selectsort (lambda (x) (if (null? x) '() (let ([k (least x)]) (cons k (selectsort (rest x k))))))) '(define least (lambda (x) (if (null? (cdr x)) (car x) (let ([s (least (cdr x))]) (if (< (car x) s) (car x) s))))) '(define rest (lambda (x k) (if (null? (cdr x)) '() (if (= k (car x)) (cdr x) (cons (car x) (rest (cdr x) k))))))) ;;;; ;;;; merge sort ;;;; (list 'mergesort '(iotas) '(define mergesort (lambda (x) (if (null? x) '() (if (null? (cdr x)) (cons (car x) '()) (merge (mergesort (odd x)) (mergesort (even x))))))) '(define odd (lambda (x) (if (null? x) '() (cons (car x) (even (cdr x)))))) '(define even (lambda (x) (if (null? x) '() (odd (cdr x))))) '(define merge (lambda (x y) (if (null? x) y (if (null? y) x (if (< (car x) (car y)) (cons (car x) (merge (cdr x) y)) (cons (car y) (merge x (cdr y))))))))) ;;;; ;;;; quicksort ;;;; (list 'quicksort '(iotas) '(define quicksort (lambda (ls) (qsort ls '()))) '(define qsort (lambda (ls rest) (if (null? ls) rest (let ([pivot (car ls)]) (let ([ls (cdr ls)]) (qsort (less pivot ls) (cons pivot (qsort (more pivot ls) rest)))))))) '(define less (lambda (pivot ls) (if (null? ls) '() (let ([rr (less pivot (cdr ls))]) (let ([item (car ls)]) (if (< pivot item) rr (cons item rr))))))) '(define more (lambda (pivot ls) (if (null? ls) '() (let ([rr (more pivot (cdr ls))]) (let ([item (car ls)]) (if (< pivot item) (cons item rr) rr))))))))) (do ([procs procedures (cdr procs)]) [(null? procs)] (do ([sizes sizes (cdr sizes)] [i 0 (+ i 1)]) [(null? sizes)] (printf "~n(~a ~a)~n" (caar procs) (car sizes)) (pretty-print (count (cddar procs) `(,(caar procs) . ,(map (lambda (x) `(vector-ref ,x ,i)) (cadar procs)))))))
false
bbc1c7a91f9c4df7d96cfcd89c97d3a66cee17cd
ae4938300d7eea07cbcb32ea4a7b0ead9ac18e82
/utils/parameter.ss
ee20c6ecfaa16b8afb14810cf549600bed05e2c9
[]
no_license
keenbug/imi-libs
05eb294190be6f612d5020d510e194392e268421
b78a238f03f31e10420ea27c3ea67c077ea951bc
refs/heads/master
2021-01-01T19:19:45.036035
2012-03-04T21:46:28
2012-03-04T21:46:28
1,900,111
0
1
null
null
null
null
UTF-8
Scheme
false
false
297
ss
parameter.ss
#!r6rs (library (imi utils parameter) (export make-parameter) (import (rnrs)) (define make-parameter (case-lambda ((x) (make-parameter x (lambda (n) n))) ((x test) (let ([v x]) (case-lambda (() v) ((n) (set! v (test n)))))))) )
false
17a905e7e6f4c46780dcc19f6f40874d3b64b51a
492b4d445abfe46847f81ae9fcac0d4eb94b3194
/package.scm
20500f825487efc2662a0c6b35cbc86b1733a4cc
[]
no_license
cyclone-scheme/cloudburst
cf4a5a3e869768a07016d9de6726505c985cd05e
6f18af7a38ad9b17136bad8142d9abc8b556a64a
refs/heads/master
2023-02-25T03:26:01.928363
2021-01-25T23:43:12
2021-01-25T23:43:12
309,513,111
0
0
null
null
null
null
UTF-8
Scheme
false
false
543
scm
package.scm
(package (name cloudburst) (version 0.1) (license "MIT") (authors "Justin Ethier") (maintainers "Justin Ethier <justin.ethier at gmail dot com>") (description "The Cloudburst web framework") (tags "web" "networking") (docs "https://github.com/cyclone-scheme/cloudburst/wiki/sha2") ;(test "test-sha2.scm") (dependencies (postgresql srfi-152 syslog temple)) (program (name cloudburst) (description "Front-end program to make it easier to use Cloudburst")) )
false
b7befc6dc0e7817afd717827cfc72318d8c46b7e
6b961ef37ff7018c8449d3fa05c04ffbda56582b
/bbn_cl/mach/zcomp/machines/butterfly/rules2.scm
54cd4ed42dda10992066439baa1cbe67bc5b9c5c
[]
no_license
tinysun212/bbn_cl
7589c5ac901fbec1b8a13f2bd60510b4b8a20263
89d88095fc2a71254e04e57cf499ae86abf98898
refs/heads/master
2021-01-10T02:35:18.357279
2015-05-26T02:44:00
2015-05-26T02:44:00
36,267,589
4
3
null
null
null
null
UTF-8
Scheme
false
false
7,231
scm
rules2.scm
#| -*-Scheme-*- $Header: rules2.scm,v 1.2 88/08/31 10:46:13 jinx Exp $ $MIT-Header: rules2.scm,v 4.2 87/12/31 10:26:18 GMT cph Exp $ Copyright (c) 1987 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and Computer Science. Permission to copy this software, to redistribute it, and to use it for any purpose is granted, subject to the following restrictions and understandings. 1. Any copy made of this software must include this copyright notice in full. 2. Users of this software agree to make their best efforts (a) to return to the MIT Scheme project any improvements or extensions that they make, so that these may be included in future releases; and (b) to inform MIT of noteworthy uses of this software. 3. All materials developed as a consequence of the use of this software shall duly acknowledge such use, in accordance with the usual standards of acknowledging credit in academic research. 4. MIT has made no warrantee or representation that the operation of this software will be error-free, and MIT is under no obligation to provide any services, by way of maintenance, update, or otherwise. 5. In conjunction with products arising from the use of this material, there shall be no use of the name of the Massachusetts Institute of Technology nor of any adaptation thereof in any advertising, promotional, or sales literature without prior written consent from MIT in each case. |# ;;;; LAP Generation Rules: Predicates (declare (usual-integrations)) ;;;; Predicates (define-rule predicate (TRUE-TEST (REGISTER (? register))) (set-standard-branches! 'NE) (LAP ,(test-non-pointer (ucode-type false) 0 (coerce->any register)))) (define-rule predicate (TRUE-TEST (OFFSET (REGISTER (? register)) (? offset))) (set-standard-branches! 'NE) (LAP ,(test-non-pointer (ucode-type false) 0 (indirect-reference! register offset)))) (define-rule predicate (TYPE-TEST (REGISTER (? register)) (? type)) (QUALIFIER (pseudo-register? register)) (set-standard-branches! 'EQ) (LAP ,(test-byte type (register-reference (load-alias-register! register 'DATA))))) (define-rule predicate (TYPE-TEST (OBJECT->TYPE (REGISTER (? register))) (? type)) (QUALIFIER (pseudo-register? register)) (set-standard-branches! 'EQ) (let ((reference (move-to-temporary-register! register 'DATA))) (LAP (RO L L (& 8) ,reference) ,(test-byte type reference)))) (define-rule predicate (TYPE-TEST (OBJECT->TYPE (OFFSET (REGISTER (? register)) (? offset))) (? type)) (set-standard-branches! 'EQ) (LAP ,(test-byte type (indirect-reference! register offset)))) (define-rule predicate (UNASSIGNED-TEST (REGISTER (? register))) (set-standard-branches! 'EQ) (LAP ,(test-non-pointer (ucode-type unassigned) 0 (coerce->any register)))) (define-rule predicate (UNASSIGNED-TEST (OFFSET (REGISTER (? register)) (? offset))) (set-standard-branches! 'EQ) (LAP ,(test-non-pointer (ucode-type unassigned) 0 (indirect-reference! register offset)))) (define (eq-test/constant*register constant register) (set-standard-branches! 'EQ) (if (non-pointer-object? constant) (LAP ,(test-non-pointer (primitive-type constant) (primitive-datum constant) (coerce->any register))) (LAP (CMP L (@PCR ,(constant->label constant)) ,(coerce->machine-register register))))) (define (eq-test/constant*memory constant memory-reference) (set-standard-branches! 'EQ) (if (non-pointer-object? constant) (LAP ,(test-non-pointer (primitive-type constant) (primitive-datum constant) memory-reference)) (let ((temp (reference-temporary-register! false))) (LAP (MOV L ,memory-reference ,temp) (CMP L (@PCR ,(constant->label constant)) ,temp))))) (define (eq-test/register*register register-1 register-2) (set-standard-branches! 'EQ) (let ((finish (lambda (register-1 register-2) (LAP (CMP L ,(coerce->any register-2) ,(coerce->machine-register register-1)))))) (if (or (and (not (register-has-alias? register-1 'DATA)) (register-has-alias? register-2 'DATA)) (and (not (register-has-alias? register-1 'ADDRESS)) (register-has-alias? register-2 'ADDRESS))) (finish register-2 register-1) (finish register-1 register-2)))) (define (eq-test/register*memory register memory-reference) (set-standard-branches! 'EQ) (LAP (CMP L ,memory-reference ,(coerce->machine-register register)))) (define (eq-test/memory*memory register-1 offset-1 register-2 offset-2) (set-standard-branches! 'EQ) (let ((temp (reference-temporary-register! false))) (let ((finish (lambda (register-1 offset-1 register-2 offset-2) (LAP (MOV L ,(indirect-reference! register-1 offset-1) ,temp) (CMP L ,(indirect-reference! register-2 offset-2) ,temp))))) (if (or (and (not (register-has-alias? register-1 'ADDRESS)) (register-has-alias? register-2 'ADDRESS)) (and (not (register-has-alias? register-1 'DATA)) (register-has-alias? register-2 'DATA))) (finish register-2 offset-2 register-1 offset-1) (finish register-1 offset-1 register-2 offset-2))))) (define-rule predicate (EQ-TEST (REGISTER (? register)) (CONSTANT (? constant))) (eq-test/constant*register constant register)) (define-rule predicate (EQ-TEST (CONSTANT (? constant)) (REGISTER (? register))) (eq-test/constant*register constant register)) (define-rule predicate (EQ-TEST (OFFSET (REGISTER (? register)) (? offset)) (CONSTANT (? constant))) (eq-test/constant*memory constant (indirect-reference! register offset))) (define-rule predicate (EQ-TEST (CONSTANT (? constant)) (OFFSET (REGISTER (? register)) (? offset))) (eq-test/constant*memory constant (indirect-reference! register offset))) (define-rule predicate (EQ-TEST (CONSTANT (? constant)) (POST-INCREMENT (REGISTER 15) 1)) (eq-test/constant*memory constant (INST-EA (@A+ 7)))) (define-rule predicate (EQ-TEST (POST-INCREMENT (REGISTER 15) 1) (CONSTANT (? constant))) (eq-test/constant*memory constant (INST-EA (@A+ 7)))) (define-rule predicate (EQ-TEST (REGISTER (? register-1)) (REGISTER (? register-2))) (eq-test/register*register register-1 register-2)) (define-rule predicate (EQ-TEST (OFFSET (REGISTER (? register-1)) (? offset-1)) (REGISTER (? register-2))) (eq-test/register*memory register-2 (indirect-reference! register-1 offset-1))) (define-rule predicate (EQ-TEST (REGISTER (? register-1)) (OFFSET (REGISTER (? register-2)) (? offset-2))) (eq-test/register*memory register-1 (indirect-reference! register-2 offset-2))) (define-rule predicate (EQ-TEST (POST-INCREMENT (REGISTER 15) 1) (REGISTER (? register))) (eq-test/register*memory register (INST-EA (@A+ 7)))) (define-rule predicate (EQ-TEST (REGISTER (? register)) (POST-INCREMENT (REGISTER 15) 1)) (eq-test/register*memory register (INST-EA (@A+ 7)))) (define-rule predicate (EQ-TEST (OFFSET (REGISTER (? register-1)) (? offset-1)) (OFFSET (REGISTER (? register-2)) (? offset-2))) (eq-test/memory*memory register-1 offset-1 register-2 offset-2))
false
8397b4edc28a181e48d53e0bffe5f59eb21565f2
defeada37d39bca09ef76f66f38683754c0a6aa0
/mscorlib/system/security/principal/generic-identity.sls
86fb3f98b2fc9a4d787dc79e2a0a4ac9643853fe
[]
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
989
sls
generic-identity.sls
(library (system security principal generic-identity) (export new is? generic-identity? authentication-type name is-authenticated?) (import (ironscheme-clr-port)) (define-syntax new (lambda (e) (syntax-case e () ((_ a ...) #'(clr-new System.Security.Principal.GenericIdentity a ...))))) (define (is? a) (clr-is System.Security.Principal.GenericIdentity a)) (define (generic-identity? a) (clr-is System.Security.Principal.GenericIdentity a)) (define-field-port authentication-type #f #f (property:) System.Security.Principal.GenericIdentity AuthenticationType System.String) (define-field-port name #f #f (property:) System.Security.Principal.GenericIdentity Name System.String) (define-field-port is-authenticated? #f #f (property:) System.Security.Principal.GenericIdentity IsAuthenticated System.Boolean))
true
928d66492bf632fbc4bf2d3c099a16780754b9dd
defeada37d39bca09ef76f66f38683754c0a6aa0
/mscorlib/system/security/security-exception.sls
d967b72ec4ce44bafa46c572b696a118eda570d1
[]
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
4,418
sls
security-exception.sls
(library (system security security-exception) (export new is? security-exception? get-object-data to-string action-get action-set! action-update! deny-set-instance-get deny-set-instance-set! deny-set-instance-update! failed-assembly-info-get failed-assembly-info-set! failed-assembly-info-update! method-get method-set! method-update! permit-only-set-instance-get permit-only-set-instance-set! permit-only-set-instance-update! url-get url-set! url-update! zone-get zone-set! zone-update! demanded-get demanded-set! demanded-update! first-permission-that-failed-get first-permission-that-failed-set! first-permission-that-failed-update! permission-state-get permission-state-set! permission-state-update! permission-type-get permission-type-set! permission-type-update! granted-set-get granted-set-set! granted-set-update! refused-set-get refused-set-set! refused-set-update!) (import (ironscheme-clr-port)) (define-syntax new (lambda (e) (syntax-case e () ((_ a ...) #'(clr-new System.Security.SecurityException a ...))))) (define (is? a) (clr-is System.Security.SecurityException a)) (define (security-exception? a) (clr-is System.Security.SecurityException a)) (define-method-port get-object-data System.Security.SecurityException GetObjectData (System.Void System.Runtime.Serialization.SerializationInfo System.Runtime.Serialization.StreamingContext)) (define-method-port to-string System.Security.SecurityException ToString (System.String)) (define-field-port action-get action-set! action-update! (property:) System.Security.SecurityException Action System.Security.Permissions.SecurityAction) (define-field-port deny-set-instance-get deny-set-instance-set! deny-set-instance-update! (property:) System.Security.SecurityException DenySetInstance System.Object) (define-field-port failed-assembly-info-get failed-assembly-info-set! failed-assembly-info-update! (property:) System.Security.SecurityException FailedAssemblyInfo System.Reflection.AssemblyName) (define-field-port method-get method-set! method-update! (property:) System.Security.SecurityException Method System.Reflection.MethodInfo) (define-field-port permit-only-set-instance-get permit-only-set-instance-set! permit-only-set-instance-update! (property:) System.Security.SecurityException PermitOnlySetInstance System.Object) (define-field-port url-get url-set! url-update! (property:) System.Security.SecurityException Url System.String) (define-field-port zone-get zone-set! zone-update! (property:) System.Security.SecurityException Zone System.Security.SecurityZone) (define-field-port demanded-get demanded-set! demanded-update! (property:) System.Security.SecurityException Demanded System.Object) (define-field-port first-permission-that-failed-get first-permission-that-failed-set! first-permission-that-failed-update! (property:) System.Security.SecurityException FirstPermissionThatFailed System.Security.IPermission) (define-field-port permission-state-get permission-state-set! permission-state-update! (property:) System.Security.SecurityException PermissionState System.String) (define-field-port permission-type-get permission-type-set! permission-type-update! (property:) System.Security.SecurityException PermissionType System.Type) (define-field-port granted-set-get granted-set-set! granted-set-update! (property:) System.Security.SecurityException GrantedSet System.String) (define-field-port refused-set-get refused-set-set! refused-set-update! (property:) System.Security.SecurityException RefusedSet System.String))
true
46e9809e1c44e545e17d5572f29f1e735dcce948
8f1401b60f1a0b73577a80129ec7fe7027a27eba
/src/algebra/internal/commutative.scm
07676b387353ff9be059ea769dab7fbe40b37202
[ "Apache-2.0" ]
permissive
bluelight1324/geometric-algebra
347409d5ef023ab1109b4d6079ef1e73721ebc0b
fdc9332a4f5e2dd526c55bbaa57fd043d78f40d1
refs/heads/main
2023-04-18T08:41:57.832044
2021-05-05T20:08:21
2021-05-05T20:08:21
null
0
0
null
null
null
null
UTF-8
Scheme
false
false
2,483
scm
commutative.scm
(library (algebra internal commutative) (export add mul term? term->list term-id term-factor term-equiv collect-terms expand) (import (rnrs (6)) (format format) (utility yasos) (utility pmatch) (utility algorithms) (utility cut) (algebra rings)) (define-syntax pred-or (syntax-rules () ((_ a ...) (lambda (x) (or (a x) ...))))) (define-record-type tag) (define numeric-factor (make-tag)) (define (factor-id f) (cond ((symbol? f) f) ((number? f) numeric-factor))) (define (term? a) (or (symbol? a) (number? a) (pmatch a ((* . ,factors) (for-all (pred-or symbol? number?) factors)) (else #f)))) (define (term->list a) (pmatch a ((* . ,factors) factors) (,x `(,x)))) (define (symbol<? a b) (string<? (symbol->string a) (symbol->string b))) (define (term-id a) (list-sort symbol<? (filter symbol? (term->list a)))) (define (term-factor a) (apply * (filter number? (term->list a)))) (define (term-equiv a b) (equal? (term-id a) (term-id b))) (define (collect-terms lst) (let ((g (group-by term-id equal? lst))) (map (lambda (a) (mul (apply + (map term-factor (cdr a))) `(* ,@(car a)))) g))) (define (expand a) (pmatch a ((+ . ,k) (sum (collect-terms k))) ((* . ,k) (product (cons (term-factor a) (term-id a)))) (else a))) (define (mul a b) (pmatch (list a b) ((0 ,_) 0) ((,_ 0) 0) ((1 ,_) b) ((,_ 1) a) (((+ . ,k) ,_) (sum (map (cut mul <> b) k))) ((,_ (+ . ,l)) (sum (map (cut mul a <>) l))) (((* . ,k) (* . ,l)) `(* ,@k ,@l)) (((* . ,k) ,_) `(* ,@k ,b)) ((,_ (* . ,l)) `(* ,a ,@l)) ((,_ ,_) `(* ,a ,b)))) (define (add a b) (pmatch (list a b) ((0 ,_) b) ((,_ 0) a) (((+ . ,k) (+ . ,l)) `(+ ,@k ,@l)) (((+ . ,k) ,_) `(+ ,@k ,b)) ((,_ (+ . ,l)) `(+ ,a ,@l)) ((,_ ,_) `(+ ,a ,b)))) (define (sum lst) (if (null? lst) 0 (fold-left add (car lst) (cdr lst)))) (define (product lst) (if (null? lst) 1 (fold-left mul (car lst) (cdr lst)))) )
true
5efcb1d6e6f945c9990564a659ae1588018ba178
d8bdd07d7fff442a028ca9edbb4d66660621442d
/scam/tests/20-scam/unify/matchvector.scm
3ea9fe6526fd89155c544168528885b6ed000d2c
[]
no_license
xprime480/scam
0257dc2eae4aede8594b3a3adf0a109e230aae7d
a567d7a3a981979d929be53fce0a5fb5669ab294
refs/heads/master
2020-03-31T23:03:19.143250
2020-02-10T20:58:59
2020-02-10T20:58:59
152,641,151
0
0
null
null
null
null
UTF-8
Scheme
false
false
177
scm
matchvector.scm
(import (only (scam unify) match) (test narc)) (narc-label "Match Vector") (narc-expect ({ :name "Mike" :age 58 } (match #(:name :age) #("Mike" 58)))) (narc-report)
false
e4ffc454332c64e280cfe810035ac69285d20272
9cb1626e30c6ea40b11cd3715c03d0d5b88722de
/src/sake/extensions/core.scm
247ac3c3d4d2aef9859a8d679575be15572760be
[ "Zlib" ]
permissive
alvatar/sphere-core
fbc2a76ed6743cbe7be99ff0abf50a79e331bb55
09e07d8b881f6b0292a4292b8b9a30a4ab5798f7
refs/heads/master
2020-05-18T13:32:08.074184
2015-03-21T12:17:50
2015-03-21T12:17:50
976,512
9
0
null
2014-04-26T12:30:09
2010-10-10T15:43:10
Scheme
UTF-8
Scheme
false
false
36,819
scm
core.scm
;;; Copyright (c) 2012, Alvaro Castro-Castilla. All rights reserved. ;;; Utilities and procedures to be used within sakefiles (needs scheme-base installed) ;;! Generate a unique C file from a module or a file ;; Shouldn't be used directly, better use sake#compile-module ;; .argument version: generate module version with specific features (compiler options, cond-expand...) ;; .returns the path of the generated file (define (sake#compile-to-c module-or-file #!key (cond-expand-features '()) (compiler-options '()) (version compiler-options) (expander 'syntax-case) (output #f) (verbose #f)) (if (not (eq? 'syntax-case expander)) (err "The only supported expander is 'syntax-case")) (or (file-exists? (current-build-directory)) (make-directory (current-build-directory))) (let ((module (if (string? module-or-file) (err "Handling of module as file is unimplemented") module-or-file))) (%check-module module 'sake#compile-to-c) (let* ((header-module (%module-header module)) (macros-module (%module-macros module)) (version (if (null? version) (%module-version module) version)) (input-file (string-append (%sphere-path (%module-sphere module)) (default-source-directory) (%module-filename-scm module))) (intermediate-file (string-append (current-build-directory) "_%_" (%module-flat-name module) (default-scm-extension))) (output-file (or output (string-append (current-build-directory) (%module-filename-c module version: version))))) (info "compiling module to C -- " (%module-sphere module) ": " (%module-id module) (if (null? version) "" (string-append " version: " (object->string version)))) (let* ((generate-cond-expand-code (lambda (features) `((define-syntax syntax-rules-error (syntax-rules () ((_) (0)))) (define-syntax cond-expand (syntax-rules (and or not else ,@features) ((cond-expand) (syntax-rules-error "Unfulfilled cond-expand")) ((cond-expand (else body ...)) (begin body ...)) ((cond-expand ((and) body ...) more-clauses ...) (begin body ...)) ((cond-expand ((and req1 req2 ...) body ...) more-clauses ...) (cond-expand (req1 (cond-expand ((and req2 ...) body ...) more-clauses ...)) more-clauses ...)) ((cond-expand ((or) body ...) more-clauses ...) (cond-expand more-clauses ...)) ((cond-expand ((or req1 req2 ...) body ...) more-clauses ...) (cond-expand (req1 (begin body ...)) (else (cond-expand ((or req2 ...) body ...) more-clauses ...)))) ((cond-expand ((not req) body ...) more-clauses ...) (cond-expand (req (cond-expand more-clauses ...)) (else body ...))) ,@(map (lambda (cef) `((cond-expand (,cef body ...) more-clauses ...) (begin body ...))) features) ((cond-expand (feature-id body ...) more-clauses ...) (cond-expand more-clauses ...)))))))) (define filter-map (lambda (f l) (let recur ((l l)) (if (null? l) '() (let ((result (f (car l)))) (if result (cons result (recur (cdr l))) (recur (cdr l)))))))) (case expander ((riaxpander) (let ((compiling-without-riaxpander? (not (null? (%module-shallow-dependencies-to-prelude module))))) (let ((compilation-environment-code (if compiling-without-riaxpander? ;; No Riaxpander: no compilation environment '() ;; Riaxpander: Add cond-expand-code and import macros `(,@(generate-cond-expand-code (cons 'compile-to-c cond-expand-features)) ,@(map (lambda (m) `(##include-module-and-dependencies ',m ',(if verbose '(verbose) '()))) ;; Import shallow dependencies, as dependencies should already be expanded (append (%module-shallow-dependencies-to-include module) ;; (apply append (map %module-shallow-dependencies-to-include ;; (%module-shallow-dependencies-to-load module))) (if header-module (list header-module) '()) ;; (if macros-module (list macros-module) '()) )))))) (if verbose (if compiling-without-riaxpander? (info/color 'green "bypassing the Macro expander, as the module uses prelude") (info/color 'green "expanding macros with Riaxpander"))) (if (and (not compiling-without-riaxpander?) verbose) (begin (info/color 'light-green "compilation environment code:") (for-each pp compilation-environment-code))) ;; Eval compilation code in current environment ;; This has been removed in favor of running the code directly in the spawned GSC instance ;; (for-each eval compilation-environment-code) (let* ((input-code (with-input-from-file input-file read-all)) (intermediate-code (if compiling-without-riaxpander? ;; Without Riaxpander `(,@(map (lambda (f) `(define-cond-expand-feature ,f)) (cons 'compile-to-c cond-expand-features)) ,@(map (lambda (p) `(##include ,(string-append (%module-path-src p) (%module-filename-scm p)))) ;; Dependencies here are not deep, as they should be already compiled (%module-shallow-dependencies-to-prelude module)) ,@input-code) ;; With Riaxpander `( ;; Compile-time cond-expand-features ,@(map (lambda (f) `(define-cond-expand-feature ,f)) (cons 'compile-to-c cond-expand-features)) ;; If there is a header module set up proper namespace ,@(if header-module `((##namespace (,(%module-namespace module)))) '()) ,@(if header-module '((##include "~~lib/gambit#.scm")) '()) ;; Include custom compilation preludes defined in config.scm ,@(map (lambda (p) `(##include ,(string-append (%module-path-src p) (%module-filename-scm p)))) ;; Dependencies here are not deep, as they should be already compiled (%module-shallow-dependencies-to-prelude module)) ;; Include load dependencies' headers if they have ,@(filter-map (lambda (m) (let ((module-header (%module-header m))) (and module-header `(##include ,(string-append (%module-path-src module-header) (%module-filename-scm module-header)))))) ;; Dependencies here are not deep, as they should be already compiled (%module-shallow-dependencies-to-load module)) ;; Include header module if we have one ,@(if header-module `((##include ,(string-append (%module-path-src header-module) (%module-filename-scm header-module)))) '()) ,@input-code)))) ;; Verbose compilation (if verbose (begin (info/color 'light-green "code to be compiled:") (for-each pp intermediate-code))) ;; Write code in intermediate file (call-with-output-file intermediate-file (lambda (f) (for-each (lambda (expr) (pp expr f)) intermediate-code))) ;; Compile (or (zero? (gambit-eval-here `(,@compilation-environment-code (or (compile-file-to-target ,intermediate-file output: ,output-file options: ',compiler-options) (exit 1))) flags-string: (if compiling-without-riaxpander? "-f" ""))) (err "error compiling generated C file")))))) ((syntax-case) (let ((compilation-environment-code `(,@(generate-cond-expand-code (cons 'compile-to-c cond-expand-features)) ,@(map (lambda (m) `(##include-module-and-dependencies ',m ',(if verbose '(verbose) '()))) ;; Import shallow dependencies, as dependencies should already be expanded (append (%module-shallow-dependencies-to-include module) ;; (apply append (map %module-shallow-dependencies-to-include ;; (%module-shallow-dependencies-to-load module))) (if header-module (list header-module) '()) ;; (if macros-module (list macros-module) '()) ))))) (if verbose (begin (info/color 'light-green "compilation environment code:") (for-each pp compilation-environment-code))) ;; Eval compilation code in current environment ;; This has been removed in favor of running the code directly in the spawned GSC instance ;; (for-each eval compilation-environment-code) (let* ((input-code (with-input-from-file input-file read-all)) (intermediate-code `( ;; Compile-time cond-expand-features ,@(map (lambda (f) `(define-cond-expand-feature ,f)) (cons 'compile-to-c cond-expand-features)) ;; If there is a header module set up proper namespace ,@(if header-module `((##namespace (,(%module-namespace module)))) '()) ,@(if header-module '((##include "~~lib/gambit#.scm")) '()) ;; EXPAND custom compilation preludes defined in config.scm ,@(map (lambda (p) `(include ,(string-append (%module-path-src p) (%module-filename-scm p)))) ;; Dependencies here are not deep, as they should be already compiled (%module-shallow-dependencies-to-prelude module)) ;; Include load dependencies' headers if they have ,@(filter-map (lambda (m) (let ((module-header (%module-header m))) (and module-header `(##include ,(string-append (%module-path-src module-header) (%module-filename-scm module-header)))))) ;; Dependencies here are not deep, as they should be already compiled (%module-shallow-dependencies-to-load module)) ;; Include header module if we have one ,@(if header-module `((##include ,(string-append (%module-path-src header-module) (%module-filename-scm header-module)))) '()) ,@input-code))) ;; Verbose compilation (if verbose (begin (info/color 'light-green "code to be compiled:") (for-each pp intermediate-code))) ;; Write code in intermediate file (call-with-output-file intermediate-file (lambda (f) (for-each (lambda (expr) (pp expr f)) intermediate-code))) ;; Compile (if verbose (info/color 'light-green "syntax-case expansion:")) (or (zero? (gambit-eval-here `(,@compilation-environment-code (syntax-case-debug ,verbose) (or (compile-file-to-target ,intermediate-file output: ,output-file options: ',compiler-options) (exit 1))) flags-string: "")) (err "error compiling generated C file"))))) ((gambit) (err "Gambit expander workflow not implemented")) (else (err "Unknown expander")))) output-file))) ;;! Compile a C file generated by Gambit ;; Shouldn't be used directly, better use sake#compile-module (define (sake#compile-c-to-o c-file #!key (output (path-strip-extension c-file)) (env-options '()) (options '()) (cc-options "") (ld-options "") (delete-c #f) verbose) (if ((newer-than? output) c-file) (let* ((env-code (if (null? env-options) #!void (begin (map (lambda (e) `(setenv ,(car e) ,(cadr e))) env-options)))) (compile-code `(,@env-code (compile-file ,c-file options: ',options output: ,output cc-options: ,cc-options ld-options: ,ld-options)))) (info "compiling C file to o -- " c-file) (if verbose (begin (info/color 'green "Spawning a Gambit instance with this code: ") (pp compile-code))) (or (zero? (gambit-eval-here compile-code)) (err "error compiling C file")))) (if delete-c (delete-file c-file recursive: #t)) output) ;;! Compile to o in one step, through a C intermediary file (define (sake#compile-module module #!key (cond-expand-features '()) (compiler-options '()) (version compiler-options) (expander 'syntax-case) c-output-file o-output-file override-env-options override-cc-options override-ld-options verbose delete-c) (let ((scm-path (string-append (%module-path-src module) (%module-filename-scm module))) (default-path (string-append (%module-path-lib module) (%module-filename-c module))) (c-file #f)) (if (not ((newer-than? default-path) scm-path)) (set! c-file default-path) (set! c-file (sake#compile-to-c module cond-expand-features: cond-expand-features compiler-options: compiler-options version: version expander: expander output: c-output-file verbose: verbose))) (sake#compile-c-to-o c-file output: (or o-output-file (path-strip-extension c-file)) env-options: (or override-env-options (%module-shallow-dependencies-env-options module)) cc-options: (or override-cc-options (%process-cc-options (%module-shallow-dependencies-cc-options module))) ld-options: (or override-ld-options (%process-ld-options (%module-shallow-dependencies-ld-options module))) delete-c: delete-c verbose: verbose))) ;;! Compile to exe (define (sake#compile-to-exe exe-name modules #!key (version '()) (cond-expand-features '()) (compiler-options '()) override-cc-options override-ld-options (output (string-append (current-bin-directory) exe-name)) (strip #t) (verbose #f)) ;; Make sure work directories are ready (unless (file-exists? (current-build-directory)) (make-directory (current-build-directory))) (unless (file-exists? (current-bin-directory)) (make-directory (current-bin-directory))) (let ((cc-options (or override-cc-options (%process-cc-options (apply append (map %module-deep-dependencies-cc-options modules))))) (ld-options (or override-ld-options (%process-ld-options (apply append (map %module-deep-dependencies-ld-options modules)))))) (info "compiling modules to exe: ") (for-each (lambda (m) (info " * " (object->string m) " -> " (object->string (%module-normalize m)))) modules) (let ((c-files (apply append (map (lambda (m) (info "The following dependencies for \033[00;32m" (object->string (%module-normalize m)) "\033[00m will be linked:") (append (map (lambda (mdep) (info " * " (object->string mdep) "") ;; First try with the default path (let ((scm-path (string-append (%module-path-src mdep) (%module-filename-scm mdep))) (default-path (string-append (%module-path-lib mdep) (%module-filename-c mdep)))) (if (not ((newer-than? default-path) scm-path)) default-path (let ((local-path (string-append (current-build-directory) (%module-filename-c mdep)))) (if (not ((newer-than? local-path) scm-path)) local-path (begin (info "Compiling deferred dependency " (object->string (%module-normalize mdep))) (sake#compile-to-c mdep version: version cond-expand-features: cond-expand-features compiler-options: compiler-options verbose: verbose))))))) (%module-deep-dependencies-to-load m)) (list (sake#compile-to-c m version: version cond-expand-features: cond-expand-features compiler-options: compiler-options verbose: verbose)))) modules)))) (gambit-eval-here `((let* ((link-file (link-incremental ',c-files)) (gcc-cli (string-append ,(c-compiler) " " ,@(map (lambda (f) (string-append f " ")) c-files) " " link-file " -o" ,output " -I" (path-expand "~~include") " " ,cc-options " -L" (path-expand "~~lib") " -lgambc -lm -ldl -lutil " ,ld-options))) (if (not link-file) (err "error generating link file")) (if ,verbose (begin (pp link-file) (pp gcc-cli))) (shell-command gcc-cli) (if ,strip (shell-command ,(string-append "strip " output))) (delete-file link-file))) flags-string: "-f")))) ;;! Generate a flat link file (define (sake#link-flat link-file modules #!key (dir (current-build-directory)) (version '()) (verbose #f)) (info/color 'green (string-append "generating flat link file: " link-file)) (let* ((output-file (string-append dir link-file)) (code `((link-flat ',(map (lambda (m) (string-append dir (%module-filename-c m version: version))) modules) output: ,output-file warnings?: ,verbose)))) (if verbose (pp code)) (unless (= 0 (gambit-eval-here code)) (err "error generating Gambit flat link file")) output-file)) ;;! Generate an incremental link file (define (sake#link-incremental link-file modules #!key (dir (current-build-directory)) (version '()) (verbose #f)) (info/color 'green (string-append "generating an incremental link file: " link-file)) (let* ((output-file (string-append dir link-file)) (code `((link-incremental ',(map (lambda (m) (string-append dir (%module-filename-c m version: version))) modules) output: ,output-file warnings?: ,verbose)))) (if verbose (pp code)) (unless (= 0 (gambit-eval-here code)) (err "error generating Gambit incremental link file")) output-file)) ;;! Make a module that includes a set of modules (define (sake#generate-includer modules #!key (output "merged-modules.scm")) (let ((output-path (string-append (current-build-directory) output))) (call-with-output-file output-path (lambda (file) (display (apply string-append (map (lambda (m) (string-append "(include \"" (current-source-directory) (%module-filename-scm m) "\")\n")) modules)) file))) output-path)) ;;! Substitute (include <>) by the code in the referenced file ;; Merges the included files recursively, as S-expressions, but respects ;; the input-file as text, leaving the (define (sake#expand-includes input-file output-file) (define (do-expansion form) (map** (lambda (e) (if (and (pair? e) (eq? (car e) 'include)) (begin (current-directory (path-directory (path-expand (cadr e)))) (do-expansion `(begin ,@(with-input-from-file (path-strip-directory (cadr e)) read-all)))) e)) form)) (let* ((str-list (call-with-input-file input-file (lambda (f) (read-all f read-char)))) (str (list->string str-list)) (str-len (string-length str))) (with-output-to-file output-file (lambda () (for-each write-char (let recur ((i 0) (str-rest str-list)) (cond ((null? str-rest) '()) ((and (char=? (car str-rest) #\() (string=? "include " (substring str (+ i 1) (+ i 9)))) ; find include form (receive (continue-position filename) (let parse-filename ((j (+ i 9)) (chars '()) (status 'searching-first)) (case status ((searching-first) (if (and (char=? (string-ref str j) #\") (not (char=? (string-ref str (- j 1)) #\\))) ; make sure the " is not escaped (parse-filename (+ j 1) chars 'reading) (parse-filename (+ j 1) chars 'searching-first))) ((reading) (if (and (char=? (string-ref str j) #\") (not (char=? (string-ref str (- j 1)) #\\))) ; idem (parse-filename (+ j 1) chars 'search-next-parenthesis) (parse-filename (+ j 1) (cons (string-ref str j) chars) 'reading))) ((search-next-parenthesis) (if (char=? (string-ref str j) #\)) (values (+ j 1) (list->string (reverse chars))) (parse-filename (+ j 1) chars 'search-next-parenthesis))))) (append (parameterize ((current-directory (path-directory (path-expand input-file)))) (string->list (with-output-to-string '() (lambda () (for-each (lambda (form) (pp form (current-output-port))) (do-expansion (with-input-from-file filename read-all))))))) (recur continue-position (drop str-rest (- continue-position i)))))) (else (cons (car str-rest) (recur (+ i 1) (cdr str-rest))))))))))) ;;! Install o and/or C file in the lib/ directory (define (sake#make-module-available m #!key (versions '(())) (omit-o #f) (omit-c #f)) (or (file-exists? (current-lib-directory)) (make-directory (current-lib-directory))) (for-each (lambda (version) (or omit-o (copy-file (string-append (current-build-directory) (%module-filename-o m version: version)) (string-append (current-lib-directory) (%module-filename-o m version: version)))) (or omit-c (copy-file (string-append (current-build-directory) (%module-filename-c m version: version)) (string-append (current-lib-directory) (%module-filename-c m version: version))))) versions)) ;;! Test all files in test/ (define (sake#test-all) (for-each sake#test (fileset dir: "test/" test: (f-and (extension=? ".scm") (f-not (ends-with? "#.scm"))) recursive: #t))) ;;! Test a file (define (sake#test module) (cond ((string? module) (if (file-exists? module) (if (not (zero? (gambit-eval-here `((##spheres-include ,module))))) (err "Internal error running tests. Child process exited abnormally.")) (err "Testing file doesn't exist"))) ((%module? module) (%check-module module 'sake#test) (if (not (zero? (gambit-eval-here `((##spheres-include ,(string-append "test/" (%module-filename-scm module))))))) (err "Internal error running tests. Child process exited abnormally."))) (else (err "Bad testing module description: file path or module")))) ;;! Clean all default generated files and directories (define (sake#default-clean) (delete-file (current-build-directory) recursive: #t) (delete-file (current-lib-directory) recursive: #t) (delete-file (current-bin-directory) recursive: #t)) ;;! Install all the files in lib/ in the system directory for the library (define (sake#install-sphere-to-system #!key (extra-directories '()) (sphere (%current-sphere))) (delete-file (%sphere-system-path sphere) recursive: #t) (make-directory (%sphere-system-path sphere)) (copy-files '("config.scm" "sakefile.scm") (%sphere-system-path sphere)) (for-each (lambda (dir) (if (file-exists? dir) (begin (make-directory (string-append (%sphere-system-path sphere) dir)) (copy-files (fileset dir: dir recursive: #f) (string-append (%sphere-system-path sphere) dir))))) `(,(path-relative (current-source-directory)) ,(path-relative (current-lib-directory)) ,@extra-directories))) ;;! Uninstall all the files from the system installation (define (sake#uninstall-sphere-from-system #!optional (sphere (%current-sphere))) (delete-file (%sphere-system-path sphere) recursive: #t)) ;;! Get the host platform (define (sake#host-platform) (let ((sys (symbol->string (caddr (system-type))))) (cond ((and (> (string-length sys) 4) (string=? "linux" (substring sys 0 5))) 'linux) ((and (> (string-length sys) 5) (string=? "darwin" (substring sys 0 6))) 'osx) (else (err "sake#host-platform -> can't detect current platform"))))) ;;! Parallel for-each, suitable mainly for parallel compilation, which spawns external processes (define (sake#parallel-for-each f l #!key (max-thread-number (case (sake#host-platform) ((linux) (string->number (with-input-from-process "nproc" read-line))) ((osx) (string->number (with-input-from-port (open-process (list path: "sysctl" arguments: '("-n" "hw.logicalcpu"))) read-line))) (else 2)))) (info "using " max-thread-number " compilation threads") (let ((pending-elements l) (elements-mutex (make-mutex)) (results '()) (results-mutex (make-mutex))) (let ((main-thread (current-thread)) (add-to-results! (lambda (r) (mutex-lock! results-mutex) (set! results (cons r results)) (mutex-unlock! results-mutex)))) (let recur ((n 0) (thread-pool '())) (if (< n max-thread-number) (recur (+ n 1) (cons (thread-start! (make-thread (lambda () (let ((current-thread-element #f)) (with-exception-catcher (lambda (e) (thread-send main-thread (cons e current-thread-element))) (lambda () (let recur ((n 0)) (mutex-lock! elements-mutex) (if (null? pending-elements) (begin (mutex-unlock! elements-mutex) 'finished-thread) (let ((next (car pending-elements))) (set! current-thread-element next) (set! pending-elements (cdr pending-elements)) (mutex-unlock! elements-mutex) (add-to-results! (f next)) (recur (fx+ n 1))))))))))) thread-pool))) (for-each thread-join! thread-pool) (let read-messages () (let ((m (thread-receive 0 'finished))) (if (not (eq? m 'finished)) (begin (err "parallel-for-each exception " (car m) " running procedure on element: " (cdr m)) (read-messages))))))) (reverse results)))
true
a1eeef1eef1dd5c2ec8221fdddf6de0d248103bc
165a4ff581651cdad1bc512ec1c82cebc0ac575a
/src/SICP/4/4.1/ex4.11.ss
01075e9a481a311fdfadee322fda4b8bb55e5852
[]
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
2,560
ss
ex4.11.ss
(load "./4.1_2.ss") (define (make-frame variables values) (define (iter variables values) (if (null? variables) '() (cons (cons (car variables) (car values)) (iter (cdr variables) (cdr values))))) (list (iter variables values))) (define (frame-variables frame) (map car (car frame))) (define (frame-values frame) (map cdr (car frame))) (define (add-binding-to-frame! var val frame) (set-car! frame (cons (cons var val) (car frame)))) (define f (make-frame (list 'a 'b 'd) (list 1 2 4))) (add-binding-to-frame! 'c 3 f) (display f) (frame-variables f) (frame-values f) (define f (make-frame '() '())) (add-binding-to-frame! 'c 4 f) (display f) (frame-variables f) (frame-values f) (define (lookup-variable-value var env) (define (env-loop env) (define (scan l) (cond ((null? l) (env-loop (enclosing-environment env))) ((eq? var (caar l)) (cdar l)) (else (scan (cdr l))))) (if (eq? env the-empty-environment) (error "Unbound variable" var) (let ((frame (first-frame env))) (scan (car frame))))) (env-loop env)) (define (set-variable-value! var val env) (define (env-loop env) (define (scan l) (cond ((null? l) (env-loop (enclosing-environment env))) ((eq? var (caar l)) (set-cdr! (car l) val)) (else (scan (cdr l))))) (if (eq? env the-empty-environment) (error "Unbound variable -- SET!" var) (let ((frame (first-frame env))) (scan (car frame))))) (env-loop env)) (define (define-variable! var val env) (let ((frame (first-frame env))) (define (scan l) (cond ((null? l) (add-binding-to-frame! var val frame)) ((eq? var (caar l)) (set-cdr! (car l) val)) (else (scan (cdr l))))) (scan (car frame)))) (define (setup-environment2) (let ((initial-env (extend-environment '(a) '(1) the-empty-environment))) (define-variable! 'true true initial-env) (define-variable! 'false false initial-env) initial-env)) (define the-global-environment2 (setup-environment2)) (define-variable! 'b 1 the-global-environment2) (display the-global-environment2) (set-variable-value! 'b 2 the-global-environment2) (display the-global-environment2) ;error (set-variable-value! 'd 2 the-global-environment2) (lookup-variable-value 'a the-global-environment2) (lookup-variable-value 'b the-global-environment2) (display the-global-environment2)
false
2113dbfb668c19d886c2e16049464156b41cb5ed
defeada37d39bca09ef76f66f38683754c0a6aa0
/System.Xml/mono/xml/xsl/operations/xsl-if.sls
f844371abc05913ed14d78b25720e889b45fcce4
[]
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
676
sls
xsl-if.sls
(library (mono xml xsl operations xsl-if) (export new is? xsl-if? evaluate evaluate-if-true?) (import (ironscheme-clr-port)) (define-syntax new (lambda (e) (syntax-case e () ((_ a ...) #'(clr-new Mono.Xml.Xsl.Operations.XslIf a ...))))) (define (is? a) (clr-is Mono.Xml.Xsl.Operations.XslIf a)) (define (xsl-if? a) (clr-is Mono.Xml.Xsl.Operations.XslIf a)) (define-method-port evaluate Mono.Xml.Xsl.Operations.XslIf Evaluate (System.Void Mono.Xml.Xsl.XslTransformProcessor)) (define-method-port evaluate-if-true? Mono.Xml.Xsl.Operations.XslIf EvaluateIfTrue (System.Boolean Mono.Xml.Xsl.XslTransformProcessor)))
true
6f68f12b67e8541a52fdede45ca937036fa62829
6f7df1f0361204fb0ca039ccbff8f26335a45cd2
/scheme/tests/inversion-report/intro-query.ss
ed7501fc37369fa3031ada6d437f4b45343431ee
[]
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
61
ss
intro-query.ss
'(node (node (node (node 2))) (node (node (node 2))))
false