diff options
Diffstat (limited to 'formatst.scm')
-rw-r--r-- | formatst.scm | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/formatst.scm b/formatst.scm index 3f19130..77a46c4 100644 --- a/formatst.scm +++ b/formatst.scm @@ -66,6 +66,8 @@ (set! format:symbol-case-conv #f) (set! format:iobj-case-conv #f) (set! format:read-proof #f) +(set! format:iteration-bounded #t) +(set! format:max-iterations 100) (format #t "~q") @@ -426,6 +428,23 @@ def") (test '("~2:@{ ~a,~a ~} ~a" (a 1) (b 2) (c 3)) " a,1 b,2 (c 3)") (test '("~{~}" "<~a,~a>" (a 1 b 2 c 3)) "<a,1><b,2><c,3>") (test '("~{ ~a ~{<~a>~}~} ~a" (a (1 2) b (3 4)) 10) " a <1><2> b <3><4> 10") +(let ((nums (let iter ((ns '()) (l 0)) + (if (> l 105) (reverse ns) (iter (cons l ns) (+ l 1)))))) + ;; Test default, only 100 items formatted out: + (test `("~D~{, ~D~}" ,(car nums) ,(cdr nums)) + "0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100") + ;; Test control of number of items formatted out: + (set! format:max-iterations 90) + (test `("~D~{, ~D~}" ,(car nums) ,(cdr nums)) + "0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90") + ;; Test control of imposing bound on number of items formatted out: + (set! format:iteration-bounded #f) + (test `("~D~{, ~D~}" ,(car nums) ,(cdr nums)) + "0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105") + ;; Restore defaults: + (set! format:iteration-bounded #t) + (set! format:max-iterations 100) + ) ; up and out |