I cannot find any references on the Internet to any programming language called "Fifth", aside from [1].
The FIFTH programming language is one of John U. Sussman's joke languages published in InfoWorld and, later, to several USENET groups. It is a parody of Forth, a stack-based programming language.
The original description by Sussman is: FIFTH ... FIFTH is a precision mathematical language in which the data types refer to quantity. The data types range from CC, OUNCE, SHOT, and JIGGER to FIFTH (hence the name of the language), LITER, MAGNUM, and BLOTTO. Commands refer to in- gredients such as CHABLIS, CHARDONNAY, CABERNET, GIN, VERMOUTH, VODKA, SCOTCH and WHATEVERSAROUND.
The many versions of the FIFTH language reflect the sophisti- cation and financial status of its users. Commands in the ELITE dialect include VSOP and LAFITE, while commands in the GUTTER di- alect include HOOTCH and RIPPLE. The latter is a favorite of frustrated FORTH programmers who end up using the language
However...
In the 1980s, Kriya Systems developed and sold an object oriented Forth-like programming language which was initially announced as FIFTH. FIFTH never appeared on the market, but Kriya Systems did launch an object oriented Forth variant, named NEON. FIFTH is also the name of a Forth-based programming environment, described by Cliff Click and Paul Snow at the 1986 Rochester Forth Conference.
I found references to the Rochester Forth Conference variant @[2] as well as Neon@[3]. Wonder which one is it...
Any tips on where / how to start? Which books / tutorials worked for you? My background is in software engineering and the only thing I know about DSP is a very very basic understanding of the Fourier transform :)
This starts a declaration for our word 'shuffle'. This implementation expects the address of the array on the stack with the length of the array on top. Some Forth programmers would leave a comment to this effect like so:
( addr len -- addr )
Anything in parentheses is a comment, and this shows the contents of the stack we want as input (read from right to left) before the '--' followed by the contents of the stack we'll get as output. (We leave the array address on the stack. If we want to be void like the C example, add a drop to the end of this definition to discard it.)
1- for
Subtract one from the length given and begin a for...next loop. This will take the length value off the stack and repeat everything up to the matching next n+1 times. Equivalent to:
for(int z=n; z >= 0; z--) {}
Our stack now looks like this:
( addr )
While we're in the loop, a copy of the loop index can be pushed onto the stack via the word i. This actually accesses a secondary stack, so if you nest loops you can obtain progressive indices by using i' and j (or j and k, depending on your Forth dialect.)
i 1+ random
Add one to the loop index and generate a random number between 0 and this value, exclusive. Our stack now looks like:
( addr rand_int(i+1) )
over +
Over pushes a copy of the second element of our stack. This sequence adds the address of the array to the random index, leaving the address of that cell of the array. Our stack now looks like this:
( addr (rand_int(i+1)+addr) )
over i +
Make another copy of the array address and add the loop index to it. The stack now looks like this:
( addr (rand_int(i+1)+addr) (i+addr) )
swap@
This is a helper word which swaps the contents of two memory addresses. It should be easy to see that this will swap array indices for us in exactly the same way the C code did.
next ;
Close the loop and terminate the word definition, respectively.
Whoa..I'm definitely adding Forth to my "to-learn" list. The concept of a stack-based programming language is completely alien to me and would definitely be worth exploring further. On a side note, is it just me or is Forth's readiblity really low?
It takes some time to get used to dealing with the stack. The stack plus the fact that there aren't many "structural" symbols like the parentheses and curly braces of ALGOL-derived languages can certainly make Forth harder to skim at first. On the other hand, idiomatic Forth code should be factored into many very small definitions. Aggressive decomposition wins back some readability since everything will be in tiny bite-sized chunks, and it promotes reusing code too. I think personal preference is part of it.
[1]http://www.articleworld.org/index.php/FIFTH_programming_lang...
[2]http://www.forth.org/bournemouth/jfar/vol4/no2/article14.pdf
[3]http://drdobbs.com/184409686 (under the "Cheapo Neon" header)