Hello everyone. My goal is to see how exactly service types and configurations are evaluated. I am struggling to understand what is the primary control flow in the fold-services function. I could just not bother working it out and look deeper into the function body. However, the original intent is to learn — and this is an opportunity to learn more.
(define* (fold-services services #:key (target-type system-service-type)) ... ... ... (match (filter ... services) ((sink) (run-with-state ...)) (() (raise ...)) (x (raise ...)))) My current understanding is that the filter may return one of three patterns: 1. An empty list when the list of services does not contain the target-type. 2. A single-element list when a correctly formed list of services is provided. 3. A many-element list when the list of services contains multiple services of target-type. This does not make sense to me when comparing with the implementation of pattern matching in the function. The Scheme Documentation on pattern matching is unhelpful, and neither are the cryptic binding names in the function. I am confident that the filter function does return a list in every circumstance. How do the matching patterns correlate to this filtered list? The fold-services function is located in gnu/services.scm file.
signature.asc
Description: This is a digitally signed message part.
