[racket] Want to understand about how to use incomplete paths produced by directory-list.

From: Neil Van Dyke (neil at neilvandyke.org)
Date: Fri May 11 13:02:45 EDT 2012

Don Green wrote at 05/11/2012 12:43 PM:
> Is the best way for me to learn about how to use Racket paths:
> a) by asking the question in this mailing list,
> OR,
> b) by looking in some repository that has information on this.  (If I 
> should look in a repository, which one?)

It is usually a good idea to check the documentation first.

One of the most useful path-related procedures is "build-path".  For 
example, since you mentioned "directory-list"... You can use 
"build-path" to qualify a relative path produced by "directory-list" 
with the directory you gave as an argument to "directory-list":

#lang racket/base

(define my-dir-path (string->path "/home/user"))

(define my-relative-paths (directory-list my-dir-path))

;==> '(#<path:foo> #<path:bar>)

(map (lambda (my-relative-path)
        (build-path my-dir-path my-relative-path))
;;==> '(#<path:/home/user/foo> #<path:/home/user/bar>)

Neil V.

Posted on the users mailing list.