Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,18 @@
|
|||
#lang racket
|
||||
|
||||
(require racket/set)
|
||||
|
||||
(define (abbr-length ss)
|
||||
(for*/first ((l (in-range 1 (string-length (argmax string-length ss))))
|
||||
#:when (equal? (sequence-length
|
||||
(for/set ((s ss))
|
||||
(substring s 0 (min l (string-length s)))))
|
||||
(length ss)))
|
||||
l))
|
||||
|
||||
(module+ main
|
||||
(define report-line
|
||||
(match-lambda
|
||||
["" ""]
|
||||
[(and s (app string-split ss)) (format "~a ~a" (abbr-length ss) s)]))
|
||||
(for-each (compose displayln report-line) (take (file->lines "data.txt") 5)))
|
||||
Loading…
Add table
Add a link
Reference in a new issue