X-Git-Url: https://njoseph.me/gitweb/experiments.git/blobdiff_plain/1d1e9c655f29bb909d271c35d3eb25336de30b3e..d909520e1068ca4837187f91a8c475c31f937758:/tag_find/tag-find.rkt diff --git a/tag_find/tag-find.rkt b/tag_find/tag-find.rkt new file mode 100644 index 0000000..faf6662 --- /dev/null +++ b/tag_find/tag-find.rkt @@ -0,0 +1,28 @@ +#lang racket + +(define tag "tag") + +(define start-sequence "#+") + +(define tag-match? ( lambda (line) + (and (string-prefix? line start-sequence) + (string-contains? line tag)))) + +;; TODO Make recursive +(define files + (filter file-exists? (directory-list))) + +(define (find-file files) + (when (not (empty? files)) + (define file (first files)) + (define (find-line lines) + (when (not (empty? lines)) + (if (tag-match? (first lines)) + (displayln file) + (find-line (rest lines))) + )) + (find-line (file->lines file)) + (find-file (rest files)) + )) + +(find-file files)