2021/stats.rkt

22 lines
502 B
Racket
Raw Permalink Normal View History

2021-12-01 05:41:29 +00:00
#lang curly-fn racket
2021-12-05 18:34:29 +00:00
(require threading)
2021-12-01 05:41:29 +00:00
2021-12-05 18:34:29 +00:00
(define rkt-files
(filter #{regexp-match #rx".*\\.rkt$" (path->string %)}
(directory-list "src/" #:build? #{build-path "src/" %})))
2021-12-01 05:41:29 +00:00
(define srcs
2021-12-05 18:34:29 +00:00
(map (λ~>> file->lines
(filter non-empty-string?))
rkt-files))
2021-12-01 05:41:29 +00:00
(define src-lengths (map length srcs))
(define src-widths
2021-12-05 18:34:29 +00:00
(~>> (apply append srcs)
2021-12-01 05:41:29 +00:00
(map string-length)
(sort _ <=)))
(define src-widths-string
2021-12-05 18:34:29 +00:00
(string-join (map number->string src-widths) ","))