Lambda: the Ultimate Design Flaw

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Daniel Silva

    #1

    Lambda: the Ultimate Design Flaw

    Shriram Krishnamurthi has just announced the following elsewhere; it might
    be of interest to c.l.s, c.l.f, and c.l.p:



    The Fate Of LAMBDA in PLT Scheme v300
    or
    Lambda the Ultimate Design Flaw

    About 30 years ago, Scheme had FILTER and MAP courtesy of Lisp hackers
    who missed them from their past experience. To this collection,
    Scheme added a lexically-scoped, properly-functioning LAMBDA. But,
    despite of the PR value of anything with Guy Steele's name associated
    with it, we think these features should be cut from PLT Scheme v300.

    We think dropping FILTER and MAP is pretty uncontroversial ; (filter P
    S) is almost always written clearer as a DO loop (plus the LAMBDA is
    slower than the loop). Even more so for (map F S). In all cases,
    writing the equivalent imperative program is clearly beneficial.

    Why drop LAMBDA? Most Scheme users are unfamiliar with Alonzo Church
    (indeed, they don't even know that he was related to Guy Steele), so
    the name is confusing; also, there is a widespread misunderstandin g
    that LAMBDA can do things that a nested function can't -- we still
    recall Dan Friedman's Aha! after we showed him that there was no
    difference! (However, he appears to have since lapsed in his ways.)
    Even with a better name, we think having the two choices side-by-side
    just requires programmers to think about their program; not having the
    choice streamlines the thought process, and Scheme is designed from
    the ground up to, as much as possible, keep programmers from thinking
    at all.

    So now FOLD. This is actually the one we've always hated most,
    because, apart from a few examples involving + or *, almost every time
    we see a FOLD call with a non-trivial function argument, we have to
    grab pen and paper and imagine the *result* of a function flowing back
    in as the *argument* to a function. Plus, there are *more* arguments
    coming in on the side! This is all absurdly complicated. Because
    almost all the examples of FOLD we found in practice could be written
    as a simple loop with an accumulator, this style should be preferred,
    perhaps with us providing a simple helper function to abstract away
    the boilerplate code. At any rate, FOLD must fold.

    --The PLT Scheme Team
  • Erik Max Francis

    #2
    Re: Lambda: the Ultimate Design Flaw

    Daniel Silva wrote:
    [color=blue]
    > Shriram Krishnamurthi has just announced the following elsewhere; it might
    > be of interest to c.l.s, c.l.f, and c.l.p:
    > http://list.cs.brown.edu/pipermail/p...il/008382.html[/color]

    April Fool's Day again, eh?

    --
    Erik Max Francis && max@alcyone.com && http://www.alcyone.com/max/
    San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
    If you can't fight and you can't flee, flow.
    -- Robert Elliot

    Comment

    • alex goldman

      #3
      Re: Lambda: the Ultimate Design Flaw

      Daniel Silva wrote:
      [color=blue]
      > At any rate, FOLD must fold.[/color]

      I personally think GOTO was unduly criticized by Dijkstra. With the benefit
      of hindsight, we can see that giving up GOTO in favor of other primitives
      failed to solve the decades-old software crisis.

      Comment

      • Sunnan

        #4
        Re: Lambda: the Ultimate Design Flaw

        Daniel Silva wrote:[color=blue]
        > We think dropping FILTER and MAP is pretty uncontroversial ; (filter P
        > S) is almost always written clearer as a DO loop (plus the LAMBDA is
        > slower than the loop). Even more so for (map F S). In all cases,
        > writing the equivalent imperative program is clearly beneficial.[/color]

        How about using srfi-42 instead of those nasty do loops?
        It's pretty clean:
        (list-ec (: a lis) (* a a))
        is equivalent to
        (map (lambda (a) (* a a)) lis)

        Before I discovered srfi-42, my code often had hideous things like:

        (append-map
        (lambda (item)
        (map
        (lambda
        (inner)
        (* inner inner))
        (cdr item)))
        lis)

        to return (1 4 9 16 25 36 49 64 81) for
        a lis that's '((a 1 2 3) (b 4 5 6) (c 7 8 9))).

        This becomes even neater:
        (list-ec
        (: item lis)
        (: inner (cdr item))
        (* inner inner))

        Have a happy first of april!

        Comment

        • Hans Oesterholt-Dijkema

          #5
          Re: Lambda: the Ultimate Design Flaw

          >[color=blue]
          > The Fate Of LAMBDA in PLT Scheme v300
          > or
          > Lambda the Ultimate Design Flaw
          >
          > Why drop LAMBDA?[/color]

          Why not? Isn't all code eventually anonymous and relocatable?

          Comment

          • Torsten Bronger

            #6
            Re: Lambda: the Ultimate Design Flaw

            Hallöchen!

            Daniel Silva <dsilva@ccs.neu .edu> writes:
            [color=blue]
            > Shriram Krishnamurthi has just announced the following elsewhere; it might
            > be of interest to c.l.s, c.l.f, and c.l.p:
            > http://list.cs.brown.edu/pipermail/p...il/008382.html
            >
            >
            > The Fate Of LAMBDA in PLT Scheme v300
            > or
            > Lambda the Ultimate Design Flaw
            >
            > About 30 years ago, Scheme had FILTER and MAP courtesy of Lisp
            > hackers who missed them from their past experience. To this
            > collection, Scheme added a lexically-scoped, properly-functioning
            > LAMBDA. But, despite of the PR value of anything with Guy
            > Steele's name associated with it, we think these features should
            > be cut from PLT Scheme v300.
            >
            > [...][/color]

            The whole text seems to be a variant of
            <http://www.artima.com/weblogs/viewpost.jsp?th read=98196>.

            Tschö,
            Torsten.

            --
            Torsten Bronger, aquisgrana, europa vetus

            Comment

            • Jeremy Bowers

              #7
              Re: Lambda: the Ultimate Design Flaw

              On Thu, 31 Mar 2005 23:30:42 -0800, Erik Max Francis wrote:
              [color=blue]
              > Daniel Silva wrote:
              >[color=green]
              >> Shriram Krishnamurthi has just announced the following elsewhere; it might
              >> be of interest to c.l.s, c.l.f, and c.l.p:
              >> http://list.cs.brown.edu/pipermail/p...il/008382.html[/color]
              >
              > April Fool's Day again, eh?[/color]

              Yes and no. In the Python community, we're taking all of that pretty
              seriously. The scheme community may not seriously be thinking of getting
              rid of those things, but it's hardly impossible that some people think it
              might be better off without it.

              Comment

              • Sunnan

                #8
                Re: Lambda: the Ultimate Design Flaw

                Jeremy Bowers wrote:[color=blue]
                > Yes and no. In the Python community, we're taking all of that pretty
                > seriously. The scheme community may not seriously be thinking of getting
                > rid of those things, but it's hardly impossible that some people think it
                > might be better off without it.[/color]

                Lambda is a primitive in Scheme; in some implementations of scheme it's
                used to implement things like temporary variables (let), sequences
                (begin) and looping (named let/letrec).

                Python has other ways of doing these things; and removing things that
                has been obsoleted or superfluous makes sense, for Pythons ideal of
                having one canonical, explicit way to program.

                Having a few very abstract primitives that the rest of the language can
                theoretically be built upon is one of the reasons why Scheme/Lisp can
                work as a programmable programming language.

                Scheme is like Go - a few abstract rules that can be combined in
                endless, sprawling ways.

                Python is like (hmm, better let some pythonista answer this. I'm
                thinking of a game with a clear thematical connection (like Monopoly or
                The Creature that Ate Sheboygan) and a few explicit rules that combine
                in ways that is supposed to have a clear, readable, consistent result).
                Maybe shogi?

                (I don't usually read comp.lang.pytho n and I really don't want to offend
                anyone. My apologies if this post is either annoyingly obvious (and thus
                contains only stuff that's been said a million times), or totally wrong.)

                Sunnan

                Comment

                • François Pinard

                  #9
                  Re: Lambda: the Ultimate Design Flaw

                  [Sunnan]
                  [color=blue]
                  > [...] for Pythons ideal of having one canonical, explicit way to
                  > program.[/color]

                  No doubt it once was true, but I guess this ideal has been abandoned a
                  few years ago.

                  My honest feeling is that it would be a mis-representation of Python,
                  assertng today that this is still one of the Python's ideals.

                  --
                  François Pinard http://pinard.progiciels-bpi.ca

                  Comment

                  • Joe Marshall

                    #10
                    Re: Lambda: the Ultimate Design Flaw

                    Jeremy Bowers <jerf@jerf.or g> writes:
                    [color=blue]
                    > On Thu, 31 Mar 2005 23:30:42 -0800, Erik Max Francis wrote:
                    >[color=green]
                    >> Daniel Silva wrote:
                    >>[color=darkred]
                    >>> Shriram Krishnamurthi has just announced the following elsewhere; it might
                    >>> be of interest to c.l.s, c.l.f, and c.l.p:
                    >>> http://list.cs.brown.edu/pipermail/p...il/008382.html[/color]
                    >>
                    >> April Fool's Day again, eh?[/color]
                    >
                    > Yes and no. In the Python community, we're taking all of that pretty
                    > seriously.[/color]

                    The Python community takes many things pretty seriously. Whitespace
                    and Guido come to mind.

                    Comment

                    • Ulrich Hobelmann

                      #11
                      Re: Lambda: the Ultimate Design Flaw

                      alex goldman wrote:[color=blue]
                      > Daniel Silva wrote:
                      >
                      >[color=green]
                      >>At any rate, FOLD must fold.[/color]
                      >
                      >
                      > I personally think GOTO was unduly criticized by Dijkstra. With the benefit
                      > of hindsight, we can see that giving up GOTO in favor of other primitives
                      > failed to solve the decades-old software crisis.[/color]

                      The fault of goto in imperative languages is that it has no
                      arguments, thus creating spaghetti of gotos and assignments.

                      Continuations rule!

                      Comment

                      • Aahz

                        #12
                        Re: Lambda: the Ultimate Design Flaw

                        In article <mailman.1192.1 112376393.1799. python-list@python.org >,
                        =?iso-8859-1?Q?Fran=E7ois? = Pinard <pinard@iro.umo ntreal.ca> wrote:[color=blue]
                        >[Sunnan][color=green]
                        >>
                        >> [...] for Pythons ideal of having one canonical, explicit way to
                        >> program.[/color]
                        >
                        >No doubt it once was true, but I guess this ideal has been abandoned a
                        >few years ago.
                        >
                        >My honest feeling is that it would be a mis-representation of Python,
                        >assertng today that this is still one of the Python's ideals.[/color]

                        Mind providing evidence rather than simply citing your feelings? Yes,
                        there's certainly redundancy in Python right now, but a large portion of
                        that will go away in Python 3.0. So where's the abandonment of the
                        ideal?
                        --
                        Aahz (aahz@pythoncra ft.com) <*> http://www.pythoncraft.com/

                        "The joy of coding Python should be in seeing short, concise, readable
                        classes that express a lot of action in a small amount of clear code --
                        not in reams of trivial code that bores the reader to death." --GvR

                        Comment

                        • Tom Breton

                          #13
                          Re: Lambda: the Ultimate Design Flaw

                          Daniel Silva <dsilva@ccs.neu .edu> writes:

                          [...]
                          [color=blue]
                          > So now FOLD. This is actually the one we've always hated most,
                          > because, apart from a few examples involving + or *, almost every time
                          > we see a FOLD call with a non-trivial function argument, we have to
                          > grab pen and paper and imagine the *result* of a function flowing back
                          > in as the *argument* to a function. Plus, there are *more* arguments
                          > coming in on the side! This is all absurdly complicated. Because
                          > almost all the examples of FOLD we found in practice could be written
                          > as a simple loop with an accumulator, this style should be preferred,
                          > perhaps with us providing a simple helper function to abstract away
                          > the boilerplate code. At any rate, FOLD must fold.[/color]

                          Couldn't you leave it in for just another month? And during the
                          remaining month, we'll just call it the "APRIL FOLD".

                          --
                          Tom Breton, the calm-eyed visionary

                          Comment

                          • Bengt Richter

                            #14
                            Re: Lambda: the Ultimate Design Flaw

                            On 1 Apr 2005 20:00:13 -0500, aahz@pythoncraf t.com (Aahz) wrote:
                            [color=blue]
                            >In article <mailman.1192.1 112376393.1799. python-list@python.org >,
                            >=?iso-8859-1?Q?Fran=E7ois? = Pinard <pinard@iro.umo ntreal.ca> wrote:[color=green]
                            >>[Sunnan][color=darkred]
                            >>>
                            >>> [...] for Pythons ideal of having one canonical, explicit way to
                            >>> program.[/color]
                            >>
                            >>No doubt it once was true, but I guess this ideal has been abandoned a
                            >>few years ago.
                            >>
                            >>My honest feeling is that it would be a mis-representation of Python,
                            >>assertng today that this is still one of the Python's ideals.[/color][/color]
                            ^^^^^--in particular?? That makes for a complex sentence ;-)[color=blue]
                            >
                            >Mind providing evidence rather than simply citing your feelings? Yes,
                            >there's certainly redundancy in Python right now, but a large portion of
                            >that will go away in Python 3.0. So where's the abandonment of the
                            >ideal?
                            >--
                            >Aahz (aahz@pythoncra ft.com) <*> http://www.pythoncraft.com/
                            >
                            >"The joy of coding Python should be in seeing short, concise, readable
                            >classes that express a lot of action in a small amount of clear code --
                            >not in reams of trivial code that bores the reader to death." --GvR[/color]

                            Regards,
                            Bengt Richter

                            Comment

                            • Sunnan

                              #15
                              boring the reader to death (wasRe: Lambda: the Ultimate Design Flaw

                              Aahz wrote:[color=blue]
                              > "The joy of coding Python should be in seeing short, concise, readable
                              > classes that express a lot of action in a small amount of clear code --
                              > not in reams of trivial code that bores the reader to death." --GvR[/color]

                              Can anyone please point me to the text that quote was taken from? I
                              tried to use a search engine but I only found quotations, not the source.
                              Sunnan

                              Comment

                              Working...