Esoteric Programming Languages
led_belly writes: "I came across this interesting page from the #alt.linux IRC chat room topic (irc.keystreams.com). It is an interesting read for all those who have ever been baffled by why/how some people do things. The Yahoo! Webring listing of similar topics is here."
Well, you do have to put stuff on the stack in reverse... since it's FI/LO. Breakdown of the program:
,olleH"
55+
put 5 on the stack twice, add the numbers on the stack together, leaving 10, or a newline in ascii.
".dlrow
put "Hello, world." on the stack in reverse, this is so we can pop it off in the proper order.
>:#,_@
very nice code to print out everything on the stack. '>' sets the IP velocity to "east", ':' duplicates the last item on the stack. '_' pops an item off the stack and tests it, if true, set IP to west, if false set it to east. The # skips the next instruction, and the comma prints the character off. So you're testing and printing until there's nothing left on the stack. The '@', finally, exits, which is executed when there's nothing left on the stack.
Makes sense?
[ approaching AI ]
As an intellectual challenge, rewrite DeCSS in any of these languages. Feel free to share your results with us.
To get something done, a committee should consist of no more than three persons, two of them absent.
Post Comment
Lameness filter encountered. Post aborted!
Reason: Please use fewer 'junk' characters.
Goddamnit, I just want to post brainfuck source.
They don't bother, but the language isn't static. There is a multi-threading extension for example. Typical of Intercal it is unlike all other threading packages I know of. It doesn't share data, only the code, all messages must be passed by altering the code (disabling and enabling blocks). Trintercal is base-3, there is also a base-N variant (the base-3 one shares some ops with the Klingon programming language...)
It has to be a toss up between:
(from INTERCAL)The Sieve of Erosthenes test for prime numbers up to 65535 took over seventeen hours on a SPARC--it requires only a half second using C.
and
(from SMETANA) The language has two instructions: "Swap step n with step m", and "Go to step p".
For all intensive purposes, "whom" is no longer a word. That begs the question, "who cares"?
That's right a Klingon programming language. Waaaaaaa! As far from Perl as one can get....
Comparing it to Windows will be a moot point, since El Dorado is going to have a 40% larger code base than XP.
No list of esoteric programming languages would be complete without a link to the Beer Page:
http://core.federated.com/~jim/99/ (mirror)
This is a collection of programs written in over 200 languages designed to print the canonical "99 bottles of beer on the wall" song.
A mere 371 bits suffice to encode a universal combinator equivalent to ...(a) universal Turing machine:
11100110010100110010110011000010001110010101110010 110 0 100 1 100 1 100 0 010 0 110 0 001
0110010100110010110010100110010110010101110011001
0110111001100110011000101101011010010101110010101
1011001100101001100001000111001100101001001010010
0111000101110011000010001101110011001010011001011
1001100101100101011100110010100011011100110001011
0011011100110010100110011001010011000010001100011
Dan Brumleve has a written a combinator interpreter in Perl that may be capable of evaluating Tromp's strange machine.
Seastead this.
When I was able to do my own spam-armoring, you got a chance to email me. Now you can only hope I see your reply.
If you want a strange programming language that garnered virtually no support and was a real pain in the ass, look up APL (primarily used at Pomona College in Claremont, CA, because the guy who invented it was a professor there).
APL was defined by coding which wasn't particularly inventive but which required a complete keyboard overlay - it didn't use ASCII characters (except in text, as I recall), but rather a mixture of greek symbols and shit the author just plain made up. So in effect you had to match 'objects' to keys on the keyboard, a completely non-intuitive way of typing. Talk about watching your hands while you work....
Unfortunately the college was incredibly gung-ho on APL and thought it would revolutionize coding, so if we wanted to do any serious work we had to do it in APL. This meant that about a dozen of us sat around learning APL so that we could program what might have been (don't really know, but I don't know of any other examples in 1983) the most massively multiplayer Star Trek ship battle game to date (up to 127 players, although the mainframe usually came to a grinding halt when we passed the 70 or 80 player mark). We then passed this program off as a science project, which it was accepted as since no one else could read the damned thing.
Well, I guess it had a use after all....
Max
My god carries a hammer. Your god died nailed to a tree. Any questions?
Learn them all !!!
Of course, you could also approach the task a little more systematically. A possible approach, and this is based purely on learning a language in order to improve one's thinking processes, rather than learning a language based on the marketability improvements possession of such knowledge brings, is to broadly catergorise them along the lines of 'problem solving styles', or 'programming mindsets' that they directly support or encourage.
Assuming no prior knowledge, you could start by learning procedural programming; a very good starting point is C. It is a small, compact language that will help you learn the basics of procedural programming; it's not a difficult language if you stay away, initially, from its more esoteric features like pointers and bitwise operators. Having learnt C, you will have a very solid grounding for learning languages such as JavaScript, C++, and Java because the 'syntactic core' of these languages is very similar.
Another procedural language is COBOL. It is quite a big language in terms of the number of reserved words ('verbs' in COBOL-speak) it offers. However, it is really quite a simple language and provides, as core facilities, tremendous file processing capabilities. In addition, it forces the programmer to be systematic, that is, you need to spell out exactly, and in painstaking detail, what it is you wish to do. In a way, its wordiness is its strength, and it is difficult to produce 'sloppy' code the way it is possible to do in, for example, C.
Next, you could tackle object oriented programming. You could start with either one of the very popular object-oriented languages, C++ and Java. Personally I would start with C++ as it is, I believe, more complex, and thus, more difficult to learn; if you master it, Java will come easy, and the hardest part will be simply to learn its rich set of packages (collections of objects).
Smalltalk is probably one of the purer object-oriented languages, is widely respected in the programming community, and, I should admit that the main reason I included it here is that its the next language on *my* list to learn. I've looked at a couple of Smalltalk code listings and have found it difficult, at first glance, to understand it; that being the case, I look forward to the challenge of learning it !
Now, for a couple of oldies, but goodies: LISP and Prolog. Neither of these has, as far as I'm aware, very significant commercial application, but if you are looking to try some truly 'different' programming approaches, in a bid to extend your thinking processes, then these are it !
LISP, for me, is a truly enjoyable programming experience. I won't pretend to be an expert in it, but by simply spending time with this language I have learnt so much about data structures, programming techniques, and, generally, problem solving techniques. It's a really good tool for 'doodling', that is, quickly whipping up little algorithms and immediately testing them. A definite 'must-learn' language !
Prolog is one I find fascinating. I'm still struggling with it, and although I've developed nothing more than simple database query applications with it, every time I work with it I find myself approaching a 'simple' problem in non-conventional ways, always forced to rethink how something should be done. I would recommend you look at this language to learn how to program in a truly non-procedural way, that is, to work 'with' the help of the language itself, rather than simply writing down commands for the compiler / interpreter to follow.
Finally, on top of these you could add interpretive 'scripting' languages, tools which are aimed more at 'gluing' applications together than being fully-fledged development languages in their own right (I know perl purists will probably scream, claiming this is heresy, but basically it is not so much a development language as a 'super-shell', an all-encompassing environment, almost an 'operating system within an operating system').
Finally, I should stress that, as a programmer, it is not just languages that you should be striving to learn, but to expand your knowledge in general. For example, acquiring general business, management, communication and 'people' skills will make you more aware of the 'real world' in which you must apply your skills.
While the idea of learning other programming languages is to extend your ability to identify and abstract problems, as well as adding to your 'armory' of programming tools, there is no substitute for a good grasp of your problem environment, that is, understanding the nature and type of 'problems' you will be asked to solve. Not every problem necessarily translates into a computer-based solution, hence the importance of also acquiring non-programming skills.
I mean really, in Haskell, "factorial" looks like this:
fact 0 = 1
fact n = n * fact (n - 1)
Write that, and "fact 20" works just fine:
Examples> fact 20
2432902008176640000
Examples>
However, implementing Haskell (or Self) on a von Neumann architecture is non-trivial. Implementing an efficient compiler or interpreter is tres difficil. People get Ph. D. dissertations for that sort of thing. For someone deeply used to C, Haskell and Self are perverse.
To wit:
- In Haskell, nothing changes. Ever. State change is handled by creating a new state from the old one. Semantically clean, but about as far from C as you can get.
- In Self, anything can change at any time. Yes, Virginia, you can redefine "if-then" whenever you feel like it. Change the inheritance hierarchy? No problem! Whoops! I made a cycle in the inheritance hierarchy! No problem! (yes, A can inherit from B and B can inherit from A). Think of C without the reliability that any particular operation (function call, operator, whatever) maps to the same place more than once. This kind of thing gives most C-family compilers hives. It used to be that C++ was perceived as significantly slower than C - I don't see anyone complaining about it anymore, but Haskell and Self are more extreme examples. C++ made it easy to use jump tables. Haskell makes it easy to use recursion, lazy evaluation, and a bunch of other things. Self makes it easy to use dynamic inheritance, multiple inheritance, even cyclical inheritance.
What is most impressive about these kinds of languages is that you can build efficient implementations, without the compromises to the semantics that C (or its derivatives) entails. The fastest FFT library out there is in C, but the C code itself was generated by Haskell code (code that came up with some original optimizations along the way). The Self compiler is the root technology for Java JIT compilers (when Sun killed the Self project, all the compiler people went to work on "virtual machine" compilers). Self was able to hit 50% of the speed of optimized C while maintaining:- Full source-level debugging
- Garbage collection
- Checks for stack and integer overflow
- and the ability to change the "class" of any object at any time (I put class in quotes because Self is an object-oriented language without classes - part of the super-simple semantics)..
In short, there isn't anything wrong with clean linguistic semantics. But essentially every computer sold today is built around the von Neumann architecture, and non-von-Neumann semantics (like that used by Self and Haskell) are non-trivial to implement.-----
Klactovedestene!
Back when I took compiler construction at Drake University three of us got together and made our own programming language called Eubonicode to help those who like to engage in ghetto algorithmic expression. I threw it up on the website. Here is the fibbonacci code:
sup
{
gimme fibo bitch
a be 1 bitch
b be 1 bitch
putou a bitch
putou b bitch
fibo be fibo widout 2 bitch
slongas (fibo bepimpin 0)
c be a an b bitch
a be b bitch
b be c bitch
putou b bitch
dissin fibo bitch
nomo
}
bash-2.04$
bash-2.04$yes "Don't you hate dialup connections?"| write USERNAME