Find words whose first and last three letters are equal: Difference between revisions
Content added Content deleted
Line 471: | Line 471: | ||
testes |
testes |
||
</pre> |
</pre> |
||
=={{header|Racket}}== |
|||
<lang racket>#lang racket |
|||
(define ((prefix-and-suffix-match? len) str) |
|||
(let ((l (string-length str))) |
|||
(and (>= l (* 2 len)) |
|||
(string=? (substring str 0 len) |
|||
(substring str (- l len)))))) |
|||
(module+ main |
|||
(filter (prefix-and-suffix-match? 3) (file->lines "../../data/unixdict.txt")))</lang> |
|||
{{out}} |
|||
<pre>'("antiperspirant" "calendrical" "einstein" "hotshot" "murmur" "oshkosh" "tartar" "testes")</pre> |
|||
=={{header|Raku}}== |
=={{header|Raku}}== |