blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 3
171
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f6ee34fbc9ab8b08fa6dede32293274febb077c9 | e358b0cf94ace3520adff8d078a37aef260bb130 | /painting/2.46.scm | b9c708008872d6f89613bb81ba5d662d34cce3f1 | [] | no_license | dzhus/sicp | 784766047402db3fad4884f7c2490b4f78ad09f8 | 090fa3228d58737d3558f2af5a8b5937862a1c75 | refs/heads/master | 2021-01-18T17:28:02.847772 | 2020-05-24T19:15:57 | 2020-05-24T20:56:00 | 22,468,805 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 521 | scm | 2.46.scm | (define (make-vect x y)
(cons x y))
;; Redefine builtin to avoid confusion :-)
(define make-vector make-vect)
(define (x-vect vect)
(car vect))
(define (y-vect vect)
(cdr vect))
(define (add-vect vect1 vect2)
(make-vect
(+ (x-vect vect1) (x-vect vect2))
(+ (y-vect vect1) (y-vect vect2))))
(define (sub-vect vect1 vect2)
(make-vect
(- (x-vect vect1) (x-vect vect2))
(- (y-vect vect1) (y-vect vect2))))
(define (scale-vect vect s)
(make-vect
(* (x-vect vect) s)
(* (y-vect vect) s)))
| false |
e5e82734491ea242fcdbfc542da1250e9edcfef2 | a9d1a0e915293c3e6101e598b3f8fc1d8b8647a9 | /scheme/raytrace/test-pattern.scm | 0571e7b58c1259221d4157f7bf05eb1878cef773 | [] | no_license | mbillingr/raytracing | a3b5b988007536a7065e51ef2fc17e6b5ac44d43 | 9c786e5818080cba488d3795bc6777270c505e5e | refs/heads/master | 2021-04-16T17:10:40.435285 | 2020-11-11T07:02:18 | 2020-11-11T07:02:18 | 249,372,261 | 2 | 4 | null | null | null | null | UTF-8 | Scheme | false | false | 4,554 | scm | test-pattern.scm | (import (scheme base)
(raytrace testing)
(raytrace tuple)
(raytrace pattern)
(raytrace material)
(raytrace lights)
(raytrace shapes)
(raytrace transformations)
(raytrace matrix))
(define BLACK (color 0 0 0))
(define WHITE (color 1 1 1))
;; generic patterns
;; ===========================================================================
(define (test-pattern)
(make-pattern (lambda (p) (color (tuple-x p) (tuple-y p) (tuple-z p)))))
(test "The default pattern transformation"
(given (pattern <- (test-pattern)))
(then ((pattern 'inv-transform) == (identity-transform))))
(test "Assigning a transformation"
(given (pattern <- (test-pattern)))
(when (pattern 'set-transform! (translation 1 2 3)))
(then ((pattern 'inv-transform) == (m4-inverse (translation 1 2 3)))))
(test "A pattern with an object transformation"
(given (shape <- (sphere))
(pattern <- (test-pattern)))
(when (shape 'set-transform! (scaling 2 2 2))
(c <- (shape 'pattern-at pattern (point 2 3 4))))
(then (c == (color 1 1.5 2))))
(test "A pattern with a pattern transformation"
(given (shape <- (sphere))
(pattern <- (test-pattern)))
(when (pattern 'set-transform! (scaling 2 2 2))
(c <- (shape 'pattern-at pattern (point 2 3 4))))
(then (c == (color 1 1.5 2))))
(test "A pattern with both an object and a pattern transformation"
(given (shape <- (sphere))
(pattern <- (test-pattern)))
(when (pattern 'set-transform! (translation 0.5 1 1.5))
(shape 'set-transform! (scaling 2 2 2))
(c <- (shape 'pattern-at pattern (point 2.5 3 3.5))))
(then (c == (color 0.75 0.5 0.25))))
;; stripe pattern
;; ===========================================================================
(test "A stripe pattern is constant in y"
(given (pattern <- (stripe-pattern WHITE BLACK)))
(then ((pattern 'at (point 0 0 0)) == WHITE)
((pattern 'at (point 0 1 0)) == WHITE)
((pattern 'at (point 0 2 0)) == WHITE)))
(test "A stripe pattern is constant in z"
(given (pattern <- (stripe-pattern WHITE BLACK)))
(then ((pattern 'at (point 0 0 0)) == WHITE)
((pattern 'at (point 0 0 1)) == WHITE)
((pattern 'at (point 0 0 2)) == WHITE)))
(test "A stripe pattern alternates in x"
(given (pattern <- (stripe-pattern WHITE BLACK)))
(then ((pattern 'at (point 0.0 0 0)) == WHITE)
((pattern 'at (point 0.9 0 0)) == WHITE)
((pattern 'at (point 1.0 0 0)) == BLACK)
((pattern 'at (point -0.1 0 0)) == BLACK)
((pattern 'at (point -1.0 0 0)) == BLACK)
((pattern 'at (point -1.1 0 0)) == WHITE)))
(test "Lighting with a pattern applied"
(given (m <- (material (stripe-pattern WHITE BLACK)
1 0 0 1.0))
(eyev <- (vec 0 0 -1))
(normalv <- (vec 0 0 -1))
(light <- (point-light (point 0 0 -10) WHITE))
(s <- (sphere)))
(when (c1 <- (lighting m s light (point 0.9 0 0) eyev normalv #f))
(c2 <- (lighting m s light (point 1.1 0 0) eyev normalv #f)))
(then (c1 == WHITE)
(c2 == BLACK)))
;; more patterns
;; ===========================================================================
(test "A gradient linearly interpolates between colors"
(given (pattern <- (gradient-pattern WHITE BLACK)))
(then ((pattern 'at (point 0.25 0 0)) == (color 0.75 0.75 0.75))
((pattern 'at (point 0.5 0 0)) == (color 0.5 0.5 0.5))
((pattern 'at (point 0.75 0 0)) == (color 0.25 0.25 0.25))))
(test "A ring should extend in both x and z"
(given (pattern <- (ring-pattern WHITE BLACK)))
(then ((pattern 'at (point 0 0 0)) == WHITE)
((pattern 'at (point 1 0 0)) == BLACK)
((pattern 'at (point 0 0 1)) == BLACK)
((pattern 'at (point 0.708 0 0.708)) == BLACK)))
(test "Checkers should repeat in x"
(given (pattern <- (checkers-pattern WHITE BLACK)))
(then ((pattern 'at (point 0 0 0)) == WHITE)
((pattern 'at (point 0.99 0 0)) == WHITE)
((pattern 'at (point 1.01 0 0)) == BLACK)))
(test "Checkers should repeat in y"
(given (pattern <- (checkers-pattern WHITE BLACK)))
(then ((pattern 'at (point 0 0 0)) == WHITE)
((pattern 'at (point 0 0.99 0)) == WHITE)
((pattern 'at (point 0 1.01 0)) == BLACK)))
(test "Checkers should repeat in z"
(given (pattern <- (checkers-pattern WHITE BLACK)))
(then ((pattern 'at (point 0 0 0)) == WHITE)
((pattern 'at (point 0 0 0.99)) == WHITE)
((pattern 'at (point 0 0 1.01)) == BLACK)))
| false |
52ba538480716405944ed0c207b2c40dccd28c98 | d8fd100f7fedcf165381c5bfeac3b8b04baf5980 | /lib/sdl2/lib/sdl2-internals/accessors/rect.scm | 6d4855652820e3c0474b402248b81488cecb2a6a | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | shelt/flib | 9c7b8228692ac6973c593a4bcd2d89ad96c1879c | 5e2212d0c907297c0859758bc97a0a50f320172e | refs/heads/master | 2021-01-10T04:18:23.371234 | 2016-01-23T05:24:45 | 2016-01-23T05:24:45 | 50,224,827 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 2,966 | scm | rect.scm | ;;
;; chicken-sdl2: CHICKEN Scheme bindings to Simple DirectMedia Layer 2
;;
;; Copyright © 2013, 2015 John Croisant.
;; All rights reserved.
;;
;; Redistribution and use in source and binary forms, with or without
;; modification, are permitted provided that the following conditions
;; are met:
;;
;; - Redistributions of source code must retain the above copyright
;; notice, this list of conditions and the following disclaimer.
;;
;; - Redistributions in binary form must reproduce the above copyright
;; notice, this list of conditions and the following disclaimer in
;; the documentation and/or other materials provided with the
;; distribution.
;;
;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
;; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
;; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
;; FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
;; COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
;; INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
;; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
;; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
;; HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
;; STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
;; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
;; OF THE POSSIBILITY OF SUCH DAMAGE.
(export rect-x rect-x-set!
rect-y rect-y-set!
rect-w rect-w-set!
rect-h rect-h-set!
make-rect
make-rect*
rect-set!
rect->list
copy-rect copy-rect*)
(define-struct-field-accessors
SDL_Rect*
rect?
("x"
type: Sint32
getter: rect-x
setter: rect-x-set!
guard: (Sint32-guard "sdl2:rect field x"))
("y"
type: Sint32
getter: rect-y
setter: rect-y-set!
guard: (Sint32-guard "sdl2:rect field y"))
("w"
type: Sint32
getter: rect-w
setter: rect-w-set!
guard: (Sint32-guard "sdl2:rect field w"))
("h"
type: Sint32
getter: rect-h
setter: rect-h-set!
guard: (Sint32-guard "sdl2:rect field h")))
(define (make-rect #!optional (x 0) (y 0) (w 0) (h 0))
(rect-set! (alloc-rect) x y w h))
(define (make-rect* #!optional (x 0) (y 0) (w 0) (h 0))
(rect-set! (alloc-rect*) x y w h))
(define (rect-set! rect #!optional x y w h)
(when x (rect-x-set! rect x))
(when y (rect-y-set! rect y))
(when w (rect-w-set! rect w))
(when h (rect-h-set! rect h))
rect)
(define (rect->list rect)
(list (rect-x rect)
(rect-y rect)
(rect-w rect)
(rect-h rect)))
(define %copy-rect!
(foreign-lambda*
void ((SDL_Rect* src) (SDL_Rect* dest))
"*dest = *src;"))
(define (copy-rect rect)
(let ((dest (alloc-rect)))
(%copy-rect! rect dest)
dest))
(define (copy-rect* rect)
(let ((dest (alloc-rect*)))
(%copy-rect! rect dest)
dest))
| false |
791661c312de327b582eb01c7199f53ae132b84c | ce567bbf766df9d98dc6a5e710a77870753c7d29 | /base/chapter8/simplemodules/subtyping.scm | 23534b3fc354bfed3254209fc38fa9ac382dbfea | [] | 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 | 1,335 | scm | subtyping.scm | (module subtyping (lib "eopl.ss" "eopl")
(require "lang.scm")
(provide <:-iface)
;; <:-iface : Iface * Iface * Tenv -> Bool
;; Page: 289
(define <:-iface
(lambda (iface1 iface2 tenv)
(cases interface iface1
(simple-iface (decls1)
(cases interface iface2
(simple-iface (decls2)
(<:-decls decls1 decls2 tenv)))))))
;; <:-decls : Listof(Decl) * Listof(Decl) * Tenv -> Bool
;; Page: 289
;;
;; s1 <: s2 iff s1 has at least as much stuff as s2, and in the same
;; order. We walk down s1 until we find a declaration that declares
;; the same name as the first component of s2. If we run off the
;; end of s1, then we fail. As we walk down s1, we record any type
;; bindings in the tenv
;;
(define <:-decls
(lambda (decls1 decls2 tenv)
(cond
((null? decls2) #t)
((null? decls1) #f)
(else
(let ((name1 (decl->name (car decls1)))
(name2 (decl->name (car decls2))))
(if (eqv? name1 name2)
(and
(equal?
(decl->type (car decls1))
(decl->type (car decls2)))
(<:-decls (cdr decls1) (cdr decls2) tenv))
(<:-decls (cdr decls1) decls2 tenv)))))))
) | false |
81e35265f1c1703c16366bce45b4192276dffbc3 | 2b0dc0760baad4405f64b424345381f688173281 | /compiler/src/main/scheme/interfaces/scheme/process-context.scm | 1adc4ebf6660332beb4a45f9e5a24ab04a36360b | [
"Apache-2.0"
] | permissive | abduld/llambda | f2e7daf0c9a302dafa29a2d4067bfae6d1ec8317 | 17e53a5ec15f2b09f2eb3304151af3dbbcfd7f32 | refs/heads/master | 2023-04-12T23:59:17.462698 | 2015-10-24T04:51:25 | 2015-10-24T04:51:25 | 45,697,748 | 0 | 0 | NOASSERTION | 2023-04-04T01:11:51 | 2015-11-06T17:50:04 | Scala | UTF-8 | Scheme | false | false | 93 | scm | process-context.scm | (export exit emergency-exit get-environment-variable get-environment-variables command-line)
| false |
517e1955f4f8ea64452b8bef52353dfea1309b84 | 1384f71796ddb9d11c34c6d988c09a442b2fc8b2 | /tests/payload-dictionary-scm.t | e25bca0c41702d10374f79489fd5a53796fa8a0a | [] | no_license | ft/xmms2-guile | 94c2479eec427a370603425fc9e757611a796254 | 29670e586bf440c20366478462f425d5252b953c | refs/heads/master | 2021-07-08T07:58:15.066996 | 2020-10-12T01:24:04 | 2020-10-12T01:24:04 | 74,858,831 | 1 | 2 | null | null | null | null | UTF-8 | Scheme | false | false | 2,901 | t | payload-dictionary-scm.t | ;; -*- scheme -*-
;; Copyright (c) 2016 xmms2-guile workers, All rights reserved.
;;
;; Terms for redistribution and use can be found in LICENCE.
(use-modules (test tap)
(test payload)
(test setup)
(xmms2 payload)
(xmms2 types))
(init-test-tap!)
(define-syntax test-><-dictionary?
(syntax-rules ()
((_ lst)
(begin (perform-payload-><-test make-dictionary-payload
payload->dictionary
lst pass-if-equal?)
(perform-payload-><-test make-value-payload
payload->dictionary
lst pass-if-equal?)
(perform-payload-><-test make-dictionary-payload
payload->value
lst pass-if-equal?)
(perform-payload-><-test make-value-payload
payload->value
lst pass-if-equal?)))))
(define *tests-per-back-and-forth* 4)
(with-fs-test-bundle
(plan (+ 5 (* 3 *tests-per-back-and-forth*)))
(define-test "Empty dictionary looks good"
(pass-if-payload-equal? (make-value-payload (make-dictionary '()))
#vu8(0 0 0 7 0 0 0 0)))
(define-test "Dictionary payload '() looks good"
(pass-if-payload-equal? (make-dictionary-payload '())
#vu8(0 0 0 7 0 0 0 0)))
(define-test "Dictionary payload '((foo . 23)) looks good"
(pass-if-payload-equal?
(make-dictionary-payload '((foo . 23)))
#vu8(0 0 0 7 0 0 0 1 0 0 0 4 102 111 111 0 0 0 0 2 0 0 0 0 0 0 0 23)))
(define-test "Dictionary payload '((foo . 23) (bar . \"bar\")) looks good"
(pass-if-payload-equal?
(make-dictionary-payload '((foo . 23) (bar . "bar")))
#vu8(0 0 0 7 0 0 0 2 0 0 0 4 102 111 111 0
0 0 0 2 0 0 0 0 0 0 0 23
0 0 0 4 98 97 114
0 0 0 0 3 0 0 0 4 98 97 114 0)))
(define-test "Dictionary payload '((foo . 23) (bar . \"bar\") (baz 42 23 666)) looks good"
(pass-if-payload-equal?
(make-dictionary-payload '((foo . 23) (bar . "bar") (baz 42 23 666)))
#vu8(0 0 0 7 0 0 0 3 0 0 0 4 102 111 111 0
0 0 0 2 0 0 0 0 0 0 0 23
0 0 0 4 98 97 114 0
0 0 0 3 0 0 0 4 98 97 114 0
0 0 0 4 98 97 122
0 0 0 0 6 0 0 0 0 0 0 0 3
0 0 0 2 0 0 0 0 0 0 0 42
0 0 0 2 0 0 0 0 0 0 0 23
0 0 0 2 0 0 0 0 0 0 2 154)))
(test-><-dictionary? (make-dictionary '((foo . 23))))
(test-><-dictionary? (make-dictionary '((foo . 23) (bar . "bar"))))
(test-><-dictionary? (make-dictionary '((foo . 23) (bar . "bar") (baz 42 23 666)))))
| true |
febaa9d2b0d1ba80423dde17149fc64ba85e869a | 1b6b7335f3fabb83294f1ff421421e15fd7d1e73 | /2017/backtick.scm | f39b17d9385509d4413c930239a5b6df54d31591 | [] | no_license | bor0/misc | 42f1aa55618063b632033d70eaa4efcb9d85431d | 1b92b7af0d598d5231e8efa77ab3755cd4ac0b6a | refs/heads/master | 2023-07-20T01:30:04.558101 | 2023-07-16T20:15:40 | 2023-07-16T20:15:40 | 60,490,071 | 11 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 81 | scm | backtick.scm | (display `(with backtick only comma prefixed will be evald ,(+ 1 2) vs (+ 1 2)))
| false |
d819a0cf074c549577dea3a7616b50608fb9162d | 0768e217ef0b48b149e5c9b87f41d772cd9917f1 | /heap/boot/macro/quasi.scm | a775f8c6e7cfc5eb4510c138e4d6199d9adfedbb | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause"
] | permissive | fujita-y/ypsilon | e45c897436e333cf1a1009e13bfef72c3fb3cbe9 | 62e73643a4fe87458ae100e170bf4721d7a6dd16 | refs/heads/master | 2023-09-05T00:06:06.525714 | 2023-01-25T03:56:13 | 2023-01-25T04:02:59 | 41,003,666 | 45 | 7 | BSD-2-Clause | 2022-06-25T05:44:49 | 2015-08-19T00:05:35 | Scheme | UTF-8 | Scheme | false | false | 4,072 | scm | quasi.scm | ;;; Copyright (c) 2004-2022 Yoshikatsu Fujita / LittleWing Company Limited.
;;; See LICENSE file for terms and conditions of use.
(define expand-quasiquote
(lambda (form env)
(define unquote? (lambda (tag) (denote-unquote? env tag)))
(define quasiquote? (lambda (tag) (denote-quasiquote? env tag)))
(define unquote-splicing? (lambda (tag) (denote-unquote-splicing? env tag)))
(define quoted? (lambda (e) (and (pair? e) (pair? (cdr e)) (null? (cddr e)) (denote-quote? env (car e)))))
(define constant? (lambda (e) (or (boolean? e) (number? e) (char? e) (string? e) (bytevector? e) (quoted? e))))
(define constant-value (lambda (e) (cond ((quoted? e) (cadr e)) (else e))))
(define null-constant? (lambda (e) (and (quoted? e) (null? (cadr e)))))
(define emit-append
(lambda (body tail)
(cond ((null? body) tail)
((null-constant? tail) (if (= (length body) 1) (car body) `(,_append ,@body)))
(else `(,_append ,@body ,tail)))))
(define emit-cons*
(lambda (body tail)
(if (= (length body) 1)
(emit-cons (car body) tail)
(cond ((null? body) tail)
((null-constant? tail) `(,_list ,@body))
((and (pair? tail) (eq? (car tail) _list)) `(,_list ,@body ,@(cdr tail)))
((and (pair? tail) (or (eq? (car tail) _cons) (eq? (car tail) _cons*)))
`(,_cons* ,@body ,@(cdr tail)))
(else `(,_cons* ,@body ,tail))))))
(define emit-cons
(lambda (head tail)
(if (and (constant? head) (constant? tail))
(list '|.quote| (cons (constant-value head) (constant-value tail)))
(cond ((null-constant? tail) `(,_list ,head))
((and (pair? tail) (eq? (car tail) _list)) `(,_list ,head ,@(cdr tail)))
((and (pair? tail) (or (eq? (car tail) _cons) (eq? (car tail) _cons*)))
`(,_cons* ,head ,@(cdr tail)))
(else `(,_cons ,head ,tail))))))
(define expand-vector
(lambda (expr nest)
(let ((lst (expand (vector->list expr) nest)))
(cond ((null-constant? lst) `(|.quote| #()))
((constant? lst) `(|.quote| ,(list->vector (constant-value lst))))
((and (pair? lst) (eq? (car lst) _list)) `(,_vector ,@(cdr lst)))
(else `(,_list->vector ,lst))))))
(define expand
(lambda (expr nest)
(cond ((pair? expr)
(if (= nest 0)
(destructuring-match expr
((((? unquote? _) e1 ...) . e2) (emit-cons* e1 (expand e2 0)))
((((? unquote-splicing? _) e1 ...) . e2) (emit-append e1 (expand e2 0)))
(((? quasiquote? _) _ ...) (emit-cons (expand (car expr) 1) (expand (cdr expr) 1)))
(((? unquote? _) e1) e1)
(((? unquote? _) . _) (syntax-violation 'quasiquote "unquote appear in bad context" form expr))
(((? quasiquote? _) . _)
(syntax-violation 'quasiquote "nested quasiquote appear in bad context" form expr))
(((? unquote-splicing? _) . _)
(syntax-violation 'quasiquote "unquote-splicing appear in bad context" form expr))
(_ (emit-cons (expand (car expr) 0) (expand (cdr expr) 0))))
(let ((tag (car expr)))
(cond ((or (denote-unquote? env tag) (denote-unquote-splicing? env tag))
(emit-cons `(|.quote| ,tag) (expand (cdr expr) (- nest 1))))
((denote-quasiquote? env tag) (emit-cons `(|.quote| ,tag) (expand (cdr expr) (+ nest 1))))
(else (emit-cons (expand (car expr) nest) (expand (cdr expr) nest)))))))
((vector? expr) (expand-vector expr nest))
((symbol? expr) `(|.quote| ,expr))
((null? expr) `(|.quote| ()))
(else expr))))
(expand-form (annotate (expand (cadr form) 0) form) env)))
| false |
bbcb0a22120fb135fc897cb833b673ca979c8018 | 2767601ac7d7cf999dfb407a5255c5d777b7b6d6 | /sandbox/old-src/compiler/helpers.ss | 43548ec2a7373e7da72838b190d5a0811c24f76d | [] | no_license | manbaum/moby-scheme | 7fa8143f3749dc048762db549f1bcec76b4a8744 | 67fdf9299e9cf573834269fdcb3627d204e402ab | refs/heads/master | 2021-01-18T09:17:10.335355 | 2011-11-08T01:07:46 | 2011-11-08T01:07:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 16,404 | ss | helpers.ss | #lang s-exp "lang.ss"
(require "rbtree.ss")
(require "../collects/moby/runtime/stx.ss")
(require "../collects/moby/runtime/error-struct.ss")
;; A program is a (listof (or/c defn? expr? test-case? library-require?))
(define (list? datum)
(or (empty? datum)
(and
(pair? datum)
(list? (rest datum)))))
;; symbol<: symbol symbol -> boolean
(define (symbol< x y)
(string<? (symbol->string x)
(symbol->string y)))
;; expression<: expression expression -> boolean
;; Induces an ordering of expressions.
;; Returns true if one expression is less than another.
;; FIXME: this is a partial function at the moment: it doesn't know how to handle
;; +-inf.0, nan.0, or complex numbers yet.
(define (expression<? x y)
(cond
[(< (expression-type-number x)
(expression-type-number y))
true]
[(= (expression-type-number x)
(expression-type-number y))
(cond
[(number? (stx-e x))
;; FIXME: bug here if x is not a finite real number.
(< (stx-e x) (stx-e y))]
[(string? (stx-e x))
(string<? (stx-e x) (stx-e y))]
[(boolean? (stx-e x))
(< (if (stx-e x) 1 0) (if (stx-e y) 1 0))]
[(char? (stx-e x))
(char<? (stx-e x) (stx-e y))]
[(symbol? (stx-e x))
(symbol< (stx-e x) (stx-e y))]
[(pair? (stx-e x))
(cond
[(< (length (stx-e x))
(length (stx-e y)))
true]
[(= (length (stx-e x))
(length (stx-e y)))
(ormap expression<? (stx-e x) (stx-e y))]
[else
false])]
[(empty? (stx-e x))
false])]
[else
false]))
;; expression-type-number: expression -> number
;; Produces an arbitrary but consistent numbering on an expression based on its type.
(define (expression-type-number x)
(cond
[(number? (stx-e x))
0]
[(string? (stx-e x))
1]
[(boolean? (stx-e x))
2]
[(char? (stx-e x))
3]
[(symbol? (stx-e x))
4]
[(empty? (stx-e x))
5]
[(pair? (stx-e x))
6]))
;; program: any -> boolean
;; Returns true if the datum is a program.
(define (program? datum)
(and (list? datum)
(andmap (lambda (x)
(or (defn? x)
(expression? x)
(test-case? x)
(library-require? x)))
datum)))
;; expression?: any -> boolean
;; Returns true if the datum is an expression.
(define (expression? an-expr)
(and (not (defn? an-expr))
(not (test-case? an-expr))
(not (library-require? an-expr))))
;; defn?: stx -> boolean
(define (defn? an-sexp)
(cond
[(stx-begins-with? an-sexp 'define)
true]
[(stx-begins-with? an-sexp 'define-struct)
true]
[(stx-begins-with? an-sexp 'define-values)
true]
[else
false]))
;; provide-statement?: stx -> boolean
;; Produces true if the syntax looks like a provide.
(define (provide-statement? an-sexp)
(stx-begins-with? an-sexp 'provide))
;; string-join: (listof string) string -> string
(define (string-join strs delim)
(cond
[(empty? strs)
""]
[(empty? (rest strs))
(first strs)]
[else
(string-append
(first strs)
delim
(string-join (rest strs) delim))]))
;; string-split: string char -> (listof string)
(define (string-split a-str delim)
(local [(define (add-word acc)
(list (cons (list->string (reverse (second acc)))
(first acc))
empty))
(define (accumulate-character acc ch)
(list (first acc)
(cons ch (second acc))))]
(reverse (first
(add-word
(foldl (lambda (ch acc)
(cond [(char=? ch delim)
(add-word acc)]
[else
(accumulate-character acc ch)]))
(list empty empty)
(string->list a-str)))))))
;; test-case?: stx -> boolean
(define (test-case? an-sexp)
(or (stx-begins-with? an-sexp 'check-expect)
(stx-begins-with? an-sexp 'EXAMPLE)
(stx-begins-with? an-sexp 'check-within)
(stx-begins-with? an-sexp 'check-error)))
;; library-require?: stx -> boolean
(define (library-require? an-sexp)
(stx-begins-with? an-sexp 'require))
;; java-identifiers: (rbtreeof symbol boolean)
(define java-identifiers
(foldl (lambda (sym an-rbtree)
(rbtree-insert symbol< an-rbtree sym true))
empty-rbtree
'(abstract continue for new switch
assert default goto package synchronized
boolean do if private #; this
break double implements protected throw
byte delete else import public throws
case enum instanceof instanceOf return transient
catch extends int short try
char final interface static void
class finally long strictfp volatile
const float native super while null
comment export import in label typeof with false true
debugger)))
;; special-character-mappings: (rbtreeof char string)
(define special-character-mappings
(foldl (lambda (ch+translation an-rbtree)
(rbtree-insert char<? an-rbtree (first ch+translation) (second ch+translation)))
empty-rbtree
'((#\- "_dash_")
(#\_ "_underline_")
(#\? "_question_")
(#\! "_bang_")
(#\. "_dot_")
(#\: "_colon_")
(#\= "_equal_")
(#\@ "_at_")
(#\# "_pound_")
(#\$ "_dollar_")
(#\% "_percent_")
(#\^ "_tilde_")
(#\& "_and_")
(#\* "_star_")
(#\+ "_plus_")
(#\/ "_slash_")
(#\< "_lessthan_")
(#\> "_greaterthan_")
(#\~ "_tilde_"))))
;; translate-special-character: char -> string
;; Special character mappings for identifiers.
(define (translate-special-character ch)
(cond
[(cons? (rbtree-lookup char<? special-character-mappings ch))
(second (rbtree-lookup char<? special-character-mappings ch))]
[else
(string ch)]))
;; identifier->munged-java-identifier: symbol -> symbol
(define (identifier->munged-java-identifier an-id)
(cond
[(cons? (rbtree-lookup symbol< java-identifiers an-id))
(string->symbol (string-append "_" (symbol->string an-id) "_"))]
[else
(local [(define (maybe-prepend-hyphen chars)
(cond
[(member (first chars) (string->list "0123456789"))
(cons #\- chars)]
[else
chars]))
(define chars (maybe-prepend-hyphen (string->list (symbol->string an-id))))
(define translated-chunks
(map translate-special-character chars))
(define translated-id
(string->symbol
(string-join translated-chunks "")))]
translated-id)]))
;; remove-leading-whitespace/list: (listof char) -> string
;; Removes leading whitespace from a list of characters.
(define (remove-leading-whitespace/list chars)
(cond
[(empty? chars)
""]
[(char-whitespace? (first chars))
(remove-leading-whitespace/list (rest chars))]
[else
(list->string chars)]))
;; remove-leading-whitespace: string -> string
;; Removes the whitespace from the front of a string.
(define (remove-leading-whitespace a-str)
(remove-leading-whitespace/list (string->list a-str)))
;; take: (listof X) number -> (listof X)
;; Produces a list of the first n elmeents of a-list.
(define (take a-list n)
(cond
[(= n 0)
empty]
[else
(cons (first a-list)
(take (rest a-list) (sub1 n)))]))
;; list-tail: (listof X) number -> (listof X)
;; Produces a list of the last n elmeents in a-list.
(define (list-tail a-list n)
(cond
[(= n 0)
a-list]
[else
(list-tail (rest a-list)
(sub1 n))]))
;; range: number -> number
;; Produces a list of the numbers [0, ..., n).
(define (range n)
(cond
[(= n 0)
empty]
[else
(append (range (sub1 n))
(list (sub1 n)))]))
;; stx-list-of-symbols?: stx -> boolean
;; Produces true if an-stx is a syntax containing a list of symbols.
(define (stx-list-of-symbols? an-stx)
(and (stx:list? an-stx)
(andmap (lambda (elt) (symbol? (stx-e elt)))
(stx-e an-stx))))
;; Helper to help with the destructuring and case analysis of functions.
(define (case-analyze-definition a-definition
f-function ;; (stx (listof stx) expr-stx) -> ...
f-regular-definition ;; (stx expr-stx) -> ...
f-define-struct ;; (stx (listof id-stx)) -> ...
f-define-values ;; ((listof id-stx) stx) -> ...
)
(cond
;; (define (id args ...) body)
[(and (stx-begins-with? a-definition 'define)
(= (length (stx-e a-definition)) 3)
(stx-list-of-symbols? (second (stx-e a-definition))))
(local [(define id (first (stx-e (second (stx-e a-definition)))))
(define args (rest (stx-e (second (stx-e a-definition)))))
(define body (third (stx-e a-definition)))]
(begin
(check-single-body-stx! (rest (rest (stx-e a-definition))) a-definition)
(f-function id args body)))]
;; (define id (lambda (args ...) body))
[(and (stx-begins-with? a-definition 'define)
(= (length (stx-e a-definition)) 3)
(symbol? (stx-e (second (stx-e a-definition))))
(stx-begins-with? (third (stx-e a-definition)) 'lambda))
(local [(define id (second (stx-e a-definition)))
(define args (stx-e (second (stx-e (third (stx-e a-definition))))))
(define body (third (stx-e (third (stx-e a-definition)))))]
(begin
(check-single-body-stx! (rest (rest (stx-e (third (stx-e a-definition))))) a-definition)
(f-function id args body)))]
;; (define id body)
[(and (stx-begins-with? a-definition 'define)
(= (length (stx-e a-definition)) 3)
(symbol? (stx-e (second (stx-e a-definition))))
(not (stx-begins-with? (third (stx-e a-definition)) 'lambda)))
(local [(define id (second (stx-e a-definition)))
(define body (third (stx-e a-definition)))]
(f-regular-definition id body))]
;(define-struct id (fields ...))
[(and (stx-begins-with? a-definition 'define-struct)
(= (length (stx-e a-definition)) 3)
(symbol? (stx-e (second (stx-e a-definition))))
(or (empty? (stx-e (third (stx-e a-definition))))
(pair? (stx-e (third (stx-e a-definition))))))
(local [(define id (second (stx-e a-definition)))
(define fields (stx-e (third (stx-e a-definition))))]
(f-define-struct id fields))]
;; (define-values (id ...) body)
[(and (stx-begins-with? a-definition 'define-values)
(= (length (stx-e a-definition)) 3)
(stx-list-of-symbols? (second (stx-e a-definition))))
(local [(define ids (stx-e (second (stx-e a-definition))))
(define body (third (stx-e a-definition)))]
(f-define-values ids body))]
;; FIXME: add more error productions as necessary to get
;; reasonable error messages.
[(stx-begins-with? a-definition 'define)
(raise (make-moby-error
(stx-loc a-definition)
(make-moby-error-type:generic-syntactic-error
"define expects either an identifier and a body: (define answer 42), or a function header and body: (define (double x ) (* x 2))"
(list))))]
[(stx-begins-with? a-definition 'define-struct)
(raise (make-moby-error
(stx-loc a-definition)
(make-moby-error-type:generic-syntactic-error
"define-struct expects an identifier and a list of fields. i.e. (define-struct pizza (dough sauce toppings))"
(list))))]))
;; symbol-stx?: any -> boolean
;; Produces true when x is a symbol syntax object.
(define (symbol-stx? x)
(and (stx? x)
(symbol? (stx-e x))))
;; check-duplicate-identifiers!: (listof stx) -> void
;; Return a list of the identifiers that are duplicated.
;; Also check to see that each of the ids is really a symbolic identifier.
(define (check-duplicate-identifiers! ids)
(local [(define seen-ids (make-hash))
(define (loop ids)
(cond
[(empty? ids)
(void)]
[else
(cond [(stx? (hash-ref seen-ids (stx-e (first ids)) #f))
(raise (make-moby-error (stx-loc (first ids))
(make-moby-error-type:duplicate-identifier
(stx-e (first ids))
(stx-loc (hash-ref seen-ids (stx-e (first ids)) #f)))))]
[(not (symbol? (stx-e (first ids))))
(raise (make-moby-error (stx-loc (first ids))
(make-moby-error-type:expected-identifier (first ids))))]
[else
(begin
(hash-set! seen-ids (stx-e (first ids)) (first ids))
(loop (rest ids)))])]))]
(loop ids)))
;; check-single-body-stx!: (listof stx) stx -> void
(define (check-single-body-stx! stxs original-stx)
(cond
[(empty? stxs)
(make-moby-error (stx-loc original-stx)
(make-moby-error-type:generic-syntactic-error
"I expected a single body in this expression, but I didn't find any."
(list)))]
[(not (empty? (rest stxs)))
(make-moby-error (stx-loc original-stx)
(make-moby-error-type:generic-syntactic-error
"I expected a single body in this expression, but I found more than one."
(list)))]
[else
(void)]))
;; mapi: (X number -> Y) (listof X) -> (listof Y)
(define (mapi f lst)
(local ([define (loop lst i)
(cond
[(empty? lst)
empty]
[else
(cons (f (first lst) i)
(loop (rest lst) (add1 i)))])])
(loop lst 0)))
(provide/contract [symbol< (symbol? symbol? . -> . boolean?)]
[mapi ((any/c number? . -> . any/c) (listof any/c) . -> . (listof any/c))]
[program? (any/c . -> . boolean?)]
[expression? (any/c . -> . boolean?)]
[defn? (any/c . -> . boolean?)]
[test-case? (any/c . -> . boolean?)]
[library-require? (any/c . -> . boolean?)]
[provide-statement? (any/c . -> . boolean?)]
[take ((listof any/c) number? . -> . (listof any/c))]
[list-tail ((listof any/c) number? . -> . (listof any/c))]
[expression<? (expression? expression? . -> . boolean?)]
[remove-leading-whitespace (string? . -> . string?)]
[identifier->munged-java-identifier (symbol? . -> . symbol?)]
[range (number? . -> . (listof number?))]
[check-duplicate-identifiers! ((listof stx?) . -> . any)]
[check-single-body-stx! ((listof stx?) stx? . -> . any)]
[case-analyze-definition (stx?
(symbol-stx? (listof symbol-stx?) stx? . -> . any)
(symbol-stx? any/c . -> . any)
(symbol-stx? (listof symbol-stx?) . -> . any)
((listof symbol-stx?) stx? . -> . any)
. -> . any)]
[string-join ((listof string?) string? . -> . string?)]
[string-split (string? char? . -> . (listof string?))]) | false |
1acb09bb21d5e22b6b0cb86794a70369c260099b | ce567bbf766df9d98dc6a5e710a77870753c7d29 | /ch6/21.scm | 7e36d5e016312c435259d272147fdb872d957120 | [] | 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 | 978 | scm | 21.scm | ;; Modify cps-of-call-exp so that the operands are evaluated
;; from left to right, followed by the operator.
(load-relative "../libs/init.scm")
(load-relative "./base/test.scm")
(load-relative "./base/cps.scm")
(load-relative "./base/data-structures.scm")
(load-relative "./base/cps-cases.scm")
(load-relative "./base/cps-lang.scm")
(load-relative "./base/base-iterp.scm")
(define last
(lambda (lst)
(if (null? (cdr lst))
(car lst)
(last (cdr lst)))))
(define remove-last-iter
(lambda (lst cur)
(if (null? (cdr lst))
cur
(remove-last-iter (cdr lst)
(append cur (list (car lst)))))))
(define remove-last
(lambda (lst)
(remove-last-iter lst '())))
(define cps-of-call-exp
(lambda (rator rands k-exp)
(cps-of-exps (cons rands rator)
(lambda (new-rands)
(cps-call-exp
(last new-rands)
(append (remove-last new-rands) (list k-exp)))))))
(run "(proc(x) x 3)")
(run "(proc(x) -(x,1) 30)")
(run-all)
| false |
5b15048fe0953a37278f5384d34db35ed8b86417 | bdcc255b5af12d070214fb288112c48bf343c7f6 | /autodiff/nondeterministic-promises.sls | 0e7cf3edfaf14c37183f85230bb9979c0833fa98 | [] | no_license | xaengceilbiths/chez-lib | 089af4ab1d7580ed86fc224af137f24d91d81fa4 | b7c825f18b9ada589ce52bf5b5c7c42ac7009872 | refs/heads/master | 2021-08-14T10:36:51.315630 | 2017-11-15T11:43:57 | 2017-11-15T11:43:57 | 109,713,952 | 5 | 1 | null | null | null | null | UTF-8 | Scheme | false | false | 2,393 | sls | nondeterministic-promises.sls | #!chezscheme
;Thursday 20 May 2010
;
;Jeffrey Mark Siskind
;School of Electrical and Computer Engineering
;Purdue University
;465 Northwestern Avenue
;West Lafayette IN 47907-2035 USA
;voice: 765/496-3197
;fax: 765/494-6440
;[email protected]
;http://engineering.purdue.edu/~qobi
;
;The entire contents of this directory copyright 2010 Purdue University. All
;rights reserved.
;
;These are some AD (Automatic Differentiation) tools for both forward
;and reverse mode written for R6RS Scheme. They run under Ikarus and
;PLT Scheme. Also included are some experimental packages to support
;nondeterministic and stochastic programming, including constraint
;satisfaction problems.
;
;This code is completely unsupported.
;
;It is licensed under the GPL v2 or later, see the enclosed file COPYING.
;
;This material is based upon work supported by the National Science
;Foundation under Grant No. 0438806.
;Any opinions, findings, and conclusions or recommendations expressed in
;this material are those of the author(s) and do not necessarily reflect
;the views of the National Science Foundation.
;; Packaged for R7RS Scheme by Peter Lane, 2017
(library
(autodiff nondeterministic-promises)
(export delayed-a-member-of force-nondeterministic-promise)
(import (scheme base)
(autodiff nondeterministic-scheme))
(begin
(define-record-type <nondeterministic-promise>
(make-nondeterministic-promise domain value? value)
nondeterministic-promise?
(domain nondeterministic-promise-domain)
(value? nondeterministic-promise-value? nondeterministic-promise-value?-set!)
(value nondeterministic-promise-value nondeterministic-promise-value-set!))
(define (delayed-a-member-of d) (make-nondeterministic-promise d #f #f))
(define (force-nondeterministic-promise promise)
(cond
((not (nondeterministic-promise? promise)) promise)
((nondeterministic-promise-value? promise)
(nondeterministic-promise-value promise))
(else (upon-fail (nondeterministic-promise-value?-set! promise #f))
(nondeterministic-promise-value?-set! promise #t)
(let ((value (a-member-of (nondeterministic-promise-domain promise))))
(nondeterministic-promise-value-set! promise value)
value))))
))
| false |
956afb8ead8a2891def0307555e9b22784e1818f | 000dbfe5d1df2f18e29a76ea7e2a9556cff5e866 | /test/lib/closure-cache.scm | 646b245b5fa0bc05d0f48938454bf1e83faed8aa | [
"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 | 249 | scm | closure-cache.scm | (library (closure-cache)
(export *bar* *bar2*)
(import (core))
(define (foo-proc) #t)
(define foo-proc2
(let ((free #f))
(lambda () (set! free #t) free)))
(define *bar* (list foo-proc))
(define *bar2* (list foo-proc2))
)
| false |
45aa84ff2c8497f1ef4e5aa27bd4bde59a34ccb3 | 957ca548c81c2c047ef82cdbf11b7b2b77a3130b | /04HW/04_hw_2.scm | 2ec62902ff4ef284129106d5791681dac3196d2d | [] | no_license | emrzvv/Scheme | 943d4a55c5703f0e1318ae65aec24d0cb57e3372 | e6ae1ed19104f46d22eee2afabea5459f7031a22 | refs/heads/master | 2023-02-19T08:55:29.470491 | 2021-01-18T12:56:26 | 2021-01-18T12:56:26 | 318,609,955 | 4 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 659 | scm | 04_hw_2.scm | (define-syntax lazy-cons
(syntax-rules ()
((lazy-cons a b) (cons a (delay b)))))
(define lazy-car car)
(define (lazy-cdr ls)
(force (cdr ls)))
(define (lazy-head xs k)
(if (= k 0)
'()
(cons (lazy-car xs) (lazy-head (lazy-cdr xs) (- k 1)))))
(define (lazy-ref xs k)
(if (= k 0)
(lazy-car xs)
(lazy-ref (lazy-cdr xs) (- k 1))))
(define (naturals start)
(lazy-cons start (naturals (+ start 1))))
(define (factorial n)
(if (= n 0)
1
(* (factorial (- n 1)) n)))
(define (factorial-list n)
(lazy-cons (factorial n) (factorial-list (+ n 1))))
(define (lazy-factorial n)
(lazy-ref (factorial-list 0) n)) | true |
1d9fd10859d7cc6077a9976481c75e81b50a6195 | def26f110cf94581c6e0523383cec8c56c779d51 | /srfi-tests/srfi-54.sld | 7421d47ead68855d231c462b72e512109fed11ae | [
"MIT"
] | permissive | TaylanUB/scheme-srfis | f86649e4a71e8af59d2afd71bd33e96aaae4760f | 7c4ba635c9829a35ce7134fa12db9959e4d1982a | refs/heads/master | 2021-07-06T00:29:53.807790 | 2021-06-01T00:41:31 | 2021-06-01T00:41:31 | 37,764,520 | 39 | 4 | null | 2015-08-25T10:09:16 | 2015-06-20T09:20:04 | Scheme | UTF-8 | Scheme | false | false | 3,158 | sld | srfi-54.sld | (define-library (srfi-tests srfi-54)
(export run-tests)
(import
(scheme base)
(scheme char)
(scheme write)
(srfi 54)
(srfi 64)
(srfi-tests aux))
(begin
(define-syntax value-and-output
(syntax-rules ()
((_ expr)
(let ((port (open-output-string)))
(parameterize ((current-output-port port))
(let ((value expr))
(list value (get-output-string port))))))))
(define (string-reverse string)
(list->string (reverse (string->list string))))
(define-tests run-tests "SRFI-54"
(test-equal "130.00 " (cat 129.995 -10 2.))
(test-equal " 130.00" (cat 129.995 10 2.))
(test-equal " 129.98" (cat 129.985 10 2.))
(test-equal " 129.99" (cat 129.985001 10 2.))
(test-equal "#e130.00" (cat 129.995 2. 'exact))
(test-equal "129.00" (cat 129 -2.))
(test-equal "#e129.00" (cat 129 2.))
(test-equal "#e+0129.00" (cat 129 10 2. #\0 'sign))
(test-equal "*#e+129.00" (cat 129 10 2. #\* 'sign))
(test-equal "1/3" (cat 1/3))
(test-equal " #e0.33" (cat 1/3 10 2.))
(test-equal " 0.33" (cat 1/3 10 -2.))
(test-equal " 1,29.99,5" (cat 129.995 10 '(#\, 2)))
(test-equal " +129,995" (cat 129995 10 '(#\,) 'sign))
(test-equal "130" (cat (cat 129.995 0.) '(0 -1)))
;; These produce different results on Chibi, but I don't know if that's a
;; bug or whether the result is implementation-dependent.
;; (test-equal "#i#o+307/2" (cat 99.5 10 'sign 'octal))
;; (test-equal " #o+307/2" (cat 99.5 10 'sign 'octal 'exact))
(test-equal "#o+443" (cat #x123 'octal 'sign))
(test-equal "#e+291.00*" (cat #x123 -10 2. 'sign #\*))
;; These produce different results on Larceny, but I don't know if that's
;; a bug or whether the result is implementation-dependent.
;; (test-equal "-1.234e+15+1.236e-15i" (cat -1.2345e+15+1.2355e-15i 3.))
;; (test-equal "+1.234e+15" (cat 1.2345e+15 10 3. 'sign))
(test-equal "string " (cat "string" -10))
(test-equal " STRING" (cat "string" 10 (list string-upcase)))
(test-equal " RING" (cat "string" 10 (list string-upcase) '(-2)))
(test-equal " STING" (cat "string" 10 `(,string-upcase) '(2 3)))
(test-equal "GNIRTS" (cat "string" `(,string-reverse ,string-upcase)))
(test-equal " a" (cat #\a 10))
(test-equal " symbol" (cat 'symbol 10))
(test-equal "#(#\\a \"str\" s)" (cat '#(#\a "str" s)))
(test-equal "(#\\a \"str\" s)" (cat '(#\a "str" s)))
(test-equal '("(#\\a \"str\" s)" "(#\\a \"str\" s)")
(value-and-output (cat '(#\a "str" s) #t)))
(test-equal '("(#\\a \"str\" s)" "(#\\a \"str\" s)")
(value-and-output (cat '(#\a "str" s) (current-output-port))))
(test-equal "3s \"str\"" (cat 3 (cat 's) " " (cat "str" write)))
(test-equal '("3s \"str\"" "3s \"str\"")
(value-and-output (cat 3 #t (cat 's) " " (cat "str" write))))
(test-equal '("3s \"str\"" "s3s \"str\"")
(value-and-output (cat 3 #t (cat 's #t) " " (cat "str" write)))))
))
| true |
ffbca6adb977def17c1fec6a6da8f7c2e4a4de48 | f0916dac3f6f73d721db09e137ce6201efd027d2 | /sitelib/security/signature.scm | 60a52920a07ffd6d5ae3efb140ddb80d82f33dd2 | [
"BSD-3-Clause",
"LicenseRef-scancode-other-permissive",
"MIT",
"BSD-2-Clause"
] | permissive | christoff-buerger/sagittarius-scheme | b8b9289650b4245c1f4d8d92d03d6d8e8e0faacf | f2ac5bbc48a65ca89f036000e5a658a429e0a8b9 | refs/heads/master | 2021-11-12T12:26:17.738912 | 2021-10-28T10:06:47 | 2021-10-28T10:06:47 | 243,363,196 | 0 | 0 | NOASSERTION | 2020-02-26T20:52:02 | 2020-02-26T20:52:01 | null | UTF-8 | Scheme | false | false | 11,376 | scm | signature.scm | ;;; -*- mode:scheme; coding:utf-8; -*-
;;;
;;; security/signature.scm - Cryptographic Signature
;;;
;;; Copyright (c) 2021 Takashi Kato <[email protected]>
;;;
;;; Redistribution and use in source and binary forms, with or without
;;; modification, are permitted provided that the following conditions
;;; are met:
;;;
;;; 1. Redistributions of source code must retain the above copyright
;;; notice, this list of conditions and the following disclaimer.
;;;
;;; 2. Redistributions in binary form must reproduce the above copyright
;;; notice, this list of conditions and the following disclaimer in the
;;; documentation and/or other materials provided with the distribution.
;;;
;;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
;;; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
;;; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
;;; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
;;; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
;;; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
;;; TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
;;; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
;;; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;;;
#!nounbound
(library (security signature)
(export algorithm-identifier->signature-verifier-provider
algorithm-identifier->signature-signer-provider
;; named verifiers
*rsa/sha1-verifier-provider*
*rsa/sha256-verifier-provider*
*rsa/sha384-verifier-provider*
*rsa/sha512-verifier-provider*
*rsa/sha224-verifier-provider*
*rsa/sha512/224-verifier-provider*
*rsa/sha512/256-verifier-provider*
*rsassa-pss-verifier-provider*
*ecdsa/sha1-verifier-provider*
*ecdsa/sha224-verifier-provider*
*ecdsa/sha256-verifier-provider*
*ecdsa/sha384-verifier-provider*
*ecdsa/sha512-verifier-provider*
*eddsa-verifier-provider*
;; named signers
*rsa/sha1-signer-provider*
*rsa/sha256-signer-provider*
*rsa/sha384-signer-provider*
*rsa/sha512-signer-provider*
*rsa/sha224-signer-provider*
*rsa/sha512/224-signer-provider*
*rsa/sha512/256-signer-provider*
*rsassa-pss-signer-provider*
*ecdsa/sha1-signer-provider*
*ecdsa/sha224-signer-provider*
*ecdsa/sha256-signer-provider*
*ecdsa/sha384-signer-provider*
*ecdsa/sha512-signer-provider*
*eddsa-signer-provider*
)
(import (rnrs)
(clos core)
(crypto)
(math)
(asn.1)
(rsa pkcs :10))
(define *rsassa-pss-oid* "1.2.840.113549.1.1.10")
(define (algorithm-identifier->signature-verifier-provider aid)
(define oid (algorithm-identifier-id aid))
(cond ((string=? oid *rsassa-pss-oid*)
(let-values (((algo mgf salt-len) (parse-rsassa-pss-parameter aid)))
;; wrap it
(lambda (public-key . parameters)
(apply *rsassa-pss-verifier-provider* public-key
:digest algo
:mgf mgf
:salt-length salt-len
parameters))))
((assp (lambda (known-oid) (string=? oid known-oid))
*provider-oid-map*) => cadr)
(else
(assertion-violation 'algorithm-identifier->signature-verifier-provider
"Not supported OID" oid))))
(define (algorithm-identifier->signature-signer-provider aid)
(define oid (algorithm-identifier-id aid))
(cond ((string=? oid *rsassa-pss-oid*)
(let-values (((algo mgf salt-len) (parse-rsassa-pss-parameter aid)))
;; wrap it
(lambda (private-key . parameters)
(apply *rsassa-pss-signer-provider* private-key
:digest algo
:mgf mgf
:salt-length salt-len
parameters))))
((assp (lambda (known-oid) (string=? oid known-oid))
*provider-oid-map*) => caddr)
(else
(assertion-violation 'algorithm-identifier->signature-signer-provider
"Not supported OID" oid))))
#|
RSASSA-PSS-params ::= SEQUENCE {
hashAlgorithm [0] HashAlgorithm DEFAULT
sha1Identifier,
maskGenAlgorithm [1] MaskGenAlgorithm DEFAULT
mgf1SHA1Identifier,
saltLength [2] INTEGER DEFAULT 20,
trailerField [3] INTEGER DEFAULT 1 }
|#
(define (parse-rsassa-pss-parameter aid)
(define param (algorithm-identifier-parameters aid))
(define (find-tag param tag)
(cond ((asn.1-collection-find-tag param tag) =>
(lambda (tag) (slot-ref tag 'obj)))
(else #f)))
(unless (is-a? param <asn.1-sequence>)
(assertion-violation 'parse-rsassa-pss-parameter
"Invalid rsassa-pss parameter" aid))
(let ((hash-func-aid (make-algorithm-identifier (find-tag param 0)))
(mask-gen-func-aid (make-algorithm-identifier (find-tag param 1)))
(salt-len (find-tag param 2)))
(unless (string=? (algorithm-identifier-id mask-gen-func-aid)
"1.2.840.113549.1.1.8")
(assertion-violation 'parse-rsassa-pss-parameter
"Unknown MGF OID" mask-gen-func-aid))
(values (oid->hash-algorithm (algorithm-identifier-id hash-func-aid))
mgf-1
(der-integer->integer salt-len))))
;;; verifier providers
(define (make-rsa-verifier-provider digest verify)
(lambda (public-key . parameter)
(define cipher (make-cipher RSA public-key))
(define algo (hash-algorithm digest))
(lambda (message signnature)
(apply cipher-verify cipher message signnature
:hash algo :verify verify parameter))))
(define *rsa/sha1-verifier-provider*
(make-rsa-verifier-provider SHA-1 pkcs1-emsa-v1.5-verify))
(define *rsa/sha256-verifier-provider*
(make-rsa-verifier-provider SHA-256 pkcs1-emsa-v1.5-verify))
(define *rsa/sha384-verifier-provider*
(make-rsa-verifier-provider SHA-384 pkcs1-emsa-v1.5-verify))
(define *rsa/sha512-verifier-provider*
(make-rsa-verifier-provider SHA-512 pkcs1-emsa-v1.5-verify))
(define *rsa/sha224-verifier-provider*
(make-rsa-verifier-provider SHA-224 pkcs1-emsa-v1.5-verify))
(define *rsa/sha512/224-verifier-provider*
(make-rsa-verifier-provider SHA-512/224 pkcs1-emsa-v1.5-verify))
(define *rsa/sha512/256-verifier-provider*
(make-rsa-verifier-provider SHA-512/256 pkcs1-emsa-v1.5-verify))
(define (*rsassa-pss-verifier-provider* public-key
:key (digest SHA-1)
:allow-other-keys opts)
(define cipher (make-cipher RSA public-key))
(define algo (hash-algorithm digest))
(lambda (message signnature)
(apply cipher-verify cipher message signnature
:hash algo :verify pkcs1-emsa-pss-verify opts)))
(define (make-ecdsa-verifier-provider digest)
(lambda (public-key . opts)
(define cipher (make-cipher ECDSA public-key))
(lambda (message signature)
(apply cipher-verify cipher message signature :hash digest opts))))
(define *ecdsa/sha1-verifier-provider* (make-ecdsa-verifier-provider SHA-1))
(define *ecdsa/sha224-verifier-provider* (make-ecdsa-verifier-provider SHA-224))
(define *ecdsa/sha256-verifier-provider* (make-ecdsa-verifier-provider SHA-256))
(define *ecdsa/sha384-verifier-provider* (make-ecdsa-verifier-provider SHA-384))
(define *ecdsa/sha512-verifier-provider* (make-ecdsa-verifier-provider SHA-512))
(define (*eddsa-verifier-provider* public-key . opts)
(define cipher (apply make-cipher EdDSA public-key opts))
(lambda (message signature)
;; it's a bit ugly to handle context
(apply cipher-verify cipher message signature opts)))
;; signer providers
(define (make-rsa-signer-provider digest encode)
(lambda (private-key . parameter)
(define cipher (make-cipher RSA private-key))
(define algo (hash-algorithm digest))
(lambda (message)
(apply cipher-signature cipher message
:hash algo :encode encode parameter))))
(define *rsa/sha1-signer-provider*
(make-rsa-signer-provider SHA-1 pkcs1-emsa-v1.5-encode))
(define *rsa/sha256-signer-provider*
(make-rsa-signer-provider SHA-256 pkcs1-emsa-v1.5-encode))
(define *rsa/sha384-signer-provider*
(make-rsa-signer-provider SHA-384 pkcs1-emsa-v1.5-encode))
(define *rsa/sha512-signer-provider*
(make-rsa-signer-provider SHA-512 pkcs1-emsa-v1.5-encode))
(define *rsa/sha224-signer-provider*
(make-rsa-signer-provider SHA-224 pkcs1-emsa-v1.5-encode))
(define *rsa/sha512/224-signer-provider*
(make-rsa-signer-provider SHA-512/224 pkcs1-emsa-v1.5-encode))
(define *rsa/sha512/256-signer-provider*
(make-rsa-signer-provider SHA-512/256 pkcs1-emsa-v1.5-encode))
(define (*rsassa-pss-signer-provider* private-key
:key (digest SHA-1)
:allow-other-keys opts)
(define cipher (make-cipher RSA private-key))
(define algo (hash-algorithm digest))
(lambda (message)
(apply cipher-signature cipher message
:hash algo :encode pkcs1-emsa-pss-encode opts)))
(define (make-ecdsa-signer-provider digest)
(lambda (private-key . opts)
(define cipher (make-cipher ECDSA private-key))
(lambda (message)
(apply cipher-signature cipher message :hash digest opts))))
(define *ecdsa/sha1-signer-provider* (make-ecdsa-signer-provider SHA-1))
(define *ecdsa/sha224-signer-provider* (make-ecdsa-signer-provider SHA-224))
(define *ecdsa/sha256-signer-provider* (make-ecdsa-signer-provider SHA-256))
(define *ecdsa/sha384-signer-provider* (make-ecdsa-signer-provider SHA-384))
(define *ecdsa/sha512-signer-provider* (make-ecdsa-signer-provider SHA-512))
(define (*eddsa-signer-provider* private-key . opts)
(define cipher (apply make-cipher EdDSA private-key opts))
(lambda (message)
(apply cipher-signature cipher message opts)))
(define *provider-oid-map*
`(;; RSA PKCS v1.5
("1.2.840.113549.1.1.5" ,*rsa/sha1-verifier-provider*
,*rsa/sha1-signer-provider*)
("1.2.840.113549.1.1.11" ,*rsa/sha256-verifier-provider*
,*rsa/sha256-signer-provider*)
("1.2.840.113549.1.1.12" ,*rsa/sha384-verifier-provider*
,*rsa/sha384-signer-provider*)
("1.2.840.113549.1.1.13" ,*rsa/sha512-verifier-provider*
,*rsa/sha512-signer-provider*)
("1.2.840.113549.1.1.14" ,*rsa/sha224-verifier-provider*
,*rsa/sha224-signer-provider*)
("1.2.840.113549.1.1.15" ,*rsa/sha512/224-verifier-provider*
,*rsa/sha512/224-signer-provider*)
("1.2.840.113549.1.1.16" ,*rsa/sha512/256-verifier-provider*
,*rsa/sha512/256-signer-provider*)
;; RSA PSSSSA-PSS
(,*rsassa-pss-oid* ,*rsassa-pss-verifier-provider*
,*rsassa-pss-signer-provider*)
;; DSA
;; ECDSA
("1.2.840.10045.4.1" ,*ecdsa/sha1-verifier-provider*
,*ecdsa/sha1-signer-provider*)
("1.2.840.10045.4.3.1" ,*ecdsa/sha224-verifier-provider*
,*ecdsa/sha224-signer-provider*)
("1.2.840.10045.4.3.2" ,*ecdsa/sha256-verifier-provider*
,*ecdsa/sha256-signer-provider*)
("1.2.840.10045.4.3.3" ,*ecdsa/sha384-verifier-provider*
,*ecdsa/sha384-signer-provider*)
("1.2.840.10045.4.3.4" ,*ecdsa/sha512-verifier-provider*
,*ecdsa/sha512-signer-provider*)
;; EdDSA
("1.3.101.112" ,*eddsa-verifier-provider*
,*eddsa-signer-provider*)
("1.3.101.113" ,*eddsa-verifier-provider*
,*eddsa-signer-provider*)
))
)
| false |
ccce39b024bb25ab31365b25eb05a0250339e557 | 0855447c3321a493efa9861b3713209e37c03a4c | /g-point/c/c-rt.ss | 8683426b7631872f3f8a9b61589ea66878da28e8 | [] | no_license | dasheng523/sicp | d04f30c50076f36928728ad2fe0da392dd0ae414 | 1c40c01e16853ad83b8b82130c2c95a5533875fe | refs/heads/master | 2021-06-16T20:15:08.281249 | 2021-04-02T04:09:01 | 2021-04-02T04:09:01 | 190,505,284 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 6,903 | ss | c-rt.ss |
(define rt-apply
(lambda (rt reader)
(rt reader)))
(define rt-apply-reset
(lambda (rt reader)
(rt-apply (fail-reset rt) reader)))
(define default-reader
(lambda (p)
(let ([position (file-position p)])
(lambda (x)
(record-case
x
[(reset-reader!) () (file-position p position)]
[(the-input-port) () p])))))
(define reset-reader!
(lambda (reader)
(reader '(reset-reader!))))
(define the-input-port
(lambda (reader)
(reader '(the-input-port))))
(define copy-reader
(lambda (reader)
(default-reader (the-input-port reader))))
(define fail-reset
(lambda (rt)
(lambda (reader)
(let ([reader (copy-reader reader)])
(let ([rs (rt-apply rt reader)])
(unless rs (reset-reader! reader))
rs)))))
(define fetch-word
(lambda (reader)
(read (the-input-port reader))))
(define fetch-char
(lambda (reader)
(read-char (the-input-port reader))))
(define peek
(lambda (rt)
(lambda (reader)
(let ([reader (copy-reader reader)])
(let ([rs (rt-apply rt reader)])
(reset-reader! reader)
rs)))))
(define the-empty-rt
(lambda (reader) '()))
(define rt-not
(lambda (rt)
(lambda (reader)
(let ([rs (rt-apply-reset rt reader)])
(if rs #f #t)))))
(define (rt-or . parterns)
(lambda (reader)
(if (null? parterns)
#f
(let ([rs (rt-apply-reset (car parterns) reader)])
(if rs
rs
(rt-apply-reset (apply rt-or (cdr parterns)) reader))))))
;; 依次查询模式,如果得到#f,就返回#f,直到最后一个模式
(define (rt-and . parterns)
(lambda (reader)
(cond [(null? parterns) #t]
[(null? (cdr parterns))
(rt-apply-reset (car parterns) reader)]
[else
(let ([rs (rt-apply-reset (car parterns) reader)])
(if rs
(rt-apply-reset (apply rt-and (cdr parterns)) reader)
#f))])))
(define-syntax delay-rt
(syntax-rules ()
[(_ rt)
(delay rt)]))
(define force-rt
(lambda (rt)
(lambda (reader)
(rt-apply-reset (force rt) reader))))
(define-syntax lazy-rt
(syntax-rules ()
[(_ rt)
(force-rt (delay-rt rt))]))
(define rt-if
(case-lambda
[(pred then else)
(lambda (reader)
(if (rt-apply-reset pred reader)
(rt-apply-reset then reader)
(if else
(rt-apply-reset else reader)
#f)))]
[(pred then)
(rt-if pred then #f)]))
(define result-handler
(lambda (rt handler)
(lambda (reader)
(handler (rt-apply rt reader)))))
(define rt-check
(lambda (rt checker)
(result-handler
rt
(lambda (rs)
(if (checker rs) rs #f)))))
(define cons-rt
(lambda (rt rest)
(lambda (reader)
(let ([rs (rt-apply-reset rt reader)])
(if rs
(let ([rests (rt-apply-reset rest reader)])
(if rests
(cons rs rests)
#f))
#f)))))
;; 支持二进制,八进制,十进制,十六进制,正负
(define rt-number
(letrec* ([fetch-number-list
(rt-if (rt-check (peek fetch-char)
(lambda (c)
(and (not (eof-object? c))
(char-numeric? c))))
(cons-rt fetch-char
(rt-or (lazy-rt fetch-number-list)
(lambda (reader) '())))
#f)]
[rt-oct
(result-handler
fetch-number-list
(lambda (rs)
(if rs
(string->number
(list->string
(if (eq? #\0 (car rs))
(append (list #\# #\o)
(cdr rs))
rs)))
#f)))]
[rt-bin
(result-handler
(rt-and (rt-fetch-the-char #\0)
(rt-or (rt-fetch-the-char #\b)
(rt-fetch-the-char #\B))
fetch-number-list)
(lambda (rs)
(if rs
(string->number
(list->string
(append (list #\# #\b) rs)))
#f)))]
[rt-hex
(result-handler
(rt-and (rt-fetch-the-char #\0)
(rt-or (rt-fetch-the-char #\x)
(rt-fetch-the-char #\X))
fetch-number-list)
(lambda (rs)
(if rs
(string->number
(list->string
(append (list #\# #\x) rs)))
#f)))]
[rt-com (rt-or rt-hex rt-bin rt-oct)])
rt-com))
(define rt-eof
(rt-check fetch-char eof-object?))
(define rt-identifier
(rt-and
(rt-check (peek fetch-char)
(lambda (c)
(or (char-alphabetic? c)
(eq? #\_ c))))
fetch-word))
(define rt-whitespace
(rt-and
(rt-check (peek fetch-char)
char-whitespace?)
fetch-char))
(define rt-punctuationm
(rt-if (rt-and (rt-not (peek rt-number))
(rt-not (peek rt-identifier))
(rt-not (peek rt-whitespace)))
fetch-char))
(define rt-fetch-the-char
(lambda (char)
(rt-and
(rt-check (peek fetch-char)
(lambda (c) (eq? c char)))
fetch-char)))
(define rt-fetch-the-word
(lambda (w)
(rt-and
(rt-check (peek fetch-word)
(lambda (c) (eq? c w)))
fetch-word)))
(define rt-space
(rt-fetch-the-char #\space))
(define rt-word
(rt-or
rt-identifier
rt-number
rt-punctuationm))
(define (rt-sequence . rts)
(lambda (reader)
(if (null? rts)
'()
(let ([rs (rt-apply-reset (car rts) reader)])
(if rs
(let ([rest (rt-apply-reset
(apply rt-sequence (cdr rts)) reader)])
(if rest
(cons rs rest)
#f))
#f)))))
(define (rt-sequence . rts)
(if (null? rts)
the-empty-rt
(cons-rt (car rts)
(lazy-rt (apply rt-sequence (cdr rts))))))
(define repeat-until
(lambda (rt until)
(rt-if until
the-empty-rt
(cons-rt rt
(lazy-rt (repeat-until rt until))))))
(define repeat-before
(lambda (rt until)
(rt-if until
(lambda (reader) #f)
(cons-rt rt
(rt-or (lazy-rt (repeat-until rt until))
the-empty-rt)))))
(define skip-until
(lambda (skip rt)
(rt-if skip
(lazy-rt (skip-until skip rt))
rt)))
| true |
f9413b71f9233e05ea4702308ced136fa8df801f | a8216d80b80e4cb429086f0f9ac62f91e09498d3 | /lib/chibi/optimize/profile.scm | 7564eb93a345786d65be9ada9fef7fcc1b93df81 | [
"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 | 1,960 | scm | profile.scm |
(define (ref=? a b)
(or (eq? a b)
(and (ref? a) (ref? b)
(eq? (ref-name a) (ref-name b))
(eq? (car (ref-cell a)) (car (ref-cell b)))
(eq? (cdr (ref-cell a)) (cdr (ref-cell b))))))
(define profile-cells '())
(define (profile-get-cell f)
(or (assoc f profile-cells ref=?)
(let ((cell (cons f 0)))
(set! profile-cells (cons cell profile-cells))
cell)))
(define (profile-reset)
(for-each (lambda (x) (set-cdr! x 0)) profile-cells))
(define (profile-report)
(define (report-op op)
(match op
(($ Ref name (p . (and ($ Lam lam-name) f)))
(write name)
(cond
((not (eq? p name))
(display " ")
(write p)))
(cond
((lambda-source f)
(display " [") (write (lambda-source f)) (display "]"))))
(($ Ref name (_ . f))
(write name) (display " (") (write f) (display ")"))
(else
(write op))))
(let ((ls (filter (lambda (x) (> (cdr x) 0))
profile-cells)))
(for-each (lambda (x)
(write (cdr x)) (display ": ")
(report-op (car x)) (newline))
(sort ls > cdr))))
(define (optimize-profile ast)
(let-syntax ((opt (syntax-rules () ((opt x) (optimize-profile x)))))
(match ast
(($ Set ref value)
(set-value-set! ast (opt value))
ast)
(($ Cnd test pass fail)
(make-cnd (opt test) (opt pass) (opt fail)))
(($ Seq ls)
(make-seq (map optimize-profile ls)))
(($ Lam name params body)
(lambda-body-set! ast (opt body))
ast)
((($ Ref name cell) args ...)
(make-seq (list (list increment-cdr!
(make-lit (profile-get-cell (car ast))))
(cons (car ast) (map optimize-profile args)))))
((app ...)
(map optimize-profile app))
(else
ast))))
(register-lambda-optimization! optimize-profile)
| false |
a111d79d65d01ca1887641895103ceb0d50e125b | 3453419571c01ee4e96cc30e8ff256a0bb2a4f5e | /parsing-combinators.scm | 109c20c268fbaa1d3fd6c0d0c95e45dbcd54b595 | [] | no_license | pbaille/parsing-combinators | bac66451f5c49df903223c7d7f6cbf3342acb740 | 98aa5dfdc3fd9b6cdc823d50cfdb096e9848f73e | refs/heads/master | 2020-03-18T13:04:34.401334 | 2018-05-25T07:53:51 | 2018-05-25T07:53:51 | 134,759,804 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 6,354 | scm | parsing-combinators.scm | (load-relative "utils.scm")
(load-relative "km.scm")
(define (parser . opts)
(km 'parser? #t (apply km opts)))
(define (parser? x)
(and (km? x)
(kmget x 'parser?)))
;; accessessors -------
(define (parser-id x)
(and (parser? x)
(kmget x 'parser-id)))
(define (parser-id= p id)
(equal? id (parser-id p)))
(define (get-pparam p k)
(kmget> p 'params k))
;; utils -------------
(define (dop p x match fail)
((kmget p 'parser-impl) x match fail))
(define (testp p . xs)
(map (λ (x) (dop p x identity (λ _ 'fail)))
xs))
;; syntax ------------
(define-syntax λp
(syntax-rules ()
((_ . form)
(parser 'parser-impl (λ . form)))))
(define-syntax parametric-parser
(er-macro-transformer
(lambda (exp _ _)
(let* ((all (cdr exp))
(form (car all))
(id (car form))
(body (cadr all))
(opts (cddr all))
(args (cdr form))
(argsyms (cdr (proper! form))))
`(lambda ,args
(km ,body
'params
(km ,@(interleave (map (lambda (x) `(quote ,x)) argsyms) argsyms))
'parser-id ',id
,@opts))))))
(define-syntax defparser
(er-macro-transformer
(lambda (exp _ _)
(let* ((form (cadr exp))
(parametric? (pair? form))
(id (if parametric? (car form) form))
(predsym
(string->symbol
(string-append (symbol->string id) "?"))))
`(begin
(define (,predsym p) (parser-id= p ',id))
,(if parametric?
`(define ,id (parametric-parser ,@(cdr exp)))
`(define ,id (km ,(caddr exp) 'parser-id ',id ,@(cdddr exp)))))))))
(comment
"another way"
(define (mk-pparser id args body opts)
(let ((argsyms (proper! args)))
`(lambda ,args
(km ,body
'params
(km ,@(interleave (map (lambda (x) `(quote ,x)) argsyms) argsyms))
'parser-id ,id
,@opts))))
(define-syntax pparser
(syntax-rules ()
((_ (id . args) body . opts)
(mk-pparser id args body opts))))
;; doesn't work
(pparser
(mapp fn parser)
(λp (x match fail)
(dop parser x
(compose fn match)
fail))
'foo 'bar))
;; primitives --------
(defparser idp
(λp (x match _) (match x)))
(defparser neverp
(λp (x _ fail) (fail x)))
(defparser (mapp fn parser)
(λp (x match fail)
(dop parser x
(compose fn match)
fail)))
(defparser (constp value)
(λp (x match fail)
(if (equal? x value)
(match x)
(fail x))))
(defparser (predp pred)
(λp (x match fail)
(if (pred x)
(match x)
(fail x))))
(begin
(define pairp (predp pair?))
(define nump (predp number?))
(define symp (predp symbol?))
(define stringp (predp string?)))
(defparser (orp . ps)
(if (null? ps)
neverp
(λp (x match fail)
(dop (car ps) x
match
(λ (_)
(dop (apply orp (cdr ps))
x match fail))))))
(defparser (andp . ps)
(if (null? ps)
idp
(λp (x match fail)
(dop (car ps) x
(λ (_)
(dop (apply andp (cdr ps))
x match fail))
fail))))
(defparser (consp p1 p2)
(andp
pairp
(λp (x match fail)
(dop p1 (car x)
(λ (m)
(dop p2 (cdr x)
(λ (n) (match (cons m n)))
fail))
fail))))
(defparser nilp (constp '()))
(defparser (ifp p1 p2 p3)
(λp (x match fail)
(dop p1 x
(λ _ (dop p2 x match fail))
(λ _ (dop p3 x match fail)))))
;; others ----------
(define (carp p)
(and (parser-id= p 'consp)
(get-pparam p 'p1)))
(define (cdrp p)
(and (parser-id= p 'consp)
(get-pparam p 'p2)))
(define (listp . ps)
(if (null? ps)
nilp
(consp (car ps) (apply listp (cdr ps)))))
(define (cons.p . ps)
(cond
((null? ps) nilp)
((null? (cdr ps)) (car ps))
(else (consp (car ps) (apply cons.p (cdr ps))))))
(define (catp2 l1 l2)
(cond
((nilp? l1) l2)
((nilp? l2) l1)
(else
(consp (carp l1) (catp2 (cdrp l1) l2)))))
(define (catp . ps)
(reduce catp2 ps))
(define (->p . xs)
(if (null? xs)
idp
(λp (x match fail)
(dop (car xs) x
(λ (y) (dop (apply ->p (cdr xs)) y match fail))
fail))))
(define-syntax condp
(syntax-rules ()
((_) neverp)
((_ b1 . bs)
(orp (andp . b1) (condp . bs)))))
(define-syntax condp>
(syntax-rules ()
((_) neverp)
((_ b1 . bs)
(orp (->p . b1) (condp . bs)))))
(define (repp n p)
(cond
((zero? n) nilp)
((positive? n)
(consp p (repp (- n 1) p)))))
(define (rep p min max)
(apply orp
(map (λ (n) (repp n p))
(range max (- min 1)))))
(begin
;; basics
(testp (constp "42") "42")
(testp nump 'a 1)
(define gt10p (predp (λ (x) (> x 10))))
(define forty2p (constp 42))
(testp forty2p 41 42)
(define forty2p_
(mapp (λ _ 'forty-two) forty2p))
(testp forty2p_ 41 42)
(testp (andp nump gt10p)
1 10 34 67)
(testp (orp nump (predp string?))
1 "aze" 'zer)
(testp (->p nump forty2p_ (predp symbol?))
42)
;; cons.p
(testp
(cons.p
nump
nump
(predp pair?))
'(1 2 3))
;; ifp
(testp
(ifp nump
forty2p_
(->p (predp symbol?) (constp 'foo)))
'foo 42 'a 1)
;; list
(testp nilp '())
(testp (listp) '())
(testp (listp (predp number?)) '(1))
(testp (listp (predp number?) (predp number?)) '(1 2))
(testp
(listp (predp number?) (predp symbol?))
'(1 foo) '(42 35) '(aze 1) '(qsd dfg))
;; condp
(testp (consp forty2p_ gt10p)
(cons 42 11) (cons 42 1))
(testp
(condp
(nump forty2p_)
(nump gt10p)
((predp string?) (constp "42") (λp _ "mtf42!!!")))
42 11 2 "23" "42")
;; catp
(testp
(catp
(listp nump nump)
(listp gt10p gt10p)
(listp symp))
'(1 2 11 12 aze))
;; rep
(testp (repp 4 nump)
'(1 2 3 4))
(testp
(catp
(repp 2 nump)
(repp 2 symp))
'(1 2 a b)
'(1 a 2 b))
(testp
(rep nump 2 5)
'(1 2)
'(1 2 3)
'(1 2 3 5 6 7))
)
| true |
fd74f28bf9fea01db9c74ba7b71add1abcdab9af | e49f3e898ddab29f96617f0257c74ee45af302fa | /src/thread-tools.scm | 66936b31fb8b858b246924ee1351607ac5644f9f | [
"MIT"
] | permissive | Lattay/chicken-msgpack-rpc-client | 87e4700b65d0de63eea6fd03a3849388946c31ff | 194122b37ec8fcf2e93378a299212b8d4a979dcc | refs/heads/master | 2022-05-19T14:03:04.316611 | 2022-05-08T13:38:15 | 2022-05-08T13:38:15 | 250,248,001 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 649 | scm | thread-tools.scm | (import srfi-18)
(define (timestamp)
(time->seconds (current-time)))
(define (sleep-til! time)
(thread-sleep! (- time (timestamp))))
; allow locking a mutex for a given body but always unlocking it even in case of exception
; be careful not to use call/cc within the body, it may break everything
(define-syntax with-lock
(syntax-rules ()
((with-lock lock body ...)
(begin
(mutex-lock! lock)
(condition-case
(let ((res (begin
body ...)))
(mutex-unlock! lock)
res)
(e ()
(begin
(mutex-unlock! lock)
(raise e))))))))
| true |
d326d7e0ba2c0dd8917ebcb6fd0cf481e03c3b66 | f08220a13ec5095557a3132d563a152e718c412f | /logrotate/skel/usr/share/guile/2.0/language/scheme/spec.scm | e4cf55c4ceff218ff4a98492cc4e7bbd4df776da | [
"Apache-2.0"
] | permissive | sroettger/35c3ctf_chals | f9808c060da8bf2731e98b559babd4bf698244ac | 3d64486e6adddb3a3f3d2c041242b88b50abdb8d | refs/heads/master | 2020-04-16T07:02:50.739155 | 2020-01-15T13:50:29 | 2020-01-15T13:50:29 | 165,371,623 | 15 | 5 | Apache-2.0 | 2020-01-18T11:19:05 | 2019-01-12T09:47:33 | Python | UTF-8 | Scheme | false | false | 2,654 | scm | spec.scm | ;;; Guile Scheme specification
;; Copyright (C) 2001, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
;;;; License as published by the Free Software Foundation; either
;;;; version 3 of the License, or (at your option) any later version.
;;;;
;;;; This library is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;;; Lesser General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU Lesser General Public
;;;; License along with this library; if not, write to the Free Software
;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;;; Code:
(define-module (language scheme spec)
#:use-module (system base compile)
#:use-module (system base language)
#:use-module (language scheme compile-tree-il)
#:use-module (language scheme decompile-tree-il)
#:export (scheme))
;;;
;;; Language definition
;;;
(define-language scheme
#:title "Scheme"
#:reader (lambda (port env)
;; Use the binding of current-reader from the environment.
;; FIXME: Handle `read-options' as well?
((or (and=> (and=> (module-variable env 'current-reader)
variable-ref)
fluid-ref)
read)
port))
#:compilers `((tree-il . ,compile-tree-il))
#:decompilers `((tree-il . ,decompile-tree-il))
#:evaluator (lambda (x module) (primitive-eval x))
#:printer write
#:make-default-environment
(lambda ()
;; Ideally we'd duplicate the whole module hierarchy so that `set!',
;; `fluid-set!', etc. don't have any effect in the current environment.
(let ((m (make-fresh-user-module)))
;; Provide a separate `current-reader' fluid so that
;; compile-time changes to `current-reader' are
;; limited to the current compilation unit.
(module-define! m 'current-reader (make-fluid))
;; Default to `simple-format', as is the case until
;; (ice-9 format) is loaded. This allows
;; compile-time warnings to be emitted when using
;; unsupported options.
(module-set! m 'format simple-format)
m)))
| false |
de2e32bdbea4118d50066c66863a741c8e120e02 | 0f18ba0b9797529c81b050d456cc8c65edff8774 | /qq_in_lisp.scm | 9bf18cc3fdf43d9b4b9d17694d0fa10d4cf0e9dc | [] | no_license | troyp/papers-code | 4469399e41751062926c5fa3896b9ba7583abccd | d8dab6567cf20cfd642bf72df45c6c0c5f9df33e | refs/heads/master | 2022-11-21T04:09:28.737541 | 2020-07-21T13:53:08 | 2020-07-21T13:53:08 | 281,412,267 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 1,402 | scm | qq_in_lisp.scm | #lang scheme
;; ****************************
;; * *
;; * QUASIQUOTATION IN LISP *
;; * Alan Bawden *
;; * *
;; ****************************
(define n 10)
(define v (make-vector n))
(define a 'v)
(define initval 3)
(define (initarray1-expr array-name array-size init-val)
(list 'do '((i 0 (+ 1 i)))
(list (list '>= 'i 'array-size))
(list 'vector-set! array-name
'i
init-val)))
;; using quasiquotation...
(define (initarray-expr array-name array-size init-val)
`(do ((i 0 (+ 1 i)))
((>= i ,array-size))
(vector-set! ,array-name
i
,init-val)))
;; initarray: args should be passed in quoted,
;; eg. (initarray 'a 'n 'initval)
(define (initarray . args)
(eval (eval (cons initarray-expr args))))
(define (compare-to var val)
`(cond ((not (and (real? ,var) (real? ',val))) #f)
((< ,var ',val) 1)
((= ,var ',val) 0)
((> ,var ',val) -1)
(else 'error)))
;; ===================
;; s3.1: Splicing.
;; ===================
;; Utility Procs...
;; call-with-names: calls function on quoted arguments,
;; eg. (call-with-names initarray a n initval) ==> (initarray 'a 'n 'initarray)
(define-syntax call-with-names
(syntax-rules ()
((_ f arg1 arg2 ...)
(f (quote arg1) (quote arg2) ...))))
| true |
564049ac7ab2d654f9f036367d2fc6ee9274fb69 | 4d6d3bc9bc33bcf83f3bad1cca510adceaa7ba42 | /Plan/Exercise/ex.rkt | 7e5c42e04e2decc445fff9ecbc1e14c357675991 | [] | no_license | mfelleisen/RacketSchool | fafaf20d50e1a34976d4514e4e4e6fa1f80c8cae | ada599f31d548a538a37d998b32d80aa881d699a | refs/heads/master | 2020-04-05T11:47:42.700262 | 2019-04-19T12:51:27 | 2019-04-19T12:51:27 | 81,274,050 | 14 | 1 | null | null | null | null | UTF-8 | Scheme | false | false | 834 | rkt | ex.rkt | #lang scheme/base
(require scribble/manual
scribble/core
scribble/decode
2htdp/image
"counter.ss")
(provide exercise Exref exref eop)
(define eop (rectangle 3 10 'solid 'black)#;(image/plain "Images/qed.png"))
(define (exercise tag . content)
(nested-flow
(make-style #f '()) ;; #f ==> blockquote?
(decode-flow
(append
(list (exercise-target tag) ". ")
content
(list " " eop)))))
(define exercises (new-counter "exercise"))
(define (exercise-target tag)
(counter-target exercises tag (bold "Exercise")))
(define (Exref tag)
(make-element #f (list (counter-ref exercises tag "Exercise"))))
(define (exref tag [loud #f])
(if loud
(make-element #f (list (silent-counter-ref exercises tag loud)))
(make-element #f (list (counter-ref exercises tag "exercise")))))
| false |
6b7400acb7d3c4f65ead93f257ede0ea32c06b06 | 46244bb6af145cb393846505f37bf576a8396aa0 | /sicp/2_5.scm | 6fb914a49031d2981a13bd539223636e79aca438 | [] | no_license | aoeuidht/homework | c4fabfb5f45dbef0874e9732c7d026a7f00e13dc | 49fb2a2f8a78227589da3e5ec82ea7844b36e0e7 | refs/heads/master | 2022-10-28T06:42:04.343618 | 2022-10-15T15:52:06 | 2022-10-15T15:52:06 | 18,726,877 | 4 | 3 | null | null | null | null | UTF-8 | Scheme | false | false | 718 | scm | 2_5.scm | #lang racket
; Exercise 2.5. Show that we can represent pairs of nonnegative integers
; using only numbers and arithmetic operations if we represent the pair a and b
; as the integer that is the product 2a 3b.
; Give the corresponding definitions of the procedures cons, car, and cdr.
(define (pow b e)
(if (= e 0)
1
(* b (pow b (- e 1)))))
(define (cons a b)
(* (pow 2 a)
(pow 3 b)))
(define (remain-wrapper denom num rst)
(if (and (= 0 (remainder denom num))
(> denom 0))
(remain-wrapper (/ denom num) num (+ rst 1))
rst))
(define (car pr)
(remain-wrapper pr 2 0))
(define (cdr pr)
(remain-wrapper pr 3 0))
(car (cons 0 4))
(car (cons 4 0))
(cdr (cons 2 5))
| false |
1a23f5b0717c5a248ff19f2dbc5e8913c596e5a5 | 58381f6c0b3def1720ca7a14a7c6f0f350f89537 | /Chapter 2/2.1/Ex2.01.scm | 1950d92fd6ead9a2b646496dadd7d4d10637167a | [] | no_license | yaowenqiang/SICPBook | ef559bcd07301b40d92d8ad698d60923b868f992 | c8a0228ebf66d9c1ddc5ef1fcc1d05d8684f090a | refs/heads/master | 2020-04-19T04:03:15.888492 | 2015-11-02T15:35:46 | 2015-11-02T15:35:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 448 | scm | Ex2.01.scm | #lang planet neil/sicp
(define (numer x) (car x))
(define (denom x) (cdr x))
;; XNOR is true when x and y have the same sign
(define (xnor x y)
(or (and x y)
(and (not x) (not y))))
(define (make-rat n d)
(let ((abs-n (abs n))
(abs-d (abs d)))
(if (xnor
(positive? n)
(positive? d))
(cons abs-n abs-d)
(cons (- abs-n) abs-d))))
(make-rat 2 3)
(make-rat 2 -3)
(make-rat -2 3)
(make-rat -2 -3)
| false |
db791e8624c71660d5663b59dfa02557a320b8b3 | 4bd59493b25febc53ac9e62c259383fba410ec0e | /Scripts/Task/hash-join/scheme/hash-join.ss | bb647d25d2b17fab115830a6ff32374817791030 | [] | no_license | stefanos1316/Rosetta-Code-Research | 160a64ea4be0b5dcce79b961793acb60c3e9696b | de36e40041021ba47eabd84ecd1796cf01607514 | refs/heads/master | 2021-03-24T10:18:49.444120 | 2017-08-28T11:21:42 | 2017-08-28T11:21:42 | 88,520,573 | 5 | 1 | null | null | null | null | UTF-8 | Scheme | false | false | 521 | ss | hash-join.ss | (use srfi-42)
(define ages '((27 Jonah) (18 Alan) (28 Glory) (18 Popeye) (28 Alan)))
(define nemeses '((Jonah Whales) (Jonah Spiders) (Alan Ghosts)
(Alan Zombies) (Glory Buffy)
(unknown nothing)))
(define hash (make-hash-table 'equal?))
(dolist (item ages)
(hash-table-push! hash (last item) (car item)))
(do-ec
(: person nemeses)
(:let name (car person))
(if (hash-table-exists? hash name))
(: age (~ hash name))
(print (list (list age name)
person)))
| false |
03343ad28185d49eba869967ab17ac40793059a2 | 880bb9d4ed95741e553d903238083f69b8fcfd84 | /srfi/r7rs/scheme/load.sls | fa8278d346ce27e42976fc8ec61fa7768731c375 | [
"MIT",
"CC0-1.0"
] | permissive | pre-srfi/r6rs-r7rs-compat | 8c16aa991f924fa14676e6298a82ff5e6651d14c | ac6ae78f59575b341b4848be23f3b867a795dd11 | refs/heads/master | 2023-01-23T20:28:08.748274 | 2020-12-07T19:41:54 | 2020-12-07T19:41:54 | 310,610,604 | 1 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 626 | sls | load.sls | ;; -*- mode: scheme; coding: utf-8 -*-
;; SPDX-License-Identifier: CC0-1.0
#!r6rs
(library (scheme load)
(export
load)
(import
(rnrs)
(only (akku-r7rs compat) interaction-environment eval)
(laesare reader))
(define load
(case-lambda
((fn)
(load fn (interaction-environment)))
((fn env)
(call-with-input-file fn
(lambda (p)
(let ((reader (make-reader p fn)))
(reader-mode-set! reader 'r7rs)
(let lp ()
(let ((x (read-datum reader)))
(unless (eof-object? x)
(eval x env)
(lp)))))))))))
| false |
b6d0ea8beb28527d898a743fc9be47c76eee6a34 | 4f17c70ae149426a60a9278c132d5be187329422 | /scheme/tests/racket-r6rs/io/ports.sls | 1b9337dbc38c76d4cd9bc1401074083b5be0ddc0 | [] | 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 | 29,829 | sls | ports.sls | #!r6rs
(library (yuni scheme tests racket-r6rs io ports)
(export run-io-ports-tests)
(import (yuni scheme r6rs)
(yuni scheme r6rs mutable-strings)
(yuni scheme tests racket-r6rs test))
(define-syntax test-transcoders
(syntax-rules ()
[(_ bytevector->string string->bytevector)
(begin
(test (bytevector->string #vu8(97 112 112 206 187 101)
(make-transcoder (utf-8-codec)))
"app\x03BB;e")
(test (bytevector->string #vu8(97 112 112 206 187 101)
(make-transcoder (latin-1-codec)))
"app\xCE;\xBB;e")
(test (bytevector->string #vu8(#xFE #xFF 0 97 0 112 0 112 #x3 #xBB 0 101)
(make-transcoder (utf-16-codec)))
"app\x03BB;e")
(test (bytevector->string #vu8(97 10 98 13 99 13 10 100 #o302 #o205 101
#o342 #o200 #o250 102 13 #o302 #o205 103)
(make-transcoder (utf-8-codec) 'none))
"a\nb\rc\r\nd\x85;e\x2028;f\r\x85;g")
(test (bytevector->string #vu8(97 10 98 13 99 13 10 100 #o302 #o205 101 #o342
#o200 #o250 102 13 #o302 #o205 103)
(make-transcoder (utf-8-codec) 'lf))
"a\nb\nc\nd\ne\nf\ng")
(test/exn (bytevector->string #vu8(97 112 112 206 101)
(make-transcoder (utf-8-codec) 'lf 'raise))
&i/o-decoding)
(test (string->bytevector "app\x03BB;e"
(make-transcoder (utf-8-codec)))
#vu8(97 112 112 206 187 101))
(test (string->bytevector "apple\x85;"
(make-transcoder (latin-1-codec)))
#vu8(97 112 112 108 101 #x85))
(test/alts (string->bytevector "app\x03BB;e"
(make-transcoder (utf-16-codec)))
;; Could be LE or BE (where BE is with or without BOM):
#vu8(#xFF #xFE 97 0 112 0 112 0 #xBB #x3 101 0)
#vu8(#xFE #xFF 0 97 0 112 0 112 #x3 #xBB 0 101)
#vu8(0 97 0 112 0 112 #x3 #xBB 0 101))
(test (string->bytevector "a\nb"
(make-transcoder (utf-8-codec) 'lf))
#vu8(97 10 98))
(test (string->bytevector "a\nb"
(make-transcoder (utf-8-codec) 'cr))
#vu8(97 13 98))
(test (string->bytevector "a\nb"
(make-transcoder (utf-8-codec) 'crlf))
#vu8(97 13 10 98))
(test (string->bytevector "a\nb"
(make-transcoder (utf-8-codec) 'nel))
#vu8(97 #o302 #o205 98))
(test (string->bytevector "a\nb"
(make-transcoder (utf-8-codec) 'ls))
#vu8(97 #o342 #o200 #o250 98))
(test (string->bytevector "a\nb"
(make-transcoder (utf-8-codec) 'crnel))
#vu8(97 13 #o302 #o205 98))
(test/exn (string->bytevector "a\x185;b" (make-transcoder (latin-1-codec) 'lf 'raise))
&i/o-encoding))]))
(define-syntax test-positions
(syntax-rules ()
[(_ make)
(begin
(let* ([p (make "custom"
(lambda (? start count) 0)
(lambda () 0)
#f
(lambda () 'ok))])
(test (port-has-port-position? p) #t)
(test (port-has-set-port-position!? p) #f)
(test (port-position p) 0)
(test/unspec (close-port p)))
(let* ([p (make "custom"
(lambda (? start count) 0)
#f
(lambda (pos) 'ok)
(lambda () 'ok))])
(test (port-has-port-position? p) #f)
(test (port-has-set-port-position!? p) #t)
(test/unspec (set-port-position! p 0))
(test/unspec (close-port p)))
(let* ([p (make "custom"
(lambda (? start count) 0)
#f
#f
(lambda () 'ok))])
(test (port-has-port-position? p) #f)
(test (port-has-set-port-position!? p) #f)
(test/unspec (close-port p))))]))
(define-syntax test-rw
(syntax-rules ()
[(_ v)
(test (let ([p (open-string-input-port
(call-with-string-output-port
(lambda (p) (put-datum p v))))])
(dynamic-wind
(lambda () 'ok)
(lambda () (get-datum p))
(lambda () (close-port p))))
v)]))
;; ----------------------------------------
(define (run-io-ports-tests)
(test (enum-set->list (file-options)) '())
(test (enum-set-member? 'no-create (file-options)) #f)
(test (enum-set-member? 'no-create (file-options no-create)) #t)
(test (enum-set-member? 'no-create (file-options no-fail)) #f)
(test (enum-set-member? 'no-fail (file-options no-fail)) #t)
(test (enum-set-member? 'no-truncate (file-options no-truncate)) #t)
(test (enum-set-member? 'no-truncate (file-options no-create no-fail no-truncate)) #t)
(test (enum-set-member? 'no-fail (file-options no-create no-fail no-truncate)) #t)
(test (enum-set-member? 'no-create (file-options no-create no-fail no-truncate)) #t)
(test (buffer-mode none) 'none)
(test (buffer-mode line) 'line)
(test (buffer-mode block) 'block)
(test (buffer-mode? 'none) #t)
(test (buffer-mode? 'line) #t)
(test (buffer-mode? 'block) #t)
(test (buffer-mode? 'point) #f)
(test/unspec (latin-1-codec))
(test/unspec (utf-8-codec))
(test/unspec (utf-16-codec))
(test (eol-style lf) 'lf)
(test (eol-style cr) 'cr)
(test (eol-style crlf) 'crlf)
(test (eol-style nel) 'nel)
(test (eol-style crnel) 'crnel)
(test (eol-style ls) 'ls)
(test (eol-style none) 'none)
(test (symbol? (native-eol-style)) #t)
(test (error-handling-mode ignore) 'ignore)
(test (error-handling-mode raise) 'raise)
(test (error-handling-mode replace) 'replace)
(test (transcoder-codec (make-transcoder (latin-1-codec))) (latin-1-codec))
(test (transcoder-codec (make-transcoder (utf-8-codec))) (utf-8-codec))
(test (transcoder-codec (make-transcoder (utf-16-codec))) (utf-16-codec))
(test (transcoder-eol-style (make-transcoder (utf-16-codec))) (native-eol-style))
(test (transcoder-error-handling-mode (make-transcoder (utf-16-codec))) 'replace)
(test (transcoder-codec (make-transcoder (utf-8-codec) 'nel)) (utf-8-codec))
(test (transcoder-eol-style (make-transcoder (utf-8-codec) 'nel)) 'nel)
(test (transcoder-error-handling-mode (make-transcoder (utf-8-codec) 'nel)) 'replace)
(test (transcoder-codec (make-transcoder (utf-8-codec) 'nel 'raise)) (utf-8-codec))
(test (transcoder-eol-style (make-transcoder (utf-8-codec) 'nel 'raise)) 'nel)
(test (transcoder-error-handling-mode (make-transcoder (utf-8-codec) 'nel 'raise)) 'raise)
(test/unspec (native-transcoder))
(test-transcoders bytevector->string
string->bytevector)
(test (eqv? (eof-object) (eof-object)) #t)
(test (eq? (eof-object) (eof-object)) #t)
;; ----------------------------------------
;; Check file creation and truncation:
(test/unspec
(if (file-exists? "io-tmp1")
(delete-file "io-tmp1")))
;; Don't create if 'no-create:
(test/exn (open-file-output-port "io-tmp1"
(file-options no-create))
&i/o-file-does-not-exist)
(test/exn (open-file-output-port "io-tmp1"
(file-options no-create no-fail))
&i/o-file-does-not-exist)
(test/exn (open-file-output-port "io-tmp1"
(file-options no-create no-truncate))
&i/o-file-does-not-exist)
(test/exn (open-file-output-port "io-tmp1"
(file-options no-create no-fail no-truncate))
&i/o-file-does-not-exist)
;; Create:
(let ([p (open-file-output-port "io-tmp1")])
(test (file-exists? "io-tmp1") #t)
(test (port? p) #t)
(test (binary-port? p) #t)
(test (textual-port? p) #f)
(test (output-port? p) #t)
(test (input-port? p) #f)
(test/unspec (flush-output-port p))
(test/unspec (close-port p)))
;; Don't re-create:
(test/exn (open-file-output-port "io-tmp1")
&i/o-file-already-exists)
(test/exn (open-file-output-port "io-tmp1" (file-options no-truncate))
&i/o-file-already-exists)
;; Re-open if 'no-create is specified:
(let ([p (open-file-output-port "io-tmp1"
(file-options no-create))])
(test/unspec (close-port p)))
;; Re-open if 'no-fail is specified:
(let ([p (open-file-output-port "io-tmp1"
(file-options no-fail))])
(test/unspec (close-port p)))
;; Create if 'no-fail is specified and it doesn't exist:
(test/unspec (delete-file "io-tmp1"))
(let ([p (open-file-output-port "io-tmp1"
(file-options no-fail no-truncate))])
(test/unspec (close-port p)))
(test/unspec (delete-file "io-tmp1"))
(let ([p (open-file-output-port "io-tmp1"
(file-options no-fail))])
(test/unspec (put-bytevector p #vu8(99 101 98 100)))
(test/unspec (close-port p)))
;; Check content:
(let ([p (open-file-input-port "io-tmp1")])
(test (port? p) #t)
(test (binary-port? p) #t)
(test (textual-port? p) #f)
(test (input-port? p) #t)
(test (output-port? p) #f)
(test (get-bytevector-n p 5) #vu8(99 101 98 100))
(test (port-eof? p) #t)
(test/unspec (close-port p)))
;; Check that 'no-truncate doesn't truncate:
(let ([p (open-file-output-port "io-tmp1"
(file-options no-fail no-truncate))])
(test/unspec (put-bytevector p #vu8(97)))
(test/unspec (close-port p)))
(let ([p (open-file-input-port "io-tmp1")])
(test (get-bytevector-n p 5) #vu8(97 101 98 100))
(test/unspec (close-port p)))
(let ([p (open-file-output-port "io-tmp1"
(file-options no-create no-truncate))])
(test/unspec (put-bytevector p #vu8(96)))
(test/unspec (close-port p)))
(let ([p (open-file-input-port "io-tmp1")])
(test (get-bytevector-n p 5) #vu8(96 101 98 100))
(test/unspec (close-port p)))
(let ([p (open-file-output-port "io-tmp1"
(file-options no-create no-truncate))])
(test (port-has-port-position? p) #t)
(test (port-has-set-port-position!? p) #t)
(test (port-position p) 0)
(test/unspec (set-port-position! p 6))
(test (port-position p) 6)
(test/unspec (put-bytevector p #vu8(102)))
(test/unspec (close-port p)))
(let ([p (open-file-input-port "io-tmp1")])
(test (get-bytevector-n p 4) #vu8(96 101 98 100))
(test/unspec (get-bytevector-n p 2))
(test (get-bytevector-n p 2) #vu8(102))
(test/unspec (close-port p)))
;; Otherwise, truncate:
(let ([p (open-file-output-port "io-tmp1"
(file-options no-fail))])
(test/unspec (close-port p)))
(let ([p (open-file-input-port "io-tmp1")])
(test (port-eof? p) #t)
(test/unspec (close-port p)))
;; ----------------------------------------
;; Check buffer modes? Just make sure they're accepted:
(let ([p (open-file-output-port "io-tmp1" (file-options no-create) 'line)])
(test (output-port-buffer-mode p) 'line)
(close-port p))
(let ([p (open-file-output-port "io-tmp1" (file-options no-create) 'block)])
(test (output-port-buffer-mode p) 'block)
(close-port p))
(let ([p (open-file-output-port "io-tmp1" (file-options no-create) 'none)])
(test (output-port-buffer-mode p) 'none)
(close-port p))
(let ([p (open-file-input-port "io-tmp1" (file-options) 'line)])
(close-port p))
(let ([p (open-file-input-port "io-tmp1" (file-options) 'block)])
(close-port p))
(let ([p (open-file-input-port "io-tmp1" (file-options) 'none)])
(close-port p))
;; ----------------------------------------
;; Transcoders
(let ([p (open-file-output-port "io-tmp1" (file-options no-create)
'block (make-transcoder (latin-1-codec)))])
(when (port-has-port-position? p)
(test/unspec (port-position p))
(when (port-has-set-port-position!? p)
(let ([pos (port-position p)])
(test/unspec (set-port-position! p pos)))))
(test (binary-port? p) #f)
(test (textual-port? p) #t)
(test/unspec (put-string p "apple"))
(test/unspec (put-string p "berry" 3))
(test/unspec (put-string p "berry" 1 1))
(close-port p))
(let ([p (open-file-input-port "io-tmp1" (file-options)
'block (make-transcoder (latin-1-codec)))])
(test (binary-port? p) #f)
(test (textual-port? p) #t)
(test (lookahead-char p) #\a)
(test (get-char p) #\a)
(test (get-string-n p 20) "pplerye")
(test (lookahead-char p) (eof-object))
(test (get-char p) (eof-object))
(close-port p))
(let ([p (open-file-output-port "io-tmp1" (file-options no-create)
'block (make-transcoder (utf-8-codec)))])
(test/unspec (put-string p "app\x3BB;e"))
(close-port p))
(let ([p (open-file-input-port "io-tmp1" (file-options)
'block (make-transcoder (latin-1-codec)))])
(test (get-string-n p 20) "app\xCE;\xBB;e")
(close-port p))
(let ([p (open-file-output-port "io-tmp1" (file-options no-create)
'block (make-transcoder (utf-16-codec)))])
(test/unspec (put-string p "app\x3BB;e"))
(close-port p))
(let ([p (open-file-input-port "io-tmp1" (file-options)
'block (make-transcoder (utf-16-codec)))])
(test (get-string-n p 20) "app\x3BB;e")
(close-port p))
(let ([p (open-file-input-port "io-tmp1")])
(let ([b1 (get-u8 p)])
(cond
[(equal? b1 #xFE)
(test (get-u8 p) #xFF)
(test (get-u8 p) 0)
(test (get-u8 p) 97)]
[(equal? b1 #xFF)
(test (get-u8 p) #xFE)
(test (get-u8 p) 97)
(test (get-u8 p) 0)]
[else
;; Must be big-endian
(test b1 0)
(test (get-u8 p) 97)]))
(test/unspec (close-port p)))
(let ([bytevector->string-via-file
(lambda (bv tr)
(let ([p (open-file-output-port "io-tmp1" (file-options no-create))])
(put-bytevector p bv)
(close-port p))
(let ([p (open-file-input-port "io-tmp1" (file-options) 'block tr)])
(dynamic-wind
(lambda () 'ok)
(lambda () (get-string-all p))
(lambda () (close-port p)))))]
[string->bytevector-via-file
(lambda (str tr)
(let ([p (open-file-output-port "io-tmp1" (file-options no-create)
'block tr)])
(dynamic-wind
(lambda () 'ok)
(lambda () (put-string p str) (flush-output-port p))
(lambda () (close-port p))))
(let ([p (open-file-input-port "io-tmp1")])
(let ([v (get-bytevector-all p)])
(close-port p)
v)))])
(test-transcoders bytevector->string-via-file
string->bytevector-via-file))
(let ([test-i+o
(lambda (buf)
(let ([p (open-file-input/output-port "io-tmp1"
(file-options no-fail)
buf)])
(if (and (port-has-port-position? p)
(port-has-set-port-position!? p))
(begin
(port-position p)
(test (port-position p) 0)
(test/unspec (put-bytevector p #vu8(7 9 11)))
(unless (eq? buf 'none)
(test/unspec (flush-output-port p)))
(test (port-position p) 3)
(test/unspec (set-port-position! p 0))
(test (get-bytevector-n p 2) #vu8(7 9))
(test/unspec (put-bytevector p #vu8(13 15 17)))
(unless (eq? buf 'none)
(test/unspec (flush-output-port p)))
(test/unspec (set-port-position! p 3))
(test (get-bytevector-n p 2) #vu8(15 17)))
(begin
(test/unspec (put-bytevector p #vu8(7 9 11)))
(test (get-u8 p) (eof-object))))
(test/unspec (close-port p))))])
(test-i+o 'line)
(test-i+o 'block)
(test-i+o 'none))
(let ([p (open-file-input/output-port "io-tmp1"
(file-options no-fail)
'none
(make-transcoder (latin-1-codec)))])
(test/unspec (put-string p "berry"))
(test/unspec (close-port p)))
(let ([p (open-file-input/output-port "io-tmp1"
(file-options no-fail no-truncate)
'none
(make-transcoder (latin-1-codec)))])
(test (get-string-n p 4) "berr")
(test/unspec (put-string p "apple"))
(test/unspec (close-port p)))
(let ([p (open-file-input/output-port "io-tmp1"
(file-options no-fail no-truncate)
'none
(make-transcoder (latin-1-codec)))])
(test (get-string-n p 10) "berrapple")
(test/unspec (close-port p)))
(test/unspec (delete-file "io-tmp1"))
;; ----------------------------------------
;; bytevector ports
(let ([p (open-bytevector-input-port #vu8(0 1 2 3))])
(test (input-port? p) #t)
(test (binary-port? p) #t)
(test (textual-port? p) #f)
(test (get-u8 p) 0)
(test (lookahead-u8 p) 1)
(test (get-u8 p) 1)
(let ([bv (make-bytevector 10 0)])
(test (get-bytevector-n! p bv 1 7) 2)
(test bv #vu8(0 2 3 0 0 0 0 0 0 0)))
(test (get-bytevector-some p) (eof-object))
(close-port p))
(let-values ([(p get) (open-bytevector-output-port)])
(test (output-port? p) #t)
(test (binary-port? p) #t)
(test (textual-port? p) #f)
(test/unspec (put-u8 p 10))
(test/unspec (put-bytevector p #vu8(11 12 13)))
(test/unspec (put-bytevector p #vu8(14 15 16 17 18) 4))
(test/unspec (put-bytevector p #vu8(14 15 16 17 18) 2 1))
(test (get) #vu8(10 11 12 13 18 16))
(test (get) #vu8())
(close-port p))
(test (call-with-bytevector-output-port
(lambda (p)
(put-bytevector p #vu8(1 2 3))))
#vu8(1 2 3))
(test (call-with-bytevector-output-port
(lambda (p)
(put-string p "app\x3BB;e"))
(make-transcoder (utf-8-codec)))
#vu8(97 112 112 206 187 101))
(let ([bytevector->string-via-port
(lambda (bv tr)
(let ([p (open-bytevector-input-port bv tr)])
(dynamic-wind
(lambda () 'ok)
(lambda () (get-string-all p))
(lambda () (close-port p)))))]
[string->bytevector-via-port
(lambda (str tr)
(let-values ([(p get) (open-bytevector-output-port tr)])
(dynamic-wind
(lambda () 'ok)
(lambda ()
(put-string p str)
(get))
(lambda ()
(close-port p)))))])
(test-transcoders bytevector->string-via-port
string->bytevector-via-port))
;; ----------------------------------------
;; string ports
(let ([p (open-string-input-port "app\x3BB;e\r\nban")])
(test (input-port? p) #t)
(test (binary-port? p) #f)
(test (textual-port? p) #t)
(test (get-char p) #\a)
(test (lookahead-char p) #\p)
(test (get-line p) "pp\x3BB;e\r")
(let ([s (make-string 10 #\_)])
(test (get-string-n! p s 1 9) 3)
(test s "_ban______")))
(let ([p (open-string-input-port "(1 2 3) 4")])
(test (get-datum p) '(1 2 3))
(close-port p))
(let-values ([(p get) (open-string-output-port)])
(test/unspec (put-string p "app\x3BB;e"))
(test (get) "app\x3BB;e")
(test (get) "")
(close-port p))
(test (call-with-string-output-port
(lambda (p)
(test/unspec (put-string p "app\x3BB;y"))))
"app\x3BB;y")
;; ----------------------------------------
;; custom ports
(let* ([pos 0]
[p (make-custom-binary-input-port
"custom in"
(lambda (bv start count)
(if (= pos 16)
0
(begin
(set! pos (+ 1 pos))
(bytevector-u8-set! bv start pos)
1)))
(lambda () pos)
(lambda (p) (set! pos p))
(lambda () 'ok))])
(test (port-has-port-position? p) #t)
(test (port-has-set-port-position!? p) #t)
(test (port-position p) 0)
(test (get-bytevector-n p 3) #vu8(1 2 3))
(test (port-position p) 3)
(test (lookahead-u8 p) 4)
(test (lookahead-u8 p) 4)
(test (port-position p) 3)
(test/unspec (set-port-position! p 10))
(get-bytevector-n p 2)
(test (get-bytevector-n p 2) #vu8(13 14))
(test (get-bytevector-n p 2) #vu8(15 16))
(test (get-bytevector-n p 2) (eof-object))
(test/unspec (set-port-position! p 2))
(test (get-bytevector-n p 3) #vu8(3 4 5))
(test/unspec (close-port p)))
(test-positions make-custom-binary-input-port)
(let* ([pos 0]
[p (make-custom-textual-input-port
"custom in"
(lambda (bv start count)
(if (= pos 16)
0
(begin
(set! pos (+ 1 pos))
(string-set! bv start (integer->char (+ 96 pos)))
1)))
(lambda () pos)
(lambda (p) (set! pos p))
(lambda () 'ok))])
(test/unspec (port-position p))
(test (get-string-n p 3) "abc")
(test (lookahead-char p) #\d)
(test (lookahead-char p) #\d)
(test (get-string-n p 7) "defghij")
(get-string-n p 2)
(test (get-string-n p 2) "mn")
(test (get-string-n p 2) "op")
(test (get-string-n p 2) (eof-object))
(test/unspec (close-port p)))
;; textual port positions are hopelessly broken in R6RS
#;(test-positions make-custom-textual-input-port)
(let* ([accum '()]
[p (make-custom-binary-output-port
"custom out"
(lambda (bv start count)
(let ([bv2 (make-bytevector count)])
(bytevector-copy! bv start bv2 0 count)
(set! accum (append
(reverse (bytevector->u8-list bv2))
accum))
count))
(lambda () (length accum))
(lambda (pos) (set! accum (list-tail accum (- (length accum) pos))))
(lambda () 'ok))])
(test (port-has-port-position? p) #t)
(test (port-has-set-port-position!? p) #t)
(test (port-position p) 0)
(test/unspec (put-bytevector p #vu8(2 4 6)))
(flush-output-port p)
(test accum '(6 4 2))
(test (port-position p) 3)
(test/unspec (set-port-position! p 2))
(test (port-position p) 2)
(test accum '(4 2))
(test/unspec (put-bytevector p #vu8(3 7 9 11) 2 1))
(flush-output-port p)
(test accum '(9 4 2))
(test/unspec (close-port p)))
(test-positions make-custom-binary-output-port)
(let* ([accum '()]
[p (make-custom-textual-output-port
"custom out"
(lambda (str start count)
(let ([str (substring str start count)])
(set! accum (append
(reverse (string->list str))
accum))
count))
(lambda () (length accum))
(lambda (pos) (set! accum (list-tail accum (- (length accum) pos))))
(lambda () 'ok))])
(test (port-has-port-position? p) #t)
(test (port-has-set-port-position!? p) #t)
(test (port-position p) 0)
(test/unspec (put-string p "ab"))
(test (port-position p) 2)
(test/unspec (put-string p "c"))
(flush-output-port p)
(test accum '(#\c #\b #\a))
(test (port-position p) 3)
(test/unspec (set-port-position! p 2))
(test (port-position p) 2)
(test accum '(#\b #\a))
(test/unspec (put-string p "xyzw" 2 1))
(flush-output-port p)
(test accum '(#\z #\b #\a))
(test/unspec (close-port p)))
;; textual port positions are hopelessly broken in R6RS
#;(test-positions make-custom-textual-output-port)
(let* ([save #f]
[p (make-custom-binary-input/output-port
"custom in"
(lambda (bv start end)
(bytevector-u8-set! bv start 7)
1)
(lambda (bv start end)
(set! save (bytevector-u8-ref bv start))
1)
#f #f #f)])
(test/unspec (put-u8 p 10))
(flush-output-port p)
(test save 10)
(test (get-u8 p) 7)
(close-port p))
(test-positions (lambda (id r/w get set close)
(make-custom-binary-input/output-port
id r/w r/w get set close)))
(let* ([save #f]
[p (make-custom-textual-input/output-port
"custom in"
(lambda (str start end)
(string-set! str start #\!)
1)
(lambda (str start end)
(set! save (string-ref str start))
1)
#f #f #f)])
(test/unspec (put-char p #\q))
(flush-output-port p)
(test save #\q)
(test (get-char p) #\!)
(close-port p))
;; textual port positions are hopelessly broken in R6RS
#;(test-positions (lambda (id r/w get set close)
(make-custom-textual-input/output-port
id r/w r/w get set close)))
;; ----------------------------------------
;; stdin, stderr, stdout
(let ([p (standard-input-port)])
(test (input-port? p) #t)
(test (output-port? p) #f)
(test (binary-port? p) #t)
(test (textual-port? p) #f)
(test/unspec (close-port p)))
(let ([p (standard-output-port)])
(test (input-port? p) #f)
(test (output-port? p) #t)
(test (binary-port? p) #t)
(test (textual-port? p) #f)
(test/unspec (close-port p)))
(let ([p (standard-error-port)])
(test (input-port? p) #f)
(test (output-port? p) #t)
(test (binary-port? p) #t)
(test (textual-port? p) #f)
(test/unspec (close-port p)))
(test (input-port? (current-input-port)) #t)
(test (output-port? (current-input-port)) #f)
(test (binary-port? (current-input-port)) #f)
(test (textual-port? (current-input-port)) #t)
(test (input-port? (current-output-port)) #f)
(test (output-port? (current-output-port)) #t)
(test (binary-port? (current-output-port)) #f)
(test (textual-port? (current-output-port)) #t)
;; ----------------------------------------
(test-rw 10)
(test-rw 10.0)
(test-rw 1/2)
(test-rw 1+2i)
(test-rw 1+2.0i)
(test-rw #t)
(test-rw #f)
(test-rw 'apple)
(test-rw (string->number "app\x3BB;e"))
(test-rw (string->symbol " "))
(test-rw (string->symbol "+"))
(test-rw (string->symbol "0"))
(test-rw (string->symbol "app\x1678;e"))
(test-rw 'a1)
(test-rw '->)
(test-rw '...)
(test-rw "apple")
(test-rw "app\x3BB;e")
(test-rw "app\x1678;e")
(test-rw "\r\n")
(test-rw #\a)
(test-rw #\x3BB)
(test-rw #\nul)
(test-rw #\alarm)
(test-rw #\backspace)
(test-rw #\tab)
(test-rw #\linefeed)
(test-rw #\newline)
(test-rw #\vtab)
(test-rw #\page)
(test-rw #\return)
(test-rw #\esc)
(test-rw #\space)
(test-rw #\delete)
(test-rw #\xFF)
(test-rw #\x00006587)
(test-rw #\x10FFFF)
(test-rw #\x1678)
(test-rw #vu8())
(test-rw #vu8(1 2 3))
(test-rw '#(a))
(test-rw '#())
(test-rw '#(a 1/2 "str" #vu8(1 2 7)))
;; ----------------------------------------
;;
))
| true |
75bc65cc61d1fb3760a0b9678b80d271b20f851d | 2c291b7af5cd7679da3aa54fdc64dc006ee6ff9b | /ch3/exercise.3.8.scm | 46ecf7ddf130100e35490dc1bbabcdb0973987b6 | [] | no_license | etscrivner/sicp | caff1b3738e308c7f8165fc65a3f1bc252ce625a | 3b45aaf2b2846068dcec90ea0547fd72b28f8cdc | refs/heads/master | 2021-01-10T12:08:38.212403 | 2015-08-22T20:01:44 | 2015-08-22T20:01:44 | 36,813,957 | 1 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 128 | scm | exercise.3.8.scm | (define *previous* 0)
(define (f x)
(let ((previous *previous*))
(begin (set! *previous* x)
previous)))
| false |
ce7f25013316898e32b0858527d43a8ca25b85d2 | 53cb8287b8b44063adcfbd02f9736b109e54f001 | /flic/flic.scm | 916888cdca8c655cd6cb573b7880972f339690ab | [] | no_license | fiddlerwoaroof/yale-haskell-reboot | 72aa8fcd2ab7346a4990795621b258651c6d6c39 | 339b7d85e940db0b8cb81759e44abbb254c54aad | refs/heads/master | 2021-06-22T10:32:25.076594 | 2020-10-30T00:00:31 | 2020-10-30T00:00:31 | 92,361,235 | 3 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 739 | scm | flic.scm | ;;; flic.scm -- compilation unit for flic stuff
;;;
;;; author : Sandra Loosemore
;;; date : 7 Apr 1992
;;;
(define-compilation-unit flic
(source-filename "flic/")
(unit flic-td
(source-filename "flic-td.scm"))
(unit flic-structs
(source-filename "flic-structs.scm")
(require flic-td))
(unit print-flic
(source-filename "print-flic.scm")
(require flic-structs printer-support))
(unit ast-to-flic
(source-filename "ast-to-flic.scm")
(require flic-structs ast haskell-utils))
(unit flic-walker
(source-filename "flic-walker.scm"))
(unit copy-flic
(source-filename "copy-flic.scm")
(require flic-walker flic-structs))
(unit invariant
(source-filename "invariant.scm")
(require flic-walker flic-structs))
)
| false |
0f1e6db628be52b7d935398a5a85539ad086885f | ce567bbf766df9d98dc6a5e710a77870753c7d29 | /ch9/11.scm | 590cfe6975824a21eafb95b276c0a95e3ccaad86 | [] | 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 | 14,575 | scm | 11.scm |
(load-relative "../libs/init.scm")
(load-relative "./base/classes/test.scm")
(load-relative "./base/classes/store.scm")
(load-relative "./base/classes/data-structures.scm")
(load-relative "./base/classes/environments.scm")
(load-relative "./base/classes/lang.scm")
(load-relative "./base/classes/interp.scm")
(load-relative "./base/classes/classes.scm")
(load-relative "./base/classes/class-cases.scm")
;; add private, protected, public property for method of a class
;; see new stuff
(define debug? (make-parameter #t))
(define the-lexical-spec
'((whitespace (whitespace) skip)
(comment ("%" (arbno (not #\newline))) skip)
(identifier
(letter (arbno (or letter digit "_" "-" "?")))
symbol)
(number (digit (arbno digit)) number)
(number ("-" digit (arbno digit)) number)
))
(define the-grammar
'((program ((arbno class-decl) expression) a-program)
(expression (number) const-exp)
(expression
("-" "(" expression "," expression ")")
diff-exp)
(expression
("+" "(" expression "," expression ")")
sum-exp)
(expression
("zero?" "(" expression ")")
zero?-exp)
(expression
("if" expression "then" expression "else" expression)
if-exp)
(expression (identifier) var-exp)
(expression
("let" (arbno identifier "=" expression) "in" expression)
let-exp)
(expression
("proc" "(" (separated-list identifier ",") ")" expression)
proc-exp)
(expression
("(" expression (arbno expression) ")")
call-exp)
(expression
("letrec"
(arbno identifier "(" (separated-list identifier ",") ")"
"=" expression)
"in" expression)
letrec-exp)
(expression
("begin" expression (arbno ";" expression) "end")
begin-exp)
(expression
("set" identifier "=" expression)
assign-exp)
(expression
("list" "(" (separated-list expression ",") ")" )
list-exp)
;; new productions for oop
(class-decl
("class" identifier
"extends" identifier
(arbno "field" identifier)
(arbno method-decl)
)
a-class-decl)
(method-decl
("pri-method" identifier
"(" (separated-list identifier ",") ")" ; method formals private
expression
)
a-pri-method-decl)
(method-decl
("pro-method" identifier
"(" (separated-list identifier ",") ")" ; method formals protected
expression
)
a-pro-method-decl)
(method-decl
("method" identifier
"(" (separated-list identifier ",") ")" ; method formals public
expression
)
a-pub-method-decl)
(expression
("new" identifier "(" (separated-list expression ",") ")")
new-object-exp)
;; this is special-cased to prevent it from mutation
(expression
("self")
self-exp)
(expression
("send" expression identifier
"(" (separated-list expression ",") ")")
method-call-exp)
(expression
("super" identifier "(" (separated-list expression ",") ")")
super-call-exp)
))
;;;;;;;;;;;;;;;; sllgen boilerplate ;;;;;;;;;;;;;;;;
(sllgen:make-define-datatypes the-lexical-spec the-grammar)
(define show-the-datatypes
(lambda () (sllgen:list-define-datatypes the-lexical-spec the-grammar)))
(define scan&parse
(sllgen:make-string-parser the-lexical-spec the-grammar))
(define just-scan
(sllgen:make-string-scanner the-lexical-spec the-grammar))
;; new stuff
(define-datatype class class?
(a-class
(super-name (maybe symbol?))
(field-names (list-of symbol?))
(method-env-private method-environment?)
(method-env-protected method-environment?)
(method-env-public method-environment?)))
(define initialize-class-env!
(lambda (c-decls)
(set! the-class-env
(list
(list 'object (a-class #f '() '() '() '()))))
(for-each initialize-class-decl! c-decls)))
(define class->super-name
(lambda (c-struct)
(cases class c-struct
(a-class (super-name field-names
method-pri-env
method-pro-env
method-pub-env)
super-name))))
(define class->field-names
(lambda (c-struct)
(cases class c-struct
(a-class (super-name field-names
method-pri-env
method-pro-env
method-pub-env)
field-names))))
(define class->method-env
(lambda (c-struct type)
(cases class c-struct
(a-class (super-name field-names
method-pri-env
method-pro-env
method-pub-env)
(cond ((eq? type 'pri) method-pri-env)
((eq? type 'pro) method-pro-env)
((eq? type 'pub) method-pub-env)
(else
(error "class->method-env: %s" type)))))))
;; initialize-class-decl! : ClassDecl -> Unspecified
(define initialize-class-decl!
(lambda (c-decl)
(cases class-decl c-decl
(a-class-decl (c-name s-name f-names m-decls)
(let* ((f-names
(append-field-names
(class->field-names (lookup-class s-name))
f-names))
(all-methods (method-decls->method-env
m-decls s-name f-names)))
(add-to-class-env!
c-name
(a-class s-name f-names
(filter-method 'pri all-methods)
(merge-method-envs
(class->method-env (lookup-class s-name) 'pro)
(filter-method 'pro all-methods))
(merge-method-envs
(class->method-env (lookup-class s-name) 'pub)
(filter-method 'pub all-methods)))))))))
(define filter-method
(lambda (type methods)
(map
(lambda (a-meth)
(cdr a-meth))
(filter (lambda (a-meth)
(eq? (car a-meth) type))
methods))))
;; method-decls->method-env :
;; Listof(MethodDecl) * ClassName * Listof(FieldName) -> MethodEnv
(define method-decls->method-env
(lambda (m-decls super-name field-names)
(map
(lambda (m-decl)
(cases method-decl m-decl
(a-pub-method-decl (method-name vars body)
(list 'pub method-name
(a-method vars body
super-name field-names)))
(a-pri-method-decl (method-name vars body)
(list 'pri method-name
(a-method vars body
super-name field-names)))
(a-pro-method-decl (method-name vars body)
(list 'pro method-name
(a-method vars body
super-name field-names)))))
m-decls)))
(define class->method-env-with-type
(lambda (c-struct call-type)
(cases class c-struct
(a-class (super-name field-names
method-pri-env method-pro-env method-pub-env)
(cond ((eq? call-type 'pri)
(append (append method-pub-env method-pri-env)
method-pro-env))
((eq? call-type 'pro)
(append method-pro-env method-pub-env))
((eq? call-type 'pub)
method-pub-env)
(else
(error "call->method-env-with-type: error type ~s\n" call-type)))))))
(define find-method
(lambda (c-name name call-type)
(let ((m-env (class->method-env-with-type (lookup-class c-name) call-type)))
(let ((maybe-pair (assq name m-env)))
(if (pair? maybe-pair) (cadr maybe-pair)
(report-method-not-found name))))))
;; value-of : Exp * Env -> ExpVal
(define value-of
(lambda (exp env)
(cases expression exp
(const-exp (num) (num-val num))
(var-exp (var) (deref (apply-env env var)))
(diff-exp (exp1 exp2)
(let ((val1
(expval->num
(value-of exp1 env)))
(val2
(expval->num
(value-of exp2 env))))
(num-val
(- val1 val2))))
(sum-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 (vars exps body)
(if (instrument-let)
(printf "entering let ~s~%" vars))
(let ((new-env
(extend-env
vars
(map newref (values-of-exps exps env))
env)))
(if (instrument-let)
(begin
(printf "entering body of let ~s with env =~%" vars)
(pretty-print (env->list new-env))
(printf "store =~%")
(pretty-print (store->readable (get-store-as-list)))
(printf "~%")
))
(value-of body new-env)))
(proc-exp (bvars body)
(proc-val
(procedure bvars body env)))
(call-exp (rator rands)
(let ((proc (expval->proc (value-of rator env)))
(args (values-of-exps rands env)))
(apply-procedure proc args)))
(letrec-exp (p-names b-varss p-bodies letrec-body)
(value-of letrec-body
(extend-env-rec** p-names b-varss p-bodies env)))
(begin-exp (exp1 exps)
(letrec
((value-of-begins
(lambda (e1 es)
(let ((v1 (value-of e1 env)))
(if (null? es)
v1
(value-of-begins (car es) (cdr es)))))))
(value-of-begins exp1 exps)))
(assign-exp (x e)
(begin
(setref!
(apply-env env x)
(value-of e env))
(num-val 27)))
(list-exp (exps)
(list-val
(values-of-exps exps env)))
;; new cases for CLASSES language
(new-object-exp (class-name rands)
(let ((args (values-of-exps rands env))
(obj (new-object class-name)))
(apply-method
(find-method class-name 'initialize 'pri)
obj
args)
obj))
(self-exp ()
(apply-env env '%self))
(method-call-exp (obj-exp method-name rands)
(let* ((call-type (find-call-type obj-exp))
(args (values-of-exps rands env))
(obj (value-of obj-exp env)))
(apply-method
(find-method (object->class-name obj) method-name call-type)
obj
args)))
(super-call-exp (method-name rands)
(let ((args (values-of-exps rands env))
(obj (apply-env env '%self)))
(apply-method
(find-method (apply-env env '%super) method-name 'pro)
obj
args)))
)))
(define find-call-type
(lambda (call-exp)
(if (eq? (car call-exp) 'self-exp)
'pri
'pub)))
(run "class c1 extends object
field ivar1
method initialize() set ivar1 = 1
class c2 extends c1
method initialize()
begin
set ivar1 = 1
end
method setiv1(n) set ivar1 = n
method getiv1() ivar1
let o = new c2 ()
t1 = 0
in begin
send o setiv1(33);
send o getiv1()
end
")
(run " class bclass extends object
field base_id
method initialize() set base_i = 0
method demo() set base_id = 1
% base protected func
pro-method base_func() set base_id = 3
class aclass extends bclass
field i
method initialize(x) set i = x
method m(y) -(i,-(0,y))
method func1() send self func2()
%private method call a protected method
pri-method func2() begin set i = 2;
super demo();
send self func3()
end
%protected method
pro-method func3() begin set i = 3 end
method func4() super base_func()
method get() i
let o1 = new aclass(3)
in begin
send o1 func1();
send o1 get();
send o1 func4()
end")
(run-all)
| false |
dfc8c988ab6f938021b808cae7a44c70d4a488b9 | f08220a13ec5095557a3132d563a152e718c412f | /logrotate/skel/usr/share/guile/2.0/srfi/srfi-38.scm | 34cf22ef732899fa10531ba298b0bf543a081a41 | [
"Apache-2.0"
] | permissive | sroettger/35c3ctf_chals | f9808c060da8bf2731e98b559babd4bf698244ac | 3d64486e6adddb3a3f3d2c041242b88b50abdb8d | refs/heads/master | 2020-04-16T07:02:50.739155 | 2020-01-15T13:50:29 | 2020-01-15T13:50:29 | 165,371,623 | 15 | 5 | Apache-2.0 | 2020-01-18T11:19:05 | 2019-01-12T09:47:33 | Python | UTF-8 | Scheme | false | false | 8,387 | scm | srfi-38.scm | ;; Copyright (C) 2010 Free Software Foundation, Inc.
;; Copyright (C) Ray Dillinger 2003. All Rights Reserved.
;;
;; Contains code based upon Alex Shinn's public-domain implementation of
;; `read-with-shared-structure' found in Chicken's SRFI 38 egg.
;; Permission is hereby granted, free of charge, to any person obtaining
;; a copy of this software and associated documentation files (the
;; "Software"), to deal in the Software without restriction, including
;; without limitation the rights to use, copy, modify, merge, publish,
;; distribute, sublicense, and/or sell copies of the Software, and to
;; permit persons to whom the Software is furnished to do so, subject to
;; the following conditions:
;; The above copyright notice and this permission notice shall be
;; included in all copies or substantial portions of the Software.
;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
;; SOFTWARE.
(define-module (srfi srfi-38)
#:export (write-with-shared-structure
read-with-shared-structure)
#:use-module (rnrs bytevectors)
#:use-module (srfi srfi-8)
#:use-module (srfi srfi-69)
#:use-module (system vm trap-state))
(cond-expand-provide (current-module) '(srfi-38))
;; A printer that shows all sharing of substructures. Uses the Common
;; Lisp print-circle notation: #n# refers to a previous substructure
;; labeled with #n=. Takes O(n^2) time.
;; Code attributed to Al Petrofsky, modified by Ray Dillinger.
;; Modified in 2010 by Andreas Rottmann to use SRFI 69 hashtables,
;; making the time O(n), and adding some of Guile's data types to the
;; `interesting' objects.
(define* (write-with-shared-structure obj
#:optional
(outport (current-output-port))
(optarg #f))
;; We only track duplicates of pairs, vectors, strings, bytevectors,
;; structs (which subsume R6RS and SRFI-9 records), ports and (native)
;; hash-tables. We ignore zero-length vectors and strings because
;; r5rs doesn't guarantee that eq? treats them sanely (and they aren't
;; very interesting anyway).
(define (interesting? obj)
(or (pair? obj)
(and (vector? obj) (not (zero? (vector-length obj))))
(and (string? obj) (not (zero? (string-length obj))))
(bytevector? obj)
(struct? obj)
(port? obj)
(hash-table? obj)))
;; (write-obj OBJ STATE):
;;
;; STATE is a hashtable which has an entry for each interesting part
;; of OBJ. The associated value will be:
;;
;; -- a number if the part has been given one,
;; -- #t if the part will need to be assigned a number but has not been yet,
;; -- #f if the part will not need a number.
;; The entry `counter' in STATE should be the most recently
;; assigned number.
;;
;; Mutates STATE for any parts that had numbers assigned.
(define (write-obj obj state)
(define (write-interesting)
(cond ((pair? obj)
(display "(" outport)
(write-obj (car obj) state)
(let write-cdr ((obj (cdr obj)))
(cond ((and (pair? obj) (not (hash-table-ref state obj)))
(display " " outport)
(write-obj (car obj) state)
(write-cdr (cdr obj)))
((null? obj)
(display ")" outport))
(else
(display " . " outport)
(write-obj obj state)
(display ")" outport)))))
((vector? obj)
(display "#(" outport)
(let ((len (vector-length obj)))
(write-obj (vector-ref obj 0) state)
(let write-vec ((i 1))
(cond ((= i len) (display ")" outport))
(else (display " " outport)
(write-obj (vector-ref obj i) state)
(write-vec (+ i 1)))))))
;; else it's a string
(else (write obj outport))))
(cond ((interesting? obj)
(let ((val (hash-table-ref state obj)))
(cond ((not val) (write-interesting))
((number? val)
(begin (display "#" outport)
(write val outport)
(display "#" outport)))
(else
(let ((n (+ 1 (hash-table-ref state 'counter))))
(display "#" outport)
(write n outport)
(display "=" outport)
(hash-table-set! state 'counter n)
(hash-table-set! state obj n)
(write-interesting))))))
(else
(write obj outport))))
;; Scan computes the initial value of the hash table, which maps each
;; interesting part of the object to #t if it occurs multiple times,
;; #f if only once.
(define (scan obj state)
(cond ((not (interesting? obj)))
((hash-table-exists? state obj)
(hash-table-set! state obj #t))
(else
(hash-table-set! state obj #f)
(cond ((pair? obj)
(scan (car obj) state)
(scan (cdr obj) state))
((vector? obj)
(let ((len (vector-length obj)))
(do ((i 0 (+ 1 i)))
((= i len))
(scan (vector-ref obj i) state))))))))
(let ((state (make-hash-table eq?)))
(scan obj state)
(hash-table-set! state 'counter 0)
(write-obj obj state)))
;; A reader that understands the output of the above writer. This has
;; been written by Andreas Rottmann to re-use Guile's built-in reader,
;; with inspiration from Alex Shinn's public-domain implementation of
;; `read-with-shared-structure' found in Chicken's SRFI 38 egg.
(define* (read-with-shared-structure #:optional (port (current-input-port)))
(let ((parts-table (make-hash-table eqv?)))
;; reads chars that match PRED and returns them as a string.
(define (read-some-chars pred initial)
(let iter ((chars initial))
(let ((c (peek-char port)))
(if (or (eof-object? c) (not (pred c)))
(list->string (reverse chars))
(iter (cons (read-char port) chars))))))
(define (read-hash c port)
(let* ((n (string->number (read-some-chars char-numeric? (list c))))
(c (read-char port))
(thunk (hash-table-ref/default parts-table n #f)))
(case c
((#\=)
(if thunk
(error "Double declaration of part " n))
(let* ((cell (list #f))
(thunk (lambda () (car cell))))
(hash-table-set! parts-table n thunk)
(let ((obj (read port)))
(set-car! cell obj)
obj)))
((#\#)
(or thunk
(error "Use of undeclared part " n)))
(else
(error "Malformed shared part specifier")))))
(with-fluid* %read-hash-procedures (fluid-ref %read-hash-procedures)
(lambda ()
(for-each (lambda (digit)
(read-hash-extend digit read-hash))
'(#\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9))
(let ((result (read port)))
(if (< 0 (hash-table-size parts-table))
(patch! result))
result)))))
(define (hole? x) (procedure? x))
(define (fill-hole x) (if (hole? x) (fill-hole (x)) x))
(define (patch! x)
(cond
((pair? x)
(if (hole? (car x)) (set-car! x (fill-hole (car x))) (patch! (car x)))
(if (hole? (cdr x)) (set-cdr! x (fill-hole (cdr x))) (patch! (cdr x))))
((vector? x)
(do ((i (- (vector-length x) 1) (- i 1)))
((< i 0))
(let ((elt (vector-ref x i)))
(if (hole? elt)
(vector-set! x i (fill-hole elt))
(patch! elt)))))))
| false |
8f04de938d019d179d2bf32aaa5bb43c07e09d9d | 4a1ff5a0f674ff41bd384301ab82b3197f5ca0c8 | /problems/0895/main.scm | f89444e29919d4b184cd07f79e11841ac69b5158 | [] | no_license | MiyamonY/yukicoder | e0a323d68c4d3b41bdb42fb3ed6ab105619ca7e9 | 1bb8882ac76cc302428ab0417f90cfa94f7380c8 | refs/heads/master | 2020-05-09T12:13:31.627382 | 2019-10-06T17:01:45 | 2019-10-06T17:01:45 | 181,105,911 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 1,674 | scm | main.scm | ;;; File: main.scm
;; Author: ymiyamoto
;;
;; Created on Sat Sep 28 20:04:17 2019
;;
(define-syntax read-number
(syntax-rules ()
((_ nums)
(define-values nums
(apply values (map string->number (string-split (read-line) #\space)))))))
(define-syntax read-numbers
(syntax-rules ()
((_ as)
(define as (map string->number (string-split (read-line) #\space))))
((_ as n)
(define as (map (lambda (_) (map string->number (string-split (read-line) #\space))) (iota n))))))
(define-syntax 1+ (syntax-rules () ((_ x) (+ x 1))))
(define-syntax 1- (syntax-rules () ((_ x) (- x 1))))
(define MOD 1000000007)
(define (mod+ x y)
(modulo (+ x y) MOD))
(define (mod* x y)
(modulo (* x y) MOD))
(define (make-comb num)
(define fact-dp (make-vector num -1))
(define inv-fact-dp (make-vector num -1))
(define (fact n) (vector-ref fact-dp n))
(define (inv-fact n) (vector-ref inv-fact-dp n))
(vector-set! fact-dp 0 1)
(vector-set! inv-fact-dp 0 1)
(let loop ((i 1))
(when (< i num)
(vector-set! fact-dp i (mod* i (fact (- i 1))))
(vector-set! inv-fact-dp i (expt-mod (fact i) (- MOD 2) MOD))
(loop (+ i 1))))
(lambda (n k)
(define factn (fact n))
(define powk (inv-fact k))
(define pownk (inv-fact (- n k)))
(mod* (mod* factn powk) pownk)))
(define (solve)
(define comb (make-comb (* 3 100000)))
(read-number (a b c))
(print (fold mod+ 0
(map (lambda (i)
(define x (comb (- (+ a b c) i 2) (1- c)))
(define y (comb (- (+ a b) i 1) (1- b)))
(define z (1- (expt-mod 2 (- (+ a b c) i 1) MOD)))
(mod* (mod* x y) z))
(iota a 1)))))
(solve)
| true |
9c03f6b01aa9a6b07e3aa6e294b430078fd62bf2 | 7cc8db8c11bf2401181f8803dab125d9343f5a41 | /source/scheme/test/module/sph/sp.scm | 5e2a30c36d62646a20146574e5b41791cf9f535c | [] | no_license | sph-mn/sph-sp-guile | 9735fcfca7c29657536dc414f2af8159ba26bbc1 | 9ae56663332f4ec43b5ba025debb45b33b9fa4dd | refs/heads/master | 2021-07-06T05:10:20.270511 | 2019-04-27T20:28:13 | 2019-04-27T20:28:13 | 150,976,986 | 1 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 9,216 | scm | sp.scm | (define-test-module (test module sph sp)
(import
(sph uniform-vector)
(sph number)
(sph string)
(sph sp)
(sph sp filter)
(sph list)
(rnrs bytevectors))
(define test-env-file-path "/tmp/sp-test.wav")
(define channel-count 2)
(define volume 0.1)
(define duration 5)
(define sample-rate 8000)
(define sample-duration (/ 1 sample-rate))
(define segment-size (inexact->exact (/ sample-rate 10)))
(define (adjust-volume volume data) (map (l (a) (f64vector-map* * volume a)) data))
(define test-samples (sp-samples-new segment-size (l (index) (sin (+ 1 index)))))
(define (get-sine-segment index sample-offset)
(let (data (sp-sine segment-size sample-duration 1400 (* sample-offset sample-duration)))
(list data data)))
(define-test (sp-file) (if (file-exists? test-env-file-path) (delete-file test-env-file-path))
(let*
( (file-out (sp-file-open test-env-file-path sp-file-mode-write channel-count sample-rate))
(data
; make data for channels filled with samples of value n
(map-integers channel-count (l (n) (sp-samples-new segment-size (* (+ n 1) 0.5))))))
(assert-and
(assert-equal "properties" (list #f 0)
(list (sp-file-input? file-out) (sp-file-position file-out)))
(assert-true "write"
(= segment-size (sp-file-write file-out data segment-size) (sp-file-position file-out)))
(assert-true "close" (and (sp-file-close file-out)))
(let*
( (file-in (sp-file-open test-env-file-path sp-file-mode-read))
(test-result (assert-true "read" (equal? data (sp-file-read file-in segment-size)))))
(sp-file-close file-in) test-result))))
(define-test (sp-fft) (sp-samples? (sp-fftri (sp-fftr test-samples))))
(define-test (sp-moving-average in ex)
(apply
(l (source prev next distance . a)
(let*
( (source (sp-samples-from-list source)) (prev (and prev (sp-samples-from-list prev)))
(next (and next (sp-samples-from-list next)))
(result
(let (out (sp-samples-copy-zero source))
(apply sp-moving-average out source prev next distance a) out)))
(if (every (l (a b) (f64-nearly-equal? a b 1.0e-6)) ex (sp-samples->list result)) ex
result)))
in))
(define-test (sp-windowed-sinc in ex)
(list-bind in (in cutoff transition)
(let* ((in (sp-samples-from-list in)) (out (sp-samples-copy-zero in)))
(sp-windowed-sinc-lp-hp out in cutoff transition #f #f)
(sp-windowed-sinc-lp-hp out in cutoff transition #t #f)
(sp-windowed-sinc-bp-br out in cutoff cutoff transition transition #f #f)
(sp-windowed-sinc-bp-br out in cutoff cutoff transition transition #t #f)
; check of result data to be implemented
(assert-and (sp-samples? (sp-windowed-sinc-lp-hp-ir 0.1 0.08 #f))
(sp-samples? (sp-windowed-sinc-lp-hp-ir 0.1 0.08 #t))
(sp-samples? (sp-windowed-sinc-bp-br-ir 0.1 0.1 0.08 0.08 #f))
(sp-samples? (sp-windowed-sinc-bp-br-ir 0.1 0.1 0.08 0.08 #t)))
#t)))
(define-test (sp-convolve) "test convolve and its carryover functionality "
(let*
( (ir-list (make-list 5 2.0)) (a-list (make-list 5 1.0)) (ir (sp-samples-from-list ir-list))
(a (sp-samples-from-list a-list)) (b a)
(c a)
(result
(fold-multiple
(l (a state result)
(let
(b
(let
( (state (or state (sp-samples-new (- (sp-samples-length ir) 1))))
(out (sp-samples-copy-zero a)))
(sp-convolve out a ir state) (pair out state)))
(list (tail b) (pair (first b) result))))
(list a b c) #f null)))
(equal? (convolve (append a-list a-list a-list) ir-list)
(apply append (map sp-samples->list (reverse (pair (first result) (second result))))))))
(define-test (sp-convolution-filter)
(let*
( (a-list (make-list 5 1.0)) (a (sp-samples-from-list a-list)) (b-list (make-list 5 2.0))
(b (sp-samples-from-list b-list)) (out (sp-samples-new (- (length a-list) 1) 0.0))
(state (sp-convolution-filter out a (l a b) (list 0.1 0.08) #f))
(state (sp-convolution-filter out a (l a b) (list 0.1 0.08) state)))
(sp-samples? out)))
(define-test (sp-samples-extract)
(let (series (sp-samples-from-list (map-integers 10 identity)))
(and (equal? (list 8.0) (sp-samples->list (sp-samples-extract-padded series 8 1)))
(equal? (list 8.0 9.0) (sp-samples->list (sp-samples-extract series 8 6)))
(equal? (list 8.0 9.0 0.0 0.0 0.0 0.0)
(sp-samples->list (sp-samples-extract-padded series 8 6))))))
(define-test (sp-convolution-filter-2)
"test for the case that the input is smaller than the impulse response"
(define (test-convolve)
(let*
( (samples (list 1 2 3 4 5)) (ir (sp-samples-from-list (list 2 4 8 16 32 64)))
(convolve
(l (samples state)
(let*
( (samples (sp-samples-from-list (any->list samples)))
(output (sp-samples-copy-zero samples)))
(list output (sp-convolution-filter output samples (l a ir) null state)))))
(result-a
(reverse
(first
(fold-multiple
(l (sample result state)
(apply (l (sample state) (list (pair sample result) state))
(convolve sample state)))
samples null #f))))
(result-b (first (convolve samples #f)))
(result-a (sp-samples-from-list (apply append (map sp-samples->list result-a)))))
(equal? (any->string result-b) (any->string result-a))))
(define (test-filter)
(let*
( (samples (list 1 2 3 4 5)) (ir (sp-samples-from-list (list 2 4 8 16 32 64)))
(filter
(l (samples state)
(let*
( (samples (sp-samples-from-list (any->list samples)))
(out (sp-samples-copy-zero samples)))
(list out (sp-windowed-sinc-bp-br out samples 0.1 0.4 0.08 0.08 #f state)))))
(result-a
(reverse
(first
(fold-multiple
(l (sample result state)
(apply (l (sample state) (list (pair sample result) state))
(filter sample state)))
samples null #f))))
(result-b (first (filter samples #f)))
(result-a (sp-samples-from-list (apply append (map sp-samples->list result-a)))))
(equal? (any->string result-b) (any->string result-a))))
(assert-and (assert-true (test-convolve)) (assert-true (test-filter))))
(define-test (sp-fm-synth)
(let*
( (duration 100) (channels 2) (out-start 1)
(out (map-integers channels (l (a) (sp-samples-new (+ out-start duration))))) (start 0)
(state #f) (amp1 (sp-samples-new duration 1))
(amp2 (sp-samples-new duration 0.5))
(wvl1 (sp-sample-counts-from-list (make-list duration 20)))
(wvl2 (sp-sample-counts-from-list (make-list duration 10)))
(config
(list (vector 0 (vector amp1 amp1) (vector wvl1 wvl1) (vector 0 0))
(vector 1 (vector amp2 amp2) (vector wvl2 wvl2) (vector 0 0))))
(state (sp-fm-synth out out-start 2 start duration config state))
(state (sp-fm-synth out out-start 2 start duration config state)))
#t))
(define-test (sp-asynth)
(let*
( (duration 100) (channels 2) (out-start 1)
(out (map-integers channels (l (a) (sp-samples-new (+ out-start duration))))) (start 0)
(state #f) (amp1 (sp-samples-new duration 1))
(amp2 (sp-samples-new duration 0.5))
(wvl1 (sp-sample-counts-from-list (make-list duration 50)))
(wvl2 (sp-sample-counts-from-list (make-list duration 4)))
(config
(list (vector 5 50 (vector amp1 amp1) (vector wvl1 wvl1) (vector 0 0))
(vector 40 95 (vector amp2 amp2) (vector wvl2 wvl2) (vector 0 0))))
(state (sp-asynth out out-start 2 start duration config state))
(state (sp-asynth (map sp-samples-copy out) out-start 2 start duration config state)))
(assert-true (< 0.3 (sp-samples-ref (first out) 10)))))
(test-execute-procedures-lambda (sp-asynth) (sp-fm-synth)
(sp-convolve) (sp-convolution-filter-2)
(sp-convolution-filter) (sp-windowed-sinc ((2 2 2 2) 0.1 0.08) #t)
(sp-moving-average
; no prev/next
((2 2 2 2) #f #f 1) (1.3333333333333333 2.0 2.0 1.3333333333333333)
; no prev/next, bigger width
((1 2.5 4.0 1.5 -3.0) #f #f 2) (1.5 1.8 1.2 1.0 0.5)
; prev/next. expected taken from past output
((2 1 0 3) (8 4) (5 9) 4) (2.0 2.5555555555555554 3.5555555555555554 2.6666666666666665)
; no next but prev
((2 1 0 3) (8 4) #f 4) (2.0 2.0 2.0 1.1111111640930176)
; no prev but next
((2 1 0 3) #f (5 9) 4)
(0.6666666666666666 1.2222222222222223 2.2222222222222223 2.2222222222222223))
sp-file sp-fft (sp-samples-extract)))
| false |
c8288dfd47a45597b9d03acda95426cacb44c33e | 2bcf33718a53f5a938fd82bd0d484a423ff308d3 | /programming/sicp/ch3/ex-3.52.scm | 12cc310e6f2817db6ead6c5bf7b15d306c2ec8dc | [] | no_license | prurph/teach-yourself-cs | 50e598a0c781d79ff294434db0430f7f2c12ff53 | 4ce98ebab5a905ea1808b8785949ecb52eee0736 | refs/heads/main | 2023-08-30T06:28:22.247659 | 2021-10-17T18:27:26 | 2021-10-17T18:27:26 | 345,412,092 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 1,733 | scm | ex-3.52.scm | #lang sicp
(#%require "stream.scm")
;; https://mitpress.mit.edu/sites/default/files/sicp/full-text/book/book-Z-H-24.html#%_thm_3.52
(define sum 0)
(define (accum x) (set! sum (+ x sum)) sum)
(define seq (stream-map accum (stream-enumerate-interval 1 20)))
;; Sum is now 1 because only the car of the stream is evaluated
(define y (stream-filter even? seq))
;; Sum is now 6 because stream-filter evaluates the stream until the predicate
;; returns true, so it goes 1 -> 1 + 2 = 3 -> 3 + 3 -> 6
(define z (stream-filter (lambda (x) (= (remainder x 5) 0)) seq))
;; By the logic above, the stream is evaluated once more: 6 + 4 -> 10, so now
;; sum is 10. There is no re-evaluation of prior terms, so they don't get added
;; in again.
(stream-ref y 7)
;; Now seq is evaluated until we have 7 even terms, so the full evaluation is:
;; 6 (1 + 2 + 3)
;; 10 (6 + 4)
;; 28 (10 + 5 + 6 + 7)
;; 36 (28 + 8)
;; 66 (36 + 9 + 10 + 11)
;; 78 (66 + 12)
;; 120 (78 + 13 + 14 + 15)
;; 136 (120 + 16)
;; Consequently sum is 136, which is also what is returned.
(display-stream z)
;; Display-stream exhaustively evaluates z, displaying terms divisible by 5.
;; This requires full evaluation of seq.
;; 10
;; 15
;; 45
;; 55
;; 105
;; 120
;; 190
;; 210
;; It returns 'done. Now sum is 210, which happens to be the final value in seq.
;; If delay were simply (lambda () ...) then sum would immediately 210 after
;; the definition of seq, and each successive procedure call that evaluated seq
;; would exhausitvely re-evaluate all terms, adding 210 to sum for each of the
;; definitions of y and z. Then the terms up to 136 would be added for the
;; stream-ref call, and again another 210 for display-stream z.
| false |
2c271a378aeaa897ccb952094808063af86b7d40 | ac2a3544b88444eabf12b68a9bce08941cd62581 | /gsc/tests/40-univ/eval.scm | 1f0563ac0877fe4c0ddd2dccd088037ed5084d33 | [
"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 | 2,016 | scm | eval.scm | (declare (extended-bindings) (not safe))
(##define-macro (case-target . clauses)
(let ((target (if (and (pair? ##compilation-options)
(pair? (car ##compilation-options)))
(let ((t (assq 'target ##compilation-options)))
(if t (cadr t) 'c))
'c)))
(let loop ((clauses clauses))
(if (pair? clauses)
(let* ((clause (car clauses))
(cases (car clause)))
(if (or (eq? cases 'else)
(memq target cases))
`(begin ,@(cdr clause))
(loop (cdr clauses))))
`(begin)))))
(##define-macro (define-target name . clauses)
`(define ,name (case-target ,@clauses)))
(define-target num
((js php python ruby) "1")
(else 1))
(define-target str
((js php python ruby) "\"a string\"")
(else "a string"))
(define-target vd
((js) "undefined")
((php) "NULL")
((python) "None")
((ruby) "nil")
(else #!void))
(define-target flo
((js php python ruby) "2.5")
(else 2.5))
#;
(define-target fn
((js) "function(x) {return x}")
((python) "lambda x : x")
((ruby) "Proc.new {|x| x}")
(else (lambda (x) x)))
(case-target
((php)
(##inline-host-declaration
"function ev($x) {
eval(\"\\$x=$x;\");
return $x;
}"))
(else ""))
(define-target host
((js)
(##inline-host-expression "((typeof G_RTS !== 'undefined') ? G_RTS.host_function2scm : g_host_function2scm)(eval)"))
((python)
(##inline-host-expression "g_host_function2scm(eval)")
#;(##inline-host-expression "G_RTS.host_function2scm(eval)"))
((ruby)
(##inline-host-expression "g_host_function2scm(Proc.new {|x| eval(x)})")
#;(##inline-host-expression "G_RTS.host_function2scm(Proc.new {|x| eval(x)})"))
((php)
(##inline-host-expression "g_host_function2scm(\"ev\")")
#;(##inline-host-expression "G_RTS.host_function2scm(\"ev\")"))
(else (lambda (x) x)))
(println (host num))
(println (host flo))
(println (host str))
(println (host vd))
| false |
5c4a865794b62aa1ad0c600874ffa40a279ebf76 | 12fc725f8273ebfd9ece9ec19af748036823f495 | /tools/schemelib/wg/pass-globals.scm | 1a04775df7c7dd0b06d88b369487e3a667f43c72 | [] | no_license | contextlogger/contextlogger2 | 538e80c120f206553c4c88c5fc51546ae848785e | 8af400c3da088f25fd1420dd63889aff5feb1102 | refs/heads/master | 2020-05-05T05:03:47.896638 | 2011-10-05T23:50:14 | 2011-10-05T23:50:14 | 1,675,623 | 1 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 4,649 | scm | pass-globals.scm | ;;
;; Copyright 2006 Helsinki Institute for Information Technology (HIIT)
;; and the authors. All rights reserved.
;;
;; Authors: Tero Hasu <[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.
;;
(module
pass-globals
mzscheme
(require (lib "usual.scm" "wg"))
(require (lib "ast-util.scm" "wg"))
(require (lib "tables.scm" "wg"))
(require (lib "mop.scm" "wg"))
(require (prefix e. (lib "environment.scm" "wg")))
;; This pass finds all the globals in an AST, and adds them into a
;; name table of global names.
;;
;; The global namespace is not something consisting simply of
;; top-level items, no, because say static methods of classes (that
;; is, contained items) can also be referred to using fully qualified
;; names. This means that we require two separate name tables; one
;; containing qualified names, and another one containing local,
;; unqualified names. Global variables go to the table of qualified
;; names (in qualified form).
;;
;; When it comes to lookups, any fully qualified name (any name
;; beginning with "::") should only be looked up from the global name
;; table (in qualified form), and everything else is first looked up
;; from the chain of local environments, and only then from the
;; top-level environment (i.e., the globals).
;;
;; We build the global environment by doing a depth-first traversal,
;; which is simple to do, but we do have to keep track of the path
;; traversed to be able to form qualified names.
;;
;; This function returns a possibly modified version of g-table, but
;; ast^ and d-table are returned as is.
(define* (pass-table-globals ast^ tables)
(define g-table (get-g-table tables))
(letrec
((add-to-table-and-do
(lambda (names ast action . kw)
(let* ((name (get-reqd-nlist-elem-1 ast 'name))
(id (get-reqd-nlist-elem-1 ast 'decl-id))
(newnames (push names name))
(qname (make-qname newnames)))
(set! g-table (apply e.add-binding g-table qname id kw))
(action newnames))))
(trav
(lambda (names ast)
(cond
;; Not itself a global declaration, but may contain some.
;; Is nameless.
((list-named-one-of? ast '(cxx-unit body))
(for-each-elem (fix trav names) ast))
;; Not itself a global declaration, but may contain some.
;; Has a name.
((list-named? ast 'cxx-namespace)
(let ((name (get-reqd-nlist-memb-1 ast 'name)))
(for-each-elem (fix trav (push names name)) ast)))
;; Is a global declaration, and may contain others.
((list-named-one-of? ast '(cxx-class cxx-struct cxx-union))
(add-to-table-and-do
names ast
(lambda (newnames)
(for-each-elem (fix trav newnames) ast))))
;; Is a global declaration, but does not contain others.
;;
;; "inst-meth" is an exception here; in some sense it is
;; not global, as instance methods cannot be called in
;; just any context, but subclasses that want to
;; explicitly call the superclass method of a particular
;; ancestor should be able to resolve these as if they
;; were globals.
((list-named-one-of? ast '(cxx-typedef global-var class-var))
(add-to-table-and-do names ast do-nothing))
((list-named-one-of? ast '(global-func class-meth inst-meth))
(add-to-table-and-do names ast do-nothing #:is-func #t))
;; Anything else is neither a global declaration, nor
;; contains any.
))))
(trav '() ast^)
(list ast^ (set-g-table tables g-table))))
) ;; end module
| false |
d4fbdce3c5e929e803d81ee5264a6c36328b17d1 | 68c4bab1f5d5228078d603066b6c6cea87fdbc7a | /lab/frozen/just-born/rifle/src/mzscheme/little-error-control/little-error-control.ss | ca5d3feb6f75e1dce3680025aa074a06930bee41 | [] | no_license | felipelalli/micaroni | afab919dab304e21ba916aa6310dca102b1a04a5 | 741b628754b7c7085d3e68009a621242c2a1534e | refs/heads/master | 2023-08-03T06:25:15.405861 | 2023-07-25T14:44:56 | 2023-07-25T14:44:56 | 537,536 | 2 | 1 | null | null | null | null | UTF-8 | Scheme | false | false | 1,559 | ss | little-error-control.ss | ; Bom para ser usado somente em controle interno de erro, ou seja, como debug
(load "../little-type/little-type.ss")
(define NO_MESSAGE_ERROR "<no message>")
;(make-error 'error-name "message")
(define-syntax make-error
(syntax-rules ()
((make-error error-name)
(make-little-object 'error error-name NO_MESSAGE_ERROR))
((make-error error-name message)
(make-little-object 'error error-name message))))
;(error? obj)
(define-syntax error?
(syntax-rules ()
((error? obj)
(little-object obj is? 'error))))
; veja validate
(define validate-in-loop
(lambda l
(let ((cabeca (force (car l))))
(if (error? cabeca)
cabeca
(if (null? (cdr l))
#t
(eval `(validate-in-loop ,@(cdr l))))))))
; e.g.: (validate (boolean? #t) (pair? (cons 'a 'b)) (boolean? 10)) ; para muitas verificações
; e.g.: (validate boolean? #t) ; quando é um só valor!
; retorna um little-type de 'unexpected-param caso tenha ocorrido algum erro ou #t caso tenha corrido tudo bem
(define-syntax validate
(syntax-rules ()
((validate function obj)
(if (function obj) #t
(make-error 'unexpected-parameter
(string-append (symbol->string 'function) " is expected"))))
((validate (function obj))
(if (function obj) (delay #t)
(delay (make-error 'unexpected-parameter
(string-append (symbol->string 'function) " is expected")))))
((validate (function obj) ...)
(validate-in-loop (validate (function obj)) ...))))
| true |
fd4ab5e7bc32c8eee7ef9f15c78ebf0ecd824886 | c754c7467be397790a95c677a9ef649519be59fa | /src/chap4/amb-utils.scm | c358ade6f36f498067ba53e9648d7f308d69c43d | [
"MIT"
] | permissive | Pagliacii/my-sicp-solutions | 8117530185040aa8254f355e0ce78217d3e4b63b | 7a0ffa0e60126d3fddf506e4801dde37f586c52b | refs/heads/main | 2023-06-24T21:44:38.768363 | 2021-07-26T15:03:37 | 2021-07-26T15:03:37 | 388,704,426 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 309 | scm | amb-utils.scm | (define (an-element-of items)
(require (not (null? items)))
(amb (car items) (an-element-of (cdr items))))
(define (an-integer-starting-from n)
(amb n (an-integer-starting-from (+ n 1))))
(define (an-integer-between low high)
(require (<= low high))
(amb low (an-integer-between (+ low 1) high)))
| false |
921788ecb30098eba65aa9644c18a3c48a118b14 | 95b65c399510a7a52b7152b821b538b7a8046b3b | /2021/05/main.scm | 57ba24a1c4975598fa02f6ac1a188f96e324e72b | [] | 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 | 3,035 | scm | main.scm | (use-modules (ice-9 regex)
(ice-9 rdelim)
(ice-9 format)
(ice-9 match)
(srfi srfi-41)
(ice-9 streams))
(define lines
(stream->list
(stream-map
(lambda (line)
(let ((m (string-match "^([0-9]*),([0-9]*) -> ([0-9]*),([0-9]*)$" line)))
(cons (cons (string->number (match:substring m 1))
(string->number (match:substring m 2)))
(cons (string->number (match:substring m 3))
(string->number (match:substring m 4))))))
(port->stream (current-input-port) read-line))))
(define x car)
(define y cdr)
(define start car)
(define end cdr)
(define start-x (compose x start))
(define start-y (compose y start))
(define end-x (compose x end))
(define end-y (compose y end))
(define straight-lines
(filter (lambda (line) (or (= (x (start line))
(x (end line)))
(= (y (start line))
(y (end line)))))
lines))
(define (range from to)
((@ (srfi srfi-1) iota)
(1+ (- (max from to) (min from to))) (min from to)))
(define max-x (1+ (max (apply max (map end-x lines))
(apply max (map start-x lines)))))
(define max-y (1+ (max (apply max (map end-y lines))
(apply max (map start-y lines)))))
(format #t "max-x = ~a, max-y = ~a~%" max-x max-y)
(define world (make-array 0 max-y max-x))
(format #t "~y" world)
(define (line-range line)
(case (<=> (start-x line) (start-y line))
((1) ;; start greater
)
((0))
((-1))
)
(if (< (start-x line)
(end-x line))
;; else
)
(map (lambda (x)
(define m (min (start-y line) (end-y line)))
(cond ((= (start-y line) (end-y line)) (list x (start-y line)))
((< (start-y line) (end-y line)) (list x (+ m x)))
(else (list x (- m x)))))
(range (start-x line) (end-x line))))
(for-each (lambda (line)
(format #t "line ~a~%" line)
(for-each (match-lambda
((x y)
(array-set! world (1+ (array-ref world y x))
y x)))
(line-range line)))
lines)
(define count 0)
(for-each (lambda (y)
(for-each (lambda (x)
(when (< 1 (array-ref world y x))
(set! count (1+ count))))
(iota max-x)))
(iota max-y))
(if (> 100 max-y)
(for-each (lambda (y)
(display #\|)
(for-each (lambda (x)
(let ((value (array-ref world y x)))
(if (zero? value)
(format #t " ")
(format #t "~a" value))))
(iota max-x))
(display #\|)
(newline))
(iota max-y)))
(format #t "count = ~a~%" count)
| false |
6a3f38673a78d9d5176e4bb5977d191ad4a53d7d | ece1c4300b543df96cd22f63f55c09143989549c | /Chapter4/Exercise4.61.scm | 8c0d0d170c0a08897064109d1bbd1eec3d550911 | [] | no_license | candlc/SICP | e23a38359bdb9f43d30715345fca4cb83a545267 | 1c6cbf5ecf6397eaeb990738a938d48c193af1bb | refs/heads/master | 2022-03-04T02:55:33.594888 | 2019-11-04T09:11:34 | 2019-11-04T09:11:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 817 | scm | Exercise4.61.scm |
; Exercise 4.61: The following rules implement a next-to relation that finds adjacent elements of a list:
; (rule (?x next-to ?y in (?x ?y . ?u)))
; (rule (?x next-to ?y in (?v . ?z))
; (?x next-to ?y in ?z))
; What will the response be to the following queries?
; (?x next-to ?y in (1 (2 3) 4))
; (?x next-to 1 in (2 1 3 1))
(load "/Users/soulomoon/git/SICP/Chapter4/ch4-query.rkt")
; That I have to put the rule in setup in order for it to work
(define (inssert_to_init rule_list)
(for-each (lambda (rule) (set! microshaft-data-base (cons rule microshaft-data-base))) rule_list)
(setup-data-base))
(inssert_to_init '(
(rule (?x next-to ?y in (?x ?y . ?u)))
(rule (?x next-to ?y in (?v . ?z))
(?x next-to ?y in ?z))
))
(inqu'(
(?x next-to ?y in (1 (2 3) 4))
(?x next-to 1 in (2 1 3 1))
)) | false |
bee95b1c40e0b5ea42b5dc28edd8ad756315f435 | a09ad3e3cf64bc87282dea3902770afac90568a7 | /2/42.scm | 24a2ddc774ffb5bb9d58dd280f244960568019ab | [] | 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,777 | scm | 42.scm | #lang sicp
;; boilerplate
(define (accumulate proc initial sequence)
(if (null? sequence)
initial
(proc (car sequence)
(accumulate proc initial (cdr sequence)))))
(define (flatmap proc seq)
(accumulate append nil (map proc seq)))
(define (enumerate-interval low high)
(if (> low high)
nil
(cons low (enumerate-interval (+ low 1) high))))
; wut
(define (filter predicate l)
(cond ((null? l) nil)
(else (let ((head (car l))
(rest (cdr l)))
(if (predicate head)
(cons head (filter predicate rest))
(filter predicate rest))))))
;; actual code
(define (queens board-size)
(define empty-board nil)
(define (adjoin-position row col board)
(cons (cons row col) board))
(define (safe? col board)
(let ((queen (car board))) ; new queen is always at head of list
(not (accumulate (lambda (x y) (or x y)) false
(map (lambda (q)
(or (= (car q) (car queen))
(= (cdr q) (cdr queen))
(= (- (car q) (cdr q)) (- (car queen) (cdr queen)))))
(cdr board))))))
(define (queen-cols k)
(if (= k 0)
(list empty-board)
(filter
(lambda (positions) (safe? k positions))
(flatmap
(lambda (rest-of-queens)
(map (lambda (new-row)
(adjoin-position new-row k rest-of-queens))
(enumerate-interval 1 board-size)))
(queen-cols (- k 1))))))
(queen-cols board-size))
(queens 8)
| false |
abc24b2f5f796279abfb94c0d80328534c37f36c | 7cc14e6ab8e064fa967251e3249863e2cfbcc920 | /chapter-3/concurrency.scm | 4cd561dd46ddf33e3e112cc58ab012a6073d6836 | [] | no_license | xueeinstein/sicp-code | 0bec79419286705f58175067d474169afd6ba5fe | 49602b0b13cb9c338b6af089f989c17890ba6085 | refs/heads/master | 2021-01-10T01:20:03.089038 | 2015-11-24T03:25:54 | 2015-11-24T03:25:54 | 43,536,317 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 4,220 | scm | concurrency.scm | ;;; Bill Xue
;;; 2015-10-29
;;; Concurrency
;; Exercise 3.38
;; a)
;; 1. suppose the bank execute these three transaction
;; in order: Peter -> Paul -> Mary
;; the balance value is: (100 + 10 - 20) / 2 = 45
;; 2. in order: Peter -> Mary -> Paul
;; the balance value is: (100 + 10) / 2 - 20 = 35
;; 3. in order: Paul -> Peter -> Mary
;; the balance value is: (100 - 20 + 10) / 2 = 45
;; 4. in order: Paul -> Mary -> Peter
;; the balance value is: (100 - 20) / 2 + 10 = 50
;; 5. in order: Mary -> Peter -> Paul
;; the balance value is: 100 / 2 + 10 - 20 = 40
;; 6. in order: Mary -> Paul -> Peter
;; the balance value is: 100 / 2 - 20 + 10 = 40
;;
;; so the possible balance value is: 35, 40, 45, 50
;;
;; b)
;; Every withdraw operation can be divided into three
;; small steps:
;; access balance(A), get new balance(G), set balance(S)
;;
;; if the bank allow cross transaction, the final balance
;; depends on A & S operation order of Peter, Paul and Mary
;;
;; Notably, there three types:
;; Type I: (three cross)all A opers finished before S opers. e.g.
;; A1 S1
;; A2 S2
;; A3 S3
;; the final balance depends on the final S oper, so it can be
;; 100+10=110, 100-20=80, or 100/2=50
;;
;; Type II: no actual cross transaction. e.g.
;; A1 S1
;; A2 S2
;; A3 S3
;; this is a) question, the final balance can be 35, 40, 45, 50
;;
;; Type III: (two cross) e.g.
;; A1 S1
;; A2 S2
;; A3 S3
;; the final balance can be
;; 110-20=90, 110/2=55, 80+10=90, 80/2=40, 50+10=60, 50-20=30
;;
;; Summary:
;; possible final balance is:
;; 110, 90, 80, 60, 55, 50, 45, 40, 35, 30
;;
;; Exercise 3.39
(define x 10)
(define s (make-serializer))
(parallel-execute (lambda () (set! x
((s (lambda () (* x x))))))
(s (lambda () (set! x (+ x 1)))))
;; two procedure in serializer, p1: x+1->x, p2: x*x
;; 1. p1 execute before p2
;; final procedure is (set! x 121), so final x is 121
;; 2. p2 execute before p1
;; after p2, it generates new procedure, p3: (set! x 100)
;; if p3 execute before p1, get final x is 101
;; if p1 execute before p3, get final x is 100
;;
;; Summary:
;; All possible x value is: 100, 101, 121
;; Exercise 3.40
(define x 10)
(parallel-execute (lambda () (set! x (* x x)))
(lambda () (set! x (* x x x))))
;; two parallel procedures,
;; p1: (set! x (* x x)), p2: (set! x (* x x x))
;; and p1 has two A(access) opers, p2 has three A opers
;; while p1 two A opers may get different x value due to
;; S(set) oper from p2, and vice versa.
;; So x value can be:
;; Type I: no cross opers
;; (10^3)^2=10^6, (10^2)^3=10^6, 100, 1000
;; Type II: p2 S oper cross p1 A opers
;; 10*(10^3)=10^4
;; Type III: p1 S oper cross p2 A opers
;; 10*100*100=10^5 or 10*10*100=10^4
(define x 10)
(define s (make-serializer))
(parallel-execute (s (lambda () (set! x (* x x))))
(s (lambda () (set! x (* x x x)))))
;; after serializing, only 10^6 exists
;; Exercise 3.41
;;
;; Parallel access oper cannot influence the x value,
;; Ben is wrong, otherwise serialized withdraw and depends
;; opers will get different results
;; Exercise 3.42
(define (make-account-vBen balance)
(define (withdraw amount)
(if (>= balance amount)
(begin (set! balance (- balance amount))
balance)
"Insufficient funds"))
(define (deposit amount)
(set! balance (+ balance amount))
balance)
(let ((protected (make-serializer)))
(let ((protected-withdraw (protected withdraw))
(protected-deposit (protected deposit)))
(define (dispatch m)
(cond ((eq? m 'withdraw) protected-withdraw)
((eq? m 'deposit) protected-deposit)
((eq? m 'balance) balance)
(else
(error "Unknown request -- MAKE-ACCOUNT"
m))))
dispatch)))
;; it's safe!
;; Assuming we make account, try to withdraw 10, 20 at the same
;; time. If using Ben's implementation, we are parallel executing
;; (protected-withdraw 10) and (protected-withdraw 20)
;; The only difference is the new one serialize the procedures
;; before call the functions, but the original one do it when
;; call withdraw or deposit. | false |
5fa85c7413efd5ef8c9f7b24a0db92bad23bf2fa | 5f2104cd0f3d3144fe61b7d26ebb1e8cbd638c94 | /os2/share/snd/rgb.scm | 21f6ad4d86ca03cf4d8e28c5b6ce8d47b48b593f | [
"LicenseRef-scancode-warranty-disclaimer",
"BSD-3-Clause"
] | permissive | OS2World/MM-SOUND-Snd | 04025ecdce7578faf4401832d6f3f354424dd220 | b633660e5945a6a6b095cd9aa3178deab56b354f | refs/heads/master | 2020-05-19T21:40:24.155084 | 2014-03-25T15:17:12 | 2014-03-25T15:17:15 | 18,104,590 | 1 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 30,706 | scm | rgb.scm | ;;; X11 color names converted to Snd colors
(provide 'snd-rgb.scm)
;; tan -> tawny 24-Aug-01
(define snow (make-color 1.00 0.98 0.98))
(define ghost-white (make-color 0.97 0.97 1.00))
(define white-smoke (make-color 0.96 0.96 0.96))
(define gainsboro (make-color 0.86 0.86 0.86))
(define floral-white (make-color 1.00 0.98 0.94))
(define old-lace (make-color 0.99 0.96 0.90))
(define linen (make-color 0.98 0.94 0.90))
(define antique-white (make-color 0.98 0.92 0.84))
(define papaya-whip (make-color 1.00 0.93 0.83))
(define blanched-almond (make-color 1.00 0.92 0.80))
(define bisque (make-color 1.00 0.89 0.77))
(define peach-puff (make-color 1.00 0.85 0.72))
(define navajo-white (make-color 1.00 0.87 0.68))
(define moccasin (make-color 1.00 0.89 0.71))
(define cornsilk (make-color 1.00 0.97 0.86))
(define ivory (make-color 1.00 1.00 0.94))
(define lemon-chiffon (make-color 1.00 0.98 0.80))
(define seashell (make-color 1.00 0.96 0.93))
(define honeydew (make-color 0.94 1.00 0.94))
(define mint-cream (make-color 0.96 1.00 0.98))
(define azure (make-color 0.94 1.00 1.00))
(define alice-blue (make-color 0.94 0.97 1.00))
(define lavender (make-color 0.90 0.90 0.98))
(define lavender-blush (make-color 1.00 0.94 0.96))
(define misty-rose (make-color 1.00 0.89 0.88))
(define white (make-color 1.00 1.00 1.00))
(define black (make-color 0.00 0.00 0.00))
(define dark-slate-gray (make-color 0.18 0.31 0.31))
(define dark-slate-grey (make-color 0.18 0.31 0.31))
(define dim-gray (make-color 0.41 0.41 0.41))
(define dim-grey (make-color 0.41 0.41 0.41))
(define slate-gray (make-color 0.44 0.50 0.56))
(define slate-grey (make-color 0.44 0.50 0.56))
(define light-slate-gray (make-color 0.46 0.53 0.60))
(define light-slate-grey (make-color 0.46 0.53 0.60))
(define gray (make-color 0.74 0.74 0.74))
(define grey (make-color 0.74 0.74 0.74))
(define light-grey (make-color 0.82 0.82 0.82))
(define light-gray (make-color 0.82 0.82 0.82))
(define midnight-blue (make-color 0.10 0.10 0.44))
(define navy (make-color 0.00 0.00 0.50))
(define navy-blue (make-color 0.00 0.00 0.50))
(define cornflower-blue (make-color 0.39 0.58 0.93))
(define dark-slate-blue (make-color 0.28 0.24 0.54))
(define slate-blue (make-color 0.41 0.35 0.80))
(define medium-slate-blue (make-color 0.48 0.41 0.93))
(define light-slate-blue (make-color 0.52 0.44 1.00))
(define medium-blue (make-color 0.00 0.00 0.80))
(define royal-blue (make-color 0.25 0.41 0.88))
(define blue (make-color 0.00 0.00 1.00))
(define dodger-blue (make-color 0.12 0.56 1.00))
(define deep-sky-blue (make-color 0.00 0.75 1.00))
(define sky-blue (make-color 0.53 0.80 0.92))
(define light-sky-blue (make-color 0.53 0.80 0.98))
(define steel-blue (make-color 0.27 0.51 0.70))
(define light-steel-blue (make-color 0.69 0.77 0.87))
(define light-blue (make-color 0.68 0.84 0.90))
(define powder-blue (make-color 0.69 0.87 0.90))
(define pale-turquoise (make-color 0.68 0.93 0.93))
(define dark-turquoise (make-color 0.00 0.80 0.82))
(define medium-turquoise (make-color 0.28 0.82 0.80))
(define turquoise (make-color 0.25 0.87 0.81))
(define cyan (make-color 0.00 1.00 1.00))
(define light-cyan (make-color 0.87 1.00 1.00))
(define cadet-blue (make-color 0.37 0.62 0.62))
(define medium-aquamarine (make-color 0.40 0.80 0.66))
(define aquamarine (make-color 0.50 1.00 0.83))
(define dark-green (make-color 0.00 0.39 0.00))
(define dark-olive-green (make-color 0.33 0.42 0.18))
(define dark-sea-green (make-color 0.56 0.73 0.56))
(define sea-green (make-color 0.18 0.54 0.34))
(define medium-sea-green (make-color 0.23 0.70 0.44))
(define light-sea-green (make-color 0.12 0.70 0.66))
(define pale-green (make-color 0.59 0.98 0.59))
(define spring-green (make-color 0.00 1.00 0.50))
(define lawn-green (make-color 0.48 0.98 0.00))
(define green (make-color 0.00 1.00 0.00))
(define chartreuse (make-color 0.50 1.00 0.00))
(define medium-spring-green (make-color 0.00 0.98 0.60))
(define green-yellow (make-color 0.68 1.00 0.18))
(define lime-green (make-color 0.20 0.80 0.20))
(define yellow-green (make-color 0.60 0.80 0.20))
(define forest-green (make-color 0.13 0.54 0.13))
(define olive-drab (make-color 0.42 0.55 0.14))
(define dark-khaki (make-color 0.74 0.71 0.42))
(define khaki (make-color 0.94 0.90 0.55))
(define pale-goldenrod (make-color 0.93 0.91 0.66))
(define light-goldenrod-yellow (make-color 0.98 0.98 0.82))
(define light-yellow (make-color 1.00 1.00 0.87))
(define yellow (make-color 1.00 1.00 0.00))
(define gold (make-color 1.00 0.84 0.00))
(define light-goldenrod (make-color 0.93 0.86 0.51))
(define goldenrod (make-color 0.85 0.64 0.12))
(define dark-goldenrod (make-color 0.72 0.52 0.04))
(define rosy-brown (make-color 0.73 0.56 0.56))
(define indian-red (make-color 0.80 0.36 0.36))
(define saddle-brown (make-color 0.54 0.27 0.07))
(define sienna (make-color 0.62 0.32 0.18))
(define peru (make-color 0.80 0.52 0.25))
(define burlywood (make-color 0.87 0.72 0.53))
(define beige (make-color 0.96 0.96 0.86))
(define wheat (make-color 0.96 0.87 0.70))
(define sandy-brown (make-color 0.95 0.64 0.37))
(define tawny (make-color 0.82 0.70 0.55)) ; tan collides with Scheme built-in -- tawny suggested by Dave Phillips
(define chocolate (make-color 0.82 0.41 0.12))
(define firebrick (make-color 0.70 0.13 0.13))
(define brown (make-color 0.64 0.16 0.16))
(define dark-salmon (make-color 0.91 0.59 0.48))
(define salmon (make-color 0.98 0.50 0.45))
(define light-salmon (make-color 1.00 0.62 0.48))
(define orange (make-color 1.00 0.64 0.00))
(define dark-orange (make-color 1.00 0.55 0.00))
(define coral (make-color 1.00 0.50 0.31))
(define light-coral (make-color 0.94 0.50 0.50))
(define tomato (make-color 1.00 0.39 0.28))
(define orange-red (make-color 1.00 0.27 0.00))
(define red (make-color 1.00 0.00 0.00))
(define hot-pink (make-color 1.00 0.41 0.70))
(define deep-pink (make-color 1.00 0.08 0.57))
(define pink (make-color 1.00 0.75 0.79))
(define light-pink (make-color 1.00 0.71 0.75))
(define pale-violet-red (make-color 0.86 0.44 0.57))
(define maroon (make-color 0.69 0.19 0.37))
(define medium-violet-red (make-color 0.78 0.08 0.52))
(define violet-red (make-color 0.81 0.12 0.56))
(define magenta (make-color 1.00 0.00 1.00))
(define violet (make-color 0.93 0.51 0.93))
(define plum (make-color 0.86 0.62 0.86))
(define orchid (make-color 0.85 0.44 0.84))
(define medium-orchid (make-color 0.73 0.33 0.82))
(define dark-orchid (make-color 0.60 0.20 0.80))
(define dark-violet (make-color 0.58 0.00 0.82))
(define blue-violet (make-color 0.54 0.17 0.88))
(define purple (make-color 0.62 0.12 0.94))
(define medium-purple (make-color 0.57 0.44 0.86))
(define thistle (make-color 0.84 0.75 0.84))
(define snow1 (make-color 1.00 0.98 0.98))
(define snow2 (make-color 0.93 0.91 0.91))
(define snow3 (make-color 0.80 0.79 0.79))
(define snow4 (make-color 0.54 0.54 0.54))
(define seashell1 (make-color 1.00 0.96 0.93))
(define seashell2 (make-color 0.93 0.89 0.87))
(define seashell3 (make-color 0.80 0.77 0.75))
(define seashell4 (make-color 0.54 0.52 0.51))
(define antiquewhite1 (make-color 1.00 0.93 0.86))
(define antiquewhite2 (make-color 0.93 0.87 0.80))
(define antiquewhite3 (make-color 0.80 0.75 0.69))
(define antiquewhite4 (make-color 0.54 0.51 0.47))
(define bisque1 (make-color 1.00 0.89 0.77))
(define bisque2 (make-color 0.93 0.83 0.71))
(define bisque3 (make-color 0.80 0.71 0.62))
(define bisque4 (make-color 0.54 0.49 0.42))
(define peachpuff1 (make-color 1.00 0.85 0.72))
(define peachpuff2 (make-color 0.93 0.79 0.68))
(define peachpuff3 (make-color 0.80 0.68 0.58))
(define peachpuff4 (make-color 0.54 0.46 0.39))
(define navajowhite1 (make-color 1.00 0.87 0.68))
(define navajowhite2 (make-color 0.93 0.81 0.63))
(define navajowhite3 (make-color 0.80 0.70 0.54))
(define navajowhite4 (make-color 0.54 0.47 0.37))
(define lemonchiffon1 (make-color 1.00 0.98 0.80))
(define lemonchiffon2 (make-color 0.93 0.91 0.75))
(define lemonchiffon3 (make-color 0.80 0.79 0.64))
(define lemonchiffon4 (make-color 0.54 0.54 0.44))
(define cornsilk1 (make-color 1.00 0.97 0.86))
(define cornsilk2 (make-color 0.93 0.91 0.80))
(define cornsilk3 (make-color 0.80 0.78 0.69))
(define cornsilk4 (make-color 0.54 0.53 0.47))
(define ivory1 (make-color 1.00 1.00 0.94))
(define ivory2 (make-color 0.93 0.93 0.87))
(define ivory3 (make-color 0.80 0.80 0.75))
(define ivory4 (make-color 0.54 0.54 0.51))
(define honeydew1 (make-color 0.94 1.00 0.94))
(define honeydew2 (make-color 0.87 0.93 0.87))
(define honeydew3 (make-color 0.75 0.80 0.75))
(define honeydew4 (make-color 0.51 0.54 0.51))
(define lavenderblush1 (make-color 1.00 0.94 0.96))
(define lavenderblush2 (make-color 0.93 0.87 0.89))
(define lavenderblush3 (make-color 0.80 0.75 0.77))
(define lavenderblush4 (make-color 0.54 0.51 0.52))
(define mistyrose1 (make-color 1.00 0.89 0.88))
(define mistyrose2 (make-color 0.93 0.83 0.82))
(define mistyrose3 (make-color 0.80 0.71 0.71))
(define mistyrose4 (make-color 0.54 0.49 0.48))
(define azure1 (make-color 0.94 1.00 1.00))
(define azure2 (make-color 0.87 0.93 0.93))
(define azure3 (make-color 0.75 0.80 0.80))
(define azure4 (make-color 0.51 0.54 0.54))
(define slateblue1 (make-color 0.51 0.43 1.00))
(define slateblue2 (make-color 0.48 0.40 0.93))
(define slateblue3 (make-color 0.41 0.35 0.80))
(define slateblue4 (make-color 0.28 0.23 0.54))
(define royalblue1 (make-color 0.28 0.46 1.00))
(define royalblue2 (make-color 0.26 0.43 0.93))
(define royalblue3 (make-color 0.23 0.37 0.80))
(define royalblue4 (make-color 0.15 0.25 0.54))
(define blue1 (make-color 0.00 0.00 1.00))
(define blue2 (make-color 0.00 0.00 0.93))
(define blue3 (make-color 0.00 0.00 0.80))
(define blue4 (make-color 0.00 0.00 0.54))
(define dodgerblue1 (make-color 0.12 0.56 1.00))
(define dodgerblue2 (make-color 0.11 0.52 0.93))
(define dodgerblue3 (make-color 0.09 0.45 0.80))
(define dodgerblue4 (make-color 0.06 0.30 0.54))
(define steelblue1 (make-color 0.39 0.72 1.00))
(define steelblue2 (make-color 0.36 0.67 0.93))
(define steelblue3 (make-color 0.31 0.58 0.80))
(define steelblue4 (make-color 0.21 0.39 0.54))
(define deepskyblue1 (make-color 0.00 0.75 1.00))
(define deepskyblue2 (make-color 0.00 0.70 0.93))
(define deepskyblue3 (make-color 0.00 0.60 0.80))
(define deepskyblue4 (make-color 0.00 0.41 0.54))
(define skyblue1 (make-color 0.53 0.80 1.00))
(define skyblue2 (make-color 0.49 0.75 0.93))
(define skyblue3 (make-color 0.42 0.65 0.80))
(define skyblue4 (make-color 0.29 0.44 0.54))
(define lightskyblue1 (make-color 0.69 0.88 1.00))
(define lightskyblue2 (make-color 0.64 0.82 0.93))
(define lightskyblue3 (make-color 0.55 0.71 0.80))
(define lightskyblue4 (make-color 0.37 0.48 0.54))
(define slategray1 (make-color 0.77 0.88 1.00))
(define slategray2 (make-color 0.72 0.82 0.93))
(define slategray3 (make-color 0.62 0.71 0.80))
(define slategray4 (make-color 0.42 0.48 0.54))
(define lightsteelblue1 (make-color 0.79 0.88 1.00))
(define lightsteelblue2 (make-color 0.73 0.82 0.93))
(define lightsteelblue3 (make-color 0.63 0.71 0.80))
(define lightsteelblue4 (make-color 0.43 0.48 0.54))
(define lightblue1 (make-color 0.75 0.93 1.00))
(define lightblue2 (make-color 0.70 0.87 0.93))
(define lightblue3 (make-color 0.60 0.75 0.80))
(define lightblue4 (make-color 0.41 0.51 0.54))
(define lightcyan1 (make-color 0.87 1.00 1.00))
(define lightcyan2 (make-color 0.82 0.93 0.93))
(define lightcyan3 (make-color 0.70 0.80 0.80))
(define lightcyan4 (make-color 0.48 0.54 0.54))
(define paleturquoise1 (make-color 0.73 1.00 1.00))
(define paleturquoise2 (make-color 0.68 0.93 0.93))
(define paleturquoise3 (make-color 0.59 0.80 0.80))
(define paleturquoise4 (make-color 0.40 0.54 0.54))
(define cadetblue1 (make-color 0.59 0.96 1.00))
(define cadetblue2 (make-color 0.55 0.89 0.93))
(define cadetblue3 (make-color 0.48 0.77 0.80))
(define cadetblue4 (make-color 0.32 0.52 0.54))
(define turquoise1 (make-color 0.00 0.96 1.00))
(define turquoise2 (make-color 0.00 0.89 0.93))
(define turquoise3 (make-color 0.00 0.77 0.80))
(define turquoise4 (make-color 0.00 0.52 0.54))
(define cyan1 (make-color 0.00 1.00 1.00))
(define cyan2 (make-color 0.00 0.93 0.93))
(define cyan3 (make-color 0.00 0.80 0.80))
(define cyan4 (make-color 0.00 0.54 0.54))
(define darkslategray1 (make-color 0.59 1.00 1.00))
(define darkslategray2 (make-color 0.55 0.93 0.93))
(define darkslategray3 (make-color 0.47 0.80 0.80))
(define darkslategray4 (make-color 0.32 0.54 0.54))
(define aquamarine1 (make-color 0.50 1.00 0.83))
(define aquamarine2 (make-color 0.46 0.93 0.77))
(define aquamarine3 (make-color 0.40 0.80 0.66))
(define aquamarine4 (make-color 0.27 0.54 0.45))
(define darkseagreen1 (make-color 0.75 1.00 0.75))
(define darkseagreen2 (make-color 0.70 0.93 0.70))
(define darkseagreen3 (make-color 0.61 0.80 0.61))
(define darkseagreen4 (make-color 0.41 0.54 0.41))
(define seagreen1 (make-color 0.33 1.00 0.62))
(define seagreen2 (make-color 0.30 0.93 0.58))
(define seagreen3 (make-color 0.26 0.80 0.50))
(define seagreen4 (make-color 0.18 0.54 0.34))
(define palegreen1 (make-color 0.60 1.00 0.60))
(define palegreen2 (make-color 0.56 0.93 0.56))
(define palegreen3 (make-color 0.48 0.80 0.48))
(define palegreen4 (make-color 0.33 0.54 0.33))
(define springgreen1 (make-color 0.00 1.00 0.50))
(define springgreen2 (make-color 0.00 0.93 0.46))
(define springgreen3 (make-color 0.00 0.80 0.40))
(define springgreen4 (make-color 0.00 0.54 0.27))
(define green1 (make-color 0.00 1.00 0.00))
(define green2 (make-color 0.00 0.93 0.00))
(define green3 (make-color 0.00 0.80 0.00))
(define green4 (make-color 0.00 0.54 0.00))
(define chartreuse1 (make-color 0.50 1.00 0.00))
(define chartreuse2 (make-color 0.46 0.93 0.00))
(define chartreuse3 (make-color 0.40 0.80 0.00))
(define chartreuse4 (make-color 0.27 0.54 0.00))
(define olivedrab1 (make-color 0.75 1.00 0.24))
(define olivedrab2 (make-color 0.70 0.93 0.23))
(define olivedrab3 (make-color 0.60 0.80 0.20))
(define olivedrab4 (make-color 0.41 0.54 0.13))
(define darkolivegreen1 (make-color 0.79 1.00 0.44))
(define darkolivegreen2 (make-color 0.73 0.93 0.41))
(define darkolivegreen3 (make-color 0.63 0.80 0.35))
(define darkolivegreen4 (make-color 0.43 0.54 0.24))
(define khaki1 (make-color 1.00 0.96 0.56))
(define khaki2 (make-color 0.93 0.90 0.52))
(define khaki3 (make-color 0.80 0.77 0.45))
(define khaki4 (make-color 0.54 0.52 0.30))
(define lightgoldenrod1 (make-color 1.00 0.92 0.54))
(define lightgoldenrod2 (make-color 0.93 0.86 0.51))
(define lightgoldenrod3 (make-color 0.80 0.74 0.44))
(define lightgoldenrod4 (make-color 0.54 0.50 0.30))
(define lightyellow1 (make-color 1.00 1.00 0.87))
(define lightyellow2 (make-color 0.93 0.93 0.82))
(define lightyellow3 (make-color 0.80 0.80 0.70))
(define lightyellow4 (make-color 0.54 0.54 0.48))
(define yellow1 (make-color 1.00 1.00 0.00))
(define yellow2 (make-color 0.93 0.93 0.00))
(define yellow3 (make-color 0.80 0.80 0.00))
(define yellow4 (make-color 0.54 0.54 0.00))
(define gold1 (make-color 1.00 0.84 0.00))
(define gold2 (make-color 0.93 0.79 0.00))
(define gold3 (make-color 0.80 0.68 0.00))
(define gold4 (make-color 0.54 0.46 0.00))
(define goldenrod1 (make-color 1.00 0.75 0.14))
(define goldenrod2 (make-color 0.93 0.70 0.13))
(define goldenrod3 (make-color 0.80 0.61 0.11))
(define goldenrod4 (make-color 0.54 0.41 0.08))
(define darkgoldenrod1 (make-color 1.00 0.72 0.06))
(define darkgoldenrod2 (make-color 0.93 0.68 0.05))
(define darkgoldenrod3 (make-color 0.80 0.58 0.05))
(define darkgoldenrod4 (make-color 0.54 0.39 0.03))
(define rosybrown1 (make-color 1.00 0.75 0.75))
(define rosybrown2 (make-color 0.93 0.70 0.70))
(define rosybrown3 (make-color 0.80 0.61 0.61))
(define rosybrown4 (make-color 0.54 0.41 0.41))
(define indianred1 (make-color 1.00 0.41 0.41))
(define indianred2 (make-color 0.93 0.39 0.39))
(define indianred3 (make-color 0.80 0.33 0.33))
(define indianred4 (make-color 0.54 0.23 0.23))
(define sienna1 (make-color 1.00 0.51 0.28))
(define sienna2 (make-color 0.93 0.47 0.26))
(define sienna3 (make-color 0.80 0.41 0.22))
(define sienna4 (make-color 0.54 0.28 0.15))
(define burlywood1 (make-color 1.00 0.82 0.61))
(define burlywood2 (make-color 0.93 0.77 0.57))
(define burlywood3 (make-color 0.80 0.66 0.49))
(define burlywood4 (make-color 0.54 0.45 0.33))
(define wheat1 (make-color 1.00 0.90 0.73))
(define wheat2 (make-color 0.93 0.84 0.68))
(define wheat3 (make-color 0.80 0.73 0.59))
(define wheat4 (make-color 0.54 0.49 0.40))
(define tan1 (make-color 1.00 0.64 0.31))
(define tan2 (make-color 0.93 0.60 0.29))
(define tan3 (make-color 0.80 0.52 0.25))
(define tan4 (make-color 0.54 0.35 0.17))
(define chocolate1 (make-color 1.00 0.50 0.14))
(define chocolate2 (make-color 0.93 0.46 0.13))
(define chocolate3 (make-color 0.80 0.40 0.11))
(define chocolate4 (make-color 0.54 0.27 0.07))
(define firebrick1 (make-color 1.00 0.19 0.19))
(define firebrick2 (make-color 0.93 0.17 0.17))
(define firebrick3 (make-color 0.80 0.15 0.15))
(define firebrick4 (make-color 0.54 0.10 0.10))
(define brown1 (make-color 1.00 0.25 0.25))
(define brown2 (make-color 0.93 0.23 0.23))
(define brown3 (make-color 0.80 0.20 0.20))
(define brown4 (make-color 0.54 0.14 0.14))
(define salmon1 (make-color 1.00 0.55 0.41))
(define salmon2 (make-color 0.93 0.51 0.38))
(define salmon3 (make-color 0.80 0.44 0.33))
(define salmon4 (make-color 0.54 0.30 0.22))
(define lightsalmon1 (make-color 1.00 0.62 0.48))
(define lightsalmon2 (make-color 0.93 0.58 0.45))
(define lightsalmon3 (make-color 0.80 0.50 0.38))
(define lightsalmon4 (make-color 0.54 0.34 0.26))
(define orange1 (make-color 1.00 0.64 0.00))
(define orange2 (make-color 0.93 0.60 0.00))
(define orange3 (make-color 0.80 0.52 0.00))
(define orange4 (make-color 0.54 0.35 0.00))
(define darkorange1 (make-color 1.00 0.50 0.00))
(define darkorange2 (make-color 0.93 0.46 0.00))
(define darkorange3 (make-color 0.80 0.40 0.00))
(define darkorange4 (make-color 0.54 0.27 0.00))
(define coral1 (make-color 1.00 0.45 0.34))
(define coral2 (make-color 0.93 0.41 0.31))
(define coral3 (make-color 0.80 0.36 0.27))
(define coral4 (make-color 0.54 0.24 0.18))
(define tomato1 (make-color 1.00 0.39 0.28))
(define tomato2 (make-color 0.93 0.36 0.26))
(define tomato3 (make-color 0.80 0.31 0.22))
(define tomato4 (make-color 0.54 0.21 0.15))
(define orangered1 (make-color 1.00 0.27 0.00))
(define orangered2 (make-color 0.93 0.25 0.00))
(define orangered3 (make-color 0.80 0.21 0.00))
(define orangered4 (make-color 0.54 0.14 0.00))
(define red1 (make-color 1.00 0.00 0.00))
(define red2 (make-color 0.93 0.00 0.00))
(define red3 (make-color 0.80 0.00 0.00))
(define red4 (make-color 0.54 0.00 0.00))
(define deeppink1 (make-color 1.00 0.08 0.57))
(define deeppink2 (make-color 0.93 0.07 0.54))
(define deeppink3 (make-color 0.80 0.06 0.46))
(define deeppink4 (make-color 0.54 0.04 0.31))
(define hotpink1 (make-color 1.00 0.43 0.70))
(define hotpink2 (make-color 0.93 0.41 0.65))
(define hotpink3 (make-color 0.80 0.37 0.56))
(define hotpink4 (make-color 0.54 0.23 0.38))
(define pink1 (make-color 1.00 0.71 0.77))
(define pink2 (make-color 0.93 0.66 0.72))
(define pink3 (make-color 0.80 0.57 0.62))
(define pink4 (make-color 0.54 0.39 0.42))
(define lightpink1 (make-color 1.00 0.68 0.72))
(define lightpink2 (make-color 0.93 0.63 0.68))
(define lightpink3 (make-color 0.80 0.55 0.58))
(define lightpink4 (make-color 0.54 0.37 0.39))
(define palevioletred1 (make-color 1.00 0.51 0.67))
(define palevioletred2 (make-color 0.93 0.47 0.62))
(define palevioletred3 (make-color 0.80 0.41 0.54))
(define palevioletred4 (make-color 0.54 0.28 0.36))
(define maroon1 (make-color 1.00 0.20 0.70))
(define maroon2 (make-color 0.93 0.19 0.65))
(define maroon3 (make-color 0.80 0.16 0.56))
(define maroon4 (make-color 0.54 0.11 0.38))
(define violetred1 (make-color 1.00 0.24 0.59))
(define violetred2 (make-color 0.93 0.23 0.55))
(define violetred3 (make-color 0.80 0.20 0.47))
(define violetred4 (make-color 0.54 0.13 0.32))
(define magenta1 (make-color 1.00 0.00 1.00))
(define magenta2 (make-color 0.93 0.00 0.93))
(define magenta3 (make-color 0.80 0.00 0.80))
(define magenta4 (make-color 0.54 0.00 0.54))
(define orchid1 (make-color 1.00 0.51 0.98))
(define orchid2 (make-color 0.93 0.48 0.91))
(define orchid3 (make-color 0.80 0.41 0.79))
(define orchid4 (make-color 0.54 0.28 0.54))
(define plum1 (make-color 1.00 0.73 1.00))
(define plum2 (make-color 0.93 0.68 0.93))
(define plum3 (make-color 0.80 0.59 0.80))
(define plum4 (make-color 0.54 0.40 0.54))
(define mediumorchid1 (make-color 0.87 0.40 1.00))
(define mediumorchid2 (make-color 0.82 0.37 0.93))
(define mediumorchid3 (make-color 0.70 0.32 0.80))
(define mediumorchid4 (make-color 0.48 0.21 0.54))
(define darkorchid1 (make-color 0.75 0.24 1.00))
(define darkorchid2 (make-color 0.70 0.23 0.93))
(define darkorchid3 (make-color 0.60 0.20 0.80))
(define darkorchid4 (make-color 0.41 0.13 0.54))
(define purple1 (make-color 0.61 0.19 1.00))
(define purple2 (make-color 0.57 0.17 0.93))
(define purple3 (make-color 0.49 0.15 0.80))
(define purple4 (make-color 0.33 0.10 0.54))
(define mediumpurple1 (make-color 0.67 0.51 1.00))
(define mediumpurple2 (make-color 0.62 0.47 0.93))
(define mediumpurple3 (make-color 0.54 0.41 0.80))
(define mediumpurple4 (make-color 0.36 0.28 0.54))
(define thistle1 (make-color 1.00 0.88 1.00))
(define thistle2 (make-color 0.93 0.82 0.93))
(define thistle3 (make-color 0.80 0.71 0.80))
(define thistle4 (make-color 0.54 0.48 0.54))
(define gray0 (make-color 0.00 0.00 0.00))
(define grey0 (make-color 0.00 0.00 0.00))
(define gray1 (make-color 0.01 0.01 0.01))
(define grey1 (make-color 0.01 0.01 0.01))
(define gray2 (make-color 0.02 0.02 0.02))
(define grey2 (make-color 0.02 0.02 0.02))
(define gray3 (make-color 0.03 0.03 0.03))
(define grey3 (make-color 0.03 0.03 0.03))
(define gray4 (make-color 0.04 0.04 0.04))
(define grey4 (make-color 0.04 0.04 0.04))
(define gray5 (make-color 0.05 0.05 0.05))
(define grey5 (make-color 0.05 0.05 0.05))
(define gray6 (make-color 0.06 0.06 0.06))
(define grey6 (make-color 0.06 0.06 0.06))
(define gray7 (make-color 0.07 0.07 0.07))
(define grey7 (make-color 0.07 0.07 0.07))
(define gray8 (make-color 0.08 0.08 0.08))
(define grey8 (make-color 0.08 0.08 0.08))
(define gray9 (make-color 0.09 0.09 0.09))
(define grey9 (make-color 0.09 0.09 0.09))
(define gray10 (make-color 0.10 0.10 0.10))
(define grey10 (make-color 0.10 0.10 0.10))
(define gray11 (make-color 0.11 0.11 0.11))
(define grey11 (make-color 0.11 0.11 0.11))
(define gray12 (make-color 0.12 0.12 0.12))
(define grey12 (make-color 0.12 0.12 0.12))
(define gray13 (make-color 0.13 0.13 0.13))
(define grey13 (make-color 0.13 0.13 0.13))
(define gray14 (make-color 0.14 0.14 0.14))
(define grey14 (make-color 0.14 0.14 0.14))
(define gray15 (make-color 0.15 0.15 0.15))
(define grey15 (make-color 0.15 0.15 0.15))
(define gray16 (make-color 0.16 0.16 0.16))
(define grey16 (make-color 0.16 0.16 0.16))
(define gray17 (make-color 0.17 0.17 0.17))
(define grey17 (make-color 0.17 0.17 0.17))
(define gray18 (make-color 0.18 0.18 0.18))
(define grey18 (make-color 0.18 0.18 0.18))
(define gray19 (make-color 0.19 0.19 0.19))
(define grey19 (make-color 0.19 0.19 0.19))
(define gray20 (make-color 0.20 0.20 0.20))
(define grey20 (make-color 0.20 0.20 0.20))
(define gray21 (make-color 0.21 0.21 0.21))
(define grey21 (make-color 0.21 0.21 0.21))
(define gray22 (make-color 0.22 0.22 0.22))
(define grey22 (make-color 0.22 0.22 0.22))
(define gray23 (make-color 0.23 0.23 0.23))
(define grey23 (make-color 0.23 0.23 0.23))
(define gray24 (make-color 0.24 0.24 0.24))
(define grey24 (make-color 0.24 0.24 0.24))
(define gray25 (make-color 0.25 0.25 0.25))
(define grey25 (make-color 0.25 0.25 0.25))
(define gray26 (make-color 0.26 0.26 0.26))
(define grey26 (make-color 0.26 0.26 0.26))
(define gray27 (make-color 0.27 0.27 0.27))
(define grey27 (make-color 0.27 0.27 0.27))
(define gray28 (make-color 0.28 0.28 0.28))
(define grey28 (make-color 0.28 0.28 0.28))
(define gray29 (make-color 0.29 0.29 0.29))
(define grey29 (make-color 0.29 0.29 0.29))
(define gray30 (make-color 0.30 0.30 0.30))
(define grey30 (make-color 0.30 0.30 0.30))
(define gray31 (make-color 0.31 0.31 0.31))
(define grey31 (make-color 0.31 0.31 0.31))
(define gray32 (make-color 0.32 0.32 0.32))
(define grey32 (make-color 0.32 0.32 0.32))
(define gray33 (make-color 0.33 0.33 0.33))
(define grey33 (make-color 0.33 0.33 0.33))
(define gray34 (make-color 0.34 0.34 0.34))
(define grey34 (make-color 0.34 0.34 0.34))
(define gray35 (make-color 0.35 0.35 0.35))
(define grey35 (make-color 0.35 0.35 0.35))
(define gray36 (make-color 0.36 0.36 0.36))
(define grey36 (make-color 0.36 0.36 0.36))
(define gray37 (make-color 0.37 0.37 0.37))
(define grey37 (make-color 0.37 0.37 0.37))
(define gray38 (make-color 0.38 0.38 0.38))
(define grey38 (make-color 0.38 0.38 0.38))
(define gray39 (make-color 0.39 0.39 0.39))
(define grey39 (make-color 0.39 0.39 0.39))
(define gray40 (make-color 0.40 0.40 0.40))
(define grey40 (make-color 0.40 0.40 0.40))
(define gray41 (make-color 0.41 0.41 0.41))
(define grey41 (make-color 0.41 0.41 0.41))
(define gray42 (make-color 0.42 0.42 0.42))
(define grey42 (make-color 0.42 0.42 0.42))
(define gray43 (make-color 0.43 0.43 0.43))
(define grey43 (make-color 0.43 0.43 0.43))
(define gray44 (make-color 0.44 0.44 0.44))
(define grey44 (make-color 0.44 0.44 0.44))
(define gray45 (make-color 0.45 0.45 0.45))
(define grey45 (make-color 0.45 0.45 0.45))
(define gray46 (make-color 0.46 0.46 0.46))
(define grey46 (make-color 0.46 0.46 0.46))
(define gray47 (make-color 0.47 0.47 0.47))
(define grey47 (make-color 0.47 0.47 0.47))
(define gray48 (make-color 0.48 0.48 0.48))
(define grey48 (make-color 0.48 0.48 0.48))
(define gray49 (make-color 0.49 0.49 0.49))
(define grey49 (make-color 0.49 0.49 0.49))
(define gray50 (make-color 0.50 0.50 0.50))
(define grey50 (make-color 0.50 0.50 0.50))
(define gray51 (make-color 0.51 0.51 0.51))
(define grey51 (make-color 0.51 0.51 0.51))
(define gray52 (make-color 0.52 0.52 0.52))
(define grey52 (make-color 0.52 0.52 0.52))
(define gray53 (make-color 0.53 0.53 0.53))
(define grey53 (make-color 0.53 0.53 0.53))
(define gray54 (make-color 0.54 0.54 0.54))
(define grey54 (make-color 0.54 0.54 0.54))
(define gray55 (make-color 0.55 0.55 0.55))
(define grey55 (make-color 0.55 0.55 0.55))
(define gray56 (make-color 0.56 0.56 0.56))
(define grey56 (make-color 0.56 0.56 0.56))
(define gray57 (make-color 0.57 0.57 0.57))
(define grey57 (make-color 0.57 0.57 0.57))
(define gray58 (make-color 0.58 0.58 0.58))
(define grey58 (make-color 0.58 0.58 0.58))
(define gray59 (make-color 0.59 0.59 0.59))
(define grey59 (make-color 0.59 0.59 0.59))
(define gray60 (make-color 0.60 0.60 0.60))
(define grey60 (make-color 0.60 0.60 0.60))
(define gray61 (make-color 0.61 0.61 0.61))
(define grey61 (make-color 0.61 0.61 0.61))
(define gray62 (make-color 0.62 0.62 0.62))
(define grey62 (make-color 0.62 0.62 0.62))
(define gray63 (make-color 0.63 0.63 0.63))
(define grey63 (make-color 0.63 0.63 0.63))
(define gray64 (make-color 0.64 0.64 0.64))
(define grey64 (make-color 0.64 0.64 0.64))
(define gray65 (make-color 0.65 0.65 0.65))
(define grey65 (make-color 0.65 0.65 0.65))
(define gray66 (make-color 0.66 0.66 0.66))
(define grey66 (make-color 0.66 0.66 0.66))
(define gray67 (make-color 0.67 0.67 0.67))
(define grey67 (make-color 0.67 0.67 0.67))
(define gray68 (make-color 0.68 0.68 0.68))
(define grey68 (make-color 0.68 0.68 0.68))
(define gray69 (make-color 0.69 0.69 0.69))
(define grey69 (make-color 0.69 0.69 0.69))
(define gray70 (make-color 0.70 0.70 0.70))
(define grey70 (make-color 0.70 0.70 0.70))
(define gray71 (make-color 0.71 0.71 0.71))
(define grey71 (make-color 0.71 0.71 0.71))
(define gray72 (make-color 0.72 0.72 0.72))
(define grey72 (make-color 0.72 0.72 0.72))
(define gray73 (make-color 0.73 0.73 0.73))
(define grey73 (make-color 0.73 0.73 0.73))
(define gray74 (make-color 0.74 0.74 0.74))
(define grey74 (make-color 0.74 0.74 0.74))
(define gray75 (make-color 0.75 0.75 0.75))
(define grey75 (make-color 0.75 0.75 0.75))
(define gray76 (make-color 0.76 0.76 0.76))
(define grey76 (make-color 0.76 0.76 0.76))
(define gray77 (make-color 0.77 0.77 0.77))
(define grey77 (make-color 0.77 0.77 0.77))
(define gray78 (make-color 0.78 0.78 0.78))
(define grey78 (make-color 0.78 0.78 0.78))
(define gray79 (make-color 0.79 0.79 0.79))
(define grey79 (make-color 0.79 0.79 0.79))
(define gray80 (make-color 0.80 0.80 0.80))
(define grey80 (make-color 0.80 0.80 0.80))
(define gray81 (make-color 0.81 0.81 0.81))
(define grey81 (make-color 0.81 0.81 0.81))
(define gray82 (make-color 0.82 0.82 0.82))
(define grey82 (make-color 0.82 0.82 0.82))
(define gray83 (make-color 0.83 0.83 0.83))
(define grey83 (make-color 0.83 0.83 0.83))
(define gray84 (make-color 0.84 0.84 0.84))
(define grey84 (make-color 0.84 0.84 0.84))
(define gray85 (make-color 0.85 0.85 0.85))
(define grey85 (make-color 0.85 0.85 0.85))
(define gray86 (make-color 0.86 0.86 0.86))
(define grey86 (make-color 0.86 0.86 0.86))
(define gray87 (make-color 0.87 0.87 0.87))
(define grey87 (make-color 0.87 0.87 0.87))
(define gray88 (make-color 0.87 0.87 0.87))
(define grey88 (make-color 0.87 0.87 0.87))
(define gray89 (make-color 0.89 0.89 0.89))
(define grey89 (make-color 0.89 0.89 0.89))
(define gray90 (make-color 0.89 0.89 0.89))
(define grey90 (make-color 0.89 0.89 0.89))
(define gray91 (make-color 0.91 0.91 0.91))
(define grey91 (make-color 0.91 0.91 0.91))
(define gray92 (make-color 0.92 0.92 0.92))
(define grey92 (make-color 0.92 0.92 0.92))
(define gray93 (make-color 0.93 0.93 0.93))
(define grey93 (make-color 0.93 0.93 0.93))
(define gray94 (make-color 0.94 0.94 0.94))
(define grey94 (make-color 0.94 0.94 0.94))
(define gray95 (make-color 0.95 0.95 0.95))
(define grey95 (make-color 0.95 0.95 0.95))
(define gray96 (make-color 0.96 0.96 0.96))
(define grey96 (make-color 0.96 0.96 0.96))
(define gray97 (make-color 0.96 0.96 0.96))
(define grey97 (make-color 0.96 0.96 0.96))
(define gray98 (make-color 0.98 0.98 0.98))
(define grey98 (make-color 0.98 0.98 0.98))
(define gray99 (make-color 0.98 0.98 0.98))
(define grey99 (make-color 0.98 0.98 0.98))
(define gray100 (make-color 1.00 1.00 1.00))
(define grey100 (make-color 1.00 1.00 1.00))
(define dark-grey (make-color 0.66 0.66 0.66))
(define dark-gray (make-color 0.66 0.66 0.66))
(define dark-blue (make-color 0.00 0.00 0.54))
(define dark-cyan (make-color 0.00 0.54 0.54))
(define dark-magenta (make-color 0.54 0.00 0.54))
(define dark-red (make-color 0.54 0.00 0.00))
(define light-green (make-color 0.56 0.93 0.56))
| false |
7523db2745c3fa34e4a5b1fe7e1c305fe53d79e3 | 358b0f0efbdb9f081245b536c673648abbb6dc41 | /entropy-procedure.scm | e27d5e829f8a92c2b34e9084821c2cd79990f681 | [
"MIT"
] | permissive | diamond-lizard/srfi-27 | edb34a5ab850bfdf342acab61f1b49b87875116a | d54fcd1916ddef175df1d3dda107b149737ce1ca | refs/heads/main | 2023-01-13T00:50:41.260636 | 2020-11-16T17:18:46 | 2020-11-16T17:18:46 | 312,747,512 | 1 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 1,565 | scm | entropy-procedure.scm | ;;;; entropy-procedure.scm
;;;; Kon Lovett, Oct '09
(module entropy-procedure
(;export
make-entropy-source/procedures
make-entropy-source/f64procedure)
(import scheme)
(import (chicken base))
(import (chicken type))
(import
(only type-checks check-procedure check-symbol check-string)
entropy-source
entropy-support)
;;;
(include "srfi-27-common-types")
;;; Entropy from some procedure
(: make-entropy-source/procedures (procedure procedure #!optional random-source-name string --> entropy-source))
;
(define (make-entropy-source/procedures u8proc f64proc
#!optional
(name (gensym 'procedures-))
(docu "Entropy from procedures"))
(check-procedure 'make-entropy-source/procedures u8proc 'u8proc)
(check-procedure 'make-entropy-source/procedures f64proc 'f64proc)
(check-symbol 'make-entropy-source/procedures name 'name)
(check-string 'make-entropy-source/procedures docu 'documentation)
(*make-entropy-source
;
(lambda () (make-entropy-source/procedures u8proc f64proc name docu))
;
name
;
docu
;
u8proc
;
f64proc
;
(lambda (u8cnt u8vec) (entropic-u8vector-filled u8cnt u8vec u8proc))
;
(lambda (f64cnt f64vec) (entropic-f64vector-filled f64cnt f64vec f64proc))) )
(: make-entropy-source/f64procedure (procedure #!optional random-source-name string --> entropy-source))
;
(define (make-entropy-source/f64procedure f64proc . args)
(apply make-entropy-source/procedures (make-entropic-u8/f64 f64proc) f64proc args) )
) ;module entropy-procedure
| false |
1f0acd49fef99cd86d46db257a3e2412f889a38c | 02dc853159cd8a315280c599020586261bd0dceb | /Informatics Basics/macros.scm | 270730ac886980810857f7e77d6ea7ffb45a148e | [] | no_license | belogurow/BMSTU_IU9 | f524380bd11d08eb4a5055687d74ff563dba1eae | 0104470d34458f5c76ccf1348b11bddc60306cfd | refs/heads/master | 2021-01-10T14:08:49.431011 | 2020-06-23T20:08:21 | 2020-06-23T20:08:21 | 55,531,808 | 14 | 1 | null | null | null | null | UTF-8 | Scheme | false | false | 959 | scm | macros.scm | (use-syntax (ice-9 syncase))
(define-syntax when
(syntax-rules ()
((_ cond? . expr) (if cond? (begin . expr)))))
(define-syntax unless
(syntax-rules ()
((_ cond? . expr) (if (not cond?) (begin . expr)))))
(define-syntax for
(syntax-rules (as in)
((_ x in xs . expr) (for-each (lambda (x) (begin . expr)) xs))
((_ xs as x . expr) (for x in xs . expr))))
(define-syntax while
(syntax-rules ()
((_ cond? . expr) (let end () (when cond? (begin . expr) (end))))))
(define-syntax repeat
(syntax-rules (until)
((_ (exp . expr) until cond?) (let end () (begin exp . expr) (when (not cond?) (end))))))
(define-syntax cout
(syntax-rules (endl <<)
((_ << endl) (newline))
((_ << exp) (display exp))
((_ << endl . expr) (begin
(newline)
(cout . expr)))
((_ << exp . expr) (begin
(display exp)
(cout . expr)))))
| true |
e971c0387771d029244dcb5af75e050e14c5e64e | 4b5dddfd00099e79cff58fcc05465b2243161094 | /chapter_3/exercise_3_55.scm | 051348a205187d6d8ebc709c5eb12b9e0f45bc2b | [
"MIT"
] | permissive | hjcapple/reading-sicp | c9b4ef99d75cc85b3758c269b246328122964edc | f54d54e4fc1448a8c52f0e4e07a7ff7356fc0bf0 | refs/heads/master | 2023-05-27T08:34:05.882703 | 2023-05-14T04:33:04 | 2023-05-14T04:33:04 | 198,552,668 | 269 | 41 | MIT | 2022-12-20T10:08:59 | 2019-07-24T03:37:47 | Scheme | UTF-8 | Scheme | false | false | 370 | scm | exercise_3_55.scm | #lang racket
;; P230 - [练习 3.55]
(require "stream.scm")
(require "infinite_stream.scm")
(provide partial-sums)
(define (partial-sums s)
(cons-stream (stream-car s)
(add-streams (partial-sums s) (stream-cdr s))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(module* main #f
(stream-head->list (partial-sums integers) 10) ; (1 3 6 10 15 21 28 36 45 55)
)
| false |
cf0856e6c53803a6b0079fa0400fd73adb4023c3 | 296dfef11631624a5b2f59601bc7656e499425a4 | /seth/seth/port-extras/test-chicken.scm | 915f57f10b2ccd565800c7dc843674f0a52cf772 | [] | no_license | sethalves/snow2-packages | f4dc7d746cbf06eb22c69c8521ec38791ae32235 | 4cc1a33d994bfeeb26c49f8a02c76bc99dc5dcda | refs/heads/master | 2021-01-22T16:37:51.427423 | 2019-06-10T01:51:42 | 2019-06-10T01:51:42 | 17,272,935 | 1 | 1 | null | null | null | null | UTF-8 | Scheme | false | false | 324 | scm | test-chicken.scm | #! /bin/sh
#| -*- scheme -*-
exec csi -s $0 "$@"
|#
(use r7rs)
(import-for-syntax r7rs)
(import (scheme base))
(define flush-output-port flush-output)
(include "snow/bytevector.sld")
(include "seth/port-extras.sld")
(include "seth/port-extras/tests.sld")
(import (seth port-extras tests))
(display (run-tests))
(newline)
| false |
d30517f5bdd1ed5e9c90a331569f92a86bf41c9f | acc632afe0d8d8b94b781beb1442bbf3b1488d22 | /deps/sdl2/lib/sdl2-internals/helpers/define-foreign-constants.scm | 004541dfdf4cbe8cde5a8a5c9daa8746e753605b | [
"BSD-2-Clause",
"BSD-3-Clause"
] | permissive | kdltr/life-is-so-pretty | 6cc6e6c6e590dda30c40fdbfd42a5a3a23644794 | 5edccf86702a543d78f8c7e0f6ae544a1b9870cd | refs/heads/master | 2021-01-20T21:12:00.963219 | 2016-05-13T12:19:02 | 2016-05-13T12:19:02 | 61,128,206 | 1 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 2,176 | scm | define-foreign-constants.scm | ;;
;; chicken-sdl2: CHICKEN Scheme bindings to Simple DirectMedia Layer 2
;;
;; Copyright © 2013, 2015-2016 John Croisant.
;; All rights reserved.
;;
;; Redistribution and use in source and binary forms, with or without
;; modification, are permitted provided that the following conditions
;; are met:
;;
;; - Redistributions of source code must retain the above copyright
;; notice, this list of conditions and the following disclaimer.
;;
;; - Redistributions in binary form must reproduce the above copyright
;; notice, this list of conditions and the following disclaimer in
;; the documentation and/or other materials provided with the
;; distribution.
;;
;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
;; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
;; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
;; FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
;; COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
;; INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
;; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
;; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
;; HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
;; STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
;; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
;; OF THE POSSIBILITY OF SUCH DAMAGE.
;;; Macro: define-foreign-constants
;;;
;;; No frills, just define AND EXPORT a bunch of foreign constants (or
;;; enums). constant-name must be an unquoted symbol that exactly
;;; matches the name of the foreign constant.
;;;
;;; Examples:
;;;
;;; (define-foreign-constants int
;;; SDL_ENABLE
;;; SDL_DISABLE)
;;;
;;; (define-foreign-constants SDL_AudioStatus
;;; SDL_AUDIO_STOPPED
;;; SDL_AUDIO_PLAYING
;;; SDL_AUDIO_PAUSED)
;;;
(define-syntax define-foreign-constants
(syntax-rules ()
((define-foreign-constants foreign-type
constant-name ...)
(begin
(export constant-name ...)
(define constant-name (foreign-value constant-name foreign-type))
...))))
| true |
c3e83955919ee8cf4296d44ce08a6a64de705514 | ecfd9ed1908bdc4b099f034b121f6e1fff7d7e22 | /old1/pllc/Y/test.scm | d5948311cef6a0019bdd320b2a2d549d8ad4ce57 | [
"MIT"
] | permissive | sKabYY/palestra | 36d36fc3a03e69b411cba0bc2336c43b3550841c | 06587df3c4d51961d928bd8dd64810c9da56abf4 | refs/heads/master | 2021-12-14T04:45:20.661697 | 2021-11-25T08:29:30 | 2021-11-25T08:29:30 | 12,856,067 | 6 | 3 | null | null | null | null | UTF-8 | Scheme | false | false | 436 | scm | test.scm | (define (Y f)
((lambda (x) (x x))
(lambda (x) (f (lambda args (apply (x x) args))))))
(define (Y0 f)
((lambda (x) (f (x x)))
(lambda (x) (f (x x)))))
(define (Yv f)
((lambda (x) (f (x x)))
(lambda (x) (f (lambda args (apply (x x) args))))))
(define (mkgcd gcd)
(lambda (a b)
(if (= a 0)
b
(gcd (remainder b a) a))))
(display ((Y mkgcd) 144 12144))(newline)
(display ((Yv mkgcd) 144 12144))(newline)
| false |
52108cf8699dfc7d4bc89464b60c5d293e0ec2ff | dc2548e45a8e5766ed12df4a6860f0b6639372f3 | /testsuite/reflect-fname.scm | 0350b28cab7c4408ef5a6410c16a33e0e06ce7e0 | [
"MIT"
] | permissive | stonewell/kawa-scheme | 0ed76ab5b954dab1ed6485ee6f98cfbbee2292a0 | 683cc0275d3a2fb933650f31afa159c4ef0d0306 | refs/heads/master | 2020-04-05T10:59:43.485051 | 2017-12-24T02:25:44 | 2017-12-24T02:25:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 1,395 | scm | reflect-fname.scm | (define-syntax define-a
(lambda (stx)
(syntax-case stx ()
((_ name) #`(define name (lambda () #f))))))
(define-syntax define-bar
(lambda (stx)
(syntax-case stx ()
((_ name) #`(define name (lambda () name: 'bar #f))))))
(define-syntax define-c
(lambda (stx)
(syntax-case stx ()
((_ n) #`(define n (letrec ((foo (lambda () name: 'n
#f)))
foo))))))
(define-syntax define-d
(lambda (stx)
(syntax-case stx ()
((_ n) #`(define n (letrec ((foo (lambda () #f)))
(set-procedure-property! foo 'name 'n)
foo))))))
(define e (letrec ((foo (lambda () #f))) foo))
(define-a a)
(format #t "Name of a: ~A~%" (procedure-property a 'name))
;; Output: Name of a: a
(define-bar b)
(format #t "Name of b: ~A~%" (procedure-property b 'name))
;; Output: Name of b: bar
(define-c c)
(format #t "Name of c: ~A~%" (procedure-property c 'name))
;; Output: Name of c: c
(define-d d)
(format #t "Name of d: ~A~%" (procedure-property d 'name))
;; Output: Name of d: d
(format #t "Name of e: ~A~%" (procedure-property e 'name))
;; Output: Name of e: foo
(define-simple-class kittens ()
(a::long))
(define (kittens-class)
kittens:class)
(format #t "kittens.class: ~w~%" (kittens-class))
;; Output: kittens.class: class kittens
| true |
10504e29534a0354606335fab5f7877071525bd4 | 26aaec3506b19559a353c3d316eb68f32f29458e | /plugins/dse/dse.scm | 620b35ca9d0a7aed92c5aa9e3097ac95c60587d3 | [
"BSD-3-Clause"
] | permissive | mdtsandman/lambdanative | f5dc42372bc8a37e4229556b55c9b605287270cd | 584739cb50e7f1c944cb5253966c6d02cd718736 | refs/heads/master | 2022-12-18T06:24:29.877728 | 2020-09-20T18:47:22 | 2020-09-20T18:47:22 | 295,607,831 | 1 | 0 | NOASSERTION | 2020-09-15T03:48:04 | 2020-09-15T03:48:03 | null | UTF-8 | Scheme | false | false | 6,428 | scm | dse.scm | #|
LambdaNative - a cross-platform Scheme framework
Copyright (c) 2009-2013, University of British Columbia
All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, are permitted provided that the
following conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the following
disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials
provided with the distribution.
* Neither the name of the University of British Columbia nor
the names of its contributors may be used to endorse or
promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|#
;; Simple decision support engine
#|
(make-instance store "DSE" "dse" '("Rules" (
("Bradycardia" ((< "HR" "HRmin")) 2)
("Hypertension" ((> "NIBPsys" "BPmax")) 2)
)))
|#
(define dse:rule-conclusion car)
(define dse:rule-condition cadr)
(define dse:rule-priority caddr)
(define dse:rule-delay cadddr)
(define (dse:check-weak-fact store fact)
(if (and (list? fact) (> (length fact) 2))
(let* ((op (car fact))
(v1 (if (string? (cadr fact)) ((if (eq? op '=) store-ref store-timedref) store (cadr fact) #f) (cadr fact)))
(v2 (if (string? (caddr fact)) (store-ref store (caddr fact) #f) (caddr fact)))
(v3 (if (> (length fact) 3) (if (string? (cadddr fact)) (store-ref store (cadddr fact) #f) (cadddr fact)) #f)))
(cond ((eq? op '<) (and (number? v1) (number? v2) (< v1 v2)))
((eq? op '>) (and (number? v1) (number? v2) (> v1 v2)))
((eq? op '=) (equal? v1 v2))
((eq? op '!=) (not (equal? v1 v2)))
((eq? op 'diff>) (and (number? v1) (number? v2) (number? v3) (> (- v2 v1) v3)))
((eq? op 'diff<) (and (number? v1) (number? v2) (number? v3) (< (- v2 v1) v3)))
((eq? op '>deviation_perc) (and (number? v1) (f32vector? v2) (number? v3)
(> (* (median (f32vector->list v2)) (/ (+ 100 v3) 100)) v1)))
((eq? op '<deviation_perc) (and (number? v1) (f32vector? v2) (number? v3)
(< (* (median (f32vector->list v2)) (/ (- 100 v3) 100)) v1)))
((eq? op 'fcn) (v1 v2 v3))
(else (log-error "dse: unknown rule operator " op) #f)
)
)
(begin
(log-error "dse: syntax error in rule " fact)
#f
)
))
(define (dse:check-strong-fact store instance fact)
(member fact (instance-refvar store instance "FactList" '())))
(define (dse:check-fact store instance fact)
(if (list? fact)
(dse:check-weak-fact store fact)
(dse:check-strong-fact store instance fact)
))
(define (dse:trigger-alarm store instance fact)
(let ((priority (dse:rule-priority (assoc fact (instance-refvar store instance "Rules")))))
(if (> priority 0) (store-event-add store priority fact instance))
))
(define (dse:check-condition store instance rule)
(define (check-iter condition)
(if (null? condition)
#t
(let ((next-fact (car condition)))
(if (dse:check-fact store instance next-fact)
(check-iter (cdr condition))
#f
)
)
)
)
(check-iter (dse:rule-condition rule)))
(define (dse:adopt-conclusion store instance rule)
(let ((fact (dse:rule-conclusion rule))
(flist (instance-refvar store instance "FactList" '())))
(instance-setvar! store instance "FactList" (append (list fact) flist))
))
;; ---- plugin hooks
(define (dse:init store instance)
#t)
(define (dse:caseinit store instance)
(instance-setvar! store instance "FactList" '())
(instance-setvar! store instance "RepeatFactList" '())
)
(define (dse:run store instance)
(define (dse:outerloop continue?)
(if continue?
(dse:outerloop (dse:innerloop (instance-refvar store instance "Rules")))
#t
))
(define (dse:innerloop rbase)
(if (null? rbase)
#f
(let ((rule (car rbase)))
(if (not (dse:check-strong-fact store instance (dse:rule-conclusion rule)))
(if (dse:check-condition store instance rule)
(begin
(dse:adopt-conclusion store instance rule)
(dse:outerloop #t)
)
(dse:innerloop (cdr rbase))
)
(dse:innerloop (cdr rbase))
)
)
))
(dse:outerloop #t)
;; update repeating facts and trigger as needed
;; non-repeating stuff is dropped
(let ((flist (instance-refvar store instance "FactList" '()))
(rlist (instance-refvar store instance "RepeatFactList" '()))
(rules (instance-refvar store instance "Rules" '())))
(let loop ((fs flist)(rs '()))
(if (= (length fs) 0)
(instance-setvar! store instance "RepeatFactList" rs)
(let* ((entry (assoc (car fs) rlist))
(oldv (if entry (cadr entry) 0))
(rule (if entry (assoc (car entry) rules) '()))
(trigger-delay (if (and entry (fx= (length rule) 4)) (dse:rule-delay rule) 10))
(newv (if (>= oldv trigger-delay)
(begin (dse:trigger-alarm store instance (car fs)) 0)
(+ oldv 1))
))
(loop (cdr fs) (append rs (list (list (car fs) newv))))
))
)
)
(instance-setvar! store instance "FactList" '())
#t)
(define (dse:caseend store instance) #t)
(define (dse:end store instance) #t)
(plugin-register "dse" dse:init dse:caseinit dse:run dse:caseend dse:end 'dse)
;; eof
| false |
2d2c06ba24f0883b8f419c34956514a6cac5157e | b9eb119317d72a6742dce6db5be8c1f78c7275ad | /genealogy/2/lookup.scm | e3af386c873d6a335320ed94dbb94f9105b18e1e | [] | no_license | offby1/doodles | be811b1004b262f69365d645a9ae837d87d7f707 | 316c4a0dedb8e4fde2da351a8de98a5725367901 | refs/heads/master | 2023-02-21T05:07:52.295903 | 2022-05-15T18:08:58 | 2022-05-15T18:08:58 | 512,608 | 2 | 1 | null | 2023-02-14T22:19:40 | 2010-02-11T04:24:52 | Scheme | UTF-8 | Scheme | false | false | 392 | scm | lookup.scm | ;; given an ID, look through the database for the section that has
;; that ID, and return it. If the database were an alist, we'd just
;; call `assq'.
(define (lookup symbol)
(let loop ((sections (gedcom-sections gdb)))
(cond
((null? sections)
#f)
((eq? symbol (kdp-keyword (section-kdp (car sections))))
(car sections))
(#t
(loop (cdr sections))))))
| false |
3cb0e5f3f40c82c75d9aacc68684c45613a3f80b | 98a86ec3182e9eef7e21db734118f15f2514cd5c | /scheme/defstruct.scm | 396c7ec59f7b3f2a04c8a1e75895ba88ac8e5720 | [
"MIT"
] | permissive | icefoxen/lang | ad3d4d2bdb162f95416e9d805c29951cc812b6f6 | 628185020123aabe4753f96c6ab4378637a2dbf5 | refs/heads/master | 2020-07-03T12:04:05.512367 | 2017-01-27T18:05:00 | 2017-01-27T18:05:00 | 74,171,174 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 2,624 | scm | defstruct.scm | ; defstruct macro.
; Shamelessly grabbed from "Teach Yourself Scheme in Fixnum Days"
; Chapter 9, section 2
(require (lib "defmacro.ss"))
(define-macro defstruct
(lambda (s . ff)
(let ((s-s (symbol->string s)) (n (length ff)))
(let* ((n+1 (+ n 1))
(vv (make-vector n+1)))
(let loop ((i 1) (ff ff))
(if (<= i n)
(let ((f (car ff)))
(vector-set! vv i
(if (pair? f) (cadr f) '(if #f #f)))
(loop (+ i 1) (cdr ff)))))
(let ((ff (map (lambda (f) (if (pair? f) (car f) f))
ff)))
`(begin
(define ,(string->symbol
(string-append "make-" s-s))
(lambda fvfv
(let ((st (make-vector ,n+1)) (ff ',ff))
(vector-set! st 0 ',s)
,@(let loop ((i 1) (r '()))
(if (>= i n+1) r
(loop (+ i 1)
(cons `(vector-set! st ,i
,(vector-ref vv i))
r))))
(let loop ((fvfv fvfv))
(if (not (null? fvfv))
(begin
(vector-set! st
(+ (list-position (car fvfv) ff)
1)
(cadr fvfv))
(loop (cddr fvfv)))))
st)))
,@(let loop ((i 1) (procs '()))
(if (>= i n+1) procs
(loop (+ i 1)
(let ((f (symbol->string
(list-ref ff (- i 1)))))
(cons
`(define ,(string->symbol
(string-append
s-s "." f))
(lambda (x) (vector-ref x ,i)))
(cons
`(define ,(string->symbol
(string-append
"set!" s-s "." f))
(lambda (x v)
(vector-set! x ,i v)))
procs))))))
(define ,(string->symbol (string-append s-s "?"))
(lambda (x)
(and (vector? x)
(eqv? (vector-ref x 0) ',s))))))))))
| false |
06a15a726ba03604b018b9f655c98ff0f6f849f6 | d28176331fc9261df8a752bc27b549032f5af542 | /libs/document.scm | de0c0fae7a8441f2688faf9679293131980cdf95 | [
"BSD-2-Clause"
] | permissive | mushrom/gojira | 16438673ad721b58725a1ffbdadbe12e6b473c68 | ba1abbe1bfb41c1e180e61cff3d60a373f571800 | refs/heads/master | 2020-04-15T07:31:16.949558 | 2016-08-11T13:51:55 | 2016-08-11T13:51:55 | 21,189,192 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 5,970 | scm | document.scm | (import! 'ansi-term)
(define :mut *docs-list* '())
(define :mut doc-title-color '(:magenta))
; see bottom of the file for doc definitions on these syntax rules
(define-syntax docs
(syntax-rules ()
((_ sym)
(print-docpage (get-docpage 'sym)))))
(define-syntax document
(syntax-rules ()
((_ func-def docinfo ...)
(add-docpage! (list (car '(func-def)) (hashmap docinfo ...))))))
(define-syntax define/docs
(syntax-rules ()
((_ func-def (docinfo ...) body ...)
(begin
(document func-def docinfo ...)
(define func-def body ...)))))
(define (add-docpage! doc)
(set! *docs-list* (cons doc *docs-list*)))
(define (get-docpage doc)
(filter (lambda (page)
(eq? (caar page) doc))
*docs-list*))
(define (print-doc-field disp-func title info)
(if (not (eq? info #f))
(begin
(display " ")
(print-color doc-title-color title)
(if (list? info)
(for-each (lambda (thing)
(display " ")
(disp-func thing)
(newline))
info)
(begin
(display " ")
(disp-func info)
(newline))))
'())
'())
(define (list-max nums)
(if (null? nums)
0
(let ((max-val (list-max (cdr nums))))
(if (> max-val (car nums))
max-val
(car nums)))))
(define (max :rest nums)
(list-max nums))
(define (print-doc-parameters title info)
(define (make-aligned-printer xs)
(let ((alignment
(list-max
(map (lambda (x)
(string-length (symbol->string (car x))))
xs))))
(lambda (sym)
(display sym)
(for-each (lambda (x) (display #\space))
(iota (+ (- alignment
(string-length
(symbol->string sym)))
1))))))
(if (not (eq? info #f))
(begin
(display " ")
(print-color doc-title-color title)
(define param-display (make-aligned-printer info))
(for thing in info
(display " ")
(param-display (car thing))
(display-list ": " (cadr thing) #\newline)
(if (not (null? (cddr thing)))
(let ((sub-arg-display (make-aligned-printer (caddr thing))))
(for sub-arg in (caddr thing)
(display " ")
(param-display (string->symbol " "))
(display "> ")
(sub-arg-display (car sub-arg))
(display-list ": " (cadr sub-arg) #\newline)))
'()))
'())
'()))
(define (print-docpage doc)
(if (not (null? doc))
(let* ((func-def (caar doc))
(func-name (car func-def))
(docmap (cadar doc))
(usage (if (eq? [docmap :usage] #f)
(list func-def)
else
[docmap :usage])))
(print-doc-field display "Usage:" usage)
(print-doc-field display "Description:" [docmap :description])
(print-doc-parameters "Parameters:" [docmap :parameters])
(print-doc-field display "Returns:" [docmap :returns])
(print-doc-field display "See Also:" [docmap :see-also])
(print-doc-field display "Example:" [docmap :example])
(print-doc-field display "Conformance:" [docmap :conformance]))
else
(print "No documentation, sorry")))
(document (docs name)
:description '("Prints short documentation corresponding to the given name")
:parameters '((name "The symbol name of the function for which to show documentation"))
:returns '("A null list")
:see-also '(document define/docs)
:example '((docs docs))
:conformance '(non-standard))
(document (document func-def docinfo ...)
:description '("Generates a documentation page for the given function")
:parameters '((func-def "The function definition for the documentee")
(docinfo "Various information about the function"
((:description "A brief overview of what the function does")
(:parameters "Description of what the function's parameters expect")
(:usage "Optional list of the possible ways the function may be called")
(:returns "A description of the values the function returns")
(:see-also "A short list of other functions which might be of interest")
(:example "An example usage of the function")
(:conformance "A list of standards the function conforms to, eg. r6rs, srfi1"))))
:conformance '(non-standard)
:returns '("A null list")
:see-also '(define/docs docs)
:example '("(document (some-function foo bar)"
" :description '(\"A minimal example doc page\")"
" :parameters '((foo \"A symbol\""
" ((sub-arg"
" \"An example of a sub-argument\")"
" (blarg"
" \"Sub-arguments specify possible values a parameter might have\")))"
" (bar \"A string\"))"
" :returns '(\"The integer 42\"))"))
(document (define/docs func-def (docinfo ...) body ...)
:description '("A macro wrapper around 'document' and 'define' to neatly group"
"function definitions and documentation definitions together.")
:parameters '((func-def "The function definition")
(docinfo "Function information to be passed to 'document'")
(body "The body of the function"))
:conformance '(non-standard)
:see-also '(document docs))
| true |
89288743609156d0bdddf1d9286e5d5a2d36b25e | bd59d4af87e34e6db598dbd098a1c89a486f85ef | /assembler/x86-misc.sls | 81c5983d58376369b9950d63d67f91bca81f23aa | [
"MIT"
] | permissive | inspier/machine-code | 02951911e5448f50b72b363579c1a63584651afc | c392236f98c5279bc875e7e5f4d59379dc440464 | refs/heads/master | 2022-03-31T07:46:48.895240 | 2019-06-22T19:22:21 | 2019-06-22T19:47:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 2,403 | sls | x86-misc.sls | ;; -*- mode: scheme; coding: utf-8 -*-
;; Copyright © 2008, 2009, 2012, 2017, 2018 Göran Weinholt <[email protected]>
;; SPDX-License-Identifier: MIT
#!r6rs
(library (machine-code assembler x86-misc)
(export
make-modr/m make-sib bitwidth<=
number->bytevector)
(import
(rnrs (6)))
(define (number->bytevector imm size)
;; Takes a number that fits in the signed or unsigned range of
;; `size' bits and encodes it in a bytevector of that many bits.
(unless (<= (- (expt 2 (- size 1))) imm (- (expt 2 size) 1))
(error 'number->bytevector "The given number does not fit in the given number of bits"
imm size))
(case size
((8) (let ((bv (make-bytevector 1)))
(bytevector-u8-set! bv 0 (bitwise-and imm #xff))
bv))
((16) (let ((bv (make-bytevector 2)))
(bytevector-u16-set! bv 0 (bitwise-and imm #xffff) (endianness little))
bv))
((32) (let ((bv (make-bytevector 4)))
(bytevector-u32-set! bv 0 (bitwise-and imm #xffffffff) (endianness little))
bv))
((64) (let ((bv (make-bytevector 8)))
(bytevector-u64-set! bv 0 (bitwise-and imm #xffffffffffffffff) (endianness little))
bv))
(else
(let ((bv (make-bytevector (bitwise-arithmetic-shift-right size 3))))
(bytevector-uint-set! bv
0
(bitwise-and imm (- (bitwise-arithmetic-shift-left 1 size) 1))
(endianness little)
(bitwise-arithmetic-shift-right size 3))
bv))))
(define (make-modr/m mod reg r/m)
(fxior (fxarithmetic-shift-left (fxand mod #b11) 6)
(fxarithmetic-shift-left (fxand reg #b111) 3)
(fxand r/m #b111)))
(define (make-sib scale index base)
(fxior (fxarithmetic-shift-left (case scale
((1) #b00)
((2) #b01)
((4) #b10)
((8) #b11)
(else (error 'make-sib "invalid scale" scale)))
6)
(fxarithmetic-shift-left (fxand index #b111) 3)
(fxand base #b111)))
(define (bitwidth<= x l u)
(<= (- (expt 2 l)) x (- (expt 2 u) 1))))
| false |
089b370428423fdd52bb10590baab0d80a16f3f7 | dae624fc36a9d8f4df26f2f787ddce942b030139 | /chapter-07/list.scm | 279908ebe8a736422a09d1112121cd63e8d19e63 | [
"MIT"
] | permissive | hshiozawa/gauche-book | 67dcd238c2edeeacb1032ce4b7345560b959b243 | 2f899be8a68aee64b6a9844f9cbe83eef324abb5 | refs/heads/master | 2020-05-30T20:58:40.752116 | 2019-10-01T08:11:59 | 2019-10-01T08:11:59 | 189,961,787 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 57 | scm | list.scm | (define (list . a)
a)
(list 1 2 3)
(list 1)
(list)
| false |
8c4822f64d667f21456f9d46660856b98718372a | ae76253c0b7fadf8065777111d3aa6b57383d01b | /chap2/exec-2.16.ss | e8c50eef8acc2a0794419d05f08d5f2a3154d99e | [] | no_license | cacaegg/sicp-solution | 176995237ad1feac39355f0684ee660f693b7989 | 5bc7df644c4634adc06355eefa1637c303cf6b9e | refs/heads/master | 2021-01-23T12:25:25.380872 | 2014-04-06T09:35:15 | 2014-04-06T09:35:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 3,026 | ss | exec-2.16.ss | (define (make-interval a b) (cons a b))
(define (lower-bound i) (car i))
(define (upper-bound i) (cdr i))
(define (width i)
(/ (- (upper-bound i) (lower-bound i)) 2.0))
(define (sub-interval a b)
(make-interval (- (lower-bound a) (lower-bound b))
(- (upper-bound a) (upper-bound b))))
(define (add-interval a b)
(make-interval (+ (lower-bound a) (lower-bound b))
(+ (upper-bound a) (upper-bound b))))
(define (mul-interval x y)
(let ((lx (lower-bound x)) (ux (upper-bound x))
(ly (lower-bound y)) (uy (upper-bound y)))
(cond ((and (>= lx 0) (>= ux 0) (>= ly 0) (>= uy 0)) ; x++ y++
(make-interval (* lx ly) (* ux uy)))
((and (< lx 0) (>= ux 0) (>= ly 0) (>= uy 0))
(make-interval (* lx uy) (* ux uy))) ; x+- y++
((and (< lx 0) (< ux 0) (>= ly 0) (>= uy 0))
(make-interval (* lx uy) (* ly ux))) ; x-- y++
((and (>= lx 0) (>= ux 0) (< ly 0) (>= uy 0))
(make-interval (* ly ux) (* ux uy))) ; x++ y+-
((and (>= lx 0) (>= ux 0) (< ly 0) (< uy 0))
(make-interval (* ux ly) (* lx uy))) ; x++ y--
((and (< lx 0) (>= ux 0) (< ly 0) (>= uy 0)) ; x+- y+-
(let ((p1 (* lx ly))
(p2 (* lx uy))
(p3 (* ux uy))
(p4 (* ux ly)))
(make-interval
(min p2 p4)
(max p1 p3))))
((and (< lx 0) (< ux 0) (< ly 0) (< uy 0))
(make-interval (* ux uy) (* lx ly))) ; x-- y--
((and (< lx 0) (< ux 0) (< ly 0) (>= uy 0))
(make-interval (* lx uy) (* lx ly))) ; x-- y+-
((and (< lx 0) (>= ux 0) (< ly 0) (< uy 0))
(make-interval (* ly ux) (* ly lx)))))) ; x+- y--
(define (div-interval x y)
(let ((uby (upper-bound y)) (lby (lower-bound y)))
(if (or (= uby 0) (= lby 0))
"Divide by Zero"
(mul-interval x
(make-interval (/ 1.0 (upper-bound y))
(/ 1.0 (lower-bound y)))))))
; p is percent. 1 for 100%, 0.1 for 10%
(define (make-center-percent c p)
(make-interval (- c (* c p)) (+ c (* c p))))
(define (center i)
(/ (+ (upper-bound i) (lower-bound i)) 2.0))
(define (percent i)
(/ (- (center i) (lower-bound i)) (center i)))
(define (par1 r1 r2)
(div-interval (mul-interval r1 r2)
(add-interval r1 r2)))
(define (par2 r1 r2)
(let ((one (make-interval 1 1)))
(div-interval one
(add-interval (div-interval one r1)
(div-interval one r2)))))
; a * (a + b)
(let ((a (make-interval 1 2))
(b (make-interval -1 2)))
(mul-interval a (add-interval a b)))
; (a * a) + (a * b)
(let ((a (make-interval 1 2))
(b (make-interval -1 2)))
(add-interval (mul-interval a a)
(mul-interval a b)))
(let ((a (make-interval 1 3)))
(div-interval a a))
; Since the result is not hold the same, we need to find a way
; to make a * (a + b) = (a * a) + (a * b)
| false |
1836f4fcd96c3d6504990556ccdab42e1e3ff720 | 6d875d9eb248e3faa5b805ec74e4ef0095542354 | /Ex2_20.scm | d60e6f820fe0702ca771bc2469488badbb91ad9b | [] | no_license | cuihz/sicp | 095d6661109075581710f37c5ded7a4525cb41d2 | 0392da93897105ced52060baedb153266babe6ec | refs/heads/master | 2016-08-04T18:01:13.515086 | 2015-07-09T13:30:04 | 2015-07-09T13:30:04 | 29,767,016 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 329 | scm | Ex2_20.scm | (define (same-parity x . y)
(define (iter list result)
(if (null? list)
result
(let ((first-element (car list))
(same-x? (if (even? x) even? odd?)))
(if (same-x? first-element)
(iter (cdr list) (cons first-element result))
(iter (cdr list) result)))))
(iter y '()))
(same-parity 1 2 3 4 5 6 7)
| false |
932db06f45881196f75da0c3b521016dd68850d5 | 2d868c9428b8f4772d2ede375a3492b3b6885e1d | /Higher-order Procedures/1.32.scm | cea52c1ca0f4c2dcaf19f725fc3d6d999f422657 | [] | 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 | 1,116 | scm | 1.32.scm | #lang scheme
;; a) Show that sum and product (exercise 1.31) are both special
;; cases of a still more general notion called accumulate that
;; combines a collection of terms, using some general
;; accumulation function:
(define (accumulate combiner null-value term a next b)
(define (iter a result)
(if (> a b)
result
(iter (next a) (combiner result (term a)))))
(iter a null-value))
(define (inc x) (+ x 1))
(define (identity x) x)
(define (sum x) (accumulate + 0 identity 0 inc x))
(define (product x) (accumulate * 1 identity 1 inc x))
;; Testing
(sum 10) ;; => 55
(product 10) ;; => 3628800
;; b) From iterative to recursive.
(define (accumulate-recursive combiner null-value term a next b)
(if (> a b)
null-value
(combiner (term a)
(accumulate-recursive
combiner null-value term (next a) next b))))
(define (sum-recursive x)
(accumulate-recursive + 0 identity 0 inc x))
(define (product-recursive x)
(accumulate-recursive * 1 identity 1 inc x))
(sum-recursive 10) ;; => 55
(product-recursive 10) ;; => 3628800 | false |
7ba7734c6e100066306dd05e4b619174edcd296f | 3323fb4391e76b853464a9b2fa478cd7429e9592 | /digital-signal.ss | c771c4d15b1ab28bf6d50735abbcaa7704998d3f | [] | no_license | simpleliangsl/hello-scheme | ceb203933fb056523f5288ce716569096a71ad97 | 31434fb810475ee0e8ec2e6816995a0041c47f44 | refs/heads/master | 2023-06-16T12:07:28.744188 | 2021-07-15T06:39:32 | 2021-07-15T06:39:32 | 386,197,304 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 2,520 | ss | digital-signal.ss | (define (make-wire)
(define signal 0)
(define actions '())
(define (set-signal! new-value)
(if (not (= signal new-value))
(begin
(set! signal new-value)
(call-each actions)
)
'done
)
)
(define (call-each actions)
(if (null? actions)
'done
(begin
((car actions))
(call-each (cdr actions))
)
)
)
(define (add-action! action)
(set! actions (cons action actions))
(action)
)
(define (dispatch message)
(cond [(eq? message 'get-signal) signal]
[(eq? message 'set-signal!) set-signal!]
[(eq? message 'add-action!) add-action!]
[else (error #f "Unknown operation on WIRE" message)]
)
)
dispatch
)
(define (get-signal wire)
(wire 'get-signal)
)
(define (set-signal! wire new-value)
((wire 'set-signal!) new-value)
)
(define (add-action! wire action)
((wire 'add-action!) action)
)
(define (after-delay delay action))
(define (inverter input output)
(define (logical-not signal)
(cond [(= signal 0) 1]
[(= signal 1) 0]
[else (error #f "Invalid signal " signal)]
)
)
(define (action-procedure)
(let ([new-value (logical-not (get-signal input))])
(after-delay inverter-delay
(lambda () (set-signal! output new-value))
)
)
)
(add-action! input action-procedure)
'ok
)
(define (and-gate a1 a2 output)
(define (logical-and signal1 signal2)
(if (or (= signal 0) (= signal 0)) 0 1)
)
(define (action-procedure)
(let ([new-value (logical-and (get-signal a1) (get-signal a1))])
(after-delay and-delay
(lambda () (set-signal! output new-value))
)
)
)
(add-action! a1 action-procedure)
(add-action! a2 action-procedure)
'ok
)
(define (or-gate a1 a2 output)
(define (logical-or signal1 signal2)
(if (and (= signal1 0) (= signal2 0)) 0 1)
)
(define (action-procedure)
(let ([new-value (logical-or (get-signal a1) (get-signal a2))])
(after-delay or-delay
(lambda () (set-signal! output new-value))
)
)
)
(add-action! a1 action-procedure)
(add-action! a2 action-procedure)
'ok
)
| false |
07ca486d4e014150ef4acc7b4ca85bff09a1a16e | 92b8d8f6274941543cf41c19bc40d0a41be44fe6 | /gnu/kawa/slib/srfi34.scm | affc05f8e15b6d583ef1dc8e6f5c41c232b81a48 | [
"MIT"
] | permissive | spurious/kawa-mirror | 02a869242ae6a4379a3298f10a7a8e610cf78529 | 6abc1995da0a01f724b823a64c846088059cd82a | refs/heads/master | 2020-04-04T06:23:40.471010 | 2017-01-16T16:54:58 | 2017-01-16T16:54:58 | 51,633,398 | 6 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 3,328 | scm | srfi34.scm | (module-compile-options warn-undefined-variable: #t
warn-invoke-unknown-method: #t)
(module-export with-exception-handler guard raise)
(provide 'srfi-34)
(define-simple-class <raise-object-exception> (<java.lang.Throwable>)
(value)
((*init* value)
(set! (*:.value (this)) value)))
(define (with-exception-handler handler thunk)
(try-catch
(thunk)
(ex <raise-object-exception> (handler (*:.value ex)))
(ex <java.lang.Throwable> (handler ex))))
(define (raise obj)
(primitive-throw (make <raise-object-exception> obj)))
(define-syntax guard
(syntax-rules ()
((guard (var . clauses) . body)
(try-catch
(begin . body)
(ex <java.lang.Throwable>
(let ((var
(if (instance? ex <raise-object-exception>)
(field (as <raise-object-exception> ex) 'value)
ex)))
(guard-aux (primitive-throw ex) . clauses)))))))
;; The implementation of the guard-aux macro is from the SRFI-34
;; reference implementation which is:
;; Copyright (C) Richard Kelsey, Michael Sperber (2002). All Rights Reserved.
;; This document and translations of it may be copied and furnished to
;; others, and derivative works that comment on or otherwise explain
;; it or assist in its implementation may be prepared, copied,
;; published and distributed, in whole or in part, without restriction
;; of any kind, provided that the above copyright notice and this
;; paragraph are included on all such copies and derivative
;; works. However, this document itself may not be modified in any
;; way, such as by removing the copyright notice or references to the
;; Scheme Request For Implementation process or editors, except as
;; needed for the purpose of developing SRFIs in which case the
;; procedures for copyrights defined in the SRFI process must be
;; followed, or as required to translate it into languages other than
;; English.
;; The limited permissions granted above are perpetual and will not be
;; revoked by the authors or their successors or assigns.
;; This document and the information contained herein is provided on
;; an "AS IS" basis and THE AUTHOR AND THE SRFI EDITORS DISCLAIM ALL
;; WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY
;; WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE
;; ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
;; FOR A PARTICULAR PURPOSE.
(define-syntax guard-aux
(syntax-rules (else =>)
((guard-aux reraise (else result1 result2 ...))
(begin result1 result2 ...))
((guard-aux reraise (test => result))
(let ((temp test))
(if temp
(result temp)
reraise)))
((guard-aux reraise (test => result) clause1 clause2 ...)
(let ((temp test))
(if temp
(result temp)
(guard-aux reraise clause1 clause2 ...))))
((guard-aux reraise (test))
test)
((guard-aux reraise (test) clause1 clause2 ...)
(let ((temp test))
(if temp
temp
(guard-aux reraise clause1 clause2 ...))))
((guard-aux reraise (test result1 result2 ...))
(if test
(begin result1 result2 ...)
reraise))
((guard-aux reraise (test result1 result2 ...) clause1 clause2 ...)
(if test
(begin result1 result2 ...)
(guard-aux reraise clause1 clause2 ...)))))
| true |
eeff1c88665d0acaeb6c8b97eef7b055e73c55dd | ae4938300d7eea07cbcb32ea4a7b0ead9ac18e82 | /asm/arm/parser/conditions.sls | d54f1755e8c0edc7b94ebd0a00468ed29afc2034 | [] | 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 | 1,005 | sls | conditions.sls | #!r6rs
(library (imi asm arm parser conditions)
(export condition-instruction?
set-condition
*conditions*)
(import (rnrs)
(imi asm arm opcodes conditions))
(define *cond-names*
'(EQ ZS NE ZC
HS CS LO CC
MI NS PL NC
VS VC
HI LS
GE LT
GT LE
AL ;NV
))
(define *cond-procs*
(list EQ ZS NE ZC
HS CS LO CC
MI NS PL NC
VS VC
HI LS
GE LT
GT LE
AL ;NV
))
(define *conditions*
(map cons *cond-names* *cond-procs*))
(define (condition-instruction? sth)
(and (memq sth *cond-names*)
#t))
(define (set-condition condition opcode)
(cond
[(assq condition *conditions*)
=> (lambda (con)
((cdr con)
opcode))]
[else
(error 'set-condition
"invalid condition name"
condition)]))
)
| false |
8890846e8878cdec5eb11f492b8d1804cac92815 | bde67688a401829ffb4a5c51394107ad7e781ba1 | /test-mgvm.scm | bfcbd5e4d6a16221a52e0bc17a59793bcf6e2600 | [] | no_license | shkmr/taco | 1fad9c21284e12c9aae278f2e06de838363c3db9 | 8bbea1a4332d6d6773a3d253ee6c2c2f2bcf2b05 | refs/heads/master | 2021-01-10T03:50:55.411877 | 2016-08-11T03:37:53 | 2016-08-11T03:37:53 | 48,963,008 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 6,949 | scm | test-mgvm.scm | ;;
(use mgvm)
;;;
;;;
;;;
(define undef (if #f #t))
(define (test v txt prog expect)
(let ((result undef))
(mgvm/init :program prog)
(print ";;;\n;;; TESTING : " txt "\n;;;")
(print "\n;;\n;; Initial condition\n;;")
(mgvm/dump)
(print ";;\n;; Program start.\n;;")
(set! result (mgvm/run :verbose v))
(print "\n;;\n;; finished.\n;;")
(mgvm/dump)
(if (equal? result expect)
(print txt " -> success !!\n")
(print txt " -> FAIL !!\n"))
))
;;
;; TEST1 : Simple one call
;;
;; (print "hello, world")
;;
(define test1
`((PRE-CALL 1) ("hello, world"
(PUSH)
(GREF) ,print
(CALL 1)
)))
;;
;; TEST2 : Two calls
;;
;; (display "hello, world")
;; (newline)
;;
(define test2
`((PRE-CALL 1) ("hello, world"
(PUSH)
(GREF) ,display
(CALL 1)
)
(PRE-CALL 0) ((GREF) ,newline
(CALL 0))))
;;
;; TEST3 : function definition
;;
;; (define (foo) (print "hello, world"))
;; (foo)
;;
(define test3
'(
(LAMBDA 0 0) ((PRE-CALL 1) ("hello, world"
(PUSH)
(GREF) print
(CALL 1)))
(DEFINE) FOO
(PRE-CALL 0) ((GREF) FOO
(CALL 0))))
;;
;; TEST4 : TAIL-CALL
;;
(define test4
'(
(LAMBDA 0 0) ((PRE-TAIL 1)
"hello, world"
(PUSH)
(GREF) print
(TAIL-CALL 1))
(DEFINE) FOO
(PRE-CALL 0) ((GREF) FOO
(CALL 0))
))
;;
;; TEST5 : LET
;; (define (FOO X)
;; (let ((Y 1)
;; (+ X Y)))
(define test5
'(
(LAMBDA 1 0) ((LET 1) (1
(LSET0)
(LREF10-PUSH)
(LREF0)
(NUMADD2)))
(DEFINE) FOO
(PRE-CALL 1) (3
(PUSH)
(GREF) FOO
(CALL 1))))
;; TEST7
;; (define (fact n)
;; (if (= n 0)
;; 1
;; (* n (fact (- n 1)))))
;; (fact 5)
;;
(define test7
'(
(LAMBDA 1 0) (
;; (PRE-CALL 1) ((LREF0-PUSH)
;; (GREF) ,print
;; (CALL 1))
(LREF0-PUSH)
0
(NUMEQ2)
(IF) (1)
(PRE-CALL 2) ((LREF0-PUSH)
(PRE-CALL 1) ((LREF0)
(NUMADDI -1)
(PUSH)
(GREF) FACT
(CALL 1))
(PUSH)
(GREF) *
(CALL 2)))
(DEFINE)
FACT
(PRE-CALL 1) ((PUSHI 5)
(GREF) FACT
(CALL 1))
))
(define test8
'(
(LAMBDA 1 0) (
;; (PRE-CALL 1) ((LREF0-PUSH)
;; (GREF) ,print
;; (CALL 1))
(LREF0-PUSH)
0
(NUMEQ2)
(IF) (1)
(PRE-TAIL 2)
(LREF0-PUSH)
(PRE-CALL 1) ((LREF0)
(NUMADDI -1)
(PUSH)
(GREF) FACT
(CALL 1))
(PUSH)
(GREF) *
(TAIL-CALL 2))
(DEFINE)
FACT
(PRE-CALL 1) ((PUSHI 5)
(GREF) FACT
(CALL 1))
))
;;
;; (define (sum n)
;; (letrec ((lp (lambda (n s)
;; (if (= n 0)
;; s
;; (lp (- n 1) (+ s n))))))
;; (lp n 0)))
;;
(define test10
'((LAMBDA 1 0) ((LET 1) ((LAMBDA 2 0) (
(LREF1-PUSH) ; n
0
(NUMEQ2)
(IF) ((LREF0))
(PRE-CALL 2) (
(LREF1) ; n
(NUMADDI -1)
(PUSH) ; (- n 1)
(LREF0-PUSH) ; s
(LREF1) ; n
(NUMADD2)
(PUSH) ; (+ s n)
(LREF10)
(CALL 2)))
(LSET0)
(PRE-CALL 2) (
(LREF10-PUSH) ; n
(PUSHI 0) ; 0
(LREF0)
(CALL 2))))
(DEFINE)
SUM
(PRE-CALL 1) (5
(PUSH)
(GREF) SUM
(CALL 1))
))
(define test11
'(
(LAMBDA 1 0) ((LET 1) ((LAMBDA 2 0) ((LREF1-PUSH)
0
(NUMEQ2)
(IF) ((LREF0))
(PRE-TAIL 2)
(LREF1)
(NUMADDI -1)
(PUSH)
(LREF0-PUSH)
(LREF1)
(NUMADD2)
(PUSH)
(LREF10)
(TAIL-CALL 2)
)
(LSET0)
(PRE-TAIL 2)
(LREF10-PUSH)
(PUSHI 0)
(LREF0)
(TAIL-CALL 2)
)
)
(DEFINE) SUM
(PRE-CALL 1) (5
(PUSH)
(GREF) SUM
(CALL 1))
))
(define (main args)
(let ((v (> (length args) 1)))
(test v "TEST1: Simple call" test1 undef)
(test v "TEST2: Two calls" test2 undef)
(test v "TEST3: DEFINE" test3 undef)
(test v "TEST4: TAIL-CALL" test4 undef)
(test v "TEST5: LET" test5 4)
(test v "TEST7: FACT" test7 120)
(test v "TEST8: FACT TAIL" test8 120)
(test v "TEST10: SUM" test10 15)
(test v "TEST11: SUM TAIL" test11 15)
)
0)
;; EOF
| false |
55adfdb63de3f05897f9bf365719ae81e011b4f7 | 120324bbbf63c54de0b7f1ca48d5dcbbc5cfb193 | /packages/slib/bytenumb.scm | 4af40b60cd67c38dd110cd5b62bbbadff7d71098 | [
"MIT"
] | permissive | evilbinary/scheme-lib | a6d42c7c4f37e684c123bff574816544132cb957 | 690352c118748413f9730838b001a03be9a6f18e | refs/heads/master | 2022-06-22T06:16:56.203827 | 2022-06-16T05:54:54 | 2022-06-16T05:54:54 | 76,329,726 | 609 | 71 | MIT | 2022-06-16T05:54:55 | 2016-12-13T06:27:36 | Scheme | UTF-8 | Scheme | false | false | 14,998 | scm | bytenumb.scm | ;;; "bytenumb.scm" Byte integer and IEEE floating-point conversions.
; Copyright (C) 2003 Aubrey Jaffer
;
;Permission to copy this software, to modify it, to redistribute it,
;to distribute modified versions, 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. I have made no warranty or representation that the operation of
;this software will be error-free, and I am under no obligation to
;provide any services, by way of maintenance, update, or otherwise.
;
;3. In conjunction with products arising from the use of this
;material, there shall be no use of my name in any advertising,
;promotional, or sales literature without prior written consent in
;each case.
(require 'byte)
(require 'logical)
;;@code{(require 'byte-number)}
;;@ftindex byte-number
;;@noindent
;;The multi-byte sequences produced and used by numeric conversion
;;routines are always big-endian. Endianness can be changed during
;;reading and writing bytes using @code{read-bytes} and
;;@code{write-bytes} @xref{Byte, read-bytes}.
;;
;;@noindent
;;The sign of the length argument to bytes/integer conversion
;;procedures determines the signedness of the number.
;;@body
;;Converts the first @code{(abs @var{n})} bytes of big-endian @1 array
;;to an integer. If @2 is negative then the integer coded by the
;;bytes are treated as two's-complement (can be negative).
;;
;;@example
;;(bytes->integer (bytes 0 0 0 15) -4) @result{} 15
;;(bytes->integer (bytes 0 0 0 15) 4) @result{} 15
;;(bytes->integer (bytes 255 255 255 255) -4) @result{} -1
;;(bytes->integer (bytes 255 255 255 255) 4) @result{} 4294967295
;;(bytes->integer (bytes 128 0 0 0) -4) @result{} -2147483648
;;(bytes->integer (bytes 128 0 0 0) 4) @result{} 2147483648
;;@end example
(define (bytes->integer bytes n)
(define cnt (abs n))
(cond ((zero? n) 0)
((and (negative? n) (> (byte-ref bytes 0) 127))
(do ((lng (- 255 (byte-ref bytes 0))
(+ (- 255 (byte-ref bytes idx)) (* 256 lng)))
(idx 1 (+ 1 idx)))
((>= idx cnt) (- -1 lng))))
(else
(do ((lng (byte-ref bytes 0)
(+ (byte-ref bytes idx) (* 256 lng)))
(idx 1 (+ 1 idx)))
((>= idx cnt) lng)))))
;;@body
;;Converts the integer @1 to a byte-array of @code{(abs @var{n})}
;;bytes. If @1 and @2 are both negative, then the bytes in the
;;returned array are coded two's-complement.
;;
;;@example
;;(bytes->list (integer->bytes 15 -4)) @result{} (0 0 0 15)
;;(bytes->list (integer->bytes 15 4)) @result{} (0 0 0 15)
;;(bytes->list (integer->bytes -1 -4)) @result{} (255 255 255 255)
;;(bytes->list (integer->bytes 4294967295 4)) @result{} (255 255 255 255)
;;(bytes->list (integer->bytes -2147483648 -4)) @result{} (128 0 0 0)
;;(bytes->list (integer->bytes 2147483648 4)) @result{} (128 0 0 0)
;;@end example
(define (integer->bytes n len)
(define bytes (make-bytes (abs len)))
(cond ((and (negative? n) (negative? len))
(do ((idx (+ -1 (abs len)) (+ -1 idx))
(res (- -1 n) (quotient res 256)))
((negative? idx) bytes)
(byte-set! bytes idx (- 255 (modulo res 256)))))
(else
(do ((idx (+ -1 (abs len)) (+ -1 idx))
(res n (quotient res 256)))
((negative? idx) bytes)
(byte-set! bytes idx (modulo res 256))))))
;;@body
;;@1 must be a 4-element byte-array. @0 calculates and returns the
;;value of @1 interpreted as a big-endian IEEE 4-byte (32-bit) number.
(define (bytes->ieee-float bytes)
(define zero (or (string->number "0.0") 0))
(define one (or (string->number "1.0") 1))
(define len (bytes-length bytes))
(define S (logbit? 7 (byte-ref bytes 0)))
(define E (+ (ash (logand #x7F (byte-ref bytes 0)) 1)
(ash (logand #x80 (byte-ref bytes 1)) -7)))
(if (not (eqv? 4 len))
(slib:error 'bytes->ieee-float 'wrong 'length len))
(do ((F (byte-ref bytes (+ -1 len))
(+ (byte-ref bytes idx) (/ F 256)))
(idx (+ -2 len) (+ -1 idx)))
((<= idx 1)
(set! F (/ (+ (logand #x7F (byte-ref bytes 1)) (/ F 256)) 128))
(cond ((< 0 E 255) (* (if S (- one) one) (expt 2 (- E 127)) (+ 1 F)))
((zero? E)
(if (zero? F)
(if S (- zero) zero)
(* (if S (- one) one) (expt 2 -126) F)))
;; E must be 255
((not (zero? F)) (/ zero zero))
(else (/ (if S (- one) one) zero))))))
;; S EEEEEEE E FFFFFFF FFFFFFFF FFFFFFFF
;; ========= ========= ======== ========
;; 0 1 8 9 31
;;@example
;;(bytes->ieee-float (bytes 0 0 0 0)) @result{} 0.0
;;(bytes->ieee-float (bytes #x80 0 0 0)) @result{} -0.0
;;(bytes->ieee-float (bytes #x40 0 0 0)) @result{} 2.0
;;(bytes->ieee-float (bytes #x40 #xd0 0 0)) @result{} 6.5
;;(bytes->ieee-float (bytes #xc0 #xd0 0 0)) @result{} -6.5
;;
;;(bytes->ieee-float (bytes 0 #x80 0 0)) @result{} 11.754943508222875e-39
;;(bytes->ieee-float (bytes 0 #x40 0 0)) @result{} 5.877471754111437e-39
;;(bytes->ieee-float (bytes 0 0 0 1)) @result{} 1.401298464324817e-45
;;
;;(bytes->ieee-float (bytes #xff #x80 0 0)) @result{} -inf.0
;;(bytes->ieee-float (bytes #x7f #x80 0 0)) @result{} +inf.0
;;(bytes->ieee-float (bytes #x7f #x80 0 1)) @result{} 0/0
;;(bytes->ieee-float (bytes #x7f #xc0 0 0)) @result{} 0/0
;;@end example
;;@body
;;@1 must be a 8-element byte-array. @0 calculates and returns the
;;value of @1 interpreted as a big-endian IEEE 8-byte (64-bit) number.
(define (bytes->ieee-double bytes)
(define zero (or (string->number "0.0") 0))
(define one (or (string->number "1.0") 1))
(define len (bytes-length bytes))
(define S (logbit? 7 (byte-ref bytes 0)))
(define E (+ (ash (logand #x7F (byte-ref bytes 0)) 4)
(ash (logand #xF0 (byte-ref bytes 1)) -4)))
(if (not (eqv? 8 len))
(slib:error 'bytes->ieee-double 'wrong 'length len))
(do ((F (byte-ref bytes (+ -1 len))
(+ (byte-ref bytes idx) (/ F 256)))
(idx (+ -2 len) (+ -1 idx)))
((<= idx 1)
(set! F (/ (+ (logand #x0F (byte-ref bytes 1)) (/ F 256)) 16))
(cond ((< 0 E 2047) (* (if S (- one) one) (expt 2 (- E 1023)) (+ 1 F)))
((zero? E)
(if (zero? F)
(if S (- zero) zero)
(* (if S (- one) one) (expt 2 -1022) F)))
;; E must be 2047
((not (zero? F)) (/ zero zero))
(else (/ (if S (- one) one) zero))))))
;; S EEEEEEE EEEE FFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF
;; ========= ========= ======== ======== ======== ======== ======== ========
;; 0 1 11 12 63
;;@example
;;(bytes->ieee-double (bytes 0 0 0 0 0 0 0 0)) @result{} 0.0
;;(bytes->ieee-double (bytes #x80 0 0 0 0 0 0 0)) @result{} -0.0
;;(bytes->ieee-double (bytes #x40 0 0 0 0 0 0 0)) @result{} 2.0
;;(bytes->ieee-double (bytes #x40 #x1A 0 0 0 0 0 0)) @result{} 6.5
;;(bytes->ieee-double (bytes #xC0 #x1A 0 0 0 0 0 0)) @result{} -6.5
;;
;;(bytes->ieee-double (bytes 0 8 0 0 0 0 0 0)) @result{} 11.125369292536006e-309
;;(bytes->ieee-double (bytes 0 4 0 0 0 0 0 0)) @result{} 5.562684646268003e-309
;;(bytes->ieee-double (bytes 0 0 0 0 0 0 0 1)) @result{} 4.0e-324
;;
;;(bytes->ieee-double (list->bytes '(127 239 255 255 255 255 255 255))) 179.76931348623157e306
;;(bytes->ieee-double (bytes #xFF #xF0 0 0 0 0 0 0)) @result{} -inf.0
;;(bytes->ieee-double (bytes #x7F #xF0 0 0 0 0 0 0)) @result{} +inf.0
;;(bytes->ieee-double (bytes #x7F #xF8 0 0 0 0 0 0)) @result{} 0/0
;;@end example
;;@args x
;;Returns a 4-element byte-array encoding the IEEE single-precision
;;floating-point of @1.
(define ieee-float->bytes
(let ((exactify (if (provided? 'inexact) inexact->exact identity)))
(lambda (flt)
(define byts (make-bytes 4 0))
(define S (and (real? flt) (negative? (if (zero? flt) (/ flt) flt))))
(define (scale flt scl)
(cond ((zero? scl) (out (/ flt 2) scl))
((>= flt 16)
(let ((flt/16 (/ flt 16)))
(cond ((= flt/16 flt)
(byte-set! byts 0 (if S #xFF #x7F))
(byte-set! byts 1 #x80)
byts)
(else (scale flt/16 (+ scl 4))))))
((>= flt 2) (scale (/ flt 2) (+ scl 1)))
((and (>= scl 4)
(< (* 16 flt) 1)) (scale (* flt 16) (+ scl -4)))
((< flt 1) (scale (* flt 2) (+ scl -1)))
(else (out (+ -1 flt) scl))))
(define (out flt scl)
(do ((flt (* 128 flt) (* 256 (- flt val)))
(val (exactify (floor (* 128 flt)))
(exactify (floor (* 256 (- flt val)))))
(idx 1 (+ 1 idx)))
((> idx 3)
(byte-set! byts 1 (bitwise-if #x80 (ash scl 7) (byte-ref byts 1)))
(byte-set! byts 0 (+ (if S 128 0) (ash scl -1)))
byts)
(byte-set! byts idx val)))
(set! flt (magnitude flt))
(cond ((zero? flt) (if S (byte-set! byts 0 #x80)) byts)
((or (not (real? flt))
(not (= flt flt)))
(byte-set! byts 0 (if S #xFF #x7F))
(byte-set! byts 1 #xC0)
byts)
(else (scale flt 127))))))
;;@example
;;(bytes->list (ieee-float->bytes 0.0)) @result{} (0 0 0 0)
;;(bytes->list (ieee-float->bytes -0.0)) @result{} (128 0 0 0)
;;(bytes->list (ieee-float->bytes 2.0)) @result{} (64 0 0 0)
;;(bytes->list (ieee-float->bytes 6.5)) @result{} (64 208 0 0)
;;(bytes->list (ieee-float->bytes -6.5)) @result{} (192 208 0 0)
;;
;;(bytes->list (ieee-float->bytes 11.754943508222875e-39)) @result{} ( 0 128 0 0)
;;(bytes->list (ieee-float->bytes 5.877471754111438e-39)) @result{} ( 0 64 0 0)
;;(bytes->list (ieee-float->bytes 1.401298464324817e-45)) @result{} ( 0 0 0 1)
;;
;;(bytes->list (ieee-float->bytes -inf.0)) @result{} (255 128 0 0)
;;(bytes->list (ieee-float->bytes +inf.0)) @result{} (127 128 0 0)
;;(bytes->list (ieee-float->bytes 0/0)) @result{} (127 192 0 0)
;;@end example
;;@args x
;;Returns a 8-element byte-array encoding the IEEE double-precision
;;floating-point of @1.
(define ieee-double->bytes
(let ((exactify (if (provided? 'inexact) inexact->exact identity)))
(lambda (flt)
(define byts (make-bytes 8 0))
(define S (and (real? flt) (negative? (if (zero? flt) (/ flt) flt))))
(define (scale flt scl)
(cond ((zero? scl) (out (/ flt 2) scl))
((>= flt 16)
(let ((flt/16 (/ flt 16)))
(cond ((= flt/16 flt)
(byte-set! byts 0 (if S #xFF #x7F))
(byte-set! byts 1 #xF0)
byts)
(else (scale flt/16 (+ scl 4))))))
((>= flt 2) (scale (/ flt 2) (+ scl 1)))
((and (>= scl 4)
(< (* 16 flt) 1)) (scale (* flt 16) (+ scl -4)))
((< flt 1) (scale (* flt 2) (+ scl -1)))
(else (out (+ -1 flt) scl))))
(define (out flt scl)
(do ((flt (* 16 flt) (* 256 (- flt val)))
(val (exactify (floor (* 16 flt)))
(exactify (floor (* 256 (- flt val)))))
(idx 1 (+ 1 idx)))
((> idx 7)
(byte-set! byts 1 (bitwise-if #xF0 (ash scl 4) (byte-ref byts 1)))
(byte-set! byts 0 (+ (if S 128 0) (ash scl -4)))
byts)
(byte-set! byts idx val)))
(set! flt (magnitude flt))
(cond ((zero? flt) (if S (byte-set! byts 0 #x80)) byts)
((or (not (real? flt))
(not (= flt flt)))
(byte-set! byts 0 #x7F)
(byte-set! byts 1 #xF8)
byts)
(else (scale flt 1023))))))
;;@example
;;(bytes->list (ieee-double->bytes 0.0)) @result{} (0 0 0 0 0 0 0 0)
;;(bytes->list (ieee-double->bytes -0.0)) @result{} (128 0 0 0 0 0 0 0)
;;(bytes->list (ieee-double->bytes 2.0)) @result{} (64 0 0 0 0 0 0 0)
;;(bytes->list (ieee-double->bytes 6.5)) @result{} (64 26 0 0 0 0 0 0)
;;(bytes->list (ieee-double->bytes -6.5)) @result{} (192 26 0 0 0 0 0 0)
;;
;;(bytes->list (ieee-double->bytes 11.125369292536006e-309))
;; @result{} ( 0 8 0 0 0 0 0 0)
;;(bytes->list (ieee-double->bytes 5.562684646268003e-309))
;; @result{} ( 0 4 0 0 0 0 0 0)
;;(bytes->list (ieee-double->bytes 4.0e-324))
;; @result{} ( 0 0 0 0 0 0 0 1)
;;
;;(bytes->list (ieee-double->bytes -inf.0)) @result{} (255 240 0 0 0 0 0 0)
;;(bytes->list (ieee-double->bytes +inf.0)) @result{} (127 240 0 0 0 0 0 0)
;;(bytes->list (ieee-double->bytes 0/0)) @result{} (127 248 0 0 0 0 0 0)
;;@end example
;;@subsubheading Byte Collation Order
;;
;;@noindent
;;The @code{string<?} ordering of big-endian byte-array
;;representations of fixed and IEEE floating-point numbers agrees with
;;the numerical ordering only when those numbers are non-negative.
;;
;;@noindent
;;Straighforward modification of these formats can extend the
;;byte-collating order to work for their entire ranges. This
;;agreement enables the full range of numbers as keys in
;;@dfn{indexed-sequential-access-method} databases.
;;@body
;;Modifies sign bit of @1 so that @code{string<?} ordering of
;;two's-complement byte-vectors matches numerical order. @0 returns
;;@1 and is its own functional inverse.
(define (integer-byte-collate! byte-vector)
(byte-set! byte-vector 0 (logxor #x80 (byte-ref byte-vector 0)))
byte-vector)
;;@body
;;Returns copy of @1 with sign bit modified so that @code{string<?}
;;ordering of two's-complement byte-vectors matches numerical order.
;;@0 is its own functional inverse.
(define (integer-byte-collate byte-vector)
(integer-byte-collate! (bytes-copy byte-vector)))
;;@body
;;Modifies @1 so that @code{string<?} ordering of IEEE floating-point
;;byte-vectors matches numerical order. @0 returns @1.
(define (ieee-byte-collate! byte-vector)
(cond ((logtest #x80 (byte-ref byte-vector 0))
(do ((idx (+ -1 (bytes-length byte-vector)) (+ -1 idx)))
((negative? idx))
(byte-set! byte-vector idx
(logxor #xFF (byte-ref byte-vector idx)))))
(else
(byte-set! byte-vector 0 (logxor #x80 (byte-ref byte-vector 0)))))
byte-vector)
;;@body
;;Given @1 modified by @code{ieee-byte-collate!}, reverses the @1
;;modifications.
(define (ieee-byte-decollate! byte-vector)
(cond ((not (logtest #x80 (byte-ref byte-vector 0)))
(do ((idx (+ -1 (bytes-length byte-vector)) (+ -1 idx)))
((negative? idx))
(byte-set! byte-vector idx
(logxor #xFF (byte-ref byte-vector idx)))))
(else
(byte-set! byte-vector 0 (logxor #x80 (byte-ref byte-vector 0)))))
byte-vector)
;;@body
;;Returns copy of @1 encoded so that @code{string<?} ordering of IEEE
;;floating-point byte-vectors matches numerical order.
(define (ieee-byte-collate byte-vector)
(ieee-byte-collate! (bytes-copy byte-vector)))
;;@body
;;Given @1 returned by @code{ieee-byte-collate}, reverses the @1
;;modifications.
(define (ieee-byte-decollate byte-vector)
(ieee-byte-decollate! (bytes-copy byte-vector)))
| false |
7a506b6897f0cd1513ac87834bd28979125c645a | 5355071004ad420028a218457c14cb8f7aa52fe4 | /3.1/e-3.3.scm | cbb096bd7a60533b5b4a9ba18b9a6bd7ac474a4a | [] | no_license | ivanjovanovic/sicp | edc8f114f9269a13298a76a544219d0188e3ad43 | 2694f5666c6a47300dadece631a9a21e6bc57496 | refs/heads/master | 2022-02-13T22:38:38.595205 | 2022-02-11T22:11:18 | 2022-02-11T22:11:18 | 2,471,121 | 376 | 90 | null | 2022-02-11T22:11:19 | 2011-09-27T22:11:25 | Scheme | UTF-8 | Scheme | false | false | 1,391 | scm | e-3.3.scm | ; Exercise 3.3. Modify the make-account procedure so that it creates
; password-protected accounts. That is, make-account should take a
; symbol as an additional argument, as in
; (define acc (make-account 100 'secret-password))
; The resulting account object should process a request only if it is
; accompanied by the password with which the account was created, and
; should otherwise return a complaint:
; ((acc 'secret-password 'withdraw) 40) ; 60
; ((acc 'some-other-password 'deposit) 50) ; "Incorrect password"
; ------------------------------------------------------------
(load "../helpers.scm")
(define (make-account balance account-password)
(define (withdraw amount)
(if (>= balance amount)
(begin (set! balance (- balance amount))
balance)
"Insufficient funds"))
(define (deposit amount)
(set! balance (+ balance amount))
balance)
; action dispatcher, protected by password
(lambda (password m)
(if (eq? password account-password)
(cond ((eq? m 'withdraw) withdraw)
((eq? m 'deposit) deposit)
(else (error "Unknown request -- MAKE-ACCOUNT" m)))
; just return complaint, but has to accept argument
(lambda (n) "Incorrect password"))))
(define acc (make-account 100 'wizards!lizards))
(output ((acc 'wizards!lizards 'withdraw) 40))
(output ((acc 'lizards!wizards 'withdraw) 40))
| false |
1ee5b1795ccd6a7878e3cf2128b25548b452d0fb | 9bffff4e253d33415af0f902f9bcefa347491798 | /example-02.scm | 4736f30b91e754ad4018e25b1006ab58399827f2 | [] | no_license | blakemcbride/POS | 005e30d89e6b5b3e5c67f86044305f63588a12cd | 7db0459151fbbf7b23105be47333becc179a46ed | refs/heads/master | 2021-06-09T06:09:12.497471 | 2021-06-03T22:03:14 | 2021-06-03T22:03:14 | 16,159,364 | 3 | 1 | null | null | null | null | UTF-8 | Scheme | false | false | 2,081 | scm | example-02.scm | ;; This is a file I used to test POS
;; It contains use of most of the features of the system
;; Blake McBride
(define-class <cls1>
(cvars
(cv1 '())) ; class variables with initial values
(ivars
(iv1 4)) ; instance variables with initial values
; class methods
(cmeths
(get-cv1 (self)
cv1)
(set-cv1 (self val)
(set! cv1 val)
cv1))
; instance methods
(imeths
(get-iv1 (self)
iv1)
(set-iv1 (self val)
(set! iv1 val)
iv1)))
(define-class <cls2>
(cvars
(cv2 '())) ; class variables with initial values
(ivars
(iv2 4)) ; instance variables with initial values
; class methods
(cmeths
(get-cv2 (self)
cv2)
(set-cv2 (self val)
(set! cv2 val)
cv2))
; instance methods
(imeths
(get-iv2 (self)
iv2)
(fun1 (self)
(display "in <cls2>:fun1")
(newline))
(set-iv2 (self val)
(set! iv2 val)
iv2)))
(define-class <cls3>
(superclasses
<cls1> <cls2>) ; list of super-classes
(cvars
(cv3 '())) ; class variables with initial values
(ivars
(iv3 4)) ; instance variables with initial values
; class methods
(cmeths
(get-cv3 (self)
cv3)
(set-cv3 (self val)
(set! cv3 val)
cv3)
(new (self val)
((make self) 'init val)))
; instance methods
(imeths
(init (self val)
(set! iv3 val)
self)
(get-iv3 (self)
iv3)
(fun1 (self)
(self 'super 'fun1) ; run the super method
(display "in <cls3>:fun1")
(newline))
(set-iv3 (self val)
(set! iv3 val)
iv3)))
(define x (make <cls3>))
(<cls3> 'set-cv1 55)
(<cls1> 'get-cv1)
(x 'set-iv1 14)
(eq? (x 'class) <cls3>)
(define y (<cls3> 'new 88))
(x 'get-iv3)
(y 'get-iv3)
| false |
80d6a96899abbc1c5a4a39fb841bebf85b354825 | 69935b6ca8c91813e39ea33690e6981a65b22790 | /pyscheme/main.ss | 86b181f65e18b5c6087cd112bc7cd80b34ece030 | [] | no_license | jasonbaker/pyscheme | 10f3e3424c46d9bf668486602eb0e3f58c6c0d3f | 7bda519e6106e2d865d9e5e9c37d7e75f9b17697 | refs/heads/master | 2020-05-04T10:46:23.816977 | 2010-06-07T17:30:54 | 2010-06-07T17:30:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 21 | ss | main.ss | (module main scheme)
| false |
89ce281b523c260bb6fe1b5f139ef14d1398bc92 | ce567bbf766df9d98dc6a5e710a77870753c7d29 | /ch6/base/test.scm | fa06e13b07f3d9efcf5219bc03924905809c34e0 | [] | 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,046 | scm | test.scm |
;; safely apply procedure fn to a list of args.
;; if successful, return (cons #t val)
;; if error is invoked, returns (cons #f string), where string is the
;; format string generated by error. If somebody manages to raise a
;; value other than an exception, then the raised value is reported.
(define apply-safely
(lambda (proc args)
(with-handlers ([(lambda (exn) #t) ; catch any error
(lambda (exn) ; evaluate to a failed test result
(cons #f
(if (exn? exn)
(exn-message exn)
exn)))])
(let ([actual (apply proc args)])
(cons #t actual)))))
;;apply-safely for Chicken-scheme
(define apply-safely
(lambda (proc args)
(handle-exceptions exn
(cons #f 'error)
(let ((actual (apply proc args)))
(cons #t actual)))))
;; run-experiment :
;; ((a ...) -> b) * (a ...) * b * (b * b -> bool)
;; -> (cons bool b)
;; usage: (run-experiment fn args correct-answer equal-answer?)
;; Applies fn to args. Compares the result to correct-answer.
;; Returns (cons bool b) where bool indicates whether the
;; answer is correct.
(define run-experiment
(lambda (fn args correct-answer equal-answer?)
(let*
((result (apply-safely fn args))
;; ans is either the answer or the args to error
(error-thrown? (not (car result)))
(ans (cdr result)))
(cons
(if (eqv? correct-answer 'error)
error-thrown?
(equal-answer? ans correct-answer))
ans))))
(define stop-after-first-error (make-parameter #f))
(define run-quietly (make-parameter #t))
;; run-tests! : (arg -> outcome) * (any * any -> bool) * (list-of test)
;; -> unspecified
;; where:
;; test ::= (name arg outcome)
;; outcome ::= ERROR | any
;; usage: (run-tests! run-fn equal-answer? tests)
;; for each item in tests, apply run-fn to the arg. Check to see if
;; the outcome is right, comparing values using equal-answer?.
;; print a log of the tests.
;; at the end, print either "no bugs found" or the list of tests
;; failed.
;; Normally, run-tests! will recover from any error and continue to
;; the end of the test suite. This behavior can be altered by
;; setting (stop-after-first-error #t).
(define (run-tests! run-fn equal-answer? tests)
(let ((tests-failed '()))
(for-each
(lambda (test-item)
(let ((name (car test-item))
(pgm (cadr test-item))
(correct-answer (caddr test-item)))
(let* ((result
(run-experiment
run-fn (list pgm) correct-answer equal-answer?))
(correct? (car result))
(actual-answer (cdr result)))
(if (or
(not correct?)
(not (run-quietly)))
(begin
(printf "~a~%" pgm)
(printf "correct outcome: ~a~%" correct-answer)
(printf "actual outcome: ")
(display actual-answer)
(printf "~%~%")
))
(if correct?
(printf "pass -> ~a ~%" name)
(begin
(printf "fail -> ~a ~%" name)
;; stop on first error if stop-after-first? is set:
(if (stop-after-first-error)
(error name "incorrect outcome detected"))
(set! tests-failed
(cons name tests-failed)))))))
tests)
(if (null? tests-failed)
(printf "Lucky, No bugs found!~%")
(printf "incorrect answers on tests: ~a~%"
(reverse tests-failed)))))
(define run
(lambda (string)
(value-of-program (scan&parse string))))
;; run-all : () -> Unspecified
(define run-all
(lambda ()
(run-tests! run equal-answer? test-list)))
(define equal-answer?
(lambda (ans correct-ans)
(equal? ans (sloppy->expval correct-ans))))
(define sloppy->expval
(lambda (sloppy-val)
(cond
((number? sloppy-val) (num-val sloppy-val))
((boolean? sloppy-val) (bool-val sloppy-val))
((list? sloppy-val)
(if (null? sloppy-val)
(emptylist-val)
(pair-val (sloppy->expval (car sloppy-val))
(sloppy->expval (cdr sloppy-val)))))
(else
(error 'sloppy->expval
"Can't convert sloppy value to expval: ~s"
sloppy-val)))))
;; run-one : Sym -> ExpVal
;; (run-one sym) runs the test whose name is sym
(define run-one
(lambda (test-name)
(let ((the-test (assoc test-name test-list)))
(cond
((assoc test-name test-list)
=> (lambda (test)
(run (cadr test))))
(else (error 'run-one "no such test: ~s" test-name))))))
(define add-test!
(lambda (test)
(set! test-list (append test-list (list test)))))
(define clear-test!
(lambda ()
(set! test-list '())))
| false |
7fad48801cb9836ad91fe60c395b248d36416b58 | 370b378f48cb3ddd94297240ceb49ff4506bc122 | /9.3.pipe.scm | 74d27bb59a477c61254ff2c49bc1b6a5559225e4 | [] | no_license | valvallow/PAIP | 7c0c0702b8c601f4e706b02eea9615d8fdeb7131 | ee0a0bd445ef52c5fe38488533fd59a3eed287f0 | refs/heads/master | 2021-01-20T06:56:48.999920 | 2010-11-26T08:09:00 | 2010-11-26T08:09:00 | 798,236 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 2,948 | scm | 9.3.pipe.scm | ;; PAIP 9.3 P.263-
;; pipe
;; delay & force
(define-macro (make-pipe head tail)
`(cons ,head (delay ,tail)))
(define-constant empty-pipe '())
(define (head pipe)
(car pipe))
(define (tail pipe)
(force (cdr pipe)))
(define (pipe-ref pipe n)
(if (zero? n)
(head pipe)
(pipe-ref (tail pipe)(- n 1))))
(define (integers . startend)
(let-optionals* startend ((start 0)(end +inf.0))
(if (<= start end)
(make-pipe start (integers (+ start 1) end))
empty-pipe)))
;; PAIP 9.3 P.266-
;; pipe
;; closure
(define-macro (make-pipe head tail)
`(cons ,head (lambda () ,tail)))
(define-constant empty-pipe '())
(define (head pipe)
(car pipe))
(define (pipe-empty? pipe)
(equal? empty-pipe pipe))
(define (pipe-ref pipe n)
(cond ((pipe-empty? pipe) #f)
((zero? n)(head pipe))
(else (pipe-ref (tail pipe)(- n 1)))))
(define (tail pipe)
(cond ((pipe-empty? pipe) empty-pipe)
((procedure? (cdr pipe))
(set! (cdr pipe)((cdr pipe)))
(cdr pipe))
(else (cdr pipe))))
(define (integers . startend)
(let-optionals* startend ((start 0)(end +inf.0))
(if (<= start end)
(make-pipe start (integers (+ start 1) end))
empty-pipe)))
;; example
(define (pipe-enumerate pipe . keys)
(let-keywords* keys ((count 0)(key #f)(result pipe))
(if (or (pipe-empty? pipe)(zero? count))
result
(begin
(when key
(key (head pipe)))
(pipe-enumerate (tail pipe)
:count (- count 1)
:key key
:result result)))))
(define (pipe-filter pred pipe)
(if (pred (head pipe))
(make-pipe (head pipe)
(pipe-filter pred (tail pipe)))
(pipe-filter pred (tail pipe))))
(define (sieve pipe)
(make-pipe (head pipe)
(pipe-filter (lambda (x)
((complement zero?)(modulo x (head pipe))))
(sieve (tail pipe)))))
(pipe-enumerate (sieve (integers 2)) :count 10)
;; (2 3 5 7 11 13 17 19 23 29 31 . #<closure (pipe-filter pipe-filter)>)
(pipe-enumerate (sieve (integers 2)) :count 100)
;; (2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 211 223 227 229 233 239 241 251 257 263 269 271 277 281 283 293 307 311 313 317 331 337 347 349 353 359 367 373 379 383 389 397 401 409 419 421 431 433 439 443 449 457 461 463 467 479 487 491 499 503 509 521 523 541 547 . #<closure (pipe-filter pipe-filter)>)
(define (facts pipe)
(let rec ((pipe pipe)(acc 1))
(let* ((h (head pipe))
(cur (* (if (zero? h)
1
h) acc)))
(make-pipe cur
(rec (tail pipe) cur)))))
(pipe-enumerate (facts (integers 0)) :count 5)
;; (1 1 2 6 24 120 . #<closure (facts rec rec)>)
| false |
b4ffc4aeb7db4a28bdc74038ef2ea0db662519b1 | eb4c9cc6036c985065fec67e3116115be1d7fc12 | /lisp/tests/pairs_and_lists.scm | deec4c09b2dd9d0156f8779b8d17788de93cac5c | [
"MIT"
] | permissive | jorendorff/cell-gc | 31d751a1d854248bb894a43c4d10a951e203cd6a | 1d73457069b93b6af1adbfeb390ba1fbae8a291a | refs/heads/master | 2021-07-12T10:24:19.880104 | 2017-12-13T16:11:33 | 2017-12-13T16:11:33 | 49,678,729 | 62 | 5 | null | 2017-11-14T19:35:38 | 2016-01-14T22:12:58 | Pascal | UTF-8 | Scheme | false | false | 5,255 | scm | pairs_and_lists.scm | ;; R4RS 6.3 Pairs and lists
;; `pair?` returns #t if obj is a pair, and otherwise returns #f.
(assert (eq? (pair? '(a . b)) #t))
(assert (eq? (pair? '(a b c)) #t))
(assert (eq? (pair? '()) #f))
(assert (eq? (pair? '#(a b)) #f))
;; `cons` returns a newly allocated pair whose car is obj1 and whose cdr is
;; obj2. The pair is guaranteed to be different (in the sense of eqv?) from
;; every existing object.
(assert (equal? (cons 'a '()) '(a)))
(assert (equal? (cons '(a) '(b c d)) '((a) b c d)))
(assert (equal? (cons "a" '(b c)) '("a" b c)))
(assert (equal? (cons 'a 3) '(a . 3)))
(assert (equal? (cons '(a b) 'c) '((a b) . c)))
;; `car` returns the contents of the car field of pair. Note that it is an
;; error to take the car of the empty list.
(assert (eq? (car '(a b c)) 'a))
(assert (equal? (car '((a) b c d)) '(a)))
(assert (eq? (car '(1 . 2)) 1))
;;(assert (equal? (car '()) 'error))
;; `cdr` returns the contents of the cdr field of pair. Note that it is an
;; error to take the cdr of the empty list.
(assert (equal? (cdr '((a) b c d)) '(b c d)))
(assert (eq? (cdr '(1 . 2)) 2))
;;(assert (eq? (cdr '()) 'error))
;; `(null? obj)` returns #t if obj is the empty list, otherwise returns #f.
(assert (eq? (null? '()) #t))
(assert (eq? (null? '#()) #f))
(assert (eq? (null? '(())) #f))
(assert (eq? (null? #f) #f))
;; `(list? obj)` returns #t if obj is a list, otherwise returns #f. By
;; definition, all lists have finite length and are terminated by the empty
;; list.
(assert (eq? (list? '(a b c)) #t))
(assert (eq? (list? '()) #t))
(assert (eq? (list? '(a . b)) #f))
(assert (eq? (letrec ((x (list 'a)))
(set-cdr! x x)
(list? x))
#f))
;; `(list obj ...)` returns a newly allocated list of its arguments.
(assert (equal? (list 'a (+ 3 4) 'c) '(a 7 c)))
(assert (eq? (list) '()))
;; `(length list)` returns the length of list.
(assert (eq? (length '(a b c)) 3))
(assert (eq? (length '(a (b) (c d e))) 3))
(assert (eq? (length '()) 0))
;; `(reverse list)` returns a newly allocated list consisting of the elements
;; of list in reverse order.
(assert (equal? (reverse '(a b c))
'(c b a)))
(assert (equal? (reverse '(a (b c) d (e (f))))
'((e (f)) d (b c) a)))
;; `(list-tail list k)` returns the sublist of list obtained by omitting the
;; first k elements.
;; `(list-ref list k)` returns the kth element of list. (This is the same as
;; the car of (list-tail list k).)
(assert (eq? (list-ref '(a b c d) 2) 'c))
;;(assert (eq? (list-ref '(a b c d)
;; (inexact->exact (round 1.8)))
;; 'c))
;; `(memq obj list)`
;; `(memv obj list)`
;; `(member obj list)`
;;
;; These procedures return the first sublist of list whose car is obj, where
;; the sublists of list are the non-empty lists returned by `(list-tail list k)`
;; for k less than the length of list. If obj does not occur in list, then #f
;; (not the empty list) is returned. `memq` uses `eq?` to compare obj with the
;; elements of list, while `memv` uses `eqv?` and `member` uses `equal?`.
(assert (equal? (memq 'a '(a b c))
'(a b c)))
(assert (equal? (memq 'b '(a b c))
'(b c)))
(assert (eq? (memq 'a '(b c d))
#f))
(assert (eq? (memq (list 'a) '(b (a) c))
#f))
(assert (equal? (member (list 'a) '(b (a) c))
'((a) c)))
(assert (equal? (memv 101 '(100 101 102))
'(101 102)))
;; `(assq obj alist)`
;; `(assv obj alist)`
;; `(assoc obj alist)`
;;
;; `alist` (for "association list") must be a list of pairs. These procedures
;; find the first pair in alist whose car field is obj, and returns that
;; pair. If no pair in alist has obj as its car, then #f (not the empty list)
;; is returned. `Assq` uses `eq?` to compare obj with the car fields of the pairs
;; in alist, while `assv` uses `eqv?` and `assoc` uses `equal?`.
(define e '((a 1) (b 2) (c 3)))
(assert (equal? (assq 'a e)
'(a 1)))
(assert (equal? (assq 'b e)
'(b 2)))
(assert (eq? (assq 'd e)
#f))
(assert (eq? (assq (list 'a) '(((a)) ((b)) ((c))))
#f))
(assert (equal? (assoc (list 'a) '(((a)) ((b)) ((c))))
'((a))))
(assert (equal? (assv 5 '((2 3) (5 7) (11 13)))
'(5 7)))
;; `(for-each proc list1 list2 ...)` procedure
;;
;; The lists should all have the same length. Proc should accept as many
;; arguments as there are lists. Proc should not mutate any of the lists.
;;
;; The for-each procedure applies proc element-wise to the elements of the
;; lists for its side effects, in order from the first elements to the
;; last. Proc is always called in the same dynamic environment as for-each
;; itself. The return values of for-each are unspecified.
(assert (equal? (let ((v (make-vector 5)))
(for-each (lambda (i)
(vector-set! v i (* i i)))
'(0 1 2 3 4))
v)
'#(0 1 4 9 16)))
(define unspecified (if #f #f))
(assert (eq? (for-each (lambda (x) x) '(1 2 3 4))
unspecified))
(letrec ((even? (lambda (x) #t)))
(assert (eq? (for-each even? '())
unspecified)))
| false |
f5750cda101927b95b3b12bdbea894b4db1fa6ea | a2d8b4843847507b02085bb8adabd818f57dd09f | /scheme/sicp/ch_2/queens-first-attempt/tst-queens.scm | a069b4ba4434043f67e62aa8023b82612b47f43f | [] | 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,262 | scm | tst-queens.scm | ;;;; tests for queens.scm
(load "test-framework.scm")
(load "queens.scm")
;;;; test Constructor
(test-eq "empty-board" (empty-board 4) '(-1 -1 -1 -1))
(define %empty-board (empty-board 4))
;;;; test Selectors
(test-eq "set-column-row"
(set-column-row 2 3 %empty-board)
'(-1 -1 3 -1))
(clear-column 3 %empty-board)
(test-eq "dummy clear"
(clear-column 2 (empty-board 4))
%empty-board)
(test-eq "clear-column"
(clear-column 2 '(2 3 0 -1))
'(2 3 -1 -1))
;;;;
(test-eq "adjoin-position"
(adjoin-position 0 0 %empty-board)
'(0 -1 -1 -1))
(test-eq "adjoin-position mid"
(adjoin-position 2 3 %empty-board)
'(-1 -1 3 -1))
#!
; should throw exception
(test-eq "adjoin-position mid"
(adjoin-position 2 2 '(2 3 6 6))
'(2 3 2 6))
!#
;;;; test rows-safe?
(test-eq "rs empty-board" (rows-safe? 3 %empty-board) #t)
(test-eq "rs diagonal" (rows-safe? 3 '(1 2 3 4)) #t)
(test-eq "rs first two same yes" (rows-safe? 3 '(1 1 3 4)) #t)
(test-eq "rs first two same no" (rows-safe? 1 '(1 1 3 4)) #f)
(test-eq "last two same" (rows-safe? 3 '(-1 -1 3 3)) #f)
;;;; test diagonals-safe?
(test-eq "ds dummy" (diagonals-safe? 1 %empty-board) #t)
(test-eq "ds not" (diagonals-safe? 1 '(0 1 -1 -1)) #f)
(test-eq "ds yes" (diagonals-safe? 3 '(1 3 0 2)) #t)
| false |
eb2a40d8654a09ca368cbfd29d4823bfb0c897f9 | 26aaec3506b19559a353c3d316eb68f32f29458e | /apps/DemoCube/main.scm | 2eaad97cf2ece1630f04ff9565663143cf46da82 | [
"BSD-3-Clause"
] | permissive | mdtsandman/lambdanative | f5dc42372bc8a37e4229556b55c9b605287270cd | 584739cb50e7f1c944cb5253966c6d02cd718736 | refs/heads/master | 2022-12-18T06:24:29.877728 | 2020-09-20T18:47:22 | 2020-09-20T18:47:22 | 295,607,831 | 1 | 0 | NOASSERTION | 2020-09-15T03:48:04 | 2020-09-15T03:48:03 | null | UTF-8 | Scheme | false | false | 4,073 | scm | main.scm | #|
LambdaNative - a cross-platform Scheme framework
Copyright (c) 2009-2013, University of British Columbia
All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, are permitted provided that the
following conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the following
disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials
provided with the distribution.
* Neither the name of the University of British Columbia nor
the names of its contributors may be used to endorse or
promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|#
;; rotating cube example
(define alpha 0.)
(define alphaincrement 0.5)
(define beta 30.)
(define betaincrement 0.)
(define cube_vertices `(
((-1 -1 1) (1 -1 1) (-1 1 1) (1 1 1)) ;; front
((1 -1 1) (1 -1 -1) (1 1 1) (1 1 -1)) ;; right
((1 -1 -1) (-1 -1 -1) (1 1 -1) (-1 1 -1)) ;; back
((-1 -1 -1) (-1 -1 1) (-1 1 -1) (-1 1 1)) ;; left
((-1 -1 -1) (1 -1 -1) (-1 -1 1) (1 -1 1)) ;; bottom
((-1 1 1) (1 1 1) (-1 1 -1) (1 1 -1)) ;; top
))
(define cube_colors `(,Red ,Green ,Blue ,Orange ,Cyan ,Yellow))
;; custom OpenGL rendering hook
(define (render-custom)
(glClearColor 0. 0. 0. 0.)
(glClear (bitwise-ior GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT))
(glMatrixMode GL_PROJECTION)
(glLoadIdentity)
(glFrustum -1.0 1.0 -1.0 1.0 1.5 20.0)
(glMatrixMode GL_MODELVIEW)
(glLoadIdentity)
(glEnable GL_CULL_FACE)
(glCullFace GL_BACK)
(glEnable GL_DEPTH_TEST)
(glDepthMask GL_TRUE)
(glTranslatef 0 0 -5)
(glRotatef alpha 0 1 0)
(glRotatef beta 1 0 0)
(let loop ((vs cube_vertices)(cs cube_colors))
(if (> (length vs) 0) (begin
(glCoreColor (car cs))
(glCoreBegin GL_TRIANGLE_STRIP)
(map (lambda (l) (apply glCoreVertex3f l)) (car vs))
(glCoreEnd)
(loop (cdr vs) (cdr cs)))))
(set! alpha (+ alpha alphaincrement))
(set! beta (- beta betaincrement)))
(define gui #f)
(define (box-callback g wgt t x y)
(let ((ox (glgui-widget-get g wgt 'offsetx))
(oy (glgui-widget-get g wgt 'offsety))
(w (glgui-widget-get g wgt 'w))
(h (glgui-widget-get g wgt 'h)))
(set! alphaincrement (/ ox w))
(set! betaincrement (/ oy h))
))
(define (button-callback g wgt t x y)
(set! alphaincrement (- alphaincrement))
(set! betaincrement (- betaincrement)))
(main
;; initialization
(lambda (w h)
(make-window 320 480)
(glgui-orientation-set! GUI_PORTRAIT)
(set! gui (make-glgui))
(let* ((w (glgui-width-get))
(h (glgui-height-get)))
(set! mybox (glgui-box-dragable gui 80 110 160 230 Red box-callback))
(glgui-widget-set! gui mybox 'draw-handle #f) ;; hides the box
(glgui-button-string gui 10 10 (- w 20) 32 "Reverse" ascii_16.fnt button-callback)
)
(glCore-registerhook render-custom)
)
;; events
(lambda (t x y)
(if (= t EVENT_KEYPRESS) (begin
(if (= x EVENT_KEYESCAPE) (terminate))))
(glgui-event gui t x y)
)
;; termination
(lambda () #t)
;; suspend
(lambda () (glgui-suspend))
;; resume
(lambda () (glgui-resume))
)
;; eof
| false |
183219adea3e946fcb622311d330fdd35313ab9e | 7aeb920de21547a1d9c714b029bbf3a9e7df449e | /scheme/chip-remote/validate.scm | 1c29459cb1e75fc63b55564e52fb68cd838eb24d | [
"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 | 3,662 | scm | validate.scm | ;; Copyright (c) 2018-2021 chip-remote workers, All rights reserved.
;;
;; Terms for redistribution and use can be found in LICENCE.
(define-module (chip-remote validate)
#:use-module (srfi srfi-9 gnu)
#:use-module (chip-remote codecs)
#:use-module (chip-remote named-value)
#:use-module (chip-remote item)
#:use-module (chip-remote semantics)
#:use-module (chip-remote utilities)
#:export (predicates
make-validator
generate-validator
define-validator
combine-validator
identify-validator
validator?
validator-name
validator-type
validator-expression
validator-predicate
validate-item-value))
(define-syntax-rule (predicates (op bound) ...)
(lambda (x) (and (op x bound) ...)))
(define-immutable-record-type <validator>
(make-validator name combination type expression predicate)
validator?
(name validator-name identify-validator)
(combination validator-combination combine-validator)
(type validator-type)
(expression validator-expression)
(predicate validator-predicate))
(define-syntax generate-validator
(lambda (x)
(define (elem-of-mode? expr)
(let ((sym (syntax->datum expr)))
(or (equal? sym 'element-of)
(equal? sym '∈))))
(define (not-elem-of-mode? expr)
(let ((sym (syntax->datum expr)))
(or (equal? sym 'not-element-of)
(equal? sym '∉))))
(syntax-case x (range interpreter scheme)
((_ range expr ...)
#'(make-validator #f #f 'range '(expr ...)
(predicates expr ...)))
((_ elem-of expr ...)
(elem-of-mode? #'elem-of)
#'(make-validator #f #f 'element-of '(expr ...)
(lambda (x)
(!! (member x '(expr ...))))))
((_ not-elem-of expr ...)
(not-elem-of-mode? #'not-elem-of)
#'(make-validator #f #f 'not-element-of '(expr ...)
(lambda (x)
(not (member x '(expr ...))))))
((_ interpreter expr)
#'(make-validator #f #f 'interpreter #f
(make-evaluation expr)))
((_ scheme expr)
#'(make-validator #f #f 'scheme #f expr)))))
(define-syntax-rule (define-validator binding expr expr* ...)
(define binding
(identify-validator (generate-validator expr expr* ...)
'binding)))
(define (minmax-ok? x min max)
(and (integer? x)
(>= x min)
(<= x max)))
(define (semantics->validator width semantics)
(let ((range (s:range semantics width)))
(cond ((list? range) (lambda (x) (!! (member x range))))
((pair? range) (lambda (x) (minmax-ok? x (car range) (cdr range))))
(else (lambda (x) #t)))))
(define (validator-or-true validator)
(if (validator? validator)
(validator-predicate validator)
(lambda (x) #t)))
(define (combination-or-semantic validator)
(if (validator? validator)
(validator-combination validator)
'semantic))
(define (validate-item-value item value)
(let* ((width (item-width item))
(semantics (item-semantics item))
(semantic-predicate (semantics->validator width semantics))
(validator (item-validator item))
(predicate (validator-or-true validator))
(combination (combination-or-semantic validator)))
(case combination
((semantic) (semantic-predicate value))
((and) (and (semantic-predicate value) (predicate value)))
((or) (or (semantic-predicate value) (predicate value)))
(else (predicate value)))))
| true |
1f048ec364869ec4d08e94dea0141b44153d8ef8 | 3ecee09e72582189e8a4a48b3d85447c7927142f | /gx/gxjs-fixes.ss | 7535e61e0eb92c7161dfae8b2ab9771a815d2b6b | [
"MIT"
] | permissive | drewc/gx-quasar | 6c745b9ec13c60ab6d1af8964a25ff14ceb4549b | 17513967f611d46cc2d5a44999c90a7891e5d2d0 | refs/heads/main | 2023-02-02T17:01:12.011714 | 2020-12-18T22:18:19 | 2020-12-18T22:18:19 | 310,720,698 | 1 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 4,996 | ss | gxjs-fixes.ss | (##inline-host-declaration #<<EOF
g_module_name = function (module_descr) {
var temp = module_descr[0];
var name = temp[temp.length - 1].name;
return name;
};
g_module_init = function(module_descr) {
g_sp = -1;
g_stack[++g_sp] = void 0;
g_r0 = g_underflow;
g_nargs = 0;
g_trampoline(module_descr[4]);
};
gx_gambit_module_table = (typeof gx_old_module_register === 'undefined') ? [] : gx_gambit_module_table;
g_module_register = function (module_descr) {
// Keep track of all registered modules.
gx_gambit_module_table.push(module_descr);
if ( typeof g_glo['##program-descr'] === 'object' ) {
g_module_init(module_descr);
} else {
var temp = module_descr[0];
var name = temp[temp.length - 1].name;
var info = Object.prototype.hasOwnProperty.call(g_module_map,name) ? g_module_map[name] : null;
g_module_latest_registered = module_descr;
if (!(info === null || g_module_count === g_module_table.length)) {
var index = info.index;
var old = g_module_table[index];
g_module_table[index] = module_descr;
if (old === null) {
++g_module_count;
if (g_module_count === g_module_table.length) {
g_glo["##program-descr"] = [g_module_table,null,false];
temp = g_module_table[g_module_table.length - 1][0];
g_glo["##vm-main-module-ref"] = temp[temp.length - 1];
g_sp = -1;
g_stack[++g_sp] = void 0;
g_r0 = g_underflow;
g_nargs = 0;
g_trampoline(g_module_table[0][4]);
}
}
}
}
};
g_module_registry_reset = function () {
g_module_count = 0;
g_module_map = {};
g_module_table = null;
g_module_latest_registered = null;
};
g_module_registry_init = function (link_info) {
var n = link_info.length;
var i = 0;
g_module_registry_reset();
g_module_table = new Array(n);
while (i < n) {
var info = link_info[i];
g_module_map[info.name] = info;
g_module_table[i] = null;
++i;
}
};
g_scm2host = function (obj) {
if (obj === void 0) {
return obj;
}
if (obj === null) {
return obj;
}
if (typeof obj === "boolean") {
return obj;
}
if (typeof obj === "number") {
return obj;
}
// this is what we add
if (obj instanceof G_Foreign) {
return g_foreign2host(obj);
}
if (obj instanceof G_Flonum) {
return obj.val;
}
if (obj instanceof G_ScmString) {
return obj.toString();
}
if (obj instanceof Array) {
return obj.map( g_scm2host );
}
if (obj instanceof G_U8Vector) {
return obj.elems;
}
if (obj instanceof G_U16Vector) {
return obj.elems;
}
if (obj instanceof G_U32Vector) {
return obj.elems;
}
if (obj instanceof G_S8Vector) {
return obj.elems;
}
if (obj instanceof G_S16Vector) {
return obj.elems;
}
if (obj instanceof G_S32Vector) {
return obj.elems;
}
if (obj instanceof G_F32Vector) {
return obj.elems;
}
if (obj instanceof G_F64Vector) {
return obj.elems;
}if (obj instanceof G_Pair) {
var jsobj = {};
var i = 0;
while (obj instanceof G_Pair) {
var elem = obj.car;
if (elem instanceof G_Pair) {
jsobj[g_scm2host(elem.car)] = g_scm2host(elem.cdr);
} else {
jsobj[i] = g_scm2host(elem);
}
++i;
obj = obj.cdr;
}
return jsobj;
}
if (obj instanceof G_Structure) {
throw "scm2host error (cannot convert Structure)";
}
if (typeof obj === "function") {
return g_procedure2host(obj);
}
throw "scm2host error";
};
g_host2scm = function (obj) {
if (obj === void 0) {
return void 0;
}
if (obj === null) {
return null;
}
if (typeof obj === "boolean") {
return obj;
}
if (typeof obj === "number") {
if ((obj | 0) === obj && obj >= -536870912 && obj <= 536870911) {
return obj;
} else {
return new G_Flonum(obj);
}
}
if (typeof obj === "function") {
return g_host_function2scm(obj);
}
if (typeof obj === "string") {
return new G_ScmString(g_str2codes(obj));
}
if (obj instanceof Array) {
return obj.map( g_host2scm );
}
if (obj instanceof Uint8Array) {
return new G_U8Vector(obj);
}
if (obj instanceof Uint16Array) {
return new G_U16Vector(obj);
}
if (obj instanceof Uint32Array) {
return new G_U32Vector(obj);
}
if (obj instanceof Int8Array) {
return new G_S8Vector(obj);
}
if (obj instanceof Int16Array) {
return new G_S16Vector(obj);
}
if (obj instanceof Int32Array) {
return new G_S32Vector(obj);
}
if (obj instanceof Float32Array) {
return new G_F32Vector(obj);
}
if (obj instanceof Float64Array) {
return new G_F64Vector(obj);
}
// Here's the GX difference!
if (typeof obj === "object") {
// var alist = null;
// for (var key in obj) {
// alist = new G_Pair(new G_Pair(g_host2scm(key),g_host2scm(obj[key])),alist);
// }
// return alist;
return g_host2foreign(obj);
}
throw "host2scm error";
};
EOF
)
| false |
977555f88d52140f7095e3f6066f7bf7c924938a | 2920e836b4e8cd7823f59ae05620f08572bd297e | /tests/showkeys.scm | 2f08c662cb9f9372302f9b291d01439251217b5c | [] | no_license | duncanmak/linedit | 036a2c6bf640baabfd6c9c6205cee50168ed7ec9 | 9e458453fed0cc13e647f713f8dbf882ebda4da7 | refs/heads/master | 2021-01-22T22:56:58.850491 | 2014-12-13T20:30:37 | 2014-12-13T20:30:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 538 | scm | showkeys.scm | (define-structure showkeys (export show-keys show-keyseq)
(open scheme ascii formats srfi-13 terminal-mode)
(begin
(define (show-keys)
(with-current-input-terminal-mode 'raw
(let loop ()
(let* ((c (read-char)))
(if (char=? c #\q)
(begin (newline) (display "bye bye now") (newline))
(begin (format #t "~A " (char->ascii c))
(loop)))))))
(define (show-keyseq s)
(string-for-each (lambda (c) (format #t "~a " (char->ascii c))) s) )
)) | false |
aaedc3799edc0dae66e88c77baa4840ff1aeeb1a | bf6fad8f5227d0b0ef78598065c83b89b8f74bbc | /chapter05/named-let01.ss | 3afc9bac9764ed55a15fb09966dbd1693274b443 | [] | no_license | e5pe0n/tspl | 931d1245611280457094bd000e20b1790c3e2499 | bc76cac2307fe9c5a3be2cea36ead986ca94be43 | refs/heads/main | 2023-08-18T08:21:29.222335 | 2021-09-28T11:04:54 | 2021-09-28T11:04:54 | 393,668,056 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 618 | ss | named-let01.ss | (define print
(lambda (x)
(for-each display `(,x "\n"))
)
)
(define divisors
(lambda (n)
(let f ([i 2])
(cond
[(>= i n) `()]
[(integer? (/ n i)) (cons i (f (+ i 1)))]
[else (f (+ i 1))]
)
)
)
)
(define divisors-tail-recursive
(lambda (n)
(let f ([i 2] [ls `()])
(cond
[(>= i n) ls]
[(integer? (/ n i)) (f (+ i 1) (cons i ls))]
[else (f (+ i 1) ls)]
)
)
)
)
(print (divisors 5)) ; ()
(print (divisors 32)) ; (2 4 8 16)
(print (divisors-tail-recursive 5)) ; ()
(print (divisors-tail-recursive 32)) ; (16 8 4 2) | false |
0c9893ca8771acdac12242e6daf6d52931d06052 | c51f6a2ddfedc49313106d935141286eb0a13256 | /PAPR2/maze/test-maze/maze8.scm | d5db8fc8677145f25c0086bbd41ec026905a0554 | [] | 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,558 | scm | maze8.scm | (define setting (quote ((56 . 52) (109 . 34) (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 #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 #t #t #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 #f #t #t #t #t #t #f #t #t #t #t #t #t #t #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 #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #f #t #f #t #t #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 #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 #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #t #t #t #t #t #f #t #f #t #t #t #t #f #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 #f #t #t #t #t #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 #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 #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 #t #f #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 #f #t #f #t #t #f #t #t #f #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 #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 #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 #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 #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #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 #f #t #f #t #t #t #t #t #t #f #t #t #t #f #t #t #t #f #t #t #f #t #f #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 #t #t #f #t #t #f #t #t #t #t #t #t #t #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 #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 #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 #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 #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 #f #f #f #f #t #t #f #f #f #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 #t #f #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 #f #f #f #t #t #t #t #t #f #t #f #t #t #f #t #t #t #t #t #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 #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 #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 #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 #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 #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 #t #f #t #f #t #t #t #t #t #t #t #f #t #t #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 #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 #f #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 #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 #f #t #t #t #t #f #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 #t #f #t #t #t #f #f #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 #f #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #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 #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 #f #f #f #t #t #t #f #t #t #t #t #t #f #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 #t #t #t #t #t #f #t #t #t #f #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 #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 #t #f #t #t #t #t #t #t #t #f #t #t #f #t #t #f #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 #f #t #t #t #t #t #t #f #t #f #t #t #f #t #t #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 #t #t #f #t #t #f #t #t #f #t #f #t #t #t #t #t #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 #t #f #t #t #t #t #f #t #f #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #t #t #f #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #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 #f #t #t #t #t #f #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 #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 #f #f #f #f #f #f #f #t #f #t #t #t #f #t #f #t #t #f #t #t #t #t #t #f #t #t #f #t #f #t #t #t #f #t #f #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 #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #f #t #t #f #f #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 #t #f #t #t #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 #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 #f #t #t #t #f #t #t #t #f #t #f #t #f #t #t #t #t #f #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #f #f #f #f #t #t #f #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 #t #t #t #f #t #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 #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 #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 #t #t #t #t #f #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 #f #f #f #f #f #f #t #t #t #f #f #t #t #t #t #t #t #t #t #t #t #f #t #t #f #f #f #f #f #f #t #t #t #t #f #t #t #f #t #t #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 #f #t #t #t #f #t #t #t #t #f #t #f #t #t #f #t #t #t #f #f #f #f #f #t #t #t #t #t #f #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #f #t #t #t #t #t #t #t #t #t #t #f #t #f #f #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 #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #f #t #t #f #t #t #t #t #f #f #f #f #t #f #t #f #f #f #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 #f #t #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 #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 #t #f #t #t #t #t #t #t #t #t #f #t #f #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 #f #t #f #t #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 #t #t #t #t #f #t #t #t #t #f #f #f #t #t #f #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 #t #t #t #t #t #f #t #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #f #f #t #t #t #t #f #f #f #t #f #f #f #t #t #t #t #f #t #f #t #t #f #t #t #t #f #t #f #f #t #t #t #f #t #t #f #f #f #f #t #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 #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 #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 #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 #t #t #t #t #t #t #t #t #f #f #t #f #f #f #f #f #f #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #f #t #f #f #t #t #f #t #f #f #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 #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 #f #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #f #t #f #t #t #t #t #t #t #f #t #f #t #t #t #f #t #f #t #f #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 #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 #f #t #f #t #t #t #t #f #t #t #f #t #t #f #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 #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 #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 #t #t #t #f #t #t #t #t #f #t #t #f #t #t #t #t #t #f #t #t #f #t #t #t #f #t #f #f #f #f #f #f #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #t #t #t #t #t #t #t #t #t #t #f #f #f #t #t #t #f #t #t #t #t #t #f #t #t #t #f #f #f #f #f #f #f #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 #f #t #t #f #t #t #t #t #f #t #f #t #t #t #f #t #t #t #t #f #t #t #f #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 #f #f #f #f #f #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 #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 #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 #f #t #t #f #t #t #t #f #t #t #f #t #f #t #f #t #t #t #f #t #t #f #t #f #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #f #t #t #t #t #t #f #f #t #t #f #t #t #t #t #t #t #t #t #f #f #f #f #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #t #t #t #t #f #f #f #f #t #t #t #t #t #t #f #t #t #t #f #f #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 #t #t #t #t #f #t #t #f #t #t #t #f #t #t #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 #f #t #t #f #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 #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #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 #f #t #t #f #t #t #f #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 #f #t #f #t #f #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 #f #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 #f #t #t #t #t #t #f #f #f #f #f #t #f #t #t #t #f #t #t #f #t #t #t #t #f #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 #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #t #t #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #t #t #f #t #f #t #t #f #t #t #t #f #t #t #f #t #f #t #t #t #t #t #f #t #t #f #t #t #f #t #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 #f #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 #f #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 #t #f #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 #f #t #t #t #f #t #t #f #t #t #f #t #t #t #t #t #t #f #t #f #t #f #t #t #f #t #t #t #f #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 #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 #t #f #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #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 #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 #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 #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 #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 #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 #f #t #t #t #t #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 #f #t #t #f #t #t #t #f #f #f #t #f #t #t #t #f #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 #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 #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #f #t #f #t #t #f #t #f #t #f #t #f #t #t #t #t #f #t #t #t #f #t #f #t #t #t #f #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 #f #t #t #f #t #t #f #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 #f #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 #f #t #t #t #t #t #t #f #t #t #f #t #t #t #f #f #f #f #t #f #t #t #t #t #t #t #t #t #t #f #t #t #f #t #f #f #f #f #f #t #t #t #f #t #t #t #f #f #t #t #t #f #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #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 #t #t #f #t #t #t #f #t #f #f #f #f #f #f #t #t #t #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 #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 #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 #t #t #t #t #t #f #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 #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 #f #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 #f #f #t #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #f #f #f #t #f #t #f #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #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 #f #f #f #f #f #f #f #f #t #t #t #t #t #f #t #t #t #f #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #f #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 #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 #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 #f #t #f #t #f #t #t #f #t #t #t #t #f #t #t #f #t #t #f #f #f #f #f #f #f #f #t #f #t #t #t #t #f #t #t #t #f #t #f #t #f #t #f #t #t #t #f #t #t #t #f #t #t #t #f #f #t #t #t #f #t #t #t #t #t #t #f #f #f #f #f #t #t #t #t #t #t #t #f #t #f #t #f #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #f #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 #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 #f #t #t #f #f #f #f #t #t #t #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 #t #t #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 #f #t #f #t #f #t #t #f #t #t #t #t #f #t #t #f #f #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 #f #f #f #f #t #t #f #t #t #t #f #t #t #t #f #f #t #f #t #t #t #f #f #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 #t #t #t #t #t #t #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 #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 #t #t #f #t #f #t #t #t #t #t #t #f #t #t #f #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 #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #f #f #f #f #t #f #t #f #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 #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 #f #t #t #f #f #f #f #f #t #t #f #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 #t #t #t #f #t #t #t #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #t #f #t #f #f #f #t #t #t #t #t #f #t #f #f #t #f #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #f #f #f #f #f #t #t #t #f #t #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 #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 #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 #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 #f #t #f #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 #f #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 #f #f #f #t #f #t #t #t #f #t #f #t #t #f #t #f #t #f #t #t #t #f #t #f #t #t #f #t #t #t #t #f #t #f #f #f #t #t #t #t #t #f #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 #f #f #f #t #t #t #f #t #f #t #f #t #t #f #t #t #t #t #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #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 #t #t #f #t #t #t #t #t #t #t #t #f #t #t #f #t #f #t #f #f #f #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 #f #t #f #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #f #t #t #f #t #f #t #f #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 #f #t #t #f #t #f #t #t #t #t #t #f #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 #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 #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 #f #t #t #f #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #f #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 #f #t #f #t #f #f #f #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #f #t #t #f #t #t #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 #t #f #t #f #t #t #t #f #t #t #f #f #t #t #t #t #f #f #f #f #f #f #t #t #t #t #t #f #t #f #t #t #t #t #t #f #f #f #t #t #t #t #f #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 #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #f #f #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 #f #f #f #f #f #t #f #f #f #f #f #f #f #f #f #t #t #t #f #t #f #t #t #f #t #t #t #f #f #f #t #t #f #t #t #t #f #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 #f #t #t #t #t #t #t #f #t #t #f #t #f #t #f #f #f #f #f #t #t #t #f #f #t #t #t #f #t #f #t #t #f #f #f #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 #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 #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 #f #t #t #t #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 #t #f #t #f #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #f #t #t #f #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 #t #t #t #t #f #t #t #t #f #t #f #t #t #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 #f #t #t #t #f #t #t #f #t #f #t #f #t #t #t #f #t #t #t #t #t #t #f #f #f #f #f #f #f #f #t #f #f #f #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 #t #t #t #t #t #t #f #t #f #t #t #f #t #t #t #t #f #t #t #t #t #f #t #t #t #f #t #t #t #t #t #f #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 #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #f #t #t #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 #t #t #t #t #t #f #t #t #f #t #t #t #f #t #t #t #t #t #t #t #f #t #f #t #f #f #f #f #t #t #t #f #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 #t #t #f #t #f #f #f #t #t #t #f #t #t #t #f #t #f #t #t #t #f #t #t #t #f #t #t #t #t #f #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 #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #f #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 #f #f #f #f #f #f #f #f #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #f #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 #t #t #t #t #t #t #t #t #f #f #f #t #f #t #f #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 #t #t #f #f #f #f #f #f #t #t #f #t #t #t #t #t #f #t #t #t #t #f #t #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 #f #t #f #t #t #t #f #t #t #f #t #f #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 #t #t #f #t #t #f #t #f #f #t #t #t #t #f #f #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 #t #f #t #f #f #t #f #t #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #f #t #t #t #t #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 #t #t #t #t #t #f #t #t #f #t #t #t #t #f #f #f #f #f #f #t #f #t #f #t #t #t #t #f #t #t #f #f #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 #t #t #f #t #t #f #t #f #t #f #f #f #t #f #t #t #t #f #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 #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 #f #t #t #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 #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 #t #t #t #f #t #t #f #t #t #t #f #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 #t #t #t #t #f #f #f #f #f #f #f #t #t #f #t #t #t #t #t #t #t #t #f #t #t #f #t #f #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 #f #t #f #t #t #t #t #f #t #f #t #t #f #t #f #t #f #t #t #t #f #t #t #t #t #t #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 #t #t #f #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 #f #t #t #t #t #t #t #t #t #t #f #t #t #t #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #t #t #t #t #t #t #t #t #t #t #f #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 #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 #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 #f #t #t #t #t #t #t #t #t #t #t #f #t #t #f #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 #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 #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 #f #t #t #t #t #t #f #t #t #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 #t #t #f #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #f #t #f #t #t #t #f #t #t #t #t #f #t #f #t #t #t #f #t #f #f #f #f #f #f #f #f #t #t #f #t #t #t #f #f #t #t #t #t #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 #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 #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 #f #t #t #t #t #t #t #t #f #t #t #t #f #t #f #f #f #f #t #t #f #t #f #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 #f #t #t #t #t #t #f #t #t #f #t #f #f #t #t #t #t #t #t #f #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 #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 #f #t #t #t #f #f #t #f #t #t #t #f #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 #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 #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #f #t #t #f #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #f #f #f #t #t #f #t #f #t #t #t #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 #t #t #t #f #t #t #f #t #f #t #t #t #t #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 #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 #t #t #t #t #t #f #t #t #f #f #f #t #t #f #f #t #f #t #t #f #t #f #t #t #t #f #t #t #t #t #t #f #t #t #t #t #f #f #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #f #t #t #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #t #t #t #f #t #f #f #t #t #t #t #f #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 #t #t #t #t #t #f #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 #f #t #t #t #t #t #t #f #t #t #t #f #t #t #f #t #f #t #t #f #t #t #t #t #t #f #t #t #f #f #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 #f #f #f #f #f #f #t #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #f #f #t #f #f #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 #f #f #f #f #t #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 #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 #f #t #f #t #t #t #f #f #f #f #f #f #t #f #t #t #t #t #t #t #f #t #f #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 #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 #t #f #t #f #t #t #t #f #f #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 #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 #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #f #f #f #t #t #t #f #f #f #f #f #f #f #f #t #t #t #t #t #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 #f #t #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 #f #t #t #f #t #t #t #f #t #t #t #f #t #t #f #t #f #t #t #t #t #f #t #f #t #t #t #t #f #t #t #t #f #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 #f #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 #t #t #f #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 #f #t #t #t #t #f #t #t #t #f #t #f #t #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 #f #t #f #t #t #t #f #t #t #t #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 #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 #t #t #t #f #t #f #t #t #t #t #t #t #f #f #f #f #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #f #f #f #f #t #f #f #f #f #f #f #f #f #t #t #f #f #f #f #f #f #t #f #t #t #t #f #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #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 #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 #t #t #f #t #f #t #t #t #t #f #t #t #t #t #t #f #t #t #f #f #f #f #t #t #t #t #f #t #f #t #t #t #t #t #t #t #f #t #f #t #t #t #f #f #t #t #f #f #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 #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 #t #t #t #t #f #t #t #f #t #f #t #t #t #t #t #f #t #f #t #t #f #t #t #t #t #f #f #f #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 #t #t #t #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 #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 #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #f #t #t #t #t #f #t #t #t #f #t #f #f #t #t #t #t #f #t #t #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 #t #f #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 #f #f #f #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 #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #f #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 #t #t #t #t #t #t #t #f #t #t #t #t #f #t #f #t #t #t #t #t #t #f #t #f #t #t #t #t #t #f #f #f #f #t #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 #t #t #t #t #f #f #f #f #f #f #t #f #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 #f #t #f #t #t #t #t #f #t #t #t #f #t #t #t #t #t #f #t #t #f #t #f #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 #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 #t #t #t #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 #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 #f #f #f #f #f #t #f #f #t #t #t #t #f #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 #t #f #t #t #t #f #f #f #t #t #f #t #t #f #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #f #f #f #f #f #f #t #t #t #t #t #t #f #t #t #t #t #f #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 #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 #f #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 #f #t #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 #t #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 #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 #t #t #t #t #f #f #f #f #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #f #t #t #t #t #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 #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #f #f #f #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 #f #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 #f #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 #t #t #t #t #f #t #t #t #f #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 #f #f #f #f #t #t #t #t #f #t #t #t #t #f #t #t #t #f #t #t #f #f #f #f #f #t #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 #f #t #f #f #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 #f #f #t #t #t #f #f #t #t #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 #f #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #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 #t #t #f #f #f #f #f #f #t #f #f #f #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 #t #f #t #t #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 #t #f #t #t #t #t #t #t #t #f #f #f #t #t #f #f #f #f #f #f #t #t #t #t #t #f #t #t #f #t #t #t #f #t #t #t #t #t #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 #t #t #f #t #t #t #t #t #f #t #t #t #t #t #f #f #t #t #t #t #f #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 #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 #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #f #f #t #t #f #t #t #t #t #t #f #f #f #t #t #t #f #t #t #t #t #f #t #f #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #f #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 #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #f #t #f #f #f #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 #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 #f #t #f #t #f #t #t #f #f #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 #t #t #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 #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #f #f #t #t #t #t #t #t #t #t #f #t #t #f #f #f #t #t #t #f #t #t #t #t #t #f #f #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #t #t #t #t #f #t #f #t #t #f #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 #t #t #f #t #t #f #f #f #f #f #f #f #t #f #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 #f #f #t #f #f #f #f #f #f #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #f #t #t #f #t #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 #f #t #t #f #t #t #f #t #t #f #t #f #t #t #t #t #f #t #f #f #t #f #t #t #t #t #t #t #t #t #t #f #t #f #t #f #t #t #t #t #t #f #t #t #t #f #t #t #t #f #t #t #t #t #f #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 #t #f #f #f #f #f #f #f #t #t #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 #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 #f #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 #t #t #t #t #t #t #f #f #f #t #t #t #t #t #t #f #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 #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 #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 #f #f #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #t #t #t #t #t #f #f #f #f #f #f #f #f #t #t #f #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 #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 #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 #f #t #f #f #f #f #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #f #t #t #f #f #f #f #t #t #f #t #t #t #t #f #t #t #t #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 #f #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 #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 #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #t #t #f #t #t #t #t #t #f #t #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 #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 #f #f #f #f #f #f #f #f #f #f #f #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 #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 #f #t #f #t #f #t #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 #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 #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 #f #f #f #f #f #f #f #f #f #f #f #t #f #f #t #f #f #t #t #t #t #f #t #t #t #f #f #f #f #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 #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 #t #t #t #f #t #f #t #f #t #f #t #f #t #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #t #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 #t #t #t #t #t #t #t #t #f #t #t #t #f #t #f #t #t #f #t #t #t #f #t #f #t #t #f #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 #f #t #t #t #t #t #t #t #t #t #t #t #f #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 #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 #f #f #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #f #t #f #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 #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 #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 #t #t #t #t #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 #f #f #t #f #t #t #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 #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 #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #f #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 #t #f #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 #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 #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 #f #f #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 #f #t #f #f #t #f #t #t #t #f #t #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 #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 #f #t #t #f #t #t #t #f #t #f #t #t #t #t #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 #t #t #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 #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 #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 #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 #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 #t #t #f #t #f #t #t #f #t #t #f #t #t #f #f #t #t #t #t #f #t #t #f #f #t #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 #f #t #t #f #t #f #t #t #t #t #t #t #t #f #t #t #t #t #f #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 #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 #f #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 #f #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 #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 #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 #f #t #f #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 #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 #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 #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #f #f #f #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 #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 #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 #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 #t #t #t #t #t #f #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 #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 #t #t #f #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 #f #f #t #t #t #t #f #t #t #t #t #t #t #t #f #f #f #f #t #t #t #t #t #t #f #f #f #f #f #f #t #t #t #t #t #t #t #t #f #f #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #f #t #t #t #f #t #t #f #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 #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 #f #t #t #f #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 #t #t #t #f #t #t #t #f #f #f #f #t #t #t #t #f #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 #f #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 #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 #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 #f #t #t #f #t #t #t #f #f #f #f #f #f #f #t #t #f #t #t #t #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 #f #f #t #f #t #t #t #f #t #t #t #t #f #t #t #t #f #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #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 #f #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 #t #t #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 #t #f #t #t #f #t #t #f #t #t #t #f #t #t #t #t #f #t #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 #t #f #f #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 #t #t #t #t #t #f #t #t #f #f #f #f #f #t #t #t #t #t #f #t #t #f #f #f #f #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #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 #t #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #t #t #t #t #f #t #t #f #t #t #t #f #t #f #t #t #f #t #t #f #t #t #t #t #t #t #f #t #f #t #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #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 #t #f #t #t #f #t #t #f #t #t #f #f #t #t #f #t #t #t #f #f #t #t #t #t #f #f #t #f #t #t #t #f #t #t #t #t #f #t #t #t #t #f #t #f #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 #f #t #t #t #f #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 #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 #f #t #f #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 #f #t #f #t #f #t #t #f #t #t #t #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 #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 #t #t #t #t #t #f #t #t #t #t #t #f #t #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 #t #f #t #f #f #f #t #t #f #f #f #t #t #f #f #t #t #t #t #t #t #t #f #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 #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #f #f #f #f #f #f #f #f #t #f #f #f #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 #f #t #t #t #t #t #t #f #t #t #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 #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 #f #t #t #f #t #f #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 #t #t #f #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #f #t #t #t #f #t #f #t #t #t #t #t #t #f #t #t #t #t #f #t #f #t #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 #t #t #f #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 #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 #t #t #t #t #f #f #f #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 #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 #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 #f #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 #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #f #t #f #t #t #t #f #t #t #f #t #f #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 #t #f #t #t #t #t #t #f #t #f #t #t #f #t #f #t #t #t #t #f #t #t #f #t #t #t #t #t #f #t #t #t #f #t #t #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 #t #t #f #t #t #t #t #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 #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 #f #t #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 #f #t #f #t #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 #t #t #t #t #t #f #t #t #t #f #f #f #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 #f #t #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 #t #t #t #t #t #t #t #t #f #f #t #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 #f #f #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 #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 #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 #f #t #t #t #f #t #t #t #f #t #t #t #t #t #f #t #f #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 #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 #t #t #t #f #t #t #t #t #t #f #t #t #f #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 #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 #t #t #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 #f #t #t #t #t #t #f #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 #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 #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 #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 #f #f #f #f #f #f #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 #t #t #t #t #f #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 #t #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 #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 #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 #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 #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 #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #f #t #t #t #f #t #t #t #t #t #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 #f #t #t #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 #t #f #t #t #t #t #t #t #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 #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 #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 #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 #t #t #t #t #f #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 #f #f #f #f #f #f #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 #t #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 #t #t #t #f #t #t #f #t #t #t #f #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 #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 #t #t #t #f #t #f #t #t #t #t #t #f #t #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 #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 #f #f #f #f #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 #f #f #f #f #f #f #f #f #f #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 #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 #t #f #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #f #f #f #f #f #t #t #f #t #f #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 #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 #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 #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 #f #t #t #f #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 #f #t #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 #f #t #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 #f #f #f #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 #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 #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 #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #t #f #f #f #t #f #t #f #t #t #t #t #f #t #t #t #t #f #t #t #f #f #f #f #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 #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 #f #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 #t #t #t #f #t #t #t #t #t #f #t #t #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 #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 #f #t #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 #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 #t #t #t #f #t #t #f #f #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 #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 #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 #f #t #t #t #t #t #t #t #t #f #t #t #f #t #f #t #t #t #t #t #t #f #t #f #t #t #f #t #f #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 #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #f #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 #t #t #f #t #f #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 #f #f #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 #t #f #t #t #f #t #t #f #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 #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 #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 #f #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 #f #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 #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 #f #t #t #t #t #t #f #t #t #t #t #f #t #t #f #t #t #f #t #f #t #t #f #t #f #t #t #t #f #t #f #t #t #t #f #t #t #f #t #t #f #t #t #t #t #t #f #t #t #t #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 #f #f #f #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 #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 #f #t #t #t #t #t #f #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 #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 #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 #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 #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 #f #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 #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 #f #t #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 #t #t #t #f #t #t #t #t #t #t #f #t #t #f #t #f #f #f #t #t #f #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 #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 #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 #f #t #t #t #t #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 #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 #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 #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 #t #t #f #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 #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 #f #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 #f #t #t #t #t #f #t #f #t #t #t #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 #t #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #t #t #t #f #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 #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 #f #t #t #f #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 #t #t #f #t #t #t #t #t #f #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 #f #f #f #f #f #f #f #t #t #t #f #f #t #t #f #f #f #f #f #f #f #f #f #t #f #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 #f #t #t #t #t #t #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 #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 #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 #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 #f #t #t #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 #t #t #t #f #t #t #t #f #t #f #t #f #t #t #f #t #t #t #t #f #t #t #t #f #t #t #t #t #f #t #f #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 #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 #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 #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 #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 #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 #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #f #f #f #f #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 #f #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 #t #f #t #t #t #t #t #f #t #f #f #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 #f #t #f #t #t #t #t #f #t #t #t #t #f #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 #f #t #t #f #t #t #t #t #t #t #t #f #t #t #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 #t #t #t #t #f #t #f #t #t #t #t #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 #t #t #t #f #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #f #t #f #t #t #t #f #f #t #f #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #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 #t #t #t #t #t #t #t #t #f #t #t #f #t #t #t #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 #t #t #t #t #t #t #t #f #t #f #t #t #f #t #t #f #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 #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #t #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 #f #f #f #f #f #f #f #t #t #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 #t #f #t #t #f #f #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 #t #t #t #t #t #t #t #t #f #t #f #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #t #f #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 #t #t #t #t #t #t #t #t #f #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #f #f #f #t #t #t #f #t #t #f #t #t #t #t #f #t #f #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 #t #t #t #t #t #f #f #t #f #t #t #f #f #f #t #t #t #t #f #t #t #f #t #t #f #t #f #f #f #t #t #t #t #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 #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 #f #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 #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 #t #t #f #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 #f #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #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 #f #f #f #f #t #t #t #f #t #t #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #f #t #f #f #t #f #t #f #t #t #t #t #f #t #t #t #t #t #f #t #f #t #f #f #f #f #f #t #f #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 #f #t #t #f #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 #t #f #f #f #f #f #t #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 #f #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 #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 #t #t #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 #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 #f #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #f #t #f #t #t #t #t #f #f #f #f #f #f #f #t #t #t #t #f #t #f #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 #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 #f #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #f #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #f #f #f #f #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 #t #t #t #f #t #t #t #f #t #f #t #t #t #t #f #t #t #t #t #f #t #f #t #t #t #t #t #t #t #f #t #t #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 #f #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #f #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 #t #t #f #t #t #t #t #f #t #t #f #t #t #t #t #f #t #t #t #t #t #t #f #t #f #t #t #t #t #f #t #f #t #t #t #t #t #t #t #f #t #f #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 #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 #f #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 #f #t #f #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 #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 #t #f #t #t #t #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 #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 #f #f #f #t #t #t #t #t #f #f #f #t #f #t #t #f #t #t #f #f #f #f #f #f #f #t #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 #t #f #t #t #f #t #t #t #t #t #t #f #t #t #f #t #f #t #f #f #f #f #t #t #t #f #t #t #t #t #f #f #f #f #f #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 #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 #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 #t #t #f #t #t #t #t #t #f #t #f #t #t #t #t #f #t #t #f #t #f #t #f #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 #f #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 #t #t #t #t #t #t #t #t #t #f #t #f #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 #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 #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 #t #t #t #t #t #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 #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 #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 #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 #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 #f #t #t #t #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 #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 #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 #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 #f #t #t #t #t #f #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 #t #t #f #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 #f #t #t #t #t #t #t #t #t #f #t #f #t #f #t #t #f #t #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #t #t #t #f #t #f #t #t #f #t #t #t #t #t #t #t #t #t #f #f #f #f #f #t #t #t #f #t #t #t #t #t #f #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 #f #t #t #f #t #t #t #f #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 #f #t #t #t #t #t #f #t #f #t #t #f #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #f #t #t #f #t #f #t #t #t #t #f #t #t #f #t #t #f #t #f #t #t #t #t #f #f #t #f #t #f #f #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 #f #f #f #f #f #f #f #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 #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 #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #f #t #f #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 #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 #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 #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 #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 #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 #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 #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 #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #t #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #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 #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 #f #t #t #t #t #f #t #f #t #t #t #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 #t #t #t #f #t #t #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 #t #t #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 #f #t #f #t #t #f #t #t #t #t #t #t #t #f #t #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 #f #t #t #t #f #t #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 #t #t #t #f #t #t #t #f #t #t #t #t #t #f #t #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 #t #t #t #t #f #t #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 #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 #f #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 #f #f #f #t #t #t #t #t #t #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 #t #f #t #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 #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 #f #f #f #f #f #f #t #t #t #f #f #f #t #t #t #f #t #f #t #t #t #t #t #f #t #t #t #f #t #f #t #f #t #f #t #t #f #t #t #t #f #t #f #t #t #t #f #t #t #t #t #t #t #t #f #t #t #f #t #t #t #f #t #t #t #f #t #t #t #t #f #t #f #t #t #t #t #f #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 #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 #t #t #t #t #t #t #t #t #t #t #f #t #t #f #f #f #f #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 #t #t #t #t #f #t #f #t #f #f #t #t #f #t #f #f #f #t #f #t #t #t #f #f #f #f #f #f #f #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 #t #f #t #t #t #f #t #t #f #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 #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #f #f #f #f #f #f #t #t #f #t #t #t #t #t #t #t #t #f #t #t #f #t #f #t #f #t #t #t #t #f #t #f #t #t #t #f #t #t #t #f #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 #f #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 #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 #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 #f #t #f #f #f #f #f #t #t #t #f #t #t #t #f #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 #f #t #t #t #f #f #f #t #t #t #f #t #t #t #t #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 #t #t #t #t #t #f #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 #t #f #t #t #t #t #f #t #f #f #f #f #f #t #t #f #f #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 #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 #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 #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 #f #t #t #f #t #t #t #t #f #t #t #f #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 #t #t #t #f #t #t #f #f #t #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 #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 #f #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #f #f #f #f #f #f #t #f #t #t #t #f #f #f #t #f #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #f #t #t #t #f #f #f #f #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #f #t #f #t #t #t #t #t #t #f #f #f #f #f #f #f #t #t #t #f #t #t #t #t #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 #f #t #f #t #t #t #t #t #f #t #f #t #f #t #f #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #t #t #t #f #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 #f #t #f #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 #f #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 #f #f #f #t #f #t #t #t #t #f #t #t #f #t #t #f #t #t #t #f #t #f #t #t #f #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 #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 #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 #f #f #f #f #f #f #f #f #f #f #f #t #f #f #t #t #t #f #f #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 #f #t #t #t #t #t #t #t #t #f #f #f #f #f #f #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 #f #t #t #t #t #t #t #f #t #t #t #f #f #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 #t #f #t #t #t #t #t #t #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 #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 #f #t #t #t #f #t #f #f #f #f #f #t #t #t #t #t #t #t #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 #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 #t #t #t #f #t #f #t #f #t #f #t #t #f #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 #t #t #t #t #f #t #t #f #t #f #t #f #f #f #f #f #f #t #t #t #t #t #t #t #f #f #f #f #f #t #t #f #t #f #t #t #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 #f #t #t #t #t #t #f #t #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #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 #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 #f #t #t #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 #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 #f #t #t #t #t #t #f #t #t #t #f #t #f #t #f #f #t #t #f #t #t #t #f #t #t #t #t #t #f #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 #t #t #t #t #t #t #f #t #t #t #t #f #t #f #t #f #t #t #t #f #t #t #f #t #t #f #t #f #t #f #t #t #f #t #t #t #t #f #t #t #t #f #t #f #t #f #t #t #f #t #t #t #t #t #f #t #t #t #t #t #f #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 #f #t #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 #t #t #t #f #t #t #t #t #f #t #t #f #t #f #t #t #f #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 #t #f #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #t #f #f #f #t #t #t #f #t #t #t #t #f #t #f #t #t #f #t #f #t #t #t #t #t #t #f #t #t #t #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 #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 #f #t #t #t #t #t #t #f #t #f #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 #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #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 #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 #t #t #f #t #t #f #f #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 #t #t #t #f #f #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 #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 #f #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #f #t #f #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 #t #t #t #f #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #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 #f #t #t #t #f #t #f #t #t #f #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 #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #f #f #f #t #f #t #f #t #t #f #t #t #t #t #f #f #f #f #f #f #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #f #f #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 #t #t #t #t #t #f #t #f #t #t #t #t #t #t #f #f #f #f #f #t #t #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #f #f #f #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 #f #t #t #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 #t #t #f #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 #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 #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 #t #t #t #f #t #t #f #t #f #t #t #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 #t #t #t #t #f #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 #t #t #t #t #t #t #f #t #t #f #t #t #t #f #f #f #f #f #f #f #t #t #f #t #t #t #t #t #t #f #t #f #t #t #t #t #f #t #t #t #t #t #f #f #f #f #f #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 #t #t #t #t #t #f #t #t #t #t #t #f #t #t #f #t #t #t #t #f #t #t #f #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 #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 #t #t #t #t #t #f #t #t #f #f #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 #t #t #t #f #t #t #t #t #f #t #t #t #f #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 #t #t #t #f #t #t #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 #f #t #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #f #f #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 #t #t #f #f #f #f #f #t #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 #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 #t #t #t #f #t #f #f #f #f #f #t #t #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 #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 #f #f #f #f #f #f #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 #f #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 #t #t #t #f #t #t #f #t #t #t #t #t #f #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 #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 #t #t #t #t #t #f #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 #t #t #t #f #t #t #t #t #t #t #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 #t #t #t #t #f #t #f #t #t #t #f #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #f #t #f #t #t #f #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 #t #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 #f #t #t #f #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 #t #f #f #t #t #f #f #t #t #t #t #t #t #t #t #t #f #t #f #t #f #f #t #f #f #f #f #f #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 #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #f #t #f #f #f #f #t #t #t #t #t #f #t #t #t #f #f #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 #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 #t #t #t #t #t #t #t #t #f #f #f #f #f #t #t #t #t #t #t #t #t #f #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 #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 #f #t #t #f #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 #f #t #t #f #t #t #t #f #t #f #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 #f #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 #f #f #t #t #f #t #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #t #f #t #f #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 #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 #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 #t #t #t #t #t #f #t #f #t #t #t #t #t #f #t #t #f #t #t #t #f #t #t #t #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 #t #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 #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 #f #t #t #t #t #t #f #t #t #t #f #t #f #t #t #f #f #t #t #f #f #t #f #t #t #f #t #f #t #f #t #t #t #t #t #t #f #f #f #f #f #t #t #f #f #f #f #f #f #f #f #f #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 #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 #f #t #t #f #t #t #f #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 #f #f #f #f #f #f #f #f #t #f #t #t #f #t #t #t #t #f #t #t #t #t #f #t #t #t #f #t #f #f #t #t #t #t #f #f #f #t #f #f #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 #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 #f #f #f #f #f #t #f #t #t #t #t #t #t #t #f #f #f #f #t #f #f #f #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 #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 #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #f #t #f #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #f #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 #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 #t #f #f #t #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #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 #f #f #f #f #f #f #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 #f #f #f #t #t #t #f #t #f #t #t #f #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 #f #f #f #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 #t #f #t #t #t #f #t #t #f #t #t #f #t #t #t #t #t #t #f #t #t #f #f #f #f #t #t #f #f #f #t #f #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 #f #f #f #t #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 #f #t #t #f #t #t #f #t #f #t #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 #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 #f #t #t #t #f #t #t #f #f #t #f #t #t #f #t #f #t #t #t #t #t #t #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 #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 #f #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 #t #t #t #f #t #f #t #t #t #t #t #t #t #t #f #t #f #t #t #f #t #t #f #t #t #t #f #f #f #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 #t #t #f #t #t #t #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #f #f #t #f #t #t #t #f #t #f #t #t #f #t #f #f #f #f #f #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 #f #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 #f #t #f #t #f #t #t #t #t #f #t #t #f #f #f #f #f #f #t #f #f #f #f #f #t #t #t #t #f #t #t #t #t #t #f #t #t #f #f #t #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 #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #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 #f #t #t #t #f #t #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 #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 #f #t #f #t #t #t #t #t #f #t #t #t #f #t #t #t #f #t #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 #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 #t #f #t #f #f #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #f #f #f #f #f #t #f #t #t #t #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 #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 #f #f #f #f #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 #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 #t #t #t #t #t #f #f #f #f #f #t #t #t #f #t #f #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 #f #t #t #f #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 #f #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #f #f #t #t #t #t #t #t #t #f #f #f #t #f #f #f #f #t #f #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #f #t #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 #f #f #f #f #f #f #t #t #t #t #t #t #f #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 #f #t #t #t #f #f #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 #f #t #t #t #t #t #t #t #f #t #t #t #t #f #t #f #t #t #t #t #t #f #t #t #t #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 #f #t #f #t #f #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 #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 #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 #f #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 #t #t #t #f #t #t #t #t #t #t #t #f #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 #t #t #t #f #t #t #f #f #f #f #f #f #t #f #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 #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 #f #f #t #t #f #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 #f #f #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 #f #f #f #f #f #f #f #f #f #t #t #f #t #t #t #t #f #t #f #f #f #f #f #t #t #f #t #t #t #t #t #f #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 #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 #f #t #t #t #t #t #t #f #t #f #t #t #t #f #t #t #t #f #f #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 #t #t #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 #f #t #f #f #t #f #t #t #f #t #t #t #t #t #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 #t #t #t #f #t #t #t #f #t #t #f #t #t #f #t #t #t #t #f #t #f #t #f #f #f #f #f #f #t #t #f #t #t #t #f #t #t #f #t #t #f #f #f #f #f #t #f #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #t #f #f #t #f #t #f #t #t #f #t #f #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 #t #t #f #t #t #f #f #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #f #f #t #t #t #t #t #t #t #t #t #t #t #f #f #t #f #f #f #f #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 #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 #f #t #t #t #f #t #t #t #t #f #t #f #t #t #f #f #f #f #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #f #f #f #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 #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #f #f #t #f #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 #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 #t #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 #f #t #f #f #f #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 #f #t #t #f #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #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 #f #f #f #f #f #f #f #f #f #f #f #f #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 #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 #f #t #t #f #t #t #t #f #t #f #t #t #t #f #t #t #t #t #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 #t #t #f #t #t #f #t #f #t #t #t #t #f #t #t #t #t #f #f #t #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 #f #f #f #f #f #f #t #t #f #f #t #f #t #t #f #t #t #f #f #f #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 #t #t #f #t #t #f #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 #f #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #t #f #f #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 #f #t #t #t #t #t #t #t #f #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #f #f #f #f #t #t #f #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 #t #t #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 #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #f #t #t #f #t #f #f #t #t #t #t #t #t #t #f #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 #f #f #t #t #t #t #f #t #f #t #f #t #t #t #f #f #f #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 #t #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #f #f #t #t #t #t #t #f #t #f #t #t #f #f #f #f #f #f #f #t #t #t #t #t #t #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 #t #t #f #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #f #t #t #t #f #t #f #t #t #t #f #t #t #f #t #t #t #t #t #f #t #t #f #t #f #t #t #f #t #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 #t #t #t #t #t #t #t #t #f #t #t #t #f #f #f #f #f #f #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 #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #f #f #f #f #f #t #t #t #f #t #t #t #t #f #t #f #t #t #f #f #f #f #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 #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 #f #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #f #f #f #t #t #t #f #f #t #t #t #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 #f #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #f #t #t #f #t #f #t #t #f #t #t #t #t #t #f #f #f #f #t #t #t #t #t #t #t #t #t #f #t #f #t #f #t #f #t #f #t #f #t #t #t #t #t #f #t #t #f #f #t #t #t #t #f #f #f #f #f #t #t #f #t #t #t #f #t #f #t #t #f #t #t #t #t #f #t #t #t #f #t #t #t #f #t #t #f #t #t #t #f #t #t #f #t #t #t #f #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 #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 #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 #t #t #f #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #f #t #t #t #t #t #t #t #f #f #f #f #f #f #t #f #t #f #f #f #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 #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 #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 #t #t #f #t #f #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 #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 #f #f #t #t #t #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 #t #t #t #f #t #t #t #t #t #t #t #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 #t #t #t #t #t #t #f #t #t #t #t #f #f #t #t #t #t #t #t #t #f #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 #t #t #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #f #t #t #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 #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 #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 #f #t #t #t #f #t #t #t #t #f #f #t #t #t #f #f #f #f #t #f #t #t #f #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 #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 #f #t #t #t #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 #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 #t #t #t #t #f #t #t #t #f #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 #t #t #f #f #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 #t #t #t #f #f #t #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 #t #f #f #t #f #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #f #f #f #f #t #t #f #f #f #f #f #f #t #f #t #t #f #t #f #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 #t #t #t #t #t #f #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #t #f #f #f #f #f #t #t #t #t #t #f #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 #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #f #f #t #f #f #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #f #t #f #f #f #t #t #t #t #t #t #t #f #t #t #f #t #f #t #t #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #t #t #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 #f #t #t #f #f #t #t #f #t #t #t #t #f #t #t #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 #t #f #t #t #t #t #t #t #f #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 #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 #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 #f #f #t #t #t #t #f #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 #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 #t #f #t #f #f #f #f #f #f #f #t #t #f #t #t #t #t #f #f #f #t #t #t #f #t #t #t #t #t #f #t #f #t #t #t #f #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 #t #t #t #f #t #t #t #t #f #f #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 #t #t #f #t #t #t #t #t #t #f #t #t #f #f #f #t #t #t #t #f #f #f #f #f #f #f #f #f #t #t #t #f #t #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 #f #f #f #t #t #t #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 #f #t #f #t #t #t #t #t #f #t #t #t #f #t #f #t #f #f #t #f #t #f #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #f #f #f #t #t #t #f #t #t #t #f #t #f #t #t #t #f #t #t #t #t #f #t #t #f #t #t #f #t #f #t #t #f #t #f #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #t #f #t #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #t #t #f #t #t #f #t #f #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 #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #t #t #f #t #t #t #t #t #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 #t #t #f #t #t #t #t #f #t #f #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 #t #f #t #f #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 #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 #t #t #t #t #t #f #t #t #f #t #t #t #t #f #f #t #t #t #t #t #t #t #t #t #t #f #f #f #t #f #t #f #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #f #f #f #f #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 #f #f #f #t #t #t #t #t #f #t #t #f #t #t #t #f #f #f #f #t #t #t #t #t #t #t #t #t #f #t #f #t #f #f #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 #f #f #f #f #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 #f #t #f #t #t #t #f #f #f #t #t #t #t #t #f #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #f #t #f #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 #t #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 #f #t #f #t #f #t #t #t #t #t #f #f #f #f #f #t #t #f #t #t #t #t #t #t #t #t #t #t #f #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 #t #f #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #f #f #t #f #f #f #t #f #t #t #f #t #t #t #t #t #t #t #t #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 #f #t #t #t #t #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 #f #t #f #t #t #t #t #t #f #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 #f #t #t #t #t #f #t #f #t #t #t #f #f #t #t #t #f #f #f #f #f #f #f #f #t #f #t #t #t #t #f #t #t #t #f #t #t #f #t #t #t #t #f #t #t #f #t #t #t #t #f #f #t #t #t #f #t #t #t #t #t #t #f #t #f #f #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 #t #f #f #f #t #t #t #t #f #t #t #t #t #t #f #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 #t #f #f #t #f #t #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 #t #f #t #t #t #t #t #t #t #f #t #f #t #f #t #f #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 #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 #f #t #t #f #t #t #t #f #t #t #t #t #f #t #f #t #f #f #f #f #f #f #t #t #t #t #t #t #f #t #t #t #t #f #t #t #f #f #f #f #f #t #f #f #f #f #f #f #f #t #t #t #f #f #t #f #t #f #f #f #f #f #f #f #f #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #t #f #t #f #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 #f #t #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 #t #t #t #t #t #t #f #f #f #f #f #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 #f #t #f #f #t #t #t #t #f #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 #f #t #t #f #t #f #f #f #t #t #t #t #t #t #t #t #t #f #t #t #t #f #t #t #f #t #t #t #t #f #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 #t #t #f #t #t #t #t #f #f #f #f #t #t #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 #t #f #f #f #t #f #t #f #t #t #t #t #f #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 #f #t #t #t #t #f #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 #f #f #t #f #t #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 #t #t #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 #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 #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 #t #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 #f #t #t #f #t #t #t #t #f #f #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #t #t #f #f #f #f #t #t #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 #t #t #t #f #t #t #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 #t #t #f #t #t #t #f #t #t #f #t #f #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 #t #t #t #t #t #t #f #f #f #t #t #t #f #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #f #f #f #f #t #t #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 #t #t #t #t #t #f #t #t #t #t #f #t #t #t #f #f #f #f #f #f #f #t #f #t #f #t #t #t #t #t #t #f #t #t #f #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 #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #t #f #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 #f #t #t #t #t #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 #t #t #f #f #f #f #f #f #f #f #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 #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #f #t #t #f #t #t #f #f #f #f #f #t #t #t #t #t #f #t #t #t #f #t #f #t #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 #t #t #t #t #t #t #t #t #t #f #t #f #f #f #t #t #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #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 #f #f #f #f #f #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 #f #t #f #t #t #t #t #t #f #t #t #f #t #t #t #t #f #t #t #t #t #f #t #t #f #f #f #t #t #f #f #t #f #t #f #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 #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 #f #t #f #f #f #f #f #f #f #f #f #t #f #t #f #t #f #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 #t #t #t #t #f #t #t #t #t #t #f #t #t #f #t #t #t #t #f #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 #t #f #t #t #t #t #t #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 #f #f #f #f #f #f #f #t #t #t #f #t #t #t #f #f #f #f #t #t #f #t #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 #f #f #f #f #f #f #f #f #t #t #t #f #t #f #t #t #t #f #f #f #f #f #f #f #f #t #t #f #f #f #f #f #f #f #t #t #t #t #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 #f #t #t #t #f #t #t #f #t #t #t #f #t #t #t #t #t #t #t #f #t #t #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 #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 #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 #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 #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #f #f #f #t #t #t #f #t #t #t #t #t #t #f #t #t #f #t #f #t #t #t #f #t #t #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 #f #f #f #f #f #f #t #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #f #t #f #t #t #t #t #f #t #t #f #t #t #t #f #t #t #t #t #t #f #t #t #f #t #f #t #t #t #f #t #t #t #f #t #t #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 #t #t #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 #f #t #f #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 #t #t #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 #t #t #t #f #t #t #t #f #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 #t #t #t #f #t #t #t #t #f #t #f #t #t #f #t #f #t #f #t #t #t #f #t #t #t #f #t #t #f #f #t #t #f #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 #t #t #t #t #t #t #f #t #f #t #t #t #f #t #t #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 #f #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 #f #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 #t #t #t #t #t #f #f #f #f #f #f #f #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 #t #t #t #f #f #f #f #f #t #f #t #t #t #f #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 #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 #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #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 #t #t #t #f #t #t #t #f #f #f #f #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 #f #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 #f #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #t #t #f #f #f #f #f #f #f #f #f #t #t #f #t #f #t #f #t #t #t #t #t #t #f #t #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 #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #f #t #t #t #t #t #t #f #f #f #f #f #f #t #t #t #t #t #f #t #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 #t #t #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 #f #t #t #t #t #t #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 #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 #f #t #f #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 #f #f #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #t #t #t #t #t #t #f #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 #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 #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 #t #t #f #f #f #f #f #f #t #t #f #t #f #f #f #f #f #f #t #t #t #t #f #t #t #t #f #t #f #t #t #t #t #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #f #t #f #t #f #f #f #f #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 #t #t #t #t #t #f #t #t #t #f #t #t #f #f #f #f #f #t #f #f #f #f #t #t #t #t #t #t #t #f #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 #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 #t #t #t #t #t #f #t #f #t #t #f #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 #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 #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 #t #t #t #f #t #f #t #f #t #t #t #t #f #f #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 #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 #t #f #t #f #t #t #t #t #f #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 #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #f #t #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 #t #t #t #f #t #t #t #f #t #f #t #t #f #t #t #t #t #f #t #t #t #t #t #f #t #t #t #t #f #f #f #f #f #t #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 #f #t #t #t #t #f #t #t #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 #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 #f #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #t #f #f #f #f #t #t #f #t #t #t #t #t #t #f #t #t #f #t #f #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #f #f #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 #t #t #f #t #t #f #f #f #f #t #f #f #f #t #t #f #t #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 #f #f #f #f #f #f #f #t #f #t #t #t #t #t #t #t #t #t #t #f #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 #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 #f #t #t #f #t #t #t #f #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 #f #t #t #f #t #t #t #t #f #f #t #t #t #f #f #t #t #t #t #t #t #t #f #f #f #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 #t #t #t #t #t #t #f #t #f #f #t #t #t #f #t #t #t #t #f #t #t #f #t #f #t #t #t #t #f #t #t #t #f #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 #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 #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 #f #t #t #t #t #f #t #t #t #f #t #f #f #f #t #t #t #t #t #t #t #t #t #t #f #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 #t #t #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 #f #t #t #f #f #f #f #f #f #f #f #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 #f #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #f #t #t #t #f #t #f #t #f #f #f #t #f #t #f #t #t #t #t #f #f #f #f #f #t #t #t #f #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 #t #t #t #f #f #f #t #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 #f #f #t #t #f #f #f #f #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 #f #f #f #f #t #t #f #t #t #t #t #t #t #t #t #f #t #t #f #t #t #f #t #t #t #f #t #f #t #f #t #t #t #t #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 #f #f #f #f #f #f #f #t #t #f #t #t #t #f #t #f #t #t #t #f #f #f #t #t #f #f #t #t #t #f #t #f #t #t #f #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 #f #f #f #f #f #t #t #t #f #t #f #t #t #t #t #t #t #t #t #f #t #f #t #f #t #t #f #t #t #t #t #t #f #f #f #f #t #f #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 #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 #f #f #f #t #f #t #t #t #t #f #t #f #t #t #t #f #t #t #f #t #t #t #t #t #f #t #t #f #t #t #f #t #t #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #t #f #t #f #t #t #f #f #f #t #f #f #f #t #f #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 #t #t #t #t #t #f #t #t #f #t #t #f #t #t #t #f #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 #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 #t #f #t #t #t #f #t #f #t #f #f #t #t #t #t #t #f #f #f #f #f #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #f #t #f #t #t #t #t #f #t #f #f #t #t #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 #f #t #t #f #t #f #t #f #t #t #f #t #f #t #f #t #t #t #f #t #t #f #f #f #f #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 #t #f #f #f #t #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 #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 #f #t #f #f #f #f #f #t #t #t #f #t #t #t #t #t #f #t #t #t #f #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 #t #f #f #f #t #f #f #f #t #t #f #t #t #t #f #f #f #f #f #f #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 #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 #f #f #f #f #t #f #t #f #f #f #f #f #f #f #f #f #f #t #t #t #f #t #t #f #t #t #t #t #f #f #f #f #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 #f #t #t #t #t #f #t #t #t #t #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 #f #t #t #t #t #t #t #t #f #t #t #f #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #f #t #t #t #f #f #t #t #t #t #f #t #t #t #t #t #t #t #f #f #f #f #f #f #t #f #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #f #t #t #t #t #f #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 #f #t #t #t #f #f #t #t #t #t #t #t #f #f #f #f #f #t #f #f #f #f #t #f #t #t #t #t #t #f #t #t #f #t #t #f #t #t #t #t #f #t #f #f #t #f #t #t #f #t #t #t #t #t #f #f #f #t #f #t #f #t #f #t #t #t #f #t #t #t #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 #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 #f #f #f #f #f #f #f #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 #f #t #t #t #f #t #t #f #f #f #f #t #t #t #f #t #t #t #t #t #f #f #t #t #t #t #t #t #f #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 #t #t #t #f #t #t #t #f #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 #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 #f #t #t #t #t #t #t #t #t #t #f #t #t #f #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 #f #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 #f #t #f #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 #f #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 #f #t #f #f #t #t #f #t #t #t #f #t #f #f #f #f #f #f #f #f #t #t #f #t #t #t #t #f #t #f #f #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 #t #f #t #f #f #f #t #t #t #f #f #f #f #t #f #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 #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 #f #t #t #f #f #f #f #f #f #f #t #t #t #f #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 #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 #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 #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #f #f #t #t #f #f #f #f #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #f #f #f #f #f #f #f #t #f #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 #t #t #f #f #f #f #f #t #t #f #f #f #t #t #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 #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 #t #t #t #t #t #f #t #t #t #f #t #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #t #f #t #f #t #t #t #t #f #t #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 #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 #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 #t #f #f #f #t #f #f #t #t #f #t #t #t #t #t #t #t #t #f #t #t #f #t #t #f #t #t #t #f #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 #t #f #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 #f #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 #t #t #t #t #t #f #t #t #t #t #t #f #t #t #f #f #f #f #f #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 #t #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #t #t #t #f #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 #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 #f #f #f #t #t #f #t #t #t #t #t #f #t #t #t #t #t #t #t #t #t #f #f #f #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #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 #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 #t #t #f #t #t #t #f #t #t #t #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 #f #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 #t #t #t #f #t #t #t #f #f #f #f #f #f #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 #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 #t #t #f #t #t #f #f #f #f #f #f #f #f #t #t #t #t #t #t #f #t #f #t #f #f #f #f #f #t #t #t #t #t #f #t #t #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 #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 #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #f #t #t #f #f #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 #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 #t #t #t #t #t #t #f #f #t #f #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #t #t #f #f #f #t #t #t #t #t #f #f #f #t #t #f #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 #f #t #t #t #t #t #t #f #t #f #f #t #t #t #t #t #f #t #t #t #f #t #t #f #f #f #f #t #t #t #t #t #f #f #f #f #f #f #f #f #t #t #t #t #f #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 #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 #f #t #f #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 #f #t #f #t #t #t #t #t #t #t #f #f #f #f #f #f #f #t #t #f #f #t #t #f #t #t #t #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 #t #f #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 #f #t #f #t #t #t #t #t #t #f #f #f #f #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #t #f #f #f #t #t #t #t #f #f #f #f #t #f #t #t #t #t #t #f #t #t #t #f #f #f #f #t #t #f #f #f #t #t #t #t #t #f #t #t #t #f #t #t #t #f #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 #f #f #f #f #f #f #f #f #f #f #f #f #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 #f #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 #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #t #t #t #t #t #t #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 #t #f #t #f #t #t #t #t #t #f #t #t #t #t #t #f #t #t #t #f #t #f #f #f #t #f #f #t #f #t #f #f #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 #f #f #f #f #f #f #f #f #t #f #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 #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 #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 #f #f #t #t #t #t #f #t #f #f #t #t #t #t #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 #f #t #t #t #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 #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 #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #f #t #f #t #t #f #t #t #t #t #t #t #t #t #f #t #t #f #t #t #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 #t #t #f #f #f #f #f #f #f #t #t #t #t #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 #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 #f #t #f #t #f #t #t #t #f #t #t #t #t #t #t #t #f #f #t #t #t #f #f #t #f #t #t #t #t #t #f #t #t #f #t #f #t #f #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #f #f #t #t #t #t #t #t #t #f #f #f #f #t #t #t #f #t #f #t #f #f #t #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 #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 #f #f #t #f #t #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 #t #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 #t #t #t #f #t #t #t #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #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 #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 #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 #t #f #t #f #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 #t #f #t #t #t #f #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 #f #t #t #f #t #t #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 #t #f #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #f #t #t #f #f #f #t #t #t #t #f #t #f #f #f #f #t #t #t #t #f #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #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 #t #t #f #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 #f #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 #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 #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 #t #f #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 #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 #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 #f #t #t #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 #t #t #f #t #t #t #f #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 #t #t #t #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 #f #t #t #t #t #f #t #t #t #f #t #t #t #t #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 #f #t #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #f #f #f #t #f #f #t #t #t #f #t #t #f #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 #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 #t #t #t #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 #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 #t #t #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 #f #f #f #f #f #f #t #t #t #t #t #f #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 #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 #f #t #t #f #t #t #t #f #f #f #t #f #t #f #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 #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 #f #t #t #t #t #t #f #t #t #t #t #f #t #t #f #t #t #t #f #t #t #t #f #t #t #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #t #f #t #t #t #t #t #f #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 #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 #t #f #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #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 #t #t #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 #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 #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 #f #t #t #t #t #f #t #t #t #t #t #t #t #f #t #t #t #f #t #t #t #t #f #t #f #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 #t #t #t #f #t #f #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 #f #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 #f #t #f #t #t #t #t #f #f #f #t #t #f #t #t #t #t #t #t #f #t #t #t #t #t #t #f #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 #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #f #t #t #t #t #t #f #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 #f #f #f #f #f #f #f #f #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 #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 #f #t #t #t #t #f #t #f #f #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #f #t #t #t #t #f #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 #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 #t #t #t #t #t #f #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 #f #f #f #f #f #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 #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 #t #t #f #t #f #t #t #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 #f #f #f #f #f #f #f #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 #f #f #f #f #f #f #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 #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 #f #f #f #f #f #f #f #t #t #f #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 #t #t #t #t #t #t #f #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #f #f #t #f #t #t #t #t #t #f #t #f #t #t #t #f #t #f #t #t #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #f #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 #t #t #t #t #f #t #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 #f #f #f #f #t #t #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 #f #f #f #f #f #f #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 #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 #t #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 #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 #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 #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 #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 #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 #t #t #t #t #t #t #t #f #f #t #t #f #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 #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 #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 #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #t #f #f #f #t #f #t #f #t #t #t #t #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 #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 #t #t #t #t #t #t #f #t #t #f #f #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 #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 #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 #f #t #f #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #f #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 #t #t #f #t #f #t #f #t #f #t #t #t #f #f #f #f #f #t #f #f #f #f #f #f #f #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 #t #f #t #t #t #t #f #t #t #t #t #t #f #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 #t #f #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 #f #t #t #f #t #t #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 #f #f #t #t #t #t #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 #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 #t #t #f #t #t #t #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 #f #t #f #f #f #t #t #t #t #t #f #t #t #t #f #t #t #t #t #t #t #f #t #f #t #t #f #f #t #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #t #t #f #t #f #t #t #t #t #t #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 #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #t #t #f #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 #t #t #f #t #f #t #t #t #t #f #t #t #t #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 #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 #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #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 #t #f #t #t #f #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 #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 #t #f #t #f #f #f #f #t #t #t #t #f #t #f #t #f #t #t #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 #f #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 #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 #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 #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #f #t #t #t #f #t #t #f #t #t #f #t #t #f #t #t #t #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 #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 #f #f #f #f #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 #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 #f #f #t #t #t #t #t #t #t #f #t #t #t #t #t #f #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 #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 #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 #f #t #t #t #t #t #t #t #t #t #f #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 #t #t #t #t #f #t #t #t #t #f #t #f #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 #t #t #f #t #f #t #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #f #t #t #f #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 #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 #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 #t #t #t #t #t #f #t #t #t #t #t #f #t #t #f #f #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 #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 #f #t #t #t #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 #f #f #t #t #t #t #t #t #t #t #t #f #f #t #f #t #f #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 #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 #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 #t #f #t #f #t #t #t #t #t #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 #f #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 #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #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 #t #t #f #t #t #t #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 #f #t #t #f #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #f #t #t #t #f #t #f #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 #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 #t #t #t #f #t #t #f #f #f #f #f #f #f #t #t #t #t #t #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 #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 #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 #t #f #t #f #t #t #f #t #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 #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 #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 #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 #t #t #t #t #t #f #f #f #f #f #f #f #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 #f #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 #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 #f #f #f #f #f #f #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 #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 #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 #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 #f #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 #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 #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 #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 #t #t #t #f #t #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 #f #t #f #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #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 #f #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 #f #t #t #t #f #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 #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 #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 #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 #f #t #t #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 #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 #f #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 #f #f #f #f #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 #f #f #f #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #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 #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 #t #t #f #t #t #t #t #t #f #t #t #t #t #f #t #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 #t #t #t #f #t #t #t #t #t #t #t #f #t #f #t #t #t #f #t #f #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 #t #f #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 #f #t #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 #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 #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 #t #t #f #t #t #t #t #t #t #t #t #f #t #t #f #f #f #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 #t #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #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 #f #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 #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 #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 #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 #t #t #t #f #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 #f #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 #f #t #t #t #f #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #t #t #f #t #t #f #t #t #t #t #f #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 #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #t #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 #f #t #f #t #f #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #f #t #t #t #f #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 #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 #f #t #t #f #t #t #f #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 #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 #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 #f #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 #t #t #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 #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #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 #t #t #t #t #f #t #f #f #t #f #t #f #t #f #t #f #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 #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 #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #f #t #t #t #t #t #f #t #t #f #t #t #t #f #t #t #t #t #t #f #t #t #f #f #f #f #f #f #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 #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #t #f #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 #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 #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 #t #f #t #t #t #t #t #f #f #t #t #t #t #t #f #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 #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 #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 #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 #t #t #t #t #t #f #t #f #t #f #t #t #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 #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 #t #t #t #f #t #t #t #f #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 #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 #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #t #f #t #t #f #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 #f #t #t #f #f #f #f #f #f #t #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 #f #t #f #f #f #f #f #f #f #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 #f #t #t #t #t #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #f #t #t #t #f #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 #f #f #t #t #t #t #t #t #t #t #t #t #t #f #t #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 #f #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 #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 #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 #f #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 #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 #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 #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 #t #t #t #t #t #t #t #t #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 #t #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 #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 #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 #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 #f #f #t #t #f #t #t #t #t #f #t #t #t #t #t #t #f #t #t #t #f #t #t #f #t #t #f #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 #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 #f #t #t #f #f #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #f #t #f #t #t #f #t #t #t #t #f #t #f #t #t #t #t #t #f #t #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 #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 #f #f #f #f #f #f #f #f #f #f #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 #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 #t #t #t #t #t #t #f #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #t #t #f #f #f #f #f #f #t #t #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 #f #f #f #f #f #f #f #f #t #t #t #f #t #f #t #t #t #t #t #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 #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 #f #f #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 #t #f #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 #f #t #t #t #f #f #t #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 #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 #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 #t #t #t #t #t #t #f #t #f #t #f #t #f #f #f #f #f #f #f #f #t #t #t #f #t #f #t #t #f #t #f #t #t #f #t #f #t #t #f #t #t #t #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 #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #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 #f #t #f #t #t #f #t #t #t #t #f #t #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 #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 #f #t #t #f #t #t #f #t #t #t #t #t #t #t #f #t #f #t #f #t #f #t #t #t #t #f #t #t #t #t #t #f #t #f #f #t #f #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 #t #f #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 #t #t #t #t #t #f #f #f #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 #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 #f #f #f #f #f #f #f #f #f #f #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 #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 #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 #t #f #t #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #f #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 #f #t #f #t #t #f #t #t #f #t #t #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 #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 #f #f #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #t #f #f #f #t #t #f #f #f #f #f #f #f #f #f #f #t #t #t #f #f #t #t #t #t #f #t #t #t #t #t #t #f #f #f #f #f #f #t #t #t #f #t #t #f #t #t #t #t #f #t #t #f #t #t #f #t #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 #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #t #t #f #t #f #t #t #f #t #t #t #t #t #t #t #t #t #f #t #t #f #t #f #f #f #t #t #t #f #t #t #t #t #t #t #f #t #f #t #t #f #t #f #f #f #f #f #f #t #t #t #t #t #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #t #f #f #t #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 #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 #t #f #t #t #f #t #t #t #t #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 #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 #f #t #t #t #f #t #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 #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 #t #t #t #f #t #f #f #f #t #t #f #f #f #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #f #f #f #f #t #f #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 #t #f #t #f #t #t #f #f #f #t #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #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 #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 #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 #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 #f #f #t #t #f #f #f #f #f #f #f #f #f #t #f #t #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 #f #f #f #f #f #f #f #t #f #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 #f #f #f #f #t #t #f #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #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 #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 #t #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #f #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 #t #t #t #t #t #f #f #f #t #f #t #f #t #t #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 #t #t #t #t #t #t #t #f #t #t #f #t #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 #f #f #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #t #t #f #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 #t #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 #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 #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 #f #t #t #t #f #t #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 #f #t #t #f #t #f #t #t #t #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 #t #f #f #t #f #f #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 #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 #t #f #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 #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 #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #f #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 #t #t #t #t #t #t #f #t #t #t #f #t #f #t #t #t #t #f #t #t #f #f #f #t #t #t #f #t #t #f #t #t #t #t #t #t #t #t #t #t #f #f #f #t #f #f #t #f #f #f #f #f #f #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 #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 #t #t #t #t #t #t #t #t #t #t #t #f #t #f #t #f #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 #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 #f #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 #f #t #t #f #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 #t #t #t #t #t #t #f #f #f #t #t #t #t #f #t #f #t #t #t #t #f #t #t #t #t #f #t #t #t #f #t #t #f #t #t #t #t #t #t #t #f #f #f #f #t #f #t #t #f #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #t #t #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 #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 #t #f #t #t #f #t #t #t #t #t #f #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 #t #t #f #t #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #f #t #t #f #f #f #f #f #f #t #t #f #t #t #t #t #t #t #f #t #f #t #t #t #t #f #t #t #t #t #f #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #t #f #f #f #t #t #t #t #t #f #t #t #t #t #f #t #t #t #t #f #t #t #t #t #f #t #t #t #t #f #f #f #f #f #t #f #t #t #t #f #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 #t #t #f #t #t #t #t #t #t #t #f #t #f #t #f #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 #f #f #f #f #f #f #t #t #t #t #t #f #f #f #f #f #f #f #f #t #t #t #t #t #t #t #f #t #t #f #f #f #f #f #f #t #t #t #t #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 #f #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 #f #t #t #f #t #f #t #t #t #t #f #t #f #t #f #t #t #f #t #t #t #t #f #t #f #t #f #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 #f #f #f #t #f #t #t #t #t #f #t #t #f #f #f #f #f #f #f #f #t #t #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 #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 #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 #t #t #t #t #t #t #t #t #t #f #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 #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 #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 #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 #t #f #t #t #f #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 #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #t #t #t #t #t #t #f #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 #t #f #t #t #f #t #t #f #t #f #t #t #f #t #t #t #t #t #f #t #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 #f #t #t #t #t #f #t #t #t #t #f #t #t #t #f #f #t #t #t #t #f #t #t #f #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 #t #f #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 #t #f #t #f #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 #t #t #t #t #f #t #f #t #t #t #t #f #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 #f #t #t #t #t #f #t #t #t #t #f #t #f #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 #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 #t #f #t #f #f #f #f #f #f #f #f #f #t #t #t #t #f #f #f #t #f #t #f #t #t #f #t #t #t #t #f #t #t #t #f #t #t #t #t #t #f #t #t #f #f #t #t #t #t #f #f #f #f #f #t #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 #t #f #t #t #f #t #t #t #f #t #f #t #t #t #f #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #t #t #f #f #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 #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 #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 #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 #f #t #t #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 #t #t #t #f #f #t #t #t #f #t #t #t #t #t #f #t #t #f #t #f #f #t #t #t #t #t #t #t #f #f #t #t #t #t #t #t #t #t #t #t #t #t #f #f #t #f #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 #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 #t #t #t #t #t #t #f #f #t #f #t #f #t #t #t #t #f #t #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 #f #t #f #t #t #t #f #t #f #t #f #t #t #t #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 #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 #t #t #t #t #f #t #t #t #t #f #t #t #t #f #t #t #t #t #f #f #t #t #f #f #f #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #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 #f #f #f #f #t #t #f #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 #t #t #f #t #t #t #t #t #t #f #t #f #t #f #t #t #t #t #t #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #f #t #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 #f #t #t #t #t #t #f #t #t #f #t #t #t #t #f #t #t #f #t #t #t #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 #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 #t #f #t #t #t #t #f #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 #t #t #t #t #f #t #t #t #t #t #t #t #t #f #t #f #t #t #t #t #t #t #t #f #t #f #f #f #f #f #f #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 #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 #f #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #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 #f #f #f #f #f #f #t #t #f #f #f #t #f #f #f #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 #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #t #t #t #f #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 #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 #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 #f #t #t #t #t #t #f #t #f #t #t #f #t #t #t #f #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #t #f #t #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 #f #t #t #f #t #t #t #t #f #f #t #t #t #t #t #t #f #t #t #t #t #t #t #f #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 #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 #f #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #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 #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 #f #t #f #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 #f #f #f #f #f #f #f #f #f #t #f #f #t #f #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 #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 #f #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 #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 #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 #f #f #f #f #f #f #f #f #f #t #t #t #t #f #t #f #t #t #t #f #t #t #f #t #t #f #t #t #t #t #f #t #t #t #f #t #t #f #t #t #t #t #f #f #f #t #f #t #t #t #f #t #f #t #t #f #f #f #t #f #t #f #t #f #t #t #t #f #t #t #t #t #f #t #f #t #f #t #t #f #t #t #t #t #t #t #t #f #t #t #t #t #t #f #t #f #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 #t #f #t #t #f #t #t #f #t #t #f #f #f #t #t #t #f #f #f #f #f #f #t #t #f #t #t #t #f #t #f #f #f #f #f #f #f #t #t #f #t #t #t #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 #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 #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 #f #t #t #f #t #t #t #t #t #t #f #f #t #t #f #t #f #f #f #f #f #f #f #t #t #t #t #t #t #t #t #f #f #t #t #f #t #t #f #t #t #t #t #f #t #t #f #t #t #t #t #f #f #f #t #t #t #t #f #t #f #t #f #t #f #t #t #t #f #f #t #t #t #t #t #t #t #t #t #t #f #f #f #f #f #f #t #t #f #t #t #t #f #f #f #t #f #t #f #t #t #t #t #t #f #t #t #t #t #f #t #f #f #f #f #f #f #f #f #f #f #f #t #t #f #f #f #f #f #t #f #t #t #t #t #f #t #t #t #f #t #f #t #t #t #t #t #f #f #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 #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 #f #t #t #t #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 #f #t #t #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 #t #t #t #f #t #t #f #t #t #f #f #f #t #f #f #f #f #f #f #f #t #t #t #t #f #f #f #t #f #t #f #t #f #t #t #t #f #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 #f #t #f #t #f #f #t #t #t #t #t #t #t #t #f #f #t #f #t #f #t #f #t #t #t #t #t #t #t #t #f #t #t #f #t #t #f #f #f #f #f #f #f #t #t #f #t #f #f #f #f #f #f #f #t #f #t #t #t #f #t #t #f #t #f #t #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 #t #t #t #t #t #t #f #t #t #t #t #t #f #t #f #f #t #f #t #f #t #t #f #t #t #t #t #t #f #t #t #t #t #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 #f #t #t #t #t #t #t #f #t #t #f #f #t #t #f #f #t #f #t #t #t #t #t #t #t #t #t #f #t #t #t #t #t #t #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 #t #t #f #f #f #t #f #f #f #f #f #t #f #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 #f #t #t #f #t #t #t #t #t #t #t #t #f #t #f #t #f #t #t #t #f #t #f #f #f #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #f #f #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 #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 #f #t #f #t #f #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 #f #t #t #t #f #t #f #t #t #t #t #t #t #t #t #t #f #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 #t #f #f #f #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 #f #t #t #t #f #t #t #t #t #t #f #f #f #t #f #t #f #f #f #f #f #f #f #f #f #f #t #f #t #t #t #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 #f #f #t #f #t #f #f #t #t #f #t #t #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 #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 #t #t #t #f #t #t #f #t #f #t #f #t #f #t #f #f #f #f #f #f #f #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 #f #f #t #t #f #t #t #t #f #t #f #f #f #f #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 #t #f #t #t #t #f #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 #f #f #f #f #f #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 #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 #f #f #f #f #f #t #f #t #f #t #t #t #f #t #t #t #f #t #t #t #f #t #f #t #f #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 #f #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 #t #t #f #t #t #t #t #t #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 #t #t #t #f #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 #f #f #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 #t #t #t #t #t #f #t #t #f #t #t #t #t #t #f #t #f #t #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 #t #f #t #t #f #t #t #f #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 #t #t #f #t #t #t #f #t #t #t #f #t #t #t #f #t #t #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 #f #f #f #f #t #f #t #t #t #f #t #f #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 #t #t #t #f #f #t #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 #t #t #t #t #f #t #f #t #t #t #t #t #t #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 #t #f #f #f #t #f #f #f #f #f #f #f #f #f #f #f #f #t #f #t #t #f #f #t #t #t #t #t #t #t #f #t #t #t #t #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 #f #t #t #t #f #t #f #t #t #t #f #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 #t #t #t #t #t #t #t #t #t #t #t #t #t #t #f #t #t #f #t #f #f #f #f #f #t #f #t #t #f #t #f #t #t #f #f #f #f #f #f #f #f #f #f #f #f #f #f #t #t #f #t #t #t #t #t #t #t #f #f #f #t #f #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 #f #t #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 #f #t #t #t #t #t #f #t #f #t #t #f #t #t #t #t #t #t #t #f #f #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 #t #t #f #t #f #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 #t #t #t #t #f #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 #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 #f #t #t #t #t #t #t #t #t #t #f #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 #f #t #f #f #f #f #f #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 #t #t #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 #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 #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 #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #f #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 #f #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 #t #t #f #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 #f #t #t #t #t #t #f #t #t #t #f #t #t #t #f #t #t #t #t #f #f #f #t #t #t #f #t #t #t #t #f #t #t #f #t #t #t #f #t #f #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 #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 #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 #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 #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 #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 #f #f #f #f #f #f #t #t #t #t #t #t #t #t #f #t #t #t #t #t #f #f #f #t #f #t #t #f #t #t #t #t #f #t #t #t #f #f #f #t #t #t #t #t #t #t #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 #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 #f #f #t #t #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 #t #t #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 #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 #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 #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 #t #t #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 #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #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 |
4086e7ef4b3ae6d53665c1048eb30faf230907c7 | 8f0c7a999b0cc7fdebd7df062aa5b14c8a809a08 | /harlan/middle/remove-complex-kernel-args.scm | cdaf8ba1917de3e4512e5ac2dc6734d9d64b7001 | [
"BSD-3-Clause-Open-MPI"
] | permissive | sarvex/harlan-lang | 7ab0eb7d0982848f68d0e5e67b12c27b91fdb34c | a361a1dc1312b3f4a46cb81c8d07852a70f67233 | refs/heads/master | 2023-06-13T03:07:01.753792 | 2023-05-30T16:03:27 | 2023-05-30T16:03:27 | 32,276,436 | 0 | 0 | NOASSERTION | 2023-05-30T16:03:28 | 2015-03-15T18:22:04 | Scheme | UTF-8 | Scheme | false | false | 1,927 | scm | remove-complex-kernel-args.scm | (library
(harlan middle remove-complex-kernel-args)
(export remove-complex-kernel-args)
(import
(rnrs)
(nanopass)
(only (elegant-weapons helpers) gensym)
(only (elegant-weapons lists) fold-right-values)
(harlan middle languages))
(define-pass remove-complex-kernel-args : M7.0 (m) -> M7.0 ()
(definitions
(define (complex? t)
(nanopass-case
(M7.0 Rho-Type) t
((adt ,x) #t)
((adt ,x ,r) #t)
(else #f))))
(SplitFreeVars
: FreeVars (fv) -> FreeVars (x^ t^ x* t*)
((free-vars (,x ,[t]) ...)
(let-values (((x* t* x^ t^)
(fold-right-values
((x* '()) (t* '())
(x^ '()) (t^ '())
<- (x x) (t t))
(if (complex? t)
(values (cons x x*) (cons t t*) x^ t^)
(values x* t* (cons x x^) (cons t t^))))))
(values `(free-vars (,x^ ,t^) ...) x^ t^ x* t*))))
(KernelStmt
: Stmt (e) -> Stmt ()
((kernel (vec ,r ,[t]) (,[e*] ...)
,[SplitFreeVars : fv x^ t^ x* t*]
,[stmt])
(let ((x*^ (map gensym x*))
(r* (map (lambda (_) r) x*)))
(if (null? x*^)
`(kernel (vec ,r ,t) (,e* ...) ,fv ,stmt)
`(let ((,x*^ (box ,r* ,t*) (box ,r* ,t* (var ,t* ,x*))) ...)
(kernel (vec ,r ,t) (,e* ...)
(free-vars (,x^ ,t^) ...
(,x*^ ,(map (lambda (t)
`(box ,r ,t))
t*)) ...)
(let ((,x* ,t* (unbox ,t* ,r* (var (box ,r* ,t*) ,x*^)))
...)
,stmt))))))
((kernel ,t (,e* ...) ,fv ,stmt)
(error 'Kernel "Unmatched kernel" (unparse-M7.0 e))))))
| false |
adb7063ef3cf77b0aa03a38d8026730f4208e8dc | defeada37d39bca09ef76f66f38683754c0a6aa0 | /mscorlib/mono/globalization/unicode/contraction-comparer.sls | 14a4c9e547d8f6accc8336ec4bffa98ad270e48e | [] | 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 | 851 | sls | contraction-comparer.sls | (library (mono globalization unicode contraction-comparer)
(export new is? contraction-comparer? compare instance)
(import (ironscheme-clr-port))
(define-syntax new
(lambda (e)
(syntax-case e ()
((_ a ...)
#'(clr-new
Mono.Globalization.Unicode.ContractionComparer
a
...)))))
(define (is? a)
(clr-is Mono.Globalization.Unicode.ContractionComparer a))
(define (contraction-comparer? a)
(clr-is Mono.Globalization.Unicode.ContractionComparer a))
(define-method-port
compare
Mono.Globalization.Unicode.ContractionComparer
Compare
(System.Int32 System.Object System.Object))
(define-field-port
instance
#f
#f
(static:)
Mono.Globalization.Unicode.ContractionComparer
Instance
Mono.Globalization.Unicode.ContractionComparer))
| true |
1ed4f08c6a03147d5eb179f64488f22a090a0b08 | 9dc73e4725583ae7af984b2e19f965bbdd023787 | /eopl-solutions/chap1/1-17.ss | 8290745e92019b2976df3a6aa01d88553f9916f7 | [] | no_license | hidaris/thinking-dumps | 2c6f7798bf51208545a08c737a588a4c0cf81923 | 05b6093c3d1239f06f3657cd3bd15bf5cd622160 | refs/heads/master | 2022-12-06T17:43:47.335583 | 2022-11-26T14:29:18 | 2022-11-26T14:29:18 | 83,424,848 | 6 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 521 | ss | 1-17.ss | #lang eopl
(require "base.ss")
;;; down : Listof(SchemeVal) -> Listof(Listof(SchemeVal))
;;; usage: (down lst) wraps parentheses around each top-level
;;; element of lst.
(define down
(lambda (lst)
(letrec
((P (lambda (l)
(cons l '()))))
(map P lst))))
(equal?? (down '(1 2 3))
'((1) (2) (3)))
(equal?? (down '((a) (fine) (idea)))
'(((a)) ((fine)) ((idea))))
(equal?? (down '(a (more (complicated)) object))
'((a) ((more (complicated))) (object)))
| false |
2d32d86861b85d8f08a74e571316aa0fe43a9041 | ec0f122fdcf4ceaf5e9e183575a460006c19ebe0 | /tests/test-date-time-utils.scm | bb334db6040fbc2a789206fc6f0d6e3de5623347 | [] | no_license | ThomasHintz/keep-the-records | d96e6253ebc3d2e11ee37277a6293c7365b25f9b | c20e648e831bed2ced3f2f74bfc590dc06b5f076 | refs/heads/master | 2021-01-13T02:37:41.053488 | 2013-07-19T04:18:44 | 2013-07-19T04:18:44 | 1,272,038 | 2 | 1 | null | null | null | null | UTF-8 | Scheme | false | false | 3,810 | scm | test-date-time-utils.scm | (use srfi-19)
(import date-time-utils)
(test-begin "date-time-utils")
(test-group "clear-date-times"
(test "12.20.3000:00:00:00"
(date->string (clear-date-time (make-date 1 1 1 1 20 12 3000))
"~m.~d.~Y:~T")))
(test-group "date-as-year"
(test "12.20.2000:01:01:01"
(date->string (date-as-year (make-date 1 1 1 1 20 12 3000) 2000)
"~m.~d.~Y:~T")))
(test-group "in-week?"
; day 9 is a sunday
(test #t (in-week? (make-date 0 0 0 0 9 1 2000)
(make-date 0 0 0 0 9 1 2000)))
(test #t (in-week? (make-date 0 0 0 0 9 1 2000)
(make-date 0 0 0 0 15 1 2000)))
(test #f (in-week? (make-date 0 0 0 0 9 1 2000)
(make-date 0 0 0 0 16 1 2000)))
; across month boundary
(test #t (in-week? (make-date 0 0 0 0 30 1 2000)
(make-date 0 0 0 0 5 2 2000)))
; across year boundary
(test #t (in-week? (make-date 0 0 0 0 30 12 1999)
(make-date 0 0 0 0 1 1 2000))))
(test-group "week-start/week-end"
(test "12/09/12" (date->string (week-start (make-date 0 0 0 0 14 12 2012)) "~D"))
(test "12/09/12" (date->string (week-start (make-date 0 0 0 0 15 12 2012)) "~D"))
(test "12/09/12" (date->string (week-start (make-date 0 0 0 0 9 12 2012)) "~D"))
; across month boundary
(test "11/25/12" (date->string (week-start (make-date 0 0 0 0 1 12 2012)) "~D"))
; across year boundary
(test "12/30/12" (date->string (week-start (make-date 0 0 0 0 1 1 2013)) "~D"))
(test "12/15/12" (date->string (week-end (make-date 0 0 0 0 14 12 2012)) "~D"))
(test "12/15/12" (date->string (week-end (make-date 0 0 0 0 15 12 2012)) "~D"))
(test "12/15/12" (date->string (week-end (make-date 0 0 0 0 9 12 2012)) "~D"))
; across month boundary
(test "12/01/12" (date->string (week-end (make-date 0 0 0 0 25 11 2012)) "~D"))
; across year boundary
(test "01/05/13" (date->string (week-end (make-date 0 0 0 0 30 12 2012)) "~D")))
(test-group "date-year+"
(test "01/01/13" (date->string (date-year+ (make-date 0 0 0 0 1 1 2012) 1) "~D")))
(test-group "date-between?"
(test #t (day/month-between? (make-date 0 0 0 0 10 1 2012) ; 01/10/2012
(make-date 0 0 0 0 05 1 2012) ; 01/05/2012
(make-date 0 0 0 0 12 1 2012))) ; 01/12/2012
(test #t (day/month-between? (make-date 0 0 0 0 10 1 2012) ; 01/10/2012
(make-date 0 0 0 0 05 1 2012) ; 01/05 2012
(make-date 0 0 0 0 12 2 2012))) ; 01/12/2012
(test #t (day/month-between? (make-date 0 0 0 0 10 1 2012) ; 01/10/2012
(make-date 0 0 0 0 05 1 2011) ; 01/05/2011
(make-date 0 0 0 0 12 2 2013))) ; 02/12/2013
(test #f (day/month-between? (make-date 0 0 0 0 10 1 2012) ; 01/10/2012
(make-date 0 0 0 0 15 1 2012) ; 01/15/2012
(make-date 0 0 0 0 12 2 2012))) ; 02/12/2012
(test #f (day/month-between? (make-date 0 0 0 0 10 10 2012) ; 10/10/2012
(make-date 0 0 0 0 15 1 2012) ; 01/15/2012
(make-date 0 0 0 0 12 2 2012)))) ; 02/12/2012
(test-end "date-time-utils")
| false |
7164f493f2e6dc78483f7cda5429b6597539ba88 | 1de3d2f5aea84e4d19825c290980a3b4f7815f32 | /monarchy/prototyping/agents/procter.scm | 8ef87ebe6c5b96d4b6c641f130712e4725059463 | [] | no_license | certainty/lisp-misc | 37798607ca0275552c39683bad3080a42ba931fe | d5ee799f3ab0f2cc74bf3b2a83604dace160a649 | refs/heads/master | 2017-12-30T03:02:25.789701 | 2016-11-12T09:27:43 | 2016-11-12T09:27:43 | 69,743,925 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 2,451 | scm | procter.scm | (module procter
*
(import chicken scheme ports extras)
(use srfi-1 irregex)
(define (make-exn-condition loc msg . args)
(make-property-condition 'exn 'location loc 'message msg 'arguments args))
(define (make-procter-condition type)
(make-property-condition 'procter ' sta))
(define (make-procter-error-condition type loc msg . args)
(make-composite-condition
(apply make-exn-condition loc msg args)
(make-property-condition 'procter)
(make-property-condition type)))
(define (make-fully-qualified-reader path reader)
(let ((reader (make-reader reader)))
(lambda ()
(reader path))))
(define ((make-reader reader #!key (path-prefix "")) path)
(let ((full-path (string-append path-prefix path)))
(unless (file-exists? full-path)
(signal (make-procter-error-condition
'path-not-found
'proc-reader
"The given path does not exist" full-path)))
(call-with-input-file full-path reader)))
(define (port-map* io proc)
(with-input-from-port io (cut port-map proc read-line)))
(define ((make-table-reader #!key (horizontal-headers #f) (use-this-headers #f) (vertical-headers #f) (separator '(+ whitespace))) io)
(let* ((line-reader (make-table-line-reader separator)))
(remove
null?
(port-map* io (cond
(horizontal-headers
(with-horizontal-headers line-reader (or use-this-headers (columnize (read-line io) separator))))
(vertical-headers
(with-vertical-headers line-reader))
(else line-reader))))))
(define (make-property-table-reader #!key (separator '(seq (+ whitespace) ":" (* whitespace))))
(let ((line-reader (make-table-line-reader separator)))
(lambda (io)
(remove
null?
(port-map* io (with-property-headers line-reader))))))
(define ((make-table-line-reader separator) line)
(columnize line separator))
(define (columnize line separator)
(irregex-split separator line))
(define ((with-horizontal-headers reader headers) line)
(zip headers (reader line)))
(define ((with-vertical-headers reader) line)
(let ((line (reader line)))
(if (null? line)
line
(cons (car line) (list (cdr line))))))
(define ((with-property-headers reader) line)
(let ((line (reader line)))
(if (null? line)
line
(cons (car line) (if (null? (cdr line)) #f (cdr line))))))
)
| false |
2ce501aed17a3993e383fa334458fa6060e39612 | 665da87f9fefd8678b0635e31df3f3ff28a1d48c | /tests/debug/cps-analysis/find-named-lets.scm | 8eab6325293e142caa9835a89165fa4d09a12e9f | [
"MIT"
] | permissive | justinethier/cyclone | eeb782c20a38f916138ac9a988dc53817eb56e79 | cc24c6be6d2b7cc16d5e0ee91f0823d7a90a3273 | refs/heads/master | 2023-08-30T15:30:09.209833 | 2023-08-22T02:11:59 | 2023-08-22T02:11:59 | 31,150,535 | 862 | 64 | MIT | 2023-03-04T15:15:37 | 2015-02-22T03:08:21 | Scheme | UTF-8 | Scheme | false | false | 12,483 | scm | find-named-lets.scm | (import
(scheme base)
(scheme cyclone ast)
(scheme cyclone util)
(scheme cyclone pretty-print)
(scheme write)
(srfi 2)
)
;; TODO:
;; - identify refs within named lets
;; and also, whether refs are defined (or not) in loop
;; - will probably need to hook into analysis DB in production version
;; - will this find function work for optimized CPS? should test that, too
;; - does find need to be more robust? Are there false positives?
(define (find-named-lets exp)
(define (scan exp lp)
(cond
((ast:lambda? exp)
(let* ((id (ast:lambda-id exp))
(has-cont (ast:lambda-has-cont exp))
(sym (string->symbol
(string-append
"lambda-"
(number->string id)
(if has-cont "-cont" ""))))
(args* (ast:lambda-args exp))
(args (if (null? args*)
'()
(formals->list args*)))
)
(when lp
(for-each
(lambda (a)
(write `(,a defined in a loop))
(newline))
args)
)
`(,sym ,(ast:lambda-args exp)
,@(map (lambda (e) (scan e lp)) (ast:lambda-body exp))))
)
((quote? exp) exp)
((const? exp) exp)
((ref? exp)
(when lp
(write `(found variable ,exp within a loop))
(newline))
exp)
((define? exp)
`(define ,(define->var exp)
,@(scan (define->exp exp) lp)))
((set!? exp)
`(set! ,(set!->var exp)
,(scan (set!->exp exp) lp)))
((if? exp)
`(if ,(scan (if->condition exp) lp)
,(scan (if->then exp) lp)
,(scan (if->else exp) lp)))
((app? exp)
(cond
((and-let* (
;; Find lambda with initial #f assignment
((ast:lambda? (car exp)))
((pair? (cdr exp)))
((not (cadr exp)))
(= 1 (length (ast:lambda-args (car exp))))
;; Get information for continuation
(loop-sym (car (ast:lambda-args (car exp))))
(inner-exp (car (ast:lambda-body (car exp))))
((app? inner-exp))
((ast:lambda? (car inner-exp)))
;; Find the set (assumes CPS conversion)
((pair? (cdr inner-exp)))
((set!? (cadr inner-exp)))
((equal? (set!->var (cadr inner-exp)) loop-sym))
;; Check the set's continuation
((app? (car (ast:lambda-body (car inner-exp)))))
((equal? (caar (ast:lambda-body (car inner-exp))) loop-sym))
)
(write `(found named lambda loop ,loop-sym))
;; Continue scanning
(map (lambda (e) (scan e #t)) exp)
))
(else
(map (lambda (e) (scan e lp)) exp))))
(else exp)))
(scan exp #f))
;; Test code follows:
(define sexp
'(define count
(lambda
(k$296 r$5$163
i$4$162
step$3$161
x$2$160
y$1$159)
((lambda
(loop$14$171)
((lambda
(r$299)
(loop$14$171
k$296
(Cyc-fast-plus
r$5$163
(Cyc-fast-mul
(inexact__inline__ x$2$160)
step$3$161))
(Cyc-fast-plus
i$4$162
(Cyc-fast-mul
(inexact__inline__ y$1$159)
step$3$161))
0))
(set! loop$14$171
(lambda
(k$301 zr$17$174 zi$16$173 c$15$172)
(if (Cyc-fast-eq c$15$172 64)
(k$301 c$15$172)
(if (Cyc-fast-gt
(Cyc-fast-plus
(Cyc-fast-mul zr$17$174 zr$17$174)
(Cyc-fast-mul zi$16$173 zi$16$173))
16.0)
(k$301 c$15$172)
(loop$14$171
k$301
(Cyc-fast-plus
(Cyc-fast-sub
(Cyc-fast-mul zr$17$174 zr$17$174)
(Cyc-fast-mul zi$16$173 zi$16$173))
(Cyc-fast-plus
r$5$163
(Cyc-fast-mul
(inexact__inline__ x$2$160)
step$3$161)))
(Cyc-fast-plus
(Cyc-fast-mul
2.0
(Cyc-fast-mul zr$17$174 zi$16$173))
(Cyc-fast-plus
i$4$162
(Cyc-fast-mul
(inexact__inline__ y$1$159)
step$3$161)))
(Cyc-fast-plus c$15$172 1))))))))
#f))))
(define sexp-after-cps-no-opts
'((define count
(lambda-165-cont
(k$296 r$5$163
i$4$162
step$3$161
x$2$160
y$1$159)
((lambda-164
(max-count$7$165 radius^2$6$164)
((lambda-163
(r$316)
((lambda-162
(r$315)
((lambda-161
(r$297)
((lambda-160
(r$314)
((lambda-159
(r$313)
((lambda-158
(r$298)
((lambda-157
(cr$9$167 ci$8$166)
((lambda-156
(zr$13$170 zi$12$169 c$11$168)
((lambda-155
(loop$14$171)
((lambda-140
(r$300)
((lambda-139
(r$299)
(loop$14$171
k$296
zr$13$170
zi$12$169
c$11$168))
(set! loop$14$171 r$300)))
(lambda-154-cont
(k$301 zr$17$174 zi$16$173 c$15$172)
((lambda-153
(r$302)
(if r$302
(k$301 c$15$172)
((lambda-152
(r$303)
((lambda-151
(r$304)
((lambda-150
(zr^2$19$176 zi^2$18$175)
((lambda-149
(r$312)
((lambda-148
(r$305)
(if r$305
(k$301 c$15$172)
((lambda-147
(r$311)
((lambda-146
(r$306)
((lambda-145
(r$310)
((lambda-144
(r$309)
((lambda-143
(r$307)
((lambda-142
(new-zr$21$178
new-zi$20$177)
((lambda-141
(r$308)
(loop$14$171
k$301
new-zr$21$178
new-zi$20$177
r$308))
(Cyc-fast-plus
c$15$172
1)))
r$306
r$307))
(Cyc-fast-plus
r$309
ci$8$166)))
(Cyc-fast-mul
2.0
r$310)))
(Cyc-fast-mul
zr$17$174
zi$16$173)))
(Cyc-fast-plus
r$311
cr$9$167)))
(Cyc-fast-sub
zr^2$19$176
zi^2$18$175))))
(Cyc-fast-gt
r$312
radius^2$6$164)))
(Cyc-fast-plus
zr^2$19$176
zi^2$18$175)))
r$303
r$304))
(Cyc-fast-mul
zi$16$173
zi$16$173)))
(Cyc-fast-mul
zr$17$174
zr$17$174))))
(Cyc-fast-eq
c$15$172
max-count$7$165)))))
#f))
cr$9$167
ci$8$166
0))
r$297
r$298))
(Cyc-fast-plus i$4$162 r$313)))
(Cyc-fast-mul r$314 step$3$161)))
(inexact__inline__ y$1$159)))
(Cyc-fast-plus r$5$163 r$315)))
(Cyc-fast-mul r$316 step$3$161)))
(inexact__inline__ x$2$160)))
64
16.0)))))
(find-named-lets
(ast:sexp->ast
sexp-after-cps-no-opts))
;;sexp))
| false |
c2a380567a6d621ddfdae1742c75e1fc75856c38 | 23122d4bae8acdc0c719aa678c47cd346335c02a | /2020/9.scm | 9634fab1566727795a75f634023573130585c811 | [] | no_license | Arctice/advent-of-code | 9076ea5d2e455d873da68726b047b64ffe11c34c | 2a2721e081204d4fd622c2e6d8bf1778dcedab3e | refs/heads/master | 2023-05-24T23:18:02.363340 | 2023-05-04T09:04:01 | 2023-05-04T09:06:24 | 225,228,308 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 1,012 | scm | 9.scm | #!/usr/bin/env -S scheme --libdirs "../scheme/" --script
(import (chezscheme) (core))
(define xmas (list->vector (map string->number (readlines "9.input"))))
(define (invalid? i)
(let ([n (vector-ref xmas i)])
(let xloop ([x (- i 25)])
(let ([yv (- n (vector-ref xmas x))])
(cond
[(= x i) n]
[(< yv 1) (xloop (inc x))]
[else
(let yloop ([y (inc x)])
(cond
[(= y i) (xloop (inc x))]
[(= yv (vector-ref xmas y)) #f]
[else (yloop (inc y))]))])))))
(define invalid (exists invalid? (list-tail (iota (vector-length xmas)) 25)))
(define secret
(let loop ([a 0] [b 0] [check 0])
(cond [(> check invalid) (loop (inc a) b (- check (vector-ref xmas a)))]
[(< check invalid) (loop a (inc b) (+ check (vector-ref xmas b)))]
[else (let ([seq (list-slice (vector->list xmas) a b)])
(+ (apply min seq) (apply max seq)))])))
(pretty-print invalid)
(pretty-print secret)
| false |
8e2b4e5a3b519c28e420c6d9cbcf9f3704f60407 | 557c51d080c302a65e6ef37beae7d9b2262d7f53 | /workspace/comp-tester/tests/my-out.ss | a936ddbc287e422c977df2e182fff1c9dd6b19c2 | [] | 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 | 674 | ss | my-out.ss | ; my optimize-source output for original introduce-procedure-primitives out
(letrec ([vector-scale!$0 (lambda (vect.1 scale.2)
(let ([size.3 (vector-length vect.1)])
(vector-scale!$12 size.3 vect.1 scale.2)))]
[vector-sum$13 (lambda (vect.7)
(vector-sum$14 (vector-length vect.7) vect.7))])
(let ([vect.11 (make-vector '5)])
(begin
(vector-set! vect.11 '0 '123)
(vector-set! vect.11 '1 '10)
(vector-set! vect.11 '2 '7)
(vector-set! vect.11 '3 '12)
(vector-set! vect.11 '4 '57)
(vector-scale!$0 vect.11 '10)
(vector-sum$13 vect.11)))) | false |
afeac508212bcd4b097f32f2f31f9e3616c2b2f4 | defeada37d39bca09ef76f66f38683754c0a6aa0 | /System.Xml/system/xml/xml-writer-settings.sls | 61e43c1712f0e60d694ae28c4140f4648a10227c | [] | 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 | 3,642 | sls | xml-writer-settings.sls | (library (system xml xml-writer-settings)
(export new
is?
xml-writer-settings?
reset
clone
check-characters?-get
check-characters?-set!
check-characters?-update!
close-output?-get
close-output?-set!
close-output?-update!
conformance-level-get
conformance-level-set!
conformance-level-update!
encoding-get
encoding-set!
encoding-update!
indent?-get
indent?-set!
indent?-update!
indent-chars-get
indent-chars-set!
indent-chars-update!
new-line-chars-get
new-line-chars-set!
new-line-chars-update!
new-line-on-attributes?-get
new-line-on-attributes?-set!
new-line-on-attributes?-update!
new-line-handling-get
new-line-handling-set!
new-line-handling-update!
omit-xml-declaration?-get
omit-xml-declaration?-set!
omit-xml-declaration?-update!
output-method)
(import (ironscheme-clr-port))
(define-syntax new
(lambda (e)
(syntax-case e ()
((_ a ...) #'(clr-new System.Xml.XmlWriterSettings a ...)))))
(define (is? a) (clr-is System.Xml.XmlWriterSettings a))
(define (xml-writer-settings? a)
(clr-is System.Xml.XmlWriterSettings a))
(define-method-port
reset
System.Xml.XmlWriterSettings
Reset
(System.Void))
(define-method-port
clone
System.Xml.XmlWriterSettings
Clone
(System.Xml.XmlWriterSettings))
(define-field-port
check-characters?-get
check-characters?-set!
check-characters?-update!
(property:)
System.Xml.XmlWriterSettings
CheckCharacters
System.Boolean)
(define-field-port
close-output?-get
close-output?-set!
close-output?-update!
(property:)
System.Xml.XmlWriterSettings
CloseOutput
System.Boolean)
(define-field-port
conformance-level-get
conformance-level-set!
conformance-level-update!
(property:)
System.Xml.XmlWriterSettings
ConformanceLevel
System.Xml.ConformanceLevel)
(define-field-port
encoding-get
encoding-set!
encoding-update!
(property:)
System.Xml.XmlWriterSettings
Encoding
System.Text.Encoding)
(define-field-port
indent?-get
indent?-set!
indent?-update!
(property:)
System.Xml.XmlWriterSettings
Indent
System.Boolean)
(define-field-port
indent-chars-get
indent-chars-set!
indent-chars-update!
(property:)
System.Xml.XmlWriterSettings
IndentChars
System.String)
(define-field-port
new-line-chars-get
new-line-chars-set!
new-line-chars-update!
(property:)
System.Xml.XmlWriterSettings
NewLineChars
System.String)
(define-field-port
new-line-on-attributes?-get
new-line-on-attributes?-set!
new-line-on-attributes?-update!
(property:)
System.Xml.XmlWriterSettings
NewLineOnAttributes
System.Boolean)
(define-field-port
new-line-handling-get
new-line-handling-set!
new-line-handling-update!
(property:)
System.Xml.XmlWriterSettings
NewLineHandling
System.Xml.NewLineHandling)
(define-field-port
omit-xml-declaration?-get
omit-xml-declaration?-set!
omit-xml-declaration?-update!
(property:)
System.Xml.XmlWriterSettings
OmitXmlDeclaration
System.Boolean)
(define-field-port
output-method
#f
#f
(property:)
System.Xml.XmlWriterSettings
OutputMethod
System.Xml.XmlOutputMethod))
| true |
7a369bd45a8160cd9364fab974bf3bad958537ed | 2f88dd127122c2444597a65d8b7a23926aebbac1 | /st-dictionary-tests.scm | 70a78624aadee3d7983092dacfb572547d6db952 | [
"BSD-2-Clause"
] | permissive | KenDickey/Crosstalk | 6f980b7188c1cc6bd176a8e0cd10b032f768b4e6 | b449fb7c711ad287f9b49e7167d8cedd514f5d81 | refs/heads/master | 2023-05-26T10:07:12.674162 | 2023-05-21T22:59:26 | 2023-05-21T22:59:26 | 58,777,987 | 11 | 1 | null | null | null | null | UTF-8 | Scheme | false | false | 1,445 | scm | st-dictionary-tests.scm | ;;; IMPLEMENTS: Unit tests for st-dictionary.scm
;;; AUTHOR: Ken Dickey
;;; DATE: 16 January 2017
;; (require 'st-dictionary)
(define %%dict%% #f)
(define (setup-st-dictionary)
(set! %%dict%% ($ Dictionary 'new))
($:: %%dict%% 'at:put: 'a 1)
($:: %%dict%% 'at:put: 'b 2)
($:: %%dict%% 'at:put: 'c 3)
)
(define (cleanup-st-dictionary)
(set! %%dict%% #f)
)
(add-test-suite 'st-dictionary
setup-st-dictionary
cleanup-st-dictionary)
(add-equal-test 'st-dictionary
3
($ %%dict%% 'size)
"size")
(add-equal-test 'st-dictionary
2
($: %%dict%% 'at: 'b)
"at:")
(add-equal-test 'st-dictionary
'(c b a)
(let ( (keys '()) )
($: %%dict%%
'keysDo:
(lambda (k)
(set! keys (cons k keys))))
keys)
"keysDo:")
(add-equal-test 'st-dictionary
6
(let ( (total 0) )
($: %%dict%%
'valuesDo:
(lambda (v)
(set! total (+ total v))))
total)
"valuesDo:")
(add-equal-test 'st-dictionary
(vector '(c b a) 6)
(let ( (keys '()) (total 0) )
($: %%dict%%
'keysAndValuesDo:
(lambda (k v)
(set! keys (cons k keys))
(set! total (+ total v))))
(vector keys total))
"keysAndValuesDo:")
;; (ensure-exception-raised 'st-dictionary
;; (make-error-string-predicate "Failed message send: #glerph to ")
;; (perform: %%test-object 'glerph)
;; "obj glerph -> doesNotUnderstand")
;;; --- E O F --- ;;;
| false |
a26a1b4b56e9a3156364ae7e70cd277175b902cd | d074b9a2169d667227f0642c76d332c6d517f1ba | /sicp/ch_1/exercise.1.37.scm | c1e18ef49bf49d3c11f91f53231a19f26d79592d | [] | no_license | zenspider/schemers | 4d0390553dda5f46bd486d146ad5eac0ba74cbb4 | 2939ca553ac79013a4c3aaaec812c1bad3933b16 | refs/heads/master | 2020-12-02T18:27:37.261206 | 2019-07-14T15:27:42 | 2019-07-14T15:27:42 | 26,163,837 | 7 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 2,945 | scm | exercise.1.37.scm | #lang racket/base
;;; Exercise 1.37:
;; a. An infinite "continued fraction" is an expression of the form
;;
;; N[1]
;; f = ---------------------
;; N[2]
;; D[1] + ---------------
;; N[3]
;; D[2] + ---------
;; D[3] + ...
;;
;; As an example, one can show that the infinite continued
;; fraction expansion with the n[i] and the D[i] all equal to 1
;; produces 1/[phi], where [phi] is the golden ratio (described
;; in section *Note 1-2-2::). One way to approximate an
;; infinite continued fraction is to truncate the expansion
;; after a given number of terms. Such a truncation--a
;; so-called finite continued fraction "k-term finite continued
;; fraction"--has the form
;;
;; N[1]
;; -----------------
;; N[2]
;; D[1] + -----------
;; ... N[K]
;; + -----
;; D[K]
;;
;; Suppose that `n' and `d' are procedures of one argument (the
;; term index i) that return the n[i] and D[i] of the terms of the
;; continued fraction. Define a procedure `cont-frac' such that
;; evaluating `(cont-frac n d k)' computes the value of the
;; k-term finite continued fraction. Check your procedure by
;; approximating 1/[phi] using
;;
;; (cont-frac (lambda (i) 1.0)
;; (lambda (i) 1.0)
;; k)
;;
;; for successive values of `k'. How large must you make `k' in
;; order to get an approximation that is accurate to 4 decimal
;; places?
(define (cont-frac n d i)
(if (< i 1) 0
(/ (n i)
(+ (d i) (cont-frac n d (- i 1))))))
(define (phi-approx k)
(/ 1 (cont-frac (lambda (i) 1.0) (lambda (i) 1.0) k)))
(define (cont-frac-test places)
(let ((error (expt 10 (- (+ places 1))))
(phi (/ (+ 1 (sqrt 5)) 2)))
(define (iterate n)
(if (< (abs (- phi (phi-approx n))) error)
n
(iterate (+ n 1))))
(iterate 1)))
(cont-frac-test 4) ; 13
(phi-approx 13) ; 1.6180257510729614
(/ (+ 1 (sqrt 5)) 2) ; 1.618033988749895
;; b. If your `cont-frac' procedure generates a recursive process,
;; write one that generates an iterative process. If it
;; generates an iterative process, write one that generates a
;; recursive process.
;; seriously? are MIT students this bad at this?
(define (cont-frac-i n d i)
(define (iterate i fraction)
(if (< i 1) fraction
(iterate (- i 1)
(/ (n i)
(+ (d i) fraction)))))
(iterate i 0))
(define (phi-approx-i k)
(/ 1 (cont-frac-i (lambda (i) 1.0) (lambda (i) 1.0) k)))
(phi-approx-i 13) ; 1.6180257510729614
| false |
201934bf2164e568f446833d3f7e1a88b782c102 | b6511594e926aab17fce152db02a8108b6a9eb53 | /macro.scm | 5a97311a5f53a647218ff81ded72de4d7cbf9ac1 | [] | no_license | sebhtml/scheme-exemples | 5e6e36c7f678ba626652526ada55d9aa0dc4a363 | ba2365e7d32f1b66b8931dbacdbcf94cf95ab9fd | refs/heads/master | 2016-09-06T03:25:30.279204 | 2011-10-20T15:00:34 | 2011-10-20T15:00:34 | 2,613,841 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 123 | scm | macro.scm | (define-syntax mon-operation
(syntax-rules ()
((mon-operation argument1 ...)(+ argument1 ...))))
(mon-operation 1 2 3 4) | true |
f35db8d911425023af851b1be772b91915a10411 | 7460741268185d205c34604a6f792b80ea0e2fa6 | /chez/monadic/effekt.ss | 7ac300463530b06f32294b6023b2c86dffcd4823 | [
"MIT",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | long-long-float/effekt | 359ae7cac3769be9cf7d1433e404eced2627335d | d471192ba6e02d269d8e8126d56125663e1ea523 | refs/heads/master | 2023-01-21T14:08:18.375961 | 2020-11-17T15:21:55 | 2020-11-17T15:21:55 | 294,625,877 | 0 | 0 | MIT | 2020-10-14T10:40:55 | 2020-09-11T07:31:43 | null | UTF-8 | Scheme | false | false | 3,017 | ss | effekt.ss | (define-syntax delayed
(syntax-rules ()
[(_ e)
(lambda (mk) (underflow e mk))]))
; Control = MetaCont -> Step
; a -> Control a
(define (pure v)
(lambda (mk) (underflow v mk)))
; Step a = (a | Control x), MetaCont x a
; (a | Control a), MetaCont -> a
(define (trampoline c mk)
(if (null? mk) c
(call-with-values
(lambda () (c mk))
trampoline)))
; a, MetaCont -> Step
(define (underflow v mk)
(if (null? mk) (values v mk)
(let* ([stack (car mk)]
[rest (cdr mk)]
[frames (Stack-frames stack)]
[fields (Stack-fields stack)]
[prompt (Stack-prompt stack)])
(if (null? frames) (underflow v rest)
(values ((car frames) v) (cons (make-Stack (cdr frames) fields prompt) rest))))))
; Control, Prompt -> Control
(define (reset p c)
(lambda (mk)
(c (cons (make-Stack '() '() p) mk))))
; Prompt, Body -> Control
(define (shift p f)
(lambda (mk)
(let-values ([(k mkrest) (splitSeq p mk)])
(let ([cont (lambda (a) (lambda (mk) (underflow a (appendSeq k mk))))])
(values (f cont) mkrest)))))
; Frame, MetaCont -> MetaCont
(define (push-frame f mk)
(if (null? mk) (error 'push-frame "Cannot push frame, meta cont ~s is empty" mk)
(let ([stack (car mk)]
[rest (cdr mk)])
(let ([frames (Stack-frames stack)]
[fields (Stack-fields stack)]
[prompt (Stack-prompt stack)])
(cons (make-Stack (cons f frames) fields prompt) rest)))))
; Cell Control -> Control
(define (with-state cell body)
(lambda (mk)
(if (null? mk) (error 'push-frame "Cannot store state, meta cont ~s is empty" mk)
(let ([stack (car mk)]
[rest (cdr mk)])
(let ([frames (Stack-frames stack)]
[fields (Stack-fields stack)]
[prompt (Stack-prompt stack)])
(body (cons (make-Stack frames (cons cell fields) prompt) rest)))))))
(define-syntax then
(syntax-rules ()
[(_ m a f1 ...)
(lambda (k) (values m (push-frame (lambda (a) (let () f1 ...)) k)))]))
(define toplevel 0)
; Control a -> a
(define (run c)
(trampoline c (cons (make-Stack '() '() toplevel) '())))
(define (while cond exp)
(then cond c
(if c (then exp _ (while cond exp)) (pure #f))))
(define newPrompt (lambda () (string #\p)))
(define-syntax handle
(syntax-rules ()
[(_ ((cap1 (op1 (arg1 ...) kid exp) ...) ...) body)
(let ([p (newPrompt)])
(reset p (body
(cap1 (define-effect-op p (arg1 ...) kid exp) ...)
...)))]))
(define-syntax state
(syntax-rules ()
[(_ effid getid setid init body)
(then init s
(define cell (box s))
(define (getid c) (lambda () (pure (unbox c))))
(define (setid c) (lambda (s*)
(set-box! c s*)
(pure #f)))
(with-state cell (body cell)))]))
(define-syntax define-effect-op
(syntax-rules ()
[(_ p (arg1 ...) kid exp ...)
(lambda (arg1 ...)
(shift p (lambda (kid) exp ...)))]))
| true |
0af08d144c6d2ccbd4fc12e8d6bd77462488d431 | 958488bc7f3c2044206e0358e56d7690b6ae696c | /scheme/guile/arbiter.scm | ffa24ff43a890cceac03d8bd0d711f10581a49e6 | [] | no_license | possientis/Prog | a08eec1c1b121c2fd6c70a8ae89e2fbef952adb4 | d4b3debc37610a88e0dac3ac5914903604fd1d1f | refs/heads/master | 2023-08-17T09:15:17.723600 | 2023-08-11T12:32:59 | 2023-08-11T12:32:59 | 40,361,602 | 3 | 0 | null | 2023-03-27T05:53:58 | 2015-08-07T13:24:19 | Coq | UTF-8 | Scheme | false | false | 1,069 | scm | arbiter.scm | (define arb (make-arbiter "arb1"))
(newline)
(display "first attempt at locking the arbiter:\n")
(define t1 (try-arbiter arb))
(if t1
(display "arbiter was unlocked and has now been locked.\n")
(display "arbiter was already locked.\n"))
(newline)
(display "second attempt at locking the arbiter:\n")
(define t2 (try-arbiter arb))
(if t2
(display "arbiter was unlocked and has now been locked.\n")
(display "arbiter was already locked.\n"))
(newline)
(display "first attempt at releasing the arbiter:\n")
(define t3 (release-arbiter arb))
(if t3
(display "arbiter was locked and has now been released\n")
(display "arbiter was already unlocked.\n"))
(newline)
(display "second attempt at releasing the arbiter:\n")
(define t4 (release-arbiter arb))
(if t4
(display "arbiter was locked and has now been released\n")
(display "arbiter was already unlocked.\n"))
(define pid (fork))
(if (eq? 0 pid) ; child process
(display "child is running\n")
(if (> pid 0)
(display "parent process is running\n")
(display "fork error\n")))
(exit 0)
| false |
b8bbdf113587aca346941f0b67d9aaffb0b47f54 | f0ae79eb90521de28ce7ef315ec5963adf2735a8 | /HW/project4/setup.scm | ce5dd82024b1314294c540faae4d7695dbf83836 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | Kausta/Comp200LN | 924b7d07cb4eb6f3437539cc43d09f556ec841b1 | 73b897501827bdb742f827dd8971b123cf9e12ec | refs/heads/master | 2022-03-11T09:45:04.119960 | 2019-11-28T14:11:45 | 2019-11-28T14:11:45 | 104,032,547 | 1 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 9,185 | scm | setup.scm |
;;------------------------------------------------------------
;; Utils to connect places by way of exits
(define (can-go-both-ways from direction reverse-direction to)
(create-exit from direction to)
(create-exit to reverse-direction from))
;;------------------------------------------------------------
;; Create our world...
(define (create-world)
; Create some places
(let ((eng-building (create-place 'eng-building))
(sci-building (create-place 'sci-building))
(sos-building (create-place 'sos-building))
(cas-building (create-place 'cas-building))
(great-court (create-place 'great-court))
(graduation-stage (create-place 'graduation-stage))
(adm-building (create-place 'adm-building))
(student-center (create-place 'student-center))
(library (create-place 'library))
(gym (create-place 'gym))
(dorms (create-place 'dorms))
(cici-bufe (create-place 'cici-bufe))
(suzy-cafe (create-place 'suzy-cafe))
(bookstore (create-place 'bookstore))
(computer-club (create-place 'computer-club))
(divan (create-place 'divan))
(migros (create-place 'migros))
(soccer-field (create-place 'soccer-field))
(amphitheater (create-place 'amphitheater))
(registrar-office (create-place 'registrar-office))
(bursar-office (create-place 'bursar-office))
(parking-lot (create-place 'parking-lot))
(eng-z21 (create-place 'eng-z21))
(eng-b30 (create-place 'eng-b30))
(eng-auditorium (create-place 'eng-auditorium))
(deans-office (create-place 'deans-office)))
; Connect up places
(can-go-both-ways eng-building 'north 'south soccer-field)
(can-go-both-ways eng-building 'west 'east parking-lot)
(can-go-both-ways eng-building 'in 'out eng-z21)
(can-go-both-ways eng-z21 'south 'north eng-auditorium)
(can-go-both-ways eng-z21 'down 'up eng-b30)
(can-go-both-ways eng-z21 'up 'down deans-office)
(can-go-both-ways eng-building 'south 'north sci-building)
(can-go-both-ways sci-building 'south 'north sos-building)
(can-go-both-ways sos-building 'south 'north cas-building)
(can-go-both-ways sos-building 'east 'west amphitheater)
(can-go-both-ways cas-building 'south 'north great-court)
(can-go-both-ways great-court 'south 'north adm-building)
(can-go-both-ways great-court 'west 'east library)
(can-go-both-ways great-court 'east 'west student-center)
(can-go-both-ways great-court 'up 'down graduation-stage)
(can-go-both-ways library 'west 'east gym)
(can-go-both-ways adm-building 'south 'north dorms)
(can-go-both-ways adm-building 'in 'out registrar-office)
(can-go-both-ways registrar-office 'west 'east bursar-office)
(can-go-both-ways student-center 'in 'out suzy-cafe)
(can-go-both-ways suzy-cafe 'east 'west bookstore)
(can-go-both-ways suzy-cafe 'down 'up cici-bufe)
(can-go-both-ways cici-bufe 'west 'east computer-club)
(can-go-both-ways cici-bufe 'north 'south migros)
(can-go-both-ways cici-bufe 'down 'up divan)
; Create some things
(create-thing 'white-board eng-b30)
(create-thing 'fancy-cars parking-lot)
(create-thing 'flag-pole great-court)
(create-mobile-thing 'tons-of-code dorms)
(create-mobile-thing 'lecture-notes eng-b30)
(create-mobile-thing 'problem-set eng-z21)
(create-mobile-thing 'final-exam eng-auditorium)
(create-mobile-thing 'sicp bookstore)
(create-mobile-thing 'engineering-book library)
(create-mobile-thing 'diploma registrar-office)
(create-mobile-thing 'football soccer-field)
(create-mobile-thing 'basketball gym)
(create-mobile-thing 'scheme-manual computer-club)
(create-mobile-thing 'transcript deans-office)
(create-mobile-thing 'milk migros)
(create-mobile-thing 'kofte cici-bufe)
(create-mobile-thing 'coke suzy-cafe)
(create-mobile-thing 'profiterol divan)
(create-mobile-thing 'umbrella amphitheater)
(list eng-building sci-building sos-building cas-building
great-court graduation-stage adm-building student-center
library gym dorms cici-bufe suzy-cafe bookstore
computer-club divan migros soccer-field amphitheater
registrar-office bursar-office parking-lot eng-z21 eng-b30
eng-auditorium deans-office)
))
(define (populate-weapons rooms)
(create-weapon 'chair-of-the-faculty (pick-random rooms) 5)
(create-weapon 'student-riot (pick-random rooms) 4)
(create-weapon 'sicp-book (pick-random rooms) 2)
(create-weapon 'inflatable-lambda (pick-random rooms) 3)
(create-weapon 'comp200-midterm (pick-random rooms) 3)
(create-weapon 'stick-of-chalk (pick-random rooms) 1)
; my weapons
(create-weapon 'plain-old-spoon (pick-random rooms) 1)
(create-weapon 'excalibur (pick-random rooms) 10)
(create-weapon 'broken-pistol (pick-random rooms) 2)
'populated-weapons)
(define (populate-players rooms)
(create-autonomous-player 'ben-bitdiddle (pick-random rooms)
2 2)
(create-autonomous-player 'alyssa-p-hacker (pick-random rooms)
2 2)
; Changed prof-yuret to a violent player, so that he can attack the students
(create-violent-player 'prof-yuret (pick-random rooms)
1 2 4)
(create-autonomous-player 'comp200-student (pick-random rooms)
2 1)
(create-autonomous-player 'lambda-man (pick-random rooms)
3 3)
(create-troll 'suzy (car (myfilter (lambda (x) (eq? (ask x 'name) 'suzy-cafe))
rooms))
3 1)
(create-troll 'cici (car (myfilter (lambda (x) (eq? (ask x 'name) 'cici-bufe))
rooms))
3 1)
; Added violent players
(define akame (create-violent-player 'akame (pick-random rooms) 4 4 2)) ; Akame is fast and attacks very frequently, to test
; Give Akame her blade, and make her start with it, so testing is easier
; try to make akame take it silently
(define murasame (create-weapon 'murasame (ask akame 'LOCATION) 5))
; This is add-thing because we want to make it silent (and (ask screen 'DEITY-MODE #f) doesn't work here), and also
; we know that she doesn't have, it is in the same room, it is mobile, etc... (but mainly bec of above)
(ask akame 'ADD-THING murasame)
; Magicians
(define raistlin (create-autonomous-magician 'raistlin (pick-random rooms) 2 100 10))
(define lighting-skill (make-skill 'lighting 50 (lambda (user target) (ask target 'SUFFER 10))))
(ask raistlin 'learn-skill lighting-skill)
(define duygu (create-autonomous-magician 'duygu (pick-random rooms) 3 40 20))
(define eat-person-skill (make-skill 'eat-person 20 (lambda (user target) (ask user 'SUFFER 1) (ask target 'SUFFER 2))))
(ask duygu 'learn-skill eat-person-skill)
(define useless-skill (make-skill 'useless 5 (lambda (user target)
(ask user 'SAY (list "I am useless."))
(ask target 'SAY (list "Yes, you are")))))
(ask duygu 'learn-skill useless-skill)
'populated-players)
(define (populate-bombs rooms)
(create-bomb 'C4 (pick-random rooms) 2)
(create-bomb 'STEAKY (pick-random rooms) 5)
(create-bomb 'ALIVE-BOMB (pick-random rooms) 10)
(create-bomb 'HOME-MADE (pick-random rooms) 4)
(create-bomb 'HAND-BOMB (pick-random rooms) 7)
(create-bomb-with-timer 'tBomb1 (pick-random rooms) 10)
(create-bomb-with-timer 'tBomb2 (pick-random rooms) 5)
(create-bomb-with-timer 'tBomb3 (pick-random rooms) 7)
(create-bomb-with-timer 'tBomb4 (pick-random rooms) 100)
(create-bomb-with-timer 'tBomb5 (pick-random rooms) 8)
(create-bomb-with-timer 'tBomb6 (pick-random rooms) 20)
'populated-bombs)
(define heaven 'will-be-set-by-setup)
(define me 'will-be-set-by-setup)
(define all-rooms 'will-be-set-by-setup)
(define death-exit 'will-be-set-by-setup)
(define (setup name)
(ask clock 'RESET)
(ask clock 'ADD-CALLBACK
(make-clock-callback 'tick-printer clock 'PRINT-TICK))
(let ((rooms (create-world)))
; UNCOMMENT AFTER YOU CREATE CODE FOR WEAPONS
(populate-weapons rooms)
(populate-players rooms)
(populate-bombs rooms)
;; The initial point of no return
(set! heaven (create-place 'heaven))
(set! me (create-magician-avatar name (pick-random rooms) 50 10))
(ask screen 'SET-ME me)
(set! all-rooms rooms)
(set! death-exit (make-exit nil 'heaven heaven))
'ready))
;; Some useful example expressions...
;(setup 'ben-bitdiddle)
;(run-clock 5)
;(ask screen 'DEITY-MODE #f)
;(ask me 'look-around)
;(ask me 'go 'up)
;(ask me 'go 'north)
;(ask me 'take (thing-named 'problem-set))
| false |
8c6fe06d46a11cdcbc7f2d5dc40197971c941b5d | 7f3f185931818a0be4e256040704e2830d253b18 | /pip-tui/tui-menubar.scm | 41825610eb9d2b0f17dbf706dc75000afcbc865e | [] | no_license | spk121/pip-tui | f405f240a5091ecab2f01ef145a1b3f5d38b65e3 | 7fafdadf80f5dcf867639af9fefa87fe1443fd78 | refs/heads/master | 2021-01-20T18:28:35.615714 | 2016-07-29T15:43:49 | 2016-07-29T15:43:49 | 60,352,270 | 7 | 1 | null | null | null | null | UTF-8 | Scheme | false | false | 14,659 | scm | tui-menubar.scm | (define-module (pip-tui tui-menubar)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-9)
#:use-module (ncurses curses)
#:use-module (ncurses panel)
#:use-module (pip-tui string-lib)
#:use-module (pip-tui event)
#:use-module (pip-tui action)
#:use-module (pip-tui action-map)
#:use-module (pip-tui tui-action)
#:use-module (pip-tui data-lib)
#:use-module (pip-tui border)
#:use-module (pip-tui coords)
#:use-module (pip-tui pip-colors)
#:use-module (pip-tui pip-color-names)
#:use-module (pip-tui render-lib)
#:export (tui-menubar-new
tui-menubar-hide
tui-menubar-show
tui-menubar-resize
%tui-menubar-get-panel
tui-menubar-action-handler
))
;;(define *debug-port* (open-file "tui_menubar_debug.out" "w0"))
;;; tui-menubar
;;; A tui-menubar is a subclass of a panel that has methods to print a
;;; single line menu of keys and labels
;;; A tui-menubar is an interactive widget. It accepts single
;;; keypresses.
(define-record-type <tui-menubar>
(%tui-menubar-new panel
border-type
horizontal-padding
vertical-padding
attributes
text-color
bg-color
border-color
key-label-alist
horizontal-alignment
vertical-alignment
ellipsize
line-wrap)
tui-menubar?
(panel %tui-menubar-get-panel %tui-menubar-set-panel!)
(border-type %tui-menubar-get-border-type %tui-menubar-set-border-type!)
(horizontal-padding %tui-menubar-get-horizontal-padding %tui-menubar-set-horizontal-padding!)
(vertical-padding %tui-menubar-get-vertical-padding %tui-menubar-set-vertical-padding!)
(attributes %tui-menubar-get-attributes %tui-menubar-set-attributes!)
(text-color %tui-menubar-get-text-color %tui-menubar-set-text-color!)
(bg-color %tui-menubar-get-bg-color %tui-menubar-set-bg-color!)
(border-color %tui-menubar-get-border-color %tui-menubar-set-border-color!)
(key-label-alist %tui-menubar-get-key-label-alist %tui-menubar-set-key-label-alist!)
(horizontal-alignment %tui-menubar-get-horizontal-alignment %tui-menubar-set-horizontal-alignment!)
(vertical-alignment %tui-menubar-get-vertical-alignment %tui-menubar-set-vertical-alignment!)
(ellipsize %tui-menubar-get-ellipsize %tui-menubar-set-ellipsize!)
(line-wrap %tui-menubar-get-line-wrap %tui-menubar-set-line-wrap!)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Properties
;;; window #<window>
;;; border-type 'border-none 'border-light 'border-heavy 'border-rounded 'border-double 'border-block
;;; horizontal-padding n >= 0
;;; vertical-padding n >= 0
;;; attributes an ncurses attribute like A_BOLD
;;; text-color an xterm color index
;;; bg-color
;;; border-color
;;; key-label-alist An alist where the key is an ncurses keypress and
;;; the label is a short text
;;; horizontal-alignment 'left 'center or 'right
;;; vertical-alignment 'top 'center or 'bottom
;;; ellipsize boolean
;;; line-wrap boolean
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; API
;; This is a number of columns that is wider than the widest possible
;; window.
(define BIG_WIDTH 10000)
(define* (tui-menubar-new y x width height
#:key
(border-type 'border-none)
(horizontal-padding 0)
(vertical-padding 0)
(attributes A_NORMAL)
(key-label-alist '())
(text-color COLOR_INDEX_PIPGREEN1)
(bg-color COLOR_INDEX_BLACK)
(border-color COLOR_INDEX_PIPGREEN1)
(color-pair-index 0)
(horizontal-alignment 'left)
(vertical-alignment 'top)
(ellipsize #f)
(line-wrap #t)
)
"Creates a new panel of a given size and position with the given
key/labels inside it."
(let* ((pan (newwin width height y x #:panel #t))
(TL (%tui-menubar-new pan
border-type
horizontal-padding
vertical-padding
attributes
text-color
bg-color
border-color
key-label-alist
horizontal-alignment
vertical-alignment
ellipsize
line-wrap)))
(tui-menubar-render-text! TL)
TL))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; INTERNAL FUNCTIONS
(define (compute-coords-list tui-menubar)
"Given a TUI-MENUBAR, this returns a coords struct containing the
start-y, start-x, height, and width for the window. start-y and start-x
are 0,0"
(window-relative-coords (%tui-menubar-get-panel tui-menubar)))
(define (do-background tui-menubar coords-list)
"Given a TUI-MENUBAR and a coords-list, a 4-element list containing
start-y, start-x height, and width. This paints the window with
spaces, and returns the same coords list."
(let ((attr (%tui-menubar-get-attributes tui-menubar))
(text-color (%tui-menubar-get-text-color tui-menubar))
(bg-color (%tui-menubar-get-bg-color tui-menubar))
(panel (%tui-menubar-get-panel tui-menubar)))
(render-background panel
#:coords-list coords-list
#:attr attr
#:fg-color text-color
#:bg-color bg-color)))
(define (do-border tui-menubar coords-list)
"Given a TUI-MENUBAR and COORDS-LIST, a 4-element struct containing
start-y, start-x, height, and width for the window, this draw the border,
if there is one. It returns a 4-element list (start-y, start-x, width, height)
of the window region inside the border."
(let ((panel (%tui-menubar-get-panel tui-menubar))
(attr (%tui-menubar-get-attributes tui-menubar))
(border-color (%tui-menubar-get-border-color tui-menubar))
(bg-color (%tui-menubar-get-bg-color tui-menubar))
(border-type (%tui-menubar-get-border-type tui-menubar)))
(render-border panel #:coords-list coords-list
#:attr attr
#:fg-color border-color
#:bg-color bg-color
#:border-type border-type)))
(define (do-padding tui-menubar coords-list)
"Given a TUI-MENUBAR and COORDS-LIST, a 4-element list containing
start-y, start-x, height, and width for the window inside the border,
this computes the effect of the the padding, if there is any. It
returns a 4-element list (start-y, start-x, width, height) of the
window region inside the padding.
The padding should actually have been drawn by render-background."
(let ((hpad (%tui-menubar-get-horizontal-padding tui-menubar))
(vpad (%tui-menubar-get-vertical-padding tui-menubar)))
(render-padding #:coords-list coords-list
#:hpad hpad
#:vpad vpad)))
(define (key-label-alist->string kv)
"Renders an alist where the CAR is an ncurses character and
CDR is a short string into a single string like the following..
'X) INSPECT R) DROP C) CYCLE DAMAGE Q) FAV'"
(let ([entry-strings (map
(lambda (entry)
(let ([key (car entry)]
[val (->string (cdr entry))])
(string-append
(keyname key)
") "
val)))
kv)])
(if (<= (length entry-strings) 1)
entry-string
;; else
(let loop ([result (car entry-strings)]
[cur (cadr entry-strings)]
[rest (cddr entry-strings)]
)
(cond
((null-list? rest)
(string-append result " " cur))
(else
(loop (string-append result " " cur)
(car rest)
(cdr rest))))))))
(define (do-text tui-menubar coords-list)
"Given a TUI-MENUBAR and COORDS-LIST, a 4-element list containing
start-y, start-x, height, and width for the window inside the border
and padding, this draws the key/label text. The return value is not
used."
(let ([panel (%tui-menubar-get-panel tui-menubar)]
[keyval (%tui-menubar-get-key-label-alist tui-menubar)])
(render-text panel (key-label-alist->string keyval)
#:coords-list coords-list
#:attr (%tui-menubar-get-attributes tui-menubar)
#:fg-color (%tui-menubar-get-text-color tui-menubar)
#:bg-color (%tui-menubar-get-bg-color tui-menubar)
#:valign (%tui-menubar-get-vertical-alignment tui-menubar)
#:halign (%tui-menubar-get-horizontal-alignment tui-menubar)
#:ellipsize (%tui-menubar-get-ellipsize tui-menubar)
#:vert-ellipsize (%tui-menubar-get-ellipsize tui-menubar)
#:line-wrap (%tui-menubar-get-line-wrap tui-menubar))))
(define (tui-menubar-render-text! tui-menubar)
(do-text tui-menubar
(do-padding tui-menubar
(do-border tui-menubar
(do-background tui-menubar
(compute-coords-list tui-menubar))))))
(define (tui-menubar-set-border-type! tui-menubar border-type)
"Sets the border-type of the tui-menubar to 'border-none,
'border-light, 'border-heavy, 'border-rounded, 'border-double or
'border-block. If the border is not 'border-none, the size available
for text will be reduced by one cell on all four sides of the
tui-menubar."
(%tui-menubar-set-border-type! tui-menubar border-type)
(tui-menubar-render-text! tui-menubar))
(define (tui-menubar-set-horizontal-padding! tui-menubar n-chars)
"Sets the number of cells at the right and left of the widget that
are blank padding. If there is a border, this padding is inside of
the border."
(%tui-menubar-set-horizontal-padding! tui-menubar n-chars)
(tui-menubar-render-text! tui-menubar))
(define (tui-menubar-set-vertical-padding! tui-menubar n-chars)
"Sets the number of cells at the top and bottom of the
widget that are blank padding. If there is a border, this padding
is inside of the border."
(%tui-menubar-set-vertical-padding! tui-menubar n-chars)
(tui-menubar-render-text! tui-menubar))
(define (tui-menubar-set-text! tui-menubar str)
"Sets the text within the tui-menubar widget. It overwrites any
text that was there before."
(%tui-menubar-set-text! tui-menubar str)
(tui-menubar-render-text! tui-menubar))
(define (tui-menubar-set-attributes! tui-menubar tui-attr)
"Sets the ncurses attributes of a tui-menubar, such as A_BOLD. If the
attributes are different than the previous attributes, the tui-menubar
is refreshed."
(unless (eqv? (%tui-menubar-get-attributes tui-menubar) tui-attr)
(%tui-menubar-set-attributes! tui-menubar tui-attr)
(tui-menubar-render-text! tui-menubar)))
(define (tui-menubar-set-horizontal-alignment! tui-menubar tui-horizontal-alignment)
"Sets the alignment of the lines in the text of the menubar relative
to each other. The allowable values are 'right, 'left, 'center"
(%tui-menubar-set-horizontal-alignment! tui-menubar tui-horizontal-alignment)
(tui-menubar-render-text! tui-menubar))
(define (tui-menubar-set-vertical-alignment! tui-menubar tui-vertical-alignment)
"Sets the alignment of the text lines in the menubar. 'top, 'center or 'bottom"
(%tui-menubar-set-vertical-alignment! tui-menubar tui-vertical-alignment)
(tui-menubar-render-text! tui-menubar))
(define (tui-menubar-set-ellipsize! tui-menubar tui-ellipsize-mode)
"Describes what type of ellipsization should be applied to a line
of text. #t or #f"
(%tui-menubar-set-ellipsize! tui-menubar tui-ellipsize-mode)
(tui-menubar-render-text! tui-menubar))
(define (tui-menubar-set-line-wrap! tui-menubar wrap)
"Sets line wrapping in the tui-menubar widget. #t make it break
if text exceedes the widget's size. #f lets the text get cut off
by the edge of the widget if it exceeds the widget size.
If a desired wrap width was set with tui-menubar-set-width-chars!,
it will try to wrap so that no characters written to the right of that
width."
(%tui-menubar-set-line-wrap! tui-menubar wrap)
(tui-menubar-render-text! tui-menubar))
(define (tui-menubar-get-text tui-menubar)
"Fetches the text from a menubar as a simple string."
(%tui-menubar-get-text tui-menubar))
(define (tui-menubar-get-border-type tui-menubar)
"Returns the current border-type, which should be one of
'border-none, 'border-light, 'border-heavy, 'border-rounded,
'border-double, or 'border-block"
(%tui-menubar-get-border-type tui-menubar))
(define (tui-menubar-get-horizontal-padding tui-menubar)
(%tui-menubar-get-horizontal-padding tui-menubar))
(define (tui-menubar-get-vertical-padding tui-menubar)
(%tui-menubar-get-vertical-padding tui-menubar))
(define (tui-menubar-get-attributes tui-menubar)
"Gets the attributes of the menubar as an ncurses attribute type."
(%tui-menubar-get-attributes tui-menubar))
(define (tui-menubar-get-horizontal-alignment tui-menubar)
"Gets the justification of a menubar as a tui-justification type."
(%tui-menubar-get-horizontal-alignment tui-menubar))
(define (tui-menubar-get-vertical-alignment tui-menubar)
"Gets the justification of a menubar as a tui-justification type. One
of 'top, 'center, or 'bottom."
(%tui-menubar-get-vertical-alignment tui-menubar))
(define (tui-menubar-get-ellipsize tui-menubar)
"Gets the ellipsizing flag of the menubar."
(%tui-menubar-get-ellipsize tui-menubar))
(define (tui-menubar-get-line-wrap tui-menubar)
"Returns #t if the tui-menubar has line wrapping enabled."
(%tui-menubar-get-line-wrap tui-menubar))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; API Inherited from panel
(define (tui-menubar-show tui-menubar)
(show-panel (%tui-menubar-get-panel tui-menubar)))
(define (tui-menubar-hide tui-menubar)
(hide-panel (%tui-menubar-get-panel tui-menubar)))
(define (tui-menubar-hidden? tui-menubar)
(panel-hidden? (%tui-menubar-get-panel tui-menubar)))
(define (tui-menubar-move tui-menubar y x)
(move-panel (%tui-menubar-get-panel tui-menubar) y x))
(define (tui-menubar-top tui-menubar)
(top-panel (%tui-menubar-get-panel tui-menubar)))
(define (tui-menubar-bottom tui-menubar)
(bottom-panel (%tui-menubar-get-panel tui-menubar)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; API Inherited from window
;; various get sizes and offsets
(define (tui-menubar-resize tui-menubar rows cols)
(resize (%tui-menubar-get-panel tui-menubar) rows cols)
(tui-menubar-render-text! tui-menubar))
(define (tui-menubar-getbegyx tui-menubar)
(getbegyx (%tui-menubar-get-panel tui-menubar)))
(define (tui-menubar-getmaxyx tui-menubar)
(getmaxyx (%tui-menubar-get-panel tui-menubar)))
(define (tui-menubar-idle TM)
(tui-menubar-render-text! TM))
(define tui-menubar-kbd-action-activate
(lambda (TM event state)
(let ((key (event-get-data event)))
;; If a keypress matches a key in the key-label alist
;; enqueue a signal
((lambda (K)
(when K
(enqueue-symbolic-action 'menubar-keypress (list key K TM))))
(assoc-ref (%tui-menubar-get-key-label-alist TM) key)))))
(define (tui-menubar-action-activate TT event state)
(cond
((idle-event? event)
(tui-menubar-idle TT))
((kbd-event? event)
(tui-menubar-kbd-action-activate TT event state))))
(define (tui-menubar-action-handler)
(action-new "tui-menubar" #t '() tui-menubar-action-activate #t))
| false |
1e05f916b974e2d6f3a371bd9d2f5d5afcffd6d7 | 87f1e27952a387ff6a7d0625169d9a4f6cd960b2 | /guix/workflows.scm | 50f03ed52478eeeded8763493670defaf01370d1 | [] | no_license | guixwl/gwl | f5d21ca3563eed71e5cabb076f783fab63309cd1 | 036a6e043b9ee010b0ca7eaa5bd1381555385808 | refs/heads/master | 2020-03-17T23:42:10.633451 | 2018-03-11T11:22:16 | 2018-05-17T10:11:40 | 134,056,393 | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 6,228 | scm | workflows.scm | ;;; Copyright © 2016, 2017, 2018 Roel Janssen <[email protected]>
;;;
;;; This program is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program. If not, see <http://www.gnu.org/licenses/>.
(define-module (guix workflows)
#:use-module (guix processes)
#:use-module (guix packages)
#:use-module (guix workflows execution-order)
#:use-module (guix workflows utils)
#:use-module (guix records)
#:use-module (ice-9 pretty-print)
#:use-module (ice-9 match)
#:use-module (ice-9 format)
#:use-module (srfi srfi-9 gnu)
#:export (workflow
workflow?
workflow-name
workflow-full-name
workflow-version
workflow-input
workflow-output
workflow-processes
workflow-restrictions
workflow-arguments
workflow-synopsis
workflow-description
print-workflow-record
workflow-run-order
workflow-prepare
workflow-run))
;;; ---------------------------------------------------------------------------
;;; RECORD TYPES
;;; ---------------------------------------------------------------------------
(define-record-type* <workflow>
workflow make-workflow
workflow?
;; Basic information about the workflow
(name workflow-name)
(version workflow-version (default ""))
(synopsis workflow-synopsis (default ""))
(description workflow-description (default ""))
;; The input and output of a workfow will be passed to each starting process.
;; This can be files or directories, depending on what the workflow expects.
(input workflow-input (default #f))
(output workflow-output (default #f))
;; Processes are functions taking two parameters (input and output) that
;; return a <process> record type.
(processes workflow-processes)
;; Processes can depend on each other. By defining dependency pairs
;; in the form (A B) where A must be executed after B.
(restrictions workflow-restrictions (default '()))
;; Arguments are literally command-line arguments that can be passed
;; when executing a specific workflow. This allows users to turn features
;; off and on, and pass an input and output directory.
;;
;; The arguments are passed as a list to the workflow record.
(arguments workflow-arguments (default #f))
;; When a workflow requires additional code to execute, it can be
;; specified in the following field.
(execution workflow-execution (default #f)))
(define (workflow-full-name arg)
"Writes the name and version as a single string of PROCESS to PORT."
(if (string= (workflow-version arg) "")
(workflow-name arg)
(string-append (workflow-name arg) "-" (workflow-version arg))))
(define (print-workflow workflow port)
"Write a decent human-representation of a workflow of WORKFLOW to PORT."
(simple-format port "#<workflow ~a>" (workflow-full-name workflow)))
(define (print-workflow-record workflow port)
"Write a multi-line representation of PROC to PORT."
(match workflow
(($ <workflow> name version synopsis description)
(format port (string-append "name: ~a~%version: ~a~%synopsis: ~a~%"
"description: ~a~%processes: ~{~% * ~a~}~%")
name version synopsis description
(map (lambda (proc)
(process-full-name proc))
(workflow-processes workflow))))))
(set-record-type-printer! <workflow> print-workflow)
;;; ---------------------------------------------------------------------------
;;; RUNNER FUNCTIONALITY
;;; ---------------------------------------------------------------------------
(define* (workflow-run-order workflow #:key (parallel? #t))
"Returns a list of processes in WORKFLOW in the order in which the processes
can be executed. When parallel? is set to #t, the list contains lists of
processes that can be executed in parallel."
(let ((order-function (if parallel?
parallel-step-execution-order
sequential-execution-order)))
(order-function (workflow-processes workflow)
(workflow-restrictions workflow))))
(define* (fold-workflow-processes workflow engine function #:key (parallel? #t))
"Runs WORKFLOW using ENGINE."
(let ((order (workflow-run-order workflow #:parallel? parallel?)))
(if (not order)
(begin
(display "Sorry, I cannot determine the order in which to ")
(display "execute the processes.")
(newline))
(if parallel?
(for-each (lambda (step)
(for-each (lambda (process)
(function process engine
#:stand-alone? #f
#:workflow workflow))
;; By reversing the order of the processes in STEP
;; we keep the output order the same as the order
;; of the sequential function.
(reverse step)))
order)
(for-each (lambda (process)
(function process engine))
order)))))
(define* (workflow-prepare workflow engine #:key (parallel? #t))
(fold-workflow-processes workflow engine process->script
#:parallel? parallel?))
(define* (workflow-run workflow engine #:key (parallel? #t))
(fold-workflow-processes workflow engine process->script->run
#:parallel? parallel?))
| false |
c410751894c66dbc5fcea7465592c75b6ad257c5 | f08220a13ec5095557a3132d563a152e718c412f | /logrotate/skel/usr/share/guile/2.0/language/elisp/runtime.scm | 0c84d102be768709a4774f7429bcb4c4b2428da8 | [
"Apache-2.0"
] | permissive | sroettger/35c3ctf_chals | f9808c060da8bf2731e98b559babd4bf698244ac | 3d64486e6adddb3a3f3d2c041242b88b50abdb8d | refs/heads/master | 2020-04-16T07:02:50.739155 | 2020-01-15T13:50:29 | 2020-01-15T13:50:29 | 165,371,623 | 15 | 5 | Apache-2.0 | 2020-01-18T11:19:05 | 2019-01-12T09:47:33 | Python | UTF-8 | Scheme | false | false | 4,900 | scm | runtime.scm | ;;; Guile Emacs Lisp
;;; Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
;;;
;;; This library is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU Lesser General Public
;;; License as published by the Free Software Foundation; either
;;; version 3 of the License, or (at your option) any later version.
;;;
;;; This library is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;; Lesser General Public License for more details.
;;;
;;; You should have received a copy of the GNU Lesser General Public
;;; License along with this library; if not, write to the Free Software
;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;;; Code:
(define-module (language elisp runtime)
#:export (nil-value
t-value
value-slot-module
function-slot-module
elisp-bool
ensure-fluid!
reference-variable
set-variable!
runtime-error
macro-error)
#:export-syntax (built-in-func built-in-macro defspecial prim))
;;; This module provides runtime support for the Elisp front-end.
;;; Values for t and nil. (FIXME remove this abstraction)
(define nil-value #nil)
(define t-value #t)
;;; Modules for the binding slots.
;;; Note: Naming those value-slot and/or function-slot clashes with the
;;; submodules of these names!
(define value-slot-module '(language elisp runtime value-slot))
(define function-slot-module '(language elisp runtime function-slot))
;;; Report an error during macro compilation, that means some special
;;; compilation (syntax) error; or report a simple runtime-error from a
;;; built-in function.
(define (macro-error msg . args)
(apply error msg args))
(define runtime-error macro-error)
;;; Convert a scheme boolean to Elisp.
(define (elisp-bool b)
(if b
t-value
nil-value))
;;; Routines for access to elisp dynamically bound symbols. This is
;;; used for runtime access using functions like symbol-value or set,
;;; where the symbol accessed might not be known at compile-time. These
;;; always access the dynamic binding and can not be used for the
;;; lexical!
(define (ensure-fluid! module sym)
(let ((intf (resolve-interface module))
(resolved (resolve-module module)))
(if (not (module-defined? intf sym))
(let ((fluid (make-unbound-fluid)))
(module-define! resolved sym fluid)
(module-export! resolved `(,sym))))))
(define (reference-variable module sym)
(let ((resolved (resolve-module module)))
(cond
((equal? module function-slot-module)
(module-ref resolved sym))
(else
(ensure-fluid! module sym)
(fluid-ref (module-ref resolved sym))))))
(define (set-variable! module sym value)
(let ((intf (resolve-interface module))
(resolved (resolve-module module)))
(cond
((equal? module function-slot-module)
(cond
((module-defined? intf sym)
(module-set! resolved sym value))
(else
(module-define! resolved sym value)
(module-export! resolved `(,sym)))))
(else
(ensure-fluid! module sym)
(fluid-set! (module-ref resolved sym) value))))
value)
;;; Define a predefined function or predefined macro for use in the
;;; function-slot and macro-slot modules, respectively.
(define-syntax built-in-func
(syntax-rules ()
((_ name value)
(begin
(define-public name value)))))
(define (make-id template-id . data)
(let ((append-symbols
(lambda (symbols)
(string->symbol
(apply string-append (map symbol->string symbols))))))
(datum->syntax template-id
(append-symbols
(map (lambda (datum)
((if (identifier? datum)
syntax->datum
identity)
datum))
data)))))
(define-syntax built-in-macro
(lambda (x)
(syntax-case x ()
((_ name value)
(with-syntax ((scheme-name (make-id #'name 'macro- #'name)))
#'(begin
(define-public scheme-name
(make-fluid (cons 'macro value)))))))))
(define-syntax defspecial
(lambda (x)
(syntax-case x ()
((_ name args body ...)
(with-syntax ((scheme-name (make-id #'name 'compile- #'name)))
#'(begin
(define scheme-name
(make-fluid
(cons 'special-operator
(lambda args body ...))))))))))
;;; Call a guile-primitive that may be rebound for elisp and thus needs
;;; absolute addressing.
(define-syntax prim
(syntax-rules ()
((_ sym args ...)
((@ (guile) sym) args ...))))
| true |
75b647b63154c3213b65670d87d429d1bed562f8 | fe0de995a95bcf09cd447349269dc0e550851b5a | /scheme/base.scm | 977c2a92056692948d585eab2af4c9bf5e1038bc | [
"MIT"
] | permissive | mugcake/ruse-scheme | 4974021858be5b7f2421212ec2eeafd34c53bce8 | dd480e17edd9a233fd2bc4e8b41ff45d13fcc328 | refs/heads/master | 2022-02-12T04:31:55.031607 | 2019-08-01T21:44:14 | 2019-08-01T21:44:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 1,889 | scm | base.scm | (define-library (scheme base)
(export assume)
(export null? cons pair? car cdr set-car! set-cdr! list)
(begin
(define assume (javascript-procedure assume))
(define null? (javascript-procedure nullp))
(define ruse-make-record-type (javascript-procedure ruse_make_record_type))
(define ruse-record-constructor (javascript-procedure ruse_record_constructor))
(define ruse-record-predicate (javascript-procedure ruse_record_predicate))
(define ruse-record-accessor (javascript-procedure ruse_record_accessor))
(define ruse-record-modifier (javascript-procedure ruse_record_modifier))
(define-syntax define-record-type
(syntax-rules ()
((define-record-type type
(constructor constructor-tag ...)
predicate
(field-tag accessor modifier) ...)
(begin
(define type
(ruse-make-record-type 'type 'field-tag ...))
(define constructor
(ruse-record-constructor type))
(define predicate
(ruse-record-predicate type))
(begin
(define accessor (ruse-record-accessor type 'field-tag))
(define modifier (ruse-record-modifier type 'field-tag)))
...))))
(define-record-type <cons>
(cons car cdr)
pair?
(car car set-car!)
(cdr cdr set-cdr!))
(define list (lambda args args))
;; (define cons*
;; (lambda (a . rest)
;; (let loop ((args (cons a rest))
;; (out '()))
;; (if (and (pair? args) (null? (cdr args)))
;; (let loop ((reversed out)
;; (out (car args)))
;; (if (null? reversed)
;; out
;; (loop (cdr reversed) (cons (car reversed) out))))
;; (loop (cdr args) (cons (car args) out))))))
))
| true |
62ff0959689fd5c79fb7456fe28615968b5ff1ec | f04768e1564b225dc8ffa58c37fe0213235efe5d | /back/datatypes.ss | c191e85e6b538c1374237c0d6e0ad48ca11377a5 | [] | no_license | FrancisMengx/PLC | 9b4e507092a94c636d784917ec5e994c322c9099 | e3ca99cc25bd6d6ece85163705b321aa122f7305 | refs/heads/master | 2021-01-01T05:37:43.849357 | 2014-09-09T23:27:08 | 2014-09-09T23:27:08 | 23,853,636 | 1 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 1,457 | ss | datatypes.ss |
;; Parsed expression datatypes
(define-datatype expression expression? ; based on the simple expression grammar, EoPL-2 p6
[var-exp (id symbol?)]
[val-exp (val integer?)]
[lit-exp (datum (lambda (x) (ormap (lambda (pred) (pred x)) (list number? vector? boolean? symbol? string? pair? null?))))]
[lambda-exp (args symbol?)
(body (list-of expression?))]
[lambda-list-exp (args pair?)
(body (list-of expression?))]
[let-exp (assign list?)
(body (list-of expression?))]
[app-exp (rator expression?)
(rands (list-of expression?))]
[prim-exp (proc proc-val?)
(args list?)]
[if-exp (con expression?)
(body expression?)]
[if-else-exp (con expression?)
(t-body expression?)
(f-body expression?)]
[set!-exp (var symbol?)
(val expression?)])
; datatype for procedures. At first there is only one
; kind of procedure, but more kinds will be added later.
;; environment type definitions
(define scheme-value?
(lambda (x) #t))
(define-datatype environment environment?
(empty-env-record)
(extended-env-record
(syms (list-of symbol?))
(vals (list-of scheme-value?))
(env environment?)))
(define-datatype proc-val proc-val?
[prim-proc (name (lambda (x) (member x *prim-proc-names*)))]
[closure (vars (lambda (x) (or (symbol? x) (pair? x))))
(body (list-of expression?))
(e environment?)])
| false |
513663689b902551ca437ac0af98fdf6785373f1 | 7a0de0d176e43453ee442354020ca0fd01111163 | /test.scm | c0f79256e65fc2c61022f757e9ea0d8476e052e7 | [] | no_license | cyclone-scheme/srfi-230 | 7e86480064c2fa1c37a8d5230884947dee668598 | fa1bd9ef6496e41198265975953a2e20f8c415c0 | refs/heads/master | 2023-08-07T11:49:07.062809 | 2021-09-20T20:23:25 | 2021-09-20T20:23:25 | 408,588,306 | 5 | 0 | null | null | null | null | UTF-8 | Scheme | false | false | 3,477 | scm | test.scm | ;; Copyright (C) Justin Ethier (2021). 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.
(import (scheme base)
(scheme write)
(srfi 18)
(srfi 230)
(cyclone test))
;; Atomic flags - Basic example of using flags to create a spin lock
(define *flag* (make-atomic-flag))
(define *counter* 0)
(define (spin-lock flag)
(let loop ()
(if (atomic-flag-test-and-set! flag)
(loop))))
(define (spin-unlock flag)
(atomic-flag-clear! flag))
(define (atomic-flag-task)
(do ((i 0 (+ i 1)))
((= i 100000))
(spin-lock *flag*)
(set! *counter* (+ *counter* 1))
(spin-unlock *flag*) ))
;; Atomic boxes
(define *atomic-box* (make-atomic-box 0.0))
(define (atomic-box-task)
(do ((i 0 (+ i 1)))
((= i 100000))
(let loop ()
(let ((expected (atomic-box-ref *atomic-box*)))
(if (not (eq? expected (atomic-box-compare-and-swap! *atomic-box* expected (+ expected 1))))
(loop))))))
;; Atomic fxboxes
(define *atomic-fxbox* (make-atomic-fxbox 0))
(define (atomic-fxbox-task)
(do ((i 0 (+ i 1)))
((= i 100000))
(let loop ()
(let ((expected (atomic-fxbox-ref *atomic-fxbox*)))
(if (not (eq? expected (atomic-fxbox-compare-and-swap! *atomic-fxbox* expected (+ expected 1))))
(loop))))
))
(define *atomic-counter* (make-atomic-fxbox 0))
(define (atomic-counter-task)
(do ((i 0 (+ i 1)))
((= i 100000))
(atomic-fxbox+/fetch! *atomic-counter* 1)
))
;; Core task runner
(define (run thunk result-thunk)
(define threads (make-vector 10))
(do ((i 0 (+ i 1)))
((= i 10))
(let ((thread (make-thread thunk)))
(vector-set! threads i thread)
(thread-start! thread)))
(do ((i 0 (+ i 1)))
((= i 10))
(thread-join! (vector-ref threads i)))
(result-thunk))
;; Test cases
(test-group "atomic flag"
(test 1000000 (run atomic-flag-task
(lambda ()
*counter*))))
(test-group "atomic box"
(test 1000000.0 (run atomic-box-task
(lambda ()
(atomic-box-ref *atomic-box*)))))
(test-group "atomic fxbox"
(test 1000000 (run atomic-fxbox-task
(lambda ()
(atomic-fxbox-ref *atomic-fxbox*))))
(test 1000000 (run atomic-counter-task
(lambda ()
(atomic-fxbox-ref *atomic-counter*))))
)
(test-exit)
| false |
5d376e41119dd0b81e5c84624a90f83a59b47548 | ac2a3544b88444eabf12b68a9bce08941cd62581 | /examples/Xlib-simple/Xlib.scm | 0019dce5448d22fe145623bf69ef7eea0e0e1c0c | [
"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 | 32,228 | scm | Xlib.scm | ;;;============================================================================
;;; File: "Xlib.scm"
;;; Copyright (c) 2006-2015 by Marc Feeley, All Rights Reserved.
;;; A simple interface to the X Window System Xlib library.
;; Note: This interface to Xlib is still in development. There are
;; still memory leaks in the interface.
;;;============================================================================
(##namespace ("Xlib#"))
(##include "~~lib/gambit#.scm")
(##include "Xlib#.scm")
(declare
(standard-bindings)
(extended-bindings)
(block)
(not safe)
)
;;;============================================================================
(c-declare #<<end-of-c-declare
#include <X11/Xlib.h>
#include <X11/Xutil.h>
end-of-c-declare
)
;; Declare a few types so that the function prototypes use the same
;; type names as a C program.
(c-define-type Time unsigned-long)
(c-define-type XID unsigned-long)
(c-define-type Window XID)
(c-define-type Drawable XID)
(c-define-type Font XID)
(c-define-type Pixmap XID)
(c-define-type Cursor XID)
(c-define-type Colormap XID)
(c-define-type GContext XID)
(c-define-type KeySym XID)
(c-declare #<<end-of-c-declare
#define debug_free_not
#define really_free
#ifdef debug_free
#include <stdio.h>
#endif
___SCMOBJ release_rc_XGCValues( void* ptr )
{ XGCValues* p = ptr;
#ifdef debug_free
printf( "release_rc_XGCValues(%p)\n", p );
fflush( stdout );
#endif
#ifdef really_free
___EXT(___release_rc)( p );
#endif
return ___FIX(___NO_ERR);
}
___SCMOBJ XFreeFontInfo_XFontStruct( void* ptr )
{ XFontStruct* p = ptr;
#ifdef debug_free
printf( "XFreeFontInfo_XFontStruct(%p)\n", p );
fflush( stdout );
#endif
#ifdef really_free
XFreeFontInfo( NULL, p, 1 );
#endif
return ___FIX(___NO_ERR);
}
___SCMOBJ release_rc_XColor( void* ptr )
{ XColor* p = ptr;
#ifdef debug_free
printf( "release_rc_XColor(%p)\n", p );
fflush( stdout );
#endif
#ifdef really_free
___EXT(___release_rc)( p );
#endif
return ___FIX(___NO_ERR);
}
___SCMOBJ release_rc_XEvent( void* ptr )
{ XEvent* p = ptr;
#ifdef debug_free
printf( "release_rc_XEvent(%p)\n", p );
fflush( stdout );
#endif
#ifdef really_free
___EXT(___release_rc)( p );
#endif
return ___FIX(___NO_ERR);
}
end-of-c-declare
)
(c-define-type Bool int)
(c-define-type Status int)
(c-define-type GC (pointer (struct "_XGC") (GC)))
(c-define-type Visual "Visual")
(c-define-type Visual* (pointer Visual (Visual*)))
(c-define-type Display "Display")
(c-define-type Display* (pointer Display (Display*)))
(c-define-type Screen "Screen")
(c-define-type Screen* (pointer Screen (Screen*)))
(c-define-type XGCValues "XGCValues")
(c-define-type XGCValues* (pointer XGCValues (XGCValues*)))
(c-define-type XGCValues*/release-rc (pointer XGCValues (XGCValues*) "release_rc_XGCValues"))
(c-define-type XFontStruct "XFontStruct")
(c-define-type XFontStruct* (pointer XFontStruct (XFontStruct*)))
(c-define-type XFontStruct*/XFreeFontInfo (pointer XFontStruct (XFontStruct*) "XFreeFontInfo_XFontStruct"))
(c-define-type XColor "XColor")
(c-define-type XColor* (pointer XColor (XColor*)))
(c-define-type XColor*/release-rc (pointer XColor (XColor*) "release_rc_XColor"))
(c-define-type XEvent "XEvent")
(c-define-type XEvent* (pointer XEvent (XEvent*)))
(c-define-type XEvent*/release-rc (pointer XEvent (XEvent*) "release_rc_XEvent"))
(c-define-type char* char-string)
;; Function prototypes for a minimal subset of Xlib functions. The
;; functions have the same name in Scheme and C.
(define XOpenDisplay
(c-lambda (char*) ;; display_name
Display*
"XOpenDisplay"))
(define XCloseDisplay
(c-lambda (Display*) ;; display
int
"XCloseDisplay"))
(define XDefaultScreen
(c-lambda (Display*) ;; display
int
"XDefaultScreen"))
(define XScreenOfDisplay
(c-lambda (Display* ;; display
int) ;; screen_number
Screen*
"XScreenOfDisplay"))
(define XDefaultColormapOfScreen
(c-lambda (Screen*) ;; screen
Colormap
"XDefaultColormapOfScreen"))
(define XClearWindow
(c-lambda (Display* ;; display
Window) ;; w
int
"XClearWindow"))
(define XConnectionNumber
(c-lambda (Display*) ;; display
int
"XConnectionNumber"))
(define XRootWindow
(c-lambda (Display* ;; display
int) ;; screen_number
Window
"XRootWindow"))
(define XDefaultRootWindow
(c-lambda (Display*) ;; display
Window
"XDefaultRootWindow"))
(define XRootWindowOfScreen
(c-lambda (Screen*) ;; screen
Window
"XRootWindowOfScreen"))
(define XDefaultVisual
(c-lambda (Display* ;; display
int) ;; screen_number
Visual*
"XDefaultVisual"))
(define XDefaultVisualOfScreen
(c-lambda (Screen*) ;; screen
Visual*
"XDefaultVisualOfScreen"))
(define XDefaultGC
(c-lambda (Display* ;; display
int) ;; screen_number
GC
"XDefaultGC"))
(define XDefaultGCOfScreen
(c-lambda (Screen*) ;; screen
GC
"XDefaultGCOfScreen"))
(define XBlackPixel
(c-lambda (Display* ;; display
int) ;; screen_number
unsigned-long
"XBlackPixel"))
(define XWhitePixel
(c-lambda (Display* ;; display
int) ;; screen_number
unsigned-long
"XWhitePixel"))
(define XCreateSimpleWindow
(c-lambda (Display* ;; display
Window ;; parent
int ;; x
int ;; y
unsigned-int ;; width
unsigned-int ;; height
unsigned-int ;; border_width
unsigned-long ;; border
unsigned-long) ;; backgound
Window
"XCreateSimpleWindow"))
(define XMapWindow
(c-lambda (Display* ;; display
Window) ;; w
int
"XMapWindow"))
(define XResizeWindow
(c-lambda (Display* ;; display
Window ;; w
unsigned-int ;; width
unsigned-int) ;; height
int
"XResizeWindow"))
(define XFlush
(c-lambda (Display*) ;; display
int
"XFlush"))
(define XCreateGC
(c-lambda (Display* ;; display
Drawable ;; d
unsigned-long ;; valuemask
XGCValues*) ;; values
GC
"XCreateGC"))
(define XFreeGC
(c-lambda (Display* ;; display
GC) ;; gc
int
"XFreeGC"))
(define XFillRectangle
(c-lambda (Display* ;; display
Drawable ;; d
GC ;; gc
int ;; x
int ;; y
unsigned-int ;; width
unsigned-int) ;; height
int
"XFillRectangle"))
(define XFillArc
(c-lambda (Display* ;; display
Drawable ;; d
GC ;; gc
int ;; x
int ;; y
unsigned-int ;; width
unsigned-int ;; height
int ;; angle1
int) ;; angle2
int
"XFillArc"))
(define XDrawString
(c-lambda (Display* ;; display
Drawable ;; d
GC ;; gc
int ;; x
int ;; y
char* ;; string
int) ;; length
int
"XDrawString"))
(define XTextWidth
(c-lambda (XFontStruct* ;; font_struct
char* ;; string
int) ;; count
int
"XTextWidth"))
(define XParseColor
(c-lambda (Display* ;; display
Colormap ;; colormap
char* ;; spec
XColor*) ;; exact_def_return
Status
"XParseColor"))
(define XAllocColor
(c-lambda (Display* ;; display
Colormap ;; colormap
XColor*) ;; screen_in_out
Status
"XAllocColor"))
(define (make-XColor-box)
((c-lambda ()
XColor*/release-rc
"___result_voidstar = ___EXT(___alloc_rc) (sizeof (XColor));")))
(define XColor-pixel
(c-lambda (XColor*) ;; XColor box
unsigned-long
"___result = ___arg1->pixel;"))
(define XColor-pixel-set!
(c-lambda (XColor* ;; XColor box
unsigned-long) ;; intensity
void
"___arg1->pixel = ___arg2;"))
(define XColor-red
(c-lambda (XColor*) ;; XColor box
unsigned-short
"___result = ___arg1->red;"))
(define XColor-red-set!
(c-lambda (XColor* ;; XColor box
unsigned-short);; intensity
void
"___arg1->red = ___arg2;"))
(define XColor-green
(c-lambda (XColor*) ;; XColor box
unsigned-short
"___result = ___arg1->green;"))
(define XColor-green-set!
(c-lambda (XColor* ;; XColor box
unsigned-short);; intensity
void
"___arg1->green = ___arg2;"))
(define XColor-blue
(c-lambda (XColor*) ;; XColor box
unsigned-short
"___result = ___arg1->blue;"))
(define XColor-blue-set!
(c-lambda (XColor* ;; XColor box
unsigned-short);; intensity
void
"___arg1->blue = ___arg2;"))
(define (make-XGCValues-box)
((c-lambda ()
XGCValues*/release-rc
"___result_voidstar = ___EXT(___alloc_rc) (sizeof (XGCValues));")))
(define XGCValues-foreground
(c-lambda (XGCValues*) ;; XGCValues box
unsigned-long
"return ___arg1->foreground;"))
(define XGCValues-foreground-set!
(c-lambda (XGCValues* ;; XGCValues box
unsigned-long) ;; pixel index
void
"___arg1->foreground = ___arg2;"))
(define XGCValues-background
(c-lambda (XGCValues*) ;; XGCValues box
unsigned-long
"return ___arg1->background;"))
(define XGCValues-background-set!
(c-lambda (XGCValues* ;; XGCValues box
unsigned-long) ;; pixel index
void
"___arg1->background = ___arg2;"))
(define XGCValues-font
(c-lambda (XGCValues*) ;; XGCValues box
Font
"return ___arg1->font;"))
(define XGCValues-font-set!
(c-lambda (XGCValues* ;; XGCValues box
Font) ;; font_ID
void
"___arg1->font = ___arg2;"))
(define GCFunction
((c-lambda () unsigned-long "___result = GCFunction;")))
(define GCPlaneMask
((c-lambda () unsigned-long "___result = GCPlaneMask;")))
(define GCForeground
((c-lambda () unsigned-long "___result = GCForeground;")))
(define GCBackground
((c-lambda () unsigned-long "___result = GCBackground;")))
(define GCLineWidth
((c-lambda () unsigned-long "___result = GCLineWidth;")))
(define GCLineStyle
((c-lambda () unsigned-long "___result = GCLineStyle;")))
(define GCCapStyle
((c-lambda () unsigned-long "___result = GCCapStyle;")))
(define GCJoinStyle
((c-lambda () unsigned-long "___result = GCJoinStyle;")))
(define GCFillStyle
((c-lambda () unsigned-long "___result = GCFillStyle;")))
(define GCFillRule
((c-lambda () unsigned-long "___result = GCFillRule;")))
(define GCTile
((c-lambda () unsigned-long "___result = GCTile;")))
(define GCStipple
((c-lambda () unsigned-long "___result = GCStipple;")))
(define GCTileStipXOrigin
((c-lambda () unsigned-long "___result = GCTileStipXOrigin;")))
(define GCTileStipYOrigin
((c-lambda () unsigned-long "___result = GCTileStipYOrigin;")))
(define GCFont
((c-lambda () unsigned-long "___result = GCFont;")))
(define GCSubwindowMode
((c-lambda () unsigned-long "___result = GCSubwindowMode;")))
(define GCGraphicsExposures
((c-lambda () unsigned-long "___result = GCGraphicsExposures;")))
(define GCClipXOrigin
((c-lambda () unsigned-long "___result = GCClipXOrigin;")))
(define GCClipYOrigin
((c-lambda () unsigned-long "___result = GCClipYOrigin;")))
(define GCClipMask
((c-lambda () unsigned-long "___result = GCClipMask;")))
(define GCDashOffset
((c-lambda () unsigned-long "___result = GCDashOffset;")))
(define GCDashList
((c-lambda () unsigned-long "___result = GCDashList;")))
(define GCArcMode
((c-lambda () unsigned-long "___result = GCArcMode;")))
(define XChangeGC
(c-lambda (Display* ;; display
GC ;; gc
unsigned-long ;; valuemask
XGCValues*) ;; values
int
"XChangeGC"))
(define XGetGCValues
(c-lambda (Display* ;; display
GC ;; gc
unsigned-long ;; valuemask
XGCValues*) ;; values_return
int
"XGetGCValues"))
(define XQueryFont
(c-lambda (Display* ;; display
Font) ;; font_ID
XFontStruct*/XFreeFontInfo
"XQueryFont"))
(define XFreeFontInfo
(c-lambda (nonnull-char-string-list ;; names
XFontStruct* ;; free_info
int) ;; actual_count
int
"XFreeFontInfo"))
(define XLoadFont
(c-lambda (Display* ;; display
char*) ;; name
Font
"XLoadFont"))
(define XUnloadFont
(c-lambda (Display* ;; display
Font) ;; font
int
"XUnloadFont"))
(define XLoadQueryFont
(c-lambda (Display* ;; display
char*) ;; name
XFontStruct*/XFreeFontInfo
"XLoadQueryFont"))
(define XFreeFont
(c-lambda (Display* ;; display
XFontStruct*) ;; font_struct
int
"XFreeFont"))
(define XFontStruct-fid
(c-lambda (XFontStruct*) ;; font_struct
Font
"___result = ___arg1->fid;"))
(define XFontStruct-ascent
(c-lambda (XFontStruct*) ;; font_struct
int
"___result = ___arg1->ascent;"))
(define XFontStruct-descent
(c-lambda (XFontStruct*) ;; font_struct
int
"___result = ___arg1->descent;"))
(define NoEventMask
((c-lambda () long "___result = NoEventMask;")))
(define KeyPressMask
((c-lambda () long "___result = KeyPressMask;")))
(define KeyReleaseMask
((c-lambda () long "___result = KeyReleaseMask;")))
(define ButtonPressMask
((c-lambda () long "___result = ButtonPressMask;")))
(define ButtonReleaseMask
((c-lambda () long "___result = ButtonReleaseMask;")))
(define EnterWindowMask
((c-lambda () long "___result = EnterWindowMask;")))
(define LeaveWindowMask
((c-lambda () long "___result = LeaveWindowMask;")))
(define PointerMotionMask
((c-lambda () long "___result = PointerMotionMask;")))
(define PointerMotionHintMask
((c-lambda () long "___result = PointerMotionHintMask;")))
(define Button1MotionMask
((c-lambda () long "___result = Button1MotionMask;")))
(define Button2MotionMask
((c-lambda () long "___result = Button2MotionMask;")))
(define Button3MotionMask
((c-lambda () long "___result = Button3MotionMask;")))
(define Button4MotionMask
((c-lambda () long "___result = Button4MotionMask;")))
(define Button5MotionMask
((c-lambda () long "___result = Button5MotionMask;")))
(define ButtonMotionMask
((c-lambda () long "___result = ButtonMotionMask;")))
(define KeymapStateMask
((c-lambda () long "___result = KeymapStateMask;")))
(define ExposureMask
((c-lambda () long "___result = ExposureMask;")))
(define VisibilityChangeMask
((c-lambda () long "___result = VisibilityChangeMask;")))
(define StructureNotifyMask
((c-lambda () long "___result = StructureNotifyMask;")))
(define ResizeRedirectMask
((c-lambda () long "___result = ResizeRedirectMask;")))
(define SubstructureNotifyMask
((c-lambda () long "___result = SubstructureNotifyMask;")))
(define SubstructureRedirectMask
((c-lambda () long "___result = SubstructureRedirectMask;")))
(define FocusChangeMask
((c-lambda () long "___result = FocusChangeMask;")))
(define PropertyChangeMask
((c-lambda () long "___result = PropertyChangeMask;")))
(define ColormapChangeMask
((c-lambda () long "___result = ColormapChangeMask;")))
(define OwnerGrabButtonMask
((c-lambda () long "___result = OwnerGrabButtonMask;")))
(define KeyPress
((c-lambda () long "___result = KeyPress;")))
(define KeyRelease
((c-lambda () long "___result = KeyRelease;")))
(define ButtonPress
((c-lambda () long "___result = ButtonPress;")))
(define ButtonRelease
((c-lambda () long "___result = ButtonRelease;")))
(define MotionNotify
((c-lambda () long "___result = MotionNotify;")))
(define EnterNotify
((c-lambda () long "___result = EnterNotify;")))
(define LeaveNotify
((c-lambda () long "___result = LeaveNotify;")))
(define FocusIn
((c-lambda () long "___result = FocusIn;")))
(define FocusOut
((c-lambda () long "___result = FocusOut;")))
(define KeymapNotify
((c-lambda () long "___result = KeymapNotify;")))
(define Expose
((c-lambda () long "___result = Expose;")))
(define GraphicsExpose
((c-lambda () long "___result = GraphicsExpose;")))
(define NoExpose
((c-lambda () long "___result = NoExpose;")))
(define VisibilityNotify
((c-lambda () long "___result = VisibilityNotify;")))
(define CreateNotify
((c-lambda () long "___result = CreateNotify;")))
(define DestroyNotify
((c-lambda () long "___result = DestroyNotify;")))
(define UnmapNotify
((c-lambda () long "___result = UnmapNotify;")))
(define MapNotify
((c-lambda () long "___result = MapNotify;")))
(define MapRequest
((c-lambda () long "___result = MapRequest;")))
(define ReparentNotify
((c-lambda () long "___result = ReparentNotify;")))
(define ConfigureNotify
((c-lambda () long "___result = ConfigureNotify;")))
(define ConfigureRequest
((c-lambda () long "___result = ConfigureRequest;")))
(define GravityNotify
((c-lambda () long "___result = GravityNotify;")))
(define ResizeRequest
((c-lambda () long "___result = ResizeRequest;")))
(define CirculateNotify
((c-lambda () long "___result = CirculateNotify;")))
(define CirculateRequest
((c-lambda () long "___result = CirculateRequest;")))
(define PropertyNotify
((c-lambda () long "___result = PropertyNotify;")))
(define SelectionClear
((c-lambda () long "___result = SelectionClear;")))
(define SelectionRequest
((c-lambda () long "___result = SelectionRequest;")))
(define SelectionNotify
((c-lambda () long "___result = SelectionNotify;")))
(define ColormapNotify
((c-lambda () long "___result = ColormapNotify;")))
(define ClientMessage
((c-lambda () long "___result = ClientMessage;")))
(define MappingNotify
((c-lambda () long "___result = MappingNotify;")))
(define XCheckMaskEvent
(c-lambda (Display* ;; display
long) ;; event_mask
XEvent*/release-rc
#<<end-of-c-lambda
XEvent ev;
XEvent* pev;
if (XCheckMaskEvent (___arg1, ___arg2, &ev))
{
pev = ___CAST(XEvent*,___EXT(___alloc_rc) (sizeof (ev)));
*pev = ev;
}
else
pev = 0;
___result_voidstar = pev;
end-of-c-lambda
))
(define XSelectInput
(c-lambda (Display* ;; display
Window ;; w
long) ;; event_mask
int
"XSelectInput"))
(define XAnyEvent-type
(c-lambda (XEvent*) ;; XEvent box
int
"___result = ___arg1->type;"))
(define XAnyEvent-serial
(c-lambda (XEvent*) ;; XEvent box
unsigned-long
"___result = ___arg1->xany.serial;"))
(define XAnyEvent-send-event
(c-lambda (XEvent*) ;; XEvent box
bool
"___result = ___arg1->xany.send_event;"))
(define XAnyEvent-display
(c-lambda (XEvent*) ;; XEvent box
Display*
"___result_voidstar = ___arg1->xany.display;"))
(define XAnyEvent-window
(c-lambda (XEvent*) ;; XEvent box
Window
"___result = ___arg1->xany.window;"))
(define XKeyEvent-root
(c-lambda (XEvent*) ;; XEvent box
Window
"___result = ___arg1->xkey.root;"))
(define XKeyEvent-subwindow
(c-lambda (XEvent*) ;; XEvent box
Window
"___result = ___arg1->xkey.subwindow;"))
(define XKeyEvent-time
(c-lambda (XEvent*) ;; XEvent box
Time
"___result = ___arg1->xkey.time;"))
(define XKeyEvent-x
(c-lambda (XEvent*) ;; XEvent box
int
"___result = ___arg1->xkey.x;"))
(define XKeyEvent-y
(c-lambda (XEvent*) ;; XEvent box
int
"___result = ___arg1->xkey.y;"))
(define XKeyEvent-x-root
(c-lambda (XEvent*) ;; XEvent box
int
"___result = ___arg1->xkey.x_root;"))
(define XKeyEvent-y-root
(c-lambda (XEvent*) ;; XEvent box
int
"___result = ___arg1->xkey.y_root;"))
(define XKeyEvent-state
(c-lambda (XEvent*) ;; XEvent box
unsigned-int
"___result = ___arg1->xkey.state;"))
(define XKeyEvent-keycode
(c-lambda (XEvent*) ;; XEvent box
unsigned-int
"___result = ___arg1->xkey.keycode;"))
(define XKeyEvent-same-screen
(c-lambda (XEvent*) ;; XEvent box
bool
"___result = ___arg1->xkey.same_screen;"))
(define XButtonEvent-root
(c-lambda (XEvent*) ;; XEvent box
Window
"___result = ___arg1->xbutton.root;"))
(define XButtonEvent-subwindow
(c-lambda (XEvent*) ;; XEvent box
Window
"___result = ___arg1->xbutton.subwindow;"))
(define XButtonEvent-time
(c-lambda (XEvent*) ;; XEvent box
Time
"___result = ___arg1->xbutton.time;"))
(define XButtonEvent-x
(c-lambda (XEvent*) ;; XEvent box
int
"___result = ___arg1->xbutton.x;"))
(define XButtonEvent-y
(c-lambda (XEvent*) ;; XEvent box
int
"___result = ___arg1->xbutton.y;"))
(define XButtonEvent-x-root
(c-lambda (XEvent*) ;; XEvent box
int
"___result = ___arg1->xbutton.x_root;"))
(define XButtonEvent-y-root
(c-lambda (XEvent*) ;; XEvent box
int
"___result = ___arg1->xbutton.y_root;"))
(define XButtonEvent-state
(c-lambda (XEvent*) ;; XEvent box
unsigned-int
"___result = ___arg1->xbutton.state;"))
(define XButtonEvent-button
(c-lambda (XEvent*) ;; XEvent box
unsigned-int
"___result = ___arg1->xbutton.button;"))
(define XButtonEvent-same-screen
(c-lambda (XEvent*) ;; XEvent box
bool
"___result = ___arg1->xbutton.same_screen;"))
(define XMotionEvent-root
(c-lambda (XEvent*) ;; XEvent box
Window
"___result = ___arg1->xmotion.root;"))
(define XMotionEvent-subwindow
(c-lambda (XEvent*) ;; XEvent box
Window
"___result = ___arg1->xmotion.subwindow;"))
(define XMotionEvent-time
(c-lambda (XEvent*) ;; XEvent box
Time
"___result = ___arg1->xmotion.time;"))
(define XMotionEvent-x
(c-lambda (XEvent*) ;; XEvent box
int
"___result = ___arg1->xmotion.x;"))
(define XMotionEvent-y
(c-lambda (XEvent*) ;; XEvent box
int
"___result = ___arg1->xmotion.y;"))
(define XMotionEvent-x-root
(c-lambda (XEvent*) ;; XEvent box
int
"___result = ___arg1->xmotion.x_root;"))
(define XMotionEvent-y-root
(c-lambda (XEvent*) ;; XEvent box
int
"___result = ___arg1->xmotion.y_root;"))
(define XMotionEvent-state
(c-lambda (XEvent*) ;; XEvent box
unsigned-int
"___result = ___arg1->xmotion.state;"))
(define XMotionEvent-is-hint
(c-lambda (XEvent*) ;; XEvent box
char
"___result = ___arg1->xmotion.is_hint;"))
(define XMotionEvent-same-screen
(c-lambda (XEvent*) ;; XEvent box
bool
"___result = ___arg1->xmotion.same_screen;"))
(define XCrossingEvent-root
(c-lambda (XEvent*) ;; XEvent box
Window
"___result = ___arg1->xcrossing.root;"))
(define XCrossingEvent-subwindow
(c-lambda (XEvent*) ;; XEvent box
Window
"___result = ___arg1->xcrossing.subwindow;"))
(define XCrossingEvent-time
(c-lambda (XEvent*) ;; XEvent box
Time
"___result = ___arg1->xcrossing.time;"))
(define XCrossingEvent-x
(c-lambda (XEvent*) ;; XEvent box
int
"___result = ___arg1->xcrossing.x;"))
(define XCrossingEvent-y
(c-lambda (XEvent*) ;; XEvent box
int
"___result = ___arg1->xcrossing.y;"))
(define XCrossingEvent-x-root
(c-lambda (XEvent*) ;; XEvent box
int
"___result = ___arg1->xcrossing.x_root;"))
(define XCrossingEvent-y-root
(c-lambda (XEvent*) ;; XEvent box
int
"___result = ___arg1->xcrossing.y_root;"))
(define XCrossingEvent-mode
(c-lambda (XEvent*) ;; XEvent box
int
"___result = ___arg1->xcrossing.mode;"))
(define XCrossingEvent-detail
(c-lambda (XEvent*) ;; XEvent box
int
"___result = ___arg1->xcrossing.detail;"))
(define XCrossingEvent-same-screen
(c-lambda (XEvent*) ;; XEvent box
bool
"___result = ___arg1->xcrossing.same_screen;"))
(define XCrossingEvent-focus
(c-lambda (XEvent*) ;; XEvent box
bool
"___result = ___arg1->xcrossing.focus;"))
(define XCrossingEvent-state
(c-lambda (XEvent*) ;; XEvent box
unsigned-int
"___result = ___arg1->xcrossing.state;"))
(define XConfigureEvent-x
(c-lambda (XEvent*) ;; XEvent box
int
"___result = ___arg1->xconfigure.x;"))
(define XConfigureEvent-y
(c-lambda (XEvent*) ;; XEvent box
int
"___result = ___arg1->xconfigure.y;"))
(define XConfigureEvent-width
(c-lambda (XEvent*) ;; XEvent box
int
"___result = ___arg1->xconfigure.width;"))
(define XConfigureEvent-height
(c-lambda (XEvent*) ;; XEvent box
int
"___result = ___arg1->xconfigure.height;"))
(define XConfigureEvent-border-width
(c-lambda (XEvent*) ;; XEvent box
int
"___result = ___arg1->xconfigure.border_width;"))
(define XResizeRequestEvent-width
(c-lambda (XEvent*) ;; XEvent box
int
"___result = ___arg1->xresizerequest.width;"))
(define XResizeRequestEvent-height
(c-lambda (XEvent*) ;; XEvent box
int
"___result = ___arg1->xresizerequest.height;"))
(define XLookupString
(c-lambda (XEvent*) ;; event_struct (XKeyEvent)
KeySym
#<<end-of-c-lambda
char buf[10];
KeySym ks;
XComposeStatus cs;
int n = XLookupString (___CAST(XKeyEvent*,___arg1),
buf,
sizeof (buf),
&ks,
&cs);
___result = ks;
end-of-c-lambda
))
(define (convert-XEvent ev)
(and ev
(let ((type (XAnyEvent-type ev)))
(cond ((or (##fx= type KeyPress)
(##fx= type KeyRelease))
(##list
(if (##fx= type KeyPress)
'XKeyPressedEvent
'XKeyReleasedEvent)
type
(XAnyEvent-serial ev)
(XAnyEvent-send-event ev)
(XAnyEvent-display ev)
(XAnyEvent-window ev)
(XKeyEvent-root ev)
(XKeyEvent-subwindow ev)
(XKeyEvent-time ev)
(XKeyEvent-x ev)
(XKeyEvent-y ev)
(XKeyEvent-x-root ev)
(XKeyEvent-y-root ev)
(XKeyEvent-state ev)
(XKeyEvent-keycode ev)
(XKeyEvent-same-screen ev)
(XLookupString ev)))
((or (##fx= type ButtonPress)
(##fx= type ButtonRelease))
(##list
(if (##fx= type ButtonPress)
'XButtonPressedEvent
'XButtonReleasedEvent)
type
(XAnyEvent-serial ev)
(XAnyEvent-send-event ev)
(XAnyEvent-display ev)
(XAnyEvent-window ev)
(XButtonEvent-root ev)
(XButtonEvent-subwindow ev)
(XButtonEvent-time ev)
(XButtonEvent-x ev)
(XButtonEvent-y ev)
(XButtonEvent-x-root ev)
(XButtonEvent-y-root ev)
(XButtonEvent-state ev)
(XButtonEvent-button ev)
(XButtonEvent-same-screen ev)))
((##fx= type MotionNotify)
(##list
'XPointerMovedEvent
type
(XAnyEvent-serial ev)
(XAnyEvent-send-event ev)
(XAnyEvent-display ev)
(XAnyEvent-window ev)
(XMotionEvent-root ev)
(XMotionEvent-subwindow ev)
(XMotionEvent-time ev)
(XMotionEvent-x ev)
(XMotionEvent-y ev)
(XMotionEvent-x-root ev)
(XMotionEvent-y-root ev)
(XMotionEvent-state ev)
(XMotionEvent-is-hint ev)
(XMotionEvent-same-screen ev)))
((or (##fx= type EnterNotify)
(##fx= type LeaveNotify))
(##list
(if (##fx= type EnterNotify)
'XEnterWindowEvent
'XLeaveWindowEvent)
type
(XAnyEvent-serial ev)
(XAnyEvent-send-event ev)
(XAnyEvent-display ev)
(XAnyEvent-window ev)
(XCrossingEvent-root ev)
(XCrossingEvent-subwindow ev)
(XCrossingEvent-time ev)
(XCrossingEvent-x ev)
(XCrossingEvent-y ev)
(XCrossingEvent-x-root ev)
(XCrossingEvent-y-root ev)
(XCrossingEvent-mode ev)
(XCrossingEvent-detail ev)
(XCrossingEvent-same-screen ev)
(XCrossingEvent-focus ev)
(XCrossingEvent-state ev)))
((##fx= type ConfigureNotify)
(##list
'XConfigureEvent
type
(XAnyEvent-serial ev)
(XAnyEvent-send-event ev)
(XAnyEvent-display ev)
(XAnyEvent-window ev)
(XConfigureEvent-x ev)
(XConfigureEvent-y ev)
(XConfigureEvent-width ev)
(XConfigureEvent-height ev)
(XConfigureEvent-border-width ev)))
((##fx= type ResizeRequest)
(##list
'XResizeRequestEvent
type
(XAnyEvent-serial ev)
(XAnyEvent-send-event ev)
(XAnyEvent-display ev)
(XAnyEvent-window ev)
(XResizeRequestEvent-width ev)
(XResizeRequestEvent-height ev)))
(else
#f)))))
;;;============================================================================
| false |
661127fa8c1f697fdca3cd3938e05871328f3750 | 000dbfe5d1df2f18e29a76ea7e2a9556cff5e866 | /sitelib/net/oauth/request-adapter.scm | 465ed7e19d2b36c8badf1662ab2f76ab5fd97dfb | [
"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 | 4,315 | scm | request-adapter.scm | ;;; -*- mode:scheme; coding:utf-8; -*-
;;;
;;; parameters.scm - OAuth 1.0 library.
;;;
;;; Copyright (c) 2010-2012 Takashi Kato <[email protected]>
;;;
;;; Redistribution and use in source and binary forms, with or without
;;; modification, are permitted provided that the following conditions
;;; are met:
;;;
;;; 1. Redistributions of source code must retain the above copyright
;;; notice, this list of conditions and the following disclaimer.
;;;
;;; 2. Redistributions in binary form must reproduce the above copyright
;;; notice, this list of conditions and the following disclaimer in the
;;; documentation and/or other materials provided with the distribution.
;;;
;;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
;;; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
;;; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
;;; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
;;; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
;;; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
;;; TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
;;; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
;;; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;;;
(library (net oauth request-adapter)
(export <request-adapter>
make-request-adapter
*request-adapter*
init-request-adapter
*request*
request
request-method
request-uri
abort-request
auth-parameters
post-parameters
get-parameters)
(import (rnrs)
(clos user)
(sagittarius mop validator)
(srfi :39 parameters))
(define (check-procedure o v)
(or (procedure? v)
(assertion-violation 'check-procedure
"argument must be a procedure" o v))
v)
(define-class <request-adapter> (<validator-mixin>)
;; all slots must be procredures
((request-object :init-keyword :request-object
:accessor request-adapter-request-object
:validator check-procedure)
(request-method :init-keyword :request-method
:accessor request-adapter-request-method
:validator check-procedure)
(request-uri :init-keyword :request-uri
:accessor request-adapter-request-uri
:validator check-procedure)
(abort-request :init-keyword :abort-request
:accessor request-adapter-abort-request
:validator check-procedure)
(auth-parameters :init-keyword :auth-parameters
:accessor request-adapter-auth-parameters
:validator check-procedure)
(post-parameters :init-keyword :post-parameters
:accessor request-adapter-post-parameters
:validator check-procedure)
(get-parameters :init-keyword :get-parameters
:accessor request-adapter-get-parameters
:validator check-procedure))
)
(define (make-request-adapter . args)
(apply make <request-adapter> args))
(define *request-adapter* (make-parameter #f))
(define (init-request-adapter adapter) (*request-adapter* adapter))
(define *request* (make-parameter #f))
(define (request)
(or (*request*)
((request-adapter-request-object (*request-adapter*)))))
;; must be captal letter request method symbol
(define (request-method :optional (request (request)))
((request-adapter-request-method (*request-adapter*)) request))
;; must be uri string
(define (request-uri :optional (request (request)))
((request-adapter-request-uri (*request-adapter*)) request))
(define (auth-parameters :optional (request (request)))
((request-adapter-auth-parameters (*request-adapter*)) request))
(define (post-parameters :optional (request (request)))
((request-adapter-post-parameters (*request-adapter*)) request))
(define (get-parameters :optional (request (request)))
((request-adapter-get-parameters (*request-adapter*)) request))
;; Return the string RESULT immediately from the request handler.
(define (abort-request result)
((request-adapter-abort-request *request-adapter*) result))
) | false |