delete-file(3scm)
π NAME π
okay bestie, welcome to delete-file(3scm) from the Scheme Programmer's Manual β the page for delete-file, which is literally just βdelete a file.β No notes, iconic behavior. π
π LIBRARY π
Load it from whichever report you're living in, bestie:
(import (rnrs)) ;R6RS
(import (rnrs files)) ;R6RS
(import (scheme file)) ;R7RS
β¨ SYNOPSIS β¨
(delete-file filename)
πΈ DESCRIPTION πΈ
Deletes the named file if it exists and can be deleted. That's the whole vibe. Lowkey simple, highkey useful. π¦
π RETURN VALUES π
- R6RS β returns unspecified values.
- R7RS β returns an unspecified value.
π¦ EXAMPLES π¦
Here's the lil demo, bestie β it writes a temp file, then yeets it:
(call-with-output-file "temp.txt"
(lambda (p)
(display "Hello, temporary world!\n" p)))
(delete-file "temp.txt")
π APPLICATION USAGE π
So this procedure is used to delete files. It's commonly used to remove existing output files before writing new output files. In R6RS systems this is handled without race conditions with (file-options no-fail) β see file-options(7scm). Slay. β¨
π COMPATIBILITY π
- R6RS β valid values for a file name include strings that name a file using the native notation of filesystem paths on an implementation's underlying operating system, and may include implementation-dependent values as well.
- R7RS β it is an error if filename is not a string. See the next section.
Also: this procedure is absent from R5RS and earlier reports. Not invited, ig. π
π¨ ERRORS π¨
This procedure can raise exceptions that satisfy the following predicates, bestie β so catch them if you're being careful:
assertion-violation?(R6RS) β the wrong number of arguments was passed or an argument was outside its domain.- R7RS β the assertions described above are errors. Implementations may signal an error, extend the procedure's domain of definition to include such arguments, or fail catastrophically.
i/o-filename-error?(R6RS),file-error?(R7RS) β the file does not exist or cannot be deleted.
π SEE ALSO π
file-exists?(3scm)file-options(7scm)
β STANDARDS β
R6RS, R7RS.
π§ HISTORY π§
This procedure is new to R6RS and R7RS, but it existed previously in early Scheme running on MacLISP as deletef. Look at her, a legacy icon. π
π AUTHORS π
This page is part of the scheme-manpages project. It includes materials from the RnRS documents. More information can be found at https://github.com/schemedoc/manpages/.
π BUGS π
If a program checks if a file exists usingfile-exists?(3scm)before callingdelete-filethen another program may still have deleted the file before the second call. It is better to wrapdelete-fileinguard(7scm). Another approach is to use(file-options no-fail), seefile-options(7scm).
π That's the whole delete-file(3scm) page, bestie β from the Scheme Programmer's Manual, footer date 2021-03-07. Periodt. ππ«Ά
π¦ where this page comes from
- nixpkgs unstable: scheme-manpages 0-unstable-2024-02-11
- π the page's license: MIT
- Copyright (c) 2021 Gwen Weinholt
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms