On 3/20/20, Aron Zvi <[email protected]> wrote:
> Thanks for your reply Ben.
>
> I understand that I am supposed to be getting a Dir instance.
> My confusion is indeed regarding the value of the name field of Dir for
> which I get a (full) path symbol of the directory and not just the folder
> name as I would expect.
>
> When I run (create-dir "test") and the test folder is in the same folder as
>
> my racket racket file (using just the folder name as you suggested), I get
> the following Dir instance for which the symbol is still the path to the
> folder from the given root
>
> (make-dir
>  'test
>  (list
>   (make-dir
>    *'test/a*
>    (list (make-dir *'test/a/docs* '() '()))
>    (list (make-file ".DS_Store" 6148 (make-date 2020 3 20 13 7 33) "")
> (make-file "me.txt" 0 (make-date 2020 3 20 13 1 42) ""))))
>  (list (make-file ".DS_Store" 6148 (make-date 2020 3 20 13 7 28) "")))
>
> *I am expecting to get this *
>
> (make-dir
>  'test
>  (list
>   (make-dir
>    *'a*
>    (list (make-dir *'docs* '() '()))
>    (list (make-file ".DS_Store" 6148 (make-date 2020 3 20 13 7 33) "")
> (make-file "me.txt" 0 (make-date 2020 3 20 13 1 42) ""))))
>  (list (make-file ".DS_Store" 6148 (make-date 2020 3 20 13 7 28) "")))

Ok, I see how that makes Exercise 339 more difficult. Thanks for
pointing this out.

In Racket, I would use `symbol->string` and `file-name-from-path` to
get the name.

In ISL, I'd use `symbol->string` and `string->list` to get started,
then design a function that takes takes all the characters after the
last #\/ character in a list (or all characters if there is no #\/)

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAFUu9R72khWOazwqVnmR2354%3DcbGxRkyn0u-xPTpemYpy1ES7Q%40mail.gmail.com.

Reply via email to