Shuffling the stack: first faltering steps on Factor

In my neverending quest of avoiding actually getting any of my projects ready, I started playing with Factor. In four years, Slava Pestov and the other folks hacking on Factor have created an extremely impressive language, beating many other dynamic languages like Python and Ruby in speed and providing an environment that doesn't make the Factor 2.0 goal "Best interactive development environment of any programming language" sound like an impossible idea.

But it does have a steep learning curve. The concepts of the language aren't difficult — in many ways it resembles other dynamic languages — but it feels like I'm clumsily trying to perform mental gymnastics instead of actually being productive. See, it's a Forth-style stack shuffling concatenative programming language. There are named variables (dynamically scoped, which feels weird, but that does have its uses when used sparingly) and these days there are even lexically scoped named locals, but depending on those instead of getting used to stack manipulation would be cheating, no? So now I'm slowly dupping, overing, tucking and swapping my way through simple algorithms, trying to switch my head into the right gear.

© Juri Pakaste 2023