I certainly learned some interesting things from fiddling with
The Fibonacci Challenge(™) for Smalltalk on my Pi.
The obvious new thing was that whole field of amazing number handling algorithms I'd never had reason to look at before. I just love the thought processes behind the "oh, let's stick this in a matrix, then simply taking that to the power of n gives us the nth Fibonacci number". And the Karatsuba/Toom-Cook algorithms... fabulous stuff. So, thank you for leading me down that path.
Specifically for Smalltalk it prompted putting those algorithms into the system for the next release and a massive speed up in handling large numbers. Now we have to look and see if there are any equivalently better algorithms we've been ignoring for simplifying Fractions (least common denominator etc) because although it can be really useful to have that sort of exactness, they can be a bit slow to use.
It was also interesting to (re)try the commandline stuff in Squeak Smalltalk; I haven't had any reason to play with it in years and it was also fascinating to see how deeply attached some people are to using such a thing. I'd forgotten that we could handle commandline input that was a URL or zipped files, for example. What still isn't done right is being able to
not have the GUI open up before considering the commandline parameters; this is mainly because the initial usage for that was to specify an EToys project file for the SUGAR/OLPC project, where you certainly want the GUI open.
As a slightly weird aside, I ended up playing briefly with the way unices can have a
type line at the beginning of files intended to be used like scripts. It turns out that one can use
as well, though it did require a tiny tweak to Squeak to ignore the !# line in the file. That made it possible to have the fibonacci script file be
Code: Select all
#! /usr/bin/squeak
some smalltalk code to load for a fibonacci method
some smalltalk code to run that method and write results out
Pretty cool.
But - there is something
even cooler that is perhaps of much wider interest, and that is the way that unix handles these scripting header lines. I'd always assumed it was fxed as
but it actually isn't. It's just a part of something that appears to be called the binfmt handler. You can actually register a rule and an interpreter of the files that match that rule, and one of the Squeak mailing denizens demonstrated a rule that allowed for a .st file to start with "!" (" being the Smalltalk comment delimiter) and be otherwise unchanged. Now that is a seriously cool thing to be able to do. It's all centred around /proc/sys/fs/binfmt_misc/register and there is a document at
https://www.kernel.org/doc/Documentatio ... t-misc.rst that describes a bit about it.