How to resolve the algorithm Check that file exists step by step in the Racket programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Check that file exists step by step in the Racket programming language

Table of Contents

Problem Statement

Verify that a file called     input.txt     and   a directory called     docs     exist.

This should be done twice:

Optional criteria (May 2015):   verify it works with:

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Check that file exists step by step in the Racket programming language

Source code in the racket programming language

#lang racket

;; here
(file-exists? "input.txt")
(file-exists? "docs")

;; in the root
(file-exists? "/input.txt")
(file-exists? "/docs")

;; or in the root with relative paths
(parameterize ([current-directory "/"])
  (and (file-exists? "input.txt")
       (file-exists? "docs")))


  

You may also check:How to resolve the algorithm Read entire file step by step in the Nim programming language
You may also check:How to resolve the algorithm Abbreviations, easy step by step in the Nanoquery programming language
You may also check:How to resolve the algorithm Dragon curve step by step in the Mathematica / Wolfram Language programming language
You may also check:How to resolve the algorithm Stack step by step in the NetRexx programming language
You may also check:How to resolve the algorithm Fibonacci word step by step in the ooRexx programming language