Skip to content

Commit 7c39cdf

Browse files
author
matt
committed
Capturing illustration of run launch loop
1 parent 2e8472f commit 7c39cdf

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

runs-launch-loop-test.scm

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
(use srfi-69)
2+
3+
(define (runs:queue-next-hed tal reg n regful)
4+
(if regful
5+
(car reg)
6+
(car tal)))
7+
8+
(define (runs:queue-next-tal tal reg n regful)
9+
(if regful
10+
tal
11+
(let ((newtal (cdr tal)))
12+
(if (null? newtal)
13+
reg
14+
newtal
15+
))))
16+
17+
(define (runs:queue-next-reg tal reg n regful)
18+
(if regful
19+
(cdr reg)
20+
(if (eq? (length tal) 1)
21+
'()
22+
reg)))
23+
24+
(use trace)
25+
(trace runs:queue-next-hed
26+
runs:queue-next-tal
27+
runs:queue-next-reg)
28+
29+
30+
(define tests '(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20))
31+
32+
(define test-registry (make-hash-table))
33+
34+
(define n 3)
35+
36+
(let loop ((hed (car tests))
37+
(tal (cdr tests))
38+
(reg '()))
39+
(let* ((reglen (length reg))
40+
(regful (> reglen n)))
41+
(print "hed=" hed ", length reg=" (length reg) ", (> lenreg n)=" (> (length reg) n))
42+
(let ((newtal (append tal (list hed)))) ;; used if we are not done with this test
43+
(cond
44+
((not (hash-table-ref/default test-registry hed #f))
45+
(hash-table-set! test-registry hed #t)
46+
(print "Registering #" hed)
47+
(if (not (null? tal))
48+
(loop (runs:queue-next-hed tal reg n regful)
49+
(runs:queue-next-tal tal reg n regful)
50+
(let ((newl (append reg (list hed))))
51+
(if regful
52+
(cdr newl)
53+
newl)))))
54+
(else
55+
(print "Running #" hed)
56+
(if (not (null? tal))
57+
(loop (runs:queue-next-hed tal reg n regful)
58+
(runs:queue-next-tal tal reg n regful)
59+
(runs:queue-next-reg tal reg n regful))))))))

0 commit comments

Comments
 (0)