From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nala Ginrut Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH] Add "scandir" procedure Date: Fri, 2 Sep 2011 09:00:11 +0800 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=20cf3079baf6211ef404abeae237 X-Trace: dough.gmane.org 1314925226 31573 80.91.229.12 (2 Sep 2011 01:00:26 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 2 Sep 2011 01:00:26 +0000 (UTC) To: guile-devel Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Sep 02 03:00:22 2011 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QzI7K-0000gq-1A for guile-devel@m.gmane.org; Fri, 02 Sep 2011 03:00:22 +0200 Original-Received: from localhost ([::1]:42362 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QzI7F-0008A0-NA for guile-devel@m.gmane.org; Thu, 01 Sep 2011 21:00:17 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:48422) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QzI7C-00089v-SF for guile-devel@gnu.org; Thu, 01 Sep 2011 21:00:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QzI79-0004ba-O9 for guile-devel@gnu.org; Thu, 01 Sep 2011 21:00:14 -0400 Original-Received: from mail-vw0-f41.google.com ([209.85.212.41]:37730) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QzI79-0004Y7-KC for guile-devel@gnu.org; Thu, 01 Sep 2011 21:00:11 -0400 Original-Received: by mail-vw0-f41.google.com with SMTP id 42so2260350vwm.0 for ; Thu, 01 Sep 2011 18:00:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=wWiK24pHHhpSXlvXSMH0YEGuJBcRgAZ6HSaXHWcRjhY=; b=Smxx/0C+UBjLD2u/0J2Kc5b0AKji3AakT4vWUy4pA7WB5VhA/05aGdGWds1yh7z1eC XB6ZDNRKB+AEQ0dcY5un/9v7qHM5AOwjIlRkU/9BHtBc4skLVgvewzmLpjrPU3Y5e2Ro Z/PaZmU0lbKLDBFDG1cBPkFJ8DggYLo3oXTS4= Original-Received: by 10.52.24.82 with SMTP id s18mr279449vdf.85.1314925211360; Thu, 01 Sep 2011 18:00:11 -0700 (PDT) Original-Received: by 10.52.166.232 with HTTP; Thu, 1 Sep 2011 18:00:11 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.212.41 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:12729 Archived-At: --20cf3079baf6211ef404abeae237 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Fri, Sep 2, 2011 at 5:01 AM, Ludovic Court=C3=A8s wrote: > Hi, > > Nala Ginrut 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 =E2=80=98scandir=E2=80=99 (and ot= hers) atop > =E2=80=98file-system-fold=E2=80=99. > > 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 =E2=80=98directory-contents=E2= =80=99 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=E2=80=99re right. However, I feel that we can come up with some= thing > 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'? --20cf3079baf6211ef404abeae237 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On Fri, Sep 2, 2011 at 5:01 AM, Ludov= ic Court=C3=A8s=C2=A0<ludo@gnu.org>=C2=A0wrote:
Hi,

Nala Ginrut <nalaginrut@gmail.com&= gt; skribis:

> I don't mean 6 args is =C2=A0improp= er. 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 =E2=80=98scandir=E2= =80=99 (and others) atop
=E2=80=98file-system-fold=E2=80=99.

The = scandir(3) C function is really meant to be a higher-order function
but its interface is awkward and mixes different concerns (traversal andfiltering.) =C2=A0Using something akin to the =E2=80=98directory-contents= =E2=80=99 procedure
I posted earlier, one could then use SRFI-1 to do ac= tual filtering.

> 'scandir' is a POSIX function, so many people will th= ink it exists in Guile.
> We have 'opendir' and 'readdir&= #39;, but no 'scandir', that's strange.

Yes, you= =E2=80=99re right. =C2=A0However, I feel that we can come up with something=
both simpler and more expressive, as sketched above.
<= br>
yeah~I realized that the idea about a bunch of = =C2=A0gorgeous high-order functions around one base function 'file-syst= em-fold' is more creative and flexible. It becomes happier to add new f= eatures into Guile than wrap a C function. Anyway, C is more painful. ;-)
So, have you already implemented others like 'directory-content= 9; instead of 'scandir' ? Or should we submit some patches for it?<= /div>
What about the sort method? And I hope it won't dismiss "= ;." and ".." in the result.=C2=A0
Let me retell my need, I need the function returns a sorted list which= contained "." and "..". Is it easy to implement it wit= h 'file-system-fold'?=C2=A0
--20cf3079baf6211ef404abeae237--