summaryrefslogtreecommitdiffstats
path: root/2024/tcl/01.tcl
diff options
context:
space:
mode:
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]