From: Ricardo Wurmus <rekado@elephly.net>
To: 41140@debbugs.gnu.org
Subject: bug#41140: “guix system” suggests wrong module import when using “remove”
Date: Sat, 09 May 2020 00:00:05 +0200 [thread overview]
Message-ID: <87lfm22il6.fsf@elephly.net> (raw)
I want to delete a service from %desktop-services, so I write
--8<---------------cut here---------------start------------->8---
…
(services (remove
(lambda (service)
(eq? (service-kind service) that-annoying-service-type))
%desktop-services))
…
--8<---------------cut here---------------end--------------->8---
Then I run “guix system build config.scm” and Guix tells me that it
doesn’t know what “remove” is:
--8<---------------cut here---------------start------------->8---
config.scm:56:18: error: remove: unbound variable
hint: Did you forget `(use-modules (rnrs lists))'?
--8<---------------cut here---------------end--------------->8---
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:
--8<---------------cut here---------------start------------->8---
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)
--8<---------------cut here---------------end--------------->8---
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):
--8<---------------cut here---------------start------------->8---
-- 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::.
--8<---------------cut here---------------end--------------->8---
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
next reply other threads:[~2020-05-08 22:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-08 22:00 Ricardo Wurmus [this message]
2020-05-09 7:30 ` bug#41140: “guix system” suggests wrong module import when using “remove” Danny Milosavljevic
2020-05-10 21:33 ` Ricardo Wurmus
2020-05-11 20:22 ` Ludovic Courtès
2021-04-12 16:21 ` Ricardo Wurmus
2020-05-11 20:23 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87lfm22il6.fsf@elephly.net \
--to=rekado@elephly.net \
--cc=41140@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).