“guix system” suggests wrong module import when using “remove”
(address . bug-guix@gnu.org)
I want to delete a service from %desktop-services, so I write
Toggle snippet (8 lines)
…
(services (remove
(lambda (service)
(eq? (service-kind service) that-annoying-service-type))
%desktop-services))
…
Then I run “guix system build config.scm” and Guix tells me that it
doesn’t know what “remove” is:
Toggle snippet (4 lines)
config.scm:56:18: error: remove: unbound variable
hint: Did you forget `(use-modules (rnrs lists))'?
I add the suggested module import to my file and it no longer complains,
but that-annoying-service-type has not actually been removed. Oh no!
Of course, the Guix manual says this:
Toggle snippet (11 lines)
Again, ‘%desktop-services’ is just a list of service objects. If you
want to remove services from there, you can do so using the procedures
for list filtering (*note (guile)SRFI-1 Filtering and Partitioning::).
For instance, the following expression returns a list that contains all
the services in ‘%desktop-services’ minus the Avahi service:
(remove (lambda (service)
(eq? (service-kind service) avahi-service-type))
%desktop-services)
But maybe I don’t know what SRFI-1 is and I trust that the hint Guix
provides will be the right thing to do.
But now I’m curious and I look at the documentation for “remove” from
(rnrs lists):
Toggle snippet (10 lines)
-- Scheme Procedure: remp proc list
-- Scheme Procedure: remove obj list
-- Scheme Procedure: remv obj list
-- Scheme Procedure: remq obj list
‘remove’, ‘remv’, and ‘remq’ are identical to the ‘delete’, ‘delv’,
and ‘delq’ procedures provided by Guile’s core library, (*note List
Modification::). ‘remp’ is identical to the alternate ‘remove’
procedure provided by SRFI-1; *Note SRFI-1 Deleting::.
Oh.
So here are my questions:
* can we prefer (srfi srfi-1) over (rnrs lists) in the suggestions for “remove”?
* can we avoid this by extending modify-services to support “delete”
much like modify-phases, and suggesting to use that instead of
“remove”?
--
Ricardo