<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Op 6-4-2012 9:20, Danny Yoo schreef:
    <blockquote
cite="mid:CAGZAPF7mimGDg_G6w5m1098dS+yDeOd=ewXt8rvVpaEz99qvqA@mail.gmail.com"
      type="cite"><br>
      <br>
      On Friday, April 6, 2012, Roelof Wobben wrote:<br>
      <blockquote class="gmail_quote" style="margin:0 0 0
        .8ex;border-left:1px #ccc solid;padding-left:1ex">Op 5-4-2012
        20:29, Danny Yoo schreef:<br>
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            I start with this :<br>
            <br>
            aaaaa|<br>
          </blockquote>
          <br>
          Concretely, what does the editor world value look like at this
          point?<br>
          You're representing the state somewhat ambiguously.  Can you
          represent<br>
          the above in terms of (make-editor ... ...)?<br>
          <br>
          <br>
        </blockquote>
        <br>
        Yes, (make-editor  aaaaaa    a  """)</blockquote>
      <div><br>
      </div>
      <div>This can't be, as make-editor can only take two strings.  The
        structure definition of make editor is:</div>
      <div><br>
      </div>
      <div>    (define-struct editor (pre post))</div>
      <div><br>
      </div>
      <div>Where both pre and post are both strings.</div>
      <div><br>
      </div>
      <div> </div>
      <blockquote class="gmail_quote" style="margin:0 0 0
        .8ex;border-left:1px #ccc solid;padding-left:1ex">
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            now someone press 3 times the left key.<br>
            So I have  aa/aaa<br>
          </blockquote>
          <br>
        </blockquote>
      </blockquote>
      <div> </div>
      <blockquote class="gmail_quote" style="margin:0 0 0
        .8ex;border-left:1px #ccc solid;padding-left:1ex">
        rep has he value of aaaaa<br>
        s has the value of a<br>
        t has also the value of a.<br>
      </blockquote>
      <div><br>
      </div>
      <div><br>
      </div>
      <div>You make the same conceptual mistake here.  This
        representation does not fit the shape of the structure
        definition.<span></span></div>
      <div><br>
      </div>
      <div><br>
      </div>
      <div>Go back and make sure you understand the data definition.  If
        you have questions about it, please feel free to ask.</div>
    </blockquote>
    <br>
    <br>
    Oke,<br>
    Back to the beginning. <br>
    <br>
    In the text is noted. <br>
    <table class="RktBlk" cellspacing="0">
      <tbody>
        <tr>
          <td><span class="RktPn">(</span><span class="RktSym"><a
href="http://docs.racket-lang.org/htdp-langs/beginner.html#%28form._%28%28lib._lang%2Fhtdp-beginner..rkt%29._define-struct%29%29"
                class="RktStxLink" pltdoc="x">define-struct</a></span><span
              class="hspace"> </span><span class="RktSym">editor</span><span
              class="hspace"> </span><span class="RktPn">(</span><span
              class="RktSym">pre</span><span class="hspace"> </span><span
              class="RktSym">post</span><span class="RktPn">)</span><span
              class="RktPn">)</span></td>
        </tr>
        <tr>
          <td><span class="RktCmt">;</span><span class="RktCmt"> </span><a
              name="(tech._editor)"></a><span style="font-style: italic">Editor</span><span
              class="RktCmt"> = </span><span class="RktPn">(</span><span
              class="RktSym">make-editor</span><span class="stt"> </span><span
              class="RktSym">String</span><span class="stt"> </span><span
              class="RktSym">String</span><span class="RktPn">)</span></td>
        </tr>
        <tr>
          <td><span class="RktCmt">;</span><span class="RktCmt"> </span><span
              class="RktCmt">interp. </span><span class="RktPn">(</span><span
              class="RktSym">make-editor</span><span class="stt"> </span><span
              class="RktSym">s</span><span class="stt"> </span><span
              class="RktSym">t</span><span class="RktPn">)</span><span
              class="RktCmt"> means the text in the editor is</span></td>
        </tr>
        <tr>
          <td><span class="RktCmt">;</span><span class="RktCmt"> </span><span
              class="RktPn">(</span><span class="RktSym"><a
href="http://docs.racket-lang.org/htdp-langs/beginner.html#%28def._%28lib._htdp-beginner..rkt._lang%29._%28%28lib._lang%2Fhtdp-beginner..rkt%29._string-append%29%29"
                class="RktValLink" pltdoc="x">string-append</a></span><span
              class="stt"> </span><span class="RktSym">s</span><span
              class="stt"> </span><span class="RktSym">t</span><span
              class="RktPn">)</span><span class="RktCmt"> with the
              cursor displayed between </span><span class="RktSym">s</span><span
              class="RktCmt"> and </span><span class="RktSym">t</span></td>
        </tr>
      </tbody>
    </table>
    <br>
    <br>
    So for aaaaaaa| s has the value of aaaaa en t has the value of ""<br>
    For aaaa|aaaa s  I think s has the value of aaaaa and t has the
    value of aaa<br>
    <br>
    I have a idea.<br>
    If I use the length of the first string and I press one time on the
    left-key then the new-length could be the old-one - 1. Then I could
    use substring to cut that part away.<br>
    The t part I could say if it's empty substring ( s , (string-lenght
    s), 1) and if it's not empty use a string-append. <br>
    <br>
    Am I on the right track ?<br>
    <br>
    Roelof<br>
    <br>
  </body>
</html>