Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented directory:walk #41

Merged
merged 3 commits into from
Oct 16, 2022
Merged

Implemented directory:walk #41

merged 3 commits into from
Oct 16, 2022

Conversation

skx
Copy link
Owner

@skx skx commented Oct 16, 2022

Sample usage looks like this:

(directory:walk "/etc" (lambda (x)
                         (if (directory? x)
                             (print "Got directory: %s" x)
                           (print "Got file: %s" x)
                           )))

To avoid the complexity of adding this as a built-in form the implementation creates "directory:entries" to return the contents of the given path, recursively.

If we have a list of file/directories, and a function, we can just use apply to do the magic.

This closes #34.

Sample usage looks like this:

```
(directory:walk "/etc" (lambda (x)
                         (if (directory? x)
                             (print "Got directory: %s" x)
                           (print "Got file: %s" x)
                           )))
```

To avoid the complexity of adding this as a built-in form the
implementation creates "directory:entries" to return the contents
of the given path, recursively.

If we have a list of file/directories, and a function, we can just
use apply to do the magic.

This closes #34.
@skx skx merged commit b4f41b5 into master Oct 16, 2022
@skx skx deleted the 34-directory-walk branch October 16, 2022 06:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement directory:walk
1 participant