Paste: aoc9

Author: jon
Mode: factor
Date: Wed, 9 Dec 2020 08:18:19
Plain Text |
"/tmp/input" ascii file-lines [ string>number ] map
25 cut [
  H{ } clone <dlist> <search-deque> [ push-all-front ] keep
] [ swap
  [
    [ assoc>> keys dup [ [ - ] dip member? ] curry with find drop not ]
    [ [ pop-back drop ] [ push-front ] bi ] 2bi
  ] curry find nip
] bi* .


"/tmp/input" ascii file-lines [ string>number ] map
[ <dlist> 0 ] dip [
  [ nip swap push-back ] 3keep
  + [ dup 29221323 <= ] [
    over pop-front -
  ] until
  dup 29221323 =
] find 2drop drop V{ } clone [ [ push ] curry slurp-deque ] keep minmax + .

New Annotation

Summary:
Author:
Mode:
Body: