[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: New ‘--list-generations’ and ‘--delete-generations’ options
From: |
Nikita Karetnikov |
Subject: |
Re: New ‘--list-generations’ and ‘--delete-generations’ options |
Date: |
Thu, 12 Sep 2013 13:17:52 +0400 |
> By definition submatches 1 and 2 exist when RES is true.
> Thus, I’d remove ‘safe-match:substring->number’ and do:
> (match (string-match "^([0-9]+)\\.\\.([0-9]+)$" str)
> (#f #f)
> (matches
> (let ((start (number->string (match:substring matches 1)))
> (end (number->string (match:substring matches 2))))
> ...)))
Done.
> 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’.
I’m attaching a sketchy version. If you don’t see any problems, I’ll
try to integrate this code into ‘package.scm’.
(Something is wrong with the store on my machine, so I can’t properly
test the filtering part. But I’ll do it as soon as possible.)
avail-generations5.scm
Description: Text document
pgpkM7utRlNdX.pgp
Description: PGP signature
- Re: New ‘--list-generations’ and ‘--delete-generations’ options, (continued)
- Re: New ‘--list-generations’ and ‘--delete-generations’ options, Nikita Karetnikov, 2013/09/04
- 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 <=
- Re: New ‘--list-generations’ and ‘--delete-generations’ options, Ludovic Courtès, 2013/09/12
- 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