[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: New ‘--list-generations’ and ‘--delete-generations’ options
From: |
Ludovic Courtès |
Subject: |
Re: New ‘--list-generations’ and ‘--delete-generations’ options |
Date: |
Thu, 12 Sep 2013 14:26:16 +0200 |
User-agent: |
Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux) |
Nikita Karetnikov <address@hidden> skribis:
>> Probably this can reduce to a big ‘cond’, which would be even more
>> readable:
>
>> (cond ((maybe-integer)
>> =>
>> list)
>> ((string-match "^([0-9]+)\\.\\.([0-9]+)$" str)
>> =>
>> (lambda (match)
>> ...))
>> ...)
>
> Are you sure? I haven’t found a way to make ‘cond’ as readable as ‘or’.
Yes, it makes it easier to enumerate all the cases, and to reason about it.
For instance, in ‘string->generations’, getting rid of ‘maybe-*-range’
and instead inlining the ‘string-match’ calls in ‘cond’ would greatly
clarify things IMO:
(cond ((maybe-integer) ...)
((maybe-comma-separated-integers) ...)
((string-match p1 x) => ...)
((string-match p2 x) => ...)
((string-match p3 x) => ...)
(else #f))
> I’m attaching a sketchy version. If you don’t see any problems, I’ll
> try to integrate this code into ‘package.scm’.
I’d prefer clearer case analysis as shown above.
Thanks,
Ludo’.
- Re: New ‘--list-generations’ and ‘--delete-generations’ options, (continued)
- Re: New ‘--list-generations’ and ‘--delete-generations’ options, Ludovic Courtès, 2013/09/05
- Re: New ‘--list-generations’ and ‘--delete-generations’ options, Nikita Karetnikov, 2013/09/05
- Re: New ‘--list-generations’ and ‘--delete-generations’ options, Ludovic Courtès, 2013/09/07
- Re: New ‘--list-generations’ and ‘--delete-generations’ options, Nikita Karetnikov, 2013/09/08
- Re: New ‘--list-generations’ and ‘--delete-generations’ options, Ludovic Courtès, 2013/09/08
- Re: New ‘--list-generations’ and ‘--delete-generations’ options, Nikita Karetnikov, 2013/09/09
- Re: New ‘--list-generations’ and ‘--delete-generations’ options, Ludovic Courtès, 2013/09/09
- Re: New ‘--list-generations’ and ‘--delete-generations’ options, Nikita Karetnikov, 2013/09/11
- Re: New ‘--list-generations’ and ‘--delete-generations’ options, Ludovic Courtès, 2013/09/11
- Re: New ‘--list-generations’ and ‘--delete-generations’ options, Nikita Karetnikov, 2013/09/12
- Re: New ‘--list-generations’ and ‘--delete-generations’ options,
Ludovic Courtès <=
- Re: New ‘--list-generations’ and ‘--delete-generations’ options, Nikita Karetnikov, 2013/09/13
- Re: New ‘--list-generations’ and ‘--delete-generations’ options, Ludovic Courtès, 2013/09/13
- Re: New ‘--list-generations’ and ‘--delete-generations’ options, Nikita Karetnikov, 2013/09/16
- Re: New ‘--list-generations’ and ‘--delete-generations’ options, Ludovic Courtès, 2013/09/16
- PRELIMINARY: [PATCH] guix package: Add '--list-generations'., Nikita Karetnikov, 2013/09/17
- Re: PRELIMINARY: [PATCH] guix package: Add '--list-generations'., Nikita Karetnikov, 2013/09/18
- Re: PRELIMINARY: [PATCH] guix package: Add '--list-generations'., Ludovic Courtès, 2013/09/18
- [PATCH] guix package: Add '--list-generations'., Nikita Karetnikov, 2013/09/18
- Re: [PATCH] guix package: Add '--list-generations'., Ludovic Courtès, 2013/09/19
- Re: [PATCH] guix package: Add '--list-generations'., Nikita Karetnikov, 2013/09/19