examples/text-progress.scm
raw| 1 | ;; sample program to show how to use text.progress |
| 2 | |
| 3 | (use text.progress) |
| 4 | |
| 5 | (define (main args) |
| 6 | (define (num-format cur max) |
| 7 | (format "~d/~d(~3d%)" cur max |
| 8 | (round->exact (/. (* cur 100) max)))) |
| 9 | |
| 10 | (let ((p (make-text-progress-bar :header "Example" |
| 11 | :header-width 10 |
| 12 | :bar-char #\o |
| 13 | :num-format num-format |
| 14 | :num-width 13 |
| 15 | :max-value 256))) |
| 16 | (do ((i 0 (+ i 1))) |
| 17 | ((= i 256) (p 'finish)) |
| 18 | (p 'inc 1) |
| 19 | (sys-select #f #f #f 50000)))) |