master
Matthew Butterick 5 years ago
parent 9b7edaf7d2
commit 3d8a6e28c2

@ -1,6 +1,5 @@
#lang debug racket/base #lang debug racket/base
(require racket/list (require racket/list
racket/file
"index.rkt") "index.rkt")
(define (make-words #:letters [letters "etaoinshrdluw"] (define (make-words #:letters [letters "etaoinshrdluw"]
@ -25,12 +24,10 @@
null) null)
mandatory-cs) mandatory-cs)
char=?)))) char=?))))
(define caser (cond
(define caer (cond
[all-caps? string-upcase] [all-caps? string-upcase]
[initial-caps? string-titlecase] [initial-caps? string-titlecase]
[else values])) [else values]))
(for*/fold ([word-acc null] (for*/fold ([word-acc null]
[count 0] [count 0]
#:result word-acc) #:result word-acc)
@ -55,7 +52,7 @@
;; maybe hide plurals ;; maybe hide plurals
(or (not hide-plurals?) (or (not hide-plurals?)
(not (word-rec-plural? rec))))) (not (word-rec-plural? rec)))))
(values (cons (caer (word-rec-word rec)) word-acc) (add1 count)))) (values (cons (caser (word-rec-word rec)) word-acc) (add1 count))))
(module+ test (module+ test
(require rackunit) (require rackunit)

Loading…
Cancel
Save