[fixing a typo, plus adding a suggestion below] Thanks for the reply!
I see, so, it's a question of terminology. From reading the documentation I would expect that directory-entries would return all types of entries (as in "both files and subdirectories"), while directory-files would return files only (as in "entries of type = file, not subdir"). In fact, the distinction in naming is not between files and dirs, but rather between output consisting of tuples (directory-entry) and output consisting of strings (entry name>>'s). It would make sense to me if directory-files was renamed directory-strings or something, while directory-files would return the filtered list of entries ([ regular-file? ] filter). > 18.09.2015, 20:08, "John Benediktsson" <mrj...@gmail.com>: >> subdirectories are files of type directory. >> >> "regular files" are files of type regular file. >> >> you can filter for regular-files if you want. >> >> : directory-regular-files ( -- files ) >> directory-entries [ regular-file? ] filter [ name>> ] map ; >> >> Most languages do this, for example python in its ``os.listdir`` function. >> >> On Fri, Sep 18, 2015 at 10:04 AM, Alexander Ilin <ajs...@yandex.ru> wrote: >>> Hello! >>> >>> Why does directory-files returns the names of subdirectories. Shouldn't >>> it return file names only? > > ---=====--- > Александр > > ------------------------------------------------------------------------------ > _______________________________________________ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk ---=====--- Александр ------------------------------------------------------------------------------ _______________________________________________ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk