Hi,
Leo Prikler skribis:
> Am Mittwoch, den 06.01.2021, 14:32 +0100 schrieb Ludovic Courtès:
>> Hi,
>>
>> Leo Prikler skribis:
>>
>> > > > +((first . rest)
>> > > > + (if (member first rest =) ; (srfi srfi-1) member
>> > > > + (cons first (find-duplicates rest =))
>> > > > +
Hi,
Am Mittwoch, den 06.01.2021, 14:32 +0100 schrieb Ludovic Courtès:
> Hi,
>
> Leo Prikler skribis:
>
> > > > +((first . rest)
> > > > + (if (member first rest =) ; (srfi srfi-1) member
> > > > + (cons first (find-duplicates rest =))
> > > > + (find-duplicates rest =)))
Hi,
Leo Prikler skribis:
>> > +((first . rest)
>> > + (if (member first rest =) ; (srfi srfi-1) member
>> > + (cons first (find-duplicates rest =))
>> > + (find-duplicates rest =)
>>
>> Note that this is quadratic; it’s fine as long as we don’t have “too
>> many” use
Hi,
Am Mittwoch, den 06.01.2021, 10:56 +0100 schrieb Ludovic Courtès:
> Hi,
>
> Leo Prikler skribis:
>
> > *gnu/system/shadow.scm (find-duplicates): New variable.
> > (assert-unique-account-names, assert-unique-group-names): New
> > variables.
> > (account-activation): Use them here.
>
> [...]
Hi,
Leo Prikler skribis:
> *gnu/system/shadow.scm (find-duplicates): New variable.
> (assert-unique-account-names, assert-unique-group-names): New variables.
> (account-activation): Use them here.
[...]
> +(define (find-duplicates list =)
> + (match list
> +('() '())
This should be:
(
*gnu/system/shadow.scm (find-duplicates): New variable.
(assert-unique-account-names, assert-unique-group-names): New variables.
(account-activation): Use them here.
---
gnu/system/shadow.scm | 35 +++
1 file changed, 35 insertions(+)
diff --git a/gnu/system/shadow
Hi Leo,
I agree that this is a good idea.
Please use (ice-9 match) instead of car and cdr.
Something among these lines would be more transparent:
(define (find-duplicates list accessor)
(match list
(() '())
((head . tail)
(if (member head tail accessor) ; (srf
*gnu/system/shadow.scm (assert-unique-account-names)
(assert-unique-group-names): New variables.
(account-activation): Use them here.
---
gnu/system/shadow.scm | 28
1 file changed, 28 insertions(+)
diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm
index a693