Feed Aggregator Page 8796
No Title


Amazon is being creepy again…

I was checking batteries yesterday…

Joe Marshall: FOLD and NAMED-LET implementations

An anonymous reader requested an implementation of FOLD-LEFT
, FOLD-RIGHT
and NAMED-LET. Here they are:
https://github.com/jrm-code-project/fold
https://github.com/jrm-code-project/named-let
MIT license, developed and tested under SBCL, but should be portable. Implementation does not depend on tail recursion.
The New Deal Bookend


To Russia, With Love

Joe Marshall: Advent of Code 2024: Day 8

Day 8 is another grid puzzle. We are given a map of antennas. Two antennas operate on the same frequency have the same ASCII character on the map. A “node” is a location on the map that is in line with two antennas of the same frequency and is twice as far from one antenna as the other. We are to count the nodes.
We can create an alist from antenna frequency to antenna locations by inverting the map:
(defun read-grid (pathname) (read-file-into-grid (char-interner #’identity (find-package "ADVENT2024/DAY8")) pathname)) (defun grid->antenna-list (grid) (hash-table-alist (invert-grid grid ’|.|)))
This solution makes use of first class
functions. antinode-answer
takes a function that
produces an answer on one side of an antenna pair and applies it to
the pair and swapped pair to produce answers on both sides.
(defun antinode-answer (antinode-half-answer) (lambda (grid left right) (append (funcall antinode-half-answer grid left right) (funcall antinode-half-answer grid right left))))
antinode-list
takes a function that produces an
answer for pair a single pair of antennas and maps it over all pairs
of antennas on a frequency.
(defun antinode-list (antinode-answer) (lambda (grid node-list) (map-pairs (lambda (left right) (funcall antinode-answer grid left right)) node-list)))
All the antinodes
can be obtained by
invoking an antinode-list-generator
over a set of node
lists and appending the results.
(defun antinodes (antinode-list-generator) (lambda (grid node-list) (fold-left #’append nil (funcall antinode-list-generator grid node-list))))
So to solve the puzzle, we call an antinode generator on all the antennas.
(defun puzzle (grid antinode-generator) (length (remove-duplicates (fold-left (lambda (antinodes entry) (append antinodes (funcall antinode-generator grid (cdr entry)))) nil (grid->antenna-list grid)) :test #’equal)))
In part 1, there is one node to the left and right of each pair, twice the distance from one antenna to the other.
(defun antinode (grid left right) (let* ((delta (2v- right left)) (antinode (2v- left delta))) (when (on-grid? grid antinode) (list antinode)))) (defun part-1 () (puzzle (read-grid (input-pathname)) (antinodes (antinode-list (antinode-answer #’antinode)))))
For part two, the antinodes are at “resonant” points, i.e., spaced out equidistantly beyond the antenna pairs.
(defun resonant-antinodes (grid left right) (let* ((delta (2v- right left))) (do ((antinode left (2v- antinode delta)) (answer ’() (cons antinode answer))) ((not (on-grid? grid antinode)) answer)))) (defun part-2 () (puzzle (read-grid (input-pathname)) (antinodes (antinode-list (antinode-answer #’resonant-antinodes)))))
Lisp was the first computer language to have first-class functions and lambda
expressions.
Red Notice.

Threads in Bluesky

I started out doing a week to strip blue.threadcenter down to its bones, for a fresh start, but then I started getting ideas, and decided to go for it. I have the time, and Bluesky is having moment after moment and these days I'm using it to the exclusion of pretty much everything else, though I do check Twitter, Threads and Mastodon a few times a day, but usually there's nothing for me in those places. Anyway I'll be pointing to this post from some of my experiments, so maybe nothing more interesting than this will appear here.
An example of AI use

I just thought of a good example of a question you could bring to ChatGPT. Here's the prompt.
- I'm thinking of driving from NYC to Jacksonville, FL. I want to do it in four days with stopovers in three places that have good places to ride a bike and a Citibike-style bike rental. Choose three places on the trip, I don't mind going out of my way.
It gave me three places to stop, Washington DC, Raleigh NC and Charleston SC. In each case it told me about the bike-sharing services and notable bike trails.
A logical next question would be to ask it to find hotels in each place that are reasonably priced and near an interesting place to ride.
It also offered information about weather considerations. It's not necessarily a great time of year for bike riding.
I'm not actually planning a trip south, I just used it as an example because I've done this trip a number of times and was curious how things had developed.
Another question I used to have when cross-country driving, where can I find a Starbucks not too far off the route I'm on. If you were plotting the progress of public information systems, AI is strictly on a continuum of services that have developed over the years that make information more accessible in the way you want it. It actually answers questions you have in the way you think of asking them.
Here's a link to the response. I've heard that sometimes people have trouble accessing these files.
Well the ravens like my bread…

The Post Of Judgement


ระบบให้ค่าตามความสามารถเป็นเรื่องเหลวไหลทั้งเพ

The Future of Independent Agencies

Red Notice.

My post is my house

One of the not-good things about Mastodon is that you can't moderate comments under your own posts.
If someone says something abusive, it's there for everyone to see, forever.
I've come to value the feature in Facebook that gives the author full discretion over what comments remain, to head off bad vibes.
I think of a post I write as my house, and I want people who visit to feel respected.
A turd in the middle of the living room is not respectful.
My offer to Democrats in DC

A simple idea, a quid pro quo.
If we want Democrats to support the Constitution, we have to demonstrate that we will support them.
We are the government of the US, Congress represents us.
We have been too passive.
But then, they have to include us in governing.
No more shutting off the connection after the election.
Seems like a fair deal.
Weekly Update 14 Feb 2025

Private to weather forecasters…

Negaraisme dan Ilusi Pemilihan
