commit c5bd90b3d8591073971e7f4d2279d562df60556c
parent 916b40fe1b29e26440be50a6cdbda89164474255
Author: Natasha Kerensikova <natgh@instinctive.eu>
Date: Mon, 5 Dec 2022 18:00:20 +0000
Add an after-the-fact comment to day 5 solutions
Diffstat:
1 file changed, 13 insertions(+), 0 deletions(-)
diff --git a/2022/day05.ps b/2022/day05.ps
@@ -296,3 +296,16 @@ show
showpage
quit
+
+% Thinking back about these solutions, I realize I went through them with
+% a kind of "functional" mindset, with immutable objects and functions
+% returns a new object built from the old one, while PostScript primitives
+% have more of a "referential" paradigm, e.g. "put" functions pop the
+% composite from the stack and modify it in place, leaving it to be accessed
+% from another reference. There are several places where fighting the
+% PostScript doesn't go well, e.g. with the rebuild and deep-rebuild.
+%
+% I should also probably have used a linear array for storage, the lack of
+% clarity of copies vs references was compounded by the use of an array of
+% arrays, instead of using a linear array and modular arithmetic to map
+% 2D coordinates into a linear index.