Problems with string and lists (searching and replaceing)

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

    Problems with string and lists (searching and replaceing)

    I should like to search certain characters in a string and when they are
    found, I want to replace other characters in other strings that are at
    the same position (for a very simply mastermind game) for my pupils.

    This very simple thing does not seem simple at all.

    If I use strings, I cannot replace their parts (though I can use
    string.find for the searching). I think it is a bad idea that strings are
    not mutable, but I suspect that this has been discussed here for ages.

    I can use sequences instead, but then first I have to 'split' and 'join'.
    Additionally, there is no 'find' for sequences (who knows why not) and so
    I can choose between using 'index' that raises an exception (and we have
    not covered exceptions yet) or I can ask whether the character is in the
    string before using 'index' which is a bit artificial from the point of
    view of my pupils. (It is all right with me.)

    Do I oversee something?

    TIA,
    JB



    ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
    http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
    ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
  • Anton Vredegoor

    #2
    Re: Problems with string and lists (searching and replaceing)

    jblazi <jblazi@hotmail .com> wrote:
    [color=blue]
    >I should like to search certain characters in a string and when they are
    >found, I want to replace other characters in other strings that are at
    >the same position (for a very simply mastermind game) for my pupils.
    >
    >This very simple thing does not seem simple at all.
    >
    >If I use strings, I cannot replace their parts (though I can use
    >string.find for the searching). I think it is a bad idea that strings are
    >not mutable, but I suspect that this has been discussed here for ages.
    >
    >I can use sequences instead, but then first I have to 'split' and 'join'.
    >Additionally , there is no 'find' for sequences (who knows why not) and so
    >I can choose between using 'index' that raises an exception (and we have
    >not covered exceptions yet) or I can ask whether the character is in the
    >string before using 'index' which is a bit artificial from the point of
    >view of my pupils. (It is all right with me.)
    >
    >Do I oversee something?[/color]

    Yes, UserString. The documentation is a bit sparse, but reading the
    module itself provides additional information. Below is a quick test
    script.

    HTH,

    Anton


    from UserString import MutableString

    def test():
    s = MutableString(" helo world")
    print s
    x = 'helo'
    y = 'hello'
    i = s.find(x)
    s[i:i+len(x)] = y
    print s

    if __name__=='__ma in__':
    test()

    #output:
    #helo world
    #hello world

    Comment

    • Shu-Hsien Sheu

      #3
      Re: Problems with string and lists (searching and replaceing)

      I am not sure if this is what you want, but it seems that you can get around with it by assignments:

      &gt;&gt;&gt; x = 'test'
      &gt;&gt;&gt; y = 'yummy'
      &gt;&gt;&gt; a = x.index('e')
      &gt;&gt;&gt; y = y[:a] + 'a'+ y[a+1:]
      &gt;&gt;&gt; y
      'yammy'

      you can add try/except ValueError for the index method.

      -shuhsien


      I should like to search certain characters in a string and when they are found, I want to replace other characters in other strings that are at the same position (for a very simply mastermind game) for my pupils. This very simple thing does not seem simple at all. If I use strings, I cannot replace their parts (though I can use string.find for the searching). I think it is a bad idea that strings are not mutable, but I suspect that this has been discussed here for ages. I can use sequences instead, but then first I have to 'split' and 'join'. Additionally, there is no 'find' for sequences (who knows why not) and so I can choose between using 'index' that raises an exception (and we have not covered exceptions yet) or I can ask whether the character is in the string before using 'index' which is a bit artificial from the point of view of my pupils. (It is all right with me.) Do I oversee something?





      Comment

      • jblazi

        #4
        Re: Problems with string and lists (searching and replaceing)

        "Anton Vredegoor" <anton@vredegoo r.doge.nl> schrieb im Newsbeitrag
        news:bkhnpn$hgc $1@news.hccnet. nl...[color=blue][color=green]
        > >Do I oversee something?[/color]
        >
        > Yes, UserString. The documentation is a bit sparse, but reading the
        > module itself provides additional information. Below is a quick test
        > script.
        >
        > from UserString import MutableString
        >
        > def test():
        > s = MutableString(" helo world")
        > print s
        > x = 'helo'
        > y = 'hello'
        > i = s.find(x)
        > s[i:i+len(x)] = y
        > print s
        >
        > if __name__=='__ma in__':
        > test()
        >
        > #output:
        > #helo world
        > #hello world[/color]

        Thx.
        It would be quite diffcult to explain this akward procedure to beginners.
        especially when they see that this can be done so simply in C.
        It seems that I have stumbled upon one of the few cases when Python is
        cumbersome and difficult to use.

        JB


        Comment

        • Anton Vredegoor

          #5
          Re: Problems with string and lists (searching and replaceing)

          "jblazi" <jblazi@hotmail .com> wrote:
          [color=blue][color=green]
          >> from UserString import MutableString
          >>
          >> def test():
          >> s = MutableString(" helo world")
          >> print s
          >> x = 'helo'
          >> y = 'hello'
          >> i = s.find(x)
          >> s[i:i+len(x)] = y
          >> print s
          >>
          >> if __name__=='__ma in__':
          >> test()
          >>
          >> #output:
          >> #helo world
          >> #hello world[/color]
          >
          >Thx.
          >It would be quite diffcult to explain this akward procedure to beginners.
          >especially when they see that this can be done so simply in C.
          >It seems that I have stumbled upon one of the few cases when Python is
          >cumbersome and difficult to use.[/color]

          Interesting. Could you provide an example showing in which way it can
          be done so simply in C ? Maybe I could come up with better Python code
          if I knew what the problem is with my code. Anyway, it was just
          something I typed in without thinking much about it, to show that
          strings can be mutated. In Python everything is an object so if some
          functionality is needed it is pretty standard to use a subclass. In
          this case a fitting subclass already was present in the standard
          distribution so it seemed like a piece of cake.

          With respect to beginners I suppose it's possible to project ones own
          sense of what is easy, instead of really checking what would be easy
          for *them*.

          Beginners are not supposed to know about C, but possibly you are, and
          maybe you are thinking too much from your own perspective in judging
          what would be easy.

          Anton

          Comment

          • Bengt Richter

            #6
            Re: Problems with string and lists (searching and replaceing)

            On Sat, 20 Sep 2003 21:08:40 +0200, "jblazi" <jblazi@hotmail .com> wrote:
            [color=blue]
            >"Anton Vredegoor" <anton@vredegoo r.doge.nl> schrieb im Newsbeitrag
            >news:bkhnpn$hg c$1@news.hccnet .nl...[color=green][color=darkred]
            >> >Do I oversee something?[/color]
            >>
            >> Yes, UserString. The documentation is a bit sparse, but reading the
            >> module itself provides additional information. Below is a quick test
            >> script.
            >>
            >> from UserString import MutableString
            >>
            >> def test():
            >> s = MutableString(" helo world")
            >> print s
            >> x = 'helo'
            >> y = 'hello'
            >> i = s.find(x)
            >> s[i:i+len(x)] = y
            >> print s
            >>
            >> if __name__=='__ma in__':
            >> test()
            >>
            >> #output:
            >> #helo world
            >> #hello world[/color]
            >
            >Thx.
            >It would be quite diffcult to explain this akward procedure to beginners.
            >especially when they see that this can be done so simply in C.
            >It seems that I have stumbled upon one of the few cases when Python is
            >cumbersome and difficult to use.
            >[/color]

            For the above, what is wrong with
            [color=blue][color=green][color=darkred]
            >>> def test():[/color][/color][/color]
            ... s = 'helo world'
            ... print s
            ... s = s.replace('helo ','hello',1)
            ... print s
            ...[color=blue][color=green][color=darkred]
            >>> test()[/color][/color][/color]
            helo world
            hello world

            ?

            Regards,
            Bengt Richter

            Comment

            • jblazi

              #7
              Re: Problems with string and lists (searching and replaceing)

              On Sat, 20 Sep 2003 21:30:37 +0000, Bengt Richter wrote:[color=blue]
              > For the above, what is wrong with
              >[color=green][color=darkred]
              > >>> def test():[/color][/color]
              > ... s = 'helo world'
              > ... print s
              > ... s = s.replace('helo ','hello',1)
              > ... print s
              > ...[color=green][color=darkred]
              > >>> test()[/color][/color]
              > helo world
              > hello world[/color]

              Nothing is wrong with that, of course, but my code is something like this:


              def vergleiche_woer ter(eingabe,wor t):
              eing = mysplit(eingabe )
              wo = mysplit(wort)
              ergebnis=['-','-','-','-','-']

              # Suche zuerst nach Bullen
              for i in range(len(eing) ):
              if eing[i] == wo[i]:
              ergebnis[i] = '*'
              eing[i]=wo[i] = None

              for i in range(len(eing) ):
              if eing[i] == None: continue
              if eing[i] in wo:
              j = wo.index(eing[i])
              ergebnis[i] = '.'
              wo[j] = None

              return join(ergebnis,' ')




              ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
              http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
              ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---

              Comment

              • Anton Vredegoor

                #8
                Re: Problems with string and lists (searching and replaceing)

                bokr@oz.net (Bengt Richter) wrote:
                [color=blue]
                >For the above, what is wrong with
                >[color=green][color=darkred]
                > >>> def test():[/color][/color]
                > ... s = 'helo world'
                > ... print s
                > ... s = s.replace('helo ','hello',1)
                > ... print s
                > ...[color=green][color=darkred]
                > >>> test()[/color][/color]
                > helo world
                > hello world[/color]

                Well, why use replace anyway. It would be better to print the string
                right to begin with and be done with it :-) But seriously, the OP
                asked for a way to find a position in a string and to change another
                string at the found position, without constructing a new string and by
                using some familiar operations. Why all these restrictions were
                necessary is not my concern. Let's just assume the OP has a C-style
                brain and needs some trajectory to reach Python-i-City.

                Your approach seems to be good in that it's better to do things the
                right way in the first place, so that no wrong things have to be
                unlearned. We all know that it's ten times more costly to change
                habits than to forget them and start from scratch.

                However there are also totally blank pupils waiting to be educated and
                the only way to get educated is by absorbing knowledge from someone
                with more knowledge, flawed as this knowledge may be.

                My strategy in such circumstances is to accept the unavoidable and to
                show that Python is an easier fit to the problem [1] -some mastermind
                scheme I believe- than C, even if C is the way the OP would know best
                and even if it would lead to Python code in a C-straitjacket. The
                straitjacket can be removed someday, and while the result would not be
                as good as never having been in it, it would be better than not having
                been educated at all.

                Come to think of it, since our educational system is nowhere perfect I
                guess we all share this condition!

                Anton

                [1] UserString's MutableString is not a subclass of string but a
                wrapper around it that mimics a mutable string more or less like if it
                were a C-style array of chars, except that it's way more powerful and
                flexible.

                Comment

                • jblazi

                  #9
                  Re: Problems with string and lists (searching and replaceing)

                  I shall have a computer science class this year and I decided to use
                  Python. It is my favourite language and I have used it for many years. Now
                  I thought, one of our first "real" programs, in our pre-graphical and
                  pre-class state, would be to write simple program that works like this:

                  One of the pupils enters a word. It should be a valid German word
                  consisting of five letters, for example 'abcde' (which is not a German
                  word by the way).

                  The the other player may enter a guess which must be a five letter word as
                  well, for example 'xbxxx'. Then the system answers with the string '-*---'
                  as the 'b' in 'xbxxx' was correct and at the right place as well.

                  Had the second player entered 'xxxbx', the system had responded with
                  '---.-', as the 'b' is correct but not correctly positioned.

                  The second player must find out the original word.

                  Now I did not see how to do it as simply as posible, that was the problem.

                  JB



                  ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
                  http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
                  ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---

                  Comment

                  • Ulrich Petri

                    #10
                    Re: Problems with string and lists (searching and replaceing)

                    "jblazi" <jblazi@hotmail .com> schrieb im Newsbeitrag
                    news:pan.2003.0 9.21.06.55.07.1 6000@hotmail.co m...[color=blue]
                    > I shall have a computer science class this year and I decided to use
                    > Python. It is my favourite language and I have used it for many years. Now
                    > I thought, one of our first "real" programs, in our pre-graphical and
                    > pre-class state, would be to write simple program that works like this:
                    >
                    > One of the pupils enters a word. It should be a valid German word
                    > consisting of five letters, for example 'abcde' (which is not a German
                    > word by the way).
                    >
                    > The the other player may enter a guess which must be a five letter word as
                    > well, for example 'xbxxx'. Then the system answers with the string '-*---'
                    > as the 'b' in 'xbxxx' was correct and at the right place as well.
                    >
                    > Had the second player entered 'xxxbx', the system had responded with
                    > '---.-', as the 'b' is correct but not correctly positioned.
                    >
                    > The second player must find out the original word.
                    >[/color]

                    Hm sth. like this?

                    -----code------
                    def mastermind(word , guess):
                    if len(word) != len(guess):
                    return "Error"
                    ret = ["-"]*len(word)
                    counter = 0
                    for lw, lg in zip(word, guess):
                    if lw == lg:
                    ret[counter] = "x"
                    else:
                    if lg in word:
                    ret[counter] = "."
                    counter += 1
                    return "".join(ret )
                    [color=blue][color=green][color=darkred]
                    >>> mastermind('hau s', 'hasu')[/color][/color][/color]
                    'xx..'[color=blue][color=green][color=darkred]
                    >>> mastermind("jag uar", "januar")[/color][/color][/color]
                    'xx-xxx'
                    -----code-----


                    HTH

                    Ciao Ulrich


                    Comment

                    • jblazi

                      #11
                      Re: Problems with string and lists (searching and replaceing)

                      On Sun, 21 Sep 2003 20:40:30 +0200, Ulrich Petri wrote:
                      [color=blue]
                      > def mastermind(word , guess):
                      > if len(word) != len(guess):
                      > return "Error"
                      > ret = ["-"]*len(word)
                      > counter = 0
                      > for lw, lg in zip(word, guess):
                      > if lw == lg:
                      > ret[counter] = "x"
                      > else:
                      > if lg in word:
                      > ret[counter] = "."
                      > counter += 1
                      > return "".join(ret )[/color]

                      Thx.
                      The problem with this may be that for example

                      mastermind('xxa xx','ayayy')

                      returns

                      ..-x--

                      but I should like to have --x-- instead (at least I think so).

                      JB

                      Comment

                      • Dennis Lee Bieber

                        #12
                        Re: Problems with string and lists (searching and replaceing)

                        jblazi fed this fish to the penguins on Saturday 20 September 2003
                        11:55 pm:
                        [color=blue]
                        >
                        > One of the pupils enters a word. It should be a valid German word
                        > consisting of five letters, for example 'abcde' (which is not a German
                        > word by the way).
                        >
                        > The the other player may enter a guess which must be a five letter
                        > word as well, for example 'xbxxx'. Then the system answers with the
                        > string '-*---' as the 'b' in 'xbxxx' was correct and at the right
                        > place as well.
                        >
                        > Had the second player entered 'xxxbx', the system had responded with
                        > '---.-', as the 'b' is correct but not correctly positioned.
                        >
                        > The second player must find out the original word.
                        >[/color]
                        Sounds like a variation of an old game called Mastermind. A Google
                        search for "Mastermind algorithm" brings up lots of links, though I
                        suspect these are all based on having the computer perform the
                        guessing. Using five slots, and the full alphabet, is going to expand
                        the possibilities drastically -- Mastermind, as I recall, normally used
                        four slots, with an "alphabet" of 6 colors, and granted something like
                        20 guesses.


                        ---- mastermind.py -----

                        """
                        Five-character word-based Mastermind control shell
                        Dennis Lee Bieber September 21 2003

                        This program performs the user input of the target word, and
                        the evaluation of the guesses. It does not create its own guesses
                        to solve a user selected target word.

                        Guess results are reported as a string containing:

                        - the letter in the guess at this position does not
                        appear anywhere in the target word

                        . the letter at this position does appear in the target,
                        but does not belong in this position

                        * the letter at this position is correct

                        """

                        def GetWord(prompt) :
                        while 1:
                        wd = raw_input(promp t)
                        if len(wd) != 5:
                        print "Please enter a five-letter word"
                        else:
                        break
                        return wd

                        def Evaluate(t, g):
                        tl = list(t)
                        gl = list(g)
                        rl = list("-----")

                        for i in range(5):
                        if gl[i] in tl:
                        rl[i] = "."
                        if gl[i] == tl[i]:
                        rl[i] = "*"

                        return "".join(rl)


                        if __name__ == "__main__":
                        print __doc__
                        print ""

                        # get the target word from "player 1"
                        #
                        target = GetWord("Enter the target word> ")

                        # clear the screen; simplistic method
                        #
                        print "\n"*50

                        # process the guesses from "player 2"
                        #
                        gcount = 0
                        while 1:
                        # get a guess -- identical to getting the target
                        #
                        gcount += 1
                        guess = GetWord("Enter a word for guess %s> " % gcount)

                        # evaluate the guess against the target
                        #
                        result = Evaluate(target , guess)

                        # report results
                        if result == "*****":
                        print "\nCongratulati ons\n\tYou have guessed the word in %s
                        tries\n" % gcount
                        break
                        else:
                        print "\n%s\tPlea se try again\n" % result




                        --[color=blue]
                        > =============== =============== =============== =============== == <
                        > wlfraed@ix.netc om.com | Wulfraed Dennis Lee Bieber KD6MOG <
                        > wulfraed@dm.net | Bestiaria Support Staff <
                        > =============== =============== =============== =============== == <
                        > Bestiaria Home Page: http://www.beastie.dm.net/ <
                        > Home Page: http://www.dm.net/~wulfraed/ <[/color]

                        Comment

                        • Colin Fox

                          #13
                          Re: Problems with string and lists (searching and replaceing)

                          On Sun, 21 Sep 2003 20:40:30 +0200, Ulrich Petri wrote:
                          [color=blue]
                          > "jblazi" <jblazi@hotmail .com> schrieb im Newsbeitrag
                          > news:pan.2003.0 9.21.06.55.07.1 6000@hotmail.co m...[color=green]
                          >> I shall have a computer science class this year and I decided to use
                          >> Python. It is my favourite language and I have used it for many years. Now
                          >> I thought, one of our first "real" programs, in our pre-graphical and
                          >> pre-class state, would be to write simple program that works like this:
                          >>
                          >> One of the pupils enters a word. It should be a valid German word
                          >> consisting of five letters, for example 'abcde' (which is not a German
                          >> word by the way).
                          >>
                          >> The the other player may enter a guess which must be a five letter word as
                          >> well, for example 'xbxxx'. Then the system answers with the string '-*---'
                          >> as the 'b' in 'xbxxx' was correct and at the right place as well.
                          >>
                          >> Had the second player entered 'xxxbx', the system had responded with
                          >> '---.-', as the 'b' is correct but not correctly positioned.
                          >>
                          >> The second player must find out the original word.
                          >>[/color]
                          >
                          > Hm sth. like this?
                          >
                          > -----code------
                          > def mastermind(word , guess):
                          > if len(word) != len(guess):
                          > return "Error"
                          > ret = ["-"]*len(word)
                          > counter = 0
                          > for lw, lg in zip(word, guess):
                          > if lw == lg:
                          > ret[counter] = "x"
                          > else:
                          > if lg in word:
                          > ret[counter] = "."
                          > counter += 1
                          > return "".join(ret )
                          >[color=green][color=darkred]
                          >>>> mastermind('hau s', 'hasu')[/color][/color]
                          > 'xx..'[color=green][color=darkred]
                          >>>> mastermind("jag uar", "januar")[/color][/color]
                          > 'xx-xxx'
                          > -----code-----[/color]

                          Here's an alternative. I took out the 'if lg in word' logic,
                          since that doesn't take into account duplicates and therefore
                          would be misleading (ie 'jaguar','jaaaa a' would return 'x.....',
                          but there aren't 5 a's in the word).

                          #!/usr/bin/env python
                          import string

                          def wordcheck(word, guess):
                          outstr = []
                          if len(word) != len(guess):
                          raise "Wrong number of letters in guess."

                          for x in range(len(word) ):
                          outstr.append( ['-','*'][(word[x]==guess[x])] )

                          return string.join(out str,'')

                          res = wordcheck('Coli n','Coolo')
                          print res


                          Comment

                          • Ulrich Petri

                            #14
                            Re: Problems with string and lists (searching and replaceing)


                            "Colin Fox" <cfox@cfconsult ing.ca> schrieb im Newsbeitrag
                            news:pan.2003.0 9.21.21.08.04.5 29981@cfconsult ing.ca...[color=blue]
                            > Here's an alternative. I took out the 'if lg in word' logic,
                            > since that doesn't take into account duplicates and therefore
                            > would be misleading (ie 'jaguar','jaaaa a' would return 'x.....',
                            > but there aren't 5 a's in the word).
                            >
                            > #!/usr/bin/env python
                            > import string
                            >
                            > def wordcheck(word, guess):
                            > outstr = []
                            > if len(word) != len(guess):
                            > raise "Wrong number of letters in guess."
                            >
                            > for x in range(len(word) ):
                            > outstr.append( ['-','*'][(word[x]==guess[x])] )
                            >
                            > return string.join(out str,'')
                            >
                            > res = wordcheck('Coli n','Coolo')
                            > print res
                            >[/color]

                            Yeah your right, but with your code there is no indication of a right letter
                            in the wrong position.
                            I guess one has to use a decorate-undecorate thing...
                            If i have some time later today i will test this...

                            Ciao Ulrich


                            Comment

                            • Alex Martelli

                              #15
                              Re: Problems with string and lists (searching and replaceing)

                              jblazi wrote:
                              [color=blue]
                              > I should like to search certain characters in a string and when they are
                              > found, I want to replace other characters in other strings that are at
                              > the same position (for a very simply mastermind game) for my pupils.
                              >
                              > This very simple thing does not seem simple at all.
                              >
                              > If I use strings, I cannot replace their parts (though I can use
                              > string.find for the searching). I think it is a bad idea that strings are
                              > not mutable, but I suspect that this has been discussed here for ages.[/color]

                              Not really (most of us appear to have no problems with immutable
                              strings). And indeed I don't see what's complicated with your task,
                              at all. Suppose the string you're "searching certain characters in"
                              is held by variable "searched_strin g", the characters you are
                              searching in (any sequence, list or other) variable "characters ",
                              the "other strings" are (e.g.) all the items of list "otherstrin gs",
                              and finally the replacement characters are in dictionary "replacers"
                              indexed by the found characters and with a default of say '*' when
                              a found character is not a key in "replacers" . Note that all of
                              these or similar hypotheses are obviously needed whether strings
                              are mutable or not.

                              Now, if strings were mutable, the obvious solution (avoiding
                              exceptions, as you asked) might be:

                              for c in characters:
                              where = searched_string .find(c)
                              if where<0: continue
                              replace_with = replacers.get(c , '*')
                              for another in otherstrings:
                              if where < len(another):
                              another[where] = replace_with

                              Now since strings are NOT mutable, you need to change this to:

                              for c in characters:
                              where = searched_string .find(c)
                              if where<0: continue
                              replace_with = replacers.get(c , '*')
                              for i, another in enumerate(other strings):
                              otherstrings[i] = another[:where] + replace_with + another[where+1:]

                              i.e, keep track of the index and set there another string build of
                              three parts -- preceding, replace_with, succeeding. In this case
                              you do not have to ensure that where<len(anoth er) -- if that
                              condition does not hold then replace_with will just be "appended"
                              to the "other string" (slicing is more tolerant than indexing). If
                              you want the same semantics as above (no change to "other strings"
                              that are shorter than the 'where' point requires) then you'll just
                              have to add the same guard in this second case, of course.

                              Basically, the change from "x[y]=z" to "x=x[:y]+z+x[y+1:]" is just
                              not "traumatic" enough, in my opinion, to warrant considering this
                              a seriously complicated problem ("not seem simple at all"). If
                              you need to explain it to beginners by analogy: imagine you have an
                              original document that you're not allowed to alter, for example
                              because that document is bound and you don't want to, or cannot,
                              break its binding; despite this, you are requested to "change page
                              4 into this one" to make a new version. Then, just "photocopy"
                              pages 1 to 3, and pages 5 and following, and in the new version
                              collate (first) the copies of original pages 1 to 3, (then)
                              the new "this one", and (finally) the copies of pages 5 and
                              following of the original document. Since not all documents one
                              meets in real life come in "flexible" bindings where one can
                              remove and replace pages, the analogy should be quite clear, IMHO.


                              Alex


                              Comment

                              Working...