[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Getting the name of file-like objects
From: |
Liliana Marie Prikler |
Subject: |
Re: Getting the name of file-like objects |
Date: |
Sat, 02 Apr 2022 22:03:53 +0200 |
User-agent: |
Evolution 3.42.1 |
Hi Justin
Am Freitag, dem 01.04.2022 um 16:29 -0400 schrieb Justin Veilleux:
> Hi everyone. I'm currently writing a set of helper functions
> (usually written using `computed-file` which act on file like
> objects to transform them in some way.
> For instance, I have a `decompress` function which, given a file-like
> object pointing to an archive, will return a computed file object
> which it will decompress to it's output.
> Everything works very well, but I would like to be able to name the
> `computed-file` objects something meaningfull.
> ```
> (define (unzip f)
> (computed-file (string-append (name f) "-unzipped")
> #~(begin
> (system* (string-append #$unzip "/bin/unzip")
> "-d" #$output
> #$file))
> #$out))
> ```
> Is there someting which ressembles the imaginary `name` function I
> used above?
Generally speaking, you'll have to speak to the store to achieve your
goal. For a specific implementation, that fetches a file from a
package (without building the package in question!), see package-file
in (guix packages).
Cheers