guix-devel
[Top][All Lists]
Advanced

[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.)

Attachment: avail-generations5.scm
Description: Text document

Attachment: pgpkM7utRlNdX.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]