Slashdot Mirror


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."

7 of 259 comments (clear)

  1. My head hurts by Alien54 · · Score: 3, Interesting
    One hallmark of Befunge programming is that all strings are reversed with respect to the IP; the following is the smallest 'Hello, World' program:
    55+".dlrow ,olleH">:#,_@
    Some folks just do not know when to quit
    --
    "It is a greater offense to steal men's labor, than their clothes"
  2. Programming challenge by hackerhue · · Score: 4, Interesting

    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.

  3. Universal Machine in 371 Bits by Baldrson · · Score: 5, Interesting
    John Tromp has managed to out do the lot of them with his "Kolmogorov Complexity in Combinatory Logic" wherein he concludes:

    A mere 371 bits suffice to encode a universal combinator equivalent to ...(a) universal Turing machine:

    11100110010100110010110011000010001110010101110010 110
    01100101001100101100101001100101100101011100110010 100
    01101110011001100110001011010110100101011100101011 100
    10110011001010011000010001110011001010010010100101 100
    01110001011100110000100011011100110010100110010110 010
    10011001011001010111001100101000110111001100010110 110
    00110111001100101001100110010100110000100011000110 001

    Dan Brumleve has a written a combinator interpreter in Perl that may be capable of evaluating Tromp's strange machine.

  4. Re:APL by DumbSwede · · Score: 4, Interesting
    The object of your uhmmmm... affection can be found here at retrocomputing which is listed in the article.

    I find it odd how every syntax I have ever seen in a computer language looks ugly and stupid to me, until I become fluent in it, then I won't abide any change after.

  5. Re:What's wrong with Haskell? by nellardo · · Score: 5, Interesting
    I happen to think that Haskell is one of the semantically cleanest languages out there (I put Self in the same category).

    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!
  6. Re:APL by edhall · · Score: 5, Interesting

    APL was a lot more common than you might think. It was the first language to treat matrices as first-class entities, and so was popular for a time among the mathematics set. It was amazingly fast, in part due to its innovative use of lazy evaluation (e.g. if you only wanted a single column of a large matrix, it wouldn't bother computing the rest of it).

    A bit of APL lore: Back in the late 1970's, Ken Thompson (one of Unix's creators) spent a summer at UC Berkeley (an event that was rather influential in BSD's development). Just for fun, he wrote an entire APL interpreter -- in one weekend. It was a real pain to work with since it used two-letter codes instead of the APL character set, but other than some of the quad functions (various OS primitives and so on) it was complete.

    It's one of the more spectacular feats of programming I've ever heard of.

    -Ed
  7. Re:What's wrong with Haskell? by tmoertel · · Score: 3, Interesting
    I happen to think that Haskell [haskell.org] is one of the semantically cleanest languages out there
    I was going to say in my earlier post that Haskell had the cleanest syntax and semantics, but I figured that regarding the latter some smart-aleck (which I suppose is now going to be me) would respond with a comment like this: Oh, really? Care to provide the clean semantics for Haskell's run-time space-consumption characteristics? At present the semantics are often best described by, "run it, and see what happens," although after a while one does develop a feel for it (which is incorrect more than one would like).

    For example, consider the expression,

    foldl1 (*) [1 .. 1000]
    which literally means
    (...((((1 * 2) * 3) * 4) * 5) ... 1000)
    and, by the way, is equivalent to your (fact 1000). Now, how much space is going to be consumed by its evaluation?

    Humans can easily see that the expression can be evaluated left to right, treating the operator (*) as strict, and, with the list defined by [1..1000] being built lazily, it is possible to evaluate the expression in constant space:

    = foldl1 (*) [1 .. 1000]
    = foldl (*) 1 [2 .. 1000]
    = foldl (*) 2 [3 .. 1000]
    = foldl (*) 6 [4 .. 1000]
    = foldl (*) 24 [4 .. 1000]
    = ...
    But is this what Haskell guarantees? Nope. An implementation might also do it like this:
    = foldl1 (*) [1 .. 1000]
    = foldl (*) 1 [2 .. 1000]
    = foldl (*) (1*2) [3 .. 1000]
    = foldl (*) ((1*2)*3) [4 .. 1000]
    = foldl (*) (((1*2)*3)*4) [5 .. 1000]
    = ...
    In this case the accumulator in foldl builds up a linear chain of thunks, which is evaluated only after the entire list is consumed.

    You and I can see that the second method is wasteful, but the language definition provides no guidance as to whether a Haskell implementation will choose the second or the more-efficient first. (In fact, GHC would until recently choose the second for this expression.)

    Don't get me wrong. Haskell is, without a doubt, my favorite language. It's what I used for my entry in this year's ICFP Programming Contest, and I consider it the best hope for a truly great mainstream functional programming language. I love Haskell. But its lack of intuitive space-consumption semantics is a serious weakness.

    And, regarding your fact example, it doesn't really show off Haskell's semantics as much as its syntax. Why not show the classic Fibonacci Series implementation, which highlights Haskell's non-strict evaluation semantics?

    fibs@(_:fibs') = 1 : 1 : zipWith (+) fibs fibs'
    Now, if that isn't a beautiful line of code, I've never seen one.
    The fastest FFT library out there is in C, but the C code itself was generated by Haskell code
    Actually, the FFTW code was generated by code written in O'Caml not Haskell.

    Cheers,
    Tom