From 645bf066b803f6a5b62aba177f792269b92e5377 Mon Sep 17 00:00:00 2001 From: Aleteoryx Date: Tue, 3 Dec 2024 03:53:49 -0500 Subject: prep --- 2024/tcl/03.tcl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to '2024/tcl/03.tcl') diff --git a/2024/tcl/03.tcl b/2024/tcl/03.tcl index d1ff7c9..7f29b9a 100755 --- a/2024/tcl/03.tcl +++ b/2024/tcl/03.tcl @@ -1,14 +1,14 @@ #!/bin/env tclsh source lib.tcl -setup 3 +setup 3 data puts {Part 1: Sum of mul(x,y) calls...} set mulsum 0 set mulsum_cf 0 set cf 1 -foreach {inst a b} [regexp -all -inline {do\(\)|don't\(\)|mul\((\d+),(\d+)\)} [read $input]] { +foreach {inst a b} [regexp -all -inline {do\(\)|don't\(\)|mul\((\d+),(\d+)\)} $input] { switch -- [string range $inst 0 2] { mul { set inc [expr {$a * $b}] @@ -26,8 +26,6 @@ foreach {inst a b} [regexp -all -inline {do\(\)|don't\(\)|mul\((\d+),(\d+)\)} [r } } -close $input - puts "Sum: $mulsum" puts "" -- cgit v1.2.3-70-g09d2