On Fri, Sep 2, 2011 at 5:01 AM, Ludovic Courtès <[email protected]> wrote:

> Hi,
>
> Nala Ginrut <[email protected]> skribis:
>
> > I don't mean 6 args is  improper. But maybe some guys just want an easy
> > thing, and maybe Guile newbies need a easy start with 'scandir'.
>
> Oh, I just meant to say you could build ‘scandir’ (and others) atop
> ‘file-system-fold’.
>
> The scandir(3) C function is really meant to be a higher-order function
> but its interface is awkward and mixes different concerns (traversal and
> filtering.)  Using something akin to the ‘directory-contents’ procedure
> I posted earlier, one could then use SRFI-1 to do actual filtering.
>
> > 'scandir' is a POSIX function, so many people will think it exists in
> Guile.
> > We have 'opendir' and 'readdir', but no 'scandir', that's strange.
>
> Yes, you’re right.  However, I feel that we can come up with something
> both simpler and more expressive, as sketched above.
>

yeah~I realized that the idea about a bunch of  gorgeous high-order
functions around one base function 'file-system-fold' is more creative and
flexible. It becomes happier to add new features into Guile than wrap a C
function. Anyway, C is more painful. ;-)
So, have you already implemented others like 'directory-content' instead of
'scandir' ? Or should we submit some patches for it?
What about the sort method? And I hope it won't dismiss "." and ".." in the
result.
Let me retell my need, I need the function returns a sorted list which
contained "." and "..". Is it easy to implement it with 'file-system-fold'?

Reply via email to