diff --git a/sh/anguish.scm b/sh/anguish.scm index d120fdb..96421ef 100644 --- a/sh/anguish.scm +++ b/sh/anguish.scm @@ -14,6 +14,7 @@ :use-module (sh pipe) :use-module (sh peg) :use-module (sh io) + :use-module (sh util) :export (main)) diff --git a/sh/pipe.scm b/sh/pipe.scm index 388ab5e..4df5e0d 100644 --- a/sh/pipe.scm +++ b/sh/pipe.scm @@ -9,8 +9,9 @@ :use-module (srfi srfi-26) :use-module (sh io) + :use-module (sh util) - :export (pipeline job-control-init jobs report-jobs fg bg disjoin conjoin)) + :export (pipeline job-control-init jobs report-jobs fg bg)) (define-record-type (make-process pid command status) @@ -164,14 +165,6 @@ (set! job-table (cons job job-table)) (if fg? (wait job)))) -(define (disjoin . predicates) - (lambda (. arguments) - (any (cut apply <> arguments) predicates))) - -(define (conjoin . predicates) - (lambda (. arguments) - (every (cut apply <> arguments) predicates))) - (define (reap-jobs) (set! job-table (filter (disjoin job-running? job-stopped?) job-table))) diff --git a/sh/util.scm b/sh/util.scm new file mode 100644 index 0000000..383b500 --- /dev/null +++ b/sh/util.scm @@ -0,0 +1,13 @@ +(define-module (sh util) + :use-module (srfi srfi-1) + :use-module (srfi srfi-26) + + :export (disjoin conjoin)) + +(define (disjoin . predicates) + (lambda (. arguments) + (any (cut apply <> arguments) predicates))) + +(define (conjoin . predicates) + (lambda (. arguments) + (every (cut apply <> arguments) predicates)))