Smalltalk (and Dart) also have "cascading" which is method chaining with special supporting syntax e.g. in ST you'd send four different messages to the same object with something like
scene add: sprite;
add: otherSprite;
setBackGround: stage;
start
I'm not sure if it matches the "reuse values from previous computation" but it should since messages will affect the object, you just don't have local variables.
In Smalltalk, `;` does two things: terminates the current message (EDIT: while ignoring its return value) and propagates the target object of the current message as a target for the following message.
So this:
scene add: sprite;
add: otherSprite;
setBackGround: stage;
start
is equivalent to:
scene add: sprite.
scene add: otherSprite.
scene setBackGround: stage.
scene start.
It's a style I really enjoy, and it's definitely not exclusive to one language or paradigm, exactly. I see it as more of less of a kind with pipelines in Unix shells, too.
In Scala, a language with OOP heritage and support, plus lots of functional programming features, some of the most common methods you use in such chains are monads.
Relatedly, I once saw someone realize that the sound they played at the end of their build was running synchronously so they were blocking themselves from a faster feedback loop and reporting unusually long builds in their profiling. Properly backgrounding the sound fixed their issues.
I don’t remember if Mac had HTML but I used to set one of the quartz screensavers as my desktop back in the day. I can’t find links to how to do it right now so can’t test if it still works. It could only be set using a command line so it wasn’t exactly mainstream. I found “Flurry” to have decently low battery and CPU usage but many would chew through one or the other quickly.
For science I added versions of the benchmarks as for loops: it's faster than the while loop versions above, but min(heights) is still way faster:
def benchmark1for(heights):
smallest = heights[0]
for h in heights:
if h < smallest:
smallest = h
return smallest
def benchmark2for(heights):
smallest = heights[0]
for h in heights:
smallest = min(h, smallest)
return smallest
Python 3.12.1 on an M2 macbook air. For extra fun I also tested doing `sorted(heights)[0]` which is slightly faster than the benchmark2 variants, but slower than the benchmark1 variants.
Niches inside of niches. I’m one of the few who enjoys a split ergo with > 60 keys and low-pro caps that doesn’t want to build it myself. The sofle choc looks promising as does the pinky4[1] if it can be made with all chocs.
That’s over 40 minutes of a full day or 5 hours a week spent locking! As the author states it’s highly context dependent but in some cases this is a lot of time to do other work if it can be reduced.
I know at least Preview on MacOS has this feature now: if you try to put a black bar over text it tells you this isn’t secure and offers to redact for you using a method that both visually replaces all characters and removes the embedded text underneath It is non-destructive until saved meaning you have a window in which to make changes before the data is gone.
reply