commit aba3e077ee55671ccb59dd81281cdfb4d639be60
parent e01416f2ac889d1f306ac0246edd0dfbe3d02a32
Author: Natasha Kerensikova <natacha@instinctive.eu>
Date: Mon, 5 Dec 2022 19:00:20 +0100
Add an after-the-fact comment to day 5 solutions
Diffstat:
1 file changed, 13 insertions(+), 0 deletions(-)
diff --git a/day05.ps b/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.