Tobias Geerinckx-Rice <m...@tobias.gr> writes: > Indeed, my first mail was too hurried & my longer mail didn't > address this part at all... > > (packages > (append > (list (list git "send-email") > (list git "gui") ; just another example > foo > ...) > (map specification->package > '("git" > "bar" > ...) > > PACKAGES takes a list of, well, packages -- *or* (package output) > sublists! This is not well-documented: it's mentioned in > gnu/system.scm, but not in the manual under ‘operating-system > Reference’. I will add it there. Thank you for pointing it out.
Thanks for the explanation, now I could make it work. > If you want to go one step further, get rid of APPEND, and MAP > everything: it's not hard to write a procedure similar to > specification->package+output that returns a list instead of > multiple values (hint: take a look at DEFINE-VALUES). There might > well already be one hiding somewhere. I don't know. > > For today, at least, I'll leave this as an excercise for the > reader. :-p Challenge accepted! :) I was able to put handle both cases with a single function. I wasn't able to get rid of map, though. Here's what I got so far: --8<---------------cut here---------------start------------->8--- (use-modules (gnu) (srfi srfi-1)) (operating-system (packages (append (map (lambda (spec) (if (not (string-contains spec ":")) (specification->package spec) (let ((spec-pair (string-split spec #\:))) (list (specification->package (first spec-pair)) (second spec-pair))))) '("git" "git:send-email")) %base-packages)) ...)) --8<---------------cut here---------------end--------------->8--- Any suggestions?