12345678910111213141516171819202122232425262728 |
- (library (string-helpers)
- (export display-to-string
- string-repeat)
- (import (except (rnrs base))
- (only (guile)
- lambda*
- λ
- call-with-output-string
- display
- when))
- (define (string-repeat str n)
- (define (iter port str n)
- (when (> n 0)
- (display str port)
- (iter port str (- n 1))))
- (call-with-output-string
- (λ (port)
- (iter port str n))))
- (define display-to-string
- (λ (sth)
- (call-with-output-string
- (λ (port)
- (display sth port))))))
|