summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tissue/issue.scm8
-rw-r--r--tissue/utils.scm11
2 files changed, 10 insertions, 9 deletions
diff --git a/tissue/issue.scm b/tissue/issue.scm
index 7b43caa..00fcbcf 100644
--- a/tissue/issue.scm
+++ b/tissue/issue.scm
@@ -226,14 +226,6 @@ return #f."
"--" file)
result))
-(define (memoize-thunk thunk)
- "Return a function memoizing THUNK."
- (let ((result #f))
- (lambda ()
- (unless result
- (set! result (thunk)))
- result)))
-
(define issues
(memoize-thunk
(lambda ()
diff --git a/tissue/utils.scm b/tissue/utils.scm
index 5fce26d..6832fb8 100644
--- a/tissue/utils.scm
+++ b/tissue/utils.scm
@@ -21,7 +21,8 @@
#:use-module (srfi srfi-26)
#:use-module (ice-9 popen)
#:export (call-with-input-pipe
- get-line-dos-or-unix))
+ get-line-dos-or-unix
+ memoize-thunk))
(define (call-with-input-pipe proc program . args)
"Execute PROGRAM ARGS ... in a subprocess with a pipe to it. Call
@@ -43,3 +44,11 @@ ports) in that it also supports DOS line endings."
(if (eof-object? line)
line
(string-trim-right line #\return))))
+
+(define (memoize-thunk thunk)
+ "Return a function memoizing THUNK."
+ (let ((result #f))
+ (lambda ()
+ (unless result
+ (set! result (thunk)))
+ result)))