# Log 2022-08-05 PDE Solvers on regular: - finite difference methods can only be done on a very simple domain - finite element methods - [https://stephenfay.xyz](https://stephenfay.xyz/) We talked about optimizing a python program that reads EEG data (timeseries, interleaved, 10GB files, python kernel, using fread). I talked about latency, bandwidth, asynchronous calls and caches, and how it just composes all the way down. This brought me then to mention feedback loops as the bigger overarching pattern of optimization. What if he writes his code and send it to the scientist and every bugfinding iteration takes 2 weeks, instead of sending a test python notebook for quick iteration in an afternoon, with zoom calls. Where is the real bottleneck at this point? This is what I heard in the [[corecursive Podcast]] with [[Daniel Lemire]] this morning too, where he was talking about processing wave data for physicists, and because the program was so slow, he didn't hear back from them for months. There's some really good related quotes in [The Systems Thinker – A Lifetime of Systems Thinking - The Systems Thinker](https://thesystemsthinker.com/a-lifetime-of-systems-thinking/) about [[Systems Thinking]]: > [!quote] Improving the performance of the parts of a system taken separately will not necessarily improve the performance of the whole; in fact, it may harm the whole. > [!quote] Problems are not disciplinary in nature but are holistic. > [!quote] The best thing that can be done to a problem is not to solve it but to dissolve it. > [!quote] The healthcare system of the United States is not a healthcare system; it is a sickness and disability-care system. > [!quote] The educational system is not dedicated to produce learning by students, but teaching by teachers—and teaching is a major obstruction to learning. > [!quote] The principal function of most corporations is not to maximize shareholder value, but to maximize the standard of living and quality of work life of those who manage the corporation. ## Programming with Categories - Lecture 0 Nothing is perfectly math in this world, there is not one goat or two goats. There is a pure side for thinking and an applied side for doing, and somehow they almost relate, and they relate enough that one can be useful for the other. Haskell is not a perfect category. ## Pairing with Maxwell on Lisp ![[2022-08-05 2022-08-05 13.35.42.excalidraw.svg]] [[2022-08-05 2022-08-05 13.35.42.excalidraw]] ```lisp (defvar *valid-states* '(:s-select-action :s-select-move-destination :s-select-attack-destination :s-destination-selected :s-turn-committed)) (defvar *valid-actions* '(:a-select-move :a-select-attack :a-choose-destination :a-undo-destination :a-commit-turn :a-next-turn)) (defparameter *current-state* :s-select-action) (defun dispatch-action (action) (case (cons state action) ((:s-select-action :a-select-move) (setf *current-state* :s-select-move-destination)) ((:s-select-action :a-select-attack) (setf *current-state* :s-select-attack-destination)) ((:s-select-move-destination :a-select-destination) (setf *current-state* :s-destination-selected)) ((:s-select-move-destination :a-undo-destination) (setf *current-state* :s-select-move-destination)) ((:s-select-attack-destination :a-select-destination) (setf *current-state* :s-destination-selected)) (t "INVALID MOVE"))) (def-state-machine game-state-machine :default-state :s-select-action :transitions ((:s-select-action -> :s-move-destination) :action :a-select-move :handler #'(lambda (from to) ...)) ``` ## Pairing with Michael We ran into a problem formatting `protocol.MessageTypePing` using the format string "%x", which produced '4d6573736167655479706550696e67'. This is because `print.go` introspects arguments for certain verbs (a verb is the 'x' in '%x'). In the case of '%x', it does indeed check for the `Stringer` interface, converts the value as a string and prints out its hexdump. This is quite odd and not the expected behaviour. The solution is to print out these values as ```go fmt.Printf("MessageType: %s (%x)\n", hdr.MessageType, byte(hdr.MessageType)) ``` ## Links From the [[Blogging Devs Community]], an article about [[Writing Process]]: - [How I Write Refactoring ✍️ - by Luca Rossi - Refactoring](https://refactoring.fm/p/how-i-write-refactoring-?triedSigningIn=true) ## Capture