summaryrefslogtreecommitdiffstats
path: root/2024/tcl/01.tcl
diff options
context:
space:
mode:
authorAleteoryx <alyx@aleteoryx.me>2024-12-03 03:53:49 -0500
committerAleteoryx <alyx@aleteoryx.me>2024-12-03 03:56:22 -0500
commit645bf066b803f6a5b62aba177f792269b92e5377 (patch)
tree65c344f818db7f3aab7b765b401c3f0dbf466fdc /2024/tcl/01.tcl
parent735b9fdf4535be1d721c59077e66def8b115d2ae (diff)
downloadadventofcode-645bf066b803f6a5b62aba177f792269b92e5377.tar.gz
adventofcode-645bf066b803f6a5b62aba177f792269b92e5377.tar.bz2
adventofcode-645bf066b803f6a5b62aba177f792269b92e5377.zip
prep
Diffstat (limited to '2024/tcl/01.tcl')
-rwxr-xr-x2024/tcl/01.tcl4
1 files changed, 1 insertions, 3 deletions
diff --git a/2024/tcl/01.tcl b/2024/tcl/01.tcl
index 2248e11..bf7e82f 100755
--- a/2024/tcl/01.tcl
+++ b/2024/tcl/01.tcl
@@ -5,7 +5,7 @@ setup 1
puts {Part 1: Find the sum of distances between pairs of numbers with the same ordinal in each list.}
-while {[gets $input line] != -1} {
+foreach line $input {
lassign $line ln rn
lappend left_nums $ln
@@ -14,8 +14,6 @@ while {[gets $input line] != -1} {
dict incr right_num_counts $rn
}
-close $input
-
set left_nums [lsort -integer $left_nums]
set right_nums [lsort -integer $right_nums]