IRC channel logs

2023-04-20.log

back to list of logs

<AwesomeAdam54321>Is there a procedure that can strip the list created by (map ...)?
<RhodiumToad>what do you mean by "strip"?
<AwesomeAdam54321>RhodiumToad: (map ...) returns a list like "(a b c)" and I want to turn it into just "a b c"
<RhodiumToad>"a b c" as a string...? or what?
<AwesomeAdam54321>RhodiumToad: as elements
<RhodiumToad>in separate variables?
<RhodiumToad>maybe show an example, it's really not clear what you mean
<AwesomeAdam54321>(map (lambda (name) `,(string->symbol name)) dependencies)
<RhodiumToad>so dependencies is a list of strings and you want a list of symbols?
<AwesomeAdam54321>Yes, but without the opening ( and closing ) in the output
<AwesomeAdam54321>so (php-guzzlehttp-guzzle php-psr-http-client php-http-httplug) should have the these two parentheses removed
<RhodiumToad>but that makes no sense
<RhodiumToad>(a b c) is a list and therefore can be treated as a single value. a b c is not
<AwesomeAdam54321>you're right, there probably isn't a way
<RhodiumToad>what are you trying to do with the result?
<RhodiumToad>also, why is that map not just (map string->symbol dependencies)
<AwesomeAdam54321>RhodiumToad: I want fix a Guix package importer for PHP and the importer outputs a Guix package definition which is scheme
<AwesomeAdam54321>(inputs (list a b c)) and (inputs (list (a b c))) are probably the same, but it's for aesthetics
<RhodiumToad>they're not the same
<RhodiumToad>I wonder if ,@ is what you're looking for?
<RhodiumToad>compare `(foo ,(map string->symbol '("bar" "baz")) quux) vs. `(foo ,@(map string->symbol '("bar" "baz")) quux)
<AwesomeAdam54321>yay it's what I was looking for
<AwesomeAdam54321>what does ,@ do?
<RhodiumToad>it's like , except that it splices in a list rather than substituting a single value
<RhodiumToad>this is within a `... form of course
<RhodiumToad>it's in the manual under "expression syntax" (look for quasiquote and unquote-splicing
<AwesomeAdam54321>thanks, quasiquote felt complicated but it turns out it's simple
<RhodiumToad>quasiquote is just the real name for ` which you already used in your example above
<cow_2001>how do i write end-of-file into a port?
<cow_2001>close it?
<cow_2001>close-input-port, i see
<cow_2001>no
<cow_2001>i am trying to write EOF (^D) into an (open-pipe* OPEN_BOTH …) port
<cow_2001>it's how you end a `yt-dlp -a -` download list
<civodul>cwebber: just close the port
<civodul>er, sorry, that was for cow_2001
<civodul>(hi cwebber! :-))
<cow_2001>hi cwebber! hi civodul!
<cow_2001>oh here it is!
<cow_2001>now, after i (close-port some-port) it, how do i wait for the popened process to complete?
<cow_2001>oh i know!
<cow_2001>waitpid on the port's pid
<cow_2001>no, that's not it. close-port is supposed to waitpid.
<cow_2001>oh no
<cow_2001>i did something real stupid
<cow_2001>it just exits guile and the yt-dlp process then runs in the background
<cow_2001>(close-port yt-dlp-port) is right at the end of the guile script
<flatwhatson>cow_2001: if it's a pipe, you need close-pipe
<cow_2001>oh.
<cow_2001>that's it.
<cow_2001>thank you!
<cwebber>:)