aoc-forth

Advent of code solutions in UF forth
git clone git://git.alexwennerberg.com/aoc-forth
Log | Files | Refs | README

commit 41d623b8117388eb767b14736997be82d66c8a1f
parent 0700ab22c61bfbb306365d694f2a07e1450c1ee5
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Sun,  4 Dec 2022 02:21:00 -0800

simplify more

Diffstat:
M2022/04.fs | 7++-----
1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/2022/04.fs b/2022/04.fs @@ -1,6 +1,3 @@ -45 constant dash -44 constant comma - : 4dup 3 pick 3 pick 3 pick 3 pick ; : not-num ( u -- f ) dup 0 < swap 9 > or ; : c>num ( c -- u ) 48 - ; @@ -10,8 +7,8 @@ rot 10 * + swap again ; : includes ( u1 u2 u3 u4 -- f ) 4dup rot <= -rot <= and >r rot >= -rot >= and r> or ; : overlaps ( u1 u2 u3 u4 -- f ) -rot >= -rot <= and ; -: read-str pad 12 erase pad pad 12 accept ; -: read-pairs ( -- u1 u2 u3 u4 ) read-str drop next-num next-num next-num next-num drop ; +: read-str pad 12 erase pad 12 accept drop ; +: read-pairs ( -- u1 u2 u3 u4 ) read-str pad next-num next-num next-num next-num drop ; variable total1 variable total2