Pseudocode in the wikipedia

Discussion in 'Python' started by bearophileHUGS@lycos.com, Apr 1, 2005.

  1. Guest

    The free wikipedia is adopting a standard pseudocode:
    http://en.wikipedia.org/wiki/Wikipedia_talk:Wikicode/Specification

    MShonle says something nice:
    I support the idea of wikicode. Basically I think we should present
    code in a Python-like language that doesn't carry so much baggage. For
    example, we can use English sentences (or sentence fragments) instead
    of requiring the reader to understand some obscure Python library.
    (Further, Python has the baggage that there are no block-terminators:
    i.e., no "}" or "end"s or "fi"s or "repeat"s. By adding such
    terminators, we can make it a lot less ambiguous to all readers.) In
    otherwords, we're basically right on track: removing the quirks of
    Python, and making it higher-level.

    Bearophile
     
    , Apr 1, 2005
    #1
    1. Advertising

  2. Peter Hansen Guest

    wrote:
    > (Further, Python has the baggage that there are no block-terminators:
    > i.e., no "}" or "end"s or "fi"s or "repeat"s. By adding such
    > terminators, we can make it a lot less ambiguous to all readers.) In
    > otherwords, we're basically right on track: removing the quirks of
    > Python, and making it higher-level.


    Heh heh... good joke for April 1.

    Clearly, calling the absence of something "baggage"
    is intended to be humorous...

    -Peter
     
    Peter Hansen, Apr 1, 2005
    #2
    1. Advertising

  3. Terry Reedy Guest

    <> wrote in message
    news:...
    > The free wikipedia is adopting a standard pseudocode:
    > http://en.wikipedia.org/wiki/Wikipedia_talk:Wikicode/Specification
    >
    > MShonle says something nice:


    Calling a feature 'baggage' is not especially nice. Neither is getting
    facts wrong.

    > I support the idea of wikicode. Basically I think we should present
    > code in a Python-like language that doesn't carry so much baggage. For
    > example, we can use English sentences (or sentence fragments) instead
    > of requiring the reader to understand some obscure Python library.
    > (Further, Python has the baggage that there are no block-terminators:


    Python does too have block terminators. They are called dedents. In doing
    so it follows standard English outline formatting and the practice of many
    algorithm pseudocode writers. (I roughly estimate around half or more.)
    Two examples I have handy: Jon Bently in Programming Pearls and Steven
    Skiena in The Algorithm Design Manual.

    > i.e., no "}" or "end"s or "fi"s or "repeat"s.


    So add #whateve-ender-you want, but leave the code executable if at all
    possible.

    > By adding such terminators, we can make it a lot less ambiguous to all
    > readers.


    Dedents are unambiguous. Be adding additional redundant terminators, one
    adds the possibility of mismatch and ambiguity.

    Terry J. Reedy
     
    Terry Reedy, Apr 1, 2005
    #3
  4. James Stroud Guest

    Is anybody else bothered by those stupid pascal-like ":=" assignment
    operators?

    Maybe, for the sake of adding more variety to the world, wiki should come up
    with a new assignment operator, like "==". I like that one because then it
    could really be original:

    if (bob = 4):
    bob == bob + 2

    See how nice that looks? Then we could have people who are used to python and
    c and perl complaining that "=" is for comparison and "==" is for assignment.
    Then the wikilitests would say "hey, man, part and parcel of being a
    programmer is getting assignment and comparison straight--and not making
    typos, you buffoon". But then the guys who have to program in a bunch of
    languages would point out how the wikilitests only psuedo code in wiki--so
    they would never even run the code they wrote. And then some understanding
    fellow would recommend a wiki precompiler to catch "==" inside of "if"
    statements, but then someone else would say that it would limit the
    expressiveness of wiki language:

    bob == (carol = 2):
    if bob = (bob or carol):
    bob == 4

    But no one could figure out what bob was supposed to equal anyway. And then
    someone would say something about a "Turing Machine", just to show that
    theoretically, the above code could be understood by something theoretical.

    James

    On Friday 01 April 2005 11:23 am, Terry Reedy wrote:
    > <> wrote in message
    > news:...
    >
    > > The free wikipedia is adopting a standard pseudocode:
    > > http://en.wikipedia.org/wiki/Wikipedia_talk:Wikicode/Specification


    --
    James Stroud, Ph.D.
    UCLA-DOE Institute for Genomics and Proteomics
    Box 951570
    Los Angeles, CA 90095

    http://www.jamesstroud.com/
     
    James Stroud, Apr 1, 2005
    #4
  5. Ron_Adam Guest

    On Fri, 1 Apr 2005 12:15:35 -0800, James Stroud <>
    wrote:

    >Is anybody else bothered by those stupid pascal-like ":=" assignment
    >operators?
    >
    >Maybe, for the sake of adding more variety to the world, wiki should come up
    >with a new assignment operator, like "==". I like that one because then it
    >could really be original:
    >
    >if (bob = 4):
    > bob == bob + 2


    To me ":=" could mean to create a copy of an object... or should it
    be "=:" ?

    Or how about ":=)" to mean is equal and ":=(" to mean it's not.

    Then there is ";=)", to indicate 'True', and ':=O' to indicate 'False'
     
    Ron_Adam, Apr 1, 2005
    #5
  6. Bill Mill Guest

    On Apr 1, 2005 3:15 PM, James Stroud <> wrote:
    > Is anybody else bothered by those stupid pascal-like ":=" assignment
    > operators?
    >


    I actually like them. I think that the = should be a comparison
    operator, not a silly ==. I think that comparisons using = are much
    clearer, especially since you often write many of them in a row,
    whereas you almost always make one assignment per line.

    I use := every day in PL/SQL, and it's one of the few positive
    syntactical features of the language.

    Peace
    Bill Mill
    bill.mill at gmail.com
     
    Bill Mill, Apr 1, 2005
    #6
  7. Ron_Adam wrote:

    >To me ":=" could mean to create a copy of an object... or should it
    >be "=:" ?
    >
    >Or how about ":=)" to mean is equal and ":=(" to mean it's not.
    >
    >Then there is ";=)", to indicate 'True', and ':=O' to indicate 'False'
    >
    >

    Not to mention "(_ | _)" for asserts!
     
    Gabriel Cooper, Apr 1, 2005
    #7
  8. On Fri, 01 Apr 2005 16:02:53 -0500, Gabriel Cooper wrote:
    > Ron_Adam wrote:
    >
    >>To me ":=" could mean to create a copy of an object... or should it
    >>be "=:" ?
    >>
    >>Or how about ":=)" to mean is equal and ":=(" to mean it's not.
    >>
    >>Then there is ";=)", to indicate 'True', and ':=O' to indicate 'False'
    >>
    >>

    > Not to mention "(_ | _)" for asserts!


    Your ass is your identity function.

    Python 2.3.5 (#1, Mar 3 2005, 17:32:12)
    [GCC 3.4.3 (Gentoo Linux 3.4.3, ssp-3.4.3-0, pie-8.7.6.6)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> 25

    25
    >>> (_ | _)

    25
    >>>


    There's clearly some interesting biometrics research to be done here,
    although there is a well-known ass-capturing attack based on readily
    commercially available machines from Xerox that might make it hard to make
    an ass-based identity system resistant to attacks.
     
    Jeremy Bowers, Apr 1, 2005
    #8
  9. Sunnan Guest

    James Stroud wrote:
    > bob == (carol = 2):
    > if bob = (bob or carol):
    > bob == 4
    >
    > But no one could figure out what bob was supposed to equal anyway.


    Wouldn't bob equal the boolean result of the expression (carol = 2)?
     
    Sunnan, Apr 2, 2005
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stefan
    Replies:
    0
    Views:
    1,801
    Stefan
    Apr 15, 2004
  2. Pseudocode Help

    , Mar 12, 2005, in forum: C++
    Replies:
    3
    Views:
    561
    Victor Bazarov
    Mar 13, 2005
  3. Krisitne

    Pseudocode For Statement

    Krisitne, Sep 13, 2003, in forum: C Programming
    Replies:
    2
    Views:
    538
    Malcolm
    Sep 13, 2003
  4. Ivan Van Laningham

    Re: Pseudocode in the wikipedia

    Ivan Van Laningham, Apr 1, 2005, in forum: Python
    Replies:
    2
    Views:
    347
    Ivan Van Laningham
    Apr 2, 2005
  5. Vusi
    Replies:
    5
    Views:
    435
    John Machin
    Jul 4, 2006
Loading...

Share This Page