Creating a Lazy Sequence of Directory Descendants in C#

Posted on Dot net Slackers See other posts from Dot net Slackers
Published on Tue, 09 Mar 2010 00:00:00 GMT Indexed on 2010/03/11 5:48 UTC
Read the original article Hit count: 175

Filed under:
My dear friend Craig Andera posted an implementation of a function that descends into a directory in a "lazy" manner, i.e. you get the first descendant back right away and not after all descendants have been calculated. His implementation was in Clojure, a Lisp variant that runs on the Java VM: (import [java.io File])(defn dir-descendants [dir]  (let [children (.listFiles (File. dir))]    (lazy-cat      (map (memfn getPath) (filter (memfn isFile) children))...

Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.



Email this Article

© Dot net Slackers or respective owner