Paste: aoc 2018 day 5

Author: Krenium
Mode: factor
Date: Wed, 5 Dec 2018 23:30:59
Plain Text |
: react ( seq -- seq' ) [
        [ length ] [
            dup 2 <clumps> [ first2 - abs 32 = ] find drop
            [ dup 2 + rot [ delete-slice ] keep ] when*
        ] over tri rot = not
    ] loop ;

"input5.txt" utf8 file-contents but-last-slice >sbuf
[ react length . ]
[
    [ 26 ] dip <repetition> CHAR: A CHAR: Z [a,b]
    [
          [ clone ] dip 2dup 32 + [ [ = ] curry reject! ] 2bi@ drop
    ] 2map [ react length ] map infimum .
] bi

New Annotation

Summary:
Author:
Mode:
Body: