Twitter Updates

    Categories

    PLT Scheme Iterators – Part 3

    Last post, I posted my in-path iterator that iterates through all the files in a particular path. Today’s function will recursively iterate through all the files in a path and its subdirectories. This is more useful for my Schemep3 program tha in-path because generally I want to recurse through all the files when [...]

    PLT Scheme Iterators – Part 2

    As I mentioned last time, I’ve also used the cool iterators in PLT Scheme to create iterators for directory contents. Without further ado:

    (require srfi/26)

    (define (directory-or-file-list path)
    (if (directory-exists? path)
    (map (cut build-path path <>) (directory-list path))
    (list path)))

    (define (in-path path)
    (make-do-sequence
    [...]

    PLT Scheme Iterators

    I recently came to understand the great power behind the iteration and comprehension forms in PLT Scheme.  Once I realized how they worked, I wrote the following iterator that will iterate over an association list and decouple the key and value in the process.

    (define (in-alist alist)
    (make-do-sequence
    (lambda ()
    [...]