myrmepropagandist on Nostr: Who wants a recursive headache? One of my very bright students is writing a program ...
Who wants a recursive headache?
One of my very bright students is writing a program to evaluate the total resistance in a network of resistors. She came up with these nested lists to represent the network. The top level is in series and it alternates series and parallel as you go deeper.
[r1, [r2, r3],[[r4, r5,],r6],r7]
That’s r1 + 1/[1/r2+ 1/r3]+ 1/[1/(r4+r5) + 1/r6] + r7
Or
s(r1, p(r2,r3), p(s(r4, r5), r6), r7)
So this ought to be a piece of cake to parse recursively right? right??
Published at
2024-02-09 21:23:42Event JSON
{
"id": "ff53e9b7eec2d7eab518c1d5435dbd928c862d09141d79ac9733f42d0015ddc7",
"pubkey": "c054144d7615820eaa2322e78ba10e111c44219059482b21ba71e51a9729f40b",
"created_at": 1707513822,
"kind": 1,
"tags": [
[
"proxy",
"https://sauropods.win/users/futurebird/statuses/111903625851782102",
"activitypub"
]
],
"content": "Who wants a recursive headache? \nOne of my very bright students is writing a program to evaluate the total resistance in a network of resistors. She came up with these nested lists to represent the network. The top level is in series and it alternates series and parallel as you go deeper. \n[r1, [r2, r3],[[r4, r5,],r6],r7]\nThat’s r1 + 1/[1/r2+ 1/r3]+ 1/[1/(r4+r5) + 1/r6] + r7\nOr\ns(r1, p(r2,r3), p(s(r4, r5), r6), r7)\nSo this ought to be a piece of cake to parse recursively right? right??",
"sig": "f4f823941b563f6a83ee4154960e6fa180237d998ee23bb661c9f8cb1a05e89222bd248375b4e3d19a04c9001935951d812c6653ca530c4734f3d4268e4a90d8"
}