Hi,
First of all I would like to thank Racket community for creating and
maintaining top quality documentation at
https://docs.racket-lang.org/
and even providing a local copy for it.
Currently I am having some difficulties in understanding this letrec
example from Racket Guide docs
(
https://docs.racket-lang.org/guide/let.html#%28part._.Recursive_.Binding__letrec%29):
(letrec ([tarzan-near-top-of-tree?
(lambda (name path depth)
(or (equal? name "tarzan")
(and (directory-exists? path)
(tarzan-in-directory? path depth))))]
[tarzan-in-directory?
(lambda (dir depth)
(cond
[(zero? depth) #f]
[else
(ormap
(λ (elem)
(tarzan-near-top-of-tree? (path-element->string elem)
(build-path dir elem)
(- depth 1)))
(directory-list dir))]))])
(tarzan-near-top-of-tree? "tmp"
(find-system-path 'temp-dir)
4))
Problem:
I having some problem on how recursion is working here and what is the
problem we are solving here. Are we finding a file with (name?
"tarzan") or something else?
--
Utkarsh Singh
http://utkarshsingh.xyz