unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Clément Lassieur" <clement@lassieur.org>
To: 30657@debbugs.gnu.org
Subject: [bug#30657] [PATCH 3/4] services: utils: move 'flatten' from (gnu services web).
Date: Wed, 28 Feb 2018 23:28:20 +0100	[thread overview]
Message-ID: <20180228222821.6195-3-clement@lassieur.org> (raw)
In-Reply-To: <20180228222821.6195-1-clement@lassieur.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 <http://www.gnu.org/licenses/>.
 
 (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
                 <nginx-configuration>
-- 
2.16.2

  parent reply	other threads:[~2018-02-28 22:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-28 22:25 [bug#30657] Add support for file-like objects to the Prosody configuration Clément Lassieur
2018-02-28 22:28 ` [bug#30657] [PATCH 1/4] services: utils: Add 'push-tokens' and 'with-tokens-to-list' Clément Lassieur
2018-02-28 22:28   ` [bug#30657] [PATCH 2/4] gexp: Add 'file-like?' Clément Lassieur
2018-03-02 16:51     ` Ludovic Courtès
2018-03-03  1:44       ` Clément Lassieur
2018-03-03 14:38         ` Ludovic Courtès
2018-02-28 22:28   ` Clément Lassieur [this message]
2018-02-28 22:28   ` [bug#30657] [PATCH 4/4] services: messaging: Prosody config supports file-like objects Clément Lassieur
2018-03-02 17:00 ` [bug#30657] Add support for file-like objects to the Prosody configuration Ludovic Courtès
2018-03-03  1:33   ` [bug#30657] [PATCH] services: messaging: Prosody config supports file-like objects Clément Lassieur
2018-03-03 11:43     ` Clément Lassieur
2018-03-03 14:27       ` Ludovic Courtès
2018-03-03 14:37     ` Ludovic Courtès
2018-03-03 17:38       ` bug#30657: " Clément Lassieur
2018-03-03  1:40   ` [bug#30657] Add support for file-like objects to the Prosody configuration Clément Lassieur

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180228222821.6195-3-clement@lassieur.org \
    --to=clement@lassieur.org \
    --cc=30657@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).