merits of Lisp vs Python

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rob Thorpe

    #661
    Re: merits of Lisp vs Python

    Bruno Desthuilliers wrote:
    Mathias Panzenboeck a écrit :
    Rob Thorpe wrote:
    >Mathias Panzenboeck wrote:
    >
    >>Mark Tarver wrote:
    >>
    >>>How do you compare Python to Lisp? What specific advantages do you
    >>>think that one has over the other?
    >>>
    >>>Note I'm not a Python person and I have no axes to grind here. This is
    >>>just a question for my general education.
    >>>
    >>>Mark
    >>>
    >>
    >>I do not know much about Lisp. What I know is:
    >>Python is a imperative, object oriented dynamic language with duck typing,
    >
    >Yes, but Python also supports the functional style to some extent.
    >

    I currently visit a course about functional programming at the university of technology vienna:
    python implements only a small subset of things needed to be called a functional language (list
    comprehension).
    >
    Python has functions as first-class objects (you can pass functions as
    arguments to functions, return functions from functions, and bind
    functions to identifiers), and that's the only thing you need to use a
    functional approach.
    Once you can do the above then you can phrase programs entirely in
    terms of composition of functions, which is what functional programming
    is about.

    Getting good performance though is problematic without being able to
    evaluate parts at compile time. This is why almost all functional
    languages provide that feature in some form.

    Comment

    • jayessay

      #662
      Re: merits of Lisp vs Python

      Paul Rubin <http://phr.cx@NOSPAM.i nvalidwrites:
      Ken Tilton <kentilton@gmai l.comwrites:
      pps. How would Python do this? Is it possible to avoid committing to
      an implementation mechanism? Compare and contrast. k
      >
      You'd just write a function. Python's expression syntax is comparable
      to a Lisp reader (you can have nested values of mixed types etc.) so
      you can use Python expressions to initialize pretty much anything.
      Nah, that won't work. He's defining a set of methods _declaratively_
      via a high level description.


      /Jon

      --
      'j' - a n t h o n y at romeo/charley/november com

      Comment

      • Willem Broekema

        #663
        Re: CLPython (was Re: merits of Lisp vs Python)

        Paul Boddie wrote:
        What would it take to get Python people more interested in it? I've
        been monitoring the site [1] and the mailing list [2] for some time,
        but nothing particularly visible seems to be happening.
        Well, judging from the reactions on blogs to the initial announcement
        here, quite some people have heard about it and seem interested. But
        that didn't result in more people hacking on it, which is unfortunate.

        I guess in part it's because there are not that many people really into
        both Python and Lisp, and those who are might not find this an
        interesting project because there is nothing "wow" to show, yet.

        So you are right about the project silence. Right now it's a one-person
        pet project, and progress is slow. But I'm already quite happy about
        the current state: stable, usable, and fairly complete.

        As for more exposure: I'd prefer to wait with big announcements until
        there are really interesting things achieved.

        Thanks a lot for your interest and comments!

        - Willem

        Comment

        • Mathias Panzenboeck

          #664
          Re: merits of Lisp vs Python

          Bruno Desthuilliers wrote:
          Mathias Panzenboeck a écrit :
          >Rob Thorpe wrote:
          >>
          >>Mathias Panzenboeck wrote:
          >>>
          >>>Mark Tarver wrote:
          >>>>
          >>>>How do you compare Python to Lisp? What specific advantages do you
          >>>>think that one has over the other?
          >>>>>
          >>>>Note I'm not a Python person and I have no axes to grind here.
          >>>>This is
          >>>>just a question for my general education.
          >>>>>
          >>>>Mark
          >>>>>
          >>>>
          >>>I do not know much about Lisp. What I know is:
          >>>Python is a imperative, object oriented dynamic language with duck
          >>>typing,
          >>>
          >>Yes, but Python also supports the functional style to some extent.
          >>>
          >>
          >>
          >I currently visit a course about functional programming at the
          >university of technology vienna:
          >python implements only a small subset of things needed to be called a
          >functional language (list
          >comprehension) .
          >
          Python has functions as first-class objects (you can pass functions as
          arguments to functions, return functions from functions, and bind
          functions to identifiers), and that's the only thing you need to use a
          functional approach.
          You mean like function pointers in C and C++? I think this should be possible in assembler, too.
          I thought functional languages have to be declarative?
          The boost C++ library has even lambdas!

          Comment

          • Kaz Kylheku

            #665
            Re: merits of Lisp vs Python

            Bruno Desthuilliers wrote:
            André Thieme a écrit :
            Bruno Desthuilliers schrieb:
            (snip)
            Both are highly dynamic. Neither are declarative.

            Well, Lisp does support some declarative features in the ansi standard.
            >
            If you go that way, there are declarative stuff in Python too... But
            neither Lisp nor Python are close to, say, SQL.
            False. Common Lisp can be made to support SQL syntax.

            Comment

            • Martin Rydstr|m

              #666
              Re: merits of Lisp vs Python

              Ken Tilton <kentilton@gmai l.comwrites:
              <snip>
              outrage over my condescension and arrogance.]
              Your condescension and arrogance are fairly well established, and no
              longer cause much outrage, except in extraordinary circumstances.

              ',mr

              --
              rydis (Martin Rydström) @CD.Chalmers.SE http://www.rydis.se

              [Emacs] is written in Lisp, which is the only computer language that is
              beautiful. -- Neal Stephenson, _In the Beginning was the Command Line_

              Comment

              • Paul Rubin

                #667
                Re: merits of Lisp vs Python

                "Rob Thorpe" <rthorpe@realwo rldtech.comwrit es:
                Once you can do the above then you can phrase programs entirely in
                terms of composition of functions, which is what functional programming
                is about.
                >
                Getting good performance though is problematic without being able to
                evaluate parts at compile time. This is why almost all functional
                languages provide that feature in some form.
                I'm not aware of any special features in Haskell for that purpose, or
                in Scheme until maybe with the more recent versions. I thought the
                main feature needed for functional programming besides first-class
                functions was guaranteed tail call optimization.

                Comment

                • Paul Rubin

                  #668
                  Re: CLPython (was Re: merits of Lisp vs Python)

                  "Willem Broekema" <metawilm@gmail .comwrites:
                  I guess in part it's because there are not that many people really into
                  both Python and Lisp, and those who are might not find this an
                  interesting project because there is nothing "wow" to show, yet.
                  I thought it was of some interest though I'm a little surprise by the
                  choice of CL rather than Scheme as a target.

                  I'm still not sure about the mapping of Python strings to Lisp strings.
                  What happens with the following in CLPython?

                  a = 'hello'
                  a[0] = 'H' # attempt to change first letter to upper case

                  Comment

                  • greg

                    #669
                    Re: merits of Lisp vs Python

                    Ken Tilton wrote:
                    How close can Python get when code is involved? The reverse function
                    signature is fixed, so can lambda help?
                    Lambda can be used if the body can be written as a
                    single expression. Otherwise you need to write the
                    function as a separate def. When the body is more
                    than a line or two, this is not usually much of
                    a problem, and is arguably more readable anyway.

                    --
                    Greg

                    Comment

                    • Bjoern Schliessmann

                      #670
                      Re: merits of Lisp vs Python

                      josephoswaldgg@ hotmail.com wrote:
                      What it isn't is some kind of miraculous invention that saves
                      programmers from ever making mistakes that are common in other
                      languages, or that reduces effort in copy-paste, as Bjoern seemed
                      to be claiming.
                      I didn't. I just stated that the Python way is less work for me.

                      Regards,


                      Björn

                      --
                      BOFH excuse #112:

                      The monitor is plugged into the serial port

                      Comment

                      • Bjoern Schliessmann

                        #671
                        Re: merits of Lisp vs Python

                        josephoswaldgg@ hotmail.com wrote:
                        What it isn't is some kind of miraculous invention that saves
                        programmers from ever making mistakes that are common in other
                        languages, or that reduces effort in copy-paste, as Bjoern seemed
                        to be claiming.
                        I didn't. I just stated that the Python way is less work for me.

                        Regards,


                        Björn

                        Xpost cll,clp

                        --
                        BOFH excuse #112:

                        The monitor is plugged into the serial port

                        Comment

                        • Gabriel Genellina

                          #672
                          Re: merits of Lisp vs Python

                          Warning: absolutely off topic!

                          At Thursday 14/12/2006 08:02, Christophe wrote:
                          >Well, I spent some time on Wikipedia looking up metric systems and
                          >things like that because of you, and I found a page that shows how to
                          >improve the current SI system by reducing the number of fundamental
                          >units to only two ( S for space and T for time ), and it was a great
                          >read. It even went so far as give a theory for the disapearance of the
                          >dinosaurs!
                          You can even make S = cT (c=ligth of speed in void space).
                          The choice of fundamental units is rather arbitrary, and can be
                          reduced further to only 1 fundamental unit and even NO fundamental units.
                          There is a nice book about this subject by L. A. Sena: Units of
                          physical quantities and their dimensions (or similar, I don't have it
                          at hand to check the title).


                          --
                          Gabriel Genellina
                          Softlab SRL

                          _______________ _______________ _______________ _____
                          Correo Yahoo!
                          Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
                          ¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar

                          Comment

                          • xscottg@gmail.com

                            #673
                            Re: merits of Lisp vs Python

                            Ken Tilton wrote:
                            Andrew Reilly wrote:
                            >
                            That all looks like data.
                            >
                            No, not reverse, the part you did not understand. I do not mean what the
                            code was doing, I meant that it was code.
                            >
                            Code is data is code - even in Python:

                            skills_table = [
                            {
                            "title": "Absolute Value",
                            "annotation s": ["Bleah bleah", "ho hum", "etc..."],
                            "hints": ["and so on", "etc..."],
                            "reverse" : (lambda x: whatever(x))
                            },
                            {
                            "title": "Square Root",
                            "annotation s": ["Bleah bleah", "ho hum", "etc..."],
                            "hints": ["and so on", "etc..."],
                            "reverse" : (lambda x: someother(x))
                            },
                            # etc...
                            ]

                            Of course those lambdas are crippled in Python (and not really
                            necessary in this bogus example)... But that's without trying to be
                            clever:

                            class AbsoluteValue:
                            title="Absolute Value"
                            annotations=["Some list", "goes here"]
                            @classmethod
                            def reverse(cls, *args):
                            # I didn't understand what your code was doing
                            pass
                            defskill(Absolu teValue)

                            That would be a reasonable place for a "pie decorator" on a class, but
                            I guess that's not allowed. I doubt this second example would be
                            considered "Pythonic" in any case...

                            Couldn't you do that with a table
                            containing those fields, and key it off the defskill argument (or even the
                            title?) at startup?
                            >
                            Not the code. In reverse.
                            >
                            Why not?

                            Python has plenty of other flaws that I can't happily work around, and
                            I do think Lisp is more flexible. However, I think your example is
                            readable enough with a data driven algorithm in most any popular
                            language. All of the data is visible to the reverse(...) method.
                            Maybe I missed something in your example, but I think you aren't trying
                            hard enough. :-)

                            The one I liked was: http://ll1.ai.mit.edu/shriram-talk.pdf

                            If I ever fill in your RtL survey, I'll be citing that one as a turning
                            point for me.

                            >
                            Interpolation does not mean what you think it means.
                            I'm sure he meant "string interpolation", which is a common enough term
                            in scripting languages nowdays.

                            It would be easier to compare and
                            contrast with the Python equivalent if someone had posted such, but your
                            troops have fallen back to Fort So What? and pulled up the drawbridge.
                            >
                            Oh God! Is it just me out here? And I'm not even a believer.

                            Cheers.

                            Comment

                            • David Steuber

                              #674
                              Re: merits of Lisp vs Python

                              Ken Tilton <kentilton@gmai l.comwrites:
                              Steven D'Aprano wrote:
                              If that's the best example of what macros can be used for, frankly I'm
                              unimpressed.
                              >
                              We're shocked.
                              Don't anyone tell him about LOOP.

                              --
                              This post uses 100% post consumer electrons and 100% virgin photons.

                              At 2.6 miles per minute, you don't really have time to get bored.
                              --- Pete Roehling on rec.motorcycles

                              I bump into a lot of veteran riders in my travels.
                              --- David Hough: Proficient Motorcycling

                              Comment

                              • David Steuber

                                #675
                                Re: merits of Lisp vs Python

                                "Wolfram Fenske" <int2k@gmx.netw rites:
                                Paul Rubin <http://phr.cx@NOSPAM.i nvalidwrites:
                                >
                                "Wolfram Fenske" <int2k@gmx.netw rites:
                                Yes, I wrote about it in another post. It was introduced in Python
                                2.5. And if it hadn't been I'd still have to write code like this.
                                You could do something with decorators that's not too bad. You'd end
                                up writing:

                                @withConnection
                                def some_func():
                                do_whatever_stu ff ()
                                >
                                Yes, now I can. But I had to wait until Python 2.4 to be able to
                                that. What I like so much about Lisp macros is that they allow me to
                                make these changes myself.
                                Besides, who wants to write production code in a language that keeps
                                changing? It's enough work just keeping up with new libraries.

                                --
                                This post uses 100% post consumer electrons and 100% virgin photons.

                                At 2.6 miles per minute, you don't really have time to get bored.
                                --- Pete Roehling on rec.motorcycles

                                I bump into a lot of veteran riders in my travels.
                                --- David Hough: Proficient Motorcycling

                                Comment

                                Working...