Dear fellow monks,

Please bonk me upside the head if "Meditations" is an inappropriate place to send this to.

Below is my rendition of this, with Perl added to the mix.

The Evolution of Language
2x(Descartes)
λx.2x(Church)
(LAMBDA (x) (* 2 x))(McCarthy)
sub { 2 * $_[0] }(Wall)
<?xml version="1.0"?>
(W3C)
<LAMBDA-TERM> <VAR-LIST> <VAR>X</VAR> </VAR-LIST> <EXPR> <APPLICATION> <EXPR><CONST>*</CONST></EXPR> <ARGUMENT-LIST> <EXPR><CONST>2</CONST></EXPR> <EXPR><VAR>X</VAR></EXPR> </ARGUMENT-LIST> </APPLICATION> </EXPR> </LAMBDA-TERM>

I am sorry to note that Perl appears to have been a step backwards in the march of progress.

the lowliest monk

Replies are listed 'Best First'.
Re: The Evolution of Language (redux)
by brian_d_foy (Abbot) on Mar 23, 2005 at 05:08 UTC

    The Perl equivalent of your starting point is much closer of any of the other ones (which also probably have much less obscure forms).

    2*$x

    To make the first one equivalent to the others, you'd have to do something that defines a function, like the other ones do.

    f(x) = 2x
    --
    brian d foy <bdfoy@cpan.org>
Re: The Evolution of Language (redux)
by Zaxo (Archbishop) on Mar 23, 2005 at 02:29 UTC

    Let's go ahead and take the perl version back to when rock'n'roll was done with real rocks. sub { (@_ ? $_[0] : $_) *= 2 } I think there are interpreters which can extract executable code from MathML, but absent that I'm not sure it's progress.

    Come to think of it, only the lisp and the perl versions are live code.

    After Compline,
    Zaxo

Re: The Evolution of Language (redux)
by webfiend (Vicar) on Mar 23, 2005 at 02:54 UTC

    What direction or evolution are you talking about? I'll admit that I'm not the most informed of folks, but I see:

    1. math
    2. math
    3. math as code
    4. code
    5. math as markup

    I downvoted this, but now I'm thinking I might have been hasty. Is there some context for the original PDF? I suspect that the author was being tongue-in-cheek in usage of the term "evolution", and now I suspect maybe you were likewise being a little silly with your use of the term "progress". But how can I tell? I am a geek of very small brain, and I need a little context.

    Next time I won't vote so quickly. Damn mouse-clicky reflex.

      I downvoted this, but now I'm thinking I might have been hasty.

      That will learn me.

      I suspect that the author was being tongue-in-cheek in usage of the term "evolution", and now I suspect maybe you were likewise being a little silly with your use of the term "progress".

      Yes and yes.

      the lowliest monk

Re: The Evolution of Language (redux)
by iblech (Friar) on Mar 23, 2005 at 17:17 UTC

    Perl 6, works nicely under Pugs :)

    { 2 * $^x } # or -> $x { 2 * $x } # or sub ($x) { 2 * $x } # or sub { 2 * $_[0] }

    The $^x is called a placeholder variable, -> $var { ... } is a pointy sub.

    They all can be invoked using:

    $sub(3); # or $sub.(3); # All except the last one can also be called using: $sub(x => 3); # or $sub.(x => 3);

    TIMTOWTDI! :)

Re: The Evolution of Language (redux)
by samizdat (Vicar) on Mar 23, 2005 at 14:00 UTC
    Don't know that it's a step backwards, although to be equivalent, I think it'd have to be written
    sub ( my $x = $_[0]; $x *= 2 )
    Whenceforth should we go, though? That is the question, and I agree with the OP and the POP that MathML isn't it.

    My APL is really rusty, but it seems to me that that language had the right idea, an operator (and definable operators) which would perform some operation on anything that was thrown at it. Ditto Smalltalk. However, in any such system, you increase the complexity of the interpreter in order to decrease the complexity of the programming syntax. Descartes and Church depended upon the mind to supply a suitable definition for x, and McCarthy's LISP will happily crash if given anything other than a scalar numeric value. Perl, at least in PP's coded version, will do a better job of taking what's thrown at it and emit something recognizable as output. Zaxo's variant does even better at characterizing "what follows".

      I think the original "Evolution of Language" thing was nothing more profound than some Lisper's joke about the back-breaking verbosity of XML.

      the lowliest monk

        You're almost certainly right,. Doesn't mean that we can't spring forth, though. :) Of course, I was just musing, and _don't_ pretend that what I said was any more profound than said joke. :D
Re: The Evolution of Language (redux)
by hardburn (Abbot) on Mar 23, 2005 at 14:19 UTC

    Yes, it's a step backward. However, it's the same step backward from LISP shared by all mainstream languages.

    public class Multiplier { public int double (int i) { return 2 * i; } }

    (Sorry if the above isn't quite right; my Java is rusty).

    "There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.

      The "step backwards" bit, just like the "evolution" and "progress" bits, is meant as irony.

      the lowliest monk