宋文武 <iyzs...@envs.net> writes:

> ```
> (define (exclude-some-packages lst)
>   (filter (lambda (pkg)
>             (not (memq pkg (list
>                             gnome-terminal
>                             gnome-user-docs
>                             gnome-maps))))
>           lst))
>
>
> (service gnome-desktop-service-type
>   (let ((cfg (gnome-desktop-configuration)))
>    (gnome-desktop-configuration
>     (core-services
>      (exclude-some-packages (gnome-desktop-configuration-core-services cfg)))
>     (shell
>      (exclude-some-packages (gnome-desktop-configuration-shell cfg)))
>     (utilities
>      (exclude-some-packages (gnome-desktop-configuration-utilities cfg)))
>     (extra-packages
>      (exclude-some-packages (gnome-desktop-configuration-utilities cfg))))))
> ```
Thank you this has been very helpful, in the end I adapted your code
like so:
```scheme
(define (gnome-exclude-packages cfg . exclude)
  (let ((exclude-packages (λ (pkgs)
                            (remove (λ (pkg)
                                      (memq pkg exclude))
                                    pkgs))))
    (gnome-desktop-configuration
     (core-services
      (exclude-packages (gnome-desktop-configuration-core-services cfg)))
     (shell
      (exclude-packages (gnome-desktop-configuration-shell cfg)))
     (utilities
      (exclude-packages (gnome-desktop-configuration-utilities cfg)))
     (extra-packages
      (exclude-packages (gnome-desktop-configuration-extra-packages cfg))))))

; ...

(service gnome-desktop-service-type
                          (gnome-exclude-packages
                           (gnome-desktop-configuration)
                           gnome-music epiphany cheese))
```

I wonder if this is the best or most elegant way of achieving this. I'm
interested to see what others think.

> Hope it helps.
Very much, it was a good opportunity to play around in the REPL and see
the data structures for myself which I must admit I was apprehensive
about. Many thanks.

Reply via email to