The "desktop calculator", dc, is a programmable arbitrary-precision RPN calculator for Unix. It was one of the very first languages created under Unix, predating C. It has some reputation both for its arcane commands and the odd wizardly types who like it.
Ironically, although it does arbitrary-precision arithmetic, the maximum call stack is a very low system-dependent number (at least for some implementations). It varies from 900 to a few thousand on modern computers. What's the fun of arbitrary precision if you can't easily compute "100000!"?
Except for certain very minor points regarding arrays, the language is explained completely by the man page. Here's an example (FizzBuzzTest
) for inspection. A, B, C and X are macros and n is the main loop variable. Typical dc is quite a bit less structured.
[sg ] sX
[Buzz] l5 0 !=X
[Fizz] l3 0 !=X
n p sG
[ln p sG] sB
ln 3 % s3
ln 5 % s5
l3 l5 * d 0 =A 0 !=B
ln 1 + d sn
A compressed and more typical version of the program (65 characters, no whitespace) would be
has no feature for doing general text input or string manipulation, so an example for BagSumInManyProgrammingLanguages
would have to have a convoluted idea of string handling. However
, the command P already contains the functionality of printing an arbitrary-size integer as a series of base 256 digits.
- BeeCee?, the successor, which has fluff like sine built right in (implemented at least originally as a wrapper around DeeCee).
- MumpsLanguage bears a resemblance, both by the single-letter commands and the use of uninterpreted text chunks of code as the device for both conditional branches and functions
- FalseLanguage, also uses PostfixNotation and single letter commands, but it's a tiny (<1K) compiler
- TeXnicard, which has a lot of resemblance of dc as well, in @E and @S blocks