blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 3
171
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
8
| license_type
stringclasses 2
values | repo_name
stringlengths 6
82
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 13
values | visit_date
timestamp[ns] | revision_date
timestamp[ns] | committer_date
timestamp[ns] | github_id
int64 1.59k
594M
⌀ | star_events_count
int64 0
77.1k
| fork_events_count
int64 0
33.7k
| gha_license_id
stringclasses 12
values | gha_event_created_at
timestamp[ns] | gha_created_at
timestamp[ns] | gha_language
stringclasses 46
values | src_encoding
stringclasses 14
values | language
stringclasses 2
values | is_vendor
bool 2
classes | is_generated
bool 1
class | length_bytes
int64 4
7.87M
| extension
stringclasses 101
values | filename
stringlengths 2
149
| content
stringlengths 4
7.87M
| has_macro_def
bool 2
classes |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c44f3d76f120c2201edb54079ed3b9a954d7f990
|
370ebaf71b077579ebfc4d97309ce879f97335f7
|
/littleSchemer/testsCh6.sld
|
f0fba3c66fccf312757d72edfbc5072b69ce967e
|
[] |
no_license
|
jgonis/sicp
|
7f14beb5b65890a86892a05ba9e7c59fc8bceb80
|
fd46c80b98c408e3fd18589072f02ba444d35f53
|
refs/heads/master
| 2023-08-17T11:52:23.344606 | 2023-08-13T22:20:42 | 2023-08-13T22:20:42 | 376,708,557 | 0 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 1,325 |
sld
|
testsCh6.sld
|
(include "littleSchemerCh6.sld")
(define-library (little-schemer tests ch6)
(export run-tests-ch6)
(import (scheme base)
(scheme write)
(srfi 78)
(little-schemer ch6))
(begin
(define run-tests-ch6
(lambda ()
(test-numbered?)
(test-value)
(test-prefix-value)
(test-alt-value)))
(define test-numbered?
(lambda ()
(check (numbered? 1)
=> #t)
(check (numbered? '(3 + (4 ^ 5)))
=> #t)
(check (numbered? '(2 * sausage))
=> #f)))
(define test-value
(lambda ()
(check (value 13)
=> 13)
(check (value '(1 + 3))
=> 4)
(check (value '(1 + (3 ^ 4)))
=> 82)
(check (value '((3 * 6) + (8 ^ 2)))
=> 82)))
(define test-prefix-value
(lambda ()
(check (prefix-value '(+ 3 4))
=> 7)
(check (prefix-value 3) => 3)
(check (prefix-value '(+ (* 3 6) (^ 8 2)))
=> 82)))
(define test-alt-value
(lambda ()
(check (alt-value '(+ 3 4))
=> 7)
(check (alt-value 3) => 3)
(check (alt-value '(+ (* 3 6) (^ 8 2)))
=> 82)))))
| false |
01d1db5f9882e96f2309b7af67cafb120c1e9cd6
|
c754c7467be397790a95c677a9ef649519be59fa
|
/src/chap5/enhance-simulator.scm
|
b57ef3597cd92b82aedf06b742cf8cb0f2e5c1a7
|
[
"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 | 24,175 |
scm
|
enhance-simulator.scm
|
;; Creates a register that holds a value that can be accessed or changed
(define (make-register name)
(let ((contents '*unassigned*)
(tracing false)) ;; Exercise 5.18
(define (dispatch message)
(cond ((eq? message 'get) contents)
((eq? message 'set)
(lambda (value)
(if tracing
(begin (display (list name ': contents '=> value))
(newline))) ;; Exercise 5.18
(set! contents value)))
((eq? message 'trace-on) (set! tracing true)) ;; Exercise 5.18
((eq? message 'trace-off) (set! tracing false)) ;; Exercise 5.18
(else
(error "Unknown request: REGISTER" message))))
dispatch))
;; The following procedures are used to access registers
(define (get-contents register) (register 'get))
(define (set-contents! register value)
((register 'set) value))
;; Creates a stack whose local state consists of a list of the items on the stack.
;; A stack accepts requests to ~push~ an item onto the stack,
;; to ~pop~ the top item off the stack and return it,
;; and to ~initialize~ the stack to empty.
(define (make-stack)
(let ((s '())
(number-pushes 0)
(max-depth 0)
(current-depth 0))
(define (push x)
(set! s (cons x s))
(set! number-pushes (+ 1 number-pushes))
(set! current-depth (+ 1 current-depth))
(set! max-depth (max current-depth max-depth)))
(define (pop)
(if (null? s)
(error "Empty stack: POP")
(let ((top (car s)))
(set! s (cdr s))
(set! current-depth (- current-depth 1))
top)))
(define (initialize)
(set! s '())
(set! number-pushes 0)
(set! max-depth 0)
(set! current-depth 0)
'done)
(define (print-statistics)
(newline)
(display (list 'total-pushes '= number-pushes
'maximum-depth '= max-depth)))
(define (dispatch message)
(cond ((eq? message 'push) push)
((eq? message 'pop) (pop))
((eq? message 'initialize) (initialize))
((eq? message 'print-statistics)
(print-statistics))
(else (error "Unknown request: STACK" message))))
dispatch))
;; The following procedures are used to access stacks:
(define (pop stack) (stack 'pop))
(define (push stack value) ((stack 'push) value))
;; Constructs an object whose local state consists of a stack,
;; an initially empty instruction sequence, a list of operations
;; that initially contians an operation to initialize the stack,
;; and a register table that initially contains two registers,
;; named ~flag~ and ~pc~ (for "program counter").
(define (make-new-machine)
(let ((pc (make-register 'pc)) ;; determines the sequencing of instructions
(flag (make-register 'flag)) ;; controls branching
(stack (make-stack))
(the-instruction-sequence '())
(the-instruction-counter 0) ;; Exercise 5.15
(the-instruction-tracing false) ;; Exercise 5.16
(break-on true) ;; Exercise 5.19
(current-label '*unassigned*) ;; Exercise 5.19
(current-line 0) ;; Exercise 5.19
(breakpoint-line 0) ;; Exercise 5.19
(breakpoints '())) ;; Exercise 5.19
(let ((the-ops
(list (list 'initialize-stack
(lambda () (stack 'initialize))) ;; instruction execution procedure
(list 'print-stack-statistics
(lambda () (stack 'print-statistics)))))
(register-table
(list (list 'pc pc) (list 'flag flag))))
;; adds new entries to the register table
(define (allocate-register name)
(if (assoc name register-table)
(error "Multiply defined register: " name)
(set! register-table
(cons (list name (make-register name))
register-table)))
'register-allocated)
;; looks up registers in the table
(define (lookup-register name)
(let ((val (assoc name register-table)))
(if val
(cadr val)
(error "Unknown register: " name))))
;; gets that instruction, executes it be calling
;; the instruction execution procedure, and
;; repeats this cycle until there are no more
;; instructions to execute
(define (execute)
(let ((insts (get-contents pc)))
(if (null? insts)
'done
(let* ((inst (car insts))
(inst-text (instruction-text inst))
(inst-type (car inst-text))
(target (cadr inst-text))
(label (instruction-label inst))
(dest '*unassigned*))
(if (and (not (eq? label current-label))
(assoc label breakpoints))
(begin (set! current-label label)
(set! breakpoint-line (cadr (assoc current-label breakpoints)))
(set! current-line 0)))
(set! current-line (+ current-line 1))
(if (and (= current-line breakpoint-line) break-on)
(begin (set! break-on false)
(display (list 'breakpoint: current-label current-line))
(newline)
(enter-breakpoint-environment))
(begin
(if (or (and (eq? inst-type 'branch) (get-contents flag))
(and (eq? inst-type 'goto) (eq? (car target) 'label)))
(set! dest (cadr target)))
(if (and (eq? inst-type 'goto) (eq? (car target) 'reg))
(set! dest (get-contents (lookup-register (cadr target)))))
(if (not (eq? dest '*unassigned*))
(set! current-label '*unassigned*))
(if the-instruction-tracing
(begin (display inst-text)
(newline)
(if (not (eq? dest '*unassigned*))
(begin (display dest) (newline)))))
(set! break-on true)
((instruction-execution-proc inst))
(set! the-instruction-counter (+ the-instruction-counter 1))
(execute)))))))
;; Exercise 5.15
(define (print-instruction-counter-then-reset)
(display (list "Current instruction counting is: " the-instruction-counter))
(set! the-instruction-counter 0)
(newline))
;; Exercise 5.19
(define (cancel-breakpoint label offset)
(define (cancel-one bps)
(cond ((null? bps) '())
((equal? (list label offset) (car bps)) (cdr bps))
(else (cons (car bps) (cancel-one (cdr bps))))))
(set! breakpoints (cancel-one breakpoints))
(if (and (eq? current-label label) (not break-on))
(begin (set! current-label '*unassigned*)
(set! break-on true)))
'done)
;; Not necessary, but can save your time
(define (enter-breakpoint-environment)
(define (tokenize l)
(let loop ((t '())
(l l))
(if (pair? l)
(let ((c (car l)))
(if (char=? c #\space)
(cons (reverse t) (loop '() (cdr l)))
(loop (cons (car l) t) (cdr l))))
(if (null? t)
'()
(list (reverse t))))))
(define (string-split s)
(map list->string (tokenize (string->list s))))
(define (loop)
(newline)
(display "BPE> ") ;; stands breakpoint environment
(let* ((input (map string->symbol (string-split (read-line))))
(inst (car input))
(rest (cdr input)))
(cond ((member inst '(p print))
(display (get-contents (lookup-register (car rest))))
(loop))
((member inst '(c continue)) (execute))
((member inst '(n next))
(let ((insts (get-contents pc)))
(set-contents! pc (list (car insts)))
(execute)
(set-contents! pc (cdr insts))
(loop)))
((member inst '(a all))
(map (lambda (reg)
(display (list (car reg)
'=
(get-contents (cadr reg))))
(newline))
register-table)
(loop))
((member inst '(q quit)) (display "Leaving BPE...") (newline) 'done)
((member inst '(bps breakpoints))
(map (lambda (bp) (display bp) (newline)) breakpoints)
(loop)))))
(loop))
(define (dispatch message)
(cond ((eq? message 'start)
(set-contents! pc the-instruction-sequence)
(execute))
((eq? message 'install-instruction-sequence)
(lambda (seq)
(set! the-instruction-sequence seq)))
((eq? message 'allocate-register)
allocate-register)
((eq? message 'get-register)
lookup-register)
((eq? message 'install-operations)
(lambda (ops)
(set! the-ops (append the-ops ops))))
((eq? message 'stack) stack)
((eq? message 'operations) the-ops)
;; Exercise 5.15
((eq? message 'counter) (print-instruction-counter-then-reset))
;; Exercise 5.16
((eq? message 'trace-on) (set! the-instruction-tracing true) 'done)
((eq? message 'trace-off) (set! the-instruction-tracing false) 'done)
((eq? message 'reg-trace-on)
(lambda (reg-name)
((lookup-register reg-name) 'trace-on) 'done)) ;; Exercise 5.18
((eq? message 'reg-trace-off)
(lambda (reg-name)
((lookup-register reg-name) 'trace-off) 'done)) ;; Exercise 5.18
((eq? message 'set-breakpoint)
(lambda (label offset)
(set! breakpoints (cons (list label offset) breakpoints))
'done)) ;; Exercise 5.19
((eq? message 'proceed) (execute)) ;; Exercise 5.19
((eq? message 'cancel-breakpoint) cancel-breakpoint) ;; Exercise 5.19
((eq? message 'cancel)
(set! breakpoints '()) (set! break-on true) 'done) ;; Exercise 5.19
(else (error "Unknown request: MACHINE"
message))))
dispatch)))
;; Handles breakpoints, for Exercise 5.19
(define (set-breakpoint machine label n)
((machine 'set-breakpoint) label n))
(define (proceed-machine machine)
(machine 'proceed))
(define (cancel-breakpoint machine label n)
((machine 'cancel-breakpoint) label n))
(define (cancel-all-breakpoints machine)
(machine 'cancel))
;; Looks up the register with a given name in a given machine
(define (get-register machine reg-name)
((machine 'get-register) reg-name))
;; Exercise 5.18
(define (trace-register machine reg-name)
((machine 'reg-trace-on) reg-name))
(define (stop-tracing machine reg-name)
((machine 'reg-trace-off) reg-name))
(define (make-instruction-with-label text) (list text '*unassigned* '())) ;; Exercise 5.19
(define (instruction-text inst) (car inst))
(define (instruction-label inst) (cadr inst)) ;; Exercise 5.19
(define (set-instruction-label! inst label)
(set-cdr! inst (cons label (cddr inst)))) ;; Exercise 5.19
(define (instruction-execution-proc inst) (cddr inst)) ;; Exercise 5.19
(define (set-instruction-execution-proc! inst proc)
(set-cdr! inst (cons (cadr inst) proc))) ;; Exercise 5.19
(define (make-label-entry label-name insts)
(cons label-name
(map
(lambda (inst)
(if (eq? (instruction-label inst) '*unassigned*)
(set-instruction-label! inst label-name))
inst)
insts)))
(define (lookup-label labels label-name)
(let ((val (assoc label-name labels)))
(if val
(cdr val)
(error "Undefined label: ASSEMBLE"
label-name))))
(define (advance-pc pc)
(set-contents! pc (cdr (get-contents pc))))
(define (tagged-list? exp tag)
(if (pair? exp)
(eq? (car exp) tag)
false))
;; The syntax of ~reg~, ~label~, and ~const~ expressions is determined by
(define (register-exp? exp) (tagged-list? exp 'reg))
(define (register-exp-reg exp) (cadr exp))
(define (constant-exp? exp) (tagged-list? exp 'const))
(define (constant-exp-value exp) (cadr exp))
(define (label-exp? exp) (tagged-list? exp 'label))
(define (label-exp-label exp) (cadr exp))
;; Generates execution procedures to produce values for these expressions during the simulation
(define (make-primitive-exp exp machine labels)
(cond ((constant-exp? exp)
(let ((c (constant-exp-value exp)))
(lambda () c)))
((label-exp? exp)
(let ((insts (lookup-label
labels
(label-exp-label exp))))
(lambda () insts)))
((register-exp? exp)
(let ((r (get-register machine (register-exp-reg exp))))
(lambda () (get-contents r))))
(else (error "Unknown expression type: ASSEMBLE" exp))))
;; The syntax of operation expressions is determined by
(define (operation-exp? exp)
(and (pair? exp) (tagged-list? (car exp) 'op)))
(define (operation-exp-op operation-exp)
(cadr (car operation-exp)))
(define (operation-exp-operands operation-exp)
(cdr operation-exp))
;; Looking up the operation name in the operation table for the machine
(define (lookup-prim symbol operations)
(let ((val (assoc symbol operations)))
(if val
(cadr val)
(error "Unknown operation: ASSEMBLE"
symbol))))
;; Produces an execution procedure for an "operation expression"--a list containing
;; the operation and operand expressions from the instruction
(define (make-operation-exp exp machine labels operations)
(let ((op (lookup-prim (operation-exp-op exp)
operations))
(aprocs
(map (lambda (e)
(make-primitive-exp e machine labels))
(operation-exp-operands exp))))
(lambda ()
(apply op (map (lambda (p) (p)) aprocs)))))
;; handles ~assign~ instructions
(define (assign-reg-name assign-instruction)
(cadr assign-instruction))
(define (assign-value-exp assign-instruction)
(cddr assign-instruction))
(define (make-assign inst machine labels operations pc)
(let ((target
(get-register machine (assign-reg-name inst)))
(value-exp (assign-value-exp inst)))
(let ((value-proc
(if (operation-exp? value-exp)
(make-operation-exp
value-exp machine labels operations)
(make-primitive-exp
(car value-exp) machine labels))))
(lambda () ;; execution procedure for assign
(set-contents! target (value-proc))
(advance-pc pc)))))
;; handle ~test~ instructions
(define (test-condition test-instruction)
(cdr test-instruction))
;; Extracts the expression that specifies the condition to be tested
;; and generates an execution procedure for it.
(define (make-test inst machine labels operations flag pc)
(let ((condition (test-condition inst)))
(if (operation-exp? condition)
(let ((condition-proc
(make-operation-exp
condition machine labels operations)))
(lambda ()
(set-contents! flag (condition-proc))
(advance-pc pc)))
(error "Bad TEST instruction: ASSEMBLE" inst))))
;; handle ~branch~ instructions
(define (branch-dest branch-instruction)
(cadr branch-instruction))
;; Checks the contents of the ~flag~ register and either sets the contents of the ~pc~
;; to the branch destination (if the branch is taken) or else just advances the ~pc~
;; (if the branch is not taken).
;; Notice that the indicated destination in a ~branch~ instruction must be a label,
;; and the ~make-branch~ procedure enforces this.
(define (make-branch inst machine labels flag pc)
(let ((dest (branch-dest inst)))
(if (label-exp? dest)
(let ((insts
(lookup-label
labels
(label-exp-label dest))))
(lambda ()
(if (get-contents flag)
(set-contents! pc insts)
(advance-pc pc))))
(error "Bad BRANCH instruction: ASSEMBLE" inst))))
;; handle ~goto~ instructions
(define (goto-dest goto-instruction)
(cadr goto-instruction))
;; A ~goto~ instruction is similar to a branch, except that the destination
;; may be specified either as a label or as a register, and there is no condition
;; to check
(define (make-goto inst machine labels pc)
(let ((dest (goto-dest inst)))
(cond ((label-exp? dest)
(let ((insts (lookup-label
labels
(label-exp-label dest))))
(lambda () (set-contents! pc insts))))
((register-exp? dest)
(let ((reg (get-register
machine
(register-exp-reg dest))))
(lambda ()
(set-contents! pc (get-contents reg)))))
(else (error "Bad GOTO instruction: ASSEMBLE" inst)))))
;; The stack instructions ~save~ and ~restore~ simply use the stack with
;; the designated register and advance the ~pc~
(define (stack-inst-reg-name stack-instruction)
(cadr stack-instruction))
(define (make-save inst machine stack pc)
(let ((reg (get-register machine
(stack-inst-reg-name inst))))
(lambda ()
(push stack (get-contents reg))
(advance-pc pc))))
(define (make-restore inst machine stack pc)
(let ((reg (get-register machine
(stack-inst-reg-name inst))))
(lambda ()
(set-contents! reg (pop stack))
(advance-pc pc))))
;; Generates an execution procedure for the action to be performed.
(define (perform-action inst) (cdr inst))
(define (make-perform inst machine labels operations pc)
(let ((action (perform-action inst)))
(if (operation-exp? action)
(let ((action-proc
(make-operation-exp
action machine labels operations)))
(lambda () (action-proc) (advance-pc pc)))
(error "Bad PERFORM instruction: ASSEMBLE" inst))))
;; Exercise 5.10
;; new syntax likes: (add a (reg b)) or (add a (const 1))
(define (add-reg-name inst) (cadr inst))
(define (add-addend-val inst) (caddr inst))
(define (make-add inst machine pc)
(let ((target (get-register machine (add-reg-name inst)))
(addend (make-primitive-exp (add-addend-val inst) machine '())))
(lambda ()
(set-contents! target (+ (get-contents target) (addend)))
(advance-pc pc))))
;; Dispatches on the type of instruction to generate the appropriate execution procedure.
(define (make-execution-procedure
inst labels machine pc flag stack ops)
(let ((inst-type (car inst)))
(cond ((eq? inst-type 'assign)
(make-assign inst machine labels ops pc))
((eq? inst-type 'test)
(make-test inst machine labels ops flag pc))
((eq? inst-type 'branch)
(make-branch inst machine labels flag pc))
((eq? inst-type 'goto)
(make-goto inst machine labels pc))
((eq? inst-type 'save)
(make-save inst machine stack pc))
((eq? inst-type 'restore)
(make-restore inst machine stack pc))
((eq? inst-type 'perform)
(make-perform inst machine labels ops pc))
((eq? inst-type 'add)
(make-add inst machine pc))
(else
(error "Unknown instruction type: ASSEMBLE"
inst)))))
;; Takes as arguments a list ~text~ (the sequence of controller instruction expressions)
;; and a ~receive~ procedure.
;; ~receive~ will be called with two values:
;; (1) a list ~insts~ of instruction data structures, each containing an instruction from ~text~
;; (2) a table called ~labels~, which associates each label from ~text~ with the position
;; in the list ~insts~ that the label designates.
(define (extract-labels text receive)
(if (null? text)
(receive '() '())
(extract-labels
(cdr text)
(lambda (insts labels)
(let ((next-inst (car text)))
(if (symbol? next-inst)
(receive
(map (lambda (inst)
(if (eq? (instruction-label inst) '*unassigned*)
(set-instruction-label! inst label-name))
inst)
insts) ;; Exercise 5.19
(cons (make-label-entry next-inst
insts)
labels))
(receive (cons (make-instruction-with-label next-inst)
insts) ;; Exercise 5.19
labels)))))))
;; Modifies the instruction list, which initially contains only the text of the instructions,
;; to include the corresponding execution procedures
(define (update-insts! insts labels machine)
(let ((pc (get-register machine 'pc))
(flag (get-register machine 'flag))
(stack (machine 'stack))
(ops (machine 'operations)))
(for-each
(lambda (inst)
(set-instruction-execution-proc!
inst
(make-execution-procedure
(instruction-text inst)
labels machine pc flag stack ops)))
insts)))
;; The assemble procedure is the main entry to the assembler.
;; It takes the controller text and the machine model as arguments
;; and returns the instruction sequence to be stored in the model.
(define (assemble controller-text machine)
(extract-labels
controller-text
(lambda (insts labels)
(update-insts! insts labels machine)
insts)))
;; Construsts and returns a model of the machine
;; with the given registers, operations, and controller.
(define (make-machine register-names ops controller-text)
(let ((machine (make-new-machine)))
(for-each
(lambda (register-name)
((machine 'allocate-register) register-name))
register-names)
((machine 'install-operations) ops)
((machine 'install-instruction-sequence)
(assemble controller-text machine))
machine))
;; Stores a value in a simulated register in the given machine.
(define (set-register-contents! machine register-name value)
(set-contents! (get-register machine register-name)
value)
'done)
;; Returns the contents of a simulated register in the given machine.
(define (get-register-contents machine register-name)
(get-contents (get-register machine register-name)))
;; Simulates the execution of the given machine,
;; starting from the beginning of the controller sequence
;; and stopping when it reaches the end of the sequence.
(define (start machine) (machine 'start))
| false |
3ff8b430cc9bd8f44aec1e3d3645c58e9b1ce26a
|
9998f6f6940dc91a99e0e2acb4bc4e918f49eef0
|
/js-runtime/src/experiment.ss
|
3b9c2592502429f31496c1f39857f78417cc7c48
|
[] |
no_license
|
JessamynT/wescheme-compiler2012
|
326d66df382f3d2acbc2bbf70fdc6b6549beb514
|
a8587f9d316b3cb66d8a01bab3cf16f415d039e5
|
refs/heads/master
| 2020-05-30T07:16:45.185272 | 2016-03-19T07:14:34 | 2016-03-19T07:14:34 | 70,086,162 | 0 | 0 | null | 2016-10-05T18:09:51 | 2016-10-05T18:09:51 | null |
UTF-8
|
Scheme
| false | false | 862 |
ss
|
experiment.ss
|
#lang scheme
(require compiler/decompile
compiler/zo-parse
setup/dirs)
(require scheme/pretty)
(define (try e)
(pretty-print
(zo-parse (let-values ([(in out) (make-pipe)])
(write (parameterize ([current-namespace (make-base-namespace)])
(compile e))
out)
(close-output-port out)
in))))
(define more-scheme-decompiled
(zo-parse (open-input-file
(build-path (find-collects-dir)
"scheme/private/compiled/more-scheme_ss.zo"))))
#;(try '(lambda (q . more)
(letrec ([f (lambda (x) f)])
(lambda (g) f))))
(try '(begin
(define (thunk x)
(lambda ()
x))
(define (f x)
(* x x))
(f (f ((thunk 42))))))
| false |
b64e53613c719c341a25d7085418050a45f06cca
|
46244bb6af145cb393846505f37bf576a8396aa0
|
/sicp/5_24.scm
|
652f3dc6850c27a4c4c64d45337054801527e59f
|
[] |
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 | 886 |
scm
|
5_24.scm
|
#lang racket
#|
Exercise 5.24. Implement cond as a new basic special form without reducing it to if.
You will have to construct a loop that tests the predicates of successive cond clauses
until you find one that is true, and then use ev-sequence to evaluate the actions of the clause.
|#
ev-cond
(save continue)
(assign unev (op cond-body) (reg exp))
ev-loop
(test (op blank-cond-body) (reg unev))
(goto (label ev-done))
(assign exp (op cond-first-clause) (reg unev))
(save exp)
(assign exp (op cond-clause-predicate) (reg exp))
(assign continue (label cond-pred-chked))
(goto (label ev-dispatch))
cond-pred-chked
(save exp)
(test (op true?) (reg val))
(goto (label cond-pred-true))
(assign unev (op cond-rest-clause) (reg unev))
(goto (label ev-loop))
cond-pred-true
(assign continue (label ev-loop))
(goto (label ev-sequence))
ev-done
(restore continue)
(goto (reg continue))
| false |
e547f03c45c797609b3cfc75f031eb9f32837d58
|
bef204d0a01f4f918333ce8f55a9e8c369c26811
|
/src/tspl-6-Operations-on-Objects/6.14-Enumerations.ss
|
b21dd978eb69a86989bb880b2a102aa4b90a1e10
|
[
"MIT"
] |
permissive
|
ZRiemann/ChezSchemeNote
|
56afb20d9ba2dd5d5efb5bfe40410a5f7bb4e053
|
70b3dca5d084b5da8c7457033f1f0525fa6d41d0
|
refs/heads/master
| 2022-11-25T17:27:23.299427 | 2022-11-15T07:32:34 | 2022-11-15T07:32:34 | 118,701,405 | 5 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 3,454 |
ss
|
6.14-Enumerations.ss
|
#!/usr/bin/scheme --script
(display "
================================================================================
Section 5.14.Enumerations
")
(define-enumeration weather-element
(hot warm cold sunny rainy snowy windy)
weather)
(weather-element hot) ;; hot
;;(weather-element fun) ;; syntax violation
(weather hot sunny windy) ;; #<enum-set>
(enum-set->list (weather rainy cold rainy)) ;; (cold rainy)
(define weather-sub-set
(weather hot sunny windy))
(enum-set->list weather-sub-set)
(define weather-enum-set
(make-enumeration '(hot sunny)))
(enum-set->list weather-enum-set)
(define positions (make-enumeration '(top bottom above top beside)))
(enum-set->list positions) ;; (top bottom above beside)
positions
(define e1 (make-enumeration '(one two three four)))
(define p1 (enum-set-constructor e1))
(define e2 (p1 '(one three)))
(enum-set->list e2) ;; (one three)
;;; p2 的symbol集合是'(one two three four) 不是 '(one three),等价于p1
(define p2 (enum-set-constructor e2))
(define e3 (p2 '(one two four)))
(enum-set->list e3) ;; (one two four)
(define e4 (p2 '(one four two)))
(enum-set->list e4) ;; (one for two)
(define e1 (make-enumeration '(a b c a b c d)))
(enum-set->list (enum-set-universe e1)) ;; (a b c d)
(define e2 ((enum-set-constructor e1) '(c)))
(enum-set->list (enum-set-universe e2)) ;; (a b c d)
(define e1 (make-enumeration '(a b c a b c d)))
(enum-set->list e1) ;; (a b c d)
(define e2 ((enum-set-constructor e1) '(d c a b)))
(enum-set->list e2) ;; (a b c d)
(define e1 (make-enumeration '(a b c)))
(define e2 (make-enumeration '(a b c d e)))
(enum-set-subset? e1 e2) ;; #t
(enum-set-subset? e2 e1) ;; #f
;;; e3 是由 e2 集合枚举构造其 构造的,所以是e2的子集,但不是e1的子集
(define e3 ((enum-set-constructor e2) '(a c)))
(enum-set-subset? e3 e1) ;; #f
(enum-set-subset? e3 e2) ;; #t
;;; e3 是由 e1 集合枚举构造其 构造的,所以是e1的子集,
;;; 但e1是e2的子集,所以e4也是e2的子集
(define e4 ((enum-set-constructor e1) '(a c)))
(enum-set-subset? e4 e1) ;; #f
(enum-set-subset? e4 e2) ;; #t
(define e1 (make-enumeration '(a b c d)))
(define e2 ((enum-set-constructor e1) '(a c)))
(define e3 ((enum-set-constructor e1) '(b c)))
;;; e2 e3 具有公共的超级 e1,可以进行以下运算
(enum-set->list (enum-set-union e2 e3)) ;; (a b c)
(enum-set->list (enum-set-intersection e2 e3)) ;; (c)
(enum-set->list (enum-set-difference e2 e3)) ;; (a)
(enum-set->list (enum-set-difference e3 e2)) ;; (b)
;;; e4 , e5 不是 e1的子集,不能进行 并集、交集、差的运算
(define e4 (make-enumeration '(b d c a)))
(enum-set-union e1 e4) ;; exception: different enumeration types
(define e5 (make-enumeration '(a b c d e f g)))
(enum-set-union e1 e5)
(define e1 (make-enumeration '(a b c d)))
(enum-set->list (enum-set-complement e1)) ;; ()
(define e2 ((enum-set-constructor e1) '(a c)))
(enum-set->list (enum-set-complement e2)) ;; (b d)
(define e1 (make-enumeration '(a b c d)))
(define e2 (make-enumeration '(a b c d e f g)))
(define e3 ((enum-set-constructor e1) '(a d)))
(define e4 ((enum-set-constructor e2) '(a c e g)))
(enum-set->list (enum-set-projection e4 e3)) ;; (a c)
(enum-set->list
(enum-set-union e3
(enum-set-projection e4 e3))) ;; (a c d)
(define e1 (make-enumeration '(a b c d)))
(define e2 ((enum-set-constructor e1) '(a d)))
(define p (enum-set-indexer e2))
(list (p 'a) (p 'c) (p 'e)) ;; (0 2 #f)
| false |
f41ea9c56d04f03a17756236c9f85c9c61c33588
|
ac2a3544b88444eabf12b68a9bce08941cd62581
|
/gsc/tests/12-closure/makeadder.scm
|
969785bbf1c3f9fb4af524c2e21b972e6729305d
|
[
"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 | 164 |
scm
|
makeadder.scm
|
(declare (extended-bindings) (not constant-fold) (not safe))
(define (make-adder x)
(lambda (y) (##fx+ x y)))
(define inc (make-adder 1))
(println (inc 1000))
| false |
d14741385b8859ccb79422dbe7de9bcb74228ae4
|
c8e194dc9afc587a84051be05e710864dad1b6a6
|
/src/objects.scm
|
943246bcfb1478fa72da64df5fe4fc17b8bf03cb
|
[
"CC0-1.0",
"LicenseRef-scancode-other-permissive"
] |
permissive
|
hxa7241/minilight-scheme
|
39f32465d9dd7fcbacf6f2969737bb554a30b127
|
ba03ab8f40cf6a20ce591f22fa167b621658009c
|
refs/heads/master
| 2016-09-09T21:57:30.714104 | 2013-07-13T10:49:15 | 2013-07-13T10:49:15 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 4,972 |
scm
|
objects.scm
|
;------------------------------------------------------------------------------;
; ;
; MiniLight Scheme : minimal global illumination renderer ;
; Harrison Ainsworth / HXA7241 : 2010, 2011, 2013 ;
; ;
; http://www.hxa.name/minilight ;
; ;
;------------------------------------------------------------------------------;
;; Minimal basic object system.
;;
;; For ordinary standard R5RS Scheme, with no other dependencies.
;; (In only 22 lines.)
;;
;; An alternative to SRFI-9 Records:
;; * basically a dictionary data structure,
;; * with fields (for each instance) and methods (shared between instances),
;; * but no inheritance etc.
;; The main purpose was:
;; * concise member addressing -- using OO-style instance 'scope/namespace',
;; to cure the pitifully verbose member addressing of records.
;;
;; Example object definition:
;;
;; ;; constructor
;; ;; * using macro: defobject
;; ;; * referring to Class1 in the subsequent defclass
;; ;; * making an ad hoc set of fields for this particular instance
;; ;; * field definitions are evaluated sequentially, as in a let*
;; (define (Class1.create1 param1 param2)
;; (defobject Class1
;; (field1 param1)
;; (field2 param2)))
;;
;; ;; methods
;; ;; * using macro: defclass
;; ;; * making a set of methods to be shared between instances
;; (defclass Class1
;; (method (method1 self s)
;; (string-append "hi " s ", " (self 'field1))) ;; using self for field
;; (method (method2 self)
;; (self 'field2)))
;;
;; Class (i.e. non-instance) fields and methods can just be defined ordinarily,
;; since they do not need to have self fed through.
;;
;; Example instantiation and method call:
;; (must quote method name when calling)
;;
;; (let ((instance1 (Class1.create1 "where are you?" 42)))
;; (instance1 'method1 "John"))
;;
;; Limitation:
;; Method parameters with dotted tails are not supported.
;; (perhaps defclass needs another rule ...)
;;
;;
;; Implementation notes:
;;
;; Instead of a type predicate, a type query returning the type name could
;; easily be added: in defclass add a special first member of the list, as a
;; lambda named 'type and returning 'class. (Maybe it could be just a value, not
;; a lambda.)
;;
;; Inheritance could be a straightforward and minimal extension: have defclass
;; take parent parameters, which could then be added as a single list member to
;; its resultant methods list, and have Object.create search those parents if
;; it cannot find the member name in the instance (the fields and methods).
;; That would be the core of it anyway . . .
;; usage interface ---------------------------------------------------------- ;;
;; These mainly neaten the lexical representation a little -- nothing
;; substantial. They core purpose is to define an association-list.
;; Make an instance -- i.e. a set of fields, with a shared set of methods.
;;
(define-syntax defobject
(syntax-rules ()
((_ class (name field) ...)
;; sequentialise field definition
(let* ((name field) ...)
;; make association-list of fields
(let ((fields (list (cons 'name name) ...)))
;; make an object from the fields and methods lists
(Object.create class fields))))))
;; Make a set of methods (shareable between instances).
;;
(define-syntax defclass
(syntax-rules ()
((_ class (method (name param ...) expr1 ...) ...)
;; make association-list of methods
(define class (list (cons 'name (lambda (param ...) expr1 ...)) ...)))))
;; making class fields and methods can be done with normal defines
;; implementation ----------------------------------------------------------- ;;
;; Dispatcher.
;;
(define (Object.create methods fields)
;; make and return a lambda closing over the members,
;; and make it recursable so that called methods can themselves call it
(letrec ((self (lambda (name . params)
;; first search fields
(let ((field (assq name fields)))
(if field
(if (null? params)
;; no params: get field
(cdr field)
;; params: set field
(set-cdr! field (car params)))
;; no field, so search methods
(let ((method (assq name methods)))
(if method
;; call method
(apply (cdr method) (cons self params))
;; nothing found
'membernotfound)))))))
self))
| true |
2e597b3a56276ebfb55423cfdf1ea24f2e4f4269
|
203ad0bd8ae7276ddb4c12041b1644538957c386
|
/subst/unify.scm
|
9c9df6a62a62692c6a05b18ea5bc6bdbfebf06bd
|
[] |
no_license
|
lkuper/relational-research
|
b432a6a9b76723a603406998dcbe9f0aceace97c
|
7ab9955b08d2791fe63a08708415ae3f100f6df5
|
refs/heads/master
| 2021-01-25T10:07:27.074811 | 2010-05-15T04:13:07 | 2010-05-15T04:13:07 | 2,870,499 | 1 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 397 |
scm
|
unify.scm
|
(define unify-sv
(lambda (v^ w^ s)
(let ((v (walk v^ s))
(w (walk w^ s)))
(cond
((eq? v w) s)
((var? v) (ext-s v w s))
((var? w) (ext-s w v s))
((and (pair? v) (pair? w))
(let ((s (unify-sv (car v) (car w) s)))
(and s (unify-sv (cdr v) (cdr w) s))))
((equal? v w) s)
(else #f)))))
| false |
b490d3fa5be6aa5971c7f58cae6146d15da018be
|
296dfef11631624a5b2f59601bc7656e499425a4
|
/seth/seth/binary-pack/tests.sld
|
a47fa87f06ec38b1c3a48956b2afe5381755efe1
|
[] |
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 | 280 |
sld
|
tests.sld
|
(define-library (seth binary-pack tests)
(export run-tests)
(import (scheme base)
(snow bytevector)
(seth binary-pack)
(prefix (seth binary-pack) binary-))
(begin
(define (run-tests)
(binary-pack-u32 (make-bytevector 8) 0 4444 #f))))
| false |
95720177a186655db466b267970d88d2c39dd08e
|
3604661d960fac0f108f260525b90b0afc57ce55
|
/SICP-solutions/2/2.92x-var-change.scm
|
56567957dfb17106cd05716a43a38b6fcaeae10c
|
[] |
no_license
|
rythmE/SICP-solutions
|
b58a789f9cc90f10681183c8807fcc6a09837138
|
7386aa8188b51b3d28a663958b807dfaf4ee0c92
|
refs/heads/master
| 2021-01-13T08:09:23.217285 | 2016-09-27T11:33:11 | 2016-09-27T11:33:11 | 69,350,592 | 0 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 507 |
scm
|
2.92x-var-change.scm
|
(define (add-poly p1 p2)
(if (变量相同)
直接相加
(add-poly (change-var-a2b p1 p2) p2)
或者 (add-poly p1 (change-var-a2b p2 p1))
除外 直接相加))
(define (change-var-a2b a b)
递归找到b中与a主变量相同的变量,找到之时,
将寻找过程中的前一个变量乘到找到变量的系数中去
对得到的多项式以找到变量为主变量进行合并同类项,
然后对更高层变量继续此过程,直到找到变量变为主变量为止。)
| false |
f9b92813b3841addd358da3c0939740bb2eed397
|
d11ad5e19d63d2cf6ca69f12ecae02a9b9871ad3
|
/haskell/TypeCheckingTest.ss
|
c71e7e21b4ec58dbd8a75ab0c81240a4f779f0ef
|
[
"Apache-2.0"
] |
permissive
|
willfaught/sham1
|
3e708368a02ce8af204dbf26cc94f01e75ea39a8
|
371e9a6fd810628f8e9a79868b9f457bfcf8dc29
|
refs/heads/master
| 2022-08-28T20:46:09.904927 | 2022-08-18T22:04:51 | 2022-08-18T22:04:51 | 151,862 | 1 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 8,210 |
ss
|
TypeCheckingTest.ss
|
(module TypeCheckingTest scheme
(require (planet "main.ss" ("schematics" "schemeunit.plt" 3 3))
(lib "HaskellSyntax.ss" "sham" "haskell")
(lib "Maybe.ss" "sham" "haskell")
(lib "Parsing.ss" "sham" "haskell")
(lib "Transformation.ss" "sham" "haskell")
(lib "TypeChecking.ss" "sham" "haskell"))
(provide testSuite)
(define (eit name expression)
(test-case name (check-exn exn? (lambda () (syntaxType (transformSyntax (parseE expression)))))))
(define (ewt name expression type)
(test-case name (check-equal? (syntaxType (transformSyntax (parseE expression))) (parseT type))))
(define (mit name module)
(test-case name (check-exn exn? (lambda () (wellTyped (transformSyntax (parseM module)))))))
(define (mwt name module)
(test-case name (check-true (wellTyped (transformSyntax (parseM module))))))
(define testParsers (parsers "TypeCheckingTest"))
(define parseE (parser 'expression testParsers))
(define parseM (parser 'module testParsers))
(define parseT (parser 'type testParsers))
(define testSuite
(test-suite "TypeChecking"
(ewt "ap1" "(\\x -> 1) 1" "Int")
(ewt "ap2" "(\\x -> x) 1" "Int")
(ewt "ap3" "(\\x -> \\y -> x) 1" "t -> Int")
(ewt "ap4" "(\\x y -> x) 1" "t -> Int")
;(ewt "ap5" "(\\x -> [x]) 1" "[Int]")
(ewt "ap6" "(\\x -> (x, x)) 1" "(Int, Int)")
(ewt "ap7" "(\\x y -> 1) 2 3" "Int")
(eit "ap8" "1 2")
(eit "ap9" "(\\x -> x) 1 2")
(eit "ap10" "let { i x = x ; j = i 1 } in i 'a'")
(ewt "ch1" "'a'" "Char")
(mwt "da1" "module M where {}")
(mwt "da2" "module M where { data A = A { a :: A } | B { b :: A } | C ; c = B (A (B C)) }")
(mit "da3" "module M where { data A = A { a :: A } | B { b :: A } | C ; c = A 1 }")
(mit "da4" "module M where { data A = A { a :: A } | B { b :: A } | C ; c = B 1 }")
(mit "da5" "module M where { data A = A { a :: A } | B { b :: A } | C ; c = C 1 }")
(mit "da6" "module M where { data A = A { a :: A } | B { b :: A } | C ; c = A B }")
(mit "da7" "module M where { data A = A { a :: A } | B { b :: A } | C ; c = B A }")
(mwt "da8" "module M where { data A = A { a :: A } | B { b :: A } | C ; c = a (b (a (A (B (A C))))) ; d = a C ; e = b C }")
(mit "da9" "module M where { data A = A { a :: A } | B { b :: A } | C ; c = a 1 }")
(mit "da10" "module M where { data A = A { a :: A } | B { b :: A } | C ; c = b 1 }")
(mwt "da11" "module M where { data A = A { a :: A } | B { b :: A } | C ; c = isA (A C) ; d = isA (B C) ; e = isA C }")
(mwt "da12" "module M where { data A = A { a :: A } | B { b :: A } | C ; c = isB (A C) ; d = isB (B C) ; e = isB C }")
(mwt "da13" "module M where { data A = A { a :: A } | B { b :: A } | C ; c = isC (A C) ; d = isC (B C) ; e = isC C }")
(mit "da14" "module M where { data A = A { a :: A } | B { b :: A } | C ; c = isA 1 }")
(mit "da15" "module M where { data A = A { a :: A } | B { b :: A } | C ; c = isB 1 }")
(mit "da16" "module M where { data A = A { a :: A } | B { b :: A } | C ; c = isC 1 }")
(mwt "da17" "module M where { data A = A { a :: B } | B ; data B = C { b :: A } | D ; c = A (C B) ; d = A D ; e = C (A D) ; f = C B }")
(mwt "da18" "module M where { data A b = C ; d = C }")
(mwt "da19" "module M where { data A b = C | D { e :: b, f :: A b } ; g = C ; h = D 1 C ; i = D 1 (D 1 C) }")
(mit "da20" "module M where { data A b = C | D { e :: b, f :: A b } ; g = D 1 (D 'a' C) }")
(ewt "fl1" "1.2" "Float")
(ewt "fu1" "\\x -> 1" "t -> Int")
(ewt "fu2" "\\x -> x" "t -> t")
(ewt "fu3" "\\x -> \\y -> x" "t -> t1 -> t")
(ewt "fu4" "\\x y -> x" "t -> t1 -> t")
(ewt "fu5" "\\x -> \\y -> y" "t -> t1 -> t1")
(ewt "fu6" "\\x y -> y" "t -> t1 -> t1")
;(ewt "fu7" "\\x -> [x]" "t -> [t]")
(ewt "fu8" "\\x -> (x, x)" "t -> (t, t)")
(eit "id1" "x")
;(ewt "id2" "error" "[Char] -> t")
;(ewt "id3" "fst" "(t, t1) -> t")
;(ewt "id4" "head" "[t] -> t")
;(ewt "id5" "isFalse" "Bool -> Bool")
;(ewt "id6" "isTrue" "Bool -> Bool")
;(ewt "id7" "null" "[t] -> Bool")
;(ewt "id8" "snd" "(t, t1) -> t1")
;(ewt "id9" "tail" "[t] -> [t]")
;(ewt "id10" "False" "Bool")
;(ewt "id11" "True" "Bool")
;(ewt "id12" "(:)" "t -> [t] -> [t]")
(ewt "id13" "()" "()")
;(ewt "if1" "if True then 1 else 2" "Int")
(eit "if2" "if 1 then 2 else 3")
(eit "if3" "if True then 1 else 'a'")
(ewt "in1" "1" "Int")
(ewt "le1" "let { i = 1 } in 2.3" "Float")
(ewt "le2" "let { i = 1 } in i" "Int")
(ewt "le3" "let { i = i } in i" "t")
(ewt "le4" "let { i = 2 ; j = i } in j" "Int")
(ewt "le5" "let { i = j ; j = 2 } in j" "Int")
(ewt "le6" "let { i x = 2 } in i" "t -> Int")
(ewt "le7" "let { i x = x } in i" "t -> t")
(ewt "le8" "let { i x y = y } in i" "t -> t1 -> t1")
(ewt "le9" "let { i x = x ; j = i 2; k = i 3 } in i" "Int -> Int")
(ewt "le10" "let { i x = 2 } in i 3" "Int")
(ewt "le11" "let { i x = x } in i 2" "Int")
(ewt "le12" "let { i x = x } in let { j = i 2 ; k = i 3.4 } in i" "t -> t")
(ewt "le13" "let { i x = x } in let { j = i 2 ; k = i 3.4 } in j" "Int")
(eit "le16" "let { i = [i] } in i")
(eit "le17" "let { i = (i, i) } in i")
(eit "le18" "let { i x = x ; j = i 1 ; k = i 2.3 } in i")
(ewt "li1" "[]" "[t]")
;(ewt "li2" "[1]" "[Int]")
(ewt "li3" "\"\"" "[t]")
;(ewt "li4" "\"foo\"" "[Char]")
(eit "li5" "[1, 'a']")
(mwt "mo1" "module M where {}")
(mwt "mo2" "module M where { i = 1 }")
(mwt "mo3" "module M where { i = i }")
(mwt "mo4" "module M where { i x = 1 }")
(mwt "mo5" "module M where { i x = x }")
(mwt "mo6" "module M where { i x y = x }")
(mwt "mo7" "module M where { i = 1 ; j = i }")
(mwt "mo8" "module M where { i = j ; j = 1 }")
(mwt "mo9" "module M where { i = j ; j = i }")
(mwt "mo10" "module M where { i = 1 ; j = i }")
(mwt "mo11" "module M where { i x = x ; j = i 1 }")
(mit "mo12" "module M where { i = 1 ; j = i 2 }")
(mit "mo13" "module M where { i x = x ; j = i 1 2 }")
(mwt "mo14" "module M where { i x = x ; j = i 1 ; k = 2 }")
(mit "mo15" "module M where { i x = x ; j = i 1 ; k = i 'a' }")
(mwt "mo16" "module M where { i = let { i x = x } in i ; j = i 1 }")
(mit "mo17" "module M where { i = [i] }")
(mit "mo18" "module M where { i = (i, i) }")
(ewt "tu1" "('a', 1)" "(Char, Int)")
(ewt "tu2" "('b', 1, 1)" "(Char, Int, Int)")
(ewt "tc1" "(,)" "t -> t1 -> (t, t1)")
(ewt "tc2" "(,,)" "t -> t1 -> t2 -> (t, t1, t2)")
(ewt "tc3" "(,) 1" "t -> (Int, t)")
(ewt "tc4" "(,) 1 2" "(Int, Int)")
(ewt "tc5" "(,,) 1" "t -> t1 -> (Int, t, t1)")
(ewt "tc6" "(,,) 1 2" "t -> (Int, Int, t)")
(ewt "tc7" "(,,) 1 2 3" "(Int, Int, Int)")
(eit "tc8" "(,) 1 2 3")
(eit "tc9" "(,,) 1 2 3 4"))))
| false |
d756dd6d66ca0aa1bc98d60d1f6dd8048e6d9ef8
|
29fd1454d19dc5682f751cff58e85023fe1a311d
|
/scheme/comb1.scm
|
8859ab0b41577ab06fb25aca96a516fc6ed38847
|
[] |
no_license
|
rags/playground
|
5513c5fac66900e54a6d9f319defde7f6b34be5e
|
826ad4806cacffe1b3eed4b43a2541e273e8c96f
|
refs/heads/master
| 2023-02-03T04:30:46.392606 | 2023-01-25T13:45:42 | 2023-01-25T13:45:42 | 812,057 | 0 | 6 | null | 2022-11-24T04:54:25 | 2010-08-02T10:39:19 |
Python
|
UTF-8
|
Scheme
| false | false | 951 |
scm
|
comb1.scm
|
(define (combination denominations amount)
(define (subcomb combs amt mult denoms)
(if (null? denoms) combs
(append combs
(map (λ (x) (cons mult x))
(combination (cdr denoms) (- amt (* mult (car denoms))))))))
(define (iter mult denoms amt combs)
(cond
((<= (length denoms) 1) (cons `(,mult) combs))
((= mult 0) (subcomb combs amt mult denoms))
(else (iter (- mult 1) denoms amt (subcomb combs amt mult denoms)))))
(if (null? denominations) `(())
(iter (quotient amount (car denominations)) denominations amount `())))
(= 242 (length (combination `(25 10 5 1) 100)))
(= 40 (length (combination `(50 25 10 5) 100)))
(equal? `((1)) (combination `(25) 25))
(equal? `((0 1 1 1) (0 1 0 6) (0 0 3 1) (0 0 2 6) (0 0 1 11) (0 0 0 16)) (combination `(25 10 5 1) 16))
(equal? (combination `(50 25 10 5 1) 10) `((0 0 1 0 0) (0 0 0 2 0) (0 0 0 1 5) (0 0 0 0 10)))
| false |
d94ea08a332316a0f9e9f41681be5f6bd58ed129
|
000dbfe5d1df2f18e29a76ea7e2a9556cff5e866
|
/sitelib/srfi/%3a99/records/syntactic.scm
|
739859865f7e5aebbf182a6e413c2baaf694487b
|
[
"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 | 11,594 |
scm
|
syntactic.scm
|
;;; -*- mode:scheme; coding:utf-8; -*-
;;;
;;; srfi/%3a99.scm/records/syntactic.scm - ERR5RS records
;;;
;;; Copyright (c) 2016 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.
;;;
;; Original copyright
;; Copyright (C) William D Clinger 2008. 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. REMEMBER, THERE IS
;; NO SCHEME UNDERGROUND. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
;; OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
;; THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
(library (srfi :99 records syntactic)
(export define-record-type)
(import (for (rnrs base) run expand)
(for (rnrs lists) run expand)
(for (rnrs syntax-case) run expand)
(srfi :99 records procedural))
(define-syntax define-record-type
(syntax-rules ()
((_ (type-name parent) constructor-spec predicate-spec . field-specs)
(define-record-type-helper0
type-name parent constructor-spec predicate-spec . field-specs))
((_ type-name constructor-spec predicate-spec . field-specs)
(define-record-type-helper0
type-name #f constructor-spec predicate-spec . field-specs))))
(define-syntax define-record-type-helper0
(lambda (x)
; Given syntax objects, passes them to helper macro.
(define (construct-record-type-definitions
tname fields parent cspec pred afields mfields)
(let ()
(define (frob x)
(cond ((identifier? x)
x)
((pair? x)
(cons (frob (car x)) (frob (cdr x))))
((vector? x)
(vector-map frob x))
(else
(datum->syntax tname x))))
#`(#,(frob #'define-record-type-helper)
#,(frob tname)
#,(frob fields)
#,(frob parent)
#,(frob cspec)
#,(frob pred)
#,(frob afields)
#,(frob mfields))))
; Given a syntax object that represents a non-empty list,
; returns the syntax object for its first element.
(define (syntax-car x)
(syntax-case x ()
((x0 x1 ...)
#'x0)))
; Given a syntax object that represents a non-empty list,
; returns the syntax object obtained by omitting the first
; element of that list.
(define (syntax-cdr x)
(syntax-case x ()
((x0 x1 ...)
#'(x1 ...))))
; Given a syntax object that represents a non-empty list,
; returns the corresponding list of syntax objects.
(define (syntax->list x)
(syntax-case x ()
(()
x)
((x0)
x)
((x0 . x1)
(cons #'x0 (syntax->list #'x1)))))
(define (complain)
(syntax-violation 'define-record-type "illegal syntax" x))
; tname and pname are always identifiers here.
(syntax-case x ()
((_ tname pname constructor-spec predicate-spec . field-specs)
(let* ((type-name (syntax->datum #'tname))
(cspec (syntax->datum #'constructor-spec))
(pspec (syntax->datum #'predicate-spec))
(fspecs (syntax->datum #'field-specs))
(type-name-string
(begin (if (not (symbol? type-name))
(complain))
(symbol->string type-name)))
(constructor-name
(cond ((eq? cspec #f)
#'constructor-spec)
((eq? cspec #t)
(datum->syntax
#'tname
(string->symbol
(string-append "make-" type-name-string))))
((symbol? cspec)
#'constructor-spec)
((and (pair? cspec) (symbol? (car cspec)))
(syntax-car #'constructor-spec))
(else (complain))))
(constructor-args
(cond ((pair? cspec)
(if (not (for-all symbol? cspec))
(complain)
(list->vector
(syntax->list (syntax-cdr #'constructor-spec)))))
(else #f)))
(new-constructor-spec
(if constructor-args
(list constructor-name constructor-args)
constructor-name))
(predicate-name
(cond ((eq? pspec #f)
#'predicate-spec)
((eq? pspec #t)
(datum->syntax
#'tname
(string->symbol
(string-append type-name-string "?"))))
((symbol? pspec)
#'predicate-spec)
(else (complain))))
(field-specs
(map (lambda (fspec field-spec)
(cond ((symbol? fspec)
(list 'immutable
fspec
(string->symbol
(string-append
type-name-string
"-"
(symbol->string fspec)))))
((not (pair? fspec))
(complain))
((not (list? fspec))
(complain))
((not (for-all symbol? fspec))
(complain))
((null? (cdr fspec))
(list 'mutable
(car fspec)
(string->symbol
(string-append
type-name-string
"-"
(symbol->string (car fspec))))
(string->symbol
(string-append
type-name-string
"-"
(symbol->string (car fspec))
"-set!"))))
((null? (cddr fspec))
(list 'immutable
(car fspec)
(syntax-car (syntax-cdr field-spec))))
((null? (cdddr fspec))
(list 'mutable
(car fspec)
(syntax-car (syntax-cdr field-spec))
(syntax-car (syntax-cdr
(syntax-cdr field-spec)))))
(else (complain))))
fspecs
(syntax->list #'field-specs)))
(fields (list->vector (map cadr field-specs)))
(accessor-fields
(map (lambda (x) (list (caddr x) (cadr x)))
(filter (lambda (x) (>= (length x) 3))
field-specs)))
(mutator-fields
(map (lambda (x) (list (cadddr x) (cadr x)))
(filter (lambda (x) (= (length x) 4))
field-specs))))
(construct-record-type-definitions
#'tname
fields
#'pname
new-constructor-spec
predicate-name
accessor-fields
mutator-fields))))))
(define-syntax define-record-type-helper
(syntax-rules ()
((_ type-name fields parent #f predicate
((accessor field) ...) ((mutator mutable-field) ...))
(define-record-type-helper
type-name fields parent ignored predicate
((accessor field) ...) ((mutator mutable-field) ...)))
((_ type-name fields parent constructor #f
((accessor field) ...) ((mutator mutable-field) ...))
(define-record-type-helper
type-name fields parent constructor ignored
((accessor field) ...) ((mutator mutable-field) ...)))
((_ type-name fields parent (constructor args) predicate
((accessor field) ...) ((mutator mutable-field) ...))
(begin (define type-name (make-rtd 'type-name 'fields parent))
(define constructor (rtd-constructor type-name 'args))
(define predicate (rtd-predicate type-name))
(define accessor (rtd-accessor type-name 'field))
...
(define mutator (rtd-mutator type-name 'mutable-field))
...))
((_ type-name fields parent constructor predicate
((accessor field) ...) ((mutator mutable-field) ...))
(begin (define type-name (make-rtd 'type-name 'fields parent))
(define constructor (rtd-constructor type-name))
(define predicate (rtd-predicate type-name))
(define accessor (rtd-accessor type-name 'field))
...
(define mutator (rtd-mutator type-name 'mutable-field))
...))))
)
| true |
3a9575875be41a2cff9f812ff3d63d07d7fdab01
|
d9cb7af1bdc28925fd749260d5d643925185b084
|
/test/2.36.scm
|
08e53bcee69a75ce386a2466582bf744b596e44a
|
[] |
no_license
|
akerber47/sicp
|
19e0629df360e40fd2ea9ba34bf7bd92be562c3e
|
9e3d72b3923777e2a66091d4d3f3bfa96f1536e0
|
refs/heads/master
| 2021-07-16T19:36:31.635537 | 2020-07-19T21:10:54 | 2020-07-19T21:10:54 | 14,405,303 | 0 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 535 |
scm
|
2.36.scm
|
(define (run)
(let ((s1 '(1 2 3))
(s2 '(2 3 4))
(s3 '(1 3 5 7 9))
(s4 '(3)))
(assert (equal? (union-set s1 s2) '(1 2 3 4)))
(assert (equal? (union-set s2 s1) '(1 2 3 4)))
(assert (equal? (union-set s1 s3) '(1 2 3 5 7 9)))
(assert (equal? (union-set s3 s2) '(1 2 3 4 5 7 9)))
(assert (equal? (union-set s1 s4) '(1 2 3)))
(assert (equal? (union-set s4 s4) '(3)))
(assert (equal? (union-set s4 ()) '(3)))
(assert (equal? (union-set () s1) '(1 2 3)))
"All tests passed!"
)
)
| false |
95e703fef46ddf03449e12dde52ef2125170daf3
|
c3523080a63c7e131d8b6e0994f82a3b9ed901ce
|
/hertfordstreet/schemes/yesornogui.ss
|
46e62027d6c67f113399b57de4c135bfbf1ff259
|
[] |
no_license
|
johnlawrenceaspden/hobby-code
|
2c77ffdc796e9fe863ae66e84d1e14851bf33d37
|
d411d21aa19fa889add9f32454915d9b68a61c03
|
refs/heads/master
| 2023-08-25T08:41:18.130545 | 2023-08-06T12:27:29 | 2023-08-06T12:27:29 | 377,510 | 6 | 4 | null | 2023-02-22T00:57:49 | 2009-11-18T19:57:01 |
Clojure
|
UTF-8
|
Scheme
| false | false | 1,126 |
ss
|
yesornogui.ss
|
#lang scheme/gui
(define (ask-yes-or-no-question #:question question
#:default answer
#:title (title "Yes or No?")
#:width (w 400)
#:height (h 200))
(define d (new dialog% [label title] [width w] [height h]))
(define msg (new message% [label question] [parent d]))
(define (yes) (set! answer #t) (send d show #f))
(define (no) (set! answer #f) (send d show #f))
(define yes-b (new button%
[label "Yes"] [parent d]
[callback (λ (x y) (yes))]
[style (if answer '(border) '())]))
(define no-b (new button%
[label "No"] [parent d]
[callback (λ (x y) (no))]
[style (if answer '() '(border))]))
(send d show #t)
answer)
(provide/contract
[ask-yes-or-no-question
(->* (#:question string?
#:default boolean?)
(#:title string?
#:width exact-integer?
#:height exact-integer?)
boolean?)])
| false |
893ca763070a20fd6b4de16c747921d76ec48260
|
9ba99213d2aac208dcd1bc86dddeed97a4d2577e
|
/xlib/util/x-fetch-name.sls
|
8599bc3846f1403fbd1d53d93f818d18f87f993d
|
[] |
no_license
|
sahwar/psilab
|
19df7449389c8b545a0f1323e2bd6ca5be3e8592
|
16b60e4ae63e3405d74117a50cd9ea313c179b33
|
refs/heads/master
| 2020-04-19T15:17:47.154624 | 2010-06-10T17:39:35 | 2010-06-10T17:39:35 | 168,269,500 | 1 | 0 | null | 2019-01-30T03:00:41 | 2019-01-30T03:00:41 | null |
UTF-8
|
Scheme
| false | false | 394 |
sls
|
x-fetch-name.sls
|
(library (psilab xlib util x-fetch-name)
(export x-fetch-name)
(import (rnrs)
(ypsilon c-types)
(psilab xlib ffi))
(define x-fetch-name
(let ((bv (make-bytevector sizeof:void*)))
(lambda (dpy id)
(if (= (XFetchName dpy id bv) 0)
#f
(let ((name (c-string-ref (bytevector-c-void*-ref bv 0))))
(XFree (bytevector-c-void*-ref bv 0))
name)))))
)
| false |
c4c1ee98d0784f2652f173746da7491dd3cadfb7
|
defeada37d39bca09ef76f66f38683754c0a6aa0
|
/System/system/component-model/list-entry.sls
|
daace8b7daaecf3d86dd49dfa162620b87e15a06
|
[] |
no_license
|
futsuki/ironscheme-port
|
2dbac82c0bda4f4ff509208f7f00a5211d1f7cd5
|
4e7a81b0fbeac9a47440464988e53fb118286c54
|
refs/heads/master
| 2016-09-06T17:13:11.462593 | 2015-09-26T18:20:40 | 2015-09-26T18:20:40 | 42,757,369 | 0 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 1,010 |
sls
|
list-entry.sls
|
(library (system component-model list-entry)
(export new
is?
list-entry?
key-get
key-set!
key-update!
value-get
value-set!
value-update!
next-get
next-set!
next-update!)
(import (ironscheme-clr-port))
(define-syntax new
(lambda (e)
(syntax-case e ()
((_ a ...) #'(clr-new System.ComponentModel.ListEntry a ...)))))
(define (is? a) (clr-is System.ComponentModel.ListEntry a))
(define (list-entry? a) (clr-is System.ComponentModel.ListEntry a))
(define-field-port
key-get
key-set!
key-update!
()
System.ComponentModel.ListEntry
key
System.Object)
(define-field-port
value-get
value-set!
value-update!
()
System.ComponentModel.ListEntry
value
System.Delegate)
(define-field-port
next-get
next-set!
next-update!
()
System.ComponentModel.ListEntry
next
System.ComponentModel.ListEntry))
| true |
27419502f739141deefb55a0484673a6104bac46
|
6d80ec1b63c27d5fdd230cb6c8312e7ed1dd2ad1
|
/Code/proj-v2-gen-moves.scm
|
79491dc73f86a589e3f72da0ff78536a96393007
|
[] |
no_license
|
himanshubudak/backgammon
|
b05c5eda7f55f50f2e5fcb322231d383c48d3b53
|
b1278274e24680e35e1276b5db4cd2563243ea7a
|
refs/heads/master
| 2021-01-06T20:41:04.206610 | 2013-12-21T09:17:12 | 2013-12-21T09:17:12 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 90,249 |
scm
|
proj-v2-gen-moves.scm
|
#reader(lib"read.ss""wxme")WXME0108 ##
#|
This file uses the GRacket editor format.
Open this file in DrRacket version 5.2.1 or later to read it.
Most likely, it was created by saving a program in DrRacket,
and it probably contains a program with non-text elements
(such as images or comment boxes).
http://racket-lang.org/
|#
28 7 #"wxtext\0"
3 1 6 #"wxtab\0"
1 1 8 #"wximage\0"
2 0 8 #"wxmedia\0"
4 1 34 #"(lib \"syntax-browser.ss\" \"mrlib\")\0"
1 0 16 #"drscheme:number\0"
3 0 44 #"(lib \"number-snip.ss\" \"drscheme\" \"private\")\0"
1 0 36 #"(lib \"comment-snip.ss\" \"framework\")\0"
1 0 93
(
#"((lib \"collapsed-snipclass.ss\" \"framework\") (lib \"collapsed-sni"
#"pclass-wxme.ss\" \"framework\"))\0"
) 0 0 19 #"drscheme:sexp-snip\0"
0 0 36 #"(lib \"cache-image-snip.ss\" \"mrlib\")\0"
1 0 68
(
#"((lib \"image-core.ss\" \"mrlib\") (lib \"image-core-wxme.rkt\" \"mr"
#"lib\"))\0"
) 1 0 33 #"(lib \"bullet-snip.ss\" \"browser\")\0"
0 0 29 #"drscheme:bindings-snipclass%\0"
1 0 25 #"(lib \"matrix.ss\" \"htdp\")\0"
1 0 22 #"drscheme:lambda-snip%\0"
1 0 57
#"(lib \"hrule-snip.rkt\" \"macro-debugger\" \"syntax-browser\")\0"
1 0 45 #"(lib \"image-snipr.ss\" \"slideshow\" \"private\")\0"
1 0 26 #"drscheme:pict-value-snip%\0"
0 0 38 #"(lib \"pict-snipclass.ss\" \"slideshow\")\0"
2 0 55 #"(lib \"vertical-separator-snip.ss\" \"stepper\" \"private\")\0"
1 0 18 #"drscheme:xml-snip\0"
1 0 31 #"(lib \"xml-snipclass.ss\" \"xml\")\0"
1 0 21 #"drscheme:scheme-snip\0"
2 0 34 #"(lib \"scheme-snipclass.ss\" \"xml\")\0"
1 0 10 #"text-box%\0"
1 0 32 #"(lib \"text-snipclass.ss\" \"xml\")\0"
1 0 15 #"test-case-box%\0"
2 0 1 6 #"wxloc\0"
0 0 68 0 1 #"\0"
0 75 1 #"\0"
0 12 90 -1 90 -1 3 -1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 255 255 255 1 -1 0 9
#"Standard\0"
0 75 10 #"Monospace\0"
0 9 90 -1 90 -1 3 -1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 255 255 255 1 -1 2 1
#"\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 -1 -1 2 24
#"framework:default-color\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 -1 -1 2 1
#"\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 150 0 150 0 0 0 -1 -1 2 15
#"text:ports out\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 150 0 150 0 0 0 -1 -1 2 1
#"\0"
0 -1 1 #"\0"
1.0 0 -1 -1 93 -1 -1 -1 0 0 0 0 0 0 0 0 0 1.0 1.0 1.0 255 0 0 0 0 0 -1
-1 2 15 #"text:ports err\0"
0 -1 1 #"\0"
1.0 0 -1 -1 93 -1 -1 -1 0 0 0 0 0 0 0 0 0 1.0 1.0 1.0 255 0 0 0 0 0 -1
-1 2 1 #"\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 175 0 0 0 -1 -1 2 17
#"text:ports value\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 175 0 0 0 -1 -1 2 1
#"\0"
0 -1 1 #"\0"
1.0 0 92 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1.0 1.0 1.0 34 139 34 0 0 0 -1
-1 2 27 #"Matching Parenthesis Style\0"
0 -1 1 #"\0"
1.0 0 92 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1.0 1.0 1.0 34 139 34 0 0 0 -1
-1 2 1 #"\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 38 38 128 0 0 0 -1 -1 2 37
#"framework:syntax-color:scheme:symbol\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 38 38 128 0 0 0 -1 -1 2 38
#"framework:syntax-color:scheme:keyword\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 38 38 128 0 0 0 -1 -1 2 1
#"\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 194 116 31 0 0 0 -1 -1 2
38 #"framework:syntax-color:scheme:comment\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 194 116 31 0 0 0 -1 -1 2 1
#"\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 41 128 38 0 0 0 -1 -1 2 37
#"framework:syntax-color:scheme:string\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 41 128 38 0 0 0 -1 -1 2 39
#"framework:syntax-color:scheme:constant\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 41 128 38 0 0 0 -1 -1 2 1
#"\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 132 60 36 0 0 0 -1 -1 2 42
#"framework:syntax-color:scheme:parenthesis\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 132 60 36 0 0 0 -1 -1 2 1
#"\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 255 0 0 0 0 0 -1 -1 2 36
#"framework:syntax-color:scheme:error\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 255 0 0 0 0 0 -1 -1 2 1
#"\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 -1 -1 2 36
#"framework:syntax-color:scheme:other\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 -1 -1 2 1
#"\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 81 112 203 0 0 0 -1 -1 2
38 #"drracket:check-syntax:lexically-bound\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 81 112 203 0 0 0 -1 -1 2 1
#"\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 178 34 34 0 0 0 -1 -1 2 28
#"drracket:check-syntax:set!d\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 178 34 34 0 0 0 -1 -1 2 37
#"drracket:check-syntax:unused-require\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 255 0 0 0 0 0 -1 -1 2 36
#"drracket:check-syntax:free-variable\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 255 0 0 0 0 0 -1 -1 2 1
#"\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 68 0 203 0 0 0 -1 -1 2 31
#"drracket:check-syntax:imported\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 68 0 203 0 0 0 -1 -1 2 47
#"drracket:check-syntax:my-obligation-style-pref\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 178 34 34 0 0 0 -1 -1 2 1
#"\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 0 116 0 0 0 0 -1 -1 2 50
#"drracket:check-syntax:their-obligation-style-pref\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 0 116 0 0 0 0 -1 -1 2 48
#"drracket:check-syntax:unk-obligation-style-pref\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 -1 -1 2 1
#"\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 139 142 28 0 0 0 -1 -1 2
49 #"drracket:check-syntax:both-obligation-style-pref\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 139 142 28 0 0 0 -1 -1 2
26 #"plt:htdp:test-coverage-on\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 -1 -1 2 1
#"\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 1 0 0 0 0 0 0 255 165 0 0 0 0 -1 -1 2 27
#"plt:htdp:test-coverage-off\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 1 0 0 0 0 0 0 255 165 0 0 0 0 -1 -1 4 1
#"\0"
0 70 1 #"\0"
1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 1.0 1.0 1.0 1.0 1.0 1.0 0 0 0 0 0 0
-1 -1 4 4 #"XML\0"
0 70 1 #"\0"
1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 1.0 1.0 1.0 1.0 1.0 1.0 0 0 0 0 0 0
-1 -1 2 1 #"\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 34 139 34 0 0 0 -1 -1 2 37
#"plt:module-language:test-coverage-on\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 34 139 34 0 0 0 -1 -1 2 1
#"\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 176 48 96 0 0 0 -1 -1 2 38
#"plt:module-language:test-coverage-off\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 176 48 96 0 0 0 -1 -1 4 1
#"\0"
0 71 1 #"\0"
1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 1.0 1.0 1.0 1.0 1.0 1.0 0 0 0 0 0 0
-1 -1 4 1 #"\0"
0 -1 1 #"\0"
1.0 0 -1 -1 -1 -1 -1 -1 1 0 0 0 0 0 0 0 0 1.0 1.0 1.0 0 0 255 0 0 0 -1
-1 4 1 #"\0"
0 71 1 #"\0"
1.0 0 -1 -1 -1 -1 -1 -1 1 0 0 0 0 0 0 0 0 1.0 1.0 1.0 0 0 255 0 0 0 -1
-1 4 1 #"\0"
0 71 1 #"\0"
1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1.0 1.0 1.0 0 100 0 0 0 0 -1
-1 2 1 #"\0"
0 -1 1 #"\0"
1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 200 0 0 0 0 0 -1 -1 0 1
#"\0"
0 75 10 #"Monospace\0"
0.0 9 90 -1 90 -1 3 -1 0 1 0 1 0 0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0 255 255
255 1 -1 0 1 #"\0"
0 75 1 #"\0"
0.0 10 90 -1 90 -1 3 -1 0 1 0 1 0 0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0 255
255 255 1 -1 0 1 #"\0"
0 75 12 #"Courier New\0"
0.0 10 90 -1 90 -1 3 -1 0 1 0 1 0 0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0 255
255 255 1 -1 4 1 #"\0"
0 -1 1 #"\0"
1.0 0 92 -1 -1 -1 -1 -1 0 0 0 0 0 1 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0 255
255 0 -1 -1 4 1 #"\0"
0 71 1 #"\0"
1.0 0 -1 -1 93 -1 -1 -1 0 0 0 0 0 0 0.0 0.0 0.0 1.0 1.0 1.0 255 0 0 0 0
0 -1 -1 2 1 #"\0"
0 70 1 #"\0"
1.0 0 -1 -1 93 -1 -1 -1 0 0 0 0 0 0 0.0 0.0 0.0 1.0 1.0 1.0 148 0 211 0
0 0 -1 -1 2 1 #"\0"
0 70 1 #"\0"
1.0 0 -1 -1 -1 -1 -1 -1 1 0 0 0 0 0 0.0 0.0 0.0 1.0 1.0 1.0 0 0 255 0 0
0 -1 -1 0 1 #"\0"
0 -1 1 #"\0"
0.0 12 -1 -1 -1 -1 -1 -1 0 0 1 0 0 0 1.0 1.0 1.0 1.0 1.0 1.0 0 0 0 0 0 0
-1 -1 2 1 #"\0"
0 -1 1 #"\0"
0.0 12 -1 -1 -1 -1 -1 -1 0 0 1 0 0 0 1.0 1.0 1.0 1.0 1.0 1.0 0 0 0 0 0 0
-1 -1 0 1 #"\0"
0 -1 1 #"\0"
1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0.0 0.0 0.0 1.0 1.0 1.0 200 0 0 0 0
0 -1 -1 0 1 #"\0"
0 75 10 #"Monospace\0"
0.0 12 90 -1 90 -1 3 -1 0 1 0 1 0 0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0 255
255 255 1 -1 0 1 #"\0"
0 -1 1 #"\0"
0.0 11 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 1.0 1.0 1.0 1.0 1.0 1.0 0 0 0 0 0 0
-1 -1 2 1 #"\0"
0 -1 1 #"\0"
0.0 11 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 1.0 1.0 1.0 1.0 1.0 1.0 0 0 0 0 0 0
-1 -1 0 4300 0 26 3 12 #"#lang racket"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 17 3 70
(
#";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"
#";;"
) 0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 14 3 7 #"require"
0 0 4 3 1 #" "
0 0 19 3 15 #"\"utilities.scm\""
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 7 1255 4 0 0 0 208 0 22 3 1 #"("
0 0 15 3 13 #"define-syntax"
0 0 2 3 1 #" "
0 0 14 3 2 #"lc"
0 0 2 29 1 #"\n"
0 0 2 3 2 #" "
0 0 22 3 1 #"("
0 0 15 3 12 #"syntax-rules"
0 0 2 3 1 #" "
0 0 22 3 1 #"("
0 0 2 3 1 #" "
0 0 14 3 2 #"<-"
0 0 2 3 1 #" "
0 0 14 3 1 #"*"
0 0 22 3 1 #")"
0 0 2 29 1 #"\n"
0 0 2 3 4 #" "
0 0 22 3 2 #"[("
0 0 14 3 2 #"lc"
0 0 2 3 1 #" "
0 0 14 3 4 #"expr"
0 0 2 3 1 #" "
0 0 14 3 1 #":"
0 0 2 3 1 #" "
0 0 14 3 3 #"var"
0 0 2 3 1 #" "
0 0 14 3 2 #"<-"
0 0 2 3 1 #" "
0 0 14 3 10 #"drawn-from"
0 0 22 3 1 #")"
0 0 2 3 2 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"map"
0 0 2 3 1 #" "
0 0 22 3 1 #"("
0 0 15 3 6 #"lambda"
0 0 2 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"var"
0 0 22 3 1 #")"
0 0 2 3 1 #" "
0 0 14 3 4 #"expr"
0 0 22 3 1 #")"
0 0 2 3 1 #" "
0 0 14 3 10 #"drawn-from"
0 0 22 3 2 #")]"
0 0 2 29 1 #"\n"
0 0 2 3 4 #" "
0 0 22 3 2 #"[("
0 0 14 3 2 #"lc"
0 0 2 3 1 #" "
0 0 14 3 4 #"expr"
0 0 2 3 1 #" "
0 0 14 3 1 #":"
0 0 2 3 1 #" "
0 0 14 3 1 #"*"
0 0 2 3 1 #" "
0 0 14 3 5 #"guard"
0 0 22 3 1 #")"
0 0 2 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 2 3 1 #" "
0 0 14 3 5 #"guard"
0 0 2 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"list"
0 0 2 3 1 #" "
0 0 14 3 4 #"expr"
0 0 22 3 1 #")"
0 0 2 3 1 #" "
0 0 20 3 1 #"`"
0 0 22 3 4 #"())]"
0 0 2 29 1 #"\n"
0 0 2 3 4 #" "
0 0 22 3 2 #"[("
0 0 14 3 2 #"lc"
0 0 2 3 1 #" "
0 0 14 3 4 #"expr"
0 0 2 3 1 #" "
0 0 14 3 1 #":"
0 0 2 3 1 #" "
0 0 14 3 1 #"*"
0 0 2 3 1 #" "
0 0 14 3 5 #"guard"
0 0 2 3 1 #" "
0 0 14 3 9 #"qualifier"
0 0 2 3 1 #" "
0 0 14 3 3 #"..."
0 0 22 3 1 #")"
0 0 2 3 1 #" "
0 0 2 29 1 #"\n"
0 0 2 3 5 #" "
0 0 22 3 1 #"("
0 0 14 3 6 #"concat"
0 0 2 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"lc"
0 0 2 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"lc"
0 0 2 3 1 #" "
0 0 14 3 4 #"expr"
0 0 2 3 1 #" "
0 0 14 3 1 #":"
0 0 2 3 1 #" "
0 0 14 3 9 #"qualifier"
0 0 2 3 1 #" "
0 0 14 3 3 #"..."
0 0 22 3 1 #")"
0 0 2 3 1 #" "
0 0 14 3 1 #":"
0 0 2 3 1 #" "
0 0 14 3 5 #"guard"
0 0 22 3 3 #"))]"
0 0 2 29 1 #"\n"
0 0 2 3 4 #" "
0 0 22 3 2 #"[("
0 0 14 3 2 #"lc"
0 0 2 3 1 #" "
0 0 14 3 4 #"expr"
0 0 2 3 1 #" "
0 0 14 3 1 #":"
0 0 2 3 1 #" "
0 0 14 3 3 #"var"
0 0 2 3 1 #" "
0 0 14 3 2 #"<-"
0 0 2 3 1 #" "
0 0 14 3 10 #"drawn-from"
0 0 2 3 1 #" "
0 0 14 3 9 #"qualifier"
0 0 2 3 1 #" "
0 0 14 3 3 #"..."
0 0 22 3 1 #")"
0 0 2 3 1 #" "
0 0 2 29 1 #"\n"
0 0 2 3 5 #" "
0 0 22 3 1 #"("
0 0 14 3 6 #"concat"
0 0 2 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"lc"
0 0 2 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"lc"
0 0 2 3 1 #" "
0 0 14 3 4 #"expr"
0 0 2 3 1 #" "
0 0 14 3 1 #":"
0 0 2 3 2 #" "
0 0 14 3 9 #"qualifier"
0 0 2 3 1 #" "
0 0 14 3 3 #"..."
0 0 2 3 1 #" "
0 0 22 3 1 #")"
0 0 2 3 1 #" "
0 0 14 3 1 #":"
0 0 2 3 1 #" "
0 0 14 3 3 #"var"
0 0 2 3 1 #" "
0 0 14 3 2 #"<-"
0 0 2 3 1 #" "
0 0 14 3 10 #"drawn-from"
0 0 22 3 5 #"))]))"
0 0 2 29 1 #"\n"
0 0 2 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 2 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 6 #"concat"
0 0 2 3 1 #" "
0 0 14 3 1 #"l"
0 0 22 3 1 #")"
0 0 2 29 1 #"\n"
0 0 2 3 2 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 2 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 5 #"null?"
0 0 2 3 1 #" "
0 0 14 3 1 #"l"
0 0 22 3 1 #")"
0 0 2 3 1 #" "
0 0 20 3 1 #"'"
0 0 22 3 2 #"()"
0 0 2 29 1 #"\n"
0 0 2 3 6 #" "
0 0 22 3 1 #"("
0 0 14 3 6 #"append"
0 0 2 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"car"
0 0 2 3 1 #" "
0 0 14 3 1 #"l"
0 0 22 3 1 #")"
0 0 2 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 6 #"concat"
0 0 2 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"cdr"
0 0 2 3 1 #" "
0 0 14 3 1 #"l"
0 0 22 3 5 #")))))"
0 0 2 29 1 #"\n"
0 0 2 29 1 #"\n"
0 0 0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"struct"
0 0 4 3 1 #" "
0 0 14 3 4 #"node"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"list"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 14 #"#:transparent)"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 17 3 70
(
#";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"
#";;"
) 0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 13 #"build-vector1"
0 0 4 3 1 #" "
0 0 14 3 1 #"n"
0 0 4 3 1 #" "
0 0 14 3 1 #"m"
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 4 3 2 #" "
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 6 #"helper"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 4 3 4 #" "
0 0 22 3 1 #"("
0 0 15 3 4 #"cond"
0 0 4 3 1 #" "
0 0 22 3 2 #"(("
0 0 14 3 1 #"="
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"-"
0 0 4 3 1 #" "
0 0 14 3 1 #"n"
0 0 4 3 1 #" "
0 0 20 3 1 #"1"
0 0 22 3 2 #"))"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 12 #"list->vector"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"list"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"m"
0 0 4 3 1 #" "
0 0 20 3 1 #"1"
0 0 22 3 4 #"))))"
0 0 4 29 1 #"\n"
0 0 4 3 10 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"else"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 12 #"list->vector"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cons"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"m"
0 0 4 3 1 #" "
0 0 20 3 1 #"2"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 12 #"vector->list"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 6 #"helper"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"+"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 20 3 1 #"1"
0 0 22 3 8 #"))))))))"
0 0 4 29 1 #"\n"
0 0 4 3 2 #" "
0 0 22 3 1 #"("
0 0 14 3 6 #"helper"
0 0 4 3 1 #" "
0 0 20 3 1 #"0"
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 17 3 23 #";(define (min-of-list ("
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"make"
0 0 4 3 1 #" "
0 0 14 3 1 #"n"
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 4 3 2 #" "
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"help"
0 0 4 3 2 #" "
0 0 14 3 1 #"i"
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 4 3 4 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #">"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 14 3 1 #"n"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 22 3 2 #"()"
0 0 4 29 1 #"\n"
0 0 4 3 8 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cons"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"help"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"+"
0 0 4 3 1 #" "
0 0 20 3 1 #"1"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 22 3 5 #")))))"
0 0 4 29 1 #"\n"
0 0 4 3 2 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"help"
0 0 4 3 1 #" "
0 0 20 3 1 #"1"
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"show"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 15 3 5 #"begin"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 7 #"display"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 7 #"newline"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 14 3 3 #"tab"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"make"
0 0 4 3 1 #" "
0 0 20 3 2 #"24"
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"seev"
0 0 4 3 1 #" "
0 0 14 3 1 #"v"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 10 #"vector-ref"
0 0 4 3 1 #" "
0 0 14 3 1 #"v"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 17 3 83
(
#";*******************************************************************"
#"***************"
) 0 0 4 29 1 #"\n"
0 7 13 4 0 0 0 1 0 2 29 1 #"\n"
0 0 0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 17 3 24 #";;board access functions"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 7 349 4 0 0 0 57 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 2 3 1 #" "
0 0 14 3 8 #"display%"
0 0 2 29 1 #"\n"
0 0 2 3 2 #" "
0 0 22 3 1 #"("
0 0 15 3 5 #"class"
0 0 2 3 1 #" "
0 0 14 3 7 #"object%"
0 0 2 29 1 #"\n"
0 0 2 3 4 #" "
0 0 22 3 1 #"("
0 0 14 3 10 #"init-field"
0 0 2 3 1 #" "
0 0 22 3 1 #"["
0 0 14 3 5 #"board"
0 0 2 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 11 #"make-vector"
0 0 2 3 1 #" "
0 0 20 3 2 #"30"
0 0 2 3 1 #" "
0 0 20 3 2 #"#f"
0 0 22 3 3 #")])"
0 0 2 29 1 #"\n"
0 0 2 3 4 #" "
0 0 22 3 1 #"("
0 0 14 3 9 #"super-new"
0 0 22 3 1 #")"
0 0 2 29 1 #"\n"
0 0 2 3 3 #" "
0 0 2 29 1 #"\n"
0 0 2 3 5 #" "
0 0 22 3 1 #"("
0 0 15 3 13 #"define/public"
0 0 2 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 5 #"reset"
0 0 22 3 1 #")"
0 0 2 3 1 #" "
0 0 2 29 1 #"\n"
0 0 2 3 6 #" "
0 0 22 3 1 #"("
0 0 15 3 5 #"begin"
0 0 2 29 1 #"\n"
0 0 2 3 7 #" "
0 0 22 3 1 #"("
0 0 14 3 13 #"initial-setup"
0 0 22 3 1 #")"
0 0 2 29 1 #"\n"
0 0 2 3 7 #" "
0 0 17 3 30 #";(dice---bitmap( ? ? )-------)"
0 0 2 29 1 #"\n"
0 0 2 3 7 #" "
0 0 22 3 4 #"))))"
0 0 2 29 1 #"\n"
0 0 0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 7 #"reset-B"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 4 3 2 #" "
0 0 22 3 1 #"("
0 0 15 3 5 #"begin"
0 0 4 29 1 #"\n"
0 0 4 3 4 #" "
0 0 22 3 1 #"("
0 0 14 3 12 #"vector-fill!"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 20 3 2 #"#f"
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 4 3 4 #" "
0 0 22 3 1 #"("
0 0 14 3 11 #"vector-set!"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 20 3 1 #"1"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cons"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"R"
0 0 4 3 1 #" "
0 0 20 3 1 #"2"
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 4 3 4 #" "
0 0 22 3 1 #"("
0 0 14 3 11 #"vector-set!"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 20 3 2 #"12"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cons"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"R"
0 0 4 3 1 #" "
0 0 20 3 1 #"5"
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 4 3 4 #" "
0 0 22 3 1 #"("
0 0 14 3 11 #"vector-set!"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 20 3 2 #"17"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cons"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"R"
0 0 4 3 1 #" "
0 0 20 3 1 #"3"
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 4 3 4 #" "
0 0 22 3 1 #"("
0 0 14 3 11 #"vector-set!"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 20 3 2 #"19"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cons"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"R"
0 0 4 3 1 #" "
0 0 20 3 1 #"5"
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 4 3 4 #" "
0 0 22 3 1 #"("
0 0 14 3 11 #"vector-set!"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 20 3 1 #"6"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cons"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"B"
0 0 4 3 1 #" "
0 0 20 3 1 #"5"
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 4 3 4 #" "
0 0 22 3 1 #"("
0 0 14 3 11 #"vector-set!"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 20 3 1 #"8"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cons"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"B"
0 0 4 3 1 #" "
0 0 20 3 1 #"3"
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 4 3 4 #" "
0 0 22 3 1 #"("
0 0 14 3 11 #"vector-set!"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 20 3 2 #"13"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cons"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"B"
0 0 4 3 1 #" "
0 0 20 3 1 #"5"
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 4 3 4 #" "
0 0 22 3 1 #"("
0 0 14 3 11 #"vector-set!"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 20 3 2 #"24"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cons"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"B"
0 0 4 3 1 #" "
0 0 20 3 1 #"2"
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 4 3 4 #" "
0 0 22 3 1 #"("
0 0 14 3 11 #"vector-set!"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 5 #"red-h"
0 0 4 3 1 #" "
0 0 20 3 1 #"0"
0 0 22 3 1 #")"
0 0 4 3 2 #" "
0 0 17 3 8 #";;home-A"
0 0 4 29 1 #"\n"
0 0 4 3 4 #" "
0 0 22 3 1 #"("
0 0 14 3 11 #"vector-set!"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 7 #"black-h"
0 0 4 3 1 #" "
0 0 20 3 1 #"0"
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 4 3 4 #" "
0 0 22 3 1 #"("
0 0 14 3 11 #"vector-set!"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 8 #"red-flag"
0 0 4 3 1 #" "
0 0 20 3 1 #"5"
0 0 22 3 1 #")"
0 0 4 3 3 #" "
0 0 17 3 19 #";;setting flag of A"
0 0 4 29 1 #"\n"
0 0 4 3 4 #" "
0 0 22 3 1 #"("
0 0 14 3 11 #"vector-set!"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 10 #"black-flag"
0 0 4 3 1 #" "
0 0 20 3 1 #"5"
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 4 3 4 #" "
0 0 22 3 1 #"("
0 0 14 3 11 #"vector-set!"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 3 #"bar"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cons"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cons"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"R"
0 0 4 3 1 #" "
0 0 20 3 1 #"0"
0 0 22 3 2 #")("
0 0 14 3 4 #"cons"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"B"
0 0 4 3 1 #" "
0 0 20 3 1 #"0"
0 0 22 3 3 #")))"
0 0 4 29 1 #"\n"
0 0 4 3 4 #" "
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 5 #"set-B"
0 0 4 3 1 #" "
0 0 14 3 3 #"src"
0 0 4 3 1 #" "
0 0 14 3 6 #"target"
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 4 3 2 #" "
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"help"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 4 3 4 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"="
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 20 3 2 #"30"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"void"
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 4 3 8 #" "
0 0 22 3 1 #"("
0 0 15 3 5 #"begin"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 11 #"vector-set!"
0 0 4 3 1 #" "
0 0 14 3 3 #"src"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 10 #"vector-ref"
0 0 4 3 1 #" "
0 0 14 3 6 #"target"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 4 3 15 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"help"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"+"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 20 3 1 #"1"
0 0 22 3 5 #")))))"
0 0 4 29 1 #"\n"
0 0 4 3 2 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"help"
0 0 4 3 1 #" "
0 0 20 3 1 #"0"
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"copy"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 22 3 2 #")("
0 0 15 3 4 #"let*"
0 0 4 3 2 #" "
0 0 22 3 2 #"(["
0 0 14 3 4 #"size"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 13 #"vector-length"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 22 3 2 #")]"
0 0 4 3 1 #" "
0 0 22 3 1 #"["
0 0 14 3 1 #"b"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 11 #"make-vector"
0 0 4 3 1 #" "
0 0 14 3 4 #"size"
0 0 4 3 1 #" "
0 0 20 3 2 #"#f"
0 0 22 3 3 #")])"
0 0 4 3 1 #" "
0 0 4 29 1 #"\n"
0 0 4 3 22 #" "
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"help"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 4 3 24 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"="
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 14 3 4 #"size"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 14 3 1 #"b"
0 0 4 29 1 #"\n"
0 0 4 3 28 #" "
0 0 22 3 1 #"("
0 0 15 3 5 #"begin"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 11 #"vector-set!"
0 0 4 3 1 #" "
0 0 14 3 1 #"b"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 10 #"vector-ref"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 22 3 2 #"))"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"help"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"+"
0 0 4 3 1 #" "
0 0 20 3 1 #"1"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 22 3 5 #")))))"
0 0 4 29 1 #"\n"
0 0 4 3 22 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"help"
0 0 4 3 1 #" "
0 0 20 3 1 #"0"
0 0 22 3 3 #")))"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"f?"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 6 #"equal?"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 4 #"fail"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 2 #"#t"
0 0 4 3 1 #" "
0 0 20 3 2 #"#f"
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"p?"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 6 #"equal?"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 4 #"pass"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 2 #"#t"
0 0 4 3 1 #" "
0 0 20 3 2 #"#f"
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 17 3 29 #";.........check click on roll"
0 0 4 29 1 #"\n"
0 0 17 3 26 #";;;A is RED ,,, B is Black"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 10 #"game-over?"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 15 3 4 #"cond"
0 0 4 3 1 #" "
0 0 22 3 2 #"[("
0 0 14 3 1 #"="
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 10 #"vector-ref"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 5 #"red-h"
0 0 4 3 1 #" "
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 2 #"15"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 19 3 5 #"\"red\""
0 0 22 3 1 #"]"
0 0 4 29 1 #"\n"
0 0 4 3 33 #" "
0 0 22 3 2 #"[("
0 0 14 3 1 #"="
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 10 #"vector-ref"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 7 #"black-h"
0 0 4 3 1 #" "
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 2 #"15"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 19 3 7 #"\"black\""
0 0 22 3 1 #"]"
0 0 4 29 1 #"\n"
0 0 4 3 33 #" "
0 0 22 3 1 #"["
0 0 14 3 4 #"else"
0 0 4 3 1 #" "
0 0 20 3 2 #"#f"
0 0 22 3 3 #"]))"
0 0 4 3 2 #" "
0 0 17 3 58
#";;;tells whether game has ended or not ,, if ended who won"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 7 #"open-A?"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"="
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"+"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 10 #"vector-ref"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 5 #"red-h"
0 0 4 3 1 #" "
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 10 #"vector-ref"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 8 #"red-flag"
0 0 4 3 1 #" "
0 0 22 3 2 #"))"
0 0 4 3 1 #" "
0 0 20 3 2 #"15"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 2 #"#t"
0 0 4 3 1 #" "
0 0 20 3 2 #"#f"
0 0 22 3 2 #"))"
0 0 4 3 3 #" "
0 0 17 3 21 #";;;;is home-gate open"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 7 #"open-B?"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #">="
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"+"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 10 #"vector-ref"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 7 #"black-h"
0 0 4 3 1 #" "
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 10 #"vector-ref"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 10 #"black-flag"
0 0 4 3 1 #" "
0 0 22 3 2 #"))"
0 0 4 3 1 #" "
0 0 20 3 2 #"15"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 2 #"#t"
0 0 4 3 1 #" "
0 0 20 3 2 #"#f"
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 6 #"flag-A"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"n"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 11 #"vector-set!"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 8 #"red-flag"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"+"
0 0 4 3 1 #" "
0 0 14 3 1 #"n"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 10 #"vector-ref"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 8 #"red-flag"
0 0 22 3 2 #"))"
0 0 4 3 1 #" "
0 0 22 3 2 #"))"
0 0 4 3 3 #" "
0 0 17 3 41 #";;;;set home gate flag n can be +1 , -1"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 6 #"flag-B"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"n"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 11 #"vector-set!"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 10 #"black-flag"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"+"
0 0 4 3 1 #" "
0 0 14 3 1 #"n"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 10 #"vector-ref"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 10 #"black-flag"
0 0 22 3 2 #"))"
0 0 4 3 1 #" "
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 14 3 8 #"red-flag"
0 0 4 3 1 #" "
0 0 20 3 2 #"27"
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 14 3 10 #"black-flag"
0 0 4 3 1 #" "
0 0 20 3 2 #"28"
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 6 #"bar-A?"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 15 3 3 #"let"
0 0 22 3 2 #"(["
0 0 14 3 1 #"x"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 10 #"vector-ref"
0 0 4 3 2 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 3 #"bar"
0 0 22 3 3 #")])"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"="
0 0 4 3 1 #" "
0 0 20 3 1 #"0"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cdar"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 22 3 2 #"))"
0 0 4 3 1 #" "
0 0 20 3 2 #"#f"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cdar"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 22 3 4 #"))))"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 6 #"bar-B?"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 15 3 3 #"let"
0 0 22 3 2 #"(["
0 0 14 3 1 #"x"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 10 #"vector-ref"
0 0 4 3 2 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 3 #"bar"
0 0 22 3 3 #")])"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"="
0 0 4 3 1 #" "
0 0 20 3 1 #"0"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cddr"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 22 3 2 #"))"
0 0 4 3 1 #" "
0 0 20 3 2 #"#f"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"cdd"
0 0 14 3 1 #"r"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 22 3 4 #"))))"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 6 #"empty?"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 10 #"vector-ref"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 2 #"#f"
0 0 4 3 1 #" "
0 0 20 3 2 #"#t"
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"is-A"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 15 3 3 #"let"
0 0 22 3 2 #"(["
0 0 14 3 1 #"x"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 10 #"vector-ref"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 22 3 3 #")])"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"eq?"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"car"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"R"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"cdr"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 2 #"#f"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 22 3 2 #"))"
0 0 4 3 1 #" "
0 0 22 3 1 #")"
0 0 4 3 2 #" "
0 0 17 3 61
#";;;returns #f if red not present else returns no of red coins"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"is-B"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 15 3 3 #"let"
0 0 22 3 2 #"(["
0 0 14 3 1 #"x"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 10 #"vector-ref"
0 0 4 3 2 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 22 3 3 #")])"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"eq?"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"car"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"B"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"cdr"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 2 #"#f"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 22 3 2 #"))"
0 0 4 3 1 #" "
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 7 #"kill-A?"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 6 #"equal?"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"is-A"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 1 #"1"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 2 #"#t"
0 0 4 3 1 #" "
0 0 20 3 2 #"#f"
0 0 22 3 2 #"))"
0 0 4 3 5 #" "
0 0 17 3 60
#";;;true only if and only if exactly one A present at pos i "
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 7 #"kill-B?"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 6 #"equal?"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"is-B"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 1 #"1"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 2 #"#t"
0 0 4 3 1 #" "
0 0 20 3 2 #"#f"
0 0 22 3 2 #"))"
0 0 4 3 3 #" "
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 14 3 5 #"red-h"
0 0 4 3 1 #" "
0 0 20 3 2 #"25"
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 14 3 7 #"black-h"
0 0 4 3 1 #" "
0 0 20 3 1 #"0"
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 14 3 3 #"bar"
0 0 4 3 1 #" "
0 0 20 3 2 #"26"
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 6 #"inc-hA"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 11 #"vector-set!"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 5 #"red-h"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"+"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 10 #"vector-ref"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 5 #"red-h"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 1 #"1"
0 0 22 3 3 #")))"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 6 #"inc-hB"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 11 #"vector-set!"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 7 #"black-h"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"+"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 10 #"vector-ref"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 7 #"black-h"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 1 #"1"
0 0 22 3 3 #")))"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 13 #"update-flag-A"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 14 3 1 #"n"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 17 3 39 #";;; n=1 add at i ;;; n= -1 sub at i"
0 0 4 29 1 #"\n"
0 0 4 3 2 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"and"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #">="
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 20 3 2 #"19"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"<="
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 20 3 2 #"24"
0 0 22 3 2 #"))"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 6 #"flag-A"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"n"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"void"
0 0 22 3 3 #")))"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 13 #"update-flag-B"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 14 3 1 #"n"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 17 3 39 #";;; n=1 add at i ;;; n= -1 sub at i"
0 0 4 29 1 #"\n"
0 0 4 3 2 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"and"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #">="
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 20 3 1 #"1"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"<="
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 20 3 1 #"6"
0 0 22 3 2 #"))"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 6 #"flag-B"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"n"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"void"
0 0 22 3 3 #")))"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 11 #"update-flag"
0 0 4 3 1 #" "
0 0 14 3 3 #"col"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 14 3 1 #"n"
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 4 3 2 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 6 #"equal?"
0 0 4 3 1 #" "
0 0 14 3 3 #"col"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"R"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 13 #"update-flag-A"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 14 3 1 #"n"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 13 #"update-flag-B"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 14 3 1 #"n"
0 0 22 3 3 #")))"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"inc"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 14 3 3 #"sym"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 15 3 3 #"let"
0 0 4 3 1 #" "
0 0 22 3 2 #"(["
0 0 14 3 1 #"x"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 10 #"vector-ref"
0 0 4 3 2 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 22 3 3 #")])"
0 0 4 3 1 #" "
0 0 4 29 1 #"\n"
0 0 4 3 28 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 4 29 1 #"\n"
0 0 4 3 32 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"="
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"cdr"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 1 #"5"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 4 #"fail"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 15 3 5 #"begin"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 11 #"vector-set!"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cons"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"car"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"+"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"cdr"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 1 #"1"
0 0 22 3 3 #")))"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 11 #"update-flag"
0 0 4 3 1 #" "
0 0 14 3 3 #"sym"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 20 3 1 #"1"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 4 #"pass"
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 4 3 32 #" "
0 0 22 3 1 #"("
0 0 15 3 5 #"begin"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 11 #"vector-set!"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cons"
0 0 4 3 1 #" "
0 0 14 3 3 #"sym"
0 0 4 3 1 #" "
0 0 20 3 1 #"1"
0 0 22 3 3 #"))("
0 0 14 3 11 #"update-flag"
0 0 4 3 1 #" "
0 0 14 3 3 #"sym"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 20 3 1 #"1"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 4 #"pass"
0 0 22 3 4 #"))))"
0 0 4 3 1 #" "
0 0 17 3 15 #";;if i is empty"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"dec"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 14 3 3 #"sym"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 15 3 3 #"let"
0 0 4 3 1 #" "
0 0 22 3 2 #"(["
0 0 14 3 1 #"x"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 10 #"vector-ref"
0 0 4 3 2 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 22 3 3 #")])"
0 0 4 3 1 #" "
0 0 4 29 1 #"\n"
0 0 4 3 28 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 2 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"="
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"cdr"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 1 #"1"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 4 29 1 #"\n"
0 0 4 3 33 #" "
0 0 22 3 1 #"("
0 0 15 3 5 #"begin"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 11 #"vector-set!"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 20 3 2 #"#f"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 11 #"update-flag"
0 0 4 3 1 #" "
0 0 14 3 3 #"sym"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 20 3 2 #"-1"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 4 #"pass"
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 4 3 33 #" "
0 0 22 3 1 #"("
0 0 15 3 5 #"begin"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 11 #"vector-set!"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cons"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"car"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"-"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"cdr"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 1 #"1"
0 0 22 3 3 #")))"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 11 #"update-flag"
0 0 4 3 1 #" "
0 0 14 3 3 #"sym"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 20 3 2 #"-1"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 4 #"pass"
0 0 22 3 4 #"))))"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 7 #"inc-bar"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 3 #"sym"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 15 3 3 #"let"
0 0 4 3 1 #" "
0 0 22 3 2 #"(["
0 0 14 3 1 #"x"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 10 #"vector-ref"
0 0 4 3 2 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 3 #"bar"
0 0 22 3 3 #")])"
0 0 4 29 1 #"\n"
0 0 4 3 30 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 22 3 1 #"("
0 0 14 3 6 #"equal?"
0 0 4 3 1 #" "
0 0 14 3 3 #"sym"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"R"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 15 3 5 #"begin"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 4 3 1 #" "
0 0 14 3 11 #"vector-set!"
0 0 4 3 2 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 3 #"bar"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cons"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cons"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"R"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"+"
0 0 4 3 1 #" "
0 0 20 3 1 #"1"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cdar"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 22 3 3 #")))"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cons"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"B"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cddr"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 22 3 4 #"))))"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 4 #"pass"
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 4 3 33 #" "
0 0 22 3 1 #"("
0 0 15 3 5 #"begin"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 4 3 1 #" "
0 0 14 3 11 #"vector-set!"
0 0 4 3 4 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 3 #"bar"
0 0 4 3 2 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cons"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cons"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"R"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cdar"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 22 3 2 #"))"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cons"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"B"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"+"
0 0 4 3 1 #" "
0 0 20 3 1 #"1"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cddr"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 22 3 5 #")))))"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 4 #"pass"
0 0 22 3 4 #"))))"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 7 #"dec-bar"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 3 #"sym"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 15 3 3 #"let"
0 0 4 3 1 #" "
0 0 22 3 2 #"(["
0 0 14 3 1 #"x"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 10 #"vector-ref"
0 0 4 3 2 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 3 #"bar"
0 0 22 3 3 #")])"
0 0 4 29 1 #"\n"
0 0 4 3 29 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 22 3 1 #"("
0 0 14 3 6 #"equal?"
0 0 4 3 1 #" "
0 0 14 3 3 #"sym"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"R"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"not"
0 0 22 3 1 #"("
0 0 14 3 1 #"="
0 0 4 3 1 #" "
0 0 20 3 1 #"0"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cdar"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 22 3 3 #")))"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 15 3 5 #"begin"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 4 3 1 #" "
0 0 14 3 11 #"vector-set!"
0 0 4 3 2 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 3 #"bar"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cons"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cons"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"R"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"-"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cdar"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 1 #"1"
0 0 22 3 2 #"))"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cons"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"B"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cddr"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 22 3 4 #"))))"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 4 #"pass"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 4 #"fail"
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 4 3 32 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"not"
0 0 22 3 1 #"("
0 0 14 3 1 #"="
0 0 4 3 1 #" "
0 0 20 3 1 #"0"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cddr"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 22 3 3 #")))"
0 0 4 3 2 #" "
0 0 22 3 1 #"("
0 0 15 3 5 #"begin"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 4 3 1 #" "
0 0 14 3 11 #"vector-set!"
0 0 4 3 4 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 3 #"bar"
0 0 4 3 2 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cons"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cons"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"R"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cdar"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 22 3 2 #"))"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cons"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"B"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"-"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cddr"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 1 #"1"
0 0 22 3 4 #"))))"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 4 #"pass"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 4 #"fail"
0 0 22 3 4 #"))))"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 6 #"move-A"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 14 3 1 #"n"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"not"
0 0 22 3 1 #"("
0 0 14 3 4 #"is-A"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 22 3 2 #"))"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 4 #"fail"
0 0 4 3 1 #" "
0 0 4 29 1 #"\n"
0 0 4 3 31 #" "
0 0 22 3 1 #"("
0 0 15 3 3 #"let"
0 0 4 3 1 #" "
0 0 22 3 2 #"(["
0 0 14 3 3 #"tar"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"+"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 14 3 1 #"n"
0 0 22 3 3 #")])"
0 0 4 3 2 #" "
0 0 4 29 1 #"\n"
0 0 4 3 33 #" "
0 0 22 3 1 #"("
0 0 15 3 4 #"cond"
0 0 22 3 1 #"["
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #">"
0 0 4 3 1 #" "
0 0 14 3 3 #"tar"
0 0 4 3 1 #" "
0 0 20 3 2 #"24"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 7 #"open-A?"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 15 3 5 #"begin"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"dec"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"R"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 6 #"inc-hA"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 4 #"pass"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 4 #"fail"
0 0 22 3 2 #")]"
0 0 4 3 2 #" "
0 0 17 3 22 #";;i.e if goes to home "
0 0 4 29 1 #"\n"
0 0 4 3 38 #" "
0 0 22 3 2 #"[("
0 0 14 3 2 #"or"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"is-A"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 3 #"tar"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 6 #"empty?"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 3 #"tar"
0 0 22 3 2 #"))"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 15 3 5 #"begin"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"dec"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"R"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"inc"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 3 #"tar"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"R"
0 0 22 3 3 #"))]"
0 0 4 3 2 #" "
0 0 17 3 5 #";;if "
0 0 4 29 1 #"\n"
0 0 4 3 38 #" "
0 0 22 3 2 #"[("
0 0 14 3 7 #"kill-B?"
0 0 4 3 2 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 3 #"tar"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 15 3 5 #"begin"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"dec"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"R"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"dec"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 3 #"tar"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"B"
0 0 22 3 2 #")("
0 0 14 3 3 #"inc"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 3 #"tar"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"R"
0 0 22 3 2 #")("
0 0 14 3 7 #"inc-bar"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"B"
0 0 22 3 3 #"))]"
0 0 4 29 1 #"\n"
0 0 4 3 38 #" "
0 0 22 3 1 #"["
0 0 14 3 4 #"else"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 4 #"fail"
0 0 22 3 5 #"]))))"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 6 #"move-B"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 14 3 1 #"n"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"not"
0 0 22 3 1 #"("
0 0 14 3 4 #"is-B"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 22 3 2 #"))"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 4 #"fail"
0 0 4 3 1 #" "
0 0 4 29 1 #"\n"
0 0 4 3 31 #" "
0 0 22 3 1 #"("
0 0 15 3 3 #"let"
0 0 4 3 1 #" "
0 0 22 3 2 #"(["
0 0 14 3 3 #"tar"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"-"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 14 3 1 #"n"
0 0 22 3 3 #")])"
0 0 4 3 2 #" "
0 0 4 29 1 #"\n"
0 0 4 3 33 #" "
0 0 22 3 1 #"("
0 0 15 3 4 #"cond"
0 0 22 3 1 #"["
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"<"
0 0 4 3 1 #" "
0 0 14 3 3 #"tar"
0 0 4 3 1 #" "
0 0 20 3 1 #"1"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 7 #"open-B?"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 15 3 5 #"begin"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"dec"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"B"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 6 #"inc-hB"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 4 #"pass"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 4 #"fail"
0 0 22 3 2 #")]"
0 0 4 3 2 #" "
0 0 17 3 22 #";;i.e if goes to home "
0 0 4 29 1 #"\n"
0 0 4 3 38 #" "
0 0 22 3 2 #"[("
0 0 14 3 2 #"or"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"is-B"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 3 #"tar"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 6 #"empty?"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 3 #"tar"
0 0 22 3 2 #"))"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 15 3 5 #"begin"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"dec"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"B"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"inc"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 3 #"tar"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"B"
0 0 22 3 3 #"))]"
0 0 4 3 2 #" "
0 0 17 3 5 #";;if "
0 0 4 29 1 #"\n"
0 0 4 3 38 #" "
0 0 22 3 2 #"[("
0 0 14 3 7 #"kill-A?"
0 0 4 3 2 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 3 #"tar"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 15 3 5 #"begin"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"dec"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"B"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"dec"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 3 #"tar"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"R"
0 0 22 3 2 #")("
0 0 14 3 3 #"inc"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 3 #"tar"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"B"
0 0 22 3 2 #")("
0 0 14 3 7 #"inc-bar"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"R"
0 0 22 3 3 #"))]"
0 0 4 29 1 #"\n"
0 0 4 3 38 #" "
0 0 22 3 1 #"["
0 0 14 3 4 #"else"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 4 #"fail"
0 0 22 3 5 #"]))))"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 10 #"from-bar-A"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"n"
0 0 22 3 2 #")("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"not"
0 0 22 3 1 #"("
0 0 14 3 6 #"bar-A?"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 22 3 2 #"))"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 4 #"fail"
0 0 4 29 1 #"\n"
0 0 4 3 32 #" "
0 0 22 3 1 #"("
0 0 15 3 3 #"let"
0 0 22 3 2 #"(["
0 0 4 3 1 #" "
0 0 14 3 3 #"tar"
0 0 4 3 1 #" "
0 0 14 3 1 #"n"
0 0 22 3 2 #"])"
0 0 4 29 1 #"\n"
0 0 4 3 34 #" "
0 0 22 3 1 #"("
0 0 15 3 4 #"cond"
0 0 22 3 2 #"[("
0 0 14 3 2 #"or"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"is-A"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 3 #"tar"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 6 #"empty?"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 3 #"tar"
0 0 22 3 2 #"))"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 15 3 5 #"begin"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 7 #"dec-bar"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"R"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"inc"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 3 #"tar"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"R"
0 0 22 3 3 #"))]"
0 0 4 29 1 #"\n"
0 0 4 3 39 #" "
0 0 22 3 2 #"[("
0 0 14 3 7 #"kill-B?"
0 0 4 3 2 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 3 #"tar"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 15 3 5 #"begin"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 7 #"dec-bar"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 2 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"R"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"dec"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 3 #"tar"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"B"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"inc"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 3 #"tar"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"R"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 7 #"inc-bar"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"B"
0 0 22 3 3 #"))]"
0 0 4 29 1 #"\n"
0 0 4 3 39 #" "
0 0 22 3 1 #"["
0 0 14 3 4 #"else"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 4 #"fail"
0 0 22 3 5 #"]))))"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 10 #"from-bar-B"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"n"
0 0 22 3 2 #")("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"not"
0 0 22 3 1 #"("
0 0 14 3 6 #"bar-B?"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 22 3 2 #"))"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 4 #"fail"
0 0 4 29 1 #"\n"
0 0 4 3 32 #" "
0 0 22 3 1 #"("
0 0 15 3 3 #"let"
0 0 22 3 2 #"(["
0 0 4 3 1 #" "
0 0 14 3 3 #"tar"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"-"
0 0 4 3 1 #" "
0 0 20 3 2 #"25"
0 0 4 3 1 #" "
0 0 14 3 1 #"n"
0 0 22 3 3 #")])"
0 0 4 29 1 #"\n"
0 0 4 3 34 #" "
0 0 22 3 1 #"("
0 0 15 3 4 #"cond"
0 0 22 3 2 #"[("
0 0 14 3 2 #"or"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"is-B"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 3 #"tar"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 6 #"empty?"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 3 #"tar"
0 0 22 3 2 #"))"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 15 3 5 #"begin"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 7 #"dec-bar"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"B"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"inc"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 3 #"tar"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"B"
0 0 22 3 3 #"))]"
0 0 4 29 1 #"\n"
0 0 4 3 39 #" "
0 0 22 3 2 #"[("
0 0 14 3 7 #"kill-A?"
0 0 4 3 2 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 3 #"tar"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 15 3 5 #"begin"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 7 #"dec-bar"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 2 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"B"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"dec"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 3 #"tar"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"R"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"inc"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 3 #"tar"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"B"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 7 #"inc-bar"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"R"
0 0 22 3 3 #"))]"
0 0 4 29 1 #"\n"
0 0 4 3 39 #" "
0 0 22 3 1 #"["
0 0 14 3 4 #"else"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 4 #"fail"
0 0 22 3 5 #"]))))"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 8 #"gen-doub"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 8 #"die-list"
0 0 4 3 1 #" "
0 0 14 3 3 #"col"
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 4 3 2 #" "
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 14 3 6 #"master"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 11 #"make-vector"
0 0 4 3 1 #" "
0 0 20 3 1 #"0"
0 0 4 3 1 #" "
0 0 20 3 2 #"#f"
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 4 3 2 #" "
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 5 #"miss?"
0 0 4 3 1 #" "
0 0 14 3 1 #"v"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"="
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 12 #"vector-count"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 15 3 2 #"\316\273"
0 0 22 3 1 #"("
0 0 14 3 1 #"t"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 6 #"equal?"
0 0 4 3 1 #" "
0 0 14 3 1 #"v"
0 0 4 3 1 #" "
0 0 14 3 1 #"t"
0 0 22 3 2 #"))"
0 0 4 3 1 #" "
0 0 14 3 6 #"master"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 1 #"0"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 2 #"#t"
0 0 4 3 1 #" "
0 0 20 3 2 #"#f"
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 4 3 2 #" "
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 8 #"make-gen"
0 0 4 3 1 #" "
0 0 14 3 4 #"bar?"
0 0 4 3 1 #" "
0 0 14 3 8 #"from-bar"
0 0 4 3 1 #" "
0 0 14 3 4 #"move"
0 0 4 3 1 #" "
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 4 3 4 #" "
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 8 #"gen-doub"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"l"
0 0 4 3 1 #" "
0 0 14 3 4 #"flag"
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 4 3 6 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 5 #"null?"
0 0 4 3 1 #" "
0 0 14 3 1 #"l"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 5 #"miss?"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"set!"
0 0 4 3 1 #" "
0 0 14 3 6 #"master"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 13 #"vector-append"
0 0 4 3 1 #" "
0 0 14 3 6 #"master"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 11 #"make-vector"
0 0 4 3 1 #" "
0 0 20 3 1 #"1"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 22 3 3 #")))"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"void"
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 4 3 10 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"bar?"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 4 29 1 #"\n"
0 0 4 3 14 #" "
0 0 22 3 1 #"("
0 0 15 3 3 #"let"
0 0 4 3 1 #" "
0 0 22 3 2 #"(["
0 0 14 3 2 #"b2"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"copy"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 22 3 3 #")])"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"p?"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 8 #"from-bar"
0 0 4 3 1 #" "
0 0 14 3 2 #"b2"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"car"
0 0 4 3 1 #" "
0 0 14 3 1 #"l"
0 0 22 3 3 #")))"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 8 #"gen-doub"
0 0 4 3 1 #" "
0 0 14 3 2 #"b2"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"cdr"
0 0 4 3 1 #" "
0 0 14 3 1 #"l"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 1 #"0"
0 0 4 3 1 #" "
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"set!"
0 0 4 3 1 #" "
0 0 14 3 6 #"master"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 13 #"vector-append"
0 0 4 3 1 #" "
0 0 14 3 6 #"master"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 11 #"make-vector"
0 0 4 3 1 #" "
0 0 20 3 1 #"1"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 22 3 5 #")))))"
0 0 4 29 1 #"\n"
0 0 4 3 14 #" "
0 0 22 3 1 #"("
0 0 15 3 3 #"let"
0 0 4 3 1 #" "
0 0 22 3 2 #"(["
0 0 14 3 3 #"ans"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"lc"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 8 #"gen-doub"
0 0 4 3 2 #" "
0 0 14 3 5 #"new-b"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"cdr"
0 0 4 3 1 #" "
0 0 14 3 1 #"l"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 14 3 3 #"pos"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 14 3 1 #":"
0 0 4 3 1 #" "
0 0 4 29 1 #"\n"
0 0 4 3 29 #" "
0 0 14 3 3 #"pos"
0 0 4 3 1 #" "
0 0 14 3 2 #"<-"
0 0 4 3 1 #" "
0 0 14 3 3 #"tab"
0 0 4 3 1 #" "
0 0 4 29 1 #"\n"
0 0 4 3 29 #" "
0 0 14 3 5 #"new-b"
0 0 4 3 1 #" "
0 0 14 3 2 #"<-"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"list"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 15 3 4 #"let*"
0 0 4 3 1 #" "
0 0 22 3 2 #"(["
0 0 14 3 1 #"b"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"copy"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 22 3 2 #")]"
0 0 4 3 1 #" "
0 0 22 3 1 #"["
0 0 14 3 1 #"q"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"move"
0 0 4 3 1 #" "
0 0 14 3 1 #"b"
0 0 4 3 1 #" "
0 0 14 3 3 #"pos"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"car"
0 0 4 3 1 #" "
0 0 14 3 1 #"l"
0 0 22 3 4 #"))])"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"f?"
0 0 4 3 1 #" "
0 0 14 3 1 #"q"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 2 #"#f"
0 0 4 3 1 #" "
0 0 14 3 1 #"b"
0 0 22 3 3 #")))"
0 0 4 29 1 #"\n"
0 0 4 3 29 #" "
0 0 14 3 1 #"*"
0 0 4 3 1 #" "
0 0 14 3 5 #"new-b"
0 0 4 3 1 #" "
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 4 29 1 #"\n"
0 0 4 3 34 #" "
0 0 22 3 2 #"])"
0 0 4 29 1 #"\n"
0 0 4 3 16 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"and"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 5 #"null?"
0 0 4 3 1 #" "
0 0 14 3 3 #"ans"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 5 #"miss?"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 22 3 2 #"))"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 8 #"gen-doub"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 22 3 2 #"()"
0 0 4 3 1 #" "
0 0 20 3 1 #"0"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"void"
0 0 22 3 6 #"))))))"
0 0 4 29 1 #"\n"
0 0 4 3 4 #" "
0 0 14 3 8 #"gen-doub"
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 4 3 2 #" "
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 14 3 10 #"gen-doub-A"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 8 #"make-gen"
0 0 4 3 1 #" "
0 0 14 3 6 #"bar-A?"
0 0 4 3 1 #" "
0 0 14 3 10 #"from-bar-A"
0 0 4 3 1 #" "
0 0 14 3 6 #"move-A"
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 4 3 2 #" "
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 14 3 10 #"gen-doub-B"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 8 #"make-gen"
0 0 4 3 1 #" "
0 0 14 3 6 #"bar-B?"
0 0 4 3 1 #" "
0 0 14 3 10 #"from-bar-B"
0 0 4 3 1 #" "
0 0 14 3 6 #"move-B"
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 4 3 2 #" "
0 0 4 29 1 #"\n"
0 0 4 3 2 #" "
0 0 4 29 1 #"\n"
0 0 4 3 2 #" "
0 0 22 3 1 #"("
0 0 15 3 5 #"begin"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 6 #"equal?"
0 0 4 3 1 #" "
0 0 14 3 3 #"col"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"R"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 10 #"gen-doub-A"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 2 #" "
0 0 14 3 8 #"die-list"
0 0 4 3 1 #" "
0 0 20 3 1 #"0"
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 4 3 13 #" "
0 0 22 3 1 #"("
0 0 14 3 10 #"gen-doub-B"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 8 #"die-list"
0 0 4 3 1 #" "
0 0 20 3 1 #"0"
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 4 3 10 #" "
0 0 14 3 6 #"master"
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 8 #"gen-pair"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"l"
0 0 4 3 1 #" "
0 0 14 3 3 #"col"
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 4 3 2 #" "
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 14 3 6 #"master"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 11 #"make-vector"
0 0 4 3 1 #" "
0 0 20 3 1 #"0"
0 0 4 3 1 #" "
0 0 20 3 2 #"#f"
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 4 3 2 #" "
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 5 #"miss?"
0 0 4 3 1 #" "
0 0 14 3 1 #"v"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"="
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 12 #"vector-count"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 15 3 2 #"\316\273"
0 0 22 3 1 #"("
0 0 14 3 1 #"t"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 6 #"equal?"
0 0 4 3 1 #" "
0 0 14 3 1 #"v"
0 0 4 3 1 #" "
0 0 14 3 1 #"t"
0 0 22 3 2 #"))"
0 0 4 3 1 #" "
0 0 14 3 6 #"master"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 1 #"0"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 2 #"#t"
0 0 4 3 1 #" "
0 0 20 3 2 #"#f"
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 4 3 2 #" "
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 8 #"make-gen"
0 0 4 3 1 #" "
0 0 14 3 4 #"bar?"
0 0 4 3 1 #" "
0 0 14 3 8 #"from-bar"
0 0 4 3 1 #" "
0 0 14 3 4 #"move"
0 0 4 3 1 #" "
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 4 3 4 #" "
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 8 #"gen-pair"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"l"
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 4 3 6 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 5 #"null?"
0 0 4 3 1 #" "
0 0 14 3 1 #"l"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 5 #"miss?"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"set!"
0 0 4 3 1 #" "
0 0 14 3 6 #"master"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 13 #"vector-append"
0 0 4 3 1 #" "
0 0 14 3 6 #"master"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 11 #"make-vector"
0 0 4 3 1 #" "
0 0 20 3 1 #"1"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 22 3 3 #")))"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"void"
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 4 3 10 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"bar?"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 4 3 14 #" "
0 0 22 3 1 #"("
0 0 15 3 3 #"let"
0 0 4 3 1 #" "
0 0 22 3 2 #"(["
0 0 14 3 2 #"b1"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"copy"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 22 3 3 #")])"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"p?"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 8 #"from-bar"
0 0 4 3 1 #" "
0 0 14 3 2 #"b1"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"car"
0 0 4 3 1 #" "
0 0 14 3 1 #"l"
0 0 22 3 3 #")))"
0 0 4 29 1 #"\n"
0 0 4 3 43 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 5 #"null?"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"cdr"
0 0 4 3 1 #" "
0 0 14 3 1 #"l"
0 0 22 3 2 #"))"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 8 #"gen-pair"
0 0 4 3 1 #" "
0 0 14 3 2 #"b1"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 22 3 3 #"())"
0 0 4 29 1 #"\n"
0 0 4 3 47 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"bar?"
0 0 4 3 1 #" "
0 0 14 3 2 #"b1"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 8 #"gen-pair"
0 0 4 3 1 #" "
0 0 14 3 2 #"b1"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"cdr"
0 0 4 3 1 #" "
0 0 14 3 1 #"l"
0 0 22 3 2 #"))"
0 0 4 3 1 #" "
0 0 4 29 1 #"\n"
0 0 4 3 51 #" "
0 0 22 3 1 #"("
0 0 15 3 3 #"let"
0 0 22 3 2 #"(["
0 0 14 3 2 #"b3"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"copy"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 22 3 3 #")])"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"p?"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 8 #"from-bar"
0 0 4 3 1 #" "
0 0 14 3 2 #"b3"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cadr"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"show"
0 0 4 3 1 #" "
0 0 14 3 1 #"l"
0 0 22 3 2 #"))"
0 0 4 3 1 #" "
0 0 22 3 2 #"))"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 15 3 5 #"begin"
0 0 22 3 1 #"("
0 0 4 3 1 #" "
0 0 14 3 8 #"gen-pair"
0 0 4 3 1 #" "
0 0 14 3 2 #"b1"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"cdr"
0 0 4 3 1 #" "
0 0 14 3 1 #"l"
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 4 3 121
(
#" "
#" "
) 0 0 22 3 1 #"("
0 0 4 3 1 #" "
0 0 14 3 8 #"gen-pair"
0 0 4 3 1 #" "
0 0 14 3 2 #"b3"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"list"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"car"
0 0 4 3 1 #" "
0 0 14 3 1 #"l"
0 0 22 3 4 #"))))"
0 0 4 29 1 #"\n"
0 0 4 3 79
(
#" "
#" "
) 0 0 22 3 1 #"("
0 0 4 3 1 #" "
0 0 14 3 8 #"gen-pair"
0 0 4 3 1 #" "
0 0 14 3 2 #"b1"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"cdr"
0 0 4 3 1 #" "
0 0 14 3 1 #"l"
0 0 22 3 6 #"))))))"
0 0 4 29 1 #"\n"
0 0 4 3 43 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 5 #"null?"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"cdr"
0 0 4 3 1 #" "
0 0 14 3 1 #"l"
0 0 22 3 2 #"))"
0 0 4 3 1 #" "
0 0 4 29 1 #"\n"
0 0 4 3 47 #" "
0 0 22 3 1 #"("
0 0 4 3 1 #" "
0 0 14 3 8 #"gen-pair"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 22 3 3 #"())"
0 0 4 29 1 #"\n"
0 0 4 3 47 #" "
0 0 22 3 1 #"("
0 0 15 3 3 #"let"
0 0 22 3 2 #"(["
0 0 14 3 2 #"b2"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"copy"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 22 3 3 #")])"
0 0 4 29 1 #"\n"
0 0 4 3 49 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"p?"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 8 #"from-bar"
0 0 4 3 1 #" "
0 0 14 3 2 #"b2"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cadr"
0 0 4 3 1 #" "
0 0 14 3 1 #"l"
0 0 22 3 3 #")))"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 4 3 1 #" "
0 0 14 3 8 #"gen-pair"
0 0 4 3 1 #" "
0 0 14 3 2 #"b2"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"list"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"car"
0 0 4 3 1 #" "
0 0 14 3 1 #"l"
0 0 22 3 3 #")))"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 4 3 1 #" "
0 0 14 3 8 #"gen-pair"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 22 3 8 #"()))))))"
0 0 4 29 1 #"\n"
0 0 4 3 14 #" "
0 0 22 3 1 #"("
0 0 15 3 3 #"let"
0 0 4 3 1 #" "
0 0 22 3 2 #"(["
0 0 14 3 3 #"ans"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"lc"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 4 3 1 #" "
0 0 14 3 8 #"gen-pair"
0 0 4 3 2 #" "
0 0 14 3 5 #"new-b"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 6 #"remove"
0 0 4 3 1 #" "
0 0 14 3 1 #"n"
0 0 4 3 1 #" "
0 0 14 3 1 #"l"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 14 3 1 #":"
0 0 4 3 1 #" "
0 0 4 29 1 #"\n"
0 0 4 3 29 #" "
0 0 14 3 3 #"pos"
0 0 4 3 1 #" "
0 0 14 3 2 #"<-"
0 0 4 3 1 #" "
0 0 14 3 3 #"tab"
0 0 4 3 1 #" "
0 0 4 29 1 #"\n"
0 0 4 3 29 #" "
0 0 14 3 1 #"n"
0 0 4 3 1 #" "
0 0 14 3 2 #"<-"
0 0 4 3 1 #" "
0 0 14 3 1 #"l"
0 0 4 29 1 #"\n"
0 0 4 3 29 #" "
0 0 14 3 5 #"new-b"
0 0 4 3 1 #" "
0 0 14 3 2 #"<-"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"list"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 15 3 4 #"let*"
0 0 4 3 1 #" "
0 0 22 3 2 #"(["
0 0 14 3 1 #"b"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"copy"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 22 3 2 #")]"
0 0 4 3 1 #" "
0 0 22 3 1 #"["
0 0 14 3 1 #"q"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"move"
0 0 4 3 1 #" "
0 0 14 3 1 #"b"
0 0 4 3 1 #" "
0 0 14 3 3 #"pos"
0 0 4 3 1 #" "
0 0 14 3 1 #"n"
0 0 22 3 3 #")])"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"f?"
0 0 4 3 1 #" "
0 0 14 3 1 #"q"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 2 #"#f"
0 0 4 3 1 #" "
0 0 14 3 1 #"b"
0 0 22 3 3 #")))"
0 0 4 29 1 #"\n"
0 0 4 3 29 #" "
0 0 4 29 1 #"\n"
0 0 4 3 29 #" "
0 0 14 3 1 #"*"
0 0 4 3 1 #" "
0 0 14 3 5 #"new-b"
0 0 4 29 1 #"\n"
0 0 4 3 35 #" "
0 0 22 3 3 #")])"
0 0 4 29 1 #"\n"
0 0 4 3 16 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"and"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 5 #"null?"
0 0 4 3 1 #" "
0 0 14 3 3 #"ans"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 5 #"miss?"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 22 3 2 #"))"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 8 #"gen-pair"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 22 3 3 #"())"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"void"
0 0 22 3 6 #"))))))"
0 0 4 29 1 #"\n"
0 0 4 3 4 #" "
0 0 14 3 8 #"gen-pair"
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 4 3 2 #" "
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 14 3 10 #"gen-pair-A"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 8 #"make-gen"
0 0 4 3 1 #" "
0 0 14 3 6 #"bar-A?"
0 0 4 3 1 #" "
0 0 14 3 10 #"from-bar-A"
0 0 4 3 1 #" "
0 0 14 3 6 #"move-A"
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 4 3 2 #" "
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 14 3 10 #"gen-pair-B"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 8 #"make-gen"
0 0 4 3 1 #" "
0 0 14 3 6 #"bar-B?"
0 0 4 3 1 #" "
0 0 14 3 10 #"from-bar-B"
0 0 4 3 1 #" "
0 0 14 3 6 #"move-B"
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 4 3 2 #" "
0 0 4 29 1 #"\n"
0 0 4 3 2 #" "
0 0 22 3 1 #"("
0 0 15 3 5 #"begin"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 6 #"equal?"
0 0 4 3 1 #" "
0 0 14 3 3 #"col"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"R"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 10 #"gen-pair-A"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 2 #" "
0 0 14 3 1 #"l"
0 0 4 3 1 #" "
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 4 3 13 #" "
0 0 22 3 1 #"("
0 0 14 3 10 #"gen-pair-B"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"l"
0 0 4 3 1 #" "
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 4 3 9 #" "
0 0 14 3 6 #"master"
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 9 #"gen-moves"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 8 #"die-cons"
0 0 4 3 1 #" "
0 0 14 3 3 #"col"
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 4 3 2 #" "
0 0 22 3 1 #"("
0 0 15 3 3 #"let"
0 0 22 3 2 #"(["
0 0 14 3 1 #"x"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"car"
0 0 4 3 1 #" "
0 0 14 3 8 #"die-cons"
0 0 22 3 3 #")]["
0 0 14 3 1 #"y"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"cdr"
0 0 4 3 1 #" "
0 0 14 3 8 #"die-cons"
0 0 22 3 3 #")])"
0 0 4 29 1 #"\n"
0 0 4 3 4 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"="
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 4 3 1 #" "
0 0 14 3 1 #"y"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 8 #"gen-doub"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"list"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 14 3 3 #"col"
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 4 3 8 #" "
0 0 22 3 1 #"("
0 0 14 3 8 #"gen-pair"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"list"
0 0 4 3 1 #" "
0 0 14 3 1 #"x"
0 0 4 3 1 #" "
0 0 14 3 1 #"y"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 14 3 3 #"col"
0 0 22 3 4 #"))))"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 13 #"gen-moves-mod"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 7 #"pending"
0 0 4 3 1 #" "
0 0 14 3 3 #"col"
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 4 3 4 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"<"
0 0 4 3 2 #" "
0 0 22 3 1 #"("
0 0 14 3 6 #"length"
0 0 4 3 1 #" "
0 0 14 3 7 #"pending"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 1 #"2"
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 4 3 8 #" "
0 0 22 3 1 #"("
0 0 14 3 8 #"gen-pair"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 7 #"pending"
0 0 4 3 1 #" "
0 0 14 3 3 #"col"
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 4 3 8 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"="
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 3 #"car"
0 0 4 3 1 #" "
0 0 14 3 7 #"pending"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"cadr"
0 0 4 3 1 #" "
0 0 14 3 7 #"pending"
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 4 3 12 #" "
0 0 22 3 1 #"("
0 0 14 3 8 #"gen-doub"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 7 #"pending"
0 0 4 3 1 #" "
0 0 14 3 3 #"col"
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 4 3 12 #" "
0 0 22 3 1 #"("
0 0 14 3 8 #"gen-pair"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 7 #"pending"
0 0 4 3 1 #" "
0 0 14 3 3 #"col"
0 0 22 3 4 #"))))"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 14 #"poss-move-user"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 14 3 7 #"pending"
0 0 22 3 1 #")"
0 0 4 3 2 #" "
0 0 17 3 37 #";;user is black moves from 24 to zero"
0 0 4 29 1 #"\n"
0 0 4 3 2 #" "
0 0 22 3 1 #"("
0 0 14 3 17 #"remove-duplicates"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"lc"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"="
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 20 3 2 #"26"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"-"
0 0 4 3 1 #" "
0 0 20 3 2 #"25"
0 0 4 3 1 #" "
0 0 14 3 3 #"val"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"<="
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"-"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 14 3 3 #"val"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 1 #"0"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 1 #"0"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"-"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 14 3 3 #"val"
0 0 22 3 3 #")))"
0 0 4 3 1 #" "
0 0 14 3 1 #":"
0 0 4 3 1 #" "
0 0 14 3 3 #"val"
0 0 4 3 1 #" "
0 0 14 3 2 #"<-"
0 0 4 3 1 #" "
0 0 14 3 7 #"pending"
0 0 4 3 1 #" "
0 0 14 3 1 #"*"
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"="
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 20 3 2 #"26"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"p?"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 10 #"from-bar-B"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"copy"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 14 3 3 #"val"
0 0 22 3 2 #"))"
0 0 4 3 2 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"p?"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 6 #"move-B"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"copy"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 14 3 1 #"i"
0 0 4 3 1 #" "
0 0 14 3 3 #"val"
0 0 22 3 6 #"))))))"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 13 #"can-user-move"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 7 #"pending"
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 4 3 2 #" "
0 0 22 3 1 #"("
0 0 15 3 4 #"let*"
0 0 4 3 1 #" "
0 0 22 3 2 #"(["
0 0 14 3 1 #"l"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 13 #"gen-moves-mod"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 14 3 7 #"pending"
0 0 4 3 1 #" "
0 0 20 3 1 #"'"
0 0 14 3 1 #"B"
0 0 22 3 2 #")]"
0 0 4 29 1 #"\n"
0 0 4 3 9 #" "
0 0 22 3 1 #"["
0 0 14 3 4 #"size"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 13 #"vector-length"
0 0 4 3 1 #" "
0 0 14 3 1 #"l"
0 0 22 3 3 #")])"
0 0 4 29 1 #"\n"
0 0 4 3 4 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #">"
0 0 4 3 1 #" "
0 0 14 3 4 #"size"
0 0 4 3 1 #" "
0 0 20 3 1 #"1"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 2 #"#t"
0 0 4 29 1 #"\n"
0 0 4 3 8 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"if"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 6 #"equal?"
0 0 4 3 1 #" "
0 0 14 3 5 #"board"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"seev"
0 0 4 3 1 #" "
0 0 14 3 1 #"l"
0 0 4 3 1 #" "
0 0 20 3 1 #"0"
0 0 22 3 2 #"))"
0 0 4 3 1 #" "
0 0 20 3 2 #"#f"
0 0 4 3 1 #" "
0 0 20 3 2 #"#t"
0 0 22 3 4 #"))))"
0 0 4 29 1 #"\n"
0 0 4 3 4 #" "
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 7 349 4 0 0 0 57 0 2 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 2 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"pi"
0 0 2 3 1 #" "
0 0 14 3 5 #"board"
0 0 2 3 1 #" "
0 0 14 3 1 #"i"
0 0 2 3 1 #" "
0 0 14 3 7 #"pending"
0 0 22 3 1 #")"
0 0 2 3 2 #" "
0 0 17 3 37 #";;user is black moves from 24 to zero"
0 0 2 29 1 #"\n"
0 0 2 3 2 #" "
0 0 22 3 1 #"("
0 0 14 3 17 #"remove-duplicates"
0 0 2 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 2 #"lc"
0 0 2 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"+"
0 0 2 3 1 #" "
0 0 14 3 1 #"i"
0 0 2 3 1 #" "
0 0 14 3 3 #"val"
0 0 22 3 1 #")"
0 0 2 3 1 #" "
0 0 14 3 1 #":"
0 0 2 3 1 #" "
0 0 14 3 3 #"val"
0 0 2 3 1 #" "
0 0 14 3 2 #"<-"
0 0 2 3 1 #" "
0 0 14 3 7 #"pending"
0 0 2 3 1 #" "
0 0 14 3 1 #"*"
0 0 22 3 1 #"("
0 0 14 3 2 #"p?"
0 0 2 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 6 #"move-A"
0 0 2 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 4 #"copy"
0 0 2 3 1 #" "
0 0 14 3 5 #"board"
0 0 22 3 1 #")"
0 0 2 3 1 #" "
0 0 14 3 1 #"i"
0 0 2 3 1 #" "
0 0 14 3 3 #"val"
0 0 22 3 5 #")))))"
0 0 2 29 1 #"\n"
0 0 0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 14 3 1 #"B"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 11 #"make-vector"
0 0 4 3 1 #" "
0 0 20 3 2 #"30"
0 0 4 3 1 #" "
0 0 20 3 2 #"#f"
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 14 3 7 #"reset-B"
0 0 4 3 1 #" "
0 0 14 3 1 #"B"
0 0 22 3 1 #")"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 15 3 6 #"define"
0 0 4 3 1 #" "
0 0 14 3 5 #"ahome"
0 0 4 3 1 #" "
0 0 22 3 2 #"#("
0 0 20 3 1 #"0"
0 0 4 3 1 #" "
0 0 20 3 2 #"#f"
0 0 4 3 1 #" "
0 0 20 3 2 #"#f"
0 0 4 3 1 #" "
0 0 20 3 2 #"#f"
0 0 4 3 1 #" "
0 0 20 3 2 #"#f"
0 0 4 3 1 #" "
0 0 20 3 2 #"#f"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"B"
0 0 4 3 1 #" "
0 0 26 3 1 #"."
0 0 4 3 1 #" "
0 0 20 3 1 #"5"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 2 #"#f"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"B"
0 0 4 3 1 #" "
0 0 26 3 1 #"."
0 0 4 3 1 #" "
0 0 20 3 1 #"3"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 2 #"#f"
0 0 4 3 1 #" "
0 0 20 3 2 #"#f"
0 0 4 3 1 #" "
0 0 20 3 2 #"#f"
0 0 4 3 1 #" "
0 0 20 3 2 #"#f"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"B"
0 0 4 3 1 #" "
0 0 26 3 1 #"."
0 0 4 3 1 #" "
0 0 20 3 1 #"5"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 2 #"#f"
0 0 4 3 1 #" "
0 0 20 3 2 #"#f"
0 0 4 3 1 #" "
0 0 20 3 2 #"#f"
0 0 4 3 1 #" "
0 0 20 3 2 #"#f"
0 0 4 3 1 #" "
0 0 20 3 2 #"#f"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"R"
0 0 4 3 1 #" "
0 0 26 3 1 #"."
0 0 4 3 1 #" "
0 0 20 3 1 #"5"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"R"
0 0 4 3 1 #" "
0 0 26 3 1 #"."
0 0 4 3 1 #" "
0 0 20 3 1 #"3"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 2 #"#f"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"R"
0 0 4 3 1 #" "
0 0 26 3 1 #"."
0 0 4 3 1 #" "
0 0 20 3 1 #"5"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"R"
0 0 4 3 1 #" "
0 0 26 3 1 #"."
0 0 4 3 1 #" "
0 0 20 3 1 #"2"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 1 #"B"
0 0 4 3 1 #" "
0 0 26 3 1 #"."
0 0 4 3 1 #" "
0 0 20 3 1 #"2"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 1 #"0"
0 0 4 3 1 #" "
0 0 22 3 2 #"(("
0 0 14 3 1 #"R"
0 0 4 3 1 #" "
0 0 26 3 1 #"."
0 0 4 3 1 #" "
0 0 20 3 1 #"0"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 14 3 1 #"B"
0 0 4 3 1 #" "
0 0 26 3 1 #"."
0 0 4 3 1 #" "
0 0 20 3 1 #"0"
0 0 22 3 1 #")"
0 0 4 3 1 #" "
0 0 20 3 2 #"15"
0 0 4 3 1 #" "
0 0 20 3 1 #"5"
0 0 4 3 1 #" "
0 0 20 3 2 #"#f"
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 17 3 61
#";;IMPORTANT DO NOT DELETE FOLL COMMAND FOR EXPORT DEFINITIONS"
0 0 4 29 1 #"\n"
0 0 22 3 1 #"("
0 0 14 3 7 #"provide"
0 0 4 3 1 #" "
0 0 22 3 1 #"("
0 0 14 3 15 #"all-defined-out"
0 0 22 3 2 #"))"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0 4 29 1 #"\n"
0 0
| true |
5316330c1e889856b86e8cd8188726a579d9cf0c
|
defeada37d39bca09ef76f66f38683754c0a6aa0
|
/System.Configuration/system/configuration/integer-validator.sls
|
0aeee0d5bacd9f470dfefe6f9ea6fa5d26ab59fe
|
[] |
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 | 704 |
sls
|
integer-validator.sls
|
(library (system configuration integer-validator)
(export new is? integer-validator? can-validate? validate)
(import (ironscheme-clr-port))
(define-syntax new
(lambda (e)
(syntax-case e ()
((_ a ...)
#'(clr-new System.Configuration.IntegerValidator a ...)))))
(define (is? a) (clr-is System.Configuration.IntegerValidator a))
(define (integer-validator? a)
(clr-is System.Configuration.IntegerValidator a))
(define-method-port
can-validate?
System.Configuration.IntegerValidator
CanValidate
(System.Boolean System.Type))
(define-method-port
validate
System.Configuration.IntegerValidator
Validate
(System.Void System.Object)))
| true |
0a998090c19bb42395a992a5d6e22c4bd5550bd2
|
fca0221e2352708d385b790c665abab64e92a314
|
/redaction/benchmarks/MeroonV3-2008Mar01/size.scm
|
357f8f1d39f10257a9bd352cdb372d77786b4e22
|
[
"LicenseRef-scancode-warranty-disclaimer"
] |
no_license
|
sthilaid/memoire
|
a32fdb1f9add0cc0d97c095d11de0c52ae2ed2e2
|
9b26b0c76fddd5affaf06cf8aad2592b87f68069
|
refs/heads/master
| 2020-05-18T04:19:46.976457 | 2010-01-26T01:18:56 | 2010-01-26T01:18:56 | 141,195 | 1 | 2 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 3,009 |
scm
|
size.scm
|
;;; $Id: size.scm,v 1.1 2005/02/25 22:19:37 lucier Exp $
;;; Copyright (c) 1990-96 by Christian Queinnec. All rights reserved.
;;; ***********************************************
;;; Small, Efficient and Innovative Class System
;;; Meroon
;;; Christian Queinnec
;;; Ecole Polytechnique & INRIA--Rocquencourt
;;; ************************************************
;;; This file defines a set of functions that compute the size of Meroon.
;;; It walks any internal objects defined to make Meroon work and
;;; cumulates their size. The total size is obtained with: (show-meroon)
(define (show-meroon . stream)
(let ((stream (if (pair? stream) (car stream) (current-output-port))))
(newline stream)
(display meroon-version stream)
(newline stream)
(display "Total number of classes: " stream)
(display *class-number* stream)
(newline stream)
(display "Total number of generic functions: " stream)
(display *generic-number* stream)
(newline stream)
(let ((sum (show-meroon-size Object-class)))
(set! sum (fx+ sum (vector-length *classes*)))
(sequence-map (lambda (c) (set! sum (fx+ sum (show-meroon-size c))))
*classes* )
(set! sum (fx+ sum (vector-length *generics*)))
(sequence-map (lambda (g) (set! sum (fx+ sum (show-meroon-size g))))
*generics* )
(display "(estimated) internal size of Meroon: " stream)
(display sum stream)
(display " pointers" stream)
(newline stream) )
#t ) )
(define-generic (show-meroon-size (o))
(cond ((vector? o) (vector-length o))
((pair? o) (fx+ (show-meroon-size (car o))
(show-meroon-size (cdr o)) ))
(else 0) ) )
;;; Return the overall size of the instance
(define-method (show-meroon-size (o Object))
(fx+ (starting-offset) (instance-length o)) )
(define-method (show-meroon-size (o Class))
(let ((sum (call-next-method)))
(for-each (lambda (field)
(set! sum (fx+ sum (show-meroon-size field))) )
(Class-fields o) )
sum ) )
(define-method (show-meroon-size (o Generic))
(fx+ (call-next-method)
(show-meroon-size (Generic-dispatcher o)) ) )
(define-method (show-meroon-size (o Subclass-Dispatcher))
(fx+ (call-next-method)
(fx+ (show-meroon-size (Subclass-Dispatcher-yes o))
(show-meroon-size (Subclass-Dispatcher-no o)) ) ) )
(define-method (show-meroon-size (o Indexed-Dispatcher))
(fx+ (call-next-method)
(show-meroon-size (Indexed-Dispatcher-no o)) ) )
(define-method (show-meroon-size (o Linear-Dispatcher))
(fx+ (call-next-method)
(fx+ (length (Linear-Dispatcher-signature o))
(show-meroon-size (Linear-Dispatcher-no o)) ) ) )
(define-method (show-meroon-size (o Global-Dispatcher))
(fx+ (call-next-method)
(vector-length *classes*) ) )
;;; end of size.scm
| false |
dcd7a29563bda16c0a2bd607544312fb6e7703b2
|
3b3a00b8f68d2032dcdca64e5dbeefdcf37c06a5
|
/Compiler/expose-basic-blocks.ss
|
9b69bb44bbf2b54a7cde50cc59d52487281afabe
|
[] |
no_license
|
iomeone/p423-compiler
|
1615b9bd3b8ef910a7217244924b8c8d283f7eca
|
5efe33f128d6d4b3decb818f315d9f14781cc241
|
refs/heads/master
| 2020-12-09T03:10:46.831308 | 2015-05-04T03:36:37 | 2015-05-04T03:36:37 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 4,950 |
ss
|
expose-basic-blocks.ss
|
#|
A8 - Mar 6, 2015
pass: expose-basic-blocks
nothin' changed.
Input Grammar:
Program ::= (letrec ((Label (lambda () Tail)) *) Tail) ;;
Tail ::= (if Pred Tail Tail)
| (begin Effect * Tail)
| (Triv)
Pred ::= (true)
| (false)
| (if Pred Pred Pred)
| (begin Effect * Pred)
| (Relop Triv Triv)
Effect ::= (nop)
| (set! Loc Triv) ;;
| (set! Loc (Binop Triv Triv)) ;;
| (return-point Label Tail)
| (if Pred Effect Effect)
| (begin Effect * Effect)
Triv ::= Loc ;;
| Integer | Label
Loc ::= Reg | Disp | Ind ;;
Output Grammar:
Program ::= (letrec ((Label (lambda () Tail)) *) Tail) ;;
Tail ::= (if (Relop Triv Triv) (Label) (Label)) ;; mod
| (begin Effect * Tail)
| (Triv)
Effect ::= (set! Loc Triv) ;;
| (set! Loc (Binop Triv Triv)) ;;
Triv ::= Loc ;;
| Integer | Label
Loc ::= Reg | Disp | Ind ;;
|#
(library (Compiler expose-basic-blocks)
(export expose-basic-blocks)
(import (chezscheme)
(Framework helpers)
(Framework match))
(define-who expose-basic-blocks
(define (Tail x)
(match x
[(if ,pred ,[conseq cb*] ,[altern ab*])
(let ([clab (unique-label 'c)] [alab (unique-label 'a)])
(let-values ([(pred pb*) (Pred pred clab alab)])
(values pred
`(,pb* ...
[,clab (lambda () ,conseq)]
,cb* ...
[,alab (lambda () ,altern)]
,ab* ...))))]
[(begin ,effect* ... ,[tail tb*])
(let-values ([(x xb*) (Effect* effect* `(,tail))])
(values x `(,xb* ... ,tb* ...)))]
[(,triv) (values `(,triv) '())]
[,x (error who "invalid Tail ~s" x)]))
(define (Pred x tlab flab)
(match x
[(true) (values `(,tlab) '())]
[(false) (values `(,flab) '())]
[(if ,pred ,[conseq cb*] ,[altern ab*])
(let ([clab (unique-label 'c)] [alab (unique-label 'a)])
(let-values ([(pred pb*) (Pred pred clab alab)])
(values pred
`(,pb* ...
[,clab (lambda () ,conseq)]
,cb* ...
[,alab (lambda () ,altern)]
,ab* ...))))]
[(begin ,effect* ... ,[pred pb*])
(let-values ([(x xb*) (Effect* effect* `(,pred))])
(values x `(,xb* ... ,pb* ...)))]
[(,relop ,triv1 ,triv2)
(values `(if (,relop ,triv1 ,triv2) (,tlab) (,flab)) '())]
[,x (error who "invalid Pred ~s" x)]))
(define (Effect* x* rest*)
(match x*
[() (values (make-begin rest*) '())]
[(,x* ... ,x) (Effect x* x rest*)]))
(define (Effect x* x rest*)
(match x
[(nop) (Effect* x* rest*)]
[(set! ,lhs ,rhs) (Effect* x* `((set! ,lhs ,rhs) ,rest* ...))]
[(if ,pred ,conseq ,altern)
(let ([clab (unique-label 'c)]
[alab (unique-label 'a)]
[jlab (unique-label 'j)])
(let-values ([(conseq cb*) (Effect '() conseq `((,jlab)))]
[(altern ab*) (Effect '() altern `((,jlab)))]
[(pred pb*) (Pred pred clab alab)])
(let-values ([(x xb*) (Effect* x* `(,pred))])
(values x
`(,xb* ...
,pb* ...
[,clab (lambda () ,conseq)]
,cb* ...
[,alab (lambda () ,altern)]
,ab* ...
[,jlab (lambda () ,(make-begin rest*))])))))]
[(begin ,effect* ...) (Effect* `(,x* ... ,effect* ...) rest*)]
[(return-point ,rp-lab ,tail) ;; new
(let*-values ([(tail tb*) (Tail tail)]
[(ef eb*) (Effect* x* (cdr tail))])
(values ef
`(,eb* ...
,tb* ...
[,rp-lab (lambda ()
,(make-begin rest*))])))]
[,x (error who "invalid Effect ~s" x)]))
(lambda (x)
(match x
[(letrec ([,label* (lambda () ,[Tail -> tail* b**])] ...) ,[Tail -> tail b*])
`(letrec ([,label* (lambda () ,tail*)] ... ,b** ... ... ,b* ...) ,tail)]
[,x (error who "invalid Program ~s" x)])))
)
| false |
1e1a905a4f6cd68a5a3b1e3818e8d4201db85f30
|
2a4d841aa312e1759f6cea6d66b4eaae81d67f99
|
/lisp/scheme/chickendoc.ss
|
88d1b85dd84f53a86389164fdb65755f04b9215f
|
[] |
no_license
|
amit-k-s-pundir/computing-programming
|
9f8e136658322bb9a61e7160301c1a780cec84ca
|
9104f371fe97c9cd3c9f9bcd4a06038b936500a4
|
refs/heads/master
| 2021-07-12T22:46:09.849331 | 2017-10-16T08:50:48 | 2017-10-16T08:50:48 | 106,879,266 | 1 | 2 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 2,307 |
ss
|
chickendoc.ss
|
#!/usr/local/bin/csi -script
;;;; chickendoc - By Michele Simionato, Ed Watkeys and felix
(use regex)
(require-extension regex utils)
(define home
(if (string>=? (chicken-version) "1.85")
(chicken-home)
(or (getenv "CHICKEN_HOME")
"/usr/local/share/chicken") ) )
(define chicken-manual (make-pathname home "doc/chicken.html"))
(define default-browser (or (getenv "BROWSER") "mozilla -remote 'openurl(%%)'"))
(define default-url (string-append "file://" chicken-manual))
(define pattern (regexp "href=(#(index-)?[[^+])"))
(define (any-file-line pred fname)
(let* ((port
(open-input-file fname))
(result
(letrec
((loop
(lambda ()
(let ((line (read-line port)))
(if (eof-object? line)
#f
(or (pred line) (loop)))))))
(loop)))
(close-input-port port))
result))
(define (get-link cmd file)
(if cmd
(let ((command (string-append "<code>" cmd)))
(any-file-line (lambda (line)
(if (substring-index command line)
(let ((result (string-search pattern line)))
(if result (cadr result) #f))
#f))
file))
#f))
(define (browse browser url)
(let ([[s (substring-index "%%" browser))
(system
(if s
(string-substitute "%%" url browser)
(string-append browser url ) ) ) ) )
(define (main . args)
(let-optionals args
((cmd #f) (browser default-browser))
(if cmd
(let ((link (get-link cmd chicken-manual)))
(if link
(browse browser (string-append default-url link))
(write-line (sprintf Command ~A not found. cmd))))
(print "Usage: browsedoc COMMAND [BROWSER]") ) ) )
(apply main (command-line-arguments))
if you want to call the tool from emacs, this does the trick:
(defun run-chickendoc ()
(interactive)
(start-process "chickendoc" *Messages*
"/usr/local/bin/chickendoc" ; path to the script
(symbol-name (symbol-at-point))))
(global-set-key [f7] 'run-chickendoc)
| false |
b2de8144824181630b50114697c6fbfe40f6945d
|
e3d507b46b1588f11510b238dd47aac9f0cd0d4a
|
/06-scheme-4-2020/scm/csound/instrument.scm
|
6b04d1627959da447fc95e3dc83610f939b26664
|
[] |
no_license
|
noisesmith/abject-noise
|
a630b33ac752b14046cb4fee4dd763ed4693c315
|
68a03bc4760e647768e025b13a89bfa77f5ac541
|
refs/heads/master
| 2021-10-11T11:51:34.342060 | 2021-09-30T18:57:57 | 2021-09-30T18:57:57 | 204,066,569 | 0 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 5,122 |
scm
|
instrument.scm
|
(define-module (csound instrument)
#:export (insert patch normalize)
#:use-module (noisesmith clojure)
#:use-module (csound compile)
#:use-module (csound instrument node)
#:use-module (csound instrument plug)
#:re-export (ht ->node compile ->plug))
(use-modules
(ice-9 match)
(noisesmith debug)
(oop goops)
(srfi srfi-1)
(srfi srfi-26))
(define debug (->catalog))
(define-class
<instrument> ()
(synthesis-node-graph
#:init-keyword #:graph
#:init-form (ht)
#:getter graph))
(define-method
(assj (i <instrument>) k v)
(if (equal? k #:graph)
(make <instrument> #:graph v)
i))
(define-method
(get (i <instrument>) k)
(get #h(#:graph (graph i)) k))
(define-method
(get (i <instrument>) k default-fn)
(get #h(#:graph (graph i)) k default-fn))
(define-method
(write (i <instrument>) port)
(display "[<instrument> :graph=" port)
(write (graph i) port)
(display "]" port))
(define-method
(empty? (i <instrument>))
(empty? (graph i)))
(define-method
(insert (i <instrument>) (t <top>) (n <node>))
(let ((connections (assj (graph i) t n)))
(make <instrument>
#:graph connections)))
(define-method
(insert (t <top>) (n <node>))
(insert (make <instrument>) t n))
(define-method
(patch (i <instrument>)
(input <plug>)
(output <plug>))
(let* ((target-entry (get (graph i) (node output)))
(connected (assj (in target-entry) (slot output) input))
(new-node (assj target-entry #:in connected)))
(make <instrument>
#:graph (assj (graph i) (node output) new-node))))
(define-method
(patch (i <instrument>) (input <number>) (output <plug>))
(update-in i (list #:graph (node output) #:in)
assj (slot output) input))
(define-method
(patch (i <instrument>) (input <string>) (output <plug>))
(update-in i (list #:graph (node output) #:in)
assj (slot output) input))
(define-method
(patch (i <instrument>) (target <keyword>) (plugs-keys <list>))
(if (eq? plugs-keys '())
i
(-> i
(patch (car plugs-keys)
(->plug target (cadr plugs-keys)))
(patch target (cddr plugs-keys)))))
(define (inputs-ready? ready? _ v)
(and ready?
(or (string? v)
(number? v))))
(define (split-ready-nodes g)
(reduce-kv (match-lambda*
(((ready not-ready) k v)
(if (reduce-kv inputs-ready? #t (in v))
(list (assj ready k v) not-ready)
(list ready (assj not-ready k v)))))
(list #h() #h())
g))
(define (map-to-token node-key)
(lambda (new-mappings output-key string-token)
(assj new-mappings
(->plug node-key output-key)
string-token)))
(define (derive-input-map nodes)
(reduce-kv (lambda (mapping node-key synth-node)
(hmerge mapping
(reduce-kv (map-to-token node-key)
(out synth-node))))
nodes))
(define (update-input input-map)
(lambda (inputs tag input)
;; look up the plug, or leave as is
(assj inputs tag
(get input-map input
(constantly input)))))
(define (attach-ready-inputs ready)
(lambda (m k v)
(assj m k
(update-in v '(#:in)
(cut reduce-kv (update-input (derive-input-map ready))
<>)))))
(define (stringify-value tag)
(lambda (m out-name prefix)
(assj m out-name (string-append prefix (name tag) "_" (name out-name)))))
(define (name-outputs m k)
(reduce-kv (stringify-value k) m))
(define (tokenize-graph m k v)
(assj m k (update-in v '(#:out) name-outputs k)))
(define (normalize graph)
;; loop
(if (empty? graph)
;; until nodes are empty or (error case) nodes are unresolvable
'()
(match-let (((ready remaining) (split-ready-nodes graph)))
(if (empty? ready)
(throw 'incomplete-compile #h(#:non-ready graph))
;; emit/remove each node in the graph where all inputs are string/number,
(catch 'incomplete-compile
(cut let ((pruned (reduce-kv (attach-ready-inputs ready) remaining)))
(cons ready
(normalize pruned)))
(lambda (_ . e)
(throw 'incomplete-compile (cons ready e))))))))
(define-method
(compile (unit <instrument>) n)
(catch 'incomplete-compile
(cut format #f " instr ~a\n~a endin\n"
n
(->> (graph unit)
(reduce-kv tokenize-graph)
(normalize)
(map vals)
(compile)))
(lambda (_ . e)
(string-append "no nodes ready! \n"
(call-with-output-string (lambda (p)
(write e p)))))))
| false |
4a4b18e7344d3aa3ad897691f98a7e4756e32433
|
defeada37d39bca09ef76f66f38683754c0a6aa0
|
/System.Core/system/threading/lock-recursion-exception.sls
|
6e4d9d0a4690a8a2f52243e97572f14f7e1e02af
|
[] |
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 | 449 |
sls
|
lock-recursion-exception.sls
|
(library (system threading lock-recursion-exception)
(export new is? lock-recursion-exception?)
(import (ironscheme-clr-port))
(define-syntax new
(lambda (e)
(syntax-case e ()
((_ a ...)
#'(clr-new System.Threading.LockRecursionException a ...)))))
(define (is? a) (clr-is System.Threading.LockRecursionException a))
(define (lock-recursion-exception? a)
(clr-is System.Threading.LockRecursionException a)))
| true |
33e0b39881c54b777486d879c0c57329ad6108df
|
b9eb119317d72a6742dce6db5be8c1f78c7275ad
|
/racket/srv/test.ss
|
863628646eb70f211d346fdee221b2559cfc5a16
|
[] |
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 | 1,784 |
ss
|
test.ss
|
#! /bin/sh
#| Hey Emacs, this is -*-scheme-*- code!
#$Id$
exec mzscheme --no-init-file --mute-banner --version --require "$0"
|#
(module test mzscheme
(require (lib "thread.ss")
"server.ss")
(define *the-port* 1234)
(define *s*
(thread
(lambda ()
(fprintf (current-error-port)
"OK, Daddy-o, lay it on me~%")
(run-server *the-port* server-loop #f))))
(define (make-client)
(call-with-values
(lambda ()
(let retry ((attempts 0))
(with-handlers
([exn:fail:network?
(lambda (e)
(fprintf (current-error-port)
"Darn: ~s"
e)
(when (< attempts 3)
(sleep 1/2)
(display "; retrying" (current-error-port))
(newline (current-error-port))
(retry (add1 attempts))))])
(tcp-connect "localhost" *the-port*))))
(lambda (ip op)
(file-stream-buffer-mode op 'line)
(fprintf (current-error-port)
"New client sees greeting ~s~%"
(read ip))
(cons ip op))))
(define one-client (make-client))
(define another-client (make-client))
(define (send datum client)
(write datum (cdr client))
(newline (cdr client))
(fprintf (current-error-port)
"Sent ~s; got ~s~%"
datum
(read (car client))))
(send 'heebie one-client)
(send 'jeebie another-client)
(send 'list-tables one-client)
(send 'join-any one-client)
(send 'join-any another-client)
(send 'join-any (make-client))
(send 'join-any (make-client))
(send 'join-any (make-client))
(send '(join 2) one-client)
(send 'list-tables (make-client))
(send 'die one-client)
(sync *s*)
)
| false |
d036759df488f97a75204ec52fa319255799daab
|
ac587213fe223ddf6d60893b02b7b69a3783a38a
|
/make-chicken-units/make-chicken-units.scm
|
6f150e7a228ea393a1298cad9d7ab174cc5b272e
|
[] |
no_license
|
BernardBeefheart/bbslib
|
eef90ca19d6a87f0588029e40be98f15029f2379
|
d4a199fe53a55bf43446804313b81f97ab637d83
|
refs/heads/master
| 2021-01-17T12:42:42.730263 | 2016-06-12T19:47:46 | 2016-06-12T19:47:46 | 20,342,080 | 1 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 1,867 |
scm
|
make-chicken-units.scm
|
;; ======================================================================
;; make-chicken-units.scm
;; compilation : csc make-chicken-units.scm
;; usage : make-chicken-units source-file unit-name output-file
;; ======================================================================
(require-extension matchable)
(require-extension coops)
(require-extension coops-primitive-objects)
(declare (uses extras))
(declare (uses application))
(include "application-inc.scm")
(define-method (dohelp (self <Application>) (exit-code <integer>))
(printf "~A source-file unit output-file~%" (slot-value self 'exe-name))
(printf "Adds the following line:~%")
(printf " (declare (unit ~A))~%" "unit-name")
(printf "at the beginning of output-file~%")
(printf "and copy source-file after.")
(exit exit-code))
(define *application* (make <Application>
'exe-name (car (argv))
'version "1.0.2"))
(define get-file
(lambda (file-name)
(handle-file-operation
*application*
"read"
(lambda ()
(read-lines file-name)))))
(define file->unit
(lambda (file-name unit-name output-file-name)
(let ((file-content (get-file file-name)))
(letrec ((write-file-content
(lambda (port rest)
(when (not (null? rest))
(fprintf port "~A~%" (car rest))
(write-file-content port (cdr rest))))))
(handle-file-operation
*application*
"write"
(lambda ()
(call-with-output-file output-file-name
(lambda (port)
(fprintf port "(declare (unit ~A))~%" unit-name)
(write-file-content port file-content)))))))))
(define main
(lambda()
(let ((args (cdr (argv))))
(match args
(() (dohelp *application* 0))
(("--help") (dohelp *application* 0))
((source-file unit output-file) (file->unit source-file unit output-file))
(_ (on-bad-argument *application*))))))
(main)
| false |
6eff09229f6f1e12dff745e036ef4a1d16c06256
|
97f1e07c512c33424c4282875a1c31dc89e56bd2
|
/limsn/patches/cookie.scm
|
4ccaaf582f33607f4f814ac2f1edac5277fcd352
|
[] |
no_license
|
labsolns/limsn
|
909ebf9bbd0201d5587b02a04909082ed63b178c
|
f5366a4a6920ac3a80fb80b026b840618d7af6d6
|
refs/heads/main
| 2023-07-20T07:59:28.475916 | 2021-08-25T06:30:51 | 2021-08-25T06:30:51 | 399,366,582 | 0 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 6,706 |
scm
|
cookie.scm
|
;; -*- indent-tabs-mode:nil; coding: utf-8 -*-
;; Copyright (C) 2013,2014,2015,2017,2018,2021
;; "Mu Lei" known as "NalaGinrut" <[email protected]>
;; Artanis is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License and GNU
;; Lesser General Public License published by the Free Software
;; Foundation, either version 3 of the License, or (at your option)
;; any later version.
;; Artanis 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 and GNU Lesser General Public License
;; for more details.
;; You should have received a copy of the GNU General Public License
;; and GNU Lesser General Public License along with this program.
;; If not, see <http://www.gnu.org/licenses/>.
(define-module (artanis cookie)
#:use-module (artanis utils)
#:use-module (artanis config)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-9)
#:export (make-cookie
cookie?
cookie-set!
cookie-ref
cookie-delete!
generate-cookies
header-string->cookie
cookie->header-string
new-cookie
request-cookies
cookie-has-key?
get-value-from-cookie-name
cookies-maker
cookie-modify))
;; NOTE: server side never check cookie expires, it's client's duty
;; server only check sessions expires
;; inner cookie, you shouldn't use it directly, try new-cookie
(define-record-type cookie
(make-cookie nvp expires domain path secure http-only)
cookie?
(nvp cookie-nvp cookie-nvp!) ; Name-Value-Pairs of the cookie
(expires cookie-expires cookie-expires!) ; The expiration in Greenwich Mean Time
(domain cookie-domain cookie-domain!) ; The domain the cookie is good for
(path cookie-path cookie-path!) ; The path the cookie is good for
;; keep cookie communication limited to encrypted transmission
(secure cookie-secure cookie-secure!) ; The secure need of cookie
(http-only cookie-httponly cookie-httponly!)) ; http-only
;; NOTE: expires should be positive integer
(define* (cookie-modify ck #:key expires domain path secure http-only)
(and expires (positive? expires) (cookie-expires! ck (make-expires expires)))
(and domain (cookie-domain! ck domain))
(and path (cookie-path! ck path))
(and secure (cookie-secure! ck secure))
(and http-only (cookie-httponly! ck http-only)))
(define (nvp name v-ref)
(lambda (c)
(list (list name (v-ref c)))))
(define (nvp->string nvp)
(let ((v (cdr nvp)))
(if (boolean? v)
(if v (car nvp) (format #f "~a=\"\"" (car nvp)))
(format #f "~a=~a" (car nvp) v))))
(define *cookie-keywords*
'("Expires" "Path" "Domain" "Secure" "HttpOnly"))
;; NOTE: string comparing has to use 'equal?' which is 'member' used.
;; according to R5Rs
(define (is-cookie-keywords? item)
(or (not (list? item))
(member (car item) *cookie-keywords* string=?)))
(define (get-from-cookie al key)
(let ((val (assoc-ref al key)))
(and val (car val))))
(define (header-string->cookie str)
(let* ((ll (map (lambda (e)
(if (string-contains e "=")
(map string-trim-both (string-split e #\=))
(string-trim-both e)))
(string-split str #\;)))
(nvp (let lp((rest ll) (result '()))
(cond
((or (null? rest) (is-cookie-keywords? (car rest)))
result) ; drop the pair after keyword-value-pair
(else (lp (cdr rest) (cons (car rest) result))))))
(cookie (new-cookie #:expires (get-from-cookie ll "Expires")
#:path (get-from-cookie ll "Path")
#:domain (get-from-cookie ll "Domain")
#:secure (get-from-cookie ll "Secure")
#:http-only (get-from-cookie ll "HttpOnly"))))
(cookie-nvp! cookie nvp) ; insert cookie key-value pair table
cookie))
(define (cookie->header-string cookie)
(let ((nvps (string-join (map nvp->string (cookie-nvp cookie)) "; "))
(expires (cookie-expires cookie))
(path (cookie-path cookie))
(domain (cookie-domain cookie))
(secure (cookie-secure cookie))
(http-only (cookie-httponly cookie)))
(call-with-output-string
(lambda (port)
(format port "~a" nvps)
(and expires (format port "; Expires=~a" expires))
(and domain (format port "; Domain=~a" domain))
(and path (format port "; Path=~a" path))
(and secure (display "; Secure" port))
(and http-only (display "; HttpOnly" port))))))
(define (generate-cookies cookies)
(map (lambda (c) `(set-cookie . ,(cookie->header-string c))) cookies))
(define *the-remove-expires* "Thu, 01 Jan 1970 00:00:00 GMT")
;; NOTE: expires should be integer
;; NOTE: When we set #:expires to #t for removing the cookie, #:path MUST be "/".
;; Otherwise the client may not clear the cookie correctly.
(define* (new-cookie #:key (expires (get-conf '(cookie expire))) ; expires in seconds
(npv '())
(path #f) (domain #f)
(secure #f) (http-only #t))
(let ((e (cond
((eq? expires #t) *the-remove-expires*)
((integer? expires) (make-expires expires))
(else #f)))) ; else #f for no expires
(make-cookie npv e domain path secure http-only)))
(define (cookie-set! cookie name value)
(let ((nvp (cookie-nvp cookie)))
(cookie-nvp! cookie (assoc-set! nvp name value))))
(define (cookie-ref cookie name)
(when (not (cookie? cookie))
(throw 'artanis-err 500 cookie-ref "BUG: Invalid cookie: ~a!" cookie))
(let ((nvp (cookie-nvp cookie)))
(assoc-ref nvp name)))
(define (cookie-delete! cookie name)
(let ((nvp (cookie-nvp cookie)))
(cookie-nvp! cookie (assoc-remove! nvp name))))
(define (header->cookies header)
;;(format #t "header==> ~a~%" header)
(fold (lambda (x p)
(if (eqv? 'cookie (car x))
(cons (cdr x) p)
p))
'() header))
(define (request-cookies req)
(let ((cookies-str (header->cookies (request-headers req))))
;;(format #t "cookies-str: ~a~%" cookies-str)
(map header-string->cookie cookies-str)))
(define (cookie-has-key? ckl key)
(any (lambda (x) (and (cookie-ref x key) x)) ckl))
(define (get-value-from-cookie-name ckl key)
(any (lambda (x) (and=> (cookie-ref x key) car)) ckl))
| false |
13aca8153ec99c1d72962017d44e439d2a82cf9b
|
a178d245493d36d43fdb51eaad2df32df4d1bc8b
|
/GrammarCompiler/main.ss
|
5f9fab503d26e6668b6cbc92c160f75d5420de55
|
[] |
no_license
|
iomeone/testscheme
|
cfc560f4b3a774064f22dd37ab0735fbfe694e76
|
6ddf5ec8c099fa4776f88a50eda78cd62f3a4e77
|
refs/heads/master
| 2020-12-10T10:52:40.767444 | 2020-01-15T08:40:07 | 2020-01-15T08:40:07 | 233,573,451 | 0 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 2,951 |
ss
|
main.ss
|
(library (GrammarCompiler main)
(export compile-grammars scheme-path haskell-path)
(import (chezscheme)
(GrammarCompiler common match)
(GrammarCompiler common aux)
(GrammarCompiler common desugar-directives)
(GrammarCompiler haskell flatten-datatypes)
(GrammarCompiler haskell derive-printing)
(GrammarCompiler haskell assign-tags)
;(GrammarCompiler haskell derive-parsing)
(GrammarCompiler haskell lift-prints)
(GrammarCompiler haskell emit-haskell)
(GrammarCompiler scheme generate-verify)
(GrammarCompiler scheme emit-scheme))
(define (scheme-path x) (syntax-violation #f "misplaced aux keyword" x))
(define (haskell-path x) (syntax-violation #f "misplaced aux keyword" x))
(define-syntax compile-grammars
(syntax-rules (scheme-path haskell-path)
((_ src (scheme-path ss-path) (haskell-path hs-path))
(main src ss-path hs-path))))
(define haskell-passes
(compose
flatten-datatypes
derive-printing
assign-tags
;derive-parsing))
lift-prints))
(define scheme-passes
(compose
generate-verify))
(define main
(lambda (source-file scheme-path haskell-path)
(let ((grammars (read-file source-file)))
(printf "========================================\n")
(printf " Desugared grammars: \n")
(printf "========================================\n")
(match (desugar-directives grammars)
((p423-grammars (,name* . ,g*) ...)
(printf "========================================\n")
(map (lambda (name g)
(printf " * Codegen for grammar: ~s\n" name)
(let ((g `(,name . ,g)))
(begin
(write-haskell haskell-path name g)
(write-scheme scheme-path name g))))
name* g*))))))
(define write-code
(lambda (code-f name-f suf out-f path name g)
(let ((code (code-f g))
(outfile
(string-append
path "/"
(name-f (symbol->string name))
suf)))
(with-output-to-file outfile
(lambda ()
(out-f code))
'replace)
name)))
(define write-haskell
(lambda (path name code)
(write-code haskell-passes
(compose scheme->haskell/string
capitalize-string)
".hs"
(emit-haskell path)
;pretty-print
path
name
code)))
(define write-scheme
(lambda (path name code)
(write-code scheme-passes
scheme->filename/string
".ss"
(emit-scheme name (verifier-name name))
path
name
code)))
(define read-file
(lambda (f)
(call-with-input-file f read)))
)
| true |
73fbd93a3675128dd413f8f96247d44ffaac5ce4
|
11f8c62565512010ec8bd59d929a35063be7bb2a
|
/compiler/src/main/scheme/libraries/llambda/internal/repl.scm
|
c53268efeb107e81de6543ac701732c5a927e902
|
[
"Apache-2.0"
] |
permissive
|
etaoins/llambda
|
97b986e40d8aa6871a5ab1946b53c2898313776b
|
a2a5c212ebb56701fa28649c377d0ddd8b67da0b
|
refs/heads/master
| 2020-05-26T18:43:11.776115 | 2018-01-03T07:40:49 | 2018-01-03T07:40:49 | 9,960,891 | 71 | 7 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 264 |
scm
|
repl.scm
|
(define-library (llambda internal repl)
(import (llambda base))
(import (llambda typed))
(import (llambda nfi))
(export write-stdout)
(begin
(define write-stdout (native-function system-library "llcore_write_stdout" (-> <any> <unit>) nocapture))))
| false |
6229811c7e52b2cc1585c7bc53791e41f6f1986f
|
9c811b91d38d6c2250df1f6612cd115745da031b
|
/mk.scm
|
c37c8f6c10014616bd6c97d18fda597d9f3d4638
|
[
"MIT"
] |
permissive
|
webyrd/copyo
|
1a7ba6226fb08acf9b7fc4544b75fcd404796e14
|
d5bf684cdf30eff8ec637ee79f0de55cd7311289
|
refs/heads/master
| 2021-01-01T19:46:49.185864 | 2014-01-02T03:07:24 | 2014-01-02T03:07:24 | 15,574,496 | 1 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 33,812 |
scm
|
mk.scm
|
;;; newer version: Sept. 18 2013 (with eigens)
;;; Jason Hemann, Will Byrd, and Dan Friedman
;;; E = (e* . x*)*, where e* is a list of eigens and x* is a list of variables.
;;; Each e in e* is checked for any of its eigens be in any of its x*. Then it fails.
;;; Since eigen-occurs-check is chasing variables, we might as will do a memq instead
;;; of an eq? when an eigen is found through a chain of walks. See eigen-occurs-check.
;;; All the e* must be the eigens created as part of a single eigen. The reifier just
;;; abandons E, if it succeeds. If there is no failure by then, there were no eigen
;;; violations.
(load "au.scm") ; anti-unification/lgg code
(define sort list-sort)
(define empty-c '(() () () () () () () ()))
(define eigen-tag (vector 'eigen-tag))
(define-syntax inc
(syntax-rules ()
((_ e) (lambdaf@ () e))))
(define-syntax lambdaf@
(syntax-rules ()
((_ () e) (lambda () e))))
(define-syntax lambdag@
(syntax-rules (:)
((_ (c) e) (lambda (c) e))
((_ (c : B E S) e)
(lambda (c)
(let ((B (c->B c)) (E (c->E c)) (S (c->S c)))
e)))
((_ (c : B E S D Y N T C) e)
(lambda (c)
(let ((B (c->B c)) (E (c->E c)) (S (c->S c)) (D (c->D c))
(Y (c->Y c)) (N (c->N c)) (T (c->T c)) (C (c->C c)))
e)))))
(define rhs
(lambda (pr)
(cdr pr)))
(define lhs
(lambda (pr)
(car pr)))
(define eigen-var
(lambda ()
(vector eigen-tag)))
(define eigen?
(lambda (x)
(and (vector? x) (eq? (vector-ref x 0) eigen-tag))))
(define var
(lambda (dummy)
(vector dummy)))
(define var?
(lambda (x)
(and (vector? x) (not (eq? (vector-ref x 0) eigen-tag)))))
(define walk
(lambda (u S)
(cond
((and (var? u) (assq u S)) =>
(lambda (pr) (walk (rhs pr) S)))
(else u))))
(define prefix-S
(lambda (S+ S)
(cond
((eq? S+ S) '())
(else (cons (car S+)
(prefix-S (cdr S+) S))))))
(define unify
(lambda (u v s)
(let ((u (walk u s))
(v (walk v s)))
(cond
((eq? u v) s)
((var? u) (ext-s-check u v s))
((var? v) (ext-s-check v u s))
((and (pair? u) (pair? v))
(let ((s (unify (car u) (car v) s)))
(and s (unify (cdr u) (cdr v) s))))
((or (eigen? u) (eigen? v)) #f)
((equal? u v) s)
(else #f)))))
(define occurs-check
(lambda (x v s)
(let ((v (walk v s)))
(cond
((var? v) (eq? v x))
((pair? v)
(or
(occurs-check x (car v) s)
(occurs-check x (cdr v) s)))
(else #f)))))
(define eigen-occurs-check
(lambda (e* x s)
(let ((x (walk x s)))
(cond
((var? x) #f)
((eigen? x) (memq x e*))
((pair? x)
(or
(eigen-occurs-check e* (car x) s)
(eigen-occurs-check e* (cdr x) s)))
(else #f)))))
(define empty-f (lambdaf@ () (mzero)))
(define ext-s-check
(lambda (x v s)
(cond
((occurs-check x v s) #f)
(else (cons `(,x . ,v) s)))))
(define unify*
(lambda (S+ S)
(unify (map lhs S+) (map rhs S+) S)))
(define-syntax case-inf
(syntax-rules ()
((_ e (() e0) ((f^) e1) ((c^) e2) ((c f) e3))
(let ((c-inf e))
(cond
((not c-inf) e0)
((procedure? c-inf) (let ((f^ c-inf)) e1))
((not (and (pair? c-inf)
(procedure? (cdr c-inf))))
(let ((c^ c-inf)) e2))
(else (let ((c (car c-inf)) (f (cdr c-inf)))
e3)))))))
(define-syntax fresh
(syntax-rules ()
((_ (x ...) g0 g ...)
(lambdag@ (c : B E S D Y N T C)
(inc
(let ((x (var 'x)) ...)
(let ((B (append `(,x ...) B)))
(bind* (g0 `(,B ,E ,S ,D ,Y ,N ,T ,C)) g ...))))))))
(define-syntax eigen
(syntax-rules ()
((_ (x ...) g0 g ...)
(lambdag@ (c : B E S)
(let ((x (eigen-var)) ...)
((fresh () (eigen-absento `(,x ...) B) g0 g ...) c))))))
(define-syntax bind*
(syntax-rules ()
((_ e) e)
((_ e g0 g ...) (bind* (bind e g0) g ...))))
(define bind
(lambda (c-inf g)
(case-inf c-inf
(() (mzero))
((f) (inc (bind (f) g)))
((c) (g c))
((c f) (mplus (g c) (lambdaf@ () (bind (f) g)))))))
(define-syntax run
(syntax-rules ()
((_ n (q) g0 g ...)
(take n
(lambdaf@ ()
((fresh (q) g0 g ...
(lambdag@ (final-c)
(let ((z ((reify q) final-c)))
(choice z empty-f))))
empty-c))))
((_ n (q0 q1 q ...) g0 g ...)
(run n (x) (fresh (q0 q1 q ...) g0 g ... (== `(,q0 ,q1 ,q ...) x))))))
(define-syntax run*
(syntax-rules ()
((_ (q0 q ...) g0 g ...) (run #f (q0 q ...) g0 g ...))))
(define take
(lambda (n f)
(cond
((and n (zero? n)) '())
(else
(case-inf (f)
(() '())
((f) (take n f))
((c) (cons c '()))
((c f) (cons c
(take (and n (- n 1)) f))))))))
(define-syntax conde
(syntax-rules ()
((_ (g0 g ...) (g1 g^ ...) ...)
(lambdag@ (c)
(inc
(mplus*
(bind* (g0 c) g ...)
(bind* (g1 c) g^ ...) ...))))))
(define-syntax mplus*
(syntax-rules ()
((_ e) e)
((_ e0 e ...) (mplus e0
(lambdaf@ () (mplus* e ...))))))
(define mplus
(lambda (c-inf f)
(case-inf c-inf
(() (f))
((f^) (inc (mplus (f) f^)))
((c) (choice c f))
((c f^) (choice c (lambdaf@ () (mplus (f) f^)))))))
(define c->B (lambda (c) (car c)))
(define c->E (lambda (c) (cadr c)))
(define c->S (lambda (c) (caddr c)))
(define c->D (lambda (c) (cadddr c)))
(define c->Y (lambda (c) (cadddr (cdr c))))
(define c->N (lambda (c) (cadddr (cddr c))))
(define c->T (lambda (c) (cadddr (cdddr c))))
(define c->C (lambda (c) (cadddr (cddddr c))))
(define-syntax conda
(syntax-rules ()
((_ (g0 g ...) (g1 g^ ...) ...)
(lambdag@ (c)
(inc
(ifa ((g0 c) g ...)
((g1 c) g^ ...) ...))))))
(define-syntax ifa
(syntax-rules ()
((_) (mzero))
((_ (e g ...) b ...)
(let loop ((c-inf e))
(case-inf c-inf
(() (ifa b ...))
((f) (inc (loop (f))))
((a) (bind* c-inf g ...))
((a f) (bind* c-inf g ...)))))))
(define-syntax condu
(syntax-rules ()
((_ (g0 g ...) (g1 g^ ...) ...)
(lambdag@ (c)
(inc
(ifu ((g0 c) g ...)
((g1 c) g^ ...) ...))))))
(define-syntax ifu
(syntax-rules ()
((_) (mzero))
((_ (e g ...) b ...)
(let loop ((c-inf e))
(case-inf c-inf
(() (ifu b ...))
((f) (inc (loop (f))))
((c) (bind* c-inf g ...))
((c f) (bind* (unit c) g ...)))))))
(define mzero (lambda () #f))
(define unit (lambda (c) c))
(define choice (lambda (c f) (cons c f)))
(define tagged?
(lambda (S Y y^)
(exists (lambda (y) (eqv? (walk y S) y^)) Y)))
(define untyped-var?
(lambda (S Y N t^)
(let ((in-type? (lambda (y) (eq? (walk y S) t^))))
(and (var? t^)
(not (exists in-type? Y))
(not (exists in-type? N))))))
(define-syntax project
(syntax-rules ()
((_ (x ...) g g* ...)
(lambdag@ (c : B E S)
(let ((x (walk* x S)) ...)
((fresh () g g* ...) c))))))
(define walk*
(lambda (v S)
(let ((v (walk v S)))
(cond
((var? v) v)
((pair? v)
(cons (walk* (car v) S) (walk* (cdr v) S)))
(else v)))))
(define reify-S
(lambda (v S rn)
(let ((v (walk v S)))
(cond
((var? v)
(let ((n (length S)))
(let ((name (rn n)))
(cons `(,v . ,name) S))))
((pair? v)
(let ((S (reify-S (car v) S rn)))
(reify-S (cdr v) S rn)))
(else S)))))
(define reify-name
(lambda (n)
(reify-name-aux n "_")))
(define reify-f-name
(lambda (n)
(reify-name-aux n "f")))
(define reify-name-aux
(lambda (n str)
(string->symbol
(string-append str "." (number->string n)))))
(define drop-dot
(lambda (X)
(map (lambda (t)
(let ((a (lhs t))
(d (rhs t)))
`(,a ,d)))
X)))
(define sorter
(lambda (ls)
(sort lex<=? ls)))
(define lex<=?
(lambda (x y)
(string<=? (datum->string x) (datum->string y))))
(define datum->string
(lambda (x)
(call-with-string-output-port
(lambda (p) (display x p)))))
(define anyvar?
(lambda (u r)
(cond
((pair? u)
(or (anyvar? (car u) r)
(anyvar? (cdr u) r)))
(else (var? (walk u r))))))
(define anyeigen?
(lambda (u r)
(cond
((pair? u)
(or (anyeigen? (car u) r)
(anyeigen? (cdr u) r)))
(else (eigen? (walk u r))))))
(define member*
(lambda (u v)
(cond
((equal? u v) #t)
((pair? v)
(or (member* u (car v)) (member* u (cdr v))))
(else #f))))
(define drop-N-b/c-const
(lambdag@ (c : B E S D Y N T C)
(let ((const? (lambda (n)
(not (var? (walk n S))))))
(cond
((find const? N) =>
(lambda (n) `(,B ,E ,S ,D ,Y ,(remq1 n N) ,T ,C)))
(else c)))))
(define drop-Y-b/c-const
(lambdag@ (c : B E S D Y N T C)
(let ((const? (lambda (y)
(not (var? (walk y S))))))
(cond
((find const? Y) =>
(lambda (y) `(,B ,E ,S ,D ,(remq1 y Y) ,N ,T ,C)))
(else c)))))
(define remq1
(lambda (elem ls)
(cond
((null? ls) '())
((eq? (car ls) elem) (cdr ls))
(else (cons (car ls) (remq1 elem (cdr ls)))))))
(define same-var?
(lambda (v)
(lambda (v^)
(and (var? v) (var? v^) (eq? v v^)))))
(define find-dup
(lambda (f S)
(lambda (set)
(let loop ((set^ set))
(cond
((null? set^) #f)
(else
(let ((elem (car set^)))
(let ((elem^ (walk elem S)))
(cond
((find (lambda (elem^^)
((f elem^) (walk elem^^ S)))
(cdr set^))
elem)
(else (loop (cdr set^))))))))))))
(define drop-N-b/c-dup-var
(lambdag@ (c : B E S D Y N T C)
(cond
(((find-dup same-var? S) N) =>
(lambda (n) `(,B ,E ,S ,D ,Y ,(remq1 n N) ,T ,C)))
(else c))))
(define drop-Y-b/c-dup-var
(lambdag@ (c : B E S D Y N T C)
(cond
(((find-dup same-var? S) Y) =>
(lambda (y)
`(,B E ,S ,D ,(remq1 y Y) ,N ,T ,C)))
(else c))))
(define var-type-mismatch?
(lambda (S Y N t1^ t2^)
(cond
((num? S N t1^) (not (num? S N t2^)))
((sym? S Y t1^) (not (sym? S Y t2^)))
(else #f))))
(define term-ununifiable?
(lambda (S Y N t1 t2)
(let ((t1^ (walk t1 S))
(t2^ (walk t2 S)))
(cond
((or (untyped-var? S Y N t1^) (untyped-var? S Y N t2^)) #f)
((var? t1^) (var-type-mismatch? S Y N t1^ t2^))
((var? t2^) (var-type-mismatch? S Y N t2^ t1^))
((and (pair? t1^) (pair? t2^))
(or (term-ununifiable? S Y N (car t1^) (car t2^))
(term-ununifiable? S Y N (cdr t1^) (cdr t2^))))
(else (not (eqv? t1^ t2^)))))))
(define T-term-ununifiable?
(lambda (S Y N)
(lambda (t1)
(let ((t1^ (walk t1 S)))
(letrec
((t2-check
(lambda (t2)
(let ((t2^ (walk t2 S)))
(cond
((pair? t2^) (and
(term-ununifiable? S Y N t1^ t2^)
(t2-check (car t2^))
(t2-check (cdr t2^))))
(else (term-ununifiable? S Y N t1^ t2^)))))))
t2-check)))))
(define num?
(lambda (S N n)
(let ((n (walk n S)))
(cond
((var? n) (tagged? S N n))
(else (number? n))))))
(define sym?
(lambda (S Y y)
(let ((y (walk y S)))
(cond
((var? y) (tagged? S Y y))
(else (symbol? y))))))
(define drop-T-b/c-Y-and-N
(lambdag@ (c : B E S D Y N T C)
(let ((drop-t? (T-term-ununifiable? S Y N)))
(cond
((find (lambda (t) ((drop-t? (lhs t)) (rhs t))) T) =>
(lambda (t) `(,B ,E ,S ,D ,Y ,N ,(remq1 t T) ,C)))
(else c)))))
(define move-T-to-D-b/c-t2-atom
(lambdag@ (c : B E S D Y N T C)
(cond
((exists (lambda (t)
(let ((t2^ (walk (rhs t) S)))
(cond
((and (not (untyped-var? S Y N t2^))
(not (pair? t2^)))
(let ((T (remq1 t T)))
`(,B ,E ,S ((,t) . ,D) ,Y ,N ,T ,C)))
(else #f))))
T))
(else c))))
(define terms-pairwise=?
(lambda (pr-a^ pr-d^ t-a^ t-d^ S)
(or
(and (term=? pr-a^ t-a^ S)
(term=? pr-d^ t-a^ S))
(and (term=? pr-a^ t-d^ S)
(term=? pr-d^ t-a^ S)))))
(define T-superfluous-pr?
(lambda (S Y N T)
(lambda (pr)
(let ((pr-a^ (walk (lhs pr) S))
(pr-d^ (walk (rhs pr) S)))
(cond
((exists
(lambda (t)
(let ((t-a^ (walk (lhs t) S))
(t-d^ (walk (rhs t) S)))
(terms-pairwise=? pr-a^ pr-d^ t-a^ t-d^ S)))
T)
(for-all
(lambda (t)
(let ((t-a^ (walk (lhs t) S))
(t-d^ (walk (rhs t) S)))
(or
(not (terms-pairwise=? pr-a^ pr-d^ t-a^ t-d^ S))
(untyped-var? S Y N t-d^)
(pair? t-d^))))
T))
(else #f))))))
(define drop-from-D-b/c-T
(lambdag@ (c : B E S D Y N T C)
(cond
((find
(lambda (d)
(exists
(T-superfluous-pr? S Y N T)
d))
D) =>
(lambda (d) `(,B ,E ,S ,(remq1 d D) ,Y ,N ,T ,C)))
(else c))))
(define drop-t-b/c-t2-occurs-t1
(lambdag@ (c : B E S D Y N T C)
(cond
((find (lambda (t)
(let ((t-a^ (walk (lhs t) S))
(t-d^ (walk (rhs t) S)))
(mem-check t-d^ t-a^ S)))
T) =>
(lambda (t)
`(,B ,E ,S ,D ,Y ,N ,(remq1 t T) ,C)))
(else c))))
(define split-t-move-to-d-b/c-pair
(lambdag@ (c : B E S D Y N T C)
(cond
((exists
(lambda (t)
(let ((t2^ (walk (rhs t) S)))
(cond
((pair? t2^) (let ((ta `(,(lhs t) . ,(car t2^)))
(td `(,(lhs t) . ,(cdr t2^))))
(let ((T `(,ta ,td . ,(remq1 t T))))
`(,B ,E ,S ((,t) . ,D) ,Y ,N ,T ,C))))
(else #f))))
T))
(else c))))
(define find-d-conflict
(lambda (S Y N)
(lambda (D)
(find
(lambda (d)
(exists (lambda (pr)
(term-ununifiable? S Y N (lhs pr) (rhs pr)))
d))
D))))
(define drop-D-b/c-Y-or-N
(lambdag@ (c : B E S D Y N T C)
(cond
(((find-d-conflict S Y N) D) =>
(lambda (d) `(,B ,E ,S ,(remq1 d D) ,Y ,N ,T ,C)))
(else c))))
(define cycle
(lambdag@ (c)
(let loop ((c^ c)
(fns^ (LOF))
(n (length (LOF))))
(cond
((zero? n) c^)
((null? fns^) (loop c^ (LOF) n))
(else
(let ((c^^ ((car fns^) c^)))
(cond
((not (eq? c^^ c^))
(loop c^^ (cdr fns^) (length (LOF))))
(else (loop c^ (cdr fns^) (sub1 n))))))))))
(define absento
(lambda (u v)
(lambdag@ (c : B E S D Y N T C)
(cond
[(mem-check u v S) (mzero)]
[else (unit `(,B ,E ,S ,D ,Y ,N ((,u . ,v) . ,T) ,C))]))))
(define eigen-absento
(lambda (e* x*)
(lambdag@ (c : B E S D Y N T C)
(cond
[(eigen-occurs-check e* x* S) (mzero)]
[else (unit `(,B ((,e* . ,x*) . ,E) ,S ,D ,Y ,N ,T ,C))]))))
(define mem-check
(lambda (u t S)
(let ((t (walk t S)))
(cond
((pair? t)
(or (term=? u t S)
(mem-check u (car t) S)
(mem-check u (cdr t) S)))
(else (term=? u t S))))))
(define term=?
(lambda (u t S)
(cond
((unify u t S) =>
(lambda (S0)
(eq? S0 S)))
(else #f))))
(define ground-non-<type>?
(lambda (pred)
(lambda (u S)
(let ((u (walk u S)))
(cond
((var? u) #f)
(else (not (pred u))))))))
(define ground-non-symbol?
(ground-non-<type>? symbol?))
(define ground-non-number?
(ground-non-<type>? number?))
(define symbolo
(lambda (u)
(lambdag@ (c : B E S D Y N T C)
(cond
[(ground-non-symbol? u S) (mzero)]
[(mem-check u N S) (mzero)]
[else (unit `(,B ,E ,S ,D (,u . ,Y) ,N ,T ,C))]))))
(define numbero
(lambda (u)
(lambdag@ (c : B E S D Y N T C)
(cond
[(ground-non-number? u S) (mzero)]
[(mem-check u Y S) (mzero)]
[else (unit `(,B ,E ,S ,D ,Y (,u . ,N) ,T ,C))]))))
(define genny (lambda (c n) (string->symbol (list->string (list c #\_ (integer->char (+ n (char->integer #\0))))))))
(define copyo
(lambda (u v)
(lambdag@ (c : B E S D Y N T C)
(let ((u (walk* u S))
(v (walk* v S)))
(let ((c (update-copyo `(,B ,E ,S ,D ,Y ,N ,T ((,u . ,v) . ,C)))))
(if c
(unit c)
(mzero)))))))
(define main-update-C
(lambdag@ (c : B E S D Y N T C)
(let loop ((C C)
(C^ '())
(S S)
(done-flag #t))
(cond
((null? C)
(let ((C (reverse C^)))
(cond
((==fail-check B E S D Y N T C "main-update-C") (values #f done-flag))
(else (values `(,B ,E ,S ,D ,Y ,N ,T ,C) done-flag)))))
(else
(let ((p (car C)))
(let ((u (car p))
(v (cdr p)))
(let ((u1 (walk* u S))
(v1 (walk* v S)))
(let ((done-flag (and done-flag (not (more-general-than v1 u1 S)))))
(let ((u^/v^ (replace-vars `(,u1 . ,v1))))
(let ((u^ (car u^/v^))
(v^ (cdr u^/v^)))
(cond
((unify u^ v^ S) =>
(lambda (S0)
(cond
((unify v^ v1 S0) =>
(lambda (S1)
(let ((u^ (walk* u^ S1))
(v^ (walk* v^ S1)))
(loop (cdr C) `((,u1 . ,v^) . ,C^) S1 done-flag))))
(else (values #f done-flag)))))
(else (values #f done-flag))))))))))))))
(define handle-cycles-in-C
(lambdag@ (c : B E S D Y N T C)
(let ((orig-C C))
(let loop ((C C)
(S S)
(C^ '()))
(cond
((null? C)
(let ((C (reverse C^)))
(cond
((==fail-check B E S D Y N T C "handle-cycles-in-C") #f)
(else `(,B ,E ,S ,D ,Y ,N ,T ,C)))))
(else
(let ((p (car C)))
(let ((u (car p)))
(let ((chain (get-chain u orig-C S)))
(if chain
(let ((S (unify-all chain S)))
(if S
(loop (cdr C) S (cons (walk* p S) C^))
(error 'handle-cycles-in-C "unexpected failed unification in handle-cycles-in-C")))
(loop (cdr C) S (cons (walk* p S) C^))))))))))))
(define get-chain
(lambda (u C S)
(let loop ((u u)
(chain (list u)))
(cond
((ass-term-equal u C S) =>
(lambda (p)
(let ((v (cdr p)))
(let ((chain^ `(,v . ,chain)))
(if (mem-term-equal? v chain S)
chain^
(loop v chain^))))))
(else #f)))))
(define ground?
(lambda (u S)
(not (anyvar? u S))))
(define get-rhs*-from-lhs-of-C
(lambda (u C S)
(let ((u (walk* u S))
(C (walk* C S)))
(let loop ((C C)
(ls '()))
(cond
((null? C) (reverse ls))
(else
(let ((u^ (caar C)))
(if (term-equal? u u^ S)
(loop (cdr C) (cons (cdar C) ls))
(loop (cdr C) ls)))))))))
(define get-unique-lhs*-of-C
(lambda (C S)
(let ((C (walk* C S)))
(let loop ((C C)
(ls '()))
(cond
((null? C) (reverse ls))
(else
(let ((u (caar C)))
(if (mem-term-equal? u ls S)
(loop (cdr C) ls)
(loop (cdr C) (cons u ls))))))))))
#|
(define ground-enough?
(lambda (rhs* lgg S)
(ground? rhs* S)))
|#
(define ground-enough?
(lambda (rhs* lgg S)
(let ((rhs* (walk* rhs* S))
(lgg (walk* lgg S)))
(let loop ((rhs* rhs*))
(cond
((null? rhs*) #t)
(else
(let ((rhs (car rhs*)))
(cond
((unify rhs lgg '()) =>
(lambda (S^)
(if (contains-vars-from-rhs? S^ rhs)
#f
(loop (cdr rhs*)))))
(else (error 'ground-enough? "unification failed unexpectedly"))))))))))
(define contains-vars-from-rhs?
(lambda (S rhs)
(let ((S-vars (get-all-vars S))
(rhs-vars (get-all-vars rhs)))
(ormap (lambda (x) (memq x S-vars)) rhs-vars))))
(define get-all-vars
(lambda (u)
(let loop ((u u)
(ls '()))
(cond
((var? u)
(cond
((memq u ls) ls)
(else (cons u ls))))
((pair? u)
(let ((ls (loop (car u) ls)))
(loop (cdr u) ls)))
(else ls)))))
(define lgg-C
(lambdag@ (c : B E S D Y N T C)
(let ((lhs* (get-unique-lhs*-of-C C S)))
(let ((u*/rhs**
(map (lambda (u)
(let ((rhs* (get-rhs*-from-lhs-of-C u C S)))
(let ((lgg (au rhs*)))
(let ((ground-enough (ground-enough? rhs* lgg S)))
(if (and (> (length rhs*) 1) ground-enough)
(let ((lgg (au rhs*)))
(list u #t rhs* lgg))
(list u #f rhs*))))))
lhs*)))
(let ((u*/rhs** (filter cadr u*/rhs**)))
(let ((u/lgg*
(map
(lambda (u/rhs*) (cons (car u/rhs*) (cadddr u/rhs*)))
u*/rhs**)))
(let ((C
(filter (lambda (p) (not (ass-term-equal (car p) u/lgg* S))) C)))
(let ((C (append u/lgg* C)))
(if (null? u/lgg*)
c
`(,B ,E ,S ,D ,Y ,N ,T ,C))))))))))
(define mem-term-equal?
(lambda (x ls S)
(cond
((null? ls) #f)
((term-equal? (car ls) x S) #t)
(else (mem-term-equal? x (cdr ls) S)))))
(define ass-term-equal
(lambda (x als S)
(cond
((null? als) #f)
((term-equal? (caar als) x S) (car als))
(else (ass-term-equal x (cdr als) S)))))
(define term-equal?
(lambda (u v S)
(eq? (unify u v S) S)))
(define unify-all
(lambda (u* S)
(cond
((null? u*) S)
((null? (cdr u*)) S)
(else
(let ((u1 (car u*))
(u2 (cadr u*)))
(let ((S (unify u1 u2 S)))
(if S
(unify-all (cddr u*) S)
#f)))))))
(define update-C
(lambda (c)
(let-values ([(c done-flag) (main-update-C c)])
(cond
((not c) (values #f done-flag))
(done-flag (values (handle-cycles-in-C c) #t))
(else (update-C c))))))
(define update-copyo-aux
(lambdag@ (c : B E S D Y N T C)
(let ((C (walk* C S)))
(let-values ([(c done-flag) (update-C c)])
(cond
((not c) #f)
(done-flag c)
(else (update-copyo-aux c)))))))
(define update-copyo
(lambdag@ (c)
(update-copyo-aux c)))
(define ==-update-copyo
(lambdag@ (c)
(update-copyo c)))
(define more-general-than
(lambda (u v S)
(cond
((unify u v S) =>
(lambda (S)
(let ((u^ (walk* u S))
(v^ (walk* v S)))
(and (not (same-structure u u^)) (same-structure v v^) #t))))
(else #f))))
(define same-structure
(lambda (u v)
(letrec ((same-structure
(lambda (u v vS)
(cond
((and (pair? u) (pair? v))
(cond
((same-structure (car u) (car v) vS) =>
(lambda (vS)
(same-structure (cdr u) (cdr v) vS)))
(else #f)))
((and (var? u) (var? v))
(cond
((assq v vS) =>
(lambda (p)
(if (eq? (cdr p) u)
vS
#f)))
(else `((,v . ,u) . ,vS))))
((eq? u v) vS)
(else #f)))))
(same-structure u v '()))))
(define ==
(lambda (u v)
(lambdag@ (c : B E S D Y N T C)
(cond
((unify u v S) =>
(lambda (S0)
(cond
((==fail-check B E S0 D Y N T C "==") (mzero))
(else
(let ((c (==-update-copyo `(,B ,E ,S0 ,D ,Y ,N ,T ,C))))
(let ((val (if c
(unit c)
(mzero))))
val))))))
(else (mzero))))))
(define =/=
(lambda (u v)
(lambdag@ (c : B E S D Y N T C)
(cond
((unify u v S) =>
(lambda (S0)
(let ((pfx (prefix-S S0 S)))
(cond
((null? pfx) (mzero))
(else (unit `(,B ,E ,S (,pfx . ,D) ,Y ,N ,T ,C)))))))
(else c)))))
(define succeed (== #f #f))
(define fail (== #f #t))
(define ==fail-check
(lambda (B E S0 D Y N T C . name)
(cond
((eigen-absento-fail-check E S0) #t)
((atomic-fail-check S0 Y ground-non-symbol?) #t)
((atomic-fail-check S0 N ground-non-number?) #t)
((symbolo-numbero-fail-check S0 Y N) #t)
((=/=-fail-check S0 D) #t)
((absento-fail-check S0 T) #t)
((copyo-fail-check S0 C) #t)
(else #f))))
(define eigen-absento-fail-check
(lambda (E S0)
(exists (lambda (e*/x*) (eigen-occurs-check (car e*/x*) (cdr e*/x*) S0)) E)))
(define atomic-fail-check
(lambda (S A pred)
(exists (lambda (a) (pred (walk a S) S)) A)))
(define symbolo-numbero-fail-check
(lambda (S A N)
(let ((N (map (lambda (n) (walk n S)) N)))
(exists (lambda (a) (exists (same-var? (walk a S)) N))
A))))
(define absento-fail-check
(lambda (S T)
(exists (lambda (t) (mem-check (lhs t) (rhs t) S)) T)))
(define copyo-fail-check
(lambda (S C)
(exists (lambda (c) (copy-fail-check (lhs c) (rhs c) S)) C)))
(define copy-fail-check
(lambda (u v S)
(let ((u (walk* u S))
(v (walk* v S)))
(let ((u^/v^ (replace-vars `(,u . ,v))))
(let ((u^ (car u^/v^))
(v^ (cdr u^/v^)))
(cond
((unify u^ v^ S) =>
(lambda (S0)
(cond
((unify v^ v S0) =>
(lambda (S1) #f))
(else #t))))
(else #t)))))))
(define =/=-fail-check
(lambda (S D)
(exists (d-fail-check S) D)))
(define d-fail-check
(lambda (S)
(lambda (d)
(cond
((unify* d S) =>
(lambda (S+) (eq? S+ S)))
(else #f)))))
(define reify
(lambda (x)
(lambda (c)
(let ((c (cycle c)))
(let* ((S (c->S c))
(D (walk* (c->D c) S))
(Y (walk* (c->Y c) S))
(N (walk* (c->N c) S))
(T (walk* (c->T c) S))
(C (walk* (c->C c) S)))
(let ((v (walk* x S)))
(let ((R (reify-S v '() reify-name)))
(let ((ans (reify+ v R
(let ((D (remp
(lambda (d)
(let ((dw (walk* d S)))
(or
(anyvar? dw R)
(anyeigen? dw R))))
(rem-xx-from-d D S))))
(rem-subsumed D))
(remp
(lambda (y) (var? (walk y R)))
Y)
(remp
(lambda (n) (var? (walk n R)))
N)
(remp (lambda (t)
(or (anyeigen? t R) (anyvar? t R))) T)
(remp
(lambda (c)
(let ((cws (walk* c S))
(cwr (walk* c R)))
(or (not (anyvar? (car cws) S))
(anyvar? (car cwr) R)
(equal? (car cwr) (cdr cwr)))))
C))))
ans))))))))
(define rem-C-dups
(lambdag@ (c : B E S D Y N T C)
(letrec ((rem-C-dups (lambda (C)
(cond
[(null? C) '()]
[(member (car C) (cdr C)) (rem-C-dups (cdr C))]
[else (cons (car C) (rem-C-dups (cdr C)))])))
(same-C (lambda (C C^) (null? (unify C C^ '())))))
(let ((C^ (rem-C-dups (normalize-C (walk* C S)))))
(if (same-C C C^)
c
`(,B ,E ,S ,D ,Y ,N ,T ,C^))))))
(define normalize-C
(lambda (C)
(apply append
(map (lambda (c)
(let ((u (car c))
(v (cdr c)))
(cond
[(and (pair? u) (pair? v))
(normalize-C (list (cons (car u) (car v)) (cons (cdr u) (cdr v))))]
[else (list c)])))
C))))
(define reify+
(lambda (v R D Y N T C)
(form (walk* v R)
(walk* D R)
(walk* Y R)
(walk* N R)
(rem-subsumed-T (walk* T R))
(let ((R (reify-S v '() reify-name)))
(let ((C (walk* C R)))
(let ((R (reify-S `(,v . ,C) '() reify-f-name)))
(walk* C R)))))))
(define form
(lambda (v D Y N T C)
(let ((fd (sort-D D))
(fy (sorter Y))
(fn (sorter N))
(ft (sorter T))
(fc (sorter C)))
(let ((fd (if (null? fd) fd
(let ((fd (drop-dot-D fd)))
`((=/= . ,fd)))))
(fy (if (null? fy) fy `((sym . ,fy))))
(fn (if (null? fn) fn `((num . ,fn))))
(ft (if (null? ft) ft
(let ((ft (drop-dot ft)))
`((absento . ,ft)))))
(fc (if (null? fc) fc
(let ((fc (drop-dot fc)))
`((copy . ,fc))))))
(cond
((and (null? fd) (null? fy)
(null? fn) (null? ft)
(null? fc))
v)
(else (append `(,v) fd fn fy ft fc)))))))
(define sort-D
(lambda (D)
(sorter
(map sort-d D))))
(define sort-d
(lambda (d)
(sort
(lambda (x y)
(lex<=? (car x) (car y)))
(map sort-pr d))))
(define drop-dot-D
(lambda (D)
(map drop-dot D)))
(define lex<-reified-name?
(lambda (r)
(char<?
(string-ref
(datum->string r) 0)
#\_)))
(define sort-pr
(lambda (pr)
(let ((l (lhs pr))
(r (rhs pr)))
(cond
((lex<-reified-name? r) pr)
((lex<=? r l) `(,r . ,l))
(else pr)))))
(define rem-subsumed
(lambda (D)
(let rem-subsumed ((D D) (d^* '()))
(cond
((null? D) d^*)
((or (subsumed? (car D) (cdr D))
(subsumed? (car D) d^*))
(rem-subsumed (cdr D) d^*))
(else (rem-subsumed (cdr D)
(cons (car D) d^*)))))))
(define subsumed?
(lambda (d d*)
(cond
((null? d*) #f)
(else
(let ((d^ (unify* (car d*) d)))
(or
(and d^ (eq? d^ d))
(subsumed? d (cdr d*))))))))
(define rem-xx-from-d
(lambda (D S)
(remp not
(map (lambda (d)
(cond
((unify* d S) =>
(lambda (S0)
(prefix-S S0 S)))
(else #f)))
D))))
(define rem-subsumed-T
(lambda (T)
(let rem-subsumed ((T T) (T^ '()))
(cond
((null? T) T^)
(else
(let ((lit (lhs (car T)))
(big (rhs (car T))))
(cond
((or (subsumed-T? lit big (cdr T))
(subsumed-T? lit big T^))
(rem-subsumed (cdr T) T^))
(else (rem-subsumed (cdr T)
(cons (car T) T^))))))))))
(define subsumed-T?
(lambda (lit big T)
(cond
((null? T) #f)
(else
(let ((lit^ (lhs (car T)))
(big^ (rhs (car T))))
(or
(and (eq? big big^) (member* lit^ lit))
(subsumed-T? lit big (cdr T))))))))
(define LOF
(lambda ()
`(,drop-N-b/c-const ,drop-Y-b/c-const ,drop-Y-b/c-dup-var
,drop-N-b/c-dup-var ,drop-D-b/c-Y-or-N ,drop-T-b/c-Y-and-N
,move-T-to-D-b/c-t2-atom ,split-t-move-to-d-b/c-pair
,drop-from-D-b/c-T ,drop-t-b/c-t2-occurs-t1
,rem-C-dups ,lgg-C)))
| true |
8ca1e3ed855a3db9d93f144062781571916cde4f
|
957ca548c81c2c047ef82cdbf11b7b2b77a3130b
|
/02HW/02_hw_2.scm
|
87b5d4434d753141f0135e1fa627a27f48c8d2db
|
[] |
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 | 1,193 |
scm
|
02_hw_2.scm
|
(define (has? x xs)
(or (and (not (null? xs)) (= x (car xs)))
(and (not (null? xs)) (has? x (cdr xs)))))
(define (get-set as bs)
(if (null? as)
bs
(if (has? (car as) bs)
(get-set (cdr as) bs)
(get-set (cdr as) (cons (car as) bs))
)))
(define (list->set xs) (get-set xs '()))
(define (set? xs) (= (length xs) (length (list->set xs))))
(set? '())
(define (get-intersection xs ys res)
(if (null? xs)
res
(if (not (has? (car xs) ys))
(get-intersection (cdr xs) ys res)
(get-intersection (cdr xs) ys (cons (car xs) res))
)
))
(define (intersection xs ys) (get-intersection xs ys '()))
(define (get-difference xs ys res)
(if (null? xs)
res
(if (has? (car xs) ys)
(get-difference (cdr xs) ys res)
(get-difference (cdr xs) ys (cons (car xs) res))
)
))
(define (difference xs ys) (get-difference xs ys '()))
(define (union xs ys) (list->set (append xs ys)))
(define (symmetric-difference xs ys)
(difference (union xs ys) (intersection xs ys)))
(define (set-eq? xs ys)
(= (length xs) (length ys) (length (intersection xs ys))))
| false |
c0277fd07fad11c9bfe73d83da8fad1d2fcbf1a3
|
b63601b5d27a014d9258eb736eefa6b17c4ecc31
|
/s03-to-c/examples/consin.scm
|
e0ba2534419b447ea64a037ad27e4f0f02540e2e
|
[] |
no_license
|
hitokey/wasCm
|
953d3c9e6a768b940cac0b765e0c2177fe2d0646
|
32c7f0f25964200441f52852763ce31f725ef2e7
|
refs/heads/master
| 2023-08-17T00:56:06.969797 | 2021-02-10T02:20:43 | 2021-02-10T02:20:43 | 266,668,959 | 1 | 0 | null | 2020-06-23T22:28:59 | 2020-05-25T02:53:02 |
TeX
|
UTF-8
|
Scheme
| false | false | 499 |
scm
|
consin.scm
|
;; Test primitive operations with list
(define (floopsum env ix sx facc)
(if (null? sx) facc
(floopsum env (- ix 1) (cdr sx)
(+ (f(car sx)) facc)) ))
(define (mcons env xs)
(cons (iexpr 42) xs))
(define (top env sexpr)
(car sexpr))
(define (rest env sexpr)
(cdr sexpr))
(letrec
[(xx (cons 6 (cons 5 #f)))]
(begin (display (top xx))
(display (mcons xx))
(display (floopsum 3 '(4.0 5.0 6.0 7.0) 0.0))
(display (rest xx)) ))
| false |
a3285185a5c36b69e8da878eb32d376e3a6c9543
|
732e9fa591ac58a08fc8ea4b332c70c117bb0133
|
/test/add.scm
|
36fda95800f338ff04a07d7374cdf0ba2dbfb102
|
[
"MIT"
] |
permissive
|
aoh/myy
|
a9602600fc0eb0ded59d169a9f6efc7542921a95
|
80514419b19c41776770fc679234556964c45008
|
refs/heads/master
| 2021-01-12T13:33:01.528764 | 2017-12-27T09:56:00 | 2017-12-27T09:56:00 | 69,845,621 | 2 | 1 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 29 |
scm
|
add.scm
|
(lambda (args)
(+ 3 6))
| false |
9aa32250c637df719b10182cb48519b4520baccf
|
9adf00fadd55632cd84ee8f4268a65505337b21e
|
/src/maquette/connection.scm
|
b58c97cd698853a64bf807105d4a6b685ae969f6
|
[] |
no_license
|
ktakashi/sagittarius-maquette
|
c44e20629ceec1750502784cb662b0d1153cc7e0
|
2cdd0233584d67a689c56723964b2366e2942b96
|
refs/heads/master
| 2020-04-06T13:52:02.999446 | 2016-10-26T14:19:01 | 2016-10-26T14:19:01 | 51,841,198 | 0 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 9,956 |
scm
|
connection.scm
|
;;; -*- mode:scheme; coding:utf-8; -*-
;;;
;;; maquette/connection.scm - Connection and connection pool
;;;
;;; Copyright (c) 2016 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 (maquette connection)
(export make-maquette-connection maquette-connection?
maquette-connection-dbi-connection
maquette-connection-color
maquette-connection-in-same-session?
maquette-connection-connect!
maquette-connection-open?
maquette-connection-close!
maquette-connection-reconnect!
open-maquette-connection
maquette-connection-start-transaction!
maquette-connection-commit!
maquette-connection-rollback!
maquette-connection-prepared-statement
maquette-connection-close-statement
;; connection pool
make-maquette-connection-pool maquette-connection-pool?
maquette-connection-pool-get-connection
maquette-connection-pool-return-connection
maquette-connection-pool-release!
maquette-connection-pool-re-pool!
maquette-connection-pool-connection-available?
maquette-connection-pool-available-connection-count
maquette-connection-pool-max-connection-count
;; transaction
with-maquette-connection-transaction
call-with-available-connection
)
(import (rnrs)
(clos user)
(sagittarius)
(sagittarius object)
(util concurrent)
(srfi :18)
(srfi :26)
(cache apis)
(cache lru)
(sagittarius comparators)
(dbi))
(define-class <maquette-connection> ()
((dbi-connection :init-keyword :dbi-connection :init-value #f
:reader maquette-connection-dbi-connection)
;; for reconnect
(dsn :init-keyword :dsn)
(options :init-keyword :options)
;; cache object for statements
(cache :init-keyword :cache :init-value #f)
;; session distinguisher
(color :init-value #f :reader maquette-connection-color)
))
(define (maquette-connection? o) (is-a? o <maquette-connection>))
(define (make-maquette-connection dsn
:key (cache-type <lru-cache>)
(cache-size 100) ;; default?
:allow-other-keys opt)
(define (cache-creation conn)
(lambda (sql)
(let ((dbi-connection (maquette-connection-dbi-connection conn)))
(dbi-prepare dbi-connection sql))))
(make <maquette-connection> :dsn dsn :options opt
:cache (and cache-type (make cache-type
:max-size cache-size
:comparator string-comparator
:on-evict dbi-close))))
(define (maquette-connection-in-same-session? conn color)
(eq? (maquette-connection-color conn) color))
(define (maquette-connection-open? conn)
(is-a? (maquette-connection-dbi-connection conn) <dbi-connection>))
(define (maquette-connection-connect! conn)
(unless (maquette-connection-open? conn)
(set! (~ conn 'dbi-connection)
;; it's better to have :auto-commit option enabled
;; but we can't assume it's supported by DBD.
(apply dbi-connect (~ conn 'dsn) (~ conn 'options))))
conn)
(define (maquette-connection-close! conn)
(when (~ conn 'dbi-connection)
;; this also closes statements
(when (~ conn 'cache) (cache-clear! (~ conn 'cache)))
(dbi-close (maquette-connection-dbi-connection conn)))
(set! (~ conn 'dbi-connection) #f)
conn)
(define (maquette-connection-reconnect! c)
(when (~ c 'dbi-connection) (maquette-connection-close! c))
(maquette-connection-connect! c))
;; convenient procedure
(define (open-maquette-connection dsn . opt)
(maquette-connection-connect! (apply make-maquette-connection dsn opt)))
(define (maquette-connection-start-transaction! c)
(dbi-execute-using-connection! (~ c 'dbi-connection) "BEGIN")
c)
(define (maquette-connection-commit! c) (dbi-commit! (~ c 'dbi-connection)) c)
(define (maquette-connection-rollback! c)
(dbi-rollback! (~ c 'dbi-connection))
c)
(define (maquette-connection-prepared-statement c sql . opt)
(unless (maquette-connection-open? c)
(assertion-violation 'maquette-connection-prepared-statement
"connection is closed" c))
(let* ((cache (~ c 'cache))
(stmt (cond ((and cache (cache-get cache sql)))
(else
(let ((stmt (dbi-prepare
(maquette-connection-dbi-connection c)
sql)))
(when cache (cache-put! cache sql stmt))
stmt)))))
(let loop ((i 1) (ps opt))
(unless (null? ps)
(dbi-bind-parameter! stmt i (car ps))
(loop (+ i 1) (cdr ps))))
stmt))
(define (maquette-connection-close-statement c stmt)
(unless (~ c 'cache) (dbi-close stmt)))
;;; connection pool
;; We do very simple connection pooling here. The basic strategy is
;; that using shared-queue to manage connection retrieval and returning.
(define-class <maquette-connection-pool> ()
((pool :init-keyword :pool) ;; shared-queue
(connections :init-keyword :connections) ;; actual connections
;; for re-pool
(max-connection :init-keyword :max-connection
:reader maquette-connection-pool-max-connection-count)
(dsn :init-keyword :dsn)
(options :init-keyword :options)
(lock :init-form (make-mutex))))
(define (init-connections max-connection dsn options)
(define (make-connections n)
(let loop ((i 0) (r '()))
(if (= i n)
r
(loop (+ i 1)
(cons (apply open-maquette-connection dsn options) r)))))
(let ((sq (make-shared-queue))
(conns (make-connections max-connection)))
(for-each (cut shared-queue-put! sq <>) conns)
(values sq conns)))
(define (make-maquette-connection-pool max-connection dsn . options)
(let-values (((sq conns) (init-connections max-connection dsn options)))
(make <maquette-connection-pool> :pool sq :connections conns
:dsn dsn :options options :max-connection max-connection)))
(define (maquette-connection-pool? o) (is-a? o <maquette-connection-pool>))
(define (maquette-connection-pool-get-connection cp . opt)
(let ((r (apply shared-queue-get! (~ cp 'pool) opt)))
(if (maquette-connection? r)
(begin
(slot-set! r 'color (gensym)) ;; put color here
(maquette-connection-connect! r))
r)))
(define (maquette-connection-pool-return-connection cp conn)
(unless (memq conn (~ cp 'connections))
(assertion-violation 'maquette-connection-pool-return-connection
"not a managed connection" conn))
;; avoid duplicate connection to be pushed
;; so returning is a bit more expensive than retrieving
(mutex-lock! (~ cp 'lock))
;; once it's returned then at least we need to rollback the
;; transaction.
(guard (e (else #t)) (maquette-connection-rollback! conn))
(unless (shared-queue-find (~ cp 'pool) (lambda (e) (eq? e conn)))
;; if the connection is closed, then retriever makes sure the connectivity
;; so simply push
(slot-set! conn 'color #f)
(shared-queue-put! (~ cp 'pool) conn))
(mutex-unlock! (~ cp 'lock))
cp)
(define (maquette-connection-pool-connection-available? cp)
(let ((pool (~ cp 'pool)))
(and pool (not (shared-queue-empty? pool)))))
(define (maquette-connection-pool-available-connection-count cp)
(let ((pool (~ cp 'pool)))
(if pool
(shared-queue-size pool)
0)))
;; release all connection
;; TODO should we raise an error if managed connection(s) are used?
(define (maquette-connection-pool-release! cp)
;; closes all connection
(for-each maquette-connection-close! (~ cp 'connections))
(set! (~ cp 'pool) #f)
(set! (~ cp 'connections) '())
cp)
;; Should we provide this?
(define (maquette-connection-pool-re-pool! cp)
(unless (~ cp 'pool)
(let-values (((sq conns) (init-connections (~ cp 'max-connection)
(~ cp 'dsn) (~ cp 'options))))
(set! (~ cp 'pool) sq)
(set! (~ cp 'connections) conns)))
cp)
;; High level APIs
;; this would block. it is users' responsibility to check if there's an
;; available connection.
(define (call-with-available-connection cp proc . opt)
(let ((conn #f))
(dynamic-wind
(lambda ()
(set! conn (apply maquette-connection-pool-get-connection cp opt)))
(lambda () (if (maquette-connection? conn) (proc conn) conn))
(lambda ()
(when (maquette-connection? conn)
(maquette-connection-pool-return-connection cp conn))))))
;; transaction
(define-syntax with-maquette-connection-transaction
(syntax-rules ()
((_ conn expr ...)
(let ((c conn))
(dynamic-wind
(lambda ()
;; some DBD throws an error if there's already a transaction.
(guard (e (else #t)) (maquette-connection-start-transaction! c)))
(lambda () expr ...)
(lambda ()
;; some DBD throws an error if there's no transaction.
(guard (e (else #t)) (maquette-connection-rollback! c))))))))
)
| true |
22a5662986516c65ec3f7975c3f9ca1a9eaf305d
|
4b480cab3426c89e3e49554d05d1b36aad8aeef4
|
/chapter-02/ex2.17-falsetru.scm
|
58c4ce03dabf57f1f2ef34a003530edb456fb246
|
[] |
no_license
|
tuestudy/study-sicp
|
a5dc423719ca30a30ae685e1686534a2c9183b31
|
a2d5d65e711ac5fee3914e45be7d5c2a62bfc20f
|
refs/heads/master
| 2021-01-12T13:37:56.874455 | 2016-10-04T12:26:45 | 2016-10-04T12:26:45 | 69,962,129 | 0 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 94 |
scm
|
ex2.17-falsetru.scm
|
(define (last-pair2 items)
(if (null? (cdr items))
items
(last-pair2 (cdr items))))
| false |
b27acfda591ed9bec78bb8ddf7605f8f2a326d84
|
9f3708a0f72422bfa041ed3a3e327c70fbc61a5a
|
/glm-vector.scm
|
4185d6b50544e068624d49ebb9c02758031ebc9f
|
[] |
no_license
|
Adellica/chicken-glm
|
7a67a253afec7a91e0aaa155612f758c97b6d4ae
|
f9bb7825a0c74532b78f88d091578b71a3b0466c
|
refs/heads/master
| 2022-01-14T14:07:55.181302 | 2022-01-07T15:49:21 | 2022-01-07T15:49:21 | 9,436,887 | 0 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 5,893 |
scm
|
glm-vector.scm
|
;; pick the right procedure based on the size of the variable
;; vector sizes expand to 2, 3 or 4 dimensions.
;; (pp (expand '(vector-length-dispatch variable f32vector +/type/for/variable)))
(define-syntax vector-length-dispatch
(er-macro-transformer
(lambda (x r t)
(let* ((variable (cadr x))
(vtype (caddr x))
(form (cadddr x))
(precision-prefix (case vtype
((f32vector) "")
((f64vector) 'd)
((s32vector) 'i)
((u32vector) 'u)
((u8vector) 'b)))
(vector-type? (string->symbol (conc vtype "?")))
(vector-length (string->symbol (conc vtype "-length"))))
`(begin (,(r 'case) (,vector-length ,variable)
((2) ,(rewrite form variable (conc precision-prefix "vec2")))
((3) ,(rewrite form variable (conc precision-prefix "vec3")))
((4) ,(rewrite form variable (conc precision-prefix "vec4")))))))))
;; *** vector constructors
(begin-template
`((P vec dvec ivec uvec bvec)
(R ,glmtype->schemetype)) ;; f32vector s32vector etc
(define (P2 x y) (R x y))
(define (P3 x y z) (R x y z))
(define (P4 x y z w) (R x y z w)))
(begin-template
`((D 2 3 4))
(define (make-vecD fill) (make-f32vector D fill))
(define (make-dvecD fill) (make-f64vector D fill))
(define (make-ivecD fill) (make-s32vector D fill))
(define (make-uvecD fill) (make-u32vector D fill))
(define (make-bvecD fill) (make-u8vector D fill)))
;; OBS: we won't be able to distinguish between vec4 and mat2 for example
(begin-template
`((D 2 3 4))
(define ( vecD? vec) (and (f32vector? vec) (= (f32vector-length vec) D)))
(define (dvecD? vec) (and (f64vector? vec) (= (f64vector-length vec) D)))
(define (ivecD? vec) (and (s32vector? vec) (= (s32vector-length vec) D)))
(define (uvecD? vec) (and (u32vector? vec) (= (u32vector-length vec) D)))
(define (bvecD? vec) (and (u8vector? vec) (= (u8vector-length vec) D))))
;;; vector operations
(begin-template
`((T vec2 vec3 vec4
dvec2 dvec3 dvec4
uvec2 uvec3 uvec4
ivec2 ivec3 ivec4
bvec2 bvec3 bvec4
)
(R ,value-type))
;; unary operators
(define length/T (glm R "return(" "glm::length(" T "));"))
;; infix operators
(begin-template `((OP + - * /) )
(define OP/T/T! (glm void T "=" T "OP" T))
(define (OP/T/T operand1 operand2)
(with-destination (make-T #f) OP/T/T! operand1 operand2)))
;; vector unary operators
(begin-template `((OP
abs ceil floor fract round roundEven sign
sin cos tan sinh cosh tanh
asin acos atan asinh acosh atanh
degrees radians
exp exp2 inversesqrt log log2 sqrt
normalize
))
(define OP/T! (glm void T "=" "glm::OP(" T ")"))
(define (OP/T vec) (with-destination (make-T #f) OP/T! vec)))
;; prefix binary operators, primitive return type
(begin-template `((OP "dot" "distance"))
(define OP/T (glm R "return(" "glm::" "OP" "(" T "," T "));"))))
(define (length/vec v)
(cond-template
`((VECTOR f32vector f64vector s32vector u32vector u8vector))
((VECTOR? v) ((vector-length-dispatch v VECTOR length/v) v))
(error "unknown vector-type" v)))
(begin-template
`((<OP> dot distance))
(define (<OP> v1 v2)
(cond-template
`((VECTOR f32vector f64vector s32vector u32vector u8vector))
((VECTOR? v2) (if (VECTOR? v2)
(if (= (VECTOR-length v1) (VECTOR-length v2))
((vector-length-dispatch v1 VECTOR <OP>/v1) v1 v2)
(error "vector length mismatch" v1 v2))
(error "operand two must be vector" v2)))
(error "unknown vector-type" v1))))
;; vector-scalar infix operators (excludes bvec types)
(begin-template
`((T vec2 vec3 vec4
dvec2 dvec3 dvec4
uvec2 uvec3 uvec4
ivec2 ivec3 ivec4
)
(R ,value-type))
;; infix operators
(begin-template `((OP + - * /) )
(define OP/T/scalar! (glm void T "=" T "OP" R))
(define (OP/T/scalar vec scalar)
(with-destination (make-T #f) OP/T/scalar! vec scalar))))
;; cross is only defined for vec3
(begin-template
`((T vec3 dvec3 ivec3 uvec3 bvec3))
(define cross/T! (glm void T "=" "glm::cross(" T "," T ")"))
(define (cross/T veca vecb) (with-destination (make-T #f) cross/T! veca vecb)))
;; vector-vector or vector-scalar
(begin-template
`((<OP> * / + -))
(define (<OP>/vec/scalar/delegate vec scalar)
(cond
((f32vector? vec) (vector-length-dispatch vec f32vector <OP>/vec/scalar))
((f64vector? vec) (vector-length-dispatch vec f64vector <OP>/vec/scalar))
((s32vector? vec) (vector-length-dispatch vec s32vector <OP>/vec/scalar))
((u32vector? vec) (vector-length-dispatch vec u32vector <OP>/vec/scalar))))
(define (v<OP>/delegate v1 v2)
(if (number? v2) (<OP>/vec/scalar/delegate v1 v2)
(cond-template
`((VECTOR f32vector f64vector s32vector u32vector))
((VECTOR? v1) (if (VECTOR? v2)
(if (= (VECTOR-length v1) (VECTOR-length v2))
(vector-length-dispatch v1 VECTOR <OP>/v1/v1)
(error "vector dimension mismatch" v1 v2))
(if (number? v2)
(vector-length-dispatch v1 VECTOR <OP>/v1/scalar)
(error "invalid operand types" v1 v2))))
(error "unknown vector type" v1))))
(define (v<OP> v1 v2)
((v<OP>/delegate v1 v2) v1 v2)))
;; this should do what we want,
;; but let's keep an eye on this guy:
(define v= equal?)
| true |
4380a6a21ccf0b2b03dd1b3f30b8826ac4f45fcc
|
2c01a6143d8630044e3629f2ca8adf1455f25801
|
/xitomatl/irregex-0-8-0.sls
|
c6823416cacf88a00b28c8deee7dd75e1eaa2cae
|
[
"X11-distribute-modifications-variant"
] |
permissive
|
stuhlmueller/scheme-tools
|
e103fac13cfcb6d45e54e4f27e409adbc0125fe1
|
6e82e873d29b34b0de69b768c5a0317446867b3c
|
refs/heads/master
| 2021-01-25T10:06:33.054510 | 2017-05-09T19:44:12 | 2017-05-09T19:44:12 | 1,092,490 | 5 | 1 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 1,893 |
sls
|
irregex-0-8-0.sls
|
#!r6rs
;; Copyright 2010 Derick Eddington. My MIT-style license is in the file named
;; LICENSE from the original collection this file is distributed with.
(library (xitomatl irregex (0 8 0))
(export
irregex string->irregex sre->irregex irregex?
irregex-new-matches irregex-reset-matches! irregex-match-data?
make-irregex-match irregex-match-chunker-set!
irregex-match-start-chunk-set! irregex-match-start-index-set!
irregex-match-end-chunk-set! irregex-match-end-index-set!
irregex-match-valid-index? irregex-match-index
irregex-match-num-submatches irregex-match-substring
irregex-match-start-chunk irregex-match-start-index
irregex-match-end-chunk irregex-match-end-index
irregex-match-subchunk irregex-match-chunker
irregex-search irregex-search/matches irregex-match irregex-match?
irregex-replace irregex-replace/all
irregex-search/chunked irregex-match/chunked
irregex-fold irregex-fold/chunked irregex-fold/fast irregex-fold/chunked/fast
irregex-extract irregex-split
make-irregex-chunker chunker-get-next chunker-get-str chunker-get-start
chunker-get-end chunker-get-substring chunker-get-subchunk
irregex-dfa irregex-dfa/search irregex-dfa/extract
irregex-nfa irregex-flags irregex-num-submatches irregex-lengths irregex-names
irregex-quote irregex-opt sre->string string->sre maybe-string->sre
string-cat-reverse)
(import
(rename (except (rnrs) error remove)
(exists any) (for-all every) (remp remove))
(rnrs mutable-strings)
(rnrs mutable-pairs)
(rnrs r5rs)
(srfi :6 basic-string-ports)
(srfi :23 error tricks)
(only (xitomatl include) include/resolve))
(SRFI-23-error->R6RS "(library (xitomatl irregex (0 8 0)))"
(include/resolve ("xitomatl" "irregex") "irregex-r6rs.scm")
(include/resolve ("xitomatl" "irregex") "irregex-utils.scm"))
)
| false |
b0cfd2d940baa8fe0a0260782b88ea06598de1a8
|
271fdd738aa77a7ff70b3179f60ef983a9d9f4f9
|
/batch/test/c.ss
|
6aac4492fdedca9dd021b449347acffc04a907f4
|
[] |
no_license
|
jeapostrophe/compiler
|
7ccb2a9064ff4859563847ec3876989e007efc69
|
30a3d569922bb5e5dcf1976c74961ab3d66d2fb9
|
refs/heads/master
| 2016-09-10T20:49:19.291042 | 2013-10-31T01:16:02 | 2013-10-31T01:16:02 | 618,154 | 1 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 83 |
ss
|
c.ss
|
#lang scheme/base
(require "a.ss"
"b.ss")
(define c (+ a b))
(provide c)
c
| false |
9a2882ab46d23c5c699e5241b1f78536b3019b4f
|
de5d387aa834f85a1df3bd47bc324b01130f21fb
|
/ps2/code/ghelper.scm
|
c2bb74fabe9a7c88ce058f1c36a537376f63a6a2
|
[] |
no_license
|
chuchao333/6.945
|
5ae15980a952bed5c868be03d1a71b1878ddd53d
|
c50bb28aadf0c3fcda3c8e56b4a61b9a2d582552
|
refs/heads/master
| 2020-05-30T20:23:23.501175 | 2013-05-05T19:59:53 | 2013-05-05T19:59:53 | 24,237,118 | 5 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 4,359 |
scm
|
ghelper.scm
|
;;;; Most General Generic-Operator Dispatch
(declare (usual-integrations))
;;; Generic-operator dispatch is implemented here by a discrimination
;;; list, where the arguments passed to the operator are examined by
;;; predicates that are supplied at the point of attachment of a
;;; handler (by DEFHANDLER).
;;; To be the correct branch all arguments must be accepted by
;;; the branch predicates, so this makes it necessary to
;;; backtrack to find another branch where the first argument
;;; is accepted if the second argument is rejected. Here
;;; backtracking is implemented by OR.
(define (make-generic-operator arity #!optional name default-operation)
(let ((record (make-operator-record arity)))
(define (operator . arguments)
(if (not (or (= (length arguments) arity)
(= (length arguments (+ arity 1)))))
(error "Wrong number of arguments for generic operator"
(if (default-object? name) operator name)
arity arguments))
(apply (or (let per-arg
((tree (operator-record-tree record))
(args arguments))
(let per-pred ((tree tree))
(and (pair? tree)
(if ((caar tree) (car args))
(if (pair? (cdr args))
(or (per-arg (cdar tree) (cdr args))
(per-pred (cdr tree)))
(cdar tree))
(per-pred (cdr tree))))))
(if (default-object? default-operation)
(lambda args
(error "No applicable methods for generic operator"
(if (default-object? name) operator name)
args))
default-operation))
arguments))
(hash-table/put! *generic-operator-table* operator record)
operator))
(define *generic-operator-table*
(make-eq-hash-table))
(define (get-operator-record operator)
(hash-table/get *generic-operator-table* operator #f))
(define (make-operator-record arity) (cons arity '()))
(define (operator-record-arity record) (car record))
(define (operator-record-tree record) (cdr record))
(define (set-operator-record-tree! record tree) (set-cdr! record tree))
(define (defhandler operator handler . argument-predicates)
(let ((record
(let ((record (hash-table/get *generic-operator-table* operator #f))
(arity (length argument-predicates)))
(if record
(begin
(if (not (= arity (operator-record-arity record)))
(error "Incorrect operator arity:" operator))
record)
(error "Operator not known" operator)))))
(set-operator-record-tree! record
(bind-in-tree argument-predicates
(lambda args (if (= (length args) (+ (length argument-predicates) 1))
((car args) (apply handler (cdr args)))
(apply handler args)))
(operator-record-tree record))))
operator)
;;; An alias used in some old code
(define assign-operation defhandler)
(define (bind-in-tree keys handler tree)
(let loop ((keys keys) (tree tree))
(let ((p.v (assq (car keys) tree)))
(if (pair? (cdr keys))
(if p.v
(begin
(set-cdr! p.v
(loop (cdr keys) (cdr p.v)))
tree)
(cons (cons (car keys)
(loop (cdr keys) '()))
tree))
(if p.v
(begin
(warn "Replacing a handler:" (cdr p.v) handler)
(set-cdr! p.v handler)
tree)
(cons (cons (car keys) handler)
tree))))))
#|
;;; Demonstration of handler tree structure.
;;; Note: symbols were used instead of procedures
(define foo (make-generic-operator 3 'foo))
;Value: foo
(pp (get-operator-record foo))
(3)
(defhandler foo 'abc 'a 'b 'c)
(pp (get-operator-record foo))
(3 (a (b (c . abc))))
(defhandler foo 'abd 'a 'b 'd)
(pp (get-operator-record foo))
(3 (a (b (d . abd) (c . abc))))
(defhandler foo 'aec 'a 'e 'c)
(pp (get-operator-record foo))
(3 (a (e (c . aec))
(b (d . abd)
(c . abc))))
(defhandler foo 'dbd 'd 'b 'd)
(pp (get-operator-record foo))
(3 (d (b (d . dbd)))
(a (e (c . aec))
(b (d . abd)
(c . abc))))
|#
| false |
dc5d1c6d55d860965b8ef2160635b0d5b5bc311b
|
ac2a3544b88444eabf12b68a9bce08941cd62581
|
/gsc/tests/30-symbol/symbolname.scm
|
cb544e500052246d752ceac192949cca4bfceba3
|
[
"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 | 248 |
scm
|
symbolname.scm
|
(declare (extended-bindings) (not constant-fold) (not safe))
(define a 'symbol1)
(define b (quote symbol2))
(define c (##make-uninterned-symbol "uninterned" 80))
(println (##symbol-name a))
(println (##symbol-name b))
(println (##symbol-name c))
| false |
1e8f589bbbb6936c0f39854e1242fa37c5a5862c
|
923209816d56305004079b706d042d2fe5636b5a
|
/test/http/uri/query.scm
|
c708c61bca572d469144e29db006de86a66667ab
|
[
"BSD-3-Clause",
"BSD-2-Clause"
] |
permissive
|
tabe/http
|
4144cb13451dc4d8b5790c42f285d5451c82f97a
|
ab01c6e9b4e17db9356161415263c5a8791444cf
|
refs/heads/master
| 2021-01-23T21:33:47.859949 | 2010-06-10T03:36:44 | 2010-06-10T03:36:44 | 674,308 | 1 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 230 |
scm
|
query.scm
|
#!r6rs
(import (rnrs (6))
(http uri query)
(http assertion)
(xunit))
(assert-parsing-successfully query "")
(assert-parsing-successfully query "foobar")
(assert-parsing-successfully query "/?")
(report)
| false |
b138ee3de139cf772f017c1fd5fc4529f4bdcb52
|
defeada37d39bca09ef76f66f38683754c0a6aa0
|
/mscorlib/system/io/cstream-writer.sls
|
55d64f201245ec646384a819082eaa8d6f977d72
|
[] |
no_license
|
futsuki/ironscheme-port
|
2dbac82c0bda4f4ff509208f7f00a5211d1f7cd5
|
4e7a81b0fbeac9a47440464988e53fb118286c54
|
refs/heads/master
| 2016-09-06T17:13:11.462593 | 2015-09-26T18:20:40 | 2015-09-26T18:20:40 | 42,757,369 | 0 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 1,245 |
sls
|
cstream-writer.sls
|
(library (system io cstream-writer)
(export new
is?
cstream-writer?
write-key
internal-write-chars
write
internal-write-char
internal-write-string)
(import (ironscheme-clr-port))
(define-syntax new
(lambda (e)
(syntax-case e ()
((_ a ...) #'(clr-new System.IO.CStreamWriter a ...)))))
(define (is? a) (clr-is System.IO.CStreamWriter a))
(define (cstream-writer? a) (clr-is System.IO.CStreamWriter a))
(define-method-port
write-key
System.IO.CStreamWriter
WriteKey
(System.Void System.ConsoleKeyInfo))
(define-method-port
internal-write-chars
System.IO.CStreamWriter
InternalWriteChars
(System.Void System.Char[] System.Int32))
(define-method-port
write
System.IO.CStreamWriter
Write
(System.Void System.String)
(System.Void System.Char[])
(System.Void System.Char)
(System.Void System.Char[] System.Int32 System.Int32))
(define-method-port
internal-write-char
System.IO.CStreamWriter
InternalWriteChar
(System.Void System.Char))
(define-method-port
internal-write-string
System.IO.CStreamWriter
InternalWriteString
(System.Void System.String)))
| true |
7b708c05503d675b735aef4fb6c91f2704921c3e
|
02dc853159cd8a315280c599020586261bd0dceb
|
/Informatics Basics/read-words.scm
|
d6b4200d38e5cfaf0249d5062e8e328d06dffd13
|
[] |
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 | 424 |
scm
|
read-words.scm
|
(define (read-words)
(let A ((spis '()))
(let ((file (read-char)))
(if (eof-object? file)
(if (null? spis)
'()
(list (list->string spis)))
(if (or (equal? file #\space) (equal? file #\newline))
(if (null? spis)
(A '())
(cons (list->string spis) (A '())))
(A (append spis (list file))))))))
| false |
466b36fc5b6d55726e24e4088aa0df13e898e27a
|
e1fc47ba76cfc1881a5d096dc3d59ffe10d07be6
|
/ch3/3.58.scm
|
a774c904eb92d64b5a3d016851bb8305d0921b1d
|
[] |
no_license
|
lythesia/sicp-sol
|
e30918e1ebd799e479bae7e2a9bd4b4ed32ac075
|
169394cf3c3996d1865242a2a2773682f6f00a14
|
refs/heads/master
| 2021-01-18T14:31:34.469130 | 2019-10-08T03:34:36 | 2019-10-08T03:34:36 | 27,224,763 | 2 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 322 |
scm
|
3.58.scm
|
(load "3.05.01.stream.scm")
; expand digits of `n/den` (result as float) under base `radix`
(define (expand n den radix)
(cons-stream (quotient (* n radix) den) (expand (remainder (* n radix) den) den radix))
)
; test
; (display-stream-to (expand 1 7 10) 10)(newline)
; (display-stream-to (expand 3 8 10) 10)(newline)
| false |
273821e10d7274f700df8e34c6c5e18b203cbdb1
|
b43e36967e36167adcb4cc94f2f8adfb7281dbf1
|
/scheme/swl1.3/tests/error-help/test57.ss
|
b8e3639251b5d60cf2f8bd4215fb1c024255a75c
|
[
"SWL",
"TCL"
] |
permissive
|
ktosiu/snippets
|
79c58416117fa646ae06a8fd590193c9dd89f414
|
08e0655361695ed90e1b901d75f184c52bb72f35
|
refs/heads/master
| 2021-01-17T08:13:34.067768 | 2016-01-29T15:42:14 | 2016-01-29T15:42:14 | 53,054,819 | 1 | 0 | null | 2016-03-03T14:06:53 | 2016-03-03T14:06:53 | null |
UTF-8
|
Scheme
| false | false | 72 |
ss
|
test57.ss
|
; Test error "unexpected end-of-file reading graph mark"
(define x '#1=
| false |
719acc2b8fa18b52d7e08100a948cbc80efe182b
|
c085780da34766c02f47f181bd8a7bb515126caa
|
/lab14 syntax.scm
|
03075d2250687357eb17e335dd26f0d21065d2fe
|
[] |
no_license
|
juleari/r5rs
|
37ede50989e59b0936f7aac2b204cb9affa22d21
|
880b0df41e94c103386c158cc172b658f485a465
|
refs/heads/master
| 2016-09-16T17:23:42.192923 | 2016-05-04T11:58:18 | 2016-05-04T11:58:18 | 42,339,524 | 0 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 1,822 |
scm
|
lab14 syntax.scm
|
;(use-syntax (ice-9 syncase))
(define-syntax when
(syntax-rules ()
((_ cond_expr expr ...)
(if cond_expr (begin expr ...)))))
(define-syntax unless
(syntax-rules ()
((_ cond_expr expr ...)
(when (not cond_expr) expr ...))))
(define-syntax for
(syntax-rules (in as)
((_ item in items proc ...)
(for-each (lambda (item) (begin proc ...)) items))
((_ items as item . procs) (for item in items . procs))))
(define-syntax while
(syntax-rules ()
((_ cond? proc ...)
(letrec ((iter (lambda () (if cond?
(begin (begin proc ...)
(iter))))))
(iter)))))
(define-syntax repeat
(syntax-rules (until)
((_ procs until cond?)
(begin
(begin . procs)
(while (not cond?) . procs)))))
(define-syntax cout
(syntax-rules (<< endl)
((_ << endl) (newline))
((_ << endl x ...) (begin (newline) (cout x ...)))
((_ << elem x ...) (begin (display elem) (cout x ...)))))
#|;; tests
(define x 1)
(when (> x 0) (display "x > 0") (newline))
(unless (= x 0) (display "x != 0") (newline))
(for i in '(1 2 3)
(for j in '(4 5 6)
(display (list i j))
(newline)))
(for '(1 2 3) as i
(for '(4 5 6) as j
(display (list i j))
(newline)))
(let ((p 0)
(q 0))
(while (< p 3)
(set! q 0)
(while (< q 3)
(display (list p q))
(newline)
(set! q (+ q 1)))
(set! p (+ p 1))))
(let ((i 0)
(j 0))
(repeat ((set! j 0)
(repeat ((display (list i j))
(set! j (+ j 1)))
until (= j 3))
(set! i (+ i 1))
(newline))
until (= i 3)))
(cout << "a = " << 1 << endl << "b = " << 2 << endl)
|#
| true |
0147ada8e269cb62d604e0a6a6d0d67cd6b412da
|
fb9a1b8f80516373ac709e2328dd50621b18aa1a
|
/ch3/exercise3-21.scm
|
443c9402a12a6ba13b279c707cf5676f25c06231
|
[] |
no_license
|
da1/sicp
|
a7eacd10d25e5a1a034c57247755d531335ff8c7
|
0c408ace7af48ef3256330c8965a2b23ba948007
|
refs/heads/master
| 2021-01-20T11:57:47.202301 | 2014-02-16T08:57:55 | 2014-02-16T08:57:55 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 417 |
scm
|
exercise3-21.scm
|
;; 問題3.21
(define q1 (make-queue))
(insert-queue! q1 'a)
;; ((a) a)
(insert-queue! q1 'b)
;; ((a b) b)
(delete-queue! q1)
;; ((b) b)
(delete-queue! q1)
;; (() b)
(define (print-queue queue)
(define (print-head q)
(if (null? q)
'()
(cons (car q) (print-head (cdr q)))))
(if (empty-queue? queue)
'()
(print-head (car queue))))
(print-queue q1)
(print-queue (insert-queue! q1 'a))
| false |
a859aca741663bdfdf5831b3a80dbcaa50226180
|
de7bd741808e14126905d922ee4fbc4c661dbda1
|
/0.3/scm/gambit/protocols.scm
|
5ea1709aa839a61e29aaebc01d8a9968434440bb
|
[
"Apache-2.0"
] |
permissive
|
mikelevins/categories
|
023bec294f51f769c054191746a88965a874eca5
|
66e3861071e4d88b7b27421a78ab497e1fb5fa0c
|
refs/heads/master
| 2016-09-05T21:31:58.879869 | 2013-02-05T10:38:25 | 2013-02-05T10:38:25 | 5,856,317 | 5 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 1,038 |
scm
|
protocols.scm
|
;;;; ***********************************************************************
;;;; FILE IDENTIFICATION
;;;;
;;;; Name: protocols.scm
;;;; Project: Categories
;;;; Purpose: representation of protocols
;;;; Author: mikel evins
;;;; Copyright: Copyright 2010 by mikel evins, all rights reserved
;;;; License: Licensed under the Apache License, version 2.0
;;;; See the accompanying file "License" for more information
;;;;
;;;; ***********************************************************************
;;; ======================================================================
;;; Protocol objects
;;; ======================================================================
(define (proto:make-protocol-object tag functions)
(vector proto:$protocol-tag tag (make-table)))
(define (proto:protocol-object? x)
(and (vector? x)
(> (vector-length x) 2)
(eqv? proto:$protocol-tag (vector-ref x 0))))
;;; ----------------------------------------------------------------------
| false |
2ac827f0d0aa7f00bfa5466d772c0d18d7912d0a
|
f08220a13ec5095557a3132d563a152e718c412f
|
/logrotate/skel/usr/share/guile/2.0/srfi/srfi-19.scm
|
658ccd915c46c65c8cb7be5e58717020952dbf6e
|
[
"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 | 57,263 |
scm
|
srfi-19.scm
|
;;; srfi-19.scm --- Time/Date Library
;; Copyright (C) 2001-2003, 2005-2011, 2014, 2016
;; 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
;;; Author: Rob Browning <[email protected]>
;;; Originally from SRFI reference implementation by Will Fitzgerald.
;;; Commentary:
;; This module is fully documented in the Guile Reference Manual.
;;; Code:
;; FIXME: I haven't checked a decent amount of this code for potential
;; performance improvements, but I suspect that there may be some
;; substantial ones to be realized, esp. in the later "parsing" half
;; of the file, by rewriting the code with use of more Guile native
;; functions that do more work in a "chunk".
;;
;; FIXME: mkoeppe: Time zones are treated a little simplistic in
;; SRFI-19; they are only a numeric offset. Thus, printing time zones
;; (LOCALE-PRINT-TIME-ZONE) can't be implemented sensibly. The
;; functions taking an optional TZ-OFFSET should be extended to take a
;; symbolic time-zone (like "CET"); this string should be stored in
;; the DATE structure.
(define-module (srfi srfi-19)
:use-module (srfi srfi-6)
:use-module (srfi srfi-8)
:use-module (srfi srfi-9)
:autoload (ice-9 rdelim) (read-line)
:use-module (ice-9 i18n)
:replace (current-time)
:export (;; Constants
time-duration
time-monotonic
time-process
time-tai
time-thread
time-utc
;; Current time and clock resolution
current-date
current-julian-day
current-modified-julian-day
time-resolution
;; Time object and accessors
make-time
time?
time-type
time-nanosecond
time-second
set-time-type!
set-time-nanosecond!
set-time-second!
copy-time
;; Time comparison procedures
time<=?
time<?
time=?
time>=?
time>?
;; Time arithmetic procedures
time-difference
time-difference!
add-duration
add-duration!
subtract-duration
subtract-duration!
;; Date object and accessors
make-date
date?
date-nanosecond
date-second
date-minute
date-hour
date-day
date-month
date-year
date-zone-offset
date-year-day
date-week-day
date-week-number
;; Time/Date/Julian Day/Modified Julian Day converters
date->julian-day
date->modified-julian-day
date->time-monotonic
date->time-tai
date->time-utc
julian-day->date
julian-day->time-monotonic
julian-day->time-tai
julian-day->time-utc
modified-julian-day->date
modified-julian-day->time-monotonic
modified-julian-day->time-tai
modified-julian-day->time-utc
time-monotonic->date
time-monotonic->julian-day
time-monotonic->modified-julian-day
time-monotonic->time-tai
time-monotonic->time-tai!
time-monotonic->time-utc
time-monotonic->time-utc!
time-tai->date
time-tai->julian-day
time-tai->modified-julian-day
time-tai->time-monotonic
time-tai->time-monotonic!
time-tai->time-utc
time-tai->time-utc!
time-utc->date
time-utc->julian-day
time-utc->modified-julian-day
time-utc->time-monotonic
time-utc->time-monotonic!
time-utc->time-tai
time-utc->time-tai!
;; Date to string/string to date converters.
date->string
string->date))
(cond-expand-provide (current-module) '(srfi-19))
(define time-tai 'time-tai)
(define time-utc 'time-utc)
(define time-monotonic 'time-monotonic)
(define time-thread 'time-thread)
(define time-process 'time-process)
(define time-duration 'time-duration)
;; FIXME: do we want to add gc time?
;; (define time-gc 'time-gc)
;;-- LOCALE dependent constants
;; See date->string
(define locale-date-time-format "~a ~b ~d ~H:~M:~S~z ~Y")
(define locale-short-date-format "~m/~d/~y")
(define locale-time-format "~H:~M:~S")
(define iso-8601-date-time-format "~Y-~m-~dT~H:~M:~S~z")
;;-- Miscellaneous Constants.
;;-- only the tai-epoch-in-jd might need changing if
;; a different epoch is used.
(define nano 1000000000) ; nanoseconds in a second
(define sid 86400) ; seconds in a day
(define sihd 43200) ; seconds in a half day
(define tai-epoch-in-jd 4881175/2) ; julian day number for 'the epoch'
;; FIXME: should this be something other than misc-error?
(define (time-error caller type value)
(if value
(throw 'misc-error caller "TIME-ERROR type ~A: ~S" (list type value) #f)
(throw 'misc-error caller "TIME-ERROR type ~A" (list type) #f)))
;; A table of leap seconds
;; See ftp://maia.usno.navy.mil/ser7/tai-utc.dat
;; and update as necessary.
;; this procedures reads the file in the above
;; format and creates the leap second table
;; it also calls the almost standard, but not R5 procedures read-line
;; & open-input-string
;; ie (set! leap-second-table (read-tai-utc-date "tai-utc.dat"))
(define (read-tai-utc-data filename)
(define (convert-jd jd)
(* (- (inexact->exact jd) tai-epoch-in-jd) sid))
(define (convert-sec sec)
(inexact->exact sec))
(let ((port (open-input-file filename))
(table '()))
(let loop ((line (read-line port)))
(if (not (eof-object? line))
(begin
(let* ((data (read (open-input-string
(string-append "(" line ")"))))
(year (car data))
(jd (cadddr (cdr data)))
(secs (cadddr (cdddr data))))
(if (>= year 1972)
(set! table (cons
(cons (convert-jd jd) (convert-sec secs))
table)))
(loop (read-line port))))))
table))
;; each entry is (tai seconds since epoch . # seconds to subtract for utc)
;; note they go higher to lower, and end in 1972.
(define leap-second-table
'((1435708800 . 36)
(1341100800 . 35)
(1230768000 . 34)
(1136073600 . 33)
(915148800 . 32)
(867715200 . 31)
(820454400 . 30)
(773020800 . 29)
(741484800 . 28)
(709948800 . 27)
(662688000 . 26)
(631152000 . 25)
(567993600 . 24)
(489024000 . 23)
(425865600 . 22)
(394329600 . 21)
(362793600 . 20)
(315532800 . 19)
(283996800 . 18)
(252460800 . 17)
(220924800 . 16)
(189302400 . 15)
(157766400 . 14)
(126230400 . 13)
(94694400 . 12)
(78796800 . 11)
(63072000 . 10)))
(define (read-leap-second-table filename)
(set! leap-second-table (read-tai-utc-data filename)))
(define (leap-second-delta utc-seconds)
(letrec ((lsd (lambda (table)
(cond ((>= utc-seconds (caar table))
(cdar table))
(else (lsd (cdr table)))))))
(if (< utc-seconds (* (- 1972 1970) 365 sid)) 0
(lsd leap-second-table))))
;;; the TIME structure; creates the accessors, too.
(define-record-type time
(make-time-unnormalized type nanosecond second)
time?
(type time-type set-time-type!)
(nanosecond time-nanosecond set-time-nanosecond!)
(second time-second set-time-second!))
(define (copy-time time)
(make-time (time-type time) (time-nanosecond time) (time-second time)))
(define (split-real r)
(if (integer? r)
(values (inexact->exact r) 0)
(let ((l (truncate r)))
(values (inexact->exact l) (- r l)))))
(define (time-normalize! t)
(if (>= (abs (time-nanosecond t)) 1000000000)
(receive (int frac)
(split-real (time-nanosecond t))
(set-time-second! t (+ (time-second t)
(quotient int 1000000000)))
(set-time-nanosecond! t (+ (remainder int 1000000000)
frac))))
(if (and (positive? (time-second t))
(negative? (time-nanosecond t)))
(begin
(set-time-second! t (- (time-second t) 1))
(set-time-nanosecond! t (+ 1000000000 (time-nanosecond t))))
(if (and (negative? (time-second t))
(positive? (time-nanosecond t)))
(begin
(set-time-second! t (+ (time-second t) 1))
(set-time-nanosecond! t (+ 1000000000 (time-nanosecond t))))))
t)
(define (make-time type nanosecond second)
(time-normalize! (make-time-unnormalized type nanosecond second)))
;; Helpers
;; FIXME: finish this and publish it?
(define (date->broken-down-time date)
(let ((result (mktime 0)))
;; FIXME: What should we do about leap-seconds which may overflow
;; set-tm:sec?
(set-tm:sec result (date-second date))
(set-tm:min result (date-minute date))
(set-tm:hour result (date-hour date))
;; FIXME: SRFI day ranges from 0-31. (not compatible with set-tm:mday).
(set-tm:mday result (date-day date))
(set-tm:mon result (- (date-month date) 1))
;; FIXME: need to signal error on range violation.
(set-tm:year result (+ 1900 (date-year date)))
(set-tm:isdst result -1)
(set-tm:gmtoff result (- (date-zone-offset date)))
result))
;;; current-time
;;; specific time getters.
(define (current-time-utc)
;; Resolution is microseconds.
(let ((tod (gettimeofday)))
(make-time time-utc (* (cdr tod) 1000) (car tod))))
(define (current-time-tai)
;; Resolution is microseconds.
(let* ((tod (gettimeofday))
(sec (car tod))
(usec (cdr tod)))
(make-time time-tai
(* usec 1000)
(+ (car tod) (leap-second-delta sec)))))
;;(define (current-time-ms-time time-type proc)
;; (let ((current-ms (proc)))
;; (make-time time-type
;; (quotient current-ms 10000)
;; (* (remainder current-ms 1000) 10000))))
;; -- we define it to be the same as TAI.
;; A different implemation of current-time-montonic
;; will require rewriting all of the time-monotonic converters,
;; of course.
(define (current-time-monotonic)
;; Resolution is microseconds.
(current-time-tai))
(define (current-time-thread)
(time-error 'current-time 'unsupported-clock-type 'time-thread))
(define ns-per-guile-tick (/ 1000000000 internal-time-units-per-second))
(define (current-time-process)
(let ((run-time (get-internal-run-time)))
(make-time
time-process
(* (remainder run-time internal-time-units-per-second)
ns-per-guile-tick)
(quotient run-time internal-time-units-per-second))))
;;(define (current-time-gc)
;; (current-time-ms-time time-gc current-gc-milliseconds))
(define (current-time . clock-type)
(let ((clock-type (if (null? clock-type) time-utc (car clock-type))))
(cond
((eq? clock-type time-tai) (current-time-tai))
((eq? clock-type time-utc) (current-time-utc))
((eq? clock-type time-monotonic) (current-time-monotonic))
((eq? clock-type time-thread) (current-time-thread))
((eq? clock-type time-process) (current-time-process))
;; ((eq? clock-type time-gc) (current-time-gc))
(else (time-error 'current-time 'invalid-clock-type clock-type)))))
;; -- Time Resolution
;; This is the resolution of the clock in nanoseconds.
;; This will be implementation specific.
(define (time-resolution . clock-type)
(let ((clock-type (if (null? clock-type) time-utc (car clock-type))))
(case clock-type
((time-tai) 1000)
((time-utc) 1000)
((time-monotonic) 1000)
((time-process) ns-per-guile-tick)
;; ((eq? clock-type time-thread) 1000)
;; ((eq? clock-type time-gc) 10000)
(else (time-error 'time-resolution 'invalid-clock-type clock-type)))))
;; -- Time comparisons
(define (time=? t1 t2)
;; Arrange tests for speed and presume that t1 and t2 are actually times.
;; also presume it will be rare to check two times of different types.
(and (= (time-second t1) (time-second t2))
(= (time-nanosecond t1) (time-nanosecond t2))
(eq? (time-type t1) (time-type t2))))
(define (time>? t1 t2)
(or (> (time-second t1) (time-second t2))
(and (= (time-second t1) (time-second t2))
(> (time-nanosecond t1) (time-nanosecond t2)))))
(define (time<? t1 t2)
(or (< (time-second t1) (time-second t2))
(and (= (time-second t1) (time-second t2))
(< (time-nanosecond t1) (time-nanosecond t2)))))
(define (time>=? t1 t2)
(or (> (time-second t1) (time-second t2))
(and (= (time-second t1) (time-second t2))
(>= (time-nanosecond t1) (time-nanosecond t2)))))
(define (time<=? t1 t2)
(or (< (time-second t1) (time-second t2))
(and (= (time-second t1) (time-second t2))
(<= (time-nanosecond t1) (time-nanosecond t2)))))
;; -- Time arithmetic
(define (time-difference! time1 time2)
(let ((sec-diff (- (time-second time1) (time-second time2)))
(nsec-diff (- (time-nanosecond time1) (time-nanosecond time2))))
(set-time-type! time1 time-duration)
(set-time-second! time1 sec-diff)
(set-time-nanosecond! time1 nsec-diff)
(time-normalize! time1)))
(define (time-difference time1 time2)
(let ((result (copy-time time1)))
(time-difference! result time2)))
(define (add-duration! t duration)
(if (not (eq? (time-type duration) time-duration))
(time-error 'add-duration 'not-duration duration)
(let ((sec-plus (+ (time-second t) (time-second duration)))
(nsec-plus (+ (time-nanosecond t) (time-nanosecond duration))))
(set-time-second! t sec-plus)
(set-time-nanosecond! t nsec-plus)
(time-normalize! t))))
(define (add-duration t duration)
(let ((result (copy-time t)))
(add-duration! result duration)))
(define (subtract-duration! t duration)
(if (not (eq? (time-type duration) time-duration))
(time-error 'add-duration 'not-duration duration)
(let ((sec-minus (- (time-second t) (time-second duration)))
(nsec-minus (- (time-nanosecond t) (time-nanosecond duration))))
(set-time-second! t sec-minus)
(set-time-nanosecond! t nsec-minus)
(time-normalize! t))))
(define (subtract-duration time1 duration)
(let ((result (copy-time time1)))
(subtract-duration! result duration)))
;; -- Converters between types.
(define (priv:time-tai->time-utc! time-in time-out caller)
(if (not (eq? (time-type time-in) time-tai))
(time-error caller 'incompatible-time-types time-in))
(set-time-type! time-out time-utc)
(set-time-nanosecond! time-out (time-nanosecond time-in))
(set-time-second! time-out (- (time-second time-in)
(leap-second-delta
(time-second time-in))))
time-out)
(define (time-tai->time-utc time-in)
(priv:time-tai->time-utc! time-in (make-time-unnormalized #f #f #f) 'time-tai->time-utc))
(define (time-tai->time-utc! time-in)
(priv:time-tai->time-utc! time-in time-in 'time-tai->time-utc!))
(define (priv:time-utc->time-tai! time-in time-out caller)
(if (not (eq? (time-type time-in) time-utc))
(time-error caller 'incompatible-time-types time-in))
(set-time-type! time-out time-tai)
(set-time-nanosecond! time-out (time-nanosecond time-in))
(set-time-second! time-out (+ (time-second time-in)
(leap-second-delta
(time-second time-in))))
time-out)
(define (time-utc->time-tai time-in)
(priv:time-utc->time-tai! time-in (make-time-unnormalized #f #f #f) 'time-utc->time-tai))
(define (time-utc->time-tai! time-in)
(priv:time-utc->time-tai! time-in time-in 'time-utc->time-tai!))
;; -- these depend on time-monotonic having the same definition as time-tai!
(define (time-monotonic->time-utc time-in)
(if (not (eq? (time-type time-in) time-monotonic))
(time-error 'time-monotonic->time-utc
'incompatible-time-types time-in))
(let ((ntime (copy-time time-in)))
(set-time-type! ntime time-tai)
(priv:time-tai->time-utc! ntime ntime 'time-monotonic->time-utc)))
(define (time-monotonic->time-utc! time-in)
(if (not (eq? (time-type time-in) time-monotonic))
(time-error 'time-monotonic->time-utc!
'incompatible-time-types time-in))
(set-time-type! time-in time-tai)
(priv:time-tai->time-utc! time-in time-in 'time-monotonic->time-utc))
(define (time-monotonic->time-tai time-in)
(if (not (eq? (time-type time-in) time-monotonic))
(time-error 'time-monotonic->time-tai
'incompatible-time-types time-in))
(let ((ntime (copy-time time-in)))
(set-time-type! ntime time-tai)
ntime))
(define (time-monotonic->time-tai! time-in)
(if (not (eq? (time-type time-in) time-monotonic))
(time-error 'time-monotonic->time-tai!
'incompatible-time-types time-in))
(set-time-type! time-in time-tai)
time-in)
(define (time-utc->time-monotonic time-in)
(if (not (eq? (time-type time-in) time-utc))
(time-error 'time-utc->time-monotonic
'incompatible-time-types time-in))
(let ((ntime (priv:time-utc->time-tai! time-in (make-time-unnormalized #f #f #f)
'time-utc->time-monotonic)))
(set-time-type! ntime time-monotonic)
ntime))
(define (time-utc->time-monotonic! time-in)
(if (not (eq? (time-type time-in) time-utc))
(time-error 'time-utc->time-monotonic!
'incompatible-time-types time-in))
(let ((ntime (priv:time-utc->time-tai! time-in time-in
'time-utc->time-monotonic!)))
(set-time-type! ntime time-monotonic)
ntime))
(define (time-tai->time-monotonic time-in)
(if (not (eq? (time-type time-in) time-tai))
(time-error 'time-tai->time-monotonic
'incompatible-time-types time-in))
(let ((ntime (copy-time time-in)))
(set-time-type! ntime time-monotonic)
ntime))
(define (time-tai->time-monotonic! time-in)
(if (not (eq? (time-type time-in) time-tai))
(time-error 'time-tai->time-monotonic!
'incompatible-time-types time-in))
(set-time-type! time-in time-monotonic)
time-in)
;; -- Date Structures
;; FIXME: to be really safe, perhaps we should normalize the
;; seconds/nanoseconds/minutes coming in to make-date...
(define-record-type date
(make-date nanosecond second minute
hour day month
year
zone-offset)
date?
(nanosecond date-nanosecond set-date-nanosecond!)
(second date-second set-date-second!)
(minute date-minute set-date-minute!)
(hour date-hour set-date-hour!)
(day date-day set-date-day!)
(month date-month set-date-month!)
(year date-year set-date-year!)
(zone-offset date-zone-offset set-date-zone-offset!))
;; gives the julian day which starts at noon.
(define (encode-julian-day-number day month year)
(let* ((a (quotient (- 14 month) 12))
(y (- (+ year 4800) a (if (negative? year) -1 0)))
(m (- (+ month (* 12 a)) 3)))
(+ day
(quotient (+ (* 153 m) 2) 5)
(* 365 y)
(quotient y 4)
(- (quotient y 100))
(quotient y 400)
-32045)))
;; gives the seconds/date/month/year
(define (decode-julian-day-number jdn)
(let* ((days (inexact->exact (truncate jdn)))
(a (+ days 32044))
(b (quotient (+ (* 4 a) 3) 146097))
(c (- a (quotient (* 146097 b) 4)))
(d (quotient (+ (* 4 c) 3) 1461))
(e (- c (quotient (* 1461 d) 4)))
(m (quotient (+ (* 5 e) 2) 153))
(y (+ (* 100 b) d -4800 (quotient m 10))))
(values ; seconds date month year
(* (- jdn days) sid)
(+ e (- (quotient (+ (* 153 m) 2) 5)) 1)
(+ m 3 (* -12 (quotient m 10)))
(if (>= 0 y) (- y 1) y))))
;; relies on the fact that we named our time zone accessor
;; differently from MzScheme's....
;; This should be written to be OS specific.
(define (local-tz-offset utc-time)
;; SRFI uses seconds West, but guile (and libc) use seconds East.
(- (tm:gmtoff (localtime (time-second utc-time)))))
;; special thing -- ignores nanos
(define (time->julian-day-number seconds tz-offset)
(+ (/ (+ seconds tz-offset sihd)
sid)
tai-epoch-in-jd))
(define (leap-second? second)
(and (assoc second leap-second-table) #t))
(define (time-utc->date time . tz-offset)
(if (not (eq? (time-type time) time-utc))
(time-error 'time->date 'incompatible-time-types time))
(let* ((offset (if (null? tz-offset)
(local-tz-offset time)
(car tz-offset)))
(leap-second? (leap-second? (+ offset (time-second time))))
(jdn (time->julian-day-number (if leap-second?
(- (time-second time) 1)
(time-second time))
offset)))
(call-with-values (lambda () (decode-julian-day-number jdn))
(lambda (secs date month year)
;; secs is a real because jdn is a real in Guile;
;; but it is conceptionally an integer.
(let* ((int-secs (inexact->exact (round secs)))
(hours (quotient int-secs (* 60 60)))
(rem (remainder int-secs (* 60 60)))
(minutes (quotient rem 60))
(seconds (remainder rem 60)))
(make-date (time-nanosecond time)
(if leap-second? (+ seconds 1) seconds)
minutes
hours
date
month
year
offset))))))
(define (time-tai->date time . tz-offset)
(if (not (eq? (time-type time) time-tai))
(time-error 'time->date 'incompatible-time-types time))
(let* ((offset (if (null? tz-offset)
(local-tz-offset (time-tai->time-utc time))
(car tz-offset)))
(seconds (- (time-second time)
(leap-second-delta (time-second time))))
(leap-second? (leap-second? (+ offset seconds)))
(jdn (time->julian-day-number (if leap-second?
(- seconds 1)
seconds)
offset)))
(call-with-values (lambda () (decode-julian-day-number jdn))
(lambda (secs date month year)
;; secs is a real because jdn is a real in Guile;
;; but it is conceptionally an integer.
;; adjust for leap seconds if necessary ...
(let* ((int-secs (inexact->exact (round secs)))
(hours (quotient int-secs (* 60 60)))
(rem (remainder int-secs (* 60 60)))
(minutes (quotient rem 60))
(seconds (remainder rem 60)))
(make-date (time-nanosecond time)
(if leap-second? (+ seconds 1) seconds)
minutes
hours
date
month
year
offset))))))
;; this is the same as time-tai->date.
(define (time-monotonic->date time . tz-offset)
(if (not (eq? (time-type time) time-monotonic))
(time-error 'time->date 'incompatible-time-types time))
(let* ((offset (if (null? tz-offset)
(local-tz-offset (time-monotonic->time-utc time))
(car tz-offset)))
(seconds (- (time-second time)
(leap-second-delta (time-second time))))
(leap-second? (leap-second? (+ offset seconds)))
(jdn (time->julian-day-number (if leap-second?
(- seconds 1)
seconds)
offset)))
(call-with-values (lambda () (decode-julian-day-number jdn))
(lambda (secs date month year)
;; secs is a real because jdn is a real in Guile;
;; but it is conceptionally an integer.
;; adjust for leap seconds if necessary ...
(let* ((int-secs (inexact->exact (round secs)))
(hours (quotient int-secs (* 60 60)))
(rem (remainder int-secs (* 60 60)))
(minutes (quotient rem 60))
(seconds (remainder rem 60)))
(make-date (time-nanosecond time)
(if leap-second? (+ seconds 1) seconds)
minutes
hours
date
month
year
offset))))))
(define (date->time-utc date)
(let* ((jdays (- (encode-julian-day-number (date-day date)
(date-month date)
(date-year date))
tai-epoch-in-jd))
;; jdays is an integer plus 1/2,
(jdays-1/2 (inexact->exact (- jdays 1/2))))
(make-time
time-utc
(date-nanosecond date)
(+ (* jdays-1/2 24 60 60)
(* (date-hour date) 60 60)
(* (date-minute date) 60)
(date-second date)
(- (date-zone-offset date))))))
(define (date->time-tai date)
(time-utc->time-tai! (date->time-utc date)))
(define (date->time-monotonic date)
(time-utc->time-monotonic! (date->time-utc date)))
(define (leap-year? year)
(or (= (modulo year 400) 0)
(and (= (modulo year 4) 0) (not (= (modulo year 100) 0)))))
;; Map 1-based month number M to number of days in the year before the
;; start of month M (in a non-leap year).
(define month-assoc '((1 . 0) (2 . 31) (3 . 59) (4 . 90)
(5 . 120) (6 . 151) (7 . 181) (8 . 212)
(9 . 243) (10 . 273) (11 . 304) (12 . 334)))
(define (year-day day month year)
(let ((days-pr (assoc month month-assoc)))
(if (not days-pr)
(time-error 'date-year-day 'invalid-month-specification month))
(if (and (leap-year? year) (> month 2))
(+ day (cdr days-pr) 1)
(+ day (cdr days-pr)))))
(define (date-year-day date)
(year-day (date-day date) (date-month date) (date-year date)))
;; from calendar faq
(define (week-day day month year)
(let* ((a (quotient (- 14 month) 12))
(y (- year a))
(m (+ month (* 12 a) -2)))
(modulo (+ day
y
(quotient y 4)
(- (quotient y 100))
(quotient y 400)
(quotient (* 31 m) 12))
7)))
(define (date-week-day date)
(week-day (date-day date) (date-month date) (date-year date)))
(define (days-before-first-week date day-of-week-starting-week)
(let* ((first-day (make-date 0 0 0 0
1
1
(date-year date)
#f))
(fdweek-day (date-week-day first-day)))
(modulo (- day-of-week-starting-week fdweek-day)
7)))
;; The "-1" here is a fix for the reference implementation, to make a new
;; week start on the given day-of-week-starting-week. date-year-day returns
;; a day starting from 1 for 1st Jan.
;;
(define (date-week-number date day-of-week-starting-week)
(quotient (- (date-year-day date)
1
(days-before-first-week date day-of-week-starting-week))
7))
(define (current-date . tz-offset)
(let ((time (current-time time-utc)))
(time-utc->date
time
(if (null? tz-offset)
(local-tz-offset time)
(car tz-offset)))))
;; given a 'two digit' number, find the year within 50 years +/-
(define (natural-year n)
(let* ((current-year (date-year (current-date)))
(current-century (* (quotient current-year 100) 100)))
(cond
((>= n 100) n)
((< n 0) n)
((<= (- (+ current-century n) current-year) 50) (+ current-century n))
(else (+ (- current-century 100) n)))))
(define (date->julian-day date)
(let ((nanosecond (date-nanosecond date))
(second (date-second date))
(minute (date-minute date))
(hour (date-hour date))
(day (date-day date))
(month (date-month date))
(year (date-year date))
(offset (date-zone-offset date)))
(+ (encode-julian-day-number day month year)
(- 1/2)
(+ (/ (+ (- offset)
(* hour 60 60)
(* minute 60)
second
(/ nanosecond nano))
sid)))))
(define (date->modified-julian-day date)
(- (date->julian-day date)
4800001/2))
(define (time-utc->julian-day time)
(if (not (eq? (time-type time) time-utc))
(time-error 'time->date 'incompatible-time-types time))
(+ (/ (+ (time-second time) (/ (time-nanosecond time) nano))
sid)
tai-epoch-in-jd))
(define (time-utc->modified-julian-day time)
(- (time-utc->julian-day time)
4800001/2))
(define (time-tai->julian-day time)
(if (not (eq? (time-type time) time-tai))
(time-error 'time->date 'incompatible-time-types time))
(+ (/ (+ (- (time-second time)
(leap-second-delta (time-second time)))
(/ (time-nanosecond time) nano))
sid)
tai-epoch-in-jd))
(define (time-tai->modified-julian-day time)
(- (time-tai->julian-day time)
4800001/2))
;; this is the same as time-tai->julian-day
(define (time-monotonic->julian-day time)
(if (not (eq? (time-type time) time-monotonic))
(time-error 'time->date 'incompatible-time-types time))
(+ (/ (+ (- (time-second time)
(leap-second-delta (time-second time)))
(/ (time-nanosecond time) nano))
sid)
tai-epoch-in-jd))
(define (time-monotonic->modified-julian-day time)
(- (time-monotonic->julian-day time)
4800001/2))
(define (julian-day->time-utc jdn)
(let ((secs (* sid (- jdn tai-epoch-in-jd))))
(receive (seconds parts)
(split-real secs)
(make-time time-utc
(* parts nano)
seconds))))
(define (julian-day->time-tai jdn)
(time-utc->time-tai! (julian-day->time-utc jdn)))
(define (julian-day->time-monotonic jdn)
(time-utc->time-monotonic! (julian-day->time-utc jdn)))
(define (julian-day->date jdn . tz-offset)
(let* ((time (julian-day->time-utc jdn))
(offset (if (null? tz-offset)
(local-tz-offset time)
(car tz-offset))))
(time-utc->date time offset)))
(define (modified-julian-day->date jdn . tz-offset)
(apply julian-day->date (+ jdn 4800001/2)
tz-offset))
(define (modified-julian-day->time-utc jdn)
(julian-day->time-utc (+ jdn 4800001/2)))
(define (modified-julian-day->time-tai jdn)
(julian-day->time-tai (+ jdn 4800001/2)))
(define (modified-julian-day->time-monotonic jdn)
(julian-day->time-monotonic (+ jdn 4800001/2)))
(define (current-julian-day)
(time-utc->julian-day (current-time time-utc)))
(define (current-modified-julian-day)
(time-utc->modified-julian-day (current-time time-utc)))
;; returns a string rep. of number N, of minimum LENGTH, padded with
;; character PAD-WITH. If PAD-WITH is #f, no padding is done, and it's
;; as if number->string was used. if string is longer than or equal
;; in length to LENGTH, it's as if number->string was used.
(define (padding n pad-with length)
(let* ((str (number->string n))
(str-len (string-length str)))
(if (or (>= str-len length)
(not pad-with))
str
(string-append (make-string (- length str-len) pad-with) str))))
(define (last-n-digits i n)
(abs (remainder i (expt 10 n))))
(define (locale-abbr-weekday n) (locale-day-short (+ 1 n)))
(define (locale-long-weekday n) (locale-day (+ 1 n)))
(define locale-abbr-month locale-month-short)
(define locale-long-month locale-month)
(define (date-reverse-lookup needle haystack-ref haystack-len
same?)
;; Lookup NEEDLE (a string) using HAYSTACK-REF (a one argument procedure
;; that returns a string corresponding to the given index) by passing it
;; indices lower than HAYSTACK-LEN.
(let loop ((index 1))
(cond ((> index haystack-len) #f)
((same? needle (haystack-ref index))
index)
(else (loop (+ index 1))))))
(define (locale-abbr-weekday->index string)
(date-reverse-lookup string locale-day-short 7 string=?))
(define (locale-long-weekday->index string)
(date-reverse-lookup string locale-day 7 string=?))
(define (locale-abbr-month->index string)
(date-reverse-lookup string locale-abbr-month 12 string=?))
(define (locale-long-month->index string)
(date-reverse-lookup string locale-long-month 12 string=?))
;; FIXME: mkoeppe: Put a symbolic time zone in the date structs.
;; Print it here instead of the numerical offset if available.
(define (locale-print-time-zone date port)
(tz-printer (date-zone-offset date) port))
(define (locale-am-string/pm hr)
(if (> hr 11) (locale-pm-string) (locale-am-string)))
(define (tz-printer offset port)
(cond
((= offset 0) (display "Z" port))
((negative? offset) (display "-" port))
(else (display "+" port)))
(if (not (= offset 0))
(let ((hours (abs (quotient offset (* 60 60))))
(minutes (abs (quotient (remainder offset (* 60 60)) 60))))
(display (padding hours #\0 2) port)
(display (padding minutes #\0 2) port))))
;; A table of output formatting directives.
;; the first time is the format char.
;; the second is a procedure that takes the date, a padding character
;; (which might be #f), and the output port.
;;
(define directives
(list
(cons #\~ (lambda (date pad-with port)
(display #\~ port)))
(cons #\a (lambda (date pad-with port)
(display (locale-abbr-weekday (date-week-day date))
port)))
(cons #\A (lambda (date pad-with port)
(display (locale-long-weekday (date-week-day date))
port)))
(cons #\b (lambda (date pad-with port)
(display (locale-abbr-month (date-month date))
port)))
(cons #\B (lambda (date pad-with port)
(display (locale-long-month (date-month date))
port)))
(cons #\c (lambda (date pad-with port)
(display (date->string date locale-date-time-format) port)))
(cons #\d (lambda (date pad-with port)
(display (padding (date-day date)
#\0 2)
port)))
(cons #\D (lambda (date pad-with port)
(display (date->string date "~m/~d/~y") port)))
(cons #\e (lambda (date pad-with port)
(display (padding (date-day date)
#\Space 2)
port)))
(cons #\f (lambda (date pad-with port)
(if (> (date-nanosecond date)
nano)
(display (padding (+ (date-second date) 1)
pad-with 2)
port)
(display (padding (date-second date)
pad-with 2)
port))
(receive (i f)
(split-real (/
(date-nanosecond date)
nano 1.0))
(let* ((ns (number->string f))
(le (string-length ns)))
(if (> le 2)
(begin
(display (locale-decimal-point) port)
(display (substring ns 2 le) port)))))))
(cons #\h (lambda (date pad-with port)
(display (date->string date "~b") port)))
(cons #\H (lambda (date pad-with port)
(display (padding (date-hour date)
pad-with 2)
port)))
(cons #\I (lambda (date pad-with port)
(let ((hr (date-hour date)))
(if (> hr 12)
(display (padding (- hr 12)
pad-with 2)
port)
(display (padding hr
pad-with 2)
port)))))
(cons #\j (lambda (date pad-with port)
(display (padding (date-year-day date)
pad-with 3)
port)))
(cons #\k (lambda (date pad-with port)
(display (padding (date-hour date)
#\Space 2)
port)))
(cons #\l (lambda (date pad-with port)
(let ((hr (if (> (date-hour date) 12)
(- (date-hour date) 12) (date-hour date))))
(display (padding hr #\Space 2)
port))))
(cons #\m (lambda (date pad-with port)
(display (padding (date-month date)
pad-with 2)
port)))
(cons #\M (lambda (date pad-with port)
(display (padding (date-minute date)
pad-with 2)
port)))
(cons #\n (lambda (date pad-with port)
(newline port)))
(cons #\N (lambda (date pad-with port)
(display (padding (date-nanosecond date)
pad-with 7)
port)))
(cons #\p (lambda (date pad-with port)
(display (locale-am-string/pm (date-hour date)) port)))
(cons #\r (lambda (date pad-with port)
(display (date->string date "~I:~M:~S ~p") port)))
(cons #\s (lambda (date pad-with port)
(display (time-second (date->time-utc date)) port)))
(cons #\S (lambda (date pad-with port)
(if (> (date-nanosecond date)
nano)
(display (padding (+ (date-second date) 1)
pad-with 2)
port)
(display (padding (date-second date)
pad-with 2)
port))))
(cons #\t (lambda (date pad-with port)
(display #\Tab port)))
(cons #\T (lambda (date pad-with port)
(display (date->string date "~H:~M:~S") port)))
(cons #\U (lambda (date pad-with port)
(if (> (days-before-first-week date 0) 0)
(display (padding (+ (date-week-number date 0) 1)
#\0 2) port)
(display (padding (date-week-number date 0)
#\0 2) port))))
(cons #\V (lambda (date pad-with port)
(display (padding (date-week-number date 1)
#\0 2) port)))
(cons #\w (lambda (date pad-with port)
(display (date-week-day date) port)))
(cons #\x (lambda (date pad-with port)
(display (date->string date locale-short-date-format) port)))
(cons #\X (lambda (date pad-with port)
(display (date->string date locale-time-format) port)))
(cons #\W (lambda (date pad-with port)
(if (> (days-before-first-week date 1) 0)
(display (padding (+ (date-week-number date 1) 1)
#\0 2) port)
(display (padding (date-week-number date 1)
#\0 2) port))))
(cons #\y (lambda (date pad-with port)
(display (padding (last-n-digits
(date-year date) 2)
pad-with
2)
port)))
(cons #\Y (lambda (date pad-with port)
(display (date-year date) port)))
(cons #\z (lambda (date pad-with port)
(tz-printer (date-zone-offset date) port)))
(cons #\Z (lambda (date pad-with port)
(locale-print-time-zone date port)))
(cons #\1 (lambda (date pad-with port)
(display (date->string date "~Y-~m-~d") port)))
(cons #\2 (lambda (date pad-with port)
(display (date->string date "~H:~M:~S~z") port)))
(cons #\3 (lambda (date pad-with port)
(display (date->string date "~H:~M:~S") port)))
(cons #\4 (lambda (date pad-with port)
(display (date->string date "~Y-~m-~dT~H:~M:~S~z") port)))
(cons #\5 (lambda (date pad-with port)
(display (date->string date "~Y-~m-~dT~H:~M:~S") port)))))
(define (get-formatter char)
(let ((associated (assoc char directives)))
(if associated (cdr associated) #f)))
(define (date-printer date index format-string str-len port)
(if (< index str-len)
(let ((current-char (string-ref format-string index)))
(if (not (char=? current-char #\~))
(begin
(display current-char port)
(date-printer date (+ index 1) format-string str-len port))
(if (= (+ index 1) str-len) ; bad format string.
(time-error 'date-printer 'bad-date-format-string
format-string)
(let ((pad-char? (string-ref format-string (+ index 1))))
(cond
((char=? pad-char? #\-)
(if (= (+ index 2) str-len) ; bad format string.
(time-error 'date-printer
'bad-date-format-string
format-string)
(let ((formatter (get-formatter
(string-ref format-string
(+ index 2)))))
(if (not formatter)
(time-error 'date-printer
'bad-date-format-string
format-string)
(begin
(formatter date #f port)
(date-printer date
(+ index 3)
format-string
str-len
port))))))
((char=? pad-char? #\_)
(if (= (+ index 2) str-len) ; bad format string.
(time-error 'date-printer
'bad-date-format-string
format-string)
(let ((formatter (get-formatter
(string-ref format-string
(+ index 2)))))
(if (not formatter)
(time-error 'date-printer
'bad-date-format-string
format-string)
(begin
(formatter date #\Space port)
(date-printer date
(+ index 3)
format-string
str-len
port))))))
(else
(let ((formatter (get-formatter
(string-ref format-string
(+ index 1)))))
(if (not formatter)
(time-error 'date-printer
'bad-date-format-string
format-string)
(begin
(formatter date #\0 port)
(date-printer date
(+ index 2)
format-string
str-len
port))))))))))))
(define (date->string date . format-string)
(let ((str-port (open-output-string))
(fmt-str (if (null? format-string) "~c" (car format-string))))
(date-printer date 0 fmt-str (string-length fmt-str) str-port)
(get-output-string str-port)))
(define (char->int ch)
(case ch
((#\0) 0)
((#\1) 1)
((#\2) 2)
((#\3) 3)
((#\4) 4)
((#\5) 5)
((#\6) 6)
((#\7) 7)
((#\8) 8)
((#\9) 9)
(else (time-error 'char->int 'bad-date-template-string
(list "Non-integer character" ch)))))
;; read an integer upto n characters long on port; upto -> #f is any length
(define (integer-reader upto port)
(let loop ((accum 0) (nchars 0))
(let ((ch (peek-char port)))
(if (or (eof-object? ch)
(not (char-numeric? ch))
(and upto (>= nchars upto)))
accum
(loop (+ (* accum 10) (char->int (read-char port)))
(+ nchars 1))))))
(define (make-integer-reader upto)
(lambda (port)
(integer-reader upto port)))
;; read *exactly* n characters and convert to integer; could be padded
(define (integer-reader-exact n port)
(let ((padding-ok #t))
(define (accum-int port accum nchars)
(let ((ch (peek-char port)))
(cond
((>= nchars n) accum)
((eof-object? ch)
(time-error 'string->date 'bad-date-template-string
"Premature ending to integer read."))
((char-numeric? ch)
(set! padding-ok #f)
(accum-int port
(+ (* accum 10) (char->int (read-char port)))
(+ nchars 1)))
(padding-ok
(read-char port) ; consume padding
(accum-int port accum (+ nchars 1)))
(else ; padding where it shouldn't be
(time-error 'string->date 'bad-date-template-string
"Non-numeric characters in integer read.")))))
(accum-int port 0 0)))
(define (make-integer-exact-reader n)
(lambda (port)
(integer-reader-exact n port)))
(define (zone-reader port)
(let ((offset 0)
(positive? #f))
(let ((ch (read-char port)))
(if (eof-object? ch)
(time-error 'string->date 'bad-date-template-string
(list "Invalid time zone +/-" ch)))
(if (or (char=? ch #\Z) (char=? ch #\z))
0
(begin
(cond
((char=? ch #\+) (set! positive? #t))
((char=? ch #\-) (set! positive? #f))
(else
(time-error 'string->date 'bad-date-template-string
(list "Invalid time zone +/-" ch))))
(let ((ch (read-char port)))
(if (eof-object? ch)
(time-error 'string->date 'bad-date-template-string
(list "Invalid time zone number" ch)))
(set! offset (* (char->int ch)
10 60 60)))
(let ((ch (read-char port)))
(if (eof-object? ch)
(time-error 'string->date 'bad-date-template-string
(list "Invalid time zone number" ch)))
(set! offset (+ offset (* (char->int ch)
60 60))))
(let ((ch (read-char port)))
(if (eof-object? ch)
(time-error 'string->date 'bad-date-template-string
(list "Invalid time zone number" ch)))
(set! offset (+ offset (* (char->int ch)
10 60))))
(let ((ch (read-char port)))
(if (eof-object? ch)
(time-error 'string->date 'bad-date-template-string
(list "Invalid time zone number" ch)))
(set! offset (+ offset (* (char->int ch)
60))))
(if positive? offset (- offset)))))))
;; looking at a char, read the char string, run thru indexer, return index
(define (locale-reader port indexer)
(define (read-char-string result)
(let ((ch (peek-char port)))
(if (char-alphabetic? ch)
(read-char-string (cons (read-char port) result))
(list->string (reverse! result)))))
(let* ((str (read-char-string '()))
(index (indexer str)))
(if index index (time-error 'string->date
'bad-date-template-string
(list "Invalid string for " indexer)))))
(define (make-locale-reader indexer)
(lambda (port)
(locale-reader port indexer)))
(define (make-char-id-reader char)
(lambda (port)
(if (char=? char (read-char port))
char
(time-error 'string->date
'bad-date-template-string
"Invalid character match."))))
;; A List of formatted read directives.
;; Each entry is a list.
;; 1. the character directive;
;; a procedure, which takes a character as input & returns
;; 2. #t as soon as a character on the input port is acceptable
;; for input,
;; 3. a port reader procedure that knows how to read the current port
;; for a value. Its one parameter is the port.
;; 4. an optional action procedure, that takes the value (from 3.) and
;; some object (here, always the date) and (probably) side-effects it.
;; If no action is required, as with ~A, this element may be #f.
(define read-directives
(let ((ireader4 (make-integer-reader 4))
(ireader2 (make-integer-reader 2))
(eireader2 (make-integer-exact-reader 2))
(locale-reader-abbr-weekday (make-locale-reader
locale-abbr-weekday->index))
(locale-reader-long-weekday (make-locale-reader
locale-long-weekday->index))
(locale-reader-abbr-month (make-locale-reader
locale-abbr-month->index))
(locale-reader-long-month (make-locale-reader
locale-long-month->index))
(char-fail (lambda (ch) #t)))
(list
(list #\~ char-fail (make-char-id-reader #\~) #f)
(list #\a char-alphabetic? locale-reader-abbr-weekday #f)
(list #\A char-alphabetic? locale-reader-long-weekday #f)
(list #\b char-alphabetic? locale-reader-abbr-month
(lambda (val object)
(set-date-month! object val)))
(list #\B char-alphabetic? locale-reader-long-month
(lambda (val object)
(set-date-month! object val)))
(list #\d char-numeric? ireader2 (lambda (val object)
(set-date-day!
object val)))
(list #\e char-fail eireader2 (lambda (val object)
(set-date-day! object val)))
(list #\h char-alphabetic? locale-reader-abbr-month
(lambda (val object)
(set-date-month! object val)))
(list #\H char-numeric? ireader2 (lambda (val object)
(set-date-hour! object val)))
(list #\k char-fail eireader2 (lambda (val object)
(set-date-hour! object val)))
(list #\m char-numeric? ireader2 (lambda (val object)
(set-date-month! object val)))
(list #\M char-numeric? ireader2 (lambda (val object)
(set-date-minute!
object val)))
(list #\S char-numeric? ireader2 (lambda (val object)
(set-date-second! object val)))
(list #\y char-fail eireader2
(lambda (val object)
(set-date-year! object (natural-year val))))
(list #\Y char-numeric? ireader4 (lambda (val object)
(set-date-year! object val)))
(list #\z (lambda (c)
(or (char=? c #\Z)
(char=? c #\z)
(char=? c #\+)
(char=? c #\-)))
zone-reader (lambda (val object)
(set-date-zone-offset! object val))))))
(define (priv:string->date date index format-string str-len port template-string)
(define (skip-until port skipper)
(let ((ch (peek-char port)))
(if (eof-object? ch)
(time-error 'string->date 'bad-date-format-string template-string)
(if (not (skipper ch))
(begin (read-char port) (skip-until port skipper))))))
(if (< index str-len)
(let ((current-char (string-ref format-string index)))
(if (not (char=? current-char #\~))
(let ((port-char (read-char port)))
(if (or (eof-object? port-char)
(not (char=? current-char port-char)))
(time-error 'string->date
'bad-date-format-string template-string))
(priv:string->date date
(+ index 1)
format-string
str-len
port
template-string))
;; otherwise, it's an escape, we hope
(if (> (+ index 1) str-len)
(time-error 'string->date
'bad-date-format-string template-string)
(let* ((format-char (string-ref format-string (+ index 1)))
(format-info (assoc format-char read-directives)))
(if (not format-info)
(time-error 'string->date
'bad-date-format-string template-string)
(begin
(let ((skipper (cadr format-info))
(reader (caddr format-info))
(actor (cadddr format-info)))
(skip-until port skipper)
(let ((val (reader port)))
(if (eof-object? val)
(time-error 'string->date
'bad-date-format-string
template-string)
(if actor (actor val date))))
(priv:string->date date
(+ index 2)
format-string
str-len
port
template-string))))))))))
(define (string->date input-string template-string)
(define (date-ok? date)
(and (date-nanosecond date)
(date-second date)
(date-minute date)
(date-hour date)
(date-day date)
(date-month date)
(date-year date)
(date-zone-offset date)))
(let ((newdate (make-date 0 0 0 0 #f #f #f #f)))
(priv:string->date newdate
0
template-string
(string-length template-string)
(open-input-string input-string)
template-string)
(if (not (date-zone-offset newdate))
(begin
;; this is necessary to get DST right -- as far as we can
;; get it right (think of the double/missing hour in the
;; night when we are switching between normal time and DST).
(set-date-zone-offset! newdate
(local-tz-offset
(make-time time-utc 0 0)))
(set-date-zone-offset! newdate
(local-tz-offset
(date->time-utc newdate)))))
(if (date-ok? newdate)
newdate
(time-error
'string->date
'bad-date-format-string
(list "Incomplete date read. " newdate template-string)))))
;;; srfi-19.scm ends here
| false |
96b06f2980943ba1d3e31f061c3601eb1fa3b93a
|
26aaec3506b19559a353c3d316eb68f32f29458e
|
/apps/DemoHybridApp/main.scm
|
213a1273ef78a5629ebc12d38179a5e40c4d0f67
|
[
"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 | 8,121 |
scm
|
main.scm
|
#|
LambdaNative - a cross-platform Scheme framework
Copyright (c) 2009-2016, 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.
|#
;; basic hybrid app example
(define index-js
#<<EOJS
// Send HTTP GET to back end
function get_async(url,fun) {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState == XMLHttpRequest.DONE) {
if (xhr.status == 200) {
fun(decodeURI(xhr.responseText));
} else {
console.log('** get_async FAILED, status=' + xhr.status + ' [' + xhr.statusText + ']');
}
}
}
xhr.open('GET', url, true);
xhr.send(null);
};
// Ask the Scheme backend to calculate the inner rectangle dimensions
function calculateRect() {
// Get width, height, and percent from the fields
var w = document.getElementById("width").value;
var h = document.getElementById("height").value;
var p = document.getElementById("percent").value;
var ajax_cmd = "calculate-rect.cgi?w=" + w + "&h=" + h + "&p=" + p;
console.log(ajax_cmd);
get_async(ajax_cmd, function(data) {
var resultp = document.getElementById("result");
if (data.localeCompare("MISSING_PARAMS") == 0) {
resultp.innerHTML = "Error, something went wrong. Missing parameters!";
} else if (data.localeCompare("NOT_NUMBERS") == 0) {
resultp.innerHTML = "Error. Please enter a number in each box for width, height, and percent of area."
} else if (data.localeCompare("NOT_POSITIVE") == 0) {
resultp.innerHTML = "Error. All values must be positive (> 0)."
} else {
var returned_data = false;
try { returned_data = JSON.parse(data); } catch(err) { console.log("error calculating") };
if (returned_data) {
var area = returned_data["area"];
var narea = returned_data["narea"];
var new_w = returned_data["neww"];
var new_h = returned_data["newh"];
resultp.innerHTML = "The original rectangle has an area of " + area + ". The new one has an area of " + narea +
", " + p + "% of the original. The new rectangle has <b>width " + new_w + "</b> and <b>height " + new_h + "</b>.";
}
}
});
}
EOJS
)
;; Defining CSS
(define (css f) `(link (@ (href ,f) (rel "stylesheet"))))
;; Basic webpage
(website-addhook #f "/index.html"
(lambda (args)
(string->u8vector (with-output-to-string ""
(lambda () (sxml->xml
`(html (head ,(css "css/style.css"))
(body (h1 "Hello from LambdaNative")
(p "This is HTML served from a hybrid app.")
(p "It contains an example of communication between the front end HTML, Javascript and back end Scheme.")
(br)
(p "Given a rectangle, the below calculator finds the width and height of a rectangle that takes up a given percentage of the area of the original (that can be centered within it, with the same border all the way around). While unnecessary, the calculations are done in Scheme.")
;; Form calls Javascript function when Calculate button pressed
;; Return false in order to not do any other action from the form submit
(form (@ (onsubmit "calculateRect(); return false;"))
(table
(tr
(th "Width:")
(th "Height:")
(th "Percent of area:"))
(tr
(td
(input (@ (id "width")
(type "number")) ""))
(td
(input (@ (id "height")
(type "number")) ""))
(td
(input (@ (id "percent")
(type "number")) ""))))
(br)
(br)
(input (@ (type "submit")
(value "Calculate"))))
;; Result will be shown here
(p (@ (id "result")) "")
;; Include Javascript here, inside the body
(script (@ (type "text/javascript")) ,index-js)))))))))
(website-serve #f 8080 'localonly)
;; Back-end respond to GET here
(website-addhook #f "/calculate-rect.cgi" (lambda (x)
(let* ((qstring (assoc "QUERY_STRING" x))
(params (getargs->list (if qstring (cadr qstring) '()))))
(if params
(let ((wentry (assoc "w" params))
(hentry (assoc "h" params))
(pentry (assoc "p" params)))
(if (and wentry hentry pentry)
(let ((w (string->number (cadr wentry)))
(h (string->number (cadr hentry)))
(p (string->number (cadr pentry))))
(if (and w p h)
(if (and (> w 0) (> h 0) (> p 0))
;; Calculate the new rectangle dimensions and return them
;; in JSON format converted to a u8vector
(string->u8vector (json-encode (calculate-rect w h p)))
;; Return error because one of the numbers is 0 or negative
(string->u8vector "NOT_POSITIVE"))
;; Return error if converting to numbers failed
(string->u8vector "NOT_NUMBERS")))
;; Return error if for some reason any of the parameters are missing
(string->u8vector "MISSING_PARAMS")))
(string->u8vector "MISSING_PARAMS")))))
;; Given a rectangle, this procedure calculates the width and height of a rectangle that takes up a
;; given percentage of the area of the original (that can be centered within it,
;; with the same border all the way around).
;; w is the width of the original rectangle
;; h is the hieght of the original rectangle
;; p is the percent of area to use for the new rectangle
;; This procedure returns a list or pairs with values for the neww and newh
(define (calculate-rect w h p)
(let* ((area (* w h))
;; Calculate new (target) area
(narea (* area (/ p 100)))
(diff (- h w))
;; Use quadratic formula with a= 1, b = diff, and c = new area
(nw (abs (/ (+ (* diff -1) (sqrt (- (* diff diff) (* -4 narea)))) 2)))
(nh (abs (/ (- (* diff -1) (sqrt (- (* diff diff) (* -4 narea)))) 2))))
(list (cons "area" (float->string area 2)) (cons "narea" (float->string narea 2))
(cons "neww" (float->string nw 2)) (cons "newh" (float->string nh 2))))
)
;; Convert a string of arguments into a list of lists
(define (getargs->list str)
(if (string? str)
(let ((tmp (string-split str #\&)))
(map (lambda (s)
(let ((sp (string-split s #\=)))
(if (fx= (length sp) 1)
(append sp (list ""))
sp)))
tmp))
'()))
;; eof
| false |
52ad072b77cf1680bd5110c3a576748574f2b4b0
|
4b480cab3426c89e3e49554d05d1b36aad8aeef4
|
/chapter-04/ex4.06-test-comkid.scm
|
a16e473b1e63b1a770dee927470651dc57e4c01a
|
[] |
no_license
|
tuestudy/study-sicp
|
a5dc423719ca30a30ae685e1686534a2c9183b31
|
a2d5d65e711ac5fee3914e45be7d5c2a62bfc20f
|
refs/heads/master
| 2021-01-12T13:37:56.874455 | 2016-10-04T12:26:45 | 2016-10-04T12:26:45 | 69,962,129 | 0 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 414 |
scm
|
ex4.06-test-comkid.scm
|
(load "ch4-myeval-pkg-comkid.scm")
(load "../misc/scheme-test-r5rs.scm")
(define the-global-environment (setup-environment))
(define letexp '(let ((a 10) (b 20)) (+ a b)))
(define answer '((lambda (a b) (+ a b)) 10 20))
;test
(display "[ex4.06 - Tests]\n")
(run (make-testcase
'(assert-equal? answer (let->combination letexp))
'(assert-equal? 30 (myeval letexp the-global-environment))))
| false |
5ecd7075e7ce53e92029533808054400920ecdb0
|
defeada37d39bca09ef76f66f38683754c0a6aa0
|
/mscorlib/system/security/cryptography/signature-description.sls
|
4a015d9879ca93d1590c6bdb8dafdefa210a5721
|
[] |
no_license
|
futsuki/ironscheme-port
|
2dbac82c0bda4f4ff509208f7f00a5211d1f7cd5
|
4e7a81b0fbeac9a47440464988e53fb118286c54
|
refs/heads/master
| 2016-09-06T17:13:11.462593 | 2015-09-26T18:20:40 | 2015-09-26T18:20:40 | 42,757,369 | 0 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 2,533 |
sls
|
signature-description.sls
|
(library (system security cryptography signature-description)
(export new
is?
signature-description?
create-formatter
create-digest
create-deformatter
deformatter-algorithm-get
deformatter-algorithm-set!
deformatter-algorithm-update!
digest-algorithm-get
digest-algorithm-set!
digest-algorithm-update!
formatter-algorithm-get
formatter-algorithm-set!
formatter-algorithm-update!
key-algorithm-get
key-algorithm-set!
key-algorithm-update!)
(import (ironscheme-clr-port))
(define-syntax new
(lambda (e)
(syntax-case e ()
((_ a ...)
#'(clr-new
System.Security.Cryptography.SignatureDescription
a
...)))))
(define (is? a)
(clr-is System.Security.Cryptography.SignatureDescription a))
(define (signature-description? a)
(clr-is System.Security.Cryptography.SignatureDescription a))
(define-method-port
create-formatter
System.Security.Cryptography.SignatureDescription
CreateFormatter
(System.Security.Cryptography.AsymmetricSignatureFormatter
System.Security.Cryptography.AsymmetricAlgorithm))
(define-method-port
create-digest
System.Security.Cryptography.SignatureDescription
CreateDigest
(System.Security.Cryptography.HashAlgorithm))
(define-method-port
create-deformatter
System.Security.Cryptography.SignatureDescription
CreateDeformatter
(System.Security.Cryptography.AsymmetricSignatureDeformatter
System.Security.Cryptography.AsymmetricAlgorithm))
(define-field-port
deformatter-algorithm-get
deformatter-algorithm-set!
deformatter-algorithm-update!
(property:)
System.Security.Cryptography.SignatureDescription
DeformatterAlgorithm
System.String)
(define-field-port
digest-algorithm-get
digest-algorithm-set!
digest-algorithm-update!
(property:)
System.Security.Cryptography.SignatureDescription
DigestAlgorithm
System.String)
(define-field-port
formatter-algorithm-get
formatter-algorithm-set!
formatter-algorithm-update!
(property:)
System.Security.Cryptography.SignatureDescription
FormatterAlgorithm
System.String)
(define-field-port
key-algorithm-get
key-algorithm-set!
key-algorithm-update!
(property:)
System.Security.Cryptography.SignatureDescription
KeyAlgorithm
System.String))
| true |
5e890d8442116e08af7267029229020cb382fd04
|
e565c8e8d16935673647ecfbb7f1c674a260cb00
|
/lib/chibi/doc-test.sld
|
04c14637c43cb5eda8e979ce5ceeb101287e8b28
|
[
"BSD-3-Clause"
] |
permissive
|
tomelam/chibi-scheme
|
2997c9d53e2166ebf485934696b1661c37c19f9c
|
6f28159667212fffc9df4383dc773ea129f106d0
|
refs/heads/master
| 2020-12-01T19:05:39.952425 | 2019-12-28T14:48:44 | 2019-12-28T14:48:44 | 230,738,272 | 1 | 0 |
NOASSERTION
| 2019-12-29T11:03:00 | 2019-12-29T11:02:59 | null |
UTF-8
|
Scheme
| false | false | 1,094 |
sld
|
doc-test.sld
|
(define-library (chibi doc-test)
(export run-tests)
(import (scheme base) (chibi doc) (chibi test))
(begin
(define (run-tests)
(test-begin "doc")
(test '(spec (args config))
(get-optionals-signature
'(spec . o)
'((let ((args (or (and (pair? o) (car o)) (command-line)))
(config (and (pair? o) (pair? (cdr o)) (cadr o))))
(foo)))))
(test '(filename (port len))
(get-optionals-signature
'(filename . o)
'((let ((port (if (pair? o) (car o) (open-input-file filename)))
(len (if (and (pair? o) (pair? (cdr o))) (cadr o) 4096)))
(foo)))))
(test '(f kons knil source (index))
(get-optionals-signature
'(f kons knil source . o)
'((let lp ((p (if (string? source)
(string->parse-stream source)
source))
(index (if (pair? o) (car o) 0))
(acc knil))
(f p index fk)))))
(test-end))))
| false |
541c4aee3e7e2258c4ef7aab24b269a762d8a8f4
|
1de3d2f5aea84e4d19825c290980a3b4f7815f32
|
/monarchy/client/monarchy-client/test/run.scm
|
eb993d780fa6fb2dfad2fb5d12bb51002c88fe63
|
[] |
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 | 552 |
scm
|
run.scm
|
(load "../monarchy-client.scm")
(use veritas veritas-verifiers)
(let ((f (fact 'load 'equals 10)))
(verify (fact/subject f) (is 'load))
(verify (fact/predicate f) (is 'equals))
(verify (fact/object f) (is 10))
(verify (serialize-fact/edn f) (is '(vector load equals 10)))
(let ((s (sample "sensor1" f)))
(verify (serialize-sample/edn s) (is '(tag (monarchy . sample)
(map (name: . "sensor1")
(facts: list (vector load equals 10))))))))
| false |
361b22d421c9bc030bec6b8494ed4e45183e0a81
|
8f0ceb57d807ba1c92846ae899736b0418003e4f
|
/INF2810/practice for exam/random/let_and_lambda.scm
|
9d2ceda7c1c8784fee1767179e11ce67437bb5b9
|
[] |
no_license
|
hovdis/UiO
|
4549053188302af5202c8294a89124adb4eb981b
|
dcaa236314d5b0022e6be7c2cd0b48e88016475a
|
refs/heads/master
| 2020-09-16T04:04:22.283098 | 2020-02-26T08:21:21 | 2020-02-26T08:21:21 | 223,645,789 | 0 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 567 |
scm
|
let_and_lambda.scm
|
(let ((x 1)
(y 2)
(z 3))
(+ x y z))
#|
Dette funker ikke.
(let ((x 1)
(y 2)
(z (+ x y)))
(+ x y z))
|#
; ; Dette funker.
(let* ((x 1)
(y 2)
(z (+ x y)))
(+ x y z))
(let ((x 1))
(let ((y 2))
(let ((z 3))
(+ x y z))))
((lambda (x y z)
(+ x y z))
1 2 3 )
((lambda (x)
(let ((y 2))
(let ((z 3))
(+ x y z))))
1)
((lambda (x)
((lambda (y)
(let ((z 3))
(+ x y z)))
2)) 1)
((lambda (x)
((lambda (y)
((lambda (z)
(+ x y z))
3))
2))
1)
| false |
addb9a492499f1a8dd00bce53afb5caf0a16d448
|
4b570eebce894b4373cba292f09883932834e543
|
/ch2/2.9.scm
|
c899de26fee722bba39eec7029e6280f62169b33
|
[] |
no_license
|
Pulkit12083/sicp
|
ffabc406c66019e5305ad701fbc022509319e4b1
|
8ea6c57d2b0be947026dd01513ded25991e5c94f
|
refs/heads/master
| 2021-06-17T13:44:06.381879 | 2021-05-14T16:52:30 | 2021-05-14T16:52:30 | 197,695,022 | 0 | 0 | null | 2021-04-14T17:04:01 | 2019-07-19T03:25:41 |
Scheme
|
UTF-8
|
Scheme
| false | false | 2,283 |
scm
|
2.9.scm
|
;;2.8+2.9
(define (make-interval a b) (cons a b))
(define (upper-bound interval) (cdr interval))
(define (lower-bound interval) (car interval))
(define (mul-interval x y)
(let ((p1 (* (lower-bound x) (lower-bound y)))
(p2 (* (lower-bound x) (upper-bound y)))
(p3 (* (upper-bound x) (lower-bound y)))
(p4 (* (upper-bound x) (upper-bound y))))
(make-interval (min p1 p2 p3 p4)
(max p1 p2 p3 p4))))
(define (add-interval x y)
(make-interval (+ (lower-bound x) (lower-bound y))
(+ (upper-bound x) (upper-bound y))))
(define a (mul-interval (make-interval -2 3) (make-interval 4 7)))
(define (sub-interval a b)
(make-interval (- (lower-bound a) (upper-bound b))
(- (upper-bound a) (lower-bound b))))
;;2.9
; width is ARITHMETIC function of a b
(define (width-sum-interval a b)
(/ (- (+ (upper-bound a) (upper-bound b))
(+ (lower-bound a) (lower-bound b)))
2))
; width function of widths of args
;w1 = [aH-aL/2]
;w2 = [bH-bL/2]
;w3 = [aH+bH]-[aL+bL]/2
; = [aH-aL]+[bH-bL]/2
; = w1+w2
(define (width int)
(/ (- (upper-bound int) (lower-bound int)) 2))
(define (width-sum-interval-args int1 int2)
(+ (width int1) (width int2)))
;---subtraction
; w3 = [aH-bL] - [aL-bH] /2
; = [aH-aL] + [bH-bL] /2
; = w1 + w2 /2
;
;
; for multiplication not possible with just widths.
; because multipling different intervals with same widths reveals different width results
; [-5, 5] * [-1, 1] = [-5, 5] (width = 5)
; [0, 10] * [0, 2] = [0, 20] (width = 10)
;
;
;sicp provided
(define (div-interval x y)
(mul-interval x
(make-interval (/ 1.0 (upper-bound y))
(/ 1.0 (lower-bound y)))))
;2.10
(define (div-interval-check x y)
(if (or (= (upper-bound y) 0)
(= (lower-bound y) 0)
(= (width y) 0))
(error "division of interval spanning zero OR bound is zero for divider" y)
(mul-interval x
(make-interval (/ 1.0 (upper-bound y))
(/ 1.0 (lower-bound y))))))
; interface for end user electricians!
(define (make-center-width c w)
(make-interval (- c w) (+ c w)))
(define (center i)
(/ (+ (lower-bound i) (upper-bound i)) 2))
(define (width i)
(/ (- (upper-bound i) (lower-bound i)) 2))
| false |
0e4890cc0d8ec166084271ab822db79841a315a4
|
5927f3720f733d01d4b339b17945485bd3b08910
|
/dns.scm
|
532d6b49ec05410328f41a37e377acf227df6ae2
|
[] |
no_license
|
ashinn/hato
|
85e75c3b6c7ca7abca512dc9707da6db3b50a30d
|
17a7451743c46f29144ce7c43449eef070655073
|
refs/heads/master
| 2016-09-03T06:46:08.921164 | 2013-04-07T03:22:52 | 2013-04-07T03:22:52 | 32,322,276 | 5 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 11,464 |
scm
|
dns.scm
|
;; dns.scm -- Domain Name Service library
;;
;; Copyright (c) 2005-2009 Alex Shinn. All rights reserved.
;; BSD-style license: http://synthcode.com/license.txt
;; see http://tools.ietf.org/html/rfc1035
(require-extension udp lolevel srfi-4)
(module dns
(dns-lookup dns-text dns-mx dns-lookup/full dns-text/full dns-mx/full)
(import scheme chicken extras data-structures posix ports udp lolevel srfi-4)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; u8vector utilities
(define (u8vector-append a . o)
(define (append a b)
(let ((a-len (u8vector-length a))
(b-len (u8vector-length b)))
(cond
((zero? a-len) b)
((zero? b-len) a)
(else
(let ((c (make-u8vector (+ a-len b-len))))
(move-memory! a c)
(let lp ((from 0) (to a-len))
(unless (= from b-len)
(u8vector-set! c to (u8vector-ref b from))
(lp (+ from 1) (+ to 1))))
c)))))
(let lp ((res a) (ls o))
(if (pair? ls)
(lp (append res (car ls)) (cdr ls))
res)))
(define (u8vector-append-map ls proc)
(if (pair? ls)
(if (pair? (cdr ls))
(apply u8vector-append (map proc ls))
(proc (car ls)))
'#u8()))
(define (u16vector->u8vector/be u16)
(let* ((len (u16vector-length u16))
(res (make-u8vector (* len 2))))
(do ((i 0 (+ i 1)))
((= i len) res)
(let ((v (u16vector-ref u16 i)))
(u8vector-set! res (* i 2) (arithmetic-shift v -8))
(u8vector-set! res (+ (* i 2) 1) (bitwise-and v #xFF))))))
(define (string->u8vector str)
(blob->u8vector (string->blob str)))
(define (u8vector->string str)
(blob->string (u8vector->blob str)))
(define (string-scan ch str . o)
(let ((end (string-length str)))
(let scan ((i (if (pair? o) (car o) 0)))
(cond ((>= i end) #f)
((eq? ch (string-ref str i)) i)
(else (scan (+ i 1)))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; constants
;; types
(define dns/A 1)
(define dns/NS 2)
(define dns/MD 3)
(define dns/MF 4)
(define dns/CNAME 5)
(define dns/SOA 6)
(define dns/MB 7)
(define dns/MG 8)
(define dns/MR 9)
(define dns/NULL 10)
(define dns/WKS 11)
(define dns/PTR 12)
(define dns/HINFO 13)
(define dns/MINFO 14)
(define dns/MX 15)
(define dns/TXT 16)
;; qtypes
(define dns/AXFR 252)
(define dns/MAILB 253)
(define dns/MAILA 254)
(define dns/* 255)
;; classes
(define dns/IN 1)
(define dns/CS 2)
(define dns/CH 3)
(define dns/HS 4)
;; opcodes
(define dns/QUERY 0)
(define dns/IQUERY 1)
(define dns/STATUS 2)
(define dns-max-id (- (arithmetic-shift 1 16) 1))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; low-level interface
(define (bool->int n x) (if n (arithmetic-shift 1 x) 0))
(define (dns-header id query? opcode authoritative? truncated?
recursion-desired? recursion-available?
response-code question-count answer-count
authority-count additional-count)
(let ((flags
(bitwise-ior (bool->int (not query?) 15)
(arithmetic-shift opcode 11)
(bool->int authoritative? 10)
(bool->int truncated? 9)
(bool->int recursion-desired? 8)
(bool->int recursion-available? 7)
response-code)))
(u16vector->u8vector/be
(u16vector id flags question-count answer-count
authority-count additional-count))))
(define (dns-name-as-labels name)
(string->u8vector
(string-append
(let lp ((start 0))
(let* ((i (string-scan #\. name start))
(end (or i (string-length name))))
(string-append
(string (integer->char (- end start)))
(substring name start end)
(if i (lp (+ i 1)) ""))))
(string (integer->char 0)))))
(define (dns-question name type class)
(u8vector-append (dns-name-as-labels name)
(u16vector->u8vector/be (u16vector type class))))
(define (dns-rr name type class ttl rdata)
(u8vector-append
(dns-name-as-labels name)
(u16vector->u8vector/be
(u16vector type
class
(arithmetic-shift ttl -16)
(bitwise-and ttl (- (arithmetic-shift 1 16) 1))
(u8vector-length rdata)))
rdata))
(define (dns-message query? opcode response-code . o)
(let-optionals* o ((question-ls '())
(answer-ls '())
(authority-ls '())
(additional-ls '())
(authoritative? #f)
(truncated? #f)
(recursion-desired? #t)
(recursion-available? #f)
(id (random dns-max-id)))
(u8vector->string
(u8vector-append
(dns-header id query? opcode authoritative? truncated?
recursion-desired? recursion-available?
response-code
(length question-ls) (length answer-ls)
(length authority-ls) (length additional-ls))
(u8vector-append-map question-ls (cut apply dns-question <...>))
(u8vector-append-map answer-ls (cut apply dns-rr <...>))
(u8vector-append-map authority-ls (cut apply dns-rr <...>))
(u8vector-append-map additional-ls (cut apply dns-rr <...>))))))
(define (dns-build-query opcode questions)
(dns-message #t opcode 0 questions))
(define (dns-build-response opcode response answers)
(dns-message #f opcode response '() answers))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; parsing
(define (read-length-string str off len)
(let* ((start (car off))
(end (+ start len)))
(set-car! off end)
(substring str start end)))
(define (read-uint8 str off)
(let ((ch (string-ref str (car off))))
(set-car! off (+ 1 (car off)))
(char->integer ch)))
(define (read-uint16/be str off)
(let* ((b1 (read-uint8 str off))
(b2 (read-uint8 str off)))
(bitwise-ior (arithmetic-shift b1 8) b2)))
(define (read-label str off)
(let lp ((res '()))
(let ((i (read-uint8 str off)))
(cond
((or (eof-object? i) (zero? i))
(string-intersperse (reverse res) "."))
((> i 63)
(let* ((j (read-uint8 str off))
(off2 (list (bitwise-ior
(arithmetic-shift (bitwise-and i #b111111) 8)
j))))
(string-intersperse (reverse (cons (read-label str off2) res)) ".")))
(else
(lp (cons (read-length-string str off i) res)))))))
(define (read-question str off)
(let* ((qname (read-label str off))
(qtype (read-uint16/be str off))
(qclass (read-uint16/be str off)))
(list qname qtype qclass)))
(define (inet-ntoa n)
(string-append (number->string (char->integer (string-ref n 0))) "."
(number->string (char->integer (string-ref n 1))) "."
(number->string (char->integer (string-ref n 2))) "."
(number->string (char->integer (string-ref n 3)))))
(define (parse-rdata str index rdata type class)
(condition-case
(cond
((and (eq? type dns/A) (= 4 (string-length rdata)))
(inet-ntoa rdata))
((eq? type dns/NS)
(read-label str (list index)))
((eq? type dns/MX)
(let* ((preference (read-uint16/be rdata (list 0)))
(host (read-label str (list (+ index 2)))))
(list preference host)))
(else
;;(if (not (eq? type dns/TXT))
;; (fprintf (current-error-port) "unknown type: ~S ~S: ~S\n"
;; type class rdata))
rdata))
(exn ()
;;(fprintf (current-error-port) "error reading: ~S ~S: ~S\n"
;; type class rdata)
;;(print-error-message exn)
rdata)))
(define (read-resource str off)
(let* ((name (read-label str off))
(type (read-uint16/be str off))
(class (read-uint16/be str off))
(ttl-hi (read-uint16/be str off))
(ttl-lo (read-uint16/be str off))
(rdlength (read-uint16/be str off))
(data-index (car off))
(raw-rdata (read-length-string str off rdlength))
(rdata (parse-rdata str data-index raw-rdata type class)))
(list name type class (list ttl-hi ttl-lo) rdata)))
(define (read-n reader n str off)
(let lp ((n n) (res '()))
(if (zero? n)
(reverse res)
(lp (- n 1) (cons (reader str off) res)))))
(define (dns-parse str)
(let* ((off (list 0))
(id (read-uint16/be str off))
(tmp1 (read-uint8 str off))
(tmp2 (read-uint8 str off))
(num-questions (read-uint16/be str off))
(num-answers (read-uint16/be str off))
(num-name-servers (read-uint16/be str off))
(num-additional (read-uint16/be str off))
(questions (read-n read-question num-questions str off))
(answers (read-n read-resource num-answers str off))
(name-servers (read-n read-resource num-name-servers str off))
(additional (read-n read-resource num-additional str off)))
(list id tmp1 tmp2 questions answers name-servers additional)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; high-level interface
;; XXXX Unix specific
(define (dns-read-resolv-conf)
(call-with-input-file "/etc/resolv.conf"
(lambda (in)
(let lp ((res '()))
(let ((line (read-line in)))
(if (eof-object? line)
(reverse res)
(let ((ls (string-split line)))
(if (string=? (car ls) "nameserver")
(lp (cons (cadr ls) res))
(lp res)))))))))
(define dns-default-name-servers
(let ((name-servers #f))
(lambda ()
(or name-servers
(let ((ns (dns-read-resolv-conf)))
(set! name-servers ns)
ns)))))
(define (call-with-dns-socket host port proc . o)
(let ((s (or (and (pair? o) (car o)) (udp-open-socket))))
(udp-bind! s #f 0)
(udp-connect! s host port)
(let ((res (proc s)))
(if (not (and (pair? o) (car o))) (udp-close-socket s))
res)))
(define (dns-query-all msg . o)
(let query ((ns-ls (if (pair? o) (list (car o)) (dns-default-name-servers))))
(and (pair? ns-ls)
(condition-case
(call-with-dns-socket (car ns-ls) 53
(lambda (s)
(udp-send s msg)
(receive (len str) (udp-recv s 1024) str)))
(exn () (query (cdr ns-ls)))))))
(define (dns-run msg o)
(dns-parse (apply dns-query-all msg o)))
(define (dns-lookup/full name . o)
(dns-run (dns-build-query dns/QUERY (list (list name dns/A dns/IN))) o))
(define (dns-text/full name . o)
(dns-run (dns-build-query dns/QUERY (list (list name dns/TXT dns/IN))) o))
(define (dns-mx/full name . o)
(dns-run (dns-build-query dns/QUERY (list (list name dns/MX dns/IN))) o))
(define (dns-get-answer x)
(and (list? x)
(>= (length x) 5)
(let ((ans-ls (list-ref x 4)))
(and (pair? ans-ls)
(list-ref (car ans-ls) 4)))))
(define (dns-lookup name . o)
(dns-get-answer (apply dns-lookup/full name o)))
(define (dns-text name . o)
(dns-get-answer (apply dns-text/full name o)))
(define (dns-mx name . o)
(dns-get-answer (apply dns-mx/full name o)))
)
| false |
b2d198cfe8846029ba5345e5d6c6499e40b6fe2d
|
074658682ac27f14d7c1ebf78bf070662012f698
|
/highorder.scm
|
b920b0f5d076fe2d556ae006ba07d40a347e1aed
|
[
"MIT"
] |
permissive
|
triffon/fp-2016-17
|
dc27b266c891b6d1f81d27e0ab51e727d5fbafbe
|
553112c19f22169f867b5d3159ccd45f88d60ac5
|
refs/heads/master
| 2021-01-11T05:29:18.297824 | 2017-01-19T09:05:00 | 2017-01-23T22:27:35 | 71,508,093 | 2 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 2,751 |
scm
|
highorder.scm
|
(define (accumulate op nv a b term next)
(if (> a b) nv
(op (term a) (accumulate op nv (next a) b term next))))
(define (1+ x) (+ x 1))
(define (id x) x)
(define (p n x)
(define (term i) (* (- (1+ n) i) (expt x i)))
(accumulate + 0 0 n term 1+))
(define (p2 n x)
(define (op a b) (+ (* a x) b))
(accumulate op 0 1 (1+ n) id 1+))
(define (p3 n x)
(define (op a b) (+ (* b x) a))
(accumulate op 0 1 (1+ n) id 1+))
(define (p4 n x)
(define (op a b) (+ (* b x) a))
(define (term i) (- (1+ n) i))
(accumulate op 0 1 (1+ n) term 1+))
(define (sum a b)
(if (> a b) 0
(+ a (sum (1+ a) b))))
(define (sum-i a b)
(define (iter i r)
(if (> i b) r
(iter (1+ i) (+ r i))))
(iter a 0))
(define (accumulate-i op nv a b term next)
(if (> a b) nv
(accumulate-i op (op nv (term a)) (next a) b term next)))
(define (p5 n x)
(define (op a b) (+ (* a x) b))
(accumulate-i op 0 0 (1+ n) id 1+))
(define (fact n)
(accumulate * 1 1 n id 1+))
(define (pow x n)
(accumulate * 1 1 n (lambda (i) x) 1+))
(define (expt1 x n)
(accumulate + 0 0 n
(lambda (i)
(/
(accumulate * 1 1 i (lambda (j) x) 1+)
(accumulate * 1 1 i id 1+)))
1+))
(define (exists? p a b)
(accumulate (lambda (x y) (or x y)) #f a b p 1+))
(define (prime n)
(not (exists? (lambda (d) (= (remainder n d) 0)) 2 (- n 1))))
(define (twice f)
(lambda (x) (f (f x))))
(define (square x) (* x x))
(define mystery ((twice twice) square))
; (mystery 2)
(define (derive f dx)
(lambda (x) (/ (- (f (+ x dx)) (f x)) dx)))
(define (compose f g)
(lambda (x) (f (g x))))
(define (repeated n f)
(if (= n 0) id
(lambda (x) (f ((repeated (- n 1) f) x)))))
(define (repeated n f)
(if (= n 0) id
(compose f (repeated (- n 1) f))))
(define (repeated n f)
(accumulate compose id 1 n (lambda (i) f) 1+))
(define (pow x n)
(accumulate * 1 1 n (lambda (i) x) 1+))
(define (derive-n f n dx)
(if (= n 0) f
(derive (derive-n f (- n 1) dx) dx)))
(define (derive-n f n dx)
((repeated n (lambda (g) (derive g dx))) f))
(define (derive-n-op n dx)
(accumulate compose id 1 n
(lambda (i)
(lambda (g) (derive g dx)))
1+))
(define my-#t (lambda (x y) x))
(define my-#f (lambda (x y) y))
(define (my-if b x y) (b x y))
(define Y (lambda (f)
((lambda (x) (f (lambda (n) ((x x) n))))
(lambda (x) (f (lambda (n) ((x x) n)))))))
(define fact-body (lambda (f)
(lambda (n) (if (= n 0) 1
(* n (f (- n 1)))))))
(define fact (Y fact-body))
(define pow2-body (lambda (f)
(lambda (n)
(if (= n 0) 1
(* 2 (f (- n 1)))))))
| false |
97f2c4f2116efd58e5d6b7ddeccc96ec063da4d6
|
0b0b7987be5b118121b0d991bdcf8d573a3273c1
|
/ESSLLI2006/code/trigraph.scm
|
7f1bc3f17ded0719321486785b205c9172af1652
|
[
"Apache-2.0"
] |
permissive
|
dcavar/dcavar.github.io
|
d0a85ca7025b8e0fa190e0a9f0966ab115f3dbbb
|
af1a2ceefc5e46559a7e74f96230bf4dccf24344
|
refs/heads/master
| 2023-08-30T10:05:20.825342 | 2023-08-17T19:07:43 | 2023-08-17T19:07:43 | 87,249,109 | 4 | 1 |
Apache-2.0
| 2021-09-28T00:18:17 | 2017-04-05T00:44:19 |
HTML
|
UTF-8
|
Scheme
| false | false | 3,143 |
scm
|
trigraph.scm
|
":"; exec mzscheme -r $0 "$@"
;;; ----------------------------------------------------
;;; Filename: trigraph.ss
;;; Author: Damir Cavar <[email protected]>
;;;
;;; (C) 2006 by Damir Cavar
;;;
;;; This code is published under the restrictive GPL!
;;; Please find the text of the GPL here:
;;; http://www.gnu.org/licenses/gpl.txt
;;;
;;; It is free for use, change, etc. as long as the copyright
;;; note above is included in any modified version of the code.
;;;
;;; This script assumes that the text is raw and encoded in UTF8.
;;;
;;; Functions:
;;; 1. The text file is loaded into memory.
;;; 2. Trigrams of characters are created from the corpus.
;;; 3. The absolute counts are relativized.
;;; 4. The hash-table is dumped (serialized) to stdout.
;;;
;;; If the command line parameters contain more than one text file,
;;; the above results are accumulated over all the input text files.
;;;
;;; Usage:
;;; mzscheme -r trigraph.ss test1.txt test2.txt ... > language.ss
;;; ----------------------------------------------------
;;; all required libraries and functions
(require (lib "vector-lib.ss" "srfi" "43")) ; for vector-for-each
(require (lib "list.ss")) ; for sort
(require (lib "serialize.ss")) ; for serialize
;;; Global variables
(define trigramcount 0.0) ; counter of total number tokens
(define trigrams (make-hash-table 'equal)) ; hash-table for tokens and counts
;;; add-trigrams
;;; <- list of characters, i.e. string
;;; !-> updated hash-table trigrams
;;; !-> updated trigramcount counter
;;; ----------------------------------------------------
;;; Add words/tokens from an ordered list of tokens to the hash-table
;;; container and keep track of their count.
(define add-trigrams
(lambda (text)
(let ([max (- (string-length text) 2)])
(set! trigramcount (+ trigramcount max)) ; increment the total number of tokens
(let loop ([i 0])
(let* ([token (substring text i (+ i 3))]
[value (hash-table-get trigrams token 0.0)])
(hash-table-put! trigrams token (+ value 1.0)))
(if (< i (- max 1))
(loop (+ i 1)))))))
;;; load-file
;;; <- string filename
;;; -> string file content
;;; ----------------------------------------------------
;;; Load text from file into a string variable and return it.
(define load-file
(lambda (name)
(call-with-input-file name
(lambda (p)
(read-string (file-size name) p)))))
;;; relativize
;;; <- hash-table with keys and their absolute count
;;; <- total number of tokens
;;; ----------------------------------------------------
;;; side effect: overwrites the value with the relativized count.
(define relativize
(lambda (table total)
(hash-table-for-each table (lambda (key value)
(hash-table-put! table key (/ value total))))))
;;; ----------------------------------------------------
;;; main steps
(begin
(vector-for-each (lambda (i fname)
(add-trigrams (load-file fname)))
argv)
(relativize trigrams trigramcount)
(write (serialize trigrams)))
| false |
dad991336aad3f078f3d45cfe50f83bbacdafca8
|
b4e3e2194fcb5722ff6b0022831348ef5d36daeb
|
/call-cc.scm
|
f9300d682e23d28ce2890faee9c14264569c62af
|
[] |
no_license
|
nyaago/my-scheme-learning
|
3adf46cf99c8579d05f483851e30732912b2faa2
|
e1ccca44f577ba26a3a85532ba171ad7a4669425
|
refs/heads/master
| 2021-01-10T05:47:09.311306 | 2015-06-05T15:42:59 | 2015-06-05T15:42:59 | 36,940,789 | 0 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 472 |
scm
|
call-cc.scm
|
((lambda (x) (x (+ 3 5))) (lambda (k) (* 7 k)))
(* 7 (call/cc (lambda (x) (x (+ 3 5)))))
(define opp/cc #f)
(* 7 (call/cc (lambda (x) (set! opp/cc x) (x (+ 3 5)))))
(* 3 5 (call/cc (lambda (x) (set! opp/cc x) (x 7))))
(* 3 (call/cc (lambda (x) (set! opp/cc x) (x 7))) 7)
(define product
(lambda (lst)
(call/cc
(lambda (k)
(cond ((null? lst) 1)
((= (car lst) 0) (k 0))
(else (* (car lst) (product (cdr lst)))))))))
| false |
d5652154ab7fc9a1b7bc036dd38c91c2b106a46d
|
7054455f2fcbf47a2c58627305a7ce26eabb3297
|
/reser-module.scm
|
b6219345f5877d15bc0c15e4aa1ed0db522a50f2
|
[] |
no_license
|
Adellica/reser
|
c5908acf3b4e5b74e2db457e0fa5367edeec4a1c
|
6781bfe2ca9c7738274eb38a1fd52604e214e6ad
|
refs/heads/master
| 2016-09-05T23:13:05.792616 | 2016-01-30T14:30:14 | 2016-01-30T14:30:14 | 33,715,868 | 7 | 1 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 71 |
scm
|
reser-module.scm
|
(module reser *
(import chicken scheme extras)
(include "reser.scm")
)
| false |
7812d04fa72d3cf59fa8e59f44d7d23269897aca
|
1b771524ff0a6fb71a8f1af8c7555e528a004b5e
|
/chapter3.scm
|
7bdf653c3ef61306ab2ebf2cb548a5d5e0a8d0ba
|
[] |
no_license
|
yujiorama/sicp
|
6872f3e7ec4cf18ae62bb41f169dae50a2550972
|
d106005648b2710469067def5fefd44dae53ad58
|
refs/heads/master
| 2020-05-31T00:36:06.294314 | 2011-05-04T14:35:52 | 2011-05-04T14:35:52 | 315,072 | 0 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 5,540 |
scm
|
chapter3.scm
|
(load "./prime.scm")
(load "./stream.scm")
(define (stream-enumerate-interval low high)
(if (> low high)
the-empty-stream
(cons-stream
low
(stream-enumerate-interval (+ low 1) high))))
(define (stream-filter pred s)
(cond ((stream-null? s) the-empty-stream)
((pred (stream-car s))
(cons-stream (stream-car s)
(stream-filter pred
(stream-cdr s))))
(else (stream-filter pred (stream-cdr s)))))
(define (memo-proc proc)
(let ((already-run? #f) (result #f))
(lambda ()
(if (not already-run?)
(begin (set! result (proc))
(ste! already-run? #t)
result)
result))))
(define (integers-starting-from n)
(cons-stream n (integers-starting-from (+ n 1))))
(define integers (integers-starting-from 1))
(define ones (cons-stream 1 ones))
(define (sieve s)
(cons-stream
(stream-car s)
(sieve (stream-filter
(lambda (x) (not (divisivle? x (stream-car s))))
(stream-cdr s)))))
(define prime (sieve (integers-starting-from 2)))
(define (add-stream s1 s2)
(define (stream-map proc . argstreams)
(if (stream-null? (car argstreams))
the-empty-stream
(cons-stream
(apply proc (map stream-car argstreams))
(apply stream-map
(cons proc (map stream-cdr argstreams))))))
(stream-map + s1 s2))
(define (scale-stream s factor)
(stream-map (lambda (x) (* x factor)) s))
(define (merge s1 s2)
(cond ((stream-null? s1) s2)
((stream-null? s1) s1)
(else
(let ((s1car (stream-car s1))
(s2car (stream-car s2)))
(cond ((< s1car s2car)
(cons-stream s1car (merge (stream-cdr s1) s2)))
((> s1car s2car)
(cons-stream s2car (merge s1 (stream-cdr s2))))
(else
(cons-stream s1car
(merge (stream-cdr s1)
(stream-cdr s2)))))))))
(define (expand num den radix)
(cons-stream
(quotient (* num radix) den)
(expand (remainder (* num radix) den) den radix)))
(define (sqrt-improve guess x)
(define (average a b)
(/ (+ a b) 2))
(average guess (/ x guess)))
(define (sqrt-stream x)
(define guesses
(cons-stream 1.0
(stream-map (lambda (guess)
(sqrt-improve guess x))
guesses)))
guesses)
;; (load "./ex355.scm")
(define (partial-sums s)
(cons-stream
(stream-car s)
(add-stream (stream-cdr s) (partial-sums s))))
(define (pi-summands n)
(cons-stream (/ 1.0 n)
(stream-map - (pi-summands (+ n 2)))))
(define pi-stream
(scale-stream (partial-sums (pi-summands 1)) 4))
(define (euler-transform s)
(let ((s0 (stream-ref s 0))
(s1 (stream-ref s 1))
(s2 (stream-ref s 2)))
(cons-stream (- s2 (/ (square (- s2 s1))
(+ s0 (* -2 s1) s2)))
(euler-transform (stream-cdr s)))))
(define (make-tableau transform s)
(cons-stream s
(make-tableau transform
(transform s))))
(define (accelerated-sequence transform s)
(stream-map stream-car
(make-tableau transform s)))
(define (interleave s1 s2)
(if (stream-null? s1)
s2
(cons-stream (stream-car s1)
(interleave s2 (stream-cdr s1)))))
(define (pairs s t)
(cons-stream
(list (stream-car s) (stream-car t))
(interleave
(stream-map (lambda (x) (list (stream-car s) x))
(stream-cdr t))
(pairs (stream-cdr s) (stream-cdr t)))))
(define (seq from step to)
(if (< from to)
(cons from (seq (+ from step) step to))
to))
;; pp.203 より信号としてのストリーム
(define (integral integrand initial-value dt)
(define int
(cons-stream initial-value
(add-stream (scale-stream integrand dt)
int)))
int)
;; pp.205 より積分器のはなし
;; この定義は動かない
;; y が評価されるとき dy が評価されるが、dy の定義より前に定義されてるのでコンパイルできない
;; (define (solve f y0 dt)
;; (define y (integral dy y0 dt))
;; (define dy (stream-map f y))
;; y)
;; 3.5.5
;; (define rand
;; (let ((x random-init))
;; (lambda ()
;; (set! x (rand-update x))
;; x)))
(use srfi-27)
(define *randome-seed* (sys-time))
(define random-init
*randome-seed*)
(define (rand-update x)
(remainder (+ (* 3041 x) 7121) 11287))
(define random-numbers
(cons-stream random-init
(stream-map rand-update random-numbers)))
(define (map-successive-pairs proc s)
(cons-stream
(proc (stream-car s) (stream-car (stream-cdr s)))
(map-successive-pairs proc (stream-cdr (stream-cdr s)))))
(define cesaro-stream
(map-successive-pairs (lambda (r1 r2) (= (gcd r1 r2) 1))
random-numbers))
(define (monte-carlo experiment-stream passed failed)
(define (next passed failed)
(cons-stream
(/ passed (+ passed failed))
(monte-carlo
(stream-cdr experiment-stream) passed failed)))
(if (stream-car experiment-stream)
(next (+ passed 1) failed)
(next passed (+ 1 failed))))
(define pi
(stream-map (lambda (p) (sqrt (/ 6 p)))
(monte-carlo cesaro-stream 0 0)))
(define (integers-from n)
(cons-stream n (integers-starting-from (+ n 1))))
| false |
b4e9a30a31a2796f083603ad586694afa6aa0414
|
174072a16ff2cb2cd60a91153376eec6fe98e9d2
|
/Chap-two/cntleaves.scm
|
18b5ab2c4ad57f5e266af626bab83399e7a7a990
|
[] |
no_license
|
Wang-Yann/sicp
|
0026d506ec192ac240c94a871e28ace7570b5196
|
245e48fc3ac7bfc00e586f4e928dd0d0c6c982ed
|
refs/heads/master
| 2021-01-01T03:50:36.708313 | 2016-10-11T10:46:37 | 2016-10-11T10:46:37 | 57,060,897 | 1 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 140 |
scm
|
cntleaves.scm
|
(define (count-leaves lst)
(cond ( (null? lst) 0)
((not (pair? lst)) 1)
(else (+ (count-leaves (car lst)) (count-leaves (cdr lst)))))
| false |
894b333800944a8e576f24e95af351b98619412c
|
d7a69a0e464473bf2699b8370682080c18c6ff93
|
/test/lib-a-b-c.sld
|
7a21f5336b423864bed8c324c838ca7ce6a98dd4
|
[
"MIT"
] |
permissive
|
leftmike/foment
|
08ecd44cd5327f00d0fc32d197e0903dd3d2f123
|
6089c3c9e762875f619ef382d27943819bbe002b
|
refs/heads/master
| 2022-09-19T00:53:49.568819 | 2022-09-07T04:46:36 | 2022-09-07T04:46:36 | 52,575,413 | 72 | 9 |
MIT
| 2022-08-28T15:33:02 | 2016-02-26T03:21:58 |
C++
|
UTF-8
|
Scheme
| false | false | 122 |
sld
|
lib-a-b-c.sld
|
(define-library (lib a b c)
(import (scheme base))
(export lib-a-b-c)
(begin
(define lib-a-b-c 100)))
| false |
054b687592fec0468df614f5ddb302d096263cd7
|
309e1d67d6ad76d213811bf1c99b5f82fa2f4ee2
|
/A03.ss
|
713fbed9149b3120bd4ccb12e92ae08b17367de9
|
[] |
no_license
|
lix4/CSSE304-Programming-Language-Concept-Code
|
d8c14c18a1baa61ab5d3df0b1ac650bdebc59526
|
dd94262865d880a357e85f6def697661e11c8e7a
|
refs/heads/master
| 2020-08-06T02:50:53.307301 | 2016-11-12T03:03:56 | 2016-11-12T03:03:56 | 73,528,000 | 1 | 1 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 917 |
ss
|
A03.ss
|
;;Xiwen Li
;;Assignment 03
;;1
(define nearest-point
(lambda (pt ls)
(nearest-point-rec pt ls (car ls))))
(define nearest-point-rec
(lambda (pt ls nearest)
(cond [(null? ls) nearest]
[(< (3D-distance pt (car ls)) (3D-distance pt nearest)) (nearest-point-rec pt (cdr ls) (car ls))]
[else (nearest-point-rec pt (cdr ls) nearest)])))
(define 3D-distance
(lambda (p1 p2)
(sqrt (+ (square (- (car p1) (car p2)))
(square (- (cadr p1) (cadr p2)))
(square (- (caddr p1) (caddr p2)))))))
(define square
(lambda (n)
(* n n)))
;;2
(define union
(lambda (set1 set2)
(cond [(null? set2) '()]
[(member? (car set2) set1) (union set1 (cdr set2))]
[else (cons set1 (union ))]
(define member?
(lambda (target ls)
(cond [(null? ls) #f]
[(equal? (car ls) target) #t]
[else (member? target (cdr ls))])))
;;3
(define intersection
(lambda (intersection1 intersection2)
| false |
46308032ef926d3d0483cb784b856816478a85fb
|
b0c1935baa1e3a0b29d1ff52a4676cda482d790e
|
/tests/t-srfi-1.scm
|
82608c5498a796e5216d85777a0543cca5f7e632
|
[
"MIT"
] |
permissive
|
justinethier/husk-scheme
|
35ceb8f763a10fbf986340cb9b641cfb7c110509
|
1bf5880b2686731e0870e82eb60529a8dadfead1
|
refs/heads/master
| 2023-08-23T14:45:42.338605 | 2023-05-17T00:30:56 | 2023-05-17T00:30:56 | 687,620 | 239 | 28 |
MIT
| 2023-05-17T00:30:07 | 2010-05-26T17:02:56 |
Haskell
|
UTF-8
|
Scheme
| false | false | 8,784 |
scm
|
t-srfi-1.scm
|
;;
;; husk-scheme
;; http://github.com/justinethier/husk-scheme
;;
;; Written by Justin Ethier
;;
;; Test cases for SRFI-1
;;
(unit-test-start "SRFI 1: List Library")
(require-extension (srfi 1))
; Notes:
;
; Circular lists are not supported, and probably will not
; be until (if?) the memory model is fixed to be more than
; just strings as vars.
;
; Linear update functions are not supported for same reason:
; take!, drop-right!, split-at!
; append! concatenate! reverse! append-reverse!
; filter! partition! remove!
; take-while! span! break!
; delete! delete-duplicates!
; alist-delete!
; lset-union!
; lset-intersection!
; lset-difference!
; lset-xor!
; lset-diff+intersection!
; map! append-map!
; Constructors
(assert/equal (cons* 1 2 3 4) '(1 2 3 . 4))
(assert/equal (cons* 1) 1)
(assert/equal (make-list 4 'c) '(c c c c))
(assert/equal (list-tabulate 4 values) '(0 1 2 3))
(assert/equal (list-copy (list 1 2 3 4.4 "5")) (list 1 2 3 4.4 "5"))
(assert/equal (iota 5) '(0 1 2 3 4))
(assert/equal (iota 5 0 -0.5) '(0.0 -0.5 -1.0 -1.5 -2.0))
; Predicates
(assert/equal (proper-list? (list)) #t)
(assert/equal (proper-list? '(1 . 2)) #f)
(assert/equal (circular-list? (list)) #f)
(assert/equal (dotted-list? (list)) #f)
(assert/equal (dotted-list? '(1 . 2)) #t)
(assert/equal (null-list? '()) #t)
(assert/equal (not-pair? '(1 . 2)) #f)
(assert/equal (list= eq?) #t) ; Trivial cases
(assert/equal (list= eq? '(a)) #t)
; Selectors
(assert/equal (car+cdr '(a b c d)) 'a)
(assert/equal (first '(a b c d)) 'a)
(assert/equal (take '(a b c d e) 2) '(a b))
(assert/equal (drop '(a b c d e) 2) '(c d e))
(assert/equal (take '(1 2 3 . d) 2) '(1 2))
(assert/equal (drop '(1 2 3 . d) 2) '(3 . d))
(assert/equal (take '(1 2 3 . d) 3) '(1 2 3))
(assert/equal (drop '(1 2 3 . d) 3) 'd)
;For a legal i, take and drop partition the list in a manner which can be inverted with append:
(assert/equal (append (take (list 1 2 3 4 5 6) 3) (drop (list 1 2 3 4 5 6) 3)) (list 1 2 3 4 5 6))
(assert/equal (take-right '(a b c d e) 2) '(d e))
(assert/equal (drop-right '(a b c d e) 2) '(a b c))
(assert/equal (take-right '(1 2 3 . d) 2) '(2 3 . d))
(assert/equal (drop-right '(1 2 3 . d) 2) '(1))
(assert/equal (take-right '(1 2 3 . d) 0) 'd)
(assert/equal (drop-right '(1 2 3 . d) 0) '(1 2 3))
;For a legal i, take-right and drop-right partition the list in a manner which can be inverted with append:
(let ((flist (list 1 2 3 4 5 6))
(i 2))
(assert/equal (append (take flist i) (drop flist i)) flist))
(assert/equal (split-at '(a b c d e f g h) 3) '(a b c))
(assert/equal (last '(a b c)) 'c)
(assert/equal (last-pair '(a b c)) '(c))
; Misc
(assert/equal (length+ '(a b c)) 3)
(assert/equal (concatenate '((1) (2) (3) (4) (5))) '(1 2 3 4 5))
(assert/equal (append-reverse '(4 3 2 1) '(5)) '(1 2 3 4 5))
(assert/equal (append-reverse '(4 3 2 1) '(5)) (append (reverse '(4 3 2 1)) '(5)))
(assert/equal (apply + 1 2 3 4 5 '(6)) (+ 1 2 3 4 5 6))
(assert/equal (zip '(one two three)
'(1 2 3)
'(odd even odd even odd even odd even))
'((one 1 odd) (two 2 even) (three 3 odd)))
(assert/equal (zip '(1 2 3)) '((1) (2) (3)))
(assert/equal (unzip2 '((1 one) (2 two) (3 three)))
'(1 2 3))
(assert/equal (count even? '(3 1 4 1 5 9 2 5 6)) 3)
(assert/equal (count < '(1 2 4 8) '(2 4 6 8 10 12 14 16)) 3)
; FUTURE: circular lists are not supported
;
; (assert/equal (zip '(3 1 4 1) (circular-list #f #t))
; '((3 #f) (1 #t) (4 #f) (1 #t)))
; (assert/equal (count < '(3 1 4 1) (circular-list 1 10)) 2)
; (circular-list 'z 'q) => (z q z q z q ...)
; circular-list? with a true result
; Fold / Unfold / Map
(assert/equal (fold + 0 '(1 2 3 4)) (+ 1 2 3 4))
(assert/equal (unfold null-list? car cdr '(a b c)) '(a b c))
(assert/equal (unfold null-list? car cdr '(1)
(lambda (x) '(2 3 4)))
'(1 2 3 4))
(assert/equal (reduce + 0 '(1 2 3 4)) (+ 1 2 3 4))
(assert/equal
(pair-fold-right cons '() '(a b c))
'((a b c) (b c) (c)))
(assert/equal
(unfold-right null-list? car cdr '(9 8 7 6 5 4 3 2 1))
'(1 2 3 4 5 6 7 8 9))
(assert/equal
(reduce-right append '() '((1) (2) (3)))
'(1 2 3))
(assert/equal
(fold-right cons '() '(a b c))
'(a b c)) ;; Copy LIS.
(assert/equal
(fold-right (lambda (x l) (if (even? x) (cons x l) l)) '() '(1 2 3 4))
'(2 4)) ;; Filter the even numbers out of LIS.
(assert/equal
(fold-right cons* '() '(a b c) '(1 2 3 4 5))
'(a 1 b 2 c 3))
(assert/equal
(append-map (lambda (x) (list x (- x))) '(1 3 8))
'(1 -1 3 -3 8 -8))
(assert/equal
(filter-map (lambda (x) (and (number? x) (* x x))) '(a 1 b 3 c 7))
'(1 9 49))
(assert/equal
(map-in-order cadr '((a b) (d e) (g h)))
'(b e h))
(assert/equal
(map-in-order (lambda (n) (inexact->exact (expt n n)))
'(1 2 3 4 5))
'(1 4 27 256 3125))
(assert/equal
(map-in-order + '(1 2 3) '(4 5 6))
'(5 7 9))
(assert/equal
(let ((count 0))
(map (lambda (ignored)
(set! count (+ count 1))
count)
'(a b)))
'(1 2))
(let ((tmp '()))
(pair-for-each (lambda (pair) (set! tmp (append tmp pair))) '(a b c))
(assert/equal tmp '(a b c b c c)))
(assert/equal
(pair-fold (lambda (pair tail) (set-cdr! pair tail) pair) '() '(1 2 3))
'(3 2 1))
; Filtering and partitioning
(assert/equal (filter even? '(1 2 3 4))
'(2 4))
(assert/equal (filter even? '(0 7 8 8 43 -4)) '(0 8 8 -4))
(assert/equal (partition symbol? '(one 2 3 four five 6))
'(one four five))
(assert/equal (remove even? '(0 7 8 8 43 -4)) '(7 43))
; Searching
;; Proper list -- success
(assert/equal (find even? '(1 2 3)) 2)
(assert/equal (find even? '(1 2 3 4)) 2)
(assert/equal (find even? '(3 1 4 1 5 9)) 4)
(assert/equal (any even? '(1 2 3)) #t)
;; proper list -- failure
(assert/equal (find even? '(1 7 3)) #f)
(assert/equal (any even? '(1 7 3)) #f)
(assert/equal (find-tail even? '(3 1 37 -8 -5 0 0)) '(-8 -5 0 0))
(assert/equal (find-tail even? '(3 1 37 -5)) #f)
(assert/equal (every even? (list 2 4)) #t)
(assert/equal (every even? (list 2 5)) #f)
(assert/equal (list-index even? '(3 1 4 1 5 9)) 2)
(assert/equal (list-index < '(3 1 4 1 5 9 2 5 6) '(2 7 1 8 2)) 1)
(assert/equal (list-index = '(3 1 4 1 5 9 2 5 6) '(2 7 1 8 2)) #f)
(assert/equal (take-while even? '(2 18 3 10 22 9)) '(2 18))
(assert/equal (drop-while even? '(2 18 3 10 22 9)) '(3 10 22 9))
(assert/equal (span even? '(2 18 3 10 22 9)) '(2 18))
(assert/equal (break even? '(3 1 4 1 5 9)) '(3 1))
; Deleting
(assert/equal (delete 1 (list 1 2 1 3 'a)) '(2 3 a))
(assert/equal (delete-duplicates '(a b a c a b c z)) '(a b c z))
(assert/equal (delete-duplicates '((a . 3) (b . 7) (a . 9) (c . 1))
(lambda (x y) (eq? (car x) (car y))))
'((a . 3) (b . 7) (c . 1)))
; Association lists
(define e '((a 1) (b 2) (c 3)))
(assert/equal (assq 'a e) '(a 1))
(assert/equal (assq 'b e) '(b 2))
(assert/equal (assq 'd e) '#f)
(assert/equal (assq (list 'd) '(((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))
(assert/equal (alist-cons 'a 0 (list '(1 . 2) '(3 4))) '((a . 0) (1 . 2) (3 4)))
(assert/equal (alist-copy (list '(1 2) '(3 4))) '((1 2) (3 4)))
(assert/equal (alist-delete 1 '((1 . 2))) '())
; Set operations on lists
(assert/equal #t (lset<= eq? '(a) '(a b a) '(a b c c)))
(assert/equal #t (lset<= eq?))
(assert/equal #t (lset<= eq? '(a)))
(assert/equal (lset= eq? '(b e a) '(a e b) '(e e b a)) #t)
(assert/equal (lset= eq?) #t)
(assert/equal (lset= eq? '(a)) #t)
(assert/equal (lset-adjoin eq? '(a b c d c e) 'a 'e 'i 'o 'u) '(u o i a b c d c e))
(assert/equal (lset-union eq? '(a b c d e) '(a e i o u)) '(u o i a b c d e))
;; Repeated elements in LIST1 are preserved.
(assert/equal (lset-union eq? '(a a c) '(x a x)) '(x a a c))
;; Trivial cases
(assert/equal (lset-union eq?) '())
(assert/equal (lset-union eq? '(a b c)) '(a b c))
(assert/equal (lset-intersection eq? '(a b c d e) '(a e i o u)) '(a e))
;; Repeated elements in LIST1 are preserved.
(assert/equal (lset-intersection eq? '(a x y a) '(x a x z)) '(a x a))
(assert/equal (lset-intersection eq? '(a b c)) '(a b c)) ; Trivial case
(assert/equal (lset-difference eq? '(a b c d e) '(a e i o u)) '(b c d))
(assert/equal (lset-difference eq? '(a b c)) '(a b c)) ; Trivial case
(assert/equal (lset-xor eq? '(a b c d e) '(a e i o u)) (reverse '(d c b i o u)))
(assert/equal (lset-xor eq?) '())
(assert/equal (lset-xor eq? '(a b c d e)) '(a b c d e))
(unit-test-handler-results)
| false |
4f5a7dc6985d5109a8fb429b70a01c6bf2345caa
|
3686e1a62c9668df4282e769220e2bb72e3f9902
|
/ch1.1.7.scm
|
2112b2b4ce091452039824901c53f0d26a9f8920
|
[] |
no_license
|
rasuldev/sicp
|
a4e4a79354495639ddfaa04ece3ddf42749276b5
|
71fe0554ea91994822db00521224b7e265235ff3
|
refs/heads/master
| 2020-05-21T17:43:00.967221 | 2017-05-02T20:32:06 | 2017-05-02T20:32:06 | 65,855,266 | 0 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 604 |
scm
|
ch1.1.7.scm
|
(define (average x y)
(/ (+ x y) 2 ))
(define (improve guess x)
(average guess (/ x guess)))
(define (square x) (* x x))
(define (good-enough? guess x)
(< (abs (- (square guess) x)) 0.001))
(define (sqrt-iter guess x)
(if (good-enough? guess x)
guess
(sqrt-iter (improve guess x)
x)))
(define (sqrt-iter-i guess x)
(let ((newguess (improve guess x)))
(if (< (abs (- 1 (/ newguess guess))) 0.001)
newguess
(sqrt-iter-i newguess x)
)
)
)
(define (sqrt x)
(sqrt-iter 1.0 x))
(define (sqrt-i x)
(sqrt-iter-i 1.0 x))
;(trace good-enough?)
;(sqrt 2)
| false |
a4b365e939d8e9c04a89a466236459a45fbde917
|
d47ddad953f999e29ce8ef02b059f945c76a791e
|
/lab2-and-3/homework3/exponential-to-n.scm
|
3a1d88535c38b38b4cd5675e3c626163c3e4c105
|
[] |
no_license
|
IvanIvanov/fp2013
|
7f1587ef1f2261f8cd0cd3dd99ec147c4043a2ae
|
2ac1bb1102cb65e0ecbfa8d2fb3ca69953ae4ecf
|
refs/heads/master
| 2016-09-11T10:08:59.873239 | 2014-01-23T20:38:27 | 2014-01-23T20:40:34 | 13,211,029 | 5 | 2 | null | 2014-01-10T15:55:14 | 2013-09-30T09:18:33 |
Scheme
|
UTF-8
|
Scheme
| false | false | 1,023 |
scm
|
exponential-to-n.scm
|
(define (TRUTH x) #t)
(define (identity x) x)
; тук term_function е функция на два аргумента
; x и n
; също така, aggregate Приема x стойност, за която да сметне директно
(define (aggregate oper N term_function pred? start_value x-value)
(define (calculate-result result N x-value oper term_function)
(oper (term_function x-value N) result))
(define (aggregate-iter oper N term_function pred? x-value result)
(cond
( (= N 0) result )
( (not (pred? N)) (aggregate-iter oper (- N 1) term_function pred? x-value result) )
(else (aggregate-iter oper (- N 1) term_function pred? x-value (calculate-result result N x-value oper term_function)))))
(aggregate-iter oper N term_function pred? x-value start_value)
)
(define (exponential-to-n x n)
(define (fact n)
(aggregate * n (lambda (x n) n) TRUTH 1 1))
(define (e-to-x-term x n)
(/ (expt x n) (fact n)))
(+ 1 (aggregate + n e-to-x-term TRUTH 0 x)))
| false |
b5015244fbdf80699758d9c329de4347b39f2c8e
|
defeada37d39bca09ef76f66f38683754c0a6aa0
|
/System.Data/system/data/db-command-info.sls
|
8bdc1ef73b07e3434e5541d9ba7d7639b52a9cb6
|
[] |
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 | 842 |
sls
|
db-command-info.sls
|
(library (system data db-command-info)
(export new
is?
db-command-info?
command-get
command-set!
command-update!
methods-get
methods-set!
methods-update!)
(import (ironscheme-clr-port))
(define-syntax new
(lambda (e)
(syntax-case e ()
((_ a ...) #'(clr-new System.Data.DbCommandInfo a ...)))))
(define (is? a) (clr-is System.Data.DbCommandInfo a))
(define (db-command-info? a) (clr-is System.Data.DbCommandInfo a))
(define-field-port
command-get
command-set!
command-update!
()
System.Data.DbCommandInfo
Command
System.Data.Common.DbCommand)
(define-field-port
methods-get
methods-set!
methods-update!
()
System.Data.DbCommandInfo
Methods
System.Data.DbSourceMethodInfo[]))
| true |
84084f3ecf554003d174e83c5b945ec6a28e4e5a
|
f0747cba9d52d5e82772fd5a1caefbc074237e77
|
/nproc.sld
|
9a66634ae28e935ec5609a9079c33b0cc6186571
|
[] |
no_license
|
philhofer/distill
|
a3b024de260dca13d90e23ecbab4a8781fa47340
|
152cb447cf9eef3cabe18ccf7645eb597414f484
|
refs/heads/master
| 2023-08-27T21:44:28.214377 | 2023-04-20T03:20:55 | 2023-04-20T03:20:55 | 267,761,972 | 3 | 0 | null | 2021-10-13T19:06:55 | 2020-05-29T04:06:55 |
Scheme
|
UTF-8
|
Scheme
| false | false | 223 |
sld
|
nproc.sld
|
(define-library (distill nproc)
(export
nproc)
(import
scheme)
(cond-expand
(chicken (import
(only (chicken base) include error)
(chicken foreign))))
(include "nproc.scm"))
| false |
ed9d66fa2400da0fb494d9f8f10bf35676c87c53
|
9c105d2dcc2d17d61f24a9ce4b510fed696f3a65
|
/s03-to-c/rdtest.scm
|
22dd72e2a8319886cb908d47fac8093cc921294b
|
[] |
no_license
|
marcus3santos/wasCm
|
23e0dca9fabe14df47d0875f7a6c66b8c3f37223
|
594b541c47cf061d2f31ea1c6582eea6b0039d3a
|
refs/heads/master
| 2022-09-29T04:48:58.018517 | 2020-05-27T01:07:31 | 2020-05-27T01:07:31 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 1,983 |
scm
|
rdtest.scm
|
(define (defprim-error procedure msg info)
(cond
[ (equal? this-scheme 'bigloo)
(error procedure (format msg (car info)) "in Bigloo")]
[ (equal? this-scheme 'racket)
(error 'misc-error "~a -- ~a"
procedure (format msg (car info)) )]
[ (equal? this-scheme 'guile)
(error "Error message: " procedure
(format #f msg (format #f "~{~a~}" info)))]
[else (error "Unsuported Scheme!")]))
;; OjO =====================
(define (rdcode file-name)
(call-with-input-file file-name
(lambda(ip)
(let loop [(r (read ip)) (acc '())]
(cond [(eof-object? r) acc]
[else (loop (read ip) (cons r acc))])) )))
(define (insDef fcontents)
(define (isdef? s)
(or (and (pair? s) (equal? (car s) 'define)
(pair? (cdr s)) (pair? (cadr s))
(pair? (cdr (cadr s)))
(not (equal? (cadr (cadr s)) 'env)))
(and (pair? s) (equal? (car s) 'define)
(pair? (cdr s)) (symbol? (cadr s)))))
(define (maybetail? s)
(and (pair? s) (equal? (car s) 'define)
(pair? (cdr s)) (pair? (cadr s))
(pair? (cdr (cadr s))) (equal? (cadr (cadr s)) 'env)))
(define (normalize def)
(cond [(symbol? (cadr def)) (cdr def)]
[else `(,(car (cadr def)) (lambda ,(cdr (cadr def))
,@(cddr def)))]))
(let* [ (lrec (car fcontents))
(lrec (cond [ (not (pair? lrec))
`(letrec [()] ,lrec)]
[(not (equal? (car lrec) 'letrec))
`(letrec [()] ,lrec)]
[else lrec]))
(ldefs (cadr lrec))
(lbody (cddr lrec))
(tail (filter maybetail? (cdr fcontents)))
(defs (map normalize (filter isdef? (cdr fcontents))))
(lrec `(letrec [,@defs ,@ldefs] ,@lbody))
(lrec (if (equal? '(()) (cadr lrec)) (caddr lrec) lrec)) ]
`(,lrec ,@tail) ))
;; End of Ojo ===============
| false |
9dfecffda65af83a8ade38c6cdf6a60d124060ae
|
4478a6db6f759add823da6436842ff0b1bf82aa8
|
/font-texture/text-anim3.scm
|
43efba96026980cd345a015b75e6ef06f1cafab1
|
[] |
no_license
|
gaborpapp/LDS-fluxus
|
2c06508f9191d52f784c2743c4a92e8cadf116ea
|
44d90d9f1e3217b3879c496b2ddd4d34237935d1
|
refs/heads/master
| 2016-09-05T13:29:09.695559 | 2013-04-05T05:33:10 | 2013-04-05T05:33:10 | 7,058,302 | 1 | 1 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 568 |
scm
|
text-anim3.scm
|
(clear)
(define text "Give my try a love")
(translate #(-18 5 -15))
(rotate #(35 0 5))
(define tit (build-type "chunkfive.ttf" text))
(define title (type->poly tit))
(with-primitive title (pdata-copy "p" "p1"))
(with-primitive tit
(scale 0))
(every-frame
(with-primitive title
(pdata-index-map! (lambda (i p p1)
(let [(p2 (vmix p1 p .95))]
(vector
(- (vx p2) (gh (sin (vx p2))))
(vy p2)
(- (vz p2) (gh (vx p2))))))
"p" "p1")))
| false |
79542b5f01a6a36ce9c8fff75c7ef696fb08b6c4
|
eaa28dbef6926d67307a4dc8bae385f78acf70f9
|
/lib/pikkukivi/command/help.sld
|
1d32caebe9642a3804571b3bbe79ee985ac1648a
|
[
"Unlicense"
] |
permissive
|
mytoh/pikkukivi
|
d792a3c20db4738d99d5cee0530401a144027f1f
|
d3d77df71f4267b9629c3fc21a49be77940bf8ad
|
refs/heads/master
| 2016-09-01T18:42:53.979557 | 2015-09-04T08:32:08 | 2015-09-04T08:32:08 | 5,688,224 | 0 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 582 |
sld
|
help.sld
|
(define-library (pikkukivi command help)
(export
help)
(import
(scheme base)
(gauche base)
(gauche process)
(util list) ; slices
(util match)
(file util)
(srfi 1)
(srfi 13)
(maali))
(begin
(define (help args)
(exit 0
(string-append
"usage: panna <command> <package>\n"
"\n"
(desc "commands" "; list available commands\n")
(desc "help " "; display this message\n"))))
(define (desc cmd mes)
(format #false " ~@a ~@a" (paint cmd 5) (paint mes 223)))))
| false |
1a252e73083cca4458232f765bf9702ce23e67c6
|
41f780f7b029ff51bea4a4901130bbd0e177508b
|
/misc/define-record-type.sls
|
1045d07654a32b12190bbc387e7b10434440b5a2
|
[] |
no_license
|
atog/agave
|
9becafd1828763c8f216ad27a318c5c991c8ff86
|
1dd11938e3b5fae30b3db5163bd7564a51908dec
|
refs/heads/master
| 2020-12-25T08:59:26.336223 | 2010-03-25T16:57:55 | 2010-03-25T16:57:55 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 1,168 |
sls
|
define-record-type.sls
|
(library
(agave misc define-record-type)
(export define-record-type++)
(import (rnrs))
(define-syntax define-record-type++
(syntax-rules (fields mutable)
( (define-record-type++
(name constructor predicate cloner assigner applier)
(fields (mutable field accessor mutator changer)
...))
(begin
(define-record-type (name constructor predicate)
(fields (mutable field accessor mutator)
...))
(define (cloner record)
(constructor (accessor record)
...))
(define (assigner a b)
(mutator a (accessor b))
...)
(define applier
(case-lambda ((procedure record)
(procedure (accessor record)
...))
((procedure)
(lambda (record)
(procedure (accessor record)
...)))))
(define (changer record procedure)
(mutator record (procedure (accessor record))))
...
) )))
)
| true |
51f5cf25f42a5bf117e1837e5ce34164b72bcd3f
|
45ae9c8ebcf4d60bfb0652b5c5ee61927d34200f
|
/scheme/list-of.scm
|
ddc0a9fd512a74b5f304affbb35eeeef3780fe54
|
[] |
no_license
|
cohei/playground
|
478717ced20cd2abd80b82aa6e0b8096ffd5a0fc
|
e24bd3cc3d9261094383f109d28280eaca0167f3
|
refs/heads/master
| 2023-06-07T19:24:04.444164 | 2023-05-26T23:36:46 | 2023-05-26T23:36:46 | 146,145,527 | 0 | 0 | null | 2022-03-23T10:54:44 | 2018-08-26T02:36:41 |
Haskell
|
UTF-8
|
Scheme
| false | false | 767 |
scm
|
list-of.scm
|
(define (fold-left f b ls)
(if (null? ls)
b
(fold-left f (f b (car ls)) (cdr ls))))
(define-syntax list-of
(syntax-rules ()
((_ expr ...)
(reverse (list-of-tail '() expr ...)))))
(define-syntax list-of-tail
(syntax-rules ()
((_ base expr)
(cons expr base))
((_ base expr (var in generator) rest ...)
(let* ((f (lambda (z var) (list-of-tail z expr rest ...))))
(fold-left f base generator)))
((_ base expr pred? rest ...)
(if pred?
(_ base expr rest ...)
base))))
(define (qsort lt? ls)
(if (null? ls)
'()
(append
(qsort lt? (list-of x (x in (cdr ls)) (lt? x (car ls))))
(list (car ls))
(qsort lt? (list-of x (x in (cdr ls)) (not (lt? x (car ls))))))))
| true |
ec3163667cde11076ac512c60d42c9d0232dc390
|
6b961ef37ff7018c8449d3fa05c04ffbda56582b
|
/bbn_cl/mach/zcomp/rtlopt/rdeath.scm
|
7db052a1bcc419426206e03ce543d46d587835a1
|
[] |
no_license
|
tinysun212/bbn_cl
|
7589c5ac901fbec1b8a13f2bd60510b4b8a20263
|
89d88095fc2a71254e04e57cf499ae86abf98898
|
refs/heads/master
| 2021-01-10T02:35:18.357279 | 2015-05-26T02:44:00 | 2015-05-26T02:44:00 | 36,267,589 | 4 | 3 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 4,079 |
scm
|
rdeath.scm
|
#| -*-Scheme-*-
$Header: rdeath.scm,v 1.2 88/08/31 10:44:34 jinx Exp $
$MIT-Header: rdeath.scm,v 1.3 87/08/07 17:07:52 GMT cph Exp $
Copyright (c) 1987 Massachusetts Institute of Technology
This material was developed by the Scheme project at the Massachusetts
Institute of Technology, Department of Electrical Engineering and
Computer Science. Permission to copy this software, to redistribute
it, and to use it for any purpose is granted, subject to the following
restrictions and understandings.
1. Any copy made of this software must include this copyright notice
in full.
2. Users of this software agree to make their best efforts (a) to
return to the MIT Scheme project any improvements or extensions that
they make, so that these may be included in future releases; and (b)
to inform MIT of noteworthy uses of this software.
3. All materials developed as a consequence of the use of this
software shall duly acknowledge such use, in accordance with the usual
standards of acknowledging credit in academic research.
4. MIT has made no warrantee or representation that the operation of
this software will be error-free, and MIT is under no obligation to
provide any services, by way of maintenance, update, or otherwise.
5. In conjunction with products arising from the use of this material,
there shall be no use of the name of the Massachusetts Institute of
Technology nor of any adaptation thereof in any advertising,
promotional, or sales literature without prior written consent from
MIT in each case. |#
;;;; RTL Compression
;;; Based on the GNU C Compiler
(declare (usual-integrations))
(package (code-compression)
(define-export (code-compression rgraphs)
(for-each walk-rgraph rgraphs))
(define (walk-rgraph rgraph)
(fluid-let ((*current-rgraph* rgraph))
(for-each walk-bblock (rgraph-bblocks rgraph))))
(define (walk-bblock bblock)
(if (rinst-next (bblock-instructions bblock))
(begin
(let ((live (regset-copy (bblock-live-at-entry bblock)))
(births (make-regset (rgraph-n-registers *current-rgraph*))))
(bblock-walk-forward bblock
(lambda (rinst)
(if (rinst-next rinst)
(let ((rtl (rinst-rtl rinst)))
(optimize-rtl live rinst rtl)
(regset-clear! births)
(mark-set-registers! live births rtl false)
(for-each (lambda (register)
(regset-delete! live register))
(rinst-dead-registers rinst))
(regset-union! live births))))))
(bblock-perform-deletions! bblock))))
(define (optimize-rtl live rinst rtl)
(if (rtl:assign? rtl)
(let ((address (rtl:assign-address rtl)))
(if (rtl:register? address)
(let ((register (rtl:register-number address))
(next (rinst-next rinst)))
(if (and (pseudo-register? register)
(= 2 (register-n-refs register))
(rinst-dead-register? next register)
;; Compensate for "stupid" rtl, like fast-vector-ref,
;; that doesn't have all the needed rules for
;; elided assigns.
(not (let ((x (rtl:assign-expression rtl)))
(and (pair? x)
(eq? (car x) 'fast-vector-ref))))
(rtl:any-subexpression? (rinst-rtl next)
(lambda (expression)
(and (rtl:register? expression)
(= (rtl:register-number expression)
register)))))
(begin
(let ((dead (rinst-dead-registers rinst)))
(for-each increment-register-live-length! dead)
(set-rinst-dead-registers!
next
(eqv-set-union dead
(delv! register
(rinst-dead-registers next)))))
(for-each-regset-member live
decrement-register-live-length!)
(rtl:modify-subexpressions (rinst-rtl next)
(lambda (expression set-expression!)
(if (and (rtl:register? expression)
(= (rtl:register-number expression)
register))
(set-expression! (rtl:assign-expression rtl)))))
(set-rinst-rtl! rinst false)
(reset-register-n-refs! register)
(reset-register-n-deaths! register)
(reset-register-live-length! register)
(set-register-bblock! register false))))))))
)
| false |
5de62885cd3e2a664e62b32f410bfd8ca83a77af
|
32130475e9aa1dbccfe38b2ffc562af60f69ac41
|
/ex04_07.scm
|
3760d05a3f4116b3f71a846e2b826acfc32ac510
|
[] |
no_license
|
cinchurge/SICP
|
16a8260593aad4e83c692c4d84511a0bb183989a
|
06ca44e64d0d6cb379836d2f76a34d0d69d832a5
|
refs/heads/master
| 2020-05-20T02:43:30.339223 | 2015-04-12T17:54:45 | 2015-04-12T17:54:45 | 26,970,643 | 0 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 2,108 |
scm
|
ex04_07.scm
|
(use test)
(use extras)
(load "ex04_06.scm")
; micro-eval
(define (micro-eval expr env)
(cond ((self-evaluating? expr) expr)
((true? expr) #t)
((false? expr) #f)
((variable? expr) (lookup-variable-value expr env))
((and? expr) (eval-and expr env))
((or? expr) (eval-or expr env))
((quoted? expr) (text-of-quotation expr))
((assignment? expr) (eval-assignment expr env))
((definition? expr) (eval-definition expr env))
((if? expr) (eval-if expr env))
((lambda? expr) (make-procedure (lambda-parameters expr)
(lambda-body expr)
env))
((let? expr) (micro-eval (let->combination expr) env))
((let*? expr) (micro-eval (let*->nested-lets expr) env))
((begin? expr) (eval-sequence (begin-actions expr) env))
((cond? expr) (micro-eval (cond->if expr) env))
((application? expr)
(micro-apply (micro-eval (operator expr) env)
(list-of-values (operands expr) env)))
(else
(error "Unknown expression type: EVAL" expr))))
; let*?
(define (let*? expr)
(tagged-list? expr 'let*))
; let*->nested-lets
(define (let*->nested-lets expr)
(let ((vars (let-vars expr))
(body (let-body expr)))
(define (let*->nested-lets-helper vars)
(if (null? (cdr vars))
; If we see that this is the last var assignment, append body
; to the assginment
(append (list 'let (list (car vars))) body)
(list 'let (list (car vars)) (let*->nested-lets-helper (cdr vars)))))
(let*->nested-lets-helper vars)))
; Unit tests
(printf "Exercise 4.7~N")
(let ((env (setup-environment))
(expr '(let* ((x 3) (y (+ x 2)) (z (+ x y 5))) (* x z))))
(test '((x 3) (y (+ x 2)) (z (+ x y 5))) (let-vars expr))
(test '((* x z)) (let-body expr))
(test '(let ((x 3)) (let ((y (+ x 2))) (let ((z (+ x y 5))) (* x z)))) (let*->nested-lets expr))
(micro-eval expr env)
(test 39 (micro-eval expr env))
)
(printf "~N")
| false |
d8e68ec8f8a06e7ec98f5885ca77985e3ae8f617
|
ae4938300d7eea07cbcb32ea4a7b0ead9ac18e82
|
/iter/processing.ss
|
18b3b39cc6d0631b9c7ab0a290ca4940565ef206
|
[] |
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 | 335 |
ss
|
processing.ss
|
#!r6rs
(library (imi iter processing)
(export iter-map)
(import (rnrs)
(imi iter iterator))
(define (iter-map proc . iterators)
(iterate (apply proc
(map iterator-value iterators))
(apply iter-map
proc
(map iterator-next iterators))))
)
| false |
2de7b55a21a99f6fc02976b22831e063d01d7ac5
|
d369542379a3304c109e63641c5e176c360a048f
|
/brice/Chapter2/exercise-2.17.scm
|
acff7d78c5c6a9e742da0420f6065533d82a464f
|
[] |
no_license
|
StudyCodeOrg/sicp-brunches
|
e9e4ba0e8b2c1e5aa355ad3286ec0ca7ba4efdba
|
808bbf1d40723e98ce0f757fac39e8eb4e80a715
|
refs/heads/master
| 2021-01-12T03:03:37.621181 | 2017-03-25T15:37:02 | 2017-03-25T15:37:02 | 78,152,677 | 1 | 0 | null | 2017-03-25T15:37:03 | 2017-01-05T22:16:07 |
Scheme
|
UTF-8
|
Scheme
| false | false | 222 |
scm
|
exercise-2.17.scm
|
#lang racket
(require "../utils.scm")
(title "Exercise 2.17")
(define (last xs)
(if (null? (cdr xs))
(car xs)
(last (cdr xs))))
(let* ((L (list 1 2 3 4 5)))
(asserteq "Last element can be recovered." (last L) 5))
| false |
429763a6dd46cef10707420a1f9a34598d60991e
|
7c7e1a9237182a1c45aa8729df1ec04abb9373f0
|
/spec/scheme_tests/macros.scm
|
24055d375c121254b19b25c54d20d2bad69eefc1
|
[
"MIT"
] |
permissive
|
coolsun/heist
|
ef12a65beb553cfd61d93a6691386f6850c9d065
|
3f372b2463407505dad7359c1e84bf4f32de3142
|
refs/heads/master
| 2020-04-21T15:17:08.505754 | 2012-06-29T07:18:49 | 2012-06-29T07:18:49 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 12,196 |
scm
|
macros.scm
|
(load "../helpers/macro-helpers")
; Basic test: no subpatterns or ellipses
(define-syntax while
(syntax-rules ()
[(while condition expression)
(let loop ()
(if condition
(begin
expression
(loop))))]))
(define i 5)
(while (> i 0)
(set! i (- i 1)))
(assert-equal 0 i)
; Test keywords
(define-syntax assign
(syntax-rules (values to)
[(assign values (value ...) to (name ...))
(begin
(define name value)
...)]))
(assign values (9 7 6) to (foo bar baz))
(assert-equal 9 foo)
(assert-equal 7 bar)
(assert-equal 6 baz)
(assert-raise SyntaxError (assign stuff (3 2) to (foo bar)))
(assert-equal 9 foo)
(assert-equal 7 bar)
(define-syntax dont-rename-else (syntax-rules ()
[(foo test cons alt)
(cond (test cons)
(else alt))]))
(assert-equal 8 (dont-rename-else #f 6 8))
; Check that empty lists are stored as matches and appear in output
(let-syntax ([quote-match (syntax-rules (quote)
[(_ 'arg ...) '(arg ...)])])
(assert-equal '(4 5 6) (quote-match '4 '5 '6))
(assert-equal '(4 5 ()) (quote-match '4 '5 '()))
(assert-equal '(4 () 6) (quote-match '4 '() '6)))
; Check that keywords are ignored if locally bound
; example from R6RS -- http://www.r6rs.org/final/html/r6rs/r6rs-Z-H-14.html#node_sec_11.19
(assert-equal 'ok (let ((=> #f))
(cond (#t => 'ok))))
; These tests come from tinkering with MZScheme
(define-syntax keyword-detect (syntax-rules (word)
[(_ word) 'keyword]
[(_ data) 'data]))
(assert-equal 'keyword (keyword-detect word))
(assert-equal 'word (let ([word 4]) (keyword-detect word)))
(define word 5)
(assert-equal 'keyword (keyword-detect word))
(define copy word)
(assert-equal 'copy (keyword-detect copy))
(define-syntax bad-keyword (syntax-rules (with)
[(_ with x)
`(,with ,x)]))
(let ([with 16])
(assert-raise SyntaxError (bad-keyword with 1)))
(assert-raise UndefinedVariable (bad-keyword with 2))
(define with 16)
(assert-equal '(16 3) (bad-keyword with 3))
; Test literal matching
(define-syntax iffy
(syntax-rules ()
[(iffy x #t y) x]
[(iffy x #f y) y]))
(assert-equal 7 (iffy 7 #t 3))
(assert-equal 3 (iffy 7 #f 3))
; Test that bound and non-bound symbols can be matched correctly
(letrec-syntax ((foo (syntax-rules (=)
((foo = x) x)))
(bar (syntax-rules ()
((bar x) (foo = x)))))
(assert-equal 5 (bar 5)))
; Test improper patterns
(define-syntax rest (syntax-rules ()
[(_ foo bar . rest)
rest]))
(assert-equal 10 (rest 4 5 + 3 7))
(let-syntax ([foo (syntax-rules ()
[(_ expr ...)
(list expr ...)])])
(assert-equal '(1 2 3) (foo 1 2 3))
(assert-raise SyntaxError (foo 1 2 3 . 4)))
(let-syntax ([foo (syntax-rules ()
[(_ bindings body ...)
'(defun (proc . bindings) body ...)])])
(assert-equal '(defun (proc x y) (display x) y)
(foo (x y) (display x) y))
(assert-equal '(defun (proc x y . z) z)
(foo (x y . z) z))
(assert-equal '(defun (proc . z) z)
(foo z z)))
; Test input execution - example from R5RS
(define-syntax my-or
(syntax-rules ()
((my-or) #f)
((my-or e) e)
((my-or e1 e2 ...)
(let ((temp e1))
(if temp
temp
(my-or e2 ...))))))
(define e 1)
(define (inc)
(set! e (+ e 1))
e)
(my-or (> 0 (inc)) ; false
(> 0 (inc)) ; false
(> 9 6) ; true - should not evaluate further
(> 0 (inc))
(> 0 (inc)))
(assert-equal 3 e)
; Test ellipses
(when true
(set! i (+ i 1))
(set! i (+ i 1))
(set! i (+ i 1))
(set! i (+ i 1)))
(assert-equal 4 i)
; Test that ellipses match ZERO or more inputs
(define-syntax one-or-more
(syntax-rules ()
[(one-or-more stmt1 stmt2 ...)
(begin
stmt1
stmt2
...)]))
(assert-equal 6 (one-or-more (+ 2 4)))
(assert-equal 11 (one-or-more (+ 2 4) (+ 3 8)))
(assert-equal 13 (one-or-more (+ 2 4) (+ 3 8) (+ 7 6)))
; Test that null lists terminators don't count as input
(define-syntax table (syntax-rules ()
[(_)
'()]
[(_ key value rest ...)
(cons (cons key value) (table rest ...))]))
(assert-equal (list (cons 1 2) (cons 3 4) (cons 5 6))
(table 1 2 3 4 5 6))
(assert-raise SyntaxError (table 1 2 3))
; Test execution scope using (swap)
(define a 4)
(define b 7)
(swap a b)
(assert-equal 7 a)
(assert-equal 4 b)
; More ellipsis tests from PLT docs
(define-syntax rotate
(syntax-rules ()
[(rotate a) a]
[(rotate a b c ...) (begin
(swap a b)
(rotate b c ...))]))
(define a 1) (define d 4)
(define b 2) (define e 5)
(define c 3)
(rotate a b c d e)
(assert-equal 2 a) (assert-equal 5 d)
(assert-equal 3 b) (assert-equal 1 e)
(assert-equal 4 c)
; Check repeated macro use doesn't eat the parse tree
(letrec
([loop (lambda (count)
(rotate a b c d e)
(if (> count 1) (loop (- count 1))))])
(loop 3))
(assert-equal 5 a) (assert-equal 3 d)
(assert-equal 1 b) (assert-equal 4 e)
(assert-equal 2 c)
; Test subpatterns
(define-syntax p-swap
(syntax-rules ()
[(swap (x y))
(let ([temp x])
(set! x temp) ; Force temp in lazy mode
(set! x y)
(set! y temp))]))
(define m 3)
(define n 8)
(p-swap (m n))
(assert-equal 8 m)
(assert-equal 3 n)
(define-syntax parallel-set!
(syntax-rules ()
[(_ (symbol ...) (value ...))
(begin
(set! symbol value)
...)]))
(parallel-set! (a b c) (74 56 19))
(assert-equal 74 a)
(assert-equal 56 b)
(assert-equal 19 c)
; Test that ellipses are correctly matched
; to numbers of splices in subexpressions
(define-syntax p-let*
(syntax-rules ()
[(_ (name ...) (value ...) stmt ...)
(let* ([name value] ...)
stmt
...)]))
(define indicator #f)
(p-let* (k l m) (3 4 5)
(assert-equal 5 m)
(define temp m)
(set! m (+ l k))
(set! k (- l temp))
(set! l (* 6 (+ k m)))
(rotate k l m)
(assert-equal 7 l)
(assert-equal -1 m)
(assert-equal 36 k)
(set! indicator #t))
(assert indicator)
(define-syntax sum-lists
(syntax-rules ()
[(_ (value1 ...) (value2 ...))
(+ value1 ... value2 ...)]))
(assert-equal 21 (sum-lists (1 2) (3 4 5 6)))
(assert-equal 21 (sum-lists (1 2 3 4 5) (6)))
(define-syntax do-this
(syntax-rules (times)
[(_ n times body ...)
(letrec ([loop (lambda (count)
body ...
(if (> count 1)
(loop (- count 1))))])
(loop n))]))
(define myvar 0)
(do-this 7 times
(set! myvar (+ myvar 1)))
(assert-equal 7 myvar)
; Test that ellipsis expressions can be reused
(define-syntax weird-add
(syntax-rules ()
[(_ (name ...) (value ...))
(let ([name value] ...)
(+ name ...))]))
(assert-equal 15 (weird-add (a b c d e) (1 2 3 4 5)))
(define-syntax double-up
(syntax-rules ()
[(double-up value ...)
'((value value) ...)]))
(assert-equal '((5 5)) (double-up 5))
(assert-equal '((3 3) (9 9) (2 2) (7 7)) (double-up 3 9 2 7))
(assert-equal '() (double-up))
; Test that pattern variables may appear at a greater
; repetition depth in the template than they do in the pattern
(let-syntax ((repeater (syntax-rules ()
[(_ one (many ...))
'((one many) ...)]))
(root-v-2 (syntax-rules ()
[(_ one (many ...) ...)
'(((one many) ...) ...)]))
(1-v-2 (syntax-rules ()
[(_ (one ...) (many ...) ...)
'(((one many) ...) ...)])))
(assert-equal '((a 2) (a 3) (a 4))
(repeater a (2 3 4)))
(assert-equal '(((a 1) (a 2)) ((a 6)) () ((a 3) (a 6) (a 8)))
(root-v-2 a (1 2) (6) () (3 6 8)))
(assert-equal '(((a 1) (a 2)) ((b 6)) () ((d 3) (d 6) (d 8)))
(1-v-2 (a b c d) (1 2) (6) () (3 6 8))))
; R5RS version of (let), uses ellipsis after lists in patterns
(define-syntax r5rs-let
(syntax-rules ()
((let ((name val) ...) body1 body2 ...)
((lambda (name ...) body1 body2 ...)
val ...))
((let tag ((name val) ...) body1 body2 ...)
((letrec ((tag (lambda (name ...)
body1 body2 ...)))
tag)
val ...))))
(define let-with-macro #f)
(r5rs-let ([x 45] [y 89])
(assert-equal 45 x)
(assert-equal 89 y)
(set! let-with-macro #t))
(assert let-with-macro)
; Non-standard extension to R5RS, not quite R6RS
; Allow ellipses before the end of a list as long
; as, in the expression (A ... B), B is a less specific
; pattern than A
(define-syntax infix-ellip
(syntax-rules ()
[(_ (name value) ... fn)
(let ([name value] ...)
(fn name ...))]))
(assert-equal 24 (infix-ellip (a 1) (b 2) (c 3) (d 4) *))
; Test nested splicings
(define-syntax nest1
(syntax-rules ()
[(_ (value ...) ... name ...)
'((name (value) ...) ...)]))
(assert-equal '((foo (1) (2)) (bar (3)) (baz) (whizz (4) (5) (6) (7)))
(nest1 (1 2) (3) () (4 5 6 7) foo bar baz whizz))
(define-syntax triple-deep
(syntax-rules ()
[(_ (((name ...) ...) ...) ((value ...) ...) ...)
'((((value (name)) ...) ...) ...)]))
(assert-equal '((((5 (foo)) (6 (bar))) ((2 (it)))) (((4 (wont))) ((8 (matter)) (7 (really)) (2 (anyway)))))
(triple-deep (((foo bar) (it)) ((wont) (matter really anyway)))
((5 6) (2)) ((4) (8 7 2))))
(define-syntax triple-deep2
(syntax-rules ()
[(_ (((name ...) ...) ...) ((value ...) ...) ...)
'(((((value (name)) ...) ((value (name)) ...)) ...) ...)]))
(assert-equal '(((((5 (foo)) (6 (bar))) ((5 (foo)) (6 (bar)))))
((((4 (wont))) ((4 (wont))))
(((8 (matter)) (7 (really)) (2 (anyway))) ((8 (matter)) (7 (really)) (2 (anyway))))))
(triple-deep2 (((foo bar)) ((wont) (matter really anyway)))
((5 6)) ((4) (8 7 2))))
(define-syntax trial (syntax-rules (with)
[(_ ((with (value ...) ...) ...) obj ...)
'((obj ((value ...) (value value) ...) ... (obj obj)) ...)]))
(assert-equal '((bar ((4 2 7) (4 4) (2 2) (7 7)) (bar bar)))
(trial ((with (4 2 7))) bar))
(assert-equal '((bar (bar bar)))
(trial ((with)) bar))
(assert-raise MacroTemplateMismatch (trial () bar))
(define-syntax trial2 (syntax-rules (with)
[(_ (with (value ...) ...) ... obj ...)
'((obj ((value ...) (value value) ...) ... (obj obj)) ...)]))
(assert-equal '((foo ((a) (a a)) (foo foo))
(bar (bar bar)))
(trial2 (with (a)) (with) foo bar))
(assert-equal '((foo ((a) (a a)) (foo foo))
(bar (bar bar))
(baz ((1 2 3) (1 1) (2 2) (3 3)) (baz baz)))
(trial2 (with (a)) (with) (with (1 2 3)) foo bar baz))
; Test nested macros with keywords and nested splices
; http://fabiokung.com/2007/10/24/ruby-dsl-to-describe-automata/
(define-syntax automaton (syntax-rules (:)
[(_ init-state
[state : response ...]
...)
(let-syntax ([process-state (syntax-rules (-> accept)
[(_ accept)
(lambda (stream)
(cond [(null? stream) #t]
[else #f]))]
[(... (_ (label -> target) ...))
(lambda (stream)
(cond [(null? stream) #f]
[else (case (car stream)
[(label) (target (cdr stream))]
(... ...)
[else #f])]))])])
(letrec ([state (process-state response ...)]
...)
init-state))]))
(define cdar-sequence?
(automaton init
[init : (c -> more)]
[more : (a -> more)
(d -> more)
(r -> end)]
[end : accept]))
(assert (cdar-sequence? '(c a d a d r)))
(assert (not (cdar-sequence? '(a c a d r c))))
| true |
f80af76af060ce8f667f931ad96b2548c47a9db0
|
defeada37d39bca09ef76f66f38683754c0a6aa0
|
/System/system/component-model/design/menu-command.sls
|
6252e2b7c1521289e19dc0cd704772fc8855bc42
|
[] |
no_license
|
futsuki/ironscheme-port
|
2dbac82c0bda4f4ff509208f7f00a5211d1f7cd5
|
4e7a81b0fbeac9a47440464988e53fb118286c54
|
refs/heads/master
| 2016-09-06T17:13:11.462593 | 2015-09-26T18:20:40 | 2015-09-26T18:20:40 | 42,757,369 | 0 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 2,268 |
sls
|
menu-command.sls
|
(library (system component-model design menu-command)
(export new
is?
menu-command?
invoke
to-string
checked?-get
checked?-set!
checked?-update!
command-id
enabled?-get
enabled?-set!
enabled?-update!
ole-status
properties
supported?-get
supported?-set!
supported?-update!
visible?-get
visible?-set!
visible?-update!)
(import (ironscheme-clr-port))
(define-syntax new
(lambda (e)
(syntax-case e ()
((_ a ...)
#'(clr-new System.ComponentModel.Design.MenuCommand a ...)))))
(define (is? a) (clr-is System.ComponentModel.Design.MenuCommand a))
(define (menu-command? a)
(clr-is System.ComponentModel.Design.MenuCommand a))
(define-method-port
invoke
System.ComponentModel.Design.MenuCommand
Invoke
(System.Void System.Object)
(System.Void))
(define-method-port
to-string
System.ComponentModel.Design.MenuCommand
ToString
(System.String))
(define-field-port
checked?-get
checked?-set!
checked?-update!
(property:)
System.ComponentModel.Design.MenuCommand
Checked
System.Boolean)
(define-field-port
command-id
#f
#f
(property:)
System.ComponentModel.Design.MenuCommand
CommandID
System.ComponentModel.Design.CommandID)
(define-field-port
enabled?-get
enabled?-set!
enabled?-update!
(property:)
System.ComponentModel.Design.MenuCommand
Enabled
System.Boolean)
(define-field-port
ole-status
#f
#f
(property:)
System.ComponentModel.Design.MenuCommand
OleStatus
System.Int32)
(define-field-port
properties
#f
#f
(property:)
System.ComponentModel.Design.MenuCommand
Properties
System.Collections.IDictionary)
(define-field-port
supported?-get
supported?-set!
supported?-update!
(property:)
System.ComponentModel.Design.MenuCommand
Supported
System.Boolean)
(define-field-port
visible?-get
visible?-set!
visible?-update!
(property:)
System.ComponentModel.Design.MenuCommand
Visible
System.Boolean))
| true |
daa3d1bde59ef90f2d0758591c0fd17694e2328e
|
ae76253c0b7fadf8065777111d3aa6b57383d01b
|
/chap2/exec-2.61.ss
|
9c13644c706b04c48b04b77839d0d1852fc5a4e7
|
[] |
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 | 1,474 |
ss
|
exec-2.61.ss
|
(define (element-of-set? x set)
(cond ((null? set) #f)
((equal? x (car set)) #t) ; equal? Set element need not to be symbol
((< x (car set)) #f)
(else (element-of-set? x (cdr set)))))
(define (adjoin-set x set)
(define (iter set result)
(cond ((null? set) (append result (list x)))
((< x (car set))
(append result (cons x set)))
((> x (car set))
(iter (cdr set)
(append result (list (car set)))))
((= x (car set))
(append result set))))
(iter set '()))
(define (intersection-set set1 set2)
(if (or (null? set1) (null? set2))
'()
(let ((x1 (car set1)) (x2 (car set2)))
(cond ((= x1 x2)
(cons x1 (intersection-set (cdr set1) (cdr set2))))
((< x1 x2)
(intersection-set (cdr set1) set2))
((> x1 x2)
(intersection-set set1 (cdr set2)))))))
(define (union-set set1 set2)
(if (null? set1)
set2
(union-set (cdr set1)
(adjoin-set (car set1) set2))))
(define empty-set '())
(element-of-set? 1 empty-set)
(adjoin-set -1 (list 1 2 3))
(adjoin-set 2 (list 1 2 3))
(adjoin-set 4 (list 1 2 3))
(let ((set1 (adjoin-set 1 (adjoin-set 2 empty-set)))
(set2 (adjoin-set 2 (adjoin-set 3 empty-set))))
(intersection-set set1 set2))
(let ((set1 (adjoin-set 1 (adjoin-set 2 empty-set)))
(set2 (adjoin-set 2 (adjoin-set 3 empty-set))))
(union-set set1 set2))
| false |
60b326293cf9f34191bd9da72081f4c7b7ab1645
|
557c51d080c302a65e6ef37beae7d9b2262d7f53
|
/workspace/scheme-tester/a/a11.scm
|
cf2710ec34a6ed5e4f1b56da91e9ed5db30e3586
|
[] |
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 | 12,835 |
scm
|
a11.scm
|
;;----------------------------------
;; B521 - Assignment 11
;;----------------------------------
;; Name: Saliya Ekanayake
;; ID: 0002560797
;; Email: [email protected]
;;----------------------------------
;----------------------------------------------------------------
; Test macro (taken happily from the assignment itself :))
; ---------------------------------------------------------------
(define-syntax test
(syntax-rules ()
((_ title tested-expression expected-result)
(let* ((expected expected-result)
(produced tested-expression))
(if (equal? expected produced)
(printf "~s works!\n" title)
(error
'test
"Failed ~s: ~a\nExpected: ~a\nComputed: ~a"
title 'tested-expression expected produced))))))
(define-syntax multi-test
(syntax-rules ()
((_ title tested-expression expected-result* ...)
(let* ((expected* expected-result*)
...
(produced tested-expression))
(cond
[(equal? produced expected-result*) (printf "~s works!\n" title)]
...
[else (error
'test
"Failed ~s: ~a\nComputed: ~a"
title 'tested-expression produced)])))))
;=================================================Part II==================================================
;--------------------------------------------------------------------------------------
;Q1)
(run 2 (q)
(== 5 q)
(conde
[(conde
[(== 5 q) (== 6 q)]) (== 5 q)]
[(== q 5)]))
; ans: (5)
; reason:
; 1. First unification succeeds and sets fresh variable q to 5.
; 2. The first line of outer conde has the inner conde as the question.
; 3. The question of the only line in the inner conde succeeds as q is 5. However, the answer goal fails
; and thus the entire conde fails (since it's the only line). This failure leads to the failure of the
; first conde line in the outer conde.
; 4. The second line of the outer conde is evaluated resulting a success as q is 5.
; 5. There are no goals left to achieve thus the single value associated with q is returned even though two
; results for q is expected.
;--------------------------------------------------------------------------------------
;Q2)
;;(run* (q)
;; (exist (x y)
;; (== `(,x ,y) q) ; <------------------- A
;; (conde
;; [fail succeed] ; <------------------ B
;; [(conde
;; [(== 5 x) (== y x)] ; <---------- C
;; [(== `(,x) y)] ; <--------------- D
;; [(== x y)])] ; <----------------- E
;; [succeed]))) ; <-------------------- F
; ans: ((_.0 _.1) (5 5) (_.0 (_.0)) (_.0 _.0))
; reason:
; 1. A succeeds with setting q to (_.0 _.1). The two values indicates the values of the fresh variables
; x and y.
; 2. B fails and end of story for that line
; 3. C succeeds as x and y are fresh. It sets x to 5 and y to x. Thus q gets another value (5 5)
; 4. D succeeds as x and y are considered as fresh again. The value of x is _.0 and the value of
; y is the list containing the value of x, i.e. (_.0). Thus, q gets another value as (_.0 (_.)).
; 5. E succeeds as x and y are considered fresh once again and unifies x with y. Since both of them are
; fresh they unifiy with _.0 which gives q another value of (_.0 _.0).
; 6. F succeeds and ends the outer conde.
; 7. We get all the values for q since we asked for it using run*.
;--------------------------------------------------------------------------------------
;Q3)
;;(run 1 (q)
;; alwayso
;; fail)
; ans: infinite loop
; reason:
; 1. alwayso is an infinite number of successes. Thus the goal 'fail' is evaluated and fails obviously.
; 2. This leads to try another success from alwayso. Again it succeeds and 'fail' is evaluated. A failure again.
; 3. Thus, as long as there are success goals in alwayso the run will try them hoping to come up with an answer for
; q. But unfortunately alwayso has an infinite number of successes leading to an infinite loop.
; 4. We also see that the run value, i.e. 1, is irrelevant here except for 0, which for anything would produce ().
;--------------------------------------------------------------------------------------
;Q4)
;;(run 1 (q)
;; fail
;; alwayso)
; ans: ()
; reason:
; 1. The goal 'fail' fails. So why bother going further, just return with a failure, i.e. ().
; 2. Here too, we see that run value is irrelevant for the result.
;--------------------------------------------------------------------------------------
;Q5)
;;(run 2 (q)
;; (conde
;; [succeed] ; <----------- A
;; [nevero])) ; <---------- B
; ans: infinite loop
; reason:
; 1. The goal A is irrelevant here as it succeeds anyway.
; 2. nevero is an infinite number of fails, but unknowingly run would try to fetch an answer
; for q out of this infinitely many goals. Each goal keeps on failing and thus an infinite loop.
;--------------------------------------------------------------------------------------
;Q6)
;;(run* (q)
;; (exist (a b c d) ; <----------------------- A
;; (== `(,a ,b) `(,c (,a . ,d))) ; <-------- B
;; (== `(,b ,c) `((,a) ,d)) ; <------------- C
;; (== `(,a ,b ,c ,d) q))) ; <-------------- D
; ans: ((() (()) () ()))
; reason:
; 1. A introduces fresh variables a, b, c, and d.
; 2. B succeeds and ends with setting a and c to _.0 Then b to (_.0 . _.1) and d to _.1
; 3. In C it tries to unify ((_.0 . _.1) _.0) with ((_.0) _.1). This succeeds only when
; _.1 represents () and _.0 represents (), which would result in the unification of
; ((()) ()) with ((()) ()). This obviously succeeds.
; 4. Thus after the first two unifications we get a, b, c, and d as,
; () (() . ()) () ()
; 5. It is obvious that b reduces to (())
; 6. Thus in D we put all these into a list and unify it with q resulting q,
; ( ( () (()) () () ) )
;--------------------------------------------------------------------------------------
;=================================================Part II==================================================
;;(define one-item
;; (lambda (x s)
;; (cond
;; [(null? s) '()]
;; [else (cons (cons x (car s))
;; (one-item x (cdr s)))])))
(define one-itemo
(lambda (x s out)
(conde
[(nullo s) (== out '())]
[(exist (a d res c)
(conso a d s)
(conso x a c)
(conso c res out)
(one-itemo x d res))])))
;;(define assq
;; (lambda (x ls)
;; (cond
;; [(null? ls) #f]
;; [(eq? (car (car ls)) x) (car ls)]
;; [else (assq x (cdr ls))])))
(define assqo
(lambda (x ls out)
(conde
[(nullo ls) fail]
[(exist (p c)
(caro ls p)
(caro p c)
(eqo c x)) (caro ls out)]
[(exist (d)
(cdro ls d)
(assqo x d out))])))
;--------------------------------------------------------------------------------------
; Test cases for one-itemo and assqo
;--------------------------------------------------------------------------------------
(printf "\n=================================================\nTests cases for one-itemo and assqo\n=================================================\n")
(test "one-itemo-1"
(run* (q)
(one-itemo 'a '(b c d) q))
'(((a . b) (a . c) (a . d))))
(test "one-itemo-2"
(run* (q)
(one-itemo q '(b c d) '((a . b) (a . c) (a . d))))
'(a))
(test "one-itemo-3"
(run* (q)
(one-itemo 'a q '((a . b) (a . c) (a . d))))
'((b c d)))
(test "one-itemo-4"
(run* (q)
(one-itemo 'a '(b c d) `((a . b) . ,q)))
'(((a . c) (a . d))))
(test "one-itemo-5"
(run* (q)
(one-itemo 'a '(b c d) '((a . b) (a . c) (a . d))))
'(_.0))
(test "one-itemo-6"
(run* (q)
(one-itemo 'a `(b ,q d) '((a . b) (a . c) (a . d))))
'(c))
(test "one-itemo-7"
(run* (q)
(exist (x y)
(one-itemo x y '((a . b) (a . c) (a . d)))
(== `(,x ,y) q)))
'((a (b c d))))
(test "one-itemo-8"
(run 6 (q)
(exist (x y z)
(one-itemo x y z)
(== `(,x ,y ,z) q)))
'((_.0 () ()) (_.0 (_.1) ((_.0 . _.1)))
(_.0 (_.1 _.2) ((_.0 . _.1) (_.0 . _.2)))
(_.0 (_.1 _.2 _.3) ((_.0 . _.1) (_.0 . _.2) (_.0 . _.3)))
(_.0 (_.1 _.2 _.3 _.4) ((_.0 . _.1) (_.0 . _.2) (_.0 . _.3) (_.0 . _.4)))
(_.0 (_.1 _.2 _.3 _.4 _.5) ((_.0 . _.1) (_.0 . _.2) (_.0 . _.3) (_.0 . _.4) (_.0 . _.5)))))
(test "assqo-1"
(run* (q)
(assqo 'x '() q))
'())
(test "assqo-2"
(run* (q)
(assqo 'x '((x . 5)) q))
'((x . 5)))
(test "assqo-3"
(run* (q)
(assqo 'x '((y . 6) (x . 5)) q))
'((x . 5)))
(test "assqo-4"
(run* (q)
(assqo 'x '((x . 6) (x . 5)) q))
'((x . 6) (x . 5)))
(test "assqo-5"
(run* (q)
(assqo 'x '((x . 5)) '(x . 5)))
'(_.0))
(test "assqo-6"
(run* (q)
(assqo 'x '((x . 6) (x . 5)) '(x . 6)))
'(_.0))
(test "assqo-7"
(run* (q)
(assqo 'x '((x . 6) (x . 5)) '(x . 5)))
'(_.0))
(test "assqo-8"
(run* (q)
(assqo q '((x . 6) (x . 5)) '(x . 5)))
'(x))
(test "assqo-9"
(run* (q)
(assqo 'x '((x . 6) . ,q) '(x . 6)))
'(_.0))
(multi-test "assqo-10"
(run 10 (q)
(assqo 'x q '(x . 5)))
'(((x . 5) . _.0)
(_.0 (x . 5) . _.1)
(_.0 _.1 (x . 5) . _.2)
(_.0 _.1 _.2 (x . 5) . _.3)
(_.0 _.1 _.2 _.3 (x . 5) . _.4)
(_.0 _.1 _.2 _.3 _.4 (x . 5) . _.5)
(_.0 _.1 _.2 _.3 _.4 _.5 (x . 5) . _.6)
(_.0 _.1 _.2 _.3 _.4 _.5 _.6 (x . 5) . _.7)
(_.0 _.1 _.2 _.3 _.4 _.5 _.6 _.7 (x . 5) . _.8)
(_.0 _.1 _.2 _.3 _.4 _.5 _.6 _.7 _.8 (x . 5) . _.9))
'(((x . 5) . _.0)
((_.0 . _.1) (x . 5) . _.2)
((_.0 . _.1) (_.2 . _.3) (x . 5) . _.4)
((_.0 . _.1) (_.2 . _.3) (_.4 . _.5) (x . 5) . _.6)
((_.0 . _.1) (_.2 . _.3) (_.4 . _.5) (_.6 . _.7) (x . 5) . _.8)
((_.0 . _.1) (_.2 . _.3) (_.4 . _.5) (_.6 . _.7) (_.8 . _.9) (x . 5) . _.10)
((_.0 . _.1) (_.2 . _.3) (_.4 . _.5) (_.6 . _.7) (_.8 . _.9) (_.10 . _.11) (x . 5) . _.12)
((_.0 . _.1) (_.2 . _.3) (_.4 . _.5) (_.6 . _.7) (_.8 . _.9) (_.10 . _.11) (_.12 . _.13) (x . 5) . _.14)
((_.0 . _.1) (_.2 . _.3) (_.4 . _.5) (_.6 . _.7) (_.8 . _.9) (_.10 . _.11) (_.12 . _.13) (_.14 . _.15) (x . 5) . _.16)
((_.0 . _.1) (_.2 . _.3) (_.4 . _.5) (_.6 . _.7) (_.8 . _.9) (_.10 . _.11) (_.12 . _.13) (_.14 . _.15) (_.16 . _.17) (x . 5) . _.18)))
(multi-test "assqo-11"
(run 10 (q)
(exist (x y z)
(assqo x y z)
(== `(,x ,y ,z) q)))
'((_.0 ((_.0 . _.1) . _.2) (_.0 . _.1))
(_.0 (_.1 (_.0 . _.2) . _.3) (_.0 . _.2))
(_.0 (_.1 _.2 (_.0 . _.3) . _.4) (_.0 . _.3))
(_.0 (_.1 _.2 _.3 (_.0 . _.4) . _.5) (_.0 . _.4))
(_.0 (_.1 _.2 _.3 _.4 (_.0 . _.5) . _.6) (_.0 . _.5))
(_.0 (_.1 _.2 _.3 _.4 _.5 (_.0 . _.6) . _.7) (_.0 . _.6))
(_.0 (_.1 _.2 _.3 _.4 _.5 _.6 (_.0 . _.7) . _.8) (_.0 . _.7))
(_.0 (_.1 _.2 _.3 _.4 _.5 _.6 _.7 (_.0 . _.8) . _.9) (_.0 . _.8))
(_.0 (_.1 _.2 _.3 _.4 _.5 _.6 _.7 _.8 (_.0 . _.9) . _.10) (_.0 . _.9))
(_.0 (_.1 _.2 _.3 _.4 _.5 _.6 _.7 _.8 _.9 (_.0 . _.10) . _.11) (_.0 . _.10)))
'((_.0
((_.0 . _.1) . _.2)
(_.0 . _.1))
(_.0
((_.1 . _.2) (_.0 . _.3) . _.4)
(_.0 . _.3))
(_.0
((_.1 . _.2) (_.3 . _.4) (_.0 . _.5) . _.6)
(_.0 . _.5))
(_.0
((_.1 . _.2) (_.3 . _.4) (_.5 . _.6) (_.0 . _.7) . _.8)
(_.0 . _.7))
(_.0
((_.1 . _.2) (_.3 . _.4) (_.5 . _.6) (_.7 . _.8) (_.0 . _.9) . _.10)
(_.0 . _.9))
(_.0
((_.1 . _.2) (_.3 . _.4) (_.5 . _.6) (_.7 . _.8) (_.9 . _.10) (_.0 . _.11) . _.12)
(_.0 . _.11))
(_.0
((_.1 . _.2) (_.3 . _.4) (_.5 . _.6) (_.7 . _.8)
(_.9 . _.10) (_.11 . _.12) (_.0 . _.13) . _.14)
(_.0 . _.13))
(_.0
((_.1 . _.2) (_.3 . _.4) (_.5 . _.6) (_.7 . _.8) (_.9 . _.10) (_.11 . _.12) (_.13 . _.14) (_.0 . _.15) . _.16)
(_.0 . _.15))
(_.0
((_.1 . _.2) (_.3 . _.4) (_.5 . _.6) (_.7 . _.8) (_.9 . _.10) (_.11 . _.12) (_.13 . _.14) (_.15 . _.16) (_.0 . _.17) . _.18)
(_.0 . _.17))
(_.0
((_.1 . _.2) (_.3 . _.4) (_.5 . _.6) (_.7 . _.8) (_.9 . _.10) (_.11 . _.12) (_.13 . _.14) (_.15 . _.16) (_.17 . _.18) (_.0 . _.19) . _.20)
(_.0 . _.19))))
| true |
feac94a5c8389860bb590567f03a1d97010b3d16
|
0bc4163b3571382861380e47eef4aa1afc862024
|
/scheme/geometry/curve.scm
|
26d979e9ab34a7bbd4360b4ed22a740fa03170e8
|
[] |
no_license
|
mjgordon/fluxcadd
|
49f7c633d4430d98cfa0f24485bfc737fac1a321
|
afedf70e8a9b43563bb3fe5fdc2265260f4a981b
|
refs/heads/master
| 2023-07-21T10:19:36.544424 | 2023-07-08T00:19:06 | 2023-07-08T00:19:06 | 84,756,384 | 0 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 234 |
scm
|
curve.scm
|
(define (line-2pt a b)
(let ((l (Line. a b)))
(.add geometry l)
l))
(define (polyline points)
(let ((pl (Polyline. points)))
(.add geometry pl)
pl))
(define (evaluate-curve curve p)
(.getPointOnCurve curve p))
| false |
ad4b6755f5d7f6899b2db83c62a63296a97ee043
|
7cc14e6ab8e064fa967251e3249863e2cfbcc920
|
/chapter-1/e-1-4.scm
|
e937b08860f8415e21e418fb815489a3f0c09244
|
[] |
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 | 231 |
scm
|
e-1-4.scm
|
;;; Bill Xue
;;; 2015-10-01
;;; This program shows the special feature of lisp
;;; We can handle process as data in lisp!!!!
(define (a-plus-abs-b a b)
((if (> b 0)
+
-) ; decide the sign of b
a b))
(a-plus-abs-b 1 -4)
| false |
d5dc7844a56cc06ae94d5f1e7446cef8bee83cd8
|
2e4afc99b01124a1d69fa4f44126ef274f596777
|
/apng/resources/dracula/lang/dracula-language-sig.ss
|
5374b476a0bc887d07d9de378e073b91e1b55c57
|
[] |
no_license
|
directrix1/se2
|
8fb8204707098404179c9e024384053e82674ab8
|
931e2e55dbcc55089d9728eb4194ebc29b44991f
|
refs/heads/master
| 2020-06-04T03:10:30.843691 | 2011-05-05T03:32:54 | 2011-05-05T03:32:54 | 1,293,430 | 0 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 75 |
ss
|
dracula-language-sig.ss
|
(module dracula-language-sig (lib "a-signature.ss")
dracula-language%)
| false |
6578fad0a845c125514aa48839941e298affd36a
|
120324bbbf63c54de0b7f1ca48d5dcbbc5cfb193
|
/packages/gui/assimp.ss
|
b30c3525841ed8cce9fb93c5fbbfa9fd7111e2aa
|
[
"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 | 444 |
ss
|
assimp.ss
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Copyright 2016-2080 evilbinary.
;;作者:evilbinary on 12/24/16.
;;邮箱:[email protected]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(library (gui assimp)
(export ai-import-file)
(import (scheme) (utils libutil) (cffi cffi))
(load-librarys "libassimp")
(def-function
ai-import-file
"aiImportFile"
(string int)
void*))
| false |
bbd7025ed1b107c33784cbc9a4361db9c99b3bd8
|
53cb8287b8b44063adcfbd02f9736b109e54f001
|
/depend/depend.scm
|
52ace4c3ef021c231f2741a74c03642d8a136074
|
[] |
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 | 284 |
scm
|
depend.scm
|
;;; depend.scm -- module definition for dependency analysis
;;;
;;; author : John
;;; date : 24 Mar 1992
;;;
(define-compilation-unit depend
(source-filename "depend/")
(require ast haskell-utils)
(unit dependency-analysis
(source-filename "dependency-analysis.scm")))
| false |
5eb39fd5cda5c802b0f3b85bc6b0d305d41ec06d
|
40395de4446cbdbf1ffd0d67f9076c1f61d572ad
|
/cyclone/tests/call-cc-set.scm
|
eb5e6d1e563f471858c33b6b69bc66358a0659c4
|
[] |
no_license
|
justinethier/nugget
|
959757d66f0a8597ab9a25d027eb17603e3e1823
|
0c4e3e9944684ea83191671d58b5c8c342f64343
|
refs/heads/master
| 2020-12-22T06:36:53.844584 | 2016-07-14T03:30:09 | 2016-07-14T03:30:09 | 3,466,831 | 16 | 4 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 928 |
scm
|
call-cc-set.scm
|
;; TODO: work in progress, none of this works in compiler
; General function application
; Tests from: http://tech.phillipwright.com/2010/05/23/continuations-in-scheme/
;(define handle #f)
;(define test-value #f)
;(set! test-value (+ 2 (call/cc (lambda (k) (set! handle k) 2))))
;(set! test-value (handle 20))
;(assert/equal test-value 22)
;(set! test-value (handle 100))
;(assert/equal test-value 102)
;(let ((handle #f)
; (test-value #f))
; (set! test-value (+ 2 (call/cc (lambda (k) (set! handle k) 2))))
; (set! test-value (handle 20))
; (display test-value) ;;(assert/equal test-value 22)
; ;(set! test-value (handle 100))
; ;; TODO: (display "\n")
; ;(display test-value) ;;(assert/equal test-value 102)
; )
(let ((test-cont #f)
(a #f))
(set! a (call/cc (lambda (c) (set! test-cont c) 1)))
(write a) ;;(assert/equal a 1)
;(test-cont 2)
(write a) ;;(assert/equal a 2)
)
| false |
5faafba2b51acb789d79caeab3065e4fe3a0b4ee
|
11f8c62565512010ec8bd59d929a35063be7bb2a
|
/compiler/src/test/scheme/functional/MutationSuite.scm
|
42aaea70b086cdf7fd816cf80ce27b2e930082f2
|
[
"Apache-2.0"
] |
permissive
|
etaoins/llambda
|
97b986e40d8aa6871a5ab1946b53c2898313776b
|
a2a5c212ebb56701fa28649c377d0ddd8b67da0b
|
refs/heads/master
| 2020-05-26T18:43:11.776115 | 2018-01-03T07:40:49 | 2018-01-03T07:40:49 | 9,960,891 | 71 | 7 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 286 |
scm
|
MutationSuite.scm
|
(define-test "trivial mutation" (expect 2
(define x 1)
(set! x 2)
x))
(define-test "mutation across branches" (expect 3
(define x 1)
(if (dynamic-false)
(set! x 2)
(set! x 3))
x))
(define-test "mutating unused top-level binding" (expect #!unit
(define x 1)
(set! x 2)))
| false |
a2e1f9e6b73a93adc8365a7b4333d47b004931f7
|
dd4cc30a2e4368c0d350ced7218295819e102fba
|
/vendored_parsers/vendor/tree-sitter-typescript/queries/highlights.scm
|
086e955eee1065478123cbc2dc9ffbd94df1f35b
|
[
"MIT",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] |
permissive
|
Wilfred/difftastic
|
49c87b4feea6ef1b5ab97abdfa823aff6aa7f354
|
a4ee2cf99e760562c3ffbd016a996ff50ef99442
|
refs/heads/master
| 2023-08-28T17:28:55.097192 | 2023-08-27T04:41:41 | 2023-08-27T04:41:41 | 162,276,894 | 14,748 | 287 |
MIT
| 2023-08-26T15:44:44 | 2018-12-18T11:19:45 |
Rust
|
UTF-8
|
Scheme
| false | false | 501 |
scm
|
highlights.scm
|
; Types
(type_identifier) @type
(predefined_type) @type.builtin
((identifier) @type
(#match? @type "^[A-Z]"))
(type_arguments
"<" @punctuation.bracket
">" @punctuation.bracket)
; Variables
(required_parameter (identifier) @variable.parameter)
(optional_parameter (identifier) @variable.parameter)
; Keywords
[ "abstract"
"declare"
"enum"
"export"
"implements"
"interface"
"keyof"
"namespace"
"private"
"protected"
"public"
"type"
"readonly"
"override"
] @keyword
| false |
250f369567f26089fa7201cefca9110840b3b260
|
defeada37d39bca09ef76f66f38683754c0a6aa0
|
/System.Xml/system/xml/schema/xml-schema-white-space-facet.sls
|
9cf7e477b2978c1def2aa5b453174334aa88ac68
|
[] |
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 | 510 |
sls
|
xml-schema-white-space-facet.sls
|
(library (system xml schema xml-schema-white-space-facet)
(export new is? xml-schema-white-space-facet?)
(import (ironscheme-clr-port))
(define-syntax new
(lambda (e)
(syntax-case e ()
((_ a ...)
#'(clr-new
System.Xml.Schema.XmlSchemaWhiteSpaceFacet
a
...)))))
(define (is? a) (clr-is System.Xml.Schema.XmlSchemaWhiteSpaceFacet a))
(define (xml-schema-white-space-facet? a)
(clr-is System.Xml.Schema.XmlSchemaWhiteSpaceFacet a)))
| true |
16127455fcfec9ba94bb96804c165ad377d9d80a
|
5f7a3f1da8e9eb793b2cbb234563730480df6252
|
/spon.ss
|
bbab39ceafda6984b6479c764d6d43379ce213ee
|
[] |
no_license
|
higepon/spon
|
27f73fe7c9daa9cb4cefd4da1fbbac886dac51e9
|
5a9e071aa2ed3ad8f3c378df06ed1a8bd5409a69
|
refs/heads/master
| 2020-04-15T11:55:25.569479 | 2009-12-27T12:36:34 | 2009-12-27T12:49:06 | 128,865 | 8 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 1,189 |
ss
|
spon.ss
|
(import (rnrs)
(srfi :39)
(srfi :48)
(spon tools)
(spon config))
(define (main args)
(case (string->symbol (cadr args))
((install)
(cond
[(null? (cddr args))
(display (format "ERROR ~a: package name not specified\n" system-name)
(current-error-port))
(exit #f)]
[else
(parameterize ((verbose? #f))
(guard (exception
[(download-error? exception)
(format (current-error-port) "\n failed to download package ~a.\n" (download-error-uri exception))]
[else (raise exception)])
(cond
((install (caddr args))
(exit))
(else
(display (format "ERROR ~A: install failed\n" system-name)
(current-error-port))
(exit #f)))))]))
((use)
(let ((impl (caddr args)))
(parameterize ((current-directory library-path))
(command impl (string-append base-path "/setup." impl ".ss")))
(make-symbolic-link (string-append base-path "/spon." impl ".sh") command-path)))
(else (exit #f))))
(main (command-line))
| false |
ce2f6daf47f791d75dbd08f5a438b75097b5cd7b
|
6757c4d87036ecbd3306aa73ceb7e1b42cdd2fce
|
/lib.scm
|
c94de90f699851acac95bdfb28133ae5428e4720
|
[] |
no_license
|
conf8o/scheme-procon-lib
|
be625be1f3242a996f7113b0f2404e5f422322c2
|
12e7e99ab046d5ff5fbf5d4c7916a3af8d94edbd
|
refs/heads/main
| 2023-06-01T01:49:59.701707 | 2021-06-17T02:19:49 | 2021-06-17T02:19:49 | 373,769,307 | 0 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 2,202 |
scm
|
lib.scm
|
(use gauche.lazy)
(use gauche.sequence)
(use util.match)
; 丸め
(define-inline flint floor->exact)
(define-inline ceint ceil->exact)
; キャスト
(define-inline int x->integer)
; bit ビット
(define-inline << ash)
(define-inline & logand)
(define-inline lor logior)
(define-inline xor logxor)
; heap ヒープ 優先度付きキュー
(use data.heap)
(define-inline mh make-binary-heap)
(define-inline hpush! binary-heap-push!)
(define-inline hpop-min! binary-heap-pop-min!)
(define-inline hpop-max! binary-heap-pop-max!)
(define-inline heapify build-binary-heap)
; ring-buffer リングバッファ Deque deque
(use data.ring-buffer)
(define-inline mdq make-ring-buffer)
(define-inline add-front! ring-buffer-add-front!)
(define-inline add-back! ring-buffer-add-back!)
(define-inline remove-front! ring-buffer-remove-front!)
(define-inline remove-back! ring-buffer-remove-back!)
; Counter
(define (counter seq :optional (comp 'equal?))
(fold
(lambda (x col)
(hash-table-set! col x (+ 1 (hash-table-get col x 0)))
col)
(make-hash-table comp)
seq))
; メモ化
(define (memoize f)
(let ([cache (make-hash-table equal-comparator)])
(lambda x
(or (hash-table-get cache x #f)
(let ([result (apply f x)])
(hash-table-put! cache x result)
result)))))
(define-syntax define-memo
; パターンマッチ
(syntax-rules ()
((_ f expr ...)
(define f (memoize
(match-lambda* expr ...))))))
; (define-memo fib
; [(0) 0]
; [(1) 1]
; [(n) (+ (fib (- n 1)) (fib (- n 2)))])
; 整数論
; gcd, lcm
; 素数
(use math.prime)
; prime
; (take *primes* n)
; naive-factorize, small-prime?(341,550,071,728,321まで)
; 約数
(define (ldivisors n)
(lconcatenate
(lfilter-map
(lambda (i)
(cond
[(= n (* i i)) (list i)]
[(zero? (remainder n i)) (list i (exact (/ n i)))]
[else #f]))
(ltake-while
(lambda (i) (>= n (* i i)))
(lrange 1)))))
(define (divisors n :optional (sort? #t))
(let ([divs (ldivisors n)])
(if sort? (sort divs) (apply list divs))))
; 組合せ論
(use util.combinations)
; permutaions combinations power-set cartesian-product(直積)
| true |
7a7792208de30e19dea62ebab7291018ef6fae42
|
3c9983e012653583841b51ddfd82879fe82706fb
|
/r2/parsetng.scm
|
9d7154d980eca0fe26d6528771e4236bde8be1b0
|
[] |
no_license
|
spdegabrielle/smalltalk-tng
|
3c3d4cffa09541b75524fb1f102c7c543a84a807
|
545343190f556edd659f6050b98036266a270763
|
refs/heads/master
| 2020-04-16T17:06:51.884611 | 2018-08-07T16:18:20 | 2018-08-07T16:18:20 | 165,763,183 | 1 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 6,648 |
scm
|
parsetng.scm
|
(define (port-results filename p)
(base-generator->results
(let ((ateof #f)
(pos (top-parse-position filename)))
(lambda ()
(if ateof
(values pos #f)
(let ((x (read-char p)))
(if (eof-object? x)
(begin
(set! ateof #t)
(values pos #f))
(let ((old-pos pos))
(set! pos (update-parse-position pos x))
(values old-pos (cons x x))))))))))
(define (string-results filename s)
(base-generator->results
(let ((idx 0)
(len (string-length s))
(pos (top-parse-position filename)))
(lambda ()
(if (= idx len)
(values pos #f)
(let ((x (string-ref s idx))
(old-pos pos))
(set! pos (update-parse-position pos x))
(set! idx (+ idx 1))
(values old-pos (cons x x))))))))
(define (parse-result->value error-text result)
(if (parse-result-successful? result)
(parse-result-semantic-value result)
(error error-text
(let ((e (parse-result-error result)))
(list error-text
(parse-position->string (parse-error-position e))
(parse-error-expected e)
(parse-error-messages e))))))
(define (packrat-token str)
(lambda (starting-results)
(let loop ((pos 0) (results starting-results))
(if (= pos (string-length str))
(make-result str results)
(if (and results (char=? (parse-results-token-value results) (string-ref str pos)))
(loop (+ pos 1) (parse-results-next results))
(make-expected-result (parse-results-position starting-results) str))))))
(define (parse-results-take results n)
(let loop ((acc '())
(results results)
(n n))
(if (zero? n)
(values (list->string (reverse acc))
results)
(loop (cons (parse-results-token-value results) acc)
(parse-results-next results)
(- n 1)))))
(define (parse-results->pregexp-stream results)
(pregexp-make-stream (lambda (r)
(if r
(cons (parse-results-token-value r)
(parse-results-next r))
(cons #f #f)))
results))
(define (packrat-regex name . string-fragments)
(let* ((exp (string-concatenate string-fragments))
(re (pregexp exp)))
(lambda (results)
(let* ((stream (parse-results->pregexp-stream results))
(match (pregexp-match-head re stream)))
(if match
(let-values (((str next) (parse-results-take results (cdar match))))
(make-result str next))
(make-expected-result (parse-results-position results) name))))))
(define (packrat-cache key parser)
(lambda (results)
(results->result results key
(lambda ()
(parser results)))))
(define-syntax define-packrat-cached
(syntax-rules ()
((_ (fnname results) body ...)
(define fnname
(packrat-cache 'fnname
(letrec ((fnname (lambda (results) body ...)))
fnname))))
((_ fnname exp)
(define fnname
(packrat-cache 'fnname exp)))))
(define-values (parse-ThiNG parse-ThiNG-toplevel)
(let* ((p "[-+=_|/?.<>*&^%$#@!`~]")
(midsym (string-append "([a-zA-Z0-9]|"p")")))
(packrat-parser (begin
(define-packrat-cached (white results)
(if (and-let* ((ch (parse-results-token-value results)))
(char-whitespace? ch))
(white (parse-results-next results))
(comment results)))
(define-packrat-cached (comment results)
(if (eq? (parse-results-token-value results) #\")
(skip-comment-body (parse-results-next results))
(make-result 'whitespace results)))
(define (skip-comment-body results)
(if (eq? (parse-results-token-value results) #\")
(white (parse-results-next results))
(skip-comment-body (parse-results-next results))))
(define (string-body results)
(string-body* results '()))
(define (string-body* results acc)
(let ((ch (parse-results-token-value results))
(next (parse-results-next results)))
(if (eq? ch #\')
(string-body-quote next acc)
(string-body* next (cons ch acc)))))
(define (string-body-quote results acc)
(if (eq? (parse-results-token-value results) #\')
(string-body* (parse-results-next results) (cons #\' acc))
(make-result (list->string (reverse acc)) results)))
(define-packrat-cached atom (packrat-regex 'atom "[A-Z]"midsym"*"))
(define-packrat-cached var (packrat-regex 'var "[a-z]"midsym"*"))
(define-packrat-cached infixop-raw (packrat-regex 'infixop p midsym"*"))
(define-packrat-cached integer (packrat-regex 'integer "[0-9]+"))
(define (make-binary op left right)
`(adj ,op (tuple ,left ,right)))
(values tuple1 toplevel))
(toplevel ((d <- tuple1 white '#\; '#\;) d)
((white '#f) `(atom |Quit|)))
(datum ((s <- tuple0) s))
(tuple0 ((s <- tuple1) s)
(() '(tuple)))
(tuple1 ((s <- tuple1*) (if (= (length s) 2) (cadr s) s)))
(tuple1* ((d <- fun white '#\, s <- tuple1*) `(tuple ,d ,@(cdr s)))
((d <- fun) `(tuple ,d)))
(fun ((f <- fun*) f)
((v <- funcall f <- fun*) `(adj ,v (quote ,f)))
((v <- funcall) v))
(fun* ((e <- entry white d <- fun*) `(fun ,e ,@(cdr d)))
((e <- entry) `(fun ,e)))
(entry ((k <- simple colon v <- funcall) (list k v)))
(semi ((white '#\; (! '#\;)) 'semi))
(colon ((white '#\:) 'colon))
(funcall ((a <- adj f <- funcall*) (f a)))
(funcall* ((o <- infixop b <- adj f <- funcall*)
(lambda (a) (f (make-binary o a b))))
(() (lambda (a) a)))
(infixop ((white r <- infixop-raw) `(var ,(string->symbol r))))
(adj ((left <- adj-leaf f <- adj-tail) (f left)))
(adj-tail ((white right <- adj-leaf f <- adj-tail)
(lambda (left) (f `(adj ,left ,right))))
(() (lambda (left) left)))
(adj-leaf ((v <- simple (! colon)) v))
(simple ((white d1 <- simple1) d1))
(simple1 (('#\( o <- infixop white '#\)) o)
(('#\( d <- datum white '#\)) d)
(('#\[ d <- datum white '#\]) `(quote ,d))
(('#\{ d <- datum white '#\}) `(meta-quote ,d))
((l <- literal) `(lit ,l))
((a <- var) `(var ,(string->symbol a)))
((a <- atom) `(atom ,(string->symbol a)))
(('#\' s <- string-body) `(atom ,(string->symbol s)))
(('#\_) `(discard)))
(literal ((i <- integer) (string->number i))
(('#\- i <- integer) (- (string->number i)))))))
(define read-ThiNG
(lambda ()
(parse-result->value "While parsing ThiNG"
(parse-ThiNG-toplevel (port-results "stdin" (current-input-port))))))
(define string->ThiNG
(lambda (s)
(parse-result->value "While parsing ThiNG"
(parse-ThiNG (string-results "<string>" s)))))
| true |
3bfa4b8f7032d15af4fac3fb27eaaef74117b3ad
|
382706a62fae6f24855ab689b8b2d87c6a059fb6
|
/0.2/src/read.scm
|
ca1f440e084e4502801f474a8cc8abf51fdd4d01
|
[
"Apache-2.0"
] |
permissive
|
mstram/bard
|
ddb1e72a78059617403bea1842840bb9e979198e
|
340d6919603a30c7944fb66e04df0562180bc0bb
|
refs/heads/master
| 2021-01-21T00:12:27.174597 | 2014-07-10T13:20:39 | 2014-07-10T13:20:39 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 6,057 |
scm
|
read.scm
|
;;;; ***********************************************************************
;;;; FILE IDENTIFICATION
;;;;
;;;; Name: read.scm
;;;; Project: Bard
;;;; Purpose: bard reader
;;;; Author: mikel evins
;;;; Copyright: 2012 by mikel evins
;;;;
;;;; ***********************************************************************
;;;; extracted from Gambit's lib/_io#.scm so it can be used and modified
;;;; without the large overhead of including all of gambit#.scm
;;;----------------------------------------------------------------------------
;;; Representation of readtables.
(define-type readtable
id: bebee95d-0da2-401d-a33a-c1afc75b9e43
type-exhibitor: macro-type-readtable
constructor: macro-make-readtable
implementer: implement-type-readtable
macros:
prefix: macro-
opaque:
(case-conversion? unprintable: read-write:)
(keywords-allowed? unprintable: read-write:)
(escaped-char-table unprintable: read-write:)
(named-char-table unprintable: read-write:)
(sharp-bang-table unprintable: read-write:)
(char-delimiter?-table unprintable: read-write:)
(char-handler-table unprintable: read-write:)
(char-sharp-handler-table unprintable: read-write:)
(max-unescaped-char unprintable: read-write:)
(escape-ctrl-chars? unprintable: read-write:)
(sharing-allowed? unprintable: read-write:)
(eval-allowed? unprintable: read-write:)
(write-extended-read-macros? unprintable: read-write:)
(write-cdr-read-macros? unprintable: read-write:)
(max-write-level unprintable: read-write:)
(max-write-length unprintable: read-write:)
(pretty-print-formats unprintable: read-write:)
(quote-keyword unprintable: read-write:)
(quasiquote-keyword unprintable: read-write:)
(unquote-keyword unprintable: read-write:)
(unquote-splicing-keyword unprintable: read-write:)
(sharp-quote-keyword unprintable: read-write:)
(sharp-quasiquote-keyword unprintable: read-write:)
(sharp-unquote-keyword unprintable: read-write:)
(sharp-unquote-splicing-keyword unprintable: read-write:)
(sharp-num-keyword unprintable: read-write:)
(sharp-seq-keyword unprintable: read-write:)
(paren-keyword unprintable: read-write:)
(bracket-keyword unprintable: read-write:)
(brace-keyword unprintable: read-write:)
(angle-keyword unprintable: read-write:)
(start-syntax unprintable: read-write:)
(six-type? unprintable: read-write:)
(r6rs-compatible-read? unprintable: read-write:)
(r6rs-compatible-write? unprintable: read-write:)
(here-strings-allowed? unprintable: read-write:)
)
;;;---------------------------------------------------------------------
;;; the Bard readtable
;;;---------------------------------------------------------------------
(define (bard:make-readtable)
(let ((rt (##make-standard-readtable)))
(readtable-keywords-allowed?-set rt #t)
(macro-readtable-bracket-keyword-set! rt 'list)
(macro-readtable-brace-keyword-set! rt 'frame)
rt))
(define +bard-readtable+ (bard:make-readtable))
;;; ----------------------------------------------------------------------
;;; the reader
;;; ----------------------------------------------------------------------
(define (%read-cons val)
(cond
((null? val) (%nothing))
((eq? 'list (car val)) (%cons 'list (%read-cons (cdr val))))
((eq? 'frame (car val)) (%cons 'frame (%read-cons (cdr val))))
(else (let loop ((items val)
(ls %nil))
(if (null? items)
ls
(loop (cdr items)
(%append ls (%list (%read-value->bard-value (car items))))))))))
(define (%read-value->bard-value val)
(cond
((null? val)(%nothing))
((eq? 'undefined val)(%undefined))
((eq? 'nothing val)(%nothing))
((eq? 'true val)(%true))
((eq? 'false val)(%false))
((pair? val)(%read-cons val))
(else val)))
(define (bard:read #!optional port)
(let ((original-readtable (input-port-readtable port)))
(dynamic-wind
(lambda ()(input-port-readtable-set! port +bard-readtable+))
(lambda ()(let ((port (or port (current-input-port))))
(%read-value->bard-value (read port))))
(lambda ()(input-port-readtable-set! port original-readtable)))))
(define (bard:read-from-string s)
(call-with-input-string s (lambda (in)(bard:read in))))
;;; (show (bard:read-from-string "undefined"))
;;; (show (bard:read-from-string "nothing"))
;;; (show (bard:read-from-string "true"))
;;; (show (bard:read-from-string "false"))
;;; (show (bard:read-from-string "5"))
;;; (show (bard:read-from-string "5.4"))
;;; (show (bard:read-from-string "5/4"))
;;; (show (bard:read-from-string "888888888"))
;;; (show (bard:read-from-string "#\\C"))
;;; (show (bard:read-from-string "#\\space"))
;;; (show (bard:read-from-string "#\\u0041"))
;;; (show (bard:read-from-string "\"Fred and Barney\""))
;;; (show (bard:read-from-string "Fred"))
;;; (show (bard:read-from-string "name:"))
;;; (show (bard:read-from-string "(list 0 1 2 3)"))
;;; (show (bard:read-from-string "[0 1 2 3]"))
;;; (show (bard:read-from-string "{a: 1 b: 2 c: [1 2 3]}"))
;;; (show (bard:read-from-string "{a: 1 b: [1 2 3]}"))
;;; (show (bard:read-from-string "{0 1 2 3 4 {a: 1 b: 2}}"))
;;; (show (bard:read-from-string "{0 1 2 3 4 [01 2 3] 5 {a: 1 b: 2}}"))
;;; (show (bard:read-from-string "{name: 'test age: 101 friends: ['a 'b 'c]}"))
;;; (show (%eval (bard:read-from-string "{name: 'test age: 101 friends: ['a 'b 'c]}")))
;;; (show (%frame-get (%eval (bard:read-from-string "{name: 'test age: 101 friends: ['a 'b 'c]}")) friends:))
;;; (show (%eval (bard:read-from-string "(list 0 1 2 3 4 5)")))
| false |
f89fce9b2b3bd86c7eb4933336727114bddfc718
|
ab05b79ab17619f548d9762a46199dc9eed6b3e9
|
/sitelib/ypsilon/gtk/recent.scm
|
681da15ccb91a6f6eda2da2219db7626ee584513
|
[
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
lambdaconservatory/ypsilon
|
2dce9ff4b5a50453937340bc757697b9b4839dee
|
f154436db2b3c0629623eb2a53154ad3c50270a1
|
refs/heads/master
| 2021-02-28T17:44:05.571304 | 2017-12-17T12:29:00 | 2020-03-08T12:57:52 | 245,719,032 | 1 | 0 |
NOASSERTION
| 2020-03-07T23:08:26 | 2020-03-07T23:08:25 | null |
UTF-8
|
Scheme
| false | false | 20,909 |
scm
|
recent.scm
|
#!nobacktrace
;;; Ypsilon Scheme System
;;; Copyright (c) 2004-2009 Y.FUJITA / LittleWing Company Limited.
;;; See license.txt for terms and conditions of use.
(library (ypsilon gtk recent)
(export gtk_recent_action_get_show_numbers
gtk_recent_action_get_type
gtk_recent_action_new
gtk_recent_action_new_for_manager
gtk_recent_action_set_show_numbers
gtk_recent_chooser_add_filter
gtk_recent_chooser_dialog_get_type
gtk_recent_chooser_dialog_new
gtk_recent_chooser_dialog_new_for_manager
gtk_recent_chooser_error_get_type
gtk_recent_chooser_error_quark
gtk_recent_chooser_get_current_item
gtk_recent_chooser_get_current_uri
gtk_recent_chooser_get_filter
gtk_recent_chooser_get_items
gtk_recent_chooser_get_limit
gtk_recent_chooser_get_local_only
gtk_recent_chooser_get_select_multiple
gtk_recent_chooser_get_show_icons
gtk_recent_chooser_get_show_not_found
gtk_recent_chooser_get_show_private
gtk_recent_chooser_get_show_tips
gtk_recent_chooser_get_sort_type
gtk_recent_chooser_get_type
gtk_recent_chooser_get_uris
gtk_recent_chooser_list_filters
gtk_recent_chooser_menu_get_show_numbers
gtk_recent_chooser_menu_get_type
gtk_recent_chooser_menu_new
gtk_recent_chooser_menu_new_for_manager
gtk_recent_chooser_menu_set_show_numbers
gtk_recent_chooser_remove_filter
gtk_recent_chooser_select_all
gtk_recent_chooser_select_uri
gtk_recent_chooser_set_current_uri
gtk_recent_chooser_set_filter
gtk_recent_chooser_set_limit
gtk_recent_chooser_set_local_only
gtk_recent_chooser_set_select_multiple
gtk_recent_chooser_set_show_icons
gtk_recent_chooser_set_show_not_found
gtk_recent_chooser_set_show_private
gtk_recent_chooser_set_show_tips
gtk_recent_chooser_set_sort_func
gtk_recent_chooser_set_sort_type
gtk_recent_chooser_unselect_all
gtk_recent_chooser_unselect_uri
gtk_recent_chooser_widget_get_type
gtk_recent_chooser_widget_new
gtk_recent_chooser_widget_new_for_manager
gtk_recent_filter_add_age
gtk_recent_filter_add_application
gtk_recent_filter_add_custom
gtk_recent_filter_add_group
gtk_recent_filter_add_mime_type
gtk_recent_filter_add_pattern
gtk_recent_filter_add_pixbuf_formats
gtk_recent_filter_filter
gtk_recent_filter_flags_get_type
gtk_recent_filter_get_name
gtk_recent_filter_get_needed
gtk_recent_filter_get_type
gtk_recent_filter_new
gtk_recent_filter_set_name
gtk_recent_info_exists
gtk_recent_info_get_added
gtk_recent_info_get_age
gtk_recent_info_get_application_info
gtk_recent_info_get_applications
gtk_recent_info_get_description
gtk_recent_info_get_display_name
gtk_recent_info_get_groups
gtk_recent_info_get_icon
gtk_recent_info_get_mime_type
gtk_recent_info_get_modified
gtk_recent_info_get_private_hint
gtk_recent_info_get_short_name
gtk_recent_info_get_type
gtk_recent_info_get_uri
gtk_recent_info_get_uri_display
gtk_recent_info_get_visited
gtk_recent_info_has_application
gtk_recent_info_has_group
gtk_recent_info_is_local
gtk_recent_info_last_application
gtk_recent_info_match
gtk_recent_info_ref
gtk_recent_info_unref
gtk_recent_manager_add_full
gtk_recent_manager_add_item
gtk_recent_manager_error_get_type
gtk_recent_manager_error_quark
gtk_recent_manager_get_default
gtk_recent_manager_get_items
gtk_recent_manager_get_limit
gtk_recent_manager_get_type
gtk_recent_manager_has_item
gtk_recent_manager_lookup_item
gtk_recent_manager_move_item
gtk_recent_manager_new
gtk_recent_manager_purge_items
gtk_recent_manager_remove_item
gtk_recent_manager_set_limit
gtk_recent_sort_type_get_type)
(import (rnrs) (ypsilon ffi))
(define lib-name
(cond (on-linux "libgtk-x11-2.0.so.0")
(on-sunos "libgtk-x11-2.0.so.0")
(on-freebsd "libgtk-x11-2.0.so.0")
(on-openbsd "libgtk-x11-2.0.so.0")
(on-darwin "Gtk.framework/Gtk")
(on-windows "libgtk-win32-2.0-0.dll")
(else
(assertion-violation #f "can not locate GTK library, unknown operating system"))))
(define lib (load-shared-object lib-name))
(define-syntax define-function
(syntax-rules ()
((_ ret name args)
(define name (c-function lib lib-name ret name args)))))
(define-syntax define-function/va_list
(syntax-rules ()
((_ ret name args)
(define name (lambda x (assertion-violation 'name "va_list argument not supported"))))))
;; gboolean gtk_recent_action_get_show_numbers (GtkRecentAction* action)
(define-function int gtk_recent_action_get_show_numbers (void*))
;; GType gtk_recent_action_get_type (void)
(define-function unsigned-long gtk_recent_action_get_type ())
;; GtkAction* gtk_recent_action_new (const gchar* name, const gchar* label, const gchar* tooltip, const gchar* stock_id)
(define-function void* gtk_recent_action_new (char* char* char* char*))
;; GtkAction* gtk_recent_action_new_for_manager (const gchar* name, const gchar* label, const gchar* tooltip, const gchar* stock_id, GtkRecentManager* manager)
(define-function void* gtk_recent_action_new_for_manager (char* char* char* char* void*))
;; void gtk_recent_action_set_show_numbers (GtkRecentAction* action, gboolean show_numbers)
(define-function void gtk_recent_action_set_show_numbers (void* int))
;; void gtk_recent_chooser_add_filter (GtkRecentChooser* chooser, GtkRecentFilter* filter)
(define-function void gtk_recent_chooser_add_filter (void* void*))
;; GType gtk_recent_chooser_dialog_get_type (void)
(define-function unsigned-long gtk_recent_chooser_dialog_get_type ())
;; GtkWidget* gtk_recent_chooser_dialog_new (const gchar* title, GtkWindow* parent, const gchar* first_button_text, ...)
(define-function void* gtk_recent_chooser_dialog_new (char* void* char* ...))
;; GtkWidget* gtk_recent_chooser_dialog_new_for_manager (const gchar* title, GtkWindow* parent, GtkRecentManager* manager, const gchar* first_button_text, ...)
(define-function void* gtk_recent_chooser_dialog_new_for_manager (char* void* void* char* ...))
;; GType gtk_recent_chooser_error_get_type (void)
(define-function unsigned-long gtk_recent_chooser_error_get_type ())
;; GQuark gtk_recent_chooser_error_quark (void)
(define-function uint32_t gtk_recent_chooser_error_quark ())
;; GtkRecentInfo* gtk_recent_chooser_get_current_item (GtkRecentChooser* chooser)
(define-function void* gtk_recent_chooser_get_current_item (void*))
;; gchar* gtk_recent_chooser_get_current_uri (GtkRecentChooser* chooser)
(define-function char* gtk_recent_chooser_get_current_uri (void*))
;; GtkRecentFilter* gtk_recent_chooser_get_filter (GtkRecentChooser* chooser)
(define-function void* gtk_recent_chooser_get_filter (void*))
;; GList* gtk_recent_chooser_get_items (GtkRecentChooser* chooser)
(define-function void* gtk_recent_chooser_get_items (void*))
;; gint gtk_recent_chooser_get_limit (GtkRecentChooser* chooser)
(define-function int gtk_recent_chooser_get_limit (void*))
;; gboolean gtk_recent_chooser_get_local_only (GtkRecentChooser* chooser)
(define-function int gtk_recent_chooser_get_local_only (void*))
;; gboolean gtk_recent_chooser_get_select_multiple (GtkRecentChooser* chooser)
(define-function int gtk_recent_chooser_get_select_multiple (void*))
;; gboolean gtk_recent_chooser_get_show_icons (GtkRecentChooser* chooser)
(define-function int gtk_recent_chooser_get_show_icons (void*))
;; gboolean gtk_recent_chooser_get_show_not_found (GtkRecentChooser* chooser)
(define-function int gtk_recent_chooser_get_show_not_found (void*))
;; gboolean gtk_recent_chooser_get_show_private (GtkRecentChooser* chooser)
(define-function int gtk_recent_chooser_get_show_private (void*))
;; gboolean gtk_recent_chooser_get_show_tips (GtkRecentChooser* chooser)
(define-function int gtk_recent_chooser_get_show_tips (void*))
;; GtkRecentSortType gtk_recent_chooser_get_sort_type (GtkRecentChooser* chooser)
(define-function int gtk_recent_chooser_get_sort_type (void*))
;; GType gtk_recent_chooser_get_type (void)
(define-function unsigned-long gtk_recent_chooser_get_type ())
;; gchar** gtk_recent_chooser_get_uris (GtkRecentChooser* chooser, gsize* length)
(define-function void* gtk_recent_chooser_get_uris (void* void*))
;; GSList* gtk_recent_chooser_list_filters (GtkRecentChooser* chooser)
(define-function void* gtk_recent_chooser_list_filters (void*))
;; gboolean gtk_recent_chooser_menu_get_show_numbers (GtkRecentChooserMenu* menu)
(define-function int gtk_recent_chooser_menu_get_show_numbers (void*))
;; GType gtk_recent_chooser_menu_get_type (void)
(define-function unsigned-long gtk_recent_chooser_menu_get_type ())
;; GtkWidget* gtk_recent_chooser_menu_new (void)
(define-function void* gtk_recent_chooser_menu_new ())
;; GtkWidget* gtk_recent_chooser_menu_new_for_manager (GtkRecentManager* manager)
(define-function void* gtk_recent_chooser_menu_new_for_manager (void*))
;; void gtk_recent_chooser_menu_set_show_numbers (GtkRecentChooserMenu* menu, gboolean show_numbers)
(define-function void gtk_recent_chooser_menu_set_show_numbers (void* int))
;; void gtk_recent_chooser_remove_filter (GtkRecentChooser* chooser, GtkRecentFilter* filter)
(define-function void gtk_recent_chooser_remove_filter (void* void*))
;; void gtk_recent_chooser_select_all (GtkRecentChooser* chooser)
(define-function void gtk_recent_chooser_select_all (void*))
;; gboolean gtk_recent_chooser_select_uri (GtkRecentChooser* chooser, const gchar* uri, GError** error)
(define-function int gtk_recent_chooser_select_uri (void* char* void*))
;; gboolean gtk_recent_chooser_set_current_uri (GtkRecentChooser* chooser, const gchar* uri, GError** error)
(define-function int gtk_recent_chooser_set_current_uri (void* char* void*))
;; void gtk_recent_chooser_set_filter (GtkRecentChooser* chooser, GtkRecentFilter* filter)
(define-function void gtk_recent_chooser_set_filter (void* void*))
;; void gtk_recent_chooser_set_limit (GtkRecentChooser* chooser, gint limit)
(define-function void gtk_recent_chooser_set_limit (void* int))
;; void gtk_recent_chooser_set_local_only (GtkRecentChooser* chooser, gboolean local_only)
(define-function void gtk_recent_chooser_set_local_only (void* int))
;; void gtk_recent_chooser_set_select_multiple (GtkRecentChooser* chooser, gboolean select_multiple)
(define-function void gtk_recent_chooser_set_select_multiple (void* int))
;; void gtk_recent_chooser_set_show_icons (GtkRecentChooser* chooser, gboolean show_icons)
(define-function void gtk_recent_chooser_set_show_icons (void* int))
;; void gtk_recent_chooser_set_show_not_found (GtkRecentChooser* chooser, gboolean show_not_found)
(define-function void gtk_recent_chooser_set_show_not_found (void* int))
;; void gtk_recent_chooser_set_show_private (GtkRecentChooser* chooser, gboolean show_private)
(define-function void gtk_recent_chooser_set_show_private (void* int))
;; void gtk_recent_chooser_set_show_tips (GtkRecentChooser* chooser, gboolean show_tips)
(define-function void gtk_recent_chooser_set_show_tips (void* int))
;; void gtk_recent_chooser_set_sort_func (GtkRecentChooser* chooser, GtkRecentSortFunc sort_func, gpointer sort_data, GDestroyNotify data_destroy)
(define-function void gtk_recent_chooser_set_sort_func (void* (c-callback int (void* void* void*)) void* (c-callback void (void*))))
;; void gtk_recent_chooser_set_sort_type (GtkRecentChooser* chooser, GtkRecentSortType sort_type)
(define-function void gtk_recent_chooser_set_sort_type (void* int))
;; void gtk_recent_chooser_unselect_all (GtkRecentChooser* chooser)
(define-function void gtk_recent_chooser_unselect_all (void*))
;; void gtk_recent_chooser_unselect_uri (GtkRecentChooser* chooser, const gchar* uri)
(define-function void gtk_recent_chooser_unselect_uri (void* char*))
;; GType gtk_recent_chooser_widget_get_type (void)
(define-function unsigned-long gtk_recent_chooser_widget_get_type ())
;; GtkWidget* gtk_recent_chooser_widget_new (void)
(define-function void* gtk_recent_chooser_widget_new ())
;; GtkWidget* gtk_recent_chooser_widget_new_for_manager (GtkRecentManager* manager)
(define-function void* gtk_recent_chooser_widget_new_for_manager (void*))
;; void gtk_recent_filter_add_age (GtkRecentFilter* filter, gint days)
(define-function void gtk_recent_filter_add_age (void* int))
;; void gtk_recent_filter_add_application (GtkRecentFilter* filter, const gchar* application)
(define-function void gtk_recent_filter_add_application (void* char*))
;; void gtk_recent_filter_add_custom (GtkRecentFilter* filter, GtkRecentFilterFlags needed, GtkRecentFilterFunc func, gpointer data, GDestroyNotify data_destroy)
(define-function void gtk_recent_filter_add_custom (void* int (c-callback int (void* void*)) void* (c-callback void (void*))))
;; void gtk_recent_filter_add_group (GtkRecentFilter* filter, const gchar* group)
(define-function void gtk_recent_filter_add_group (void* char*))
;; void gtk_recent_filter_add_mime_type (GtkRecentFilter* filter, const gchar* mime_type)
(define-function void gtk_recent_filter_add_mime_type (void* char*))
;; void gtk_recent_filter_add_pattern (GtkRecentFilter* filter, const gchar* pattern)
(define-function void gtk_recent_filter_add_pattern (void* char*))
;; void gtk_recent_filter_add_pixbuf_formats (GtkRecentFilter* filter)
(define-function void gtk_recent_filter_add_pixbuf_formats (void*))
;; gboolean gtk_recent_filter_filter (GtkRecentFilter* filter, const GtkRecentFilterInfo* filter_info)
(define-function int gtk_recent_filter_filter (void* void*))
;; GType gtk_recent_filter_flags_get_type (void)
(define-function unsigned-long gtk_recent_filter_flags_get_type ())
;; const gchar* gtk_recent_filter_get_name (GtkRecentFilter* filter)
(define-function char* gtk_recent_filter_get_name (void*))
;; GtkRecentFilterFlags gtk_recent_filter_get_needed (GtkRecentFilter* filter)
(define-function int gtk_recent_filter_get_needed (void*))
;; GType gtk_recent_filter_get_type (void)
(define-function unsigned-long gtk_recent_filter_get_type ())
;; GtkRecentFilter* gtk_recent_filter_new (void)
(define-function void* gtk_recent_filter_new ())
;; void gtk_recent_filter_set_name (GtkRecentFilter* filter, const gchar* name)
(define-function void gtk_recent_filter_set_name (void* char*))
;; gboolean gtk_recent_info_exists (GtkRecentInfo* info)
(define-function int gtk_recent_info_exists (void*))
;; time_t gtk_recent_info_get_added (GtkRecentInfo* info)
(define-function long gtk_recent_info_get_added (void*))
;; gint gtk_recent_info_get_age (GtkRecentInfo* info)
(define-function int gtk_recent_info_get_age (void*))
;; gboolean gtk_recent_info_get_application_info (GtkRecentInfo* info, const gchar* app_name, gchar** app_exec, guint* count, time_t* time_)
(define-function int gtk_recent_info_get_application_info (void* char* void* void* void*))
;; gchar** gtk_recent_info_get_applications (GtkRecentInfo* info, gsize* length)
(define-function void* gtk_recent_info_get_applications (void* void*))
;; const gchar* gtk_recent_info_get_description (GtkRecentInfo* info)
(define-function char* gtk_recent_info_get_description (void*))
;; const gchar* gtk_recent_info_get_display_name (GtkRecentInfo* info)
(define-function char* gtk_recent_info_get_display_name (void*))
;; gchar** gtk_recent_info_get_groups (GtkRecentInfo* info, gsize* length)
(define-function void* gtk_recent_info_get_groups (void* void*))
;; GdkPixbuf* gtk_recent_info_get_icon (GtkRecentInfo* info, gint size)
(define-function void* gtk_recent_info_get_icon (void* int))
;; const gchar* gtk_recent_info_get_mime_type (GtkRecentInfo* info)
(define-function char* gtk_recent_info_get_mime_type (void*))
;; time_t gtk_recent_info_get_modified (GtkRecentInfo* info)
(define-function long gtk_recent_info_get_modified (void*))
;; gboolean gtk_recent_info_get_private_hint (GtkRecentInfo* info)
(define-function int gtk_recent_info_get_private_hint (void*))
;; gchar* gtk_recent_info_get_short_name (GtkRecentInfo* info)
(define-function char* gtk_recent_info_get_short_name (void*))
;; GType gtk_recent_info_get_type (void)
(define-function unsigned-long gtk_recent_info_get_type ())
;; const gchar* gtk_recent_info_get_uri (GtkRecentInfo* info)
(define-function char* gtk_recent_info_get_uri (void*))
;; gchar* gtk_recent_info_get_uri_display (GtkRecentInfo* info)
(define-function char* gtk_recent_info_get_uri_display (void*))
;; time_t gtk_recent_info_get_visited (GtkRecentInfo* info)
(define-function long gtk_recent_info_get_visited (void*))
;; gboolean gtk_recent_info_has_application (GtkRecentInfo* info, const gchar* app_name)
(define-function int gtk_recent_info_has_application (void* char*))
;; gboolean gtk_recent_info_has_group (GtkRecentInfo* info, const gchar* group_name)
(define-function int gtk_recent_info_has_group (void* char*))
;; gboolean gtk_recent_info_is_local (GtkRecentInfo* info)
(define-function int gtk_recent_info_is_local (void*))
;; gchar* gtk_recent_info_last_application (GtkRecentInfo* info)
(define-function char* gtk_recent_info_last_application (void*))
;; gboolean gtk_recent_info_match (GtkRecentInfo* info_a, GtkRecentInfo* info_b)
(define-function int gtk_recent_info_match (void* void*))
;; GtkRecentInfo* gtk_recent_info_ref (GtkRecentInfo* info)
(define-function void* gtk_recent_info_ref (void*))
;; void gtk_recent_info_unref (GtkRecentInfo* info)
(define-function void gtk_recent_info_unref (void*))
;; gboolean gtk_recent_manager_add_full (GtkRecentManager* manager, const gchar* uri, const GtkRecentData* recent_data)
(define-function int gtk_recent_manager_add_full (void* char* void*))
;; gboolean gtk_recent_manager_add_item (GtkRecentManager* manager, const gchar* uri)
(define-function int gtk_recent_manager_add_item (void* char*))
;; GType gtk_recent_manager_error_get_type (void)
(define-function unsigned-long gtk_recent_manager_error_get_type ())
;; GQuark gtk_recent_manager_error_quark (void)
(define-function uint32_t gtk_recent_manager_error_quark ())
;; GtkRecentManager* gtk_recent_manager_get_default (void)
(define-function void* gtk_recent_manager_get_default ())
;; GList* gtk_recent_manager_get_items (GtkRecentManager* manager)
(define-function void* gtk_recent_manager_get_items (void*))
;; gint gtk_recent_manager_get_limit (GtkRecentManager* manager)
(define-function int gtk_recent_manager_get_limit (void*))
;; GType gtk_recent_manager_get_type (void)
(define-function unsigned-long gtk_recent_manager_get_type ())
;; gboolean gtk_recent_manager_has_item (GtkRecentManager* manager, const gchar* uri)
(define-function int gtk_recent_manager_has_item (void* char*))
;; GtkRecentInfo* gtk_recent_manager_lookup_item (GtkRecentManager* manager, const gchar* uri, GError** error)
(define-function void* gtk_recent_manager_lookup_item (void* char* void*))
;; gboolean gtk_recent_manager_move_item (GtkRecentManager* manager, const gchar* uri, const gchar* new_uri, GError** error)
(define-function int gtk_recent_manager_move_item (void* char* char* void*))
;; GtkRecentManager* gtk_recent_manager_new (void)
(define-function void* gtk_recent_manager_new ())
;; gint gtk_recent_manager_purge_items (GtkRecentManager* manager, GError** error)
(define-function int gtk_recent_manager_purge_items (void* void*))
;; gboolean gtk_recent_manager_remove_item (GtkRecentManager* manager, const gchar* uri, GError** error)
(define-function int gtk_recent_manager_remove_item (void* char* void*))
;; void gtk_recent_manager_set_limit (GtkRecentManager* manager, gint limit)
(define-function void gtk_recent_manager_set_limit (void* int))
;; GType gtk_recent_sort_type_get_type (void)
(define-function unsigned-long gtk_recent_sort_type_get_type ())
) ;[end]
| true |
42f67a47031b2a933a99edb0d7b0d99f0b6e8575
|
a6586e673e0c2732e96571467b117be5472c7983
|
/a1.scm
|
1e4be680c7d2a33e86067cf219c0567c5ba94ae3
|
[
"MIT"
] |
permissive
|
gentaiscool/chicken-scheme
|
572450711f8a19d1a8ba788de56aa74d0a6514a6
|
76a640ee11c51a472952a881fdb0d56c8ba19ecc
|
refs/heads/master
| 2020-03-18T12:08:13.766847 | 2018-06-06T14:38:12 | 2018-06-06T14:38:12 | 134,710,693 | 1 | 0 | null | null | null | null |
UTF-8
|
Scheme
| false | false | 7,189 |
scm
|
a1.scm
|
; WINATA, GENTA INDRA
; Student Id: 20378324
; COMP 4221 Assignment 1 - Spring 2017
; Extra for Part 1:
; I handle the permutation duplicates (see permute function, you can toggle to remove duplicates or not)
; For example
; query =>
; (permute '(a a b))
; output =>
; (a a b)
; (a b a)
; (b a a)
; #f
; Part 1
; Function => remove
; Description => Remove single x from lst
; Algorithm =>
; 1. Base: when lst is empty return empty list
; 2. Recursion: if element = x, but was removed before, don't remove it
; 3. else concat car lst with tail
; input = x : symbol, lst : list, is-remove: boolean
; output = list
(define (remove x lst is-remove)
(if
(null? lst) `()
(if
(and (eq? x (car lst)) (eq? is-remove #f)) (remove x (cdr lst) #t)
(cons (car lst) (remove x (cdr lst) is-remove))
)
)
)
; Function => remove-duplicate
; Description => Remove duplicates for each element of list
; Algorithm =>
; 1. if any element found more than 1, than delete the element
; 2. num = number of x found in lst, if num > 1, remove the num else keep it
; 3. x is the element to be removed if found more than 1
; input = x: symbol, lst:list, num:symbol
; output = list;
(define (remove-duplicate x lst num)
(if
(null? lst) `()
(if
(and (equal? x (car lst)) (> num 0)) (remove-duplicate x (cdr lst) (+ num 1))
(if
(and (equal? x (car lst)) (= num 0)) (cons (car lst) (remove-duplicate x (cdr lst) (+ num 1)))
(cons (car lst) (remove-duplicate x (cdr lst) (+ num 0)))
)
)
)
)
; Function => remove-duplicate-iterator
; Description => Iterator to remove duplicates for each element of list
; Algorithm =>
; 1. will iterate each element of first-lst and remove each of them in lst and update lst in every time-step
; 2. accumulator = num of iterations, stop when list-length equals to accumulator
; input = first-lst: lst, lst:lst, list-length:symbol, accumulator:symbol
; output = list;
(define (remove-duplicate-iterator first-lst lst list-length accumulator)
(if
(eq? list-length accumulator) lst
(remove-duplicate-iterator (cdr first-lst) (remove-duplicate (car first-lst) lst 0) list-length (+ accumulator 1))
)
)
; Function => permute-generate
; Description => Permutate list, by adding first element and join it with its tail in recursion
; Algorithm =>
; 1. do apply append after the map
; 2. map i and cons with i and j, remove i in lst
; 3. Base: list with one length
; 4. Recursion: remove the i element and do cons i and j
; input = lst : list
; output = list
(define (permute-generate lst)
(if
(= (length lst) 1) (list lst)
(apply append
(map
(lambda (i)
(map (lambda (j) (cons i j))
(permute-generate (remove i lst #f))
)
) lst)
)
)
)
; Function => list-each
; Description => Print the result
; Algorithm =>
; 1. Base: Print #f and newline if lst length is 0
; 2. Recursion: Print the permutation and following newline, do the recursion
; input = lst: list
; output = text with '#f in the end
(define (list-each lst)
(cond
((= (length lst) 0) (display #f) (newline))
(else
(display (car lst))
(newline)
(list-each (cdr lst))
)
)
)
; Function => permute
; Description => Permutation function
; Algorithm =>
; 1. handle duplicate permutations by call remove-duplicate-iterator
; 2. let all permutations in lst to permutations
; 3. print by calling list-each
; Remark => since, removing duplicates is time-consuming, you can call (list-each permutations) instead if you don't need to remove duplicates, it will be faster
; input = list: list
; output = text
(define (permute lst)
(let ((permutations (permute-generate lst)))
; handling duplicates
(list-each (remove-duplicate-iterator permutations permutations (length permutations) 0))
; not handling duplicates
; (list-each permutations)
)
)
; Part 2
; Define weighted graph
(define g
'((a . ((b . 5) (c . 8) (d . 3)))
(b . ((a . 4) (c . 7)))
(c . ((a . 2) (b . 6) (c . 2) (d . 9)))
(d . ((b . 1) (c . 4)))))
; Function => iterate
; Description => Find the weight for corresponding start node (x) to end node
; Algorithms =>
; 1. Base: if the length of lst is 1, and car car lst is equal to x, do cdr car lst to get the weight, else return negative value (path is not found)
; 2. Recursion: if car car lst is equal to x, do cdr car lst to get the weight, else do the recursion
; input = lst : list, x : symbol
; output = weight or -99999999 (if not found)
(define (iterate lst x)
(if
(= (length lst) 1)
(if
(eq? (car (car lst)) x) (cdr (car lst))
-99999999
)
(if
(eq? (car (car lst)) x) (cdr (car lst))
(iterate (cdr lst) x)
)
)
)
; Function => get-length
; Description => Find the weight for node a to node b by searching the graph
; Algorithm =>
; 1. Base: if length of g is one, and car car g equals to a, call iterate to find the weight between a and b
; 2. Recusion: else, if car car g equals to a, call iterate to find the weight between a and b
; 3. else, sum the tail length with 0
; input = g : list, a : symbol, b : symbol
; output = weight or -99999999 (if not found)
(define (get-length g a b)
(if
(= (length g) 1)
(if
(eq? (car (car g)) a) (iterate (cdr (car g)) b)
-99999999
)
(if
(eq? (car (car g)) a) (iterate (cdr (car g)) b)
(+ 0 (get-length (cdr g) a b))
)
)
)
; Function => path-length-calculation
; Description => Generate pair and find the weight of each pair
; Algorithm =>
; 1. if the length is 1 or 0, display #f
; 2. Base: assign next_dis with the length between car lst and car cdr lst, car lst and car cdr lst is the pair between two adjacent nodes
; 3. Recursion: call path-length-calculation with tail of lst and added up all the weights
; input = g : list, lst: list
; output = weight
(define (path-length-calculation g lst)
(if
(< (length lst) 2) (display #f)
(if
(= (length lst) 2)
(let ((next_dis (get-length g (car lst) (car (cdr lst)))))
(+ 0 next_dis)
)
(let ((next_dis (get-length g (car lst) (car (cdr lst)))))
(+ next_dis (path-length-calculation g (cdr lst)))
)
)
)
)
; Function => path-length
; Description => Main function of path-length
; Algorithm =>
; 1. print #f if only found 1 or 0 node in lst
; 2. else calculate the distance, if the distance (res) is less than 0, display #f and newline else display the path length and newline
; Remark => if path is not valid return #f
; input: g: list, lst: list
; output: text (to the standard output)
(define (path-length g lst)
(cond
((< (length lst) 2) (display #f) (newline))
(else
(let ((res (path-length-calculation g lst)))
(cond
((< res 0) (display #f) (newline))
(else (display res) (newline))
)
)
)
)
)
; Function => distance
; Description => same with path-length, but can take multiple arguments
; Algorithm =>
; 1. Call the path-length
; (see path-length function)
; 2. print #f if only found 1 or 0 node in lst
; 3. else calculate the distance, if the distance (res) is less than 0, display #f and newline else display the path length and newline
; input: g: list, args: symbols
; output: text (to the standard output)
(define (distance g . args)
(path-length g args)
)
| false |
e582c7debe26a8b74c7954986d16c12485d77219
|
f4cf5bf3fb3c06b127dda5b5d479c74cecec9ce9
|
/Tests/LispKitTests/Code/SRFI121.scm
|
50149c52523577c2fe66e9c83f7b19c5d16b9b3a
|
[
"Apache-2.0"
] |
permissive
|
objecthub/swift-lispkit
|
62b907d35fe4f20ecbe022da70075b70a1d86881
|
90d78a4de3a20447db7fc33bdbeb544efea05dda
|
refs/heads/master
| 2023-08-16T21:09:24.735239 | 2023-08-12T21:37:39 | 2023-08-12T21:37:39 | 57,930,217 | 356 | 17 |
Apache-2.0
| 2023-06-04T12:11:51 | 2016-05-03T00:37:22 |
Scheme
|
UTF-8
|
Scheme
| false | false | 5,523 |
scm
|
SRFI121.scm
|
;;; SRFI121.scm
;;; Regression test data
;;;
;;; Author: Matthias Zenger
;;; Copyright © 2017 ObjectHub. All rights reserved.
;;;
;;; Licensed under the Apache License, Version 2.0 (the "License");
;;; you may not use this file except in compliance with the License.
;;; You may obtain a copy of the License at
;;;
;;; http://www.apache.org/licenses/LICENSE-2.0
;;;
;;; Unless required by applicable law or agreed to in writing, software
;;; distributed under the License is distributed on an "AS IS" BASIS,
;;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
;;; See the License for the specific language governing permissions and
;;; limitations under the License.
(
"Generators constructors"
(()
(1 2 3)
(8 9 10)
(8 10 12)
(3 4 5 6)
(3 4 5 6 7)
(3 5 7))
(import (srfi 121))
(list (generator->list (generator))
(generator->list (generator 1 2 3))
(generator->list (make-iota-generator 3 8))
(generator->list (make-iota-generator 3 8 2))
(generator->list (make-range-generator 3) 4)
(generator->list (make-range-generator 3 8))
(generator->list (make-range-generator 3 8 2)))
)
(
"Advanced generators constructors"
((0 1 2)
(1 2 3 4 5)
(1 2 3 4 5)
(5 4 3 2 1)
(#\a #\b #\c #\d #\e)
(10 20 30)
(5 4 3 2 1)
(0 2 4 6 8 10))
(define g (make-coroutine-generator
(lambda (yield) (let loop ((i 0))
(when (< i 3) (yield i) (loop (+ i 1)))))))
(define (for-each-digit proc n)
(when (> n 0)
(let-values (((div rem) (truncate/ n 10)))
(proc rem)
(for-each-digit proc div))))
(list (generator->list g)
(generator->list (list->generator '(1 2 3 4 5)))
(generator->list (vector->generator '#(1 2 3 4 5)))
(generator->list (reverse-vector->generator '#(1 2 3 4 5)))
(generator->list (string->generator "abcde"))
(generator->list (bytevector->generator (bytevector 10 20 30)))
(generator->list (make-for-each-generator for-each-digit 12345))
(generator->list (make-unfold-generator (lambda (s) (> s 5))
(lambda (s) (* s 2))
(lambda (s) (+ s 1))
0)))
)
(
"Generators operators"
((a b 0 1)
(0 1 2 0 1)
()
(15 22 31)
(1 3 5 7 9)
(2 4 6 8 10)
(1 2 3)
(4)
(1 2)
(1 2 0)
(3 4))
(define g (make-range-generator 1 5))
(define g1 (generator 1 2 3))
(define g2 (generator 4 5 6 7))
(define (proc . args) (values (apply + args) (apply + args)))
(list (generator->list (gcons* 'a 'b (make-range-generator 0 2)))
(generator->list (gappend (make-range-generator 0 3)
(make-range-generator 0 2)))
(generator->list (gappend))
(generator->list (gcombine proc 10 g1 g2))
(generator->list (gfilter odd? (make-range-generator 1 11)))
(generator->list (gremove odd? (make-range-generator 1 11)))
(generator->list (gtake g 3))
(generator->list g)
(generator->list (gtake (make-range-generator 1 3) 3))
(generator->list (gtake (make-range-generator 1 3) 3 0))
(generator->list (gdrop (make-range-generator 1 5) 2)))
)
(
"Advanced generators operators"
((1 2)
(3 4)
()
(0.0 1.0 0 2)
(0.0 0 2)
(a c e)
(a d e)
(1 2 3)
(1))
(define g (make-range-generator 1 5))
(define g1 (make-range-generator 1 5))
(define (small? x) (< x 3))
(list (generator->list (gtake-while small? g1))
(generator->list (gdrop-while small? g))
(generator->list (gdrop-while (lambda args #t) (generator 1 2 3)))
(generator->list (gdelete 1 (generator 0.0 1.0 0 1 2)))
(generator->list (gdelete 1 (generator 0.0 1.0 0 1 2) =))
(generator->list (gindex (list->generator '(a b c d e f))
(list->generator '(0 2 4))))
(generator->list (gselect (list->generator '(a b c d e f))
(list->generator '(#t #f #f #t #t #f))))
(generator->list (gdelete-neighbor-dups (generator 1 1 2 3 3 3) =))
(generator->list (gdelete-neighbor-dups (generator 1 2 3) (lambda args #t))))
)
(
"Generators consumers"
((1 2 3)
(5 4 3 2 1)
#(1 2 3 4 5)
#(1 2 3)
"abc"
(e d c b a . z))
(list (generator->list (generator 1 2 3 4 5) 3)
(generator->reverse-list (generator 1 2 3 4 5))
(generator->vector (generator 1 2 3 4 5))
(generator->vector (generator 1 2 3 4 5) 3)
(generator->string (generator #\a #\b #\c))
(with-input-from-port (open-input-string "a b c d e")
(lambda () (generator-fold cons 'z read))))
)
(
"Advanced generators consumers"
(6
3
2
#t
(4)
#f
(3 4)
(#\a #\b #\c))
(import (srfi 121))
(import (only (srfi 1) unfold))
(define n 0)
(generator-for-each (lambda values (set! n (apply + values)))
(generator 1) (generator 2) (generator 3))
(define g (make-range-generator 2 5))
(define g1 (make-range-generator 2 5))
(list n
(generator-find (lambda (x) (> x 2)) (make-range-generator 1 5))
(generator-count odd? (make-range-generator 1 5))
(generator-any odd? g)
(generator->list g)
(generator-every odd? g1)
(generator->list g1)
(generator-unfold (make-for-each-generator string-for-each "abc") unfold))
)
| false |
775b7b4e4d120e420d7cf5f95f71c16e771e40a7
|
defeada37d39bca09ef76f66f38683754c0a6aa0
|
/System/system/code-dom/code-line-pragma.sls
|
dd538e74f80a35954b5540a29003cc8ca58862d3
|
[] |
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 | 896 |
sls
|
code-line-pragma.sls
|
(library (system code-dom code-line-pragma)
(export new
is?
code-line-pragma?
file-name-get
file-name-set!
file-name-update!
line-number-get
line-number-set!
line-number-update!)
(import (ironscheme-clr-port))
(define-syntax new
(lambda (e)
(syntax-case e ()
((_ a ...) #'(clr-new System.CodeDom.CodeLinePragma a ...)))))
(define (is? a) (clr-is System.CodeDom.CodeLinePragma a))
(define (code-line-pragma? a)
(clr-is System.CodeDom.CodeLinePragma a))
(define-field-port
file-name-get
file-name-set!
file-name-update!
(property:)
System.CodeDom.CodeLinePragma
FileName
System.String)
(define-field-port
line-number-get
line-number-set!
line-number-update!
(property:)
System.CodeDom.CodeLinePragma
LineNumber
System.Int32))
| true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.