Reinventing the Wheel

Sure, there's existing code. Somebody Else's Code. It works fine, maybe not as fast as you'd like, or the interface isn't quite right. That's how it often is with me and SRFI-13. Olin Shivers is a skilled Schemer, back when that wasn't cool (OK, it's still not cool), but some of his APIs enshrined in early SRFIs drive me a little nuts, and the implementation is slow because it's so generalized.

So after a few false starts and failed tests, I now have these pretty things: (updated 2020-11-10, enforced hstart, hend boundaries)

;; Returns index of `needle` in `haystack`, or #f if not found.
;; `cmp`: Comparator. Default `char=?`, `char-ci=?` is the most useful alternate comparator.
;; `hstart`: Starting index, default 0.
;; `hend`: Ending index, default (- haystack-length needle-length)
(define string-find (case-lambda
    [(haystack needle)  (string-find haystack needle char=? 0 #f)]
    [(haystack needle cmp)  (string-find haystack needle cmp 0 #f)]
    [(haystack needle cmp hstart)  (string-find haystack needle cmp hstart #f) ]
    [(haystack needle cmp hstart hend)
        (let* [ (hlen (string-length haystack))  (nlen (string-length needle)) ]
            (set! hstart (max 0 (min hstart (sub1 hlen))))
            (unless hend (set! hend (fx- hlen nlen)))
            (set! hend (max 0 (min hend hlen)) )
            (if (or (fxzero? hlen) (fxzero? nlen))
                #f
                (let loop [ (hi hstart)  (ni 0) ]
                    ;; assume (< ni nlen)
                    ;(errprintln "hi=" hi ", ni=" ni ", hsub=" (substr haystack hi hlen) ", bsub=" (substr needle ni nlen))
                    (cond
                        [(cmp (string-ref haystack (fx+ hi ni)) (string-ref needle ni))  (set! ni (fx+ ni 1))
                            ;; end of needle?
                            (if (fx>=? ni nlen)  hi  (loop hi ni) )
                        ]
                        [else  (set! hi (fx+ hi 1))
                            ;; end of haystack?
                            (if (fx>? hi hend)  #f  (loop hi 0) )
                        ]
        ))))
    ]
))

;; Test whether 'haystack' starts with 'needle'.
(define (string-has-prefix? haystack needle)
    (let [ (i (string-find haystack needle char=? 0 0)) ]
        (and i (fxzero? i))
))

;; Test whether 'haystack' ends with 'needle'.
(define (string-has-suffix? haystack needle)
    (let* [ (hlen (string-length haystack))  (nlen (string-length needle))
            (i (string-find haystack needle char=? (fx- hlen nlen)))
        ]
        (and i (fx=? i (fx- hlen nlen)))
))

Written for Chez Scheme, caveat implementor. BSD license, do what thou wilt. If you find a bug, send me a failing test case.

I don't normally bother with fx (fixnum) operations, but in tight loops it makes a difference over generic numeric tower +, etc.

I Think We're Property

Dangers of near approach -- nevertheless our own ships that dare not venture close onto a rocky shore can send rowboats ashore --
Why not diplomatic relations established between the United States and Cyclorea -- which, in our advanced astronomy, is the name of a remarkable wheel-shaped world or super-construction? Why not missionaries sent here openly to convert us from our barbarous prohibitions and other taboos, and to prepare the way for a good trade in ultra-bibles and super-whiskeys; fortunes made in [155/156] selling us cast-off super-fineries, which we'd take to like an African chief to some one's old silk hat from New York or London?
The answer that occurs to me is so simple that it seems immediately acceptable, if we accept that the obvious is the solution of all problems, or if most of our perplexities consist in laboriously and painfully conceiving of the unanswerable, and then looking for answers -- using such words as "obvious" and "solution" conventionally --
Or:
Would we, if we could, educate and sophisticate pigs, geese, cattle?
Would it be wise to establish diplomatic relation with the hen that now functions, satisfied with mere sense of achievement by way of compensation?

I think we're property.

I should say we belong to something:
That once upon a time, this earth was No-man's Land, that other worlds explored and colonized here, and fought among themselves for possession, but that now it's owned by something:
That something owns this earth -- all others warned off.
Nothing in our own times -- perhaps -- because I am thinking of certain notes I have -- has ever appeared upon this earth, from somewhere else, so openly as Columbus landed upon San Salvador, or as Hudson sailed up his river. But as to surreptitious visits to this earth, in recent times, or as to emissaries, perhaps, from other worlds, or voyagers who have shown every indication of intent to evade or avoid, we shall have data as convincing as our data of oil or coal-burning aerial super-constructions.
Book of the Damned (1919), ch. 12, by Charles Fort

Eerily repeated in a lot of science fiction. Ironically, H.G. Wells' "War of the Worlds" is nearly a "we're property" story, but Wells irrationally hated Charles Fort. Likes repel, I suppose.

A few obvious ones, but there are dozens more (put them in comments if you like; archive.org links preferred!):

What I'm Watching: Yuru Camp△

Yuru Camp△ (aka Laid-Back Camp) is peaceful, calm, and friendly, the complete opposite of what I normally watch, and therefore it's very nearly the best thing I've ever watched, especially as comfort watching in this most terrible year yet.

A very small but very competent girl (Shimarin) goes solo camping in winter, and meets a hyperactive genki pink-haired girl (Nadeshiko) who is utterly unprepared for her day-trip to see Mt Fuji. More or less against her will, they become friends. Nadeshiko finds the school camping club, which is based in an unused hallway to nowhere, and not much more competent. But everyone's willing to learn, and they work side jobs and buy better and better gear. The cooking goes from "heat water to make cup noodles" to giant feasts of meat on charcoal and hot-pots.

The music's beautiful, the camping scenery is beautiful, there's no stress and the only tension is "OMG I overslept at this hot spring, I might be late for camp check-in!" (don't freak out, they make it OK).

Currently there's a season (12 x 24-minute episodes) of the main show (and make sure to watch credit to credit, they do interesting things in the credits and after), 4 x 12-minute "specials", and 12 x 3-minute "Heya Camp" stamp-collecting episodes. The second season is coming next year, and there's 9 volumes of manga which I'm likely going to get, though much of what I love is the music & scenery, the story & characters are merely there to show it to me.

I'm on my second watch-through, and likely will watch it again before S2.

★★★★★

What I'm Watching: American Murder: The Family Next Door

The conceit here is all footage is real police bodycam, Ring front-door spycams, phone footage, etc. I'm dubious about the how much of this was filmed before the events, and how much staged, but it's badly shot enough in many places to be possible. The Facebook captures are kind of gross, the fake SMS reenactments with fake misspellings and retyping are weird; "Shanann"[sic] was as bad at spelling everything else as her own name (it's normally pronounced & spelled "Shannon")?

It's creepy how much people share, without saying anything of substance. Self included, of course… you know what code and games I release, and my snarky media reviews, but I don't tell you anything else. On Fediverse, I mostly share jokes and comics I've found, and bitch about code.

The police station footage is really the disturbing part, as always when showing conversations with pigs: The touchy-feely-cop and bad-cop routine, no lawyer, cameras left running during "private" (but not protected by lawyer) conversations. Obviously the first and only words you should utter to cops are "I have no comment. I want my lawyer. Am I free to go?" Am I the weirdo for being incredibly skeeved out by pigs rubbing someone's shoulder to try to make them confess?

The "cashless economy" is an incredibly bad idea, and this shows why: Every step anyone takes is recorded as a bank charge. If you carry cash (as I mostly do), then only your dumb online purchases show up, which are probably not too incriminating.

The reveal of the murders, such as it is, is incredibly badly presented, but they just didn't have any footage to present it. And there's not enough "character building" to tell anyone why. I don't believe the statement accepted by the court, but no better information is possible.

In the end, this is a horror movie about people oversharing.

★★★☆☆

What I'm Watching: Deathsport

Deathsport (1978) is a sequel, of sorts, to Death Race 2000 (1975).

It immediately starts with some funky electronic music (the whole soundtrack is excellent if you like beepy '70s electronic music), and the best voiceover ever, the setting of every science-fantasy RPG setting I've ever run:

A thousand years from tomorrow, after the Great Neutron Wars,
the world consists of desert wastes and isolated city states.
A few machines remain as a reminder of the past,
but only the city-dwelling Statemen use them.
Between the cities roam the dreaded cannibal mutants
and the Range Guides. Guides are legendary warriors
leading an independent nomadic life,
owing allegiance only to their code.

Carradine and another range guide chick (an extremely drunk/coked up Claudia Jennings a year before her death) have a few battles against silver lamé-clad Statemen, riding "death machines" which are dirtbikes with some plastic plates glued on. I'm quite enamored of the clear plastic swords and light-up tube "blasters", not even a pretense of any gear being usable.

There's a child abducted by the mutants, who becomes a later sidequest. Or mutant lunch.

Eventually they're captured and spend entirely too long in bad prison cells, making small talk through a teeny grill. Some light torture, girls forced to dance naked under swinging blinky-light cables, nothing too interesting. The Statemen leader (David McLean, his last role while he was dying from lung cancer) wears black and is going insane, his sidekick (Richard Lynch, the only competent actor besides Carradine) wears black and is a traitor Guide, very very obviously some Star Wars influences.

Finally the big event, they're thrown into an arena (a dirtbike rally pit) against the Statemen. Mostly terrible teenage bike riders, but a few good explosive and pyro effects set off more or less at random. They blow up the force field walls to roam the wastes, hunted by the sidekick and a nigh-endless supply of goons.

A little bit of a "dungeon" crawl with torches, marching order, rats, some boinking in a cell. A lot of dirtbike fights, with these savage guides knowing exactly how to use the "death machines" better than trained Statemen soldiers. A second dungeon crawl in a "cave" with mutants. A third on-bike dungeon crawl/DOOM level with explosive barrels. They know what I like to see: Tits and explosions.

I'm somewhat impressed by the bike-front camera shooting. Trivial with a GoPro™ today, but in 1978, strapping a film camera to a dirtbike and getting any usable footage is amazing. Had to be some kind of stabilized rig?

The truth needs no introduction.
When the Sun rises, there's no necessity to announce it.
Clearly we have lost.
—sidekick contradicting his own thesis.

At least one of the writers must have played D&D or Metamorphosis Alpha, there's too many obvious gaming bits. The writing is all over the place, parts are somewhat clever and deep, there's what looks like some real setting lore, the rest is mashed together clichés and other movies; there were 4 writers, and probably Roger Corman fiddled with it, too. Carradine got in fistfights with the director, and another director had to finish it. Everyone was on drugs.

Dumb, only half-competent, but far more amusing than I expected.

★★★½☆

What I'm Watching: Hammer Dracula

The Hammer Dracula films deviate weirdly from the book, and each iteration gets stranger. Still, I'd like to see the rest; I've probably watched all of them at some point but it's been many decades.

  • Horror of Dracula (1958): Jonathan Harker is an ineffectual agent for Van Helsing (Peter Cushing), this time posing as a librarian for Count Dracula (Christopher Lee), whose castle is in "Klausenberg"/Cluj, Romania. The castle is quite nice, moody and gothic but also cleaned up enough to be a run-down Romanian palace. There's a pretty, slutty vampire wench in lieu of the 3 vampire brides. Soon enough we're in Karlstadt, Bavaria: No London or long sea voyages for this production! Mina has morphed into (pompous asshole) Arthur's blonde hausfrau wife (100% opposite of the Mina of the book), Lucy has become his chaste, brunette, engaged to Jonathan sister (even more variant, and completely changes the sexual element of her corruption). There's a Dr John Seward, but he's incidental, there's never a Quincey Morris cowboy in these adaptations.

Van Helsing does soon recruit Arthur and reveals while recording a gramophone memo (for this is an advanced 1885) all the powers and vulnerabilities of the vampire, in case you didn't know. Dracula is physically very powerful in his castle, but here in Karlstadt he relies entirely on suggestion and sneaking around, and while he has his way with "Lucy" the heroes quickly apply their scientific knowledge to destroy him.

The sets are nice, the film is bright and colorful. Chris Lee and Peter Cushing are excellent in their characters. But the script is nonsense, the plot is nothing like Dracula.

★★★★☆

  • I can't find Brides of Dracula or #3 Dracula Prince of Darkness in any reasonable way. Maybe later I'll catch up.

  • Dracula Has Risen from the Grave (1969): #4 in the series. It is now 1905. A girl is murdered in a church in the shadow of Dracula's castle; this is never clearly explained, because at this time Dracula is in torpor, frozen in a river (I dunno, #3 did it). A Monsignor (not quite a Bishop) takes the useless local priest up to Dracula's castle, does spiritual warfare (nothing) and claims victory. Well, no, because the useless priest coincidentally resurrects Dracula. So… did Dracula make that happen? Or is it just bad luck, dozens of people fell nearby over the decades but not quite in the right place?

But now we're in "Keinenberg", which sounds German but everyone and everything looks English, much less set decoration effort. The useless priest, a hot redhead barmaid, and a useless boyfriend of the Monsignor's "daughter" all bumble about, Dracula hangs out in the basement and does nothing but smoke a lot of dope, judging from his red eyes. Normally a Hammer film doesn't have time to be boring, but this one feels like it's taken hours.

There's no Van Helsing, is what it is. Say what you will about Abe's "YOU DAMNED FOOL" personality, it moves the plot along. The Monsignor putters about and does nothing, and is too fat and old for rooftop adventures. The lovesick useless boyfriend barely knows his line "where's Maria!" Dracula broods and stares, but apparently lacks the energy to do anything, except kill the slutty redhead, who was the only one I liked.

A very brief return to the bar and front door of the castle in Cluj isn't really enough of a set change, mostly it's just wandering thru woods like any Z-grade flick.

None of the vampire rules seem to apply to this one. You can see Dracula's reflections, it doesn't take multiple feedings to turn a victim, he can enter a house on his own. It is claimed you need prayer to defeat a vampire, which is not at all true in any other film; right angles inexplicably repel vampires, but the religious trappings don't do anything.

★★☆☆☆

Both have a rather overbearing score by James Bernard, who did many another Hammer soundtrack. A lighter touch and it would've been a good soundtrack, but brass shrieking at the audience made it hard to hear lines.

Fantasy & Science Fiction Magazine on Archive

I was looking specifically for Philip K. Dick's "Cantata 140", also found Roger Zelazny's "A Rose for Ecclesiastes" and look at that great wraparound cover! But also all of F&SF is in there, and it's pretty much all good, the best of the more literary end of SF, fantasy, weird tales. Unfortunately it hasn't all been neatly organized in a category on archive.org, but you can just page down in the pulp magazine rack.

Anyway, there's your reading stack for the next year sorted.