Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

APL - back in the days when programmers

  1. Apr 26, 2009 #1

    rcgldr

    User Avatar
    Homework Helper

    APL - back in the days when programmers were programmers and men were men ....

    Almost put this in the goto thread, but it deserves a thread of it's own. Typical APL program:

    aplfns.jpg

    Just in case it's not obvious, it's a program to display all the programs in a workspace as if a user displayed them manually (except for the fns program itself). I still have an old dos directory of APL source code.
     
  2. jcsd
  3. Apr 26, 2009 #2
    Bah, APL holds your hand too much. You know what's an actually cool programming language, is UNLAMBDA. Here's a program to calculate the Fibonacci numbers written in Unlambda:

    Code (Text):
    ```s``s``sii`ki
      `k.*``s``s`ks
     ``s`k`s`ks``s``s`ks``s`k`s`kr``s`k`sikk
      `k``s`ksk
    Behold the simplicity! Unlambda is the world's first purely functional programming language, by which I mean that there is nothing but functions. Most supposedly "functional" languages-- like Scheme or Erlang-- actually clutter things up by introducing non-functional concepts like "numbers" and "strings" and and "lists" and whatnot (even though it's perfectly possible to emulate those things using functions). Unlambda keeps it simple. There is exactly one syntactical element, the ` character, which in Unlambda means "apply this function to the next function". Other than this one piece of syntax the language consists of a number of builtin functions, each of which takes one function as an argument and returns one function as a result. For example, s is the function which takes a function X as an argument and returns the function which when given an argument Y returns the function which when given an argument Z evaluates and returns the results of X applied to Z, applied to Y applied to Z. Behold the convenience!

    You will of course have noticed by now that unlambda contains the s, k, and i combinators from the calculus of logical combinators, so of course most people who write unlambda use the convenient shortcut of writing their program as an expression in lambda calculus, then translating to SKI. However although this alone would be enough for most users (and indeed the S and K functions are all unlambda would need to be turing-complete), Unlambda offers a wealth of other features, including call/cc.

    In short, Unlambda is basically to Scheme what INTERCAL is to C. Unfortunately, it is not as well known as INTERCAL. I've never been able to figure out why not.
     
  4. Apr 26, 2009 #3
    Also incidentally I'm curious if anyone has any experience with "K". Supposedly this is like a modern version of APL that is possible to type on a standard keyboard.
     
  5. Apr 26, 2009 #4
    I've messed around with J (similar to K). Fun as an exercise, but I never got into it to the point where I'd prefer it for anything.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: APL - back in the days when programmers
Loading...