4 ms·
People interested in Forth might want to also check out PostScript (similar and stack-based). I recently wrote a blog post with a very brief PostScript tutorial
by ks2048 3y ago
People interested in Forth might want to also check out PostScript (similar and stack-based). I recently wrote a blog post with a very brief PostScript tutorial and an example program translated line-by-line to Python
https://kenschutte.com/postscript-vs-python/ https://kenschutte.com/postscript-vs-python/
- optimalsolver 3y agoJust fyi, typo on this line: >it this case, it’s a built-in
- whartung 3y agoWell, my favorite stack based language was RPL on the HP. Simply because it fit well in the scope of the environment that it was used. It was really easy to develop and debug on the calculator (I know many did very large projects working with editors on the PC, but I did all my work on the machine itself). It lacked any kind of composite structure outside of lists and arrays. No structs or records. But that was never a real barrier. It was just a nice, high level stack machine with a cool library and toolset.
- runlaszlorun 3y agoAs a big RPN and HP calc fan forever, and a recent Forth fan, I was a bit confused by my initial foray into RPL. It seemed like it allow infix notation and that threw me of at first glance. Did I bail to soon? I am a big stack machine convert and have had an HP RPN calc since 12.
- whartung 3y agoThe HP-48 certainly could do infix style calculations and formulas (the solvers work with these). But from the prompt it’s not particularly natural. Algebraic entry is a second class citizen. But do look at RPL. Anything that lets you push anonymous functions onto the stack can’t be all bad.
- shagie 3y agoMy favorite stack based language is dc. It's also the oldest language still found on Unix systems, predating even C (the original version was written in B on a PDP-11 - even before it had an assembler). https://www.cs.dartmouth.edu/~doug/reader.pdf https://www.cs.dartmouth.edu/~doug/reader.pdf > Almost everybody in the group has done languages. Thompson and Ritchie built assemblers from scratch. On the tiny PDP-7 the assembler was supplemented by tmg, Doug McIlroy’s version of Bob McClure’s compiler-compiler. Using it Thompson wrote B, the evolutionary link between Martin Richards’s (Cambridge University) BCPL and C. The PDP-11 assembler, a desk calculator dc, and B itself were written in B to bootstrap the system to the PDP-11. Because it could run before the disk had arrived, dc—not the assembler—became the first language to run on our PDP-11. Soon revised to handle arbitrary- precision numbers (v1), dc was taken over by Bob Morris and Lorinda Cherry. It now ranks as the senior language on UNIX systems.
- kragen 3y agohuh, i didn't realize until just now that dc had arrays, the : and ; operations i guess that makes it a far more practical platform for applications programming than i had always thought unfortunately afaik it still can't take character input. i guess you could pipe its input through something that converts it into a stream of numbers?
- sph 3y agoThanks, that's going on my reading list. Question to the more educated among us: I read that Apple's UI was based on Display PostScript... how similar is it to original PostScript, and why was it abandoned?
- ks2048 3y agoThat’s interesting. I don’t know anything about it but maybe it means it was based on PS “drawing model” more than the actual PS language. (ie the basic primitives and how stroke, fill, etc work)
- jasonwatkinspdx 3y agoIt was used as the display language for NeXT and some unix workstations. Just googling real quick it was a direct dialect of PostScript with the main changes being related to using efficient 32 bit integer ids in place of strings and similar performance optimizations.
- mepian 3y agoApple's UI is based on Display PDF since macOS 10 (Mac OS X, using the old branding), this is the royalty-free replacement for Display PostScript of OPENSTEP and NeXTSTEP which became the foundation for post-9 macOS after Apple absorbed NeXT. @DonHopkins is the most knowledgeable person on this topic here since he worked on another PostScript-based graphics system NeWS for the competitor Sun Microsystems.
- runlaszlorun 3y agoNeWS is an interesting animal. I loved going through the original PDF manuals for it.
- jacquesm 3y agoI have pinged Don (though there is a fair chance he's already sleeping).
- 3y ago
- forinti 3y agoThe first thing I ever wrote in Perl was a CGI script that printed out a form in Postscript. I wrote ps to draw boxes and fit the text the user had entered. It wasn't pretty to mix perl and ps, and I don't think I have ever written anything as wacky as that code, but it was fun. Folie de la jeunesse.
- kragen 3y agoi don't think postscript is very similar to forth, although they are both imperative and stack-based, which gives their syntax a superficial similarity what's more important is that (in the terminology of eopl) their expressed values and denoted values are completely different
- fouc 3y agoI once wrote a postscript script that took in dimensions and generated CAD drawings. It was quite fun!