unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Andreas Enge <andreas@enge.fr>
Cc: guix-devel@gnu.org
Subject: Re: Small texlive variant
Date: Thu, 11 Feb 2016 11:45:01 +0100	[thread overview]
Message-ID: <87r3gjsez6.fsf@gnu.org> (raw)
In-Reply-To: <20160209214906.GA18201@debian> (Andreas Enge's message of "Tue, 9 Feb 2016 22:49:06 +0100")

Andreas Enge <andreas@enge.fr> skribis:

> On Tue, Jan 19, 2016 at 10:20:42AM +0100, Ludovic Courtès wrote:
>> This is a bit verbose.  I think it would be nice to have a data
>> structure to describe what we are deleting, along these lines
>> (untested):
>
> I agree, computer science 101 tells us to use a function when repeating the
> same sequence of statements on separate data. This is what I did in the new
> attached patch; I also "flattened out" the deletion as you suggest.
>
> However, the data structure thing was too complicated for me and I think not
> really needed.

I think it was clearer and separated concerns better (filtering
vs. deleting.)  :-)

The version you propose is acceptable too.

> From 8a2ebb8163c54f80f2a5e4708956b87b134ada85 Mon Sep 17 00:00:00 2001
> From: Andreas Enge <andreas@enge.fr>
> Date: Fri, 15 Jan 2016 16:00:47 +0100
> Subject: [PATCH] gnu: Add texlive-minimal.
>
> * gnu/packages/texlive.scm (texlive-texmf-minimal, texlive-minimal):
>   New variables.

[...]

> +             (with-directory-excursion "texmf-dist"
> +               (for-each delete-file-recursively
> +                         '("doc" "source" "tex4ht"))
> +               ;; Delete all subdirectories of "fonts", except for those
> +               ;; named "cm", that is, "afm/public/amsfonts/cm",

This comment is too indented and redundant with the code below, I think.

> +             (let ((delete
> +                     ;; delete all files and directories in SUBDIR
> +                     ;; except for those given in the list EXCLUDE

Make it an inner ‘define’, to reduce indentation.

Also the docstring should be below the formal parameter list, and should
be a sentence.

> +                     (lambda (subdir exclude)

I’d make exclude a keyword parameter, for clarity.

With these changes, it would look like:

  (define* (delete directory #:key (except '()))
    ;; Delete all the files and directories in DIRECTORIES, except those
    ;; listed in in EXCEPT.
    …)

How does that sound?

Thanks!

Ludo’.

  reply	other threads:[~2016-02-11 10:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-15 15:21 Small texlive variant Andreas Enge
2016-01-19  9:20 ` Ludovic Courtès
2016-02-09 21:49   ` Andreas Enge
2016-02-11 10:45     ` Ludovic Courtès [this message]
2016-02-13 10:17       ` Andreas Enge

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=87r3gjsez6.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=andreas@enge.fr \
    --cc=guix-devel@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).