Hi! I'm glad to see this. This behavior has caught me up a number of times recently. Leo Prikler writes: [...] @@ -571,18 +572,22 @@ effects, such as displaying warnings or error messages." > (define* (alist-cons-before reference key value alist > #:optional (key=? equal?)) > "Insert the KEY/VALUE pair before the first occurrence of a pair whose key > -is REFERENCE in ALIST. Use KEY=? to compare keys." > +is REFERENCE in ALIST. Use KEY=? to compare keys. An error is raised when no > +such pair exists." > (let-values (((before after) > (break (match-lambda > ((k . _) > (key=? k reference))) > alist))) > - (append before (alist-cons key value after)))) > + (match after > + ((reference after ...) > + (append before (alist-cons key value (cons reference after))))))) This can probably just be (untested): ((reference after* ...) (append before (alist-cons key value after)))))) Or if we want to avoid extraneous bindings completely (also untested): ((_ _ ...) (append before (alist-cons key value after)))))) > > (define* (alist-cons-after reference key value alist > #:optional (key=? equal?)) > "Insert the KEY/VALUE pair after the first occurrence of a pair whose key > -is REFERENCE in ALIST. Use KEY=? to compare keys." > +is REFERENCE in ALIST. Use KEY=? to compare keys. An error is raised when > +no such pair exists." > (let-values (((before after) > (break (match-lambda > ((k . _) > @@ -590,9 +595,7 @@ is REFERENCE in ALIST. Use KEY=? to compare keys." > alist))) > (match after > ((reference after ...) > - (append before (cons* reference `(,key . ,value) after))) > - (() > - (append before `((,key . ,value))))))) > + (append before (cons* reference `(,key . ,value) after)))))) > > (define* (alist-replace key value alist #:optional (key=? equal?)) > "Replace the first pair in ALIST whose car is KEY with the KEY/VALUE pair. Other than that it looks good to me. Pushing this should also close #32661. This should be a patch for core-updates, though, since it changes derivations for any package that (directly or indirectly) uses ALIST-CONS-BEFORE or ALIST-CONS-AFTER. -- Sarah