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

Implement directory:walk #34

Closed
skx opened this issue Oct 15, 2022 · 1 comment · Fixed by #41
Closed

Implement directory:walk #34

skx opened this issue Oct 15, 2022 · 1 comment · Fixed by #41
Assignees

Comments

@skx
Copy link
Owner

skx commented Oct 15, 2022

As noted in the previous release notes we are going to add a "directory:walk" function:

  • Given a starting point
    • Walk it, recursively, and invoke a callback with the complete path-name.
@skx skx self-assigned this Oct 15, 2022
@skx
Copy link
Owner Author

skx commented Oct 16, 2022

Annoyingly this can't go in the builtin-package, as it needs to invoke the callback..

skx added a commit that referenced this issue 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.
@skx skx closed this as completed in #41 Oct 16, 2022
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 a pull request may close this issue.

1 participant