What, this post doesn't exist yet?
Of course, GolfScript is made for golfing, so you might think that no specific tips are really needed. But to make full use of GolfScript's features, you need to learn some non-obvious tricks. This post is for collecting such helpful tips and tricks.
To start with, here are the official GolfScript reference pages. You should really familiarize yourself with these first:
In particular, I would very much suggest reading the pages in this order — the quick reference is of little use until you're already reasonably familiar with the built-ins, and the tutorial includes some important details that are not explained on the other pages.
Ps. For the sake of inspiration and personal interest, here are some questions I'd like to see nice answers to:
How to do limited transliteration in GolfScript?
{FROM?TO=}%
works if you can be sure all the inputs are found inFROM
(or don't mind them all being mapped to the last element ofTO
), but all the ways I've seen for leaving unmapped values unchanged have been more or less klugey.How to best convert a string into an array of ASCII codes and back? Which operations do this as a side effect? What's the best way to dump the characters in a string onto the stack (like
~
does for arrays)?