Python syntax in Lisp and Scheme

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Doug Tolton

    Re: Python syntax in Lisp and Scheme

    Alex Martelli wrote:
    [color=blue]
    > Doug Tolton wrote:
    > ...
    >[color=green]
    >>don't know me or my background. Alex has stated on many occasions that
    >>he has not worked with Macros, but that he is relying on second hand
    >>information .[/color]
    >
    >
    > I never used Common Lisp in production: in the period of my life when I
    > was hired (by Texas Instruments) specifically for my knowledge of "Lisp",
    > that meant Scheme and a host of other dialects (mostly but not entirely now
    > forgotten). I did use things that "passed for" macros in those dialects:
    > I had no choice, since each TI lab or faction within the lab was using a
    > different divergent mutant thing, all named "lisp" (save a few were named
    > "scheme" -- hmmm, I do believe that some were using Prolog, too, but I
    > did not happen to use it in TI), with some of the divergence hinging on
    > locally developed sets of macros (and some on different vendors/versions).
    >
    > For all I know, CLisp's macros are SO head and shoulders above any of a
    > quarter century ago that any vaguely remembered technical problem from
    > back then may be of purely historical interest. I do believe that the
    > divergence problem has more to do with human nature and sociology, and
    > that putting in a language features that encourage groups and subgroups
    > of users to diverge that language cannot be compensated by technical
    > enhancements -- it _will_, in my opinion, cause co-workers in any middle-
    > or large-sized organization to risk ending up standing on each others'
    > feet, rather than on each others' shoulders. (Remedies must of course
    > be sociological and lato sensu political first and foremost, but the way
    > the language & tools are designed CAN help or hinder).[/color]
    I can understand and respect honest differences of opinions. I too
    believe that causes of divergence are largely sociological. I differ
    though in thinking that features which allow divergence will necessarily
    result in divergence.

    I have this personal theory (used in the non-strict sense here) that
    given enough time any homogenous group will split into at least two
    competing factions. This "theory" of mine had it's roots in a nice
    dinner at Medieval Times in California. We had arrived for dinner and
    we were waiting to be seated, everyone was milling around in a sort of
    shop/museum area. We had been given "crowns" for dinner, but no one
    paid much attention to them. We were one large group of people, bound
    by nothing and separated by nothing. Then the one of the staff took a
    microphone and began giving us instructions. She told us the color of
    our hats indicated the color of the Knight we would be rooting for, and
    tha we would be sitting only with people of similar colored crowns.
    Immediately the group (without instructions from the hostess) began
    separating into similarly colored groups. Then they began calling the
    groups by color to be seated. When they called out group, and we were
    ascending the staircase, I looked over my shoulder at the remaining
    groups. I was utterly shocked to see apparent hatred and revulsion of
    our group on people's faces. To me this was a game, but to some people
    in the crowd, having a different colored crown was a serious cause for
    emnity.

    I have long looked back on that incident, and I have since compared it
    to many situations I have observed. Over time it seems to me that human
    beings are incapable of remaining as one single cohesive group, rather
    that they will always separate into several competing factions. Or at
    the very least groups will splinter off the main group and form their
    own group.

    So it doesn't surprise me when groups splinter and diverge if they are
    not strictly controlled from an organizational or sociological point of
    view.

    However in the opensource world I expect splinters to happen frequently,
    simply because there is little to no organizational control. Even
    Python hasn't been immune to this phenomenon with both Jython and
    Stackless emerging.

    Some people want power and expressiveness. Some people want control and
    uniformity. Others still will sacrifice high level constucts for raw
    pedal to the metal speed, while others wouldn't dream of this sacrifice.

    What I'm getting at is that I can understand why people don't like
    Macros. As David Mertz said, some people are just wired in dramatically
    different ways.
    [color=blue]
    >
    > So, I'm nowhere near an _expert_ -- over 20 years' hiatus ensures I
    > just can't be. But neither is it totally 2nd hand information, and if
    > I gave the mistaken impression of never having used macros in a
    > production setting I must have expressed myself badly. I do know I
    > jumped on the occasion of moving to IBM Research, and the fact that
    > this would mean going back to APL instead of "lisp" (in the above
    > vague sense) did matter somewhat in my glee, even though I still
    > primarily thought of myself as a hardware person then (the programming
    > was needed to try out algorithms, simulate possible hardware
    > implementations thereof, etc -- it was never an end in itself).
    >[/color]
    Thank you for that clarification. I must have been mis-interpreting
    something, because I did think you had never used them.[color=blue]
    >
    >[color=green]
    >>I don't claim to be a guru on Lisp, however I believe I understand it
    >>far better than Alex does. If the people who actually know and use
    >>Common Lisp think I am mis-speaking and mis-representing Lisp, please
    >>let me know and I will be quiet.[/color]
    >
    >
    > Give that I've heard "everything and its opposite" (within two constant
    > parameters only: S-expressions are an unalloyed good -- macros are good,
    > some say unconditionally , others admit they can be prone to abuse) from
    > posters on this thread from "people who actually know and use" Lisp, I
    > don't know how you could "mis-speak and mis-represent" as long as you
    > stick to the two tenets of party doctrine;-).
    >[/color]
    For me it isn't about party doctrine. :-p My mindset very closely
    matches Paul Grahams. I can understand why other people have a
    different mindset, and from what you've said I can even understand why
    you don't like Macros, I just have a different viewpoint.

    What get's me is when people (and I do this sometimes as well) expess an
    opinion as fact, and that all rational people will agree with them. So,
    for what it' worth, for the times I have expressed my opinion as the one
    true way of thinking, I'm sorry.[color=blue]
    >
    >[color=green]
    >>Like I said, I'm not an expert at Lisp, but I think I understand the
    >>spirit and semantics of Lisp far better than Alex, and from what I've[/color]
    >
    >
    > If by Lisp you mean Common Lisp and exclude Scheme, I'm sure you do; if
    > Scheme is to be included, then I'm not sure (but it's quite possible,
    > nevertheless) -- at least the "spirit" of the small core and widespread
    > HOFs w/single-namespace seem to be things I understand more (but the
    > "spirit" of why it's so wonderful to have extensible syntax isn't:-).[/color]

    Honestly I've only used scheme in trivial things. My preference has
    been more towards Common Lisp, primarily because I need it for building
    real systems, rather than doing language research.

    I'm sure there many things that you know that I don't. From what I
    understand you've been at this a bit longer than I have. I've only been
    doing serious programming for a little over ten years now. In that
    time I have been involved with some very large projects on a very large
    scale. I think I understand the concepts of abstraction and code reuse
    pretty well, and how to build large systems that integrate the efforts
    of numerous people.

    I personally just don't believe macros are "evil" per se. I believe
    they like any other tool can be used effectively, or misused
    effectively. However most of my problems don't come from people who
    misuse advanced features of the language, rather they come from people
    who don't understand basic concepts of optimization and code reuse.

    In any event, I think Lisp and Python are both great languages. I use
    Python every day at work, and I work on learning more about Lisp (and a
    top secret pet project ;) ) every day. I very much respect your
    knowledge Alex, because I do believe you have some good insights, and I
    do enjoy discussing issues that we disagree on (when we aren't being
    "bristly" ;) ) because you have many times helped me to understand my
    own point of view better. So even though we don't always agree, I still
    appreciate your opinions.

    --
    Doug Tolton
    (format t "~a@~a~a.~a " "dtolton" "ya" "hoo" "com")

    Comment

    • Matthias

      Re: Python syntax in Lisp and Scheme

      Kenny Tilton <ktilton@nyc.rr .com> writes:
      [color=blue]
      > Pascal Costanza wrote:[color=green][color=darkred]
      > >> No studies, tho.[/color]
      > > Here they are: http://home.adelphi.edu/sbloch/class/hs/testimonials/[/color]
      >
      > Oh, please:
      >
      > "My point is... before I started teaching Scheme, weak students would
      > get overwhelmed by it all and would start a downward spiral. With
      > Scheme, if they just keep plugging along, weak students will have a
      > strong finish. And that's a great feeling for both of us!"
      >
      > That kind of anecdotal crap is meaningless. We need statistics!
      > Preferably with lots of decimal places so we know they are accurate.
      >
      > :)[/color]

      Why the smiley? Many hours of discussions could be spared if there
      were real, scientific, solid studies on the benefit of certain
      language features or languages in certain domains or for certain types
      of programmers. It would help get successful languages become
      accepted in slow/big/dump organizations. It would point language
      designers in the right directions. Project leaders could replace
      trail-and-error by more efficient search techniques. (Assuming for a
      second, programmers or managers would make rational decisions when
      choosing a programming language and having available trustworthy
      data.)

      I imagine such studies are quite hard to do properly, but having them
      would be useful.

      Comment

      • Vis Mike

        Re: Code block literals

        [snip]

        Something like this seems more logical to me:

        for line in file('input.txt ').lines:
        do_something_wi th(line)

        for byte in file('input.txt ').bytes:
        do_something_wi th(byte)

        Is it possible?

        Mike


        Comment

        • Thomas F. Burdick

          Re: Python syntax in Lisp and Scheme

          Kenny Tilton <ktilton@nyc.rr .com> writes:
          [color=blue]
          > One popular macro is WITH-OUTPUT-TO-FILE. My budding RoboCup starter kit
          > was a vital WITH-STD-ATTEMPT macro. Oh god, no! I need to see the ANSI
          > Lisp commands for these things so I can really understand them. Better
          > yet...
          >
          > why not the disassembly?[/color]

          Fortunately for insane, paranoid programmers like Kenny who don't read
          docstrings, and refuse to believe that others' libraries might work
          correctly, Lisp is quite accomidating. You want to see what a macro
          call expands to? Hey, I think we have tools for just that problem.
          Disassembly? Now I could be mistaken, but I remember it being far
          easier than in most languages ... oh yeah, DISASSEMBLE. Wow, I didn't
          have to dig through a whole object file, or anything!

          --
          /|_ .-----------------------.
          ,' .\ / | No to Imperialist war |
          ,--' _,' | Wage class war! |
          / / `-----------------------'
          ( -. |
          | ) |
          (`-. '--.)
          `. )----'

          Comment

          • Dave Benjamin

            Re: Code block literals

            In article <bm48vh$47b$1@b ob.news.rcn.net >, Vis Mike wrote:[color=blue]
            > [snip]
            >
            > Something like this seems more logical to me:
            >
            > for line in file('input.txt ').lines:
            > do_something_wi th(line)
            >
            > for byte in file('input.txt ').bytes:
            > do_something_wi th(byte)[/color]

            I like that. =)
            [color=blue]
            > Is it possible?[/color]

            Depends on your definition of "possible".

            Dave

            --
            ..:[ dave benjamin (ramenboy) -:- www.ramenfest.com -:- www.3dex.com ]:.
            : d r i n k i n g l i f e o u t o f t h e c o n t a i n e r :

            Comment

            • Andrew Dalke

              Re: Python syntax in Lisp and Scheme

              Pascal Costanza:[color=blue]
              > So what's the result of ("one" - "two") then? ;)[/color]

              It's undefined on strings -- a type error. Having + doesn't
              mean that - must exist.

              (A more interesting question would be to ask what
              the result of "throne" - "one" is. But again, a type error.)

              Pascal Costanza:[color=blue]
              > It's a myth that bytes are restricted to 8 bits. See
              > http://www.wikipedia.org/wiki/Byte[/color]

              (I can't connect to the URL but I know what you're talking
              about.)

              Sure. But I'm just barely old enough to have programmed on
              a CDC Cyber. When I see the word 'byte' I assume it means
              8 bits unless told otherwise. When I buy memory, I don't ask
              the sales staff "so is this an 8 bit byte or a 60 bit byte?" (And
              yes, I know about the lawsuit against disk drive manufacturors
              and their strange definition of "gigabyte", but even then, they
              still use an 8 bit byte.)

              Me:[color=blue][color=green]
              > > Is there consensus on the Unicode API?[/color][/color]

              Pascal Costanza:[color=blue]
              > No, not yet. ANSI CL was finalized in 1994.[/color]

              Sure. That's why I asked about consensus. De facto rather
              than de jure. SAX for XML processing is a de facto standard
              but portable across different implementations and even
              portable across different languages (that is, there's a very
              mechanical and obvious way to convert from one language
              to another.)
              [color=blue]
              > Again, not part of ANSI CL. Don't judge a standardized language with the
              > measures of a single-vendor language - that's a different subject.[/color]

              I understand your point of view. OTOH, it's like when I used to
              work with C. It was standardized, but required that I download
              a slew of packages in order to do things. Eg, I had to evalutate
              several different regexp packages before I found one which was
              appropriate. I know there are good reasons for a standard to
              leave out useful packages, but I know there are good reasons for
              an implementation to include a large number of useful packages.

              Is there a free Lisp/Scheme implementation I can experiment with
              which include in the distribution (without downloading extra
              packages; a "moby" distribution in xemacs speak):
              - unicode
              - xml processing (to some structure which I can use XPath on)
              - HTTP-1.1 (client and server)
              - URI processing, including support for opening and reading from
              http:, file:, and https:
              - regular expressions on both 8-bit bytes and unicode
              - XML-RPC
              - calling "external" applications (like system and popen do for C)
              - POP3 and mailbox processing

              As far as I can tell, there isn't. I'll need to mix and match packages
              from a variety of sources. It isn't like these are highly unusual
              requirements; I use them pretty frequently in Python. For examples:

              - connect to my POP server, delete messages with .exe attachements
              on the assumption that it's spam
              - Use DAS (see http://www.biodas.org/) to get genomic sequence
              annotations. Requires HTTP and XML processing (mostly
              Latin-1 encoding)
              - Make an XML-RPC server which takes as input molecular
              structure information (eg, "CCO" is ethanol) and calls several
              existing command-line packages to compute properties about
              the compound. Parse the output with regular expressions and
              combine and return all the results.
              - Make a client which uses that server.

              (Okay, looks like https isn't needed for these, but the rest are.)
              [color=blue]
              > (Apart from that, Jython also doesn't provide everything that Python
              > provides, right?)[/color]

              No, but there is a good overlap. I believe all of the above are
              supported on both implementations .
              [color=blue]
              > Pick the one Common Lisp implementation that provides the stuff you
              > need. If no Common Lisp implementation provides all the stuff you need,
              > write your own libraries or pick a different language. It's as simple as
              > that.[/color]

              Which Common Lisp *distribution* provides the above? I
              don't doubt that an implementation + some add-in packages do
              all that, but each new package means one extra lump on the
              barrier to entry and one extra worry when I want others to
              use the code I've written.

              I use Python in part because of the "batteries included"
              philosophy. There will always be 3rd party packages (PIL for
              images, ReportLab for PDF generation, PyDaylight or OEChem
              for chemical informatics), but there's a lot which comes in
              the standard distributions.
              [color=blue]
              > You can ask these things in comp.lang.lisp or in one of the various
              > mailing lists. Common Lispniks are generally very helpful.[/color]

              Understood. I did managed to get the biolisp code working, btw.

              Andrew
              dalke@dalkescie ntific.com


              Comment

              • Alex Martelli

                Re: Python syntax in Lisp and Scheme

                Kenny Tilton wrote:
                [color=blue]
                > Alex Martelli wrote:[color=green]
                >> ... I do believe that the
                >> divergence problem has more to do with human nature and sociology, and
                >> that putting in a language features that encourage groups and subgroups
                >> of users to diverge that language ....[/color]
                >
                > Can someone write a nifty Python hack to figure out how many times
                > Lispniks have tried to get Alex to explain how macros are any different
                > than high-order functions or new classes when it comes to The Divergence
                > Problem? I love that we have given it a name, by the way.[/color]

                The very 'feature' that was touted by Erann Gat as macros' killer advantage
                in the WITH-CONDITION-MAINTAINED example he posted is the crucial
                difference: functions (HO or not) and classes only group some existing code
                and data; macros can generate new code based on examining, and presumably to
                some level *understanding* , a LOT of very deep things about the code
                arguments they're given. If all you do with your macros is what you could
                do with HOF's, it's silly to have macros in addition to HOF's -- just
                MTOWTDItis encouraging multiple different approaches to solve any given
                problem -- this, of course, in turn breeds divergence when compared to a
                situation in which just one approach is encouraged. If you do use the
                potential implied in that example from Gat, to do things that functions and
                classes just couldn't _begin_ to, it's worse -- then you're really
                designing your own private divergent language (which most posters from
                the Lisp camp appear to assert is an unalloyed good, although admittedly
                far from all). This is far from the first time I'm explaining this, btw.

                Oh, and if you're one of those who disapprove of Gat's example feel free
                to say so, but until I hear a substantial majority denouncing it as idiotic
                (and I haven't seen anywhere near this intensity of disapproval for it from
                your camp) I'm quite justifyied in taking it as THE canonical example of a
                macro doing something that is clearly outside the purview of normal tools
                such as functions and classes. As I recall there was a lot of that going
                on in TI labs, too -- instead of writing and using compilers for hardware
                description languages, circuit simulators, etc, based on appropriate and
                specialized languages processed with the help general-purpose ones,
                the specialized languages (divergent and half-baked) were embedded in
                programs coded in the general-purpose languages (Lisp variants, including
                Scheme; that was in 1980) using macros that were supposed to do
                everything but serve you coffee while you were waiting -- of course when
                the snippets you passed (to represent hardware operation) were correct
                from the GP language viewpoint but outside the limited parts thereof that
                the macros could in fact process significantly down to circuit design &c,
                the error messages you got (if you were lucky enough to get error
                messages rather than just weird behavior) were QUITE interesting.

                [color=blue]
                > One popular macro is WITH-OUTPUT-TO-FILE. My budding RoboCup starter kit
                > was a vital WITH-STD-ATTEMPT macro. Oh god, no! I need to see the ANSI[/color]

                Do they do things a HOF or class could do? If so why bother using such
                an over-powered tool as macros instead of HOFs or classes? If not, how do
                they specially process and understand code snippets they're passed?


                Alex

                Comment

                • Andrew Dalke

                  Re: Python syntax in Lisp and Scheme

                  james anderson:[color=blue]
                  > i realize that this thread is hopelessly amorphous, but this post did
                  > introduce some concrete issues which bear concrete responses...[/color]

                  Thank you for the commentary.
                  [color=blue]
                  > i got only as far as the realization that, in order to be of any use,[/color]
                  unicode[color=blue]
                  > data management has to support the eventual primitive string operations.[/color]
                  which[color=blue]
                  > introduces the problem that, in many cases, these primitive operations
                  > eventually devolve to the respective os api. which, if one compares apple[/color]
                  and[color=blue]
                  > unix apis are anything but uniform. it is simply not possible to provide[/color]
                  them[color=blue]
                  > with the same data and do anything worthwhile. if it is possible to give[/color]
                  some[color=blue]
                  > concrete pointers to how other languages provide for this i would be[/color]
                  grateful.

                  Python does it by ignoring the respective os APIs, if I understand
                  your meaning and Python's implementation correctly. Here's some
                  more information about Unicode in Python

                  The idea of this proposal is to add native Unicode 3.0 support to Python in a way that makes use of Unicode strings as simple as possible without introducing too many pitfalls along the way.

                  Python 2.1 unicode characters can have ordinals only up to 2**16 - 1. This range corresponds to a range in Unicode known as the Basic Multilingual Plane. There are now characters in Unicode that live on other “planes”. The largest addressable character ...

                  This PEP discusses supporting access to all files possible on Windows NT by passing Unicode file names directly to the system’s wide-character functions.


                  The official home of the Python Programming Language





                  [color=blue]
                  > and i have no idea what people do with surrogate pairs.[/color]

                  See PEP 261 listed above for commentary, and you may want
                  to email the author of that PEP, Paul Prescod. I am definitely
                  not the one to ask.
                  [color=blue]
                  > yes, there are several available common-lisp implementations for http[/color]
                  clients[color=blue]
                  > and servers. they offer significant trade-offs in api complexity,
                  > functionality, resource requirements and performance.[/color]

                  And there are several available Python implementations for the same;
                  Twisted's being the most notable. But the two main distributions (and
                  variants like Stackless) include a common API for it, which makes
                  it easy to start, and for most cases is sufficient.

                  I fully understand that it isn't part of the standard, but it would be
                  useful if there was a consensus that "packages X, Y, and Z will
                  always be included in our distributions."
                  [color=blue]
                  > if one needs to _port_ it to a new lisp, yes. perhaps you skipped over the
                  > list of lisps to which it has been ported. if you look at the #+/-
                  > conditionalizat ion, you may observe that the differences are not[/color]
                  significant.

                  You are correct, and I did skip that list.

                  Andrew
                  dalke@dalkescie ntific.com


                  Comment

                  • Kenny Tilton

                    Re: Python syntax in Lisp and Scheme



                    Matthias wrote:
                    [color=blue]
                    > Kenny Tilton <ktilton@nyc.rr .com> writes:
                    >
                    >[color=green]
                    >>Pascal Costanza wrote:
                    >>[color=darkred]
                    >>>>No studies, tho.
                    >>>
                    >>>Here they are: http://home.adelphi.edu/sbloch/class/hs/testimonials/[/color]
                    >>
                    >>Oh, please:
                    >>
                    >>"My point is... before I started teaching Scheme, weak students would
                    >>get overwhelmed by it all and would start a downward spiral. With
                    >>Scheme, if they just keep plugging along, weak students will have a
                    >>strong finish. And that's a great feeling for both of us!"
                    >>
                    >>That kind of anecdotal crap is meaningless. We need statistics!
                    >>Preferably with lots of decimal places so we know they are accurate.
                    >>
                    >>:)[/color]
                    >
                    >
                    > Why the smiley?[/color]


                    Sorry, I was still laughing to myself about that study with the lines of
                    code count (and measuring the power of a language by the number of
                    machine instructions per line or whatever that was).
                    [color=blue]
                    > ...Many hours of discussions could be spared if there
                    > were real, scientific, solid studies on the benefit of certain
                    > language features or languages...[/color]

                    Studies schmudies. Everyone knows 10% of the people do 90% of the code
                    (well it might be 5-95). Go ask them. I think they are all saying (some)
                    Lisp and/or Python right now.

                    in certain domains or for certain types[color=blue]
                    > of programmers.[/color]

                    There's that relativism thing again. I think a good programming language
                    will be good for everyone, not some. What many people do not know is
                    that Lisp (macros aside!) is just a normal computer language with a
                    kazillion things done better, like generic functions and special
                    variables to name just two. Norvig himself talked about this, pardon my
                    alziness in not scaring up that well-know URL: Python is getting to be a
                    lot like Lisp, though again macros forced him into some hand-waving.
                    [color=blue]
                    >.. It would help get successful languages become
                    > accepted in slow/big/dump organizations.[/color]

                    Why you starry-eyed dreamer, you! Yes, here comes the PHB now waving his
                    copy of Software Engineering Quarterly.

                    It would point language[color=blue]
                    > designers in the right directions. Project leaders could replace
                    > trail-and-error by more efficient search techniques. (Assuming for a
                    > second, programmers or managers would make rational decisions when
                    > choosing a programming language and having available trustworthy
                    > data.)[/color]

                    Careful, any more of that and the MIB will come get you and send you
                    back to the planet you came from.
                    [color=blue]
                    >
                    > I imagine such studies are quite hard to do properly, but having them
                    > would be useful.[/color]

                    OK, I am smiling again at the first half of that sentence. But there is
                    hope. My Cells package naturally exposes the interdependency of program
                    state, something Brooks (correctly) identified as a huge problem in
                    software engineering, hence his (mistaken) conviction there could be no
                    magic bullet.

                    Now Cells can (and have been to various degrees) been ported to C++,
                    Java, and Python. If those ports were done as fully as possible, such
                    that they passed the regression tests used on the Lisp reference
                    implementation, we could then measure productivity, because (I am
                    guessing) the internal state dependencies will serve quite nicely as a
                    measure of "how much" program got written by a team, one which could be
                    used to compare intelligently the productivity on different projects in
                    different languages. (You can't have the same team do the same project,
                    and you can't use two different teams, for obvious reasons.)

                    kenny


                    --

                    What?! You are a newbie and you haven't answered my:


                    Comment

                    • Andrew Dalke

                      Re: Python syntax in Lisp and Scheme

                      Pascal Bourguignon:[color=blue]
                      > Because the present is composed of the past. You have to be
                      > compatible, otherwise you could not debug a Deep Space 1 probe
                      > 160 million km away, (and this one was only two or three years old).[/color]

                      Huh? I'm talking purely in the interface. Use ASCII '[' and ']' in the
                      Lisp code and display it locally as something with more "directionality ".
                      I'm not suggesting the unicode character be used in the Lisp code.
                      Take advantages of advances in font display to overcome limitations
                      in ASCII.
                      [color=blue]
                      > Mathematicians indeed overload operators with taking into account
                      > their precise properties. But mathematicians are naturally
                      > intelligent. Computers and our programs are not. So it's easier if
                      > you classify operators per properties; if you map the semantics to the
                      > syntax, this allow you to apply transformations on your programs based
                      > on the syntax without having to recover the meaning.[/color]

                      Ahhh, so make the language easier for computers to understand and
                      harder for intelligent users to use? ;)

                      Andrew
                      dalke@dalkescie ntific.com


                      Comment

                      • Kenny Tilton

                        Re: Python syntax in Lisp and Scheme



                        Thomas F. Burdick wrote:
                        [color=blue]
                        > Kenny Tilton <ktilton@nyc.rr .com> writes:
                        >
                        >[color=green]
                        >>One popular macro is WITH-OUTPUT-TO-FILE. My budding RoboCup starter kit
                        >>was a vital WITH-STD-ATTEMPT macro. Oh god, no! I need to see the ANSI
                        >>Lisp commands for these things so I can really understand them. Better
                        >>yet...
                        >>
                        >>why not the disassembly?[/color]
                        >
                        >
                        > Fortunately for insane, paranoid programmers like Kenny who don't read
                        > docstrings, and refuse to believe that others' libraries might work
                        > correctly, Lisp is quite accomidating. You want to see what a macro
                        > call expands to? Hey, I think we have tools for just that problem.
                        > Disassembly? Now I could be mistaken, but I remember it being far
                        > easier than in most languages ... oh yeah, DISASSEMBLE. Wow, I didn't
                        > have to dig through a whole object file, or anything!
                        >[/color]

                        <rofl> yer right! Lisp is sick. I am going to go disassemble DOTIMES
                        right now, find out once and for all what those plotters over at Franz
                        are up to.

                        kenny

                        ps. Arnold is your governor, Arnold is your governor, nyeah, nyeah, nya,
                        nyeah, nyeah.


                        --

                        What?! You are a newbie and you haven't answered my:


                        Comment

                        • Joe Marshall

                          Re: Python syntax in Lisp and Scheme

                          Andreas Rossberg <rossberg@ps.un i-sb.de> writes:
                          [color=blue]
                          > Apart from that, can you have higher-order macros? With mutual
                          > recursion between a macro and its argument? That is, can you write a
                          > fixpoint operator on macros?[/color]

                          Yes, you can. This occurs when you call MACROEXPAND as part of
                          computing the expansion of the macro.

                          Comment

                          • Joe Marshall

                            Re: Python syntax in Lisp and Scheme

                            my-first-name.my-last-name@jpl.nasa.g ov (Erann Gat) writes:
                            [color=blue]
                            > In article <bm32a3$iti$1@b ob.news.rcn.net >, "Vis Mike"
                            > <visionary25@_n ospam_hotmail.c om> wrote:
                            >[color=green]
                            >>
                            >> Ahh, but overloading only works at compile time:[/color]
                            >
                            > That's irrelevant. When it happens doesn't change the fact that this
                            > proves it (multiple dispatch with non-congruent arglists) is possible.
                            > Nothing prevents you from using the same algorithm at run time.
                            >[/color]

                            In fact, on a project I'm working on I have to handle overloaded
                            functions. I used the MOP to adjust how method combination worked
                            and now the generic functions first perform an arity-based dispatch.

                            Comment

                            • Andrew Dalke

                              Re: Python syntax in Lisp and Scheme

                              Pascal Costanza:[color=blue]
                              > I guess this reflects his experiences when he has learned Lisp in the
                              > beginning of the 80's (AFAIK).[/color]

                              But the talk wasn't given in the early 80s. It was given in the early 00s.
                              And it implies that Lisp is still strange that way. OTOH, you aren't him
                              so it's not fair of me to ask you all to defend his statements.
                              [color=blue]
                              > Yes, scripting languages have caught up in this regard. (However, note
                              > that Common Lisp also includes a full compiler at runtime.)[/color]

                              However, that's an implementation difference -- the only thing
                              users should see is that the code runs faster. It doesn't otherwise
                              provide new functionality.
                              [color=blue][color=green]
                              > > The phrase "they had hard-headed engineering reasons for
                              > > making the syntax look so strange." reminds me of the statement
                              > > "better first rate salespeople and second rate engineers than
                              > > second rate salespeople and first rate engineers" (and better
                              > > first rate both). That's saying *nothing* about the languages;
                              > > it's saying that his viewpoint seems to exclude the idea that
                              > > there are hard-headed non-engineering reasons for doing things."[/color]
                              >
                              > No, that's not a logical conclusion.[/color]

                              I used those wishy-washy words "reminds me" and "seems". ;)
                              [color=blue]
                              > These abbreviations seem strange to a Lisp outsider, but they are very
                              > convenient, and they are easy to read once you have gotten used to them.
                              > You don't actually "count" the elements in your head every time you see
                              > these operators, but they rather become patterns that you recognize in
                              > one go.[/color]

                              I did know about cddr, etc. from Hofstadter's essays in Scientific
                              America some 15 years ago.
                              [color=blue]
                              > I don't know how this could be done with 1st, rst or hd, tl respectively.[/color]

                              Okay, I gave alternatives of "." and ">" instead of "car" and "cdr"
                              "." for "here" and ">" for "the rest; over there". These are equally
                              composable.

                              .. == car[color=blue]
                              > == cdr[/color]
                              cadr == >.
                              caddr == >>.
                              cddr == >>
                              [color=blue]
                              > Pick your choice. "There is not only one way to do it." (tm)[/color]

                              Perl beat you to it -- "TMTOWTDO" (There's more than one way to
                              do it.). ;)

                              Python's reply "There should be one-- and preferably only one --
                              obvious way to do it."
                              [color=blue]
                              > The learning curve is steeper, but in the long run you become much more
                              > productive.[/color]

                              Which brings us back to the start of this thread. :)

                              Andrew
                              dalke@dalkescie ntific.com


                              Comment

                              • Kenny Tilton

                                Re: Python syntax in Lisp and Scheme



                                Alex Martelli wrote:
                                [color=blue]
                                > Kenny Tilton wrote:
                                >
                                >[color=green]
                                >>Alex Martelli wrote:
                                >>[color=darkred]
                                >>>... I do believe that the
                                >>>divergence problem has more to do with human nature and sociology, and
                                >>>that putting in a language features that encourage groups and subgroups
                                >>>of users to diverge that language ....[/color]
                                >>
                                >>Can someone write a nifty Python hack to figure out how many times
                                >>Lispniks have tried to get Alex to explain how macros are any different
                                >>than high-order functions or new classes when it comes to The Divergence
                                >>Problem? I love that we have given it a name, by the way.[/color]
                                >
                                >
                                > The very 'feature' that was touted by Erann Gat as macros' killer advantage
                                > in the WITH-CONDITION-MAINTAINED example he posted is the crucial
                                > difference: functions (HO or not) and classes only group some existing code
                                > and data; macros can generate new code based on examining, and presumably to
                                > some level *understanding* , a LOT of very deep things about the code
                                > arguments they're given.[/color]

                                Stop, your scaring me. You mean to say there are macros out there whose
                                output/behavior I cannot predict? And I am using them in a context where
                                I need to know what the behavior will be? What is wrong with me? And
                                what sort of non-deterministic macros are these, that go out and make
                                their own conclusions about what I meant in some way not documeted?

                                I think the objection to macros has at this point been painted into a
                                very small corner.

                                [color=blue]
                                > ...If all you do with your macros is what you could
                                > do with HOF's, it's silly to have macros in addition to HOF's[/color]

                                There is one c.l.l. denizen/guru who agrees with you. I believe his
                                position is "evrything can be done with lambda". And indeed, many a
                                groovy WITHOUT-CELL-DEPENDENCY expands straight into:

                                (call-with-cell-dependency (lambda () ,yadayadayada))

                                But code with WITHOUT-CELL-DEPENDENCY looks prettier (I hope we can
                                agree that that matters, esp. if you are a Pythonista).

                                -- just[color=blue]
                                > MTOWTDItis encouraging multiple different approaches to solve any given
                                > problem -- this, of course, in turn breeds divergence when compared to a
                                > situation in which just one approach is encouraged. If you do use the
                                > potential implied in that example from Gat, to do things that functions and
                                > classes just couldn't _begin_ to, it's worse -- then you're really
                                > designing your own private divergent language (which most posters from
                                > the Lisp camp appear to assert is an unalloyed good, although admittedly
                                > far from all). This is far from the first time I'm explaining this, btw.[/color]

                                Oh. OK, now that you mention it I have been skimming lately.
                                [color=blue]
                                >[color=green]
                                >>One popular macro is WITH-OUTPUT-TO-FILE. My budding RoboCup starter kit
                                >>was a vital WITH-STD-ATTEMPT macro. Oh god, no! I need to see the ANSI[/color]
                                >
                                >
                                > Do they do things a HOF or class could do?[/color]

                                Yes.
                                [color=blue]
                                >... If so why bother using such
                                > an over-powered tool as macros instead of HOFs or classes?[/color]

                                Hang on, we just agreed that in this case the only added value is
                                prettier code. Nothing over-powered going on. (And that is, in this
                                case, why I bother.)

                                --

                                What?! You are a newbie and you haven't answered my:


                                Comment

                                Working...