From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49834) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1erADm-0005sD-7m for guix-patches@gnu.org; Wed, 28 Feb 2018 17:29:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1erADj-0004d5-E2 for guix-patches@gnu.org; Wed, 28 Feb 2018 17:29:10 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:58351) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1erADi-0004cK-RR for guix-patches@gnu.org; Wed, 28 Feb 2018 17:29:07 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1erADg-0008Ke-UN for guix-patches@gnu.org; Wed, 28 Feb 2018 17:29:06 -0500 Subject: [bug#30657] [PATCH 3/4] services: utils: move 'flatten' from (gnu services web). Resent-Message-ID: From: =?UTF-8?Q?Cl=C3=A9ment?= Lassieur Date: Wed, 28 Feb 2018 23:28:20 +0100 Message-Id: <20180228222821.6195-3-clement@lassieur.org> In-Reply-To: <20180228222821.6195-1-clement@lassieur.org> References: <20180228222821.6195-1-clement@lassieur.org> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 30657@debbugs.gnu.org * gnu/services/web.scm (flatten): Move it... * gnu/services/utils.scm (flatten): ...to here, and export it. --- gnu/services/utils.scm | 12 +++++++++++- gnu/services/web.scm | 9 +-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/gnu/services/utils.scm b/gnu/services/utils.scm index a8d7981b2..4b7c9c219 100644 --- a/gnu/services/utils.scm +++ b/gnu/services/utils.scm @@ -17,8 +17,10 @@ ;;; along with GNU Guix. If not, see . (define-module (gnu services utils) + #:use-module (srfi srfi-1) #:export (push-tokens - with-tokens-to-list)) + with-tokens-to-list + flatten)) (define %tokens-stack (make-parameter #f)) @@ -36,6 +38,14 @@ list." (thunk) (%tokens-stack))) +(define (flatten . lst) + "Return a list that recursively concatenates all sub-lists of LST." + (define (flatten1 head out) + (if (list? head) + (fold-right flatten1 out head) + (cons head out))) + (fold-right flatten1 '() lst)) + ;;; Local Variables: ;;; eval: (put 'with-tokens-to-list 'scheme-indent-function 0) ;;; End: diff --git a/gnu/services/web.scm b/gnu/services/web.scm index beda481b0..38af66367 100644 --- a/gnu/services/web.scm +++ b/gnu/services/web.scm @@ -29,6 +29,7 @@ #:use-module (gnu packages admin) #:use-module (gnu packages web) #:use-module (gnu packages php) + #:use-module (gnu services utils) #:use-module (guix records) #:use-module (guix gexp) #:use-module ((guix utils) #:select (version-major)) @@ -499,14 +500,6 @@ of index files." (nginx-upstream-configuration-servers upstream)) " }\n")) -(define (flatten . lst) - "Return a list that recursively concatenates all sub-lists of LST." - (define (flatten1 head out) - (if (list? head) - (fold-right flatten1 out head) - (cons head out))) - (fold-right flatten1 '() lst)) - (define (default-nginx-config config) (match-record config -- 2.16.2