<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Hello, <br>
      <br>
      I now also see that error.<br>
      <br>
      What I try to do is : <br>
      <br>
      pp' [] xs = xs   when the first list is empty then the output is
      the second list<br>
      pp' [] [] = [] when both list are empty then the output will be a
      empty array. <br>
      <br>
      I flipped both rules and now the error is gone. <br>
      Now I hope to find out how I can take care that the right number
      is added to the second list <br>
      <br>
      Roelof<br>
      <br>
      Jonathan Skårstedt schreef op 12-5-2015 om 20:58:<br>
    </div>
    <blockquote
cite="mid:CAD6iYwYKfEKx8nNRwco6KinkOK_3wgG6Qy2i073pLO=_Nqm5gw@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>Hello!</div>
        <div><br>
        </div>
        <div>I will call plusplus' by pp' in the text below<br>
        </div>
        <div><br>
        </div>
        <div>1. Your pp' gives a warning, namely that the patterns </div>
        <div>pp' [] xs = xs</div>
        <div>pp' [] []  = []</div>
        <div>are overlapping. This is because of pattern matching
          working top-down ie if I give the input <b>pp' [] [] </b>it
          will match both your function entry points at <b>pp' [] xs</b>
          and <b>pp' [] []</b>. We don't really need <b>pp' [] []</b>
          as <b>pp' [] ys = ys </b>will give the correct answer even
          if ys is an empty list.<br>
        </div>
        <div><br>
        </div>
        <div>2. In your last function body you have this expression </div>
        <div>pp' (x:xs) ys = pp' xs (x:ys) </div>
        <div><br>
        </div>
        <div>this will not do what you expect, consider the flow below.</div>
        <div><br>
        </div>
        <div>I will call pp' on two strings "ABC" and "DEF"</div>
        <div><br>
        </div>
        <div>Lets extend this function</div>
        <div>pp' (A:BC) DEF = pp' BC (A:DEF)</div>
        <div>pp' (B:C) ADEF = pp' C (B:ADEF)</div>
        <div>pp' C:[] BADEF = pp' [] (C:BADEF)</div>
        <div>pp' [] CBADEF  = CBADEF -- <- base case</div>
        <div><br>
        </div>
        <div>As you see, it will pick the first of xs to put first on ys
          but is this what we want? For one recursion, yes but after
          that it gets a bit weird. The second recursion will flip the
          order of the resulting list by adding the first object at the
          start first, instead of last.</div>
        <div><br>
        </div>
        <div>We actually don't want our construction (the colon :) to
          work from inside the recursive call (pp' xs (x:ys)), we want
          to move it outside, like this, and just like we did in init:
          pp' (x:xs) ys = <b>x: </b>pp' xs ys</div>
        <div><br>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">2015-05-12 20:33 GMT+02:00 Roelof
          Wobben <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:r.wobben@home.nl" target="_blank">r.wobben@home.nl</a>></span>:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div bgcolor="#FFFFFF" text="#000000">
              <div>pfff, I got grazy here <br>
                <br>
                On this function it works fine : <br>
                <br>
                -- | The main entry point.<br>
                init' :: [a] -> Maybe [a]<br>
                init' [] = Nothing<br>
                init' [x] = Just [] <br>
                init' (x:xs) = Just (x:fromMaybe xs (init' xs))<br>
                <br>
                main = print . init' $ [1,3]<br>
                <br>
                <br>
                and on this one it does not work : <br>
                <span class=""> <br>
                  plusplus' :: [a] -> [a] -> [a]<br>
                  plusplus' [] (xs) = xs <br>
                  plusplus' [] [] = [] <br>
                  plusplus' (xs) [] =  xs<br>
                </span> plusplus' (x:xs) yx = plusplus' xs (x:yx)<br>
                 <br>
                <br>
                main = print . plusplus' $  [1,2] [3, 4]<br>
                <br>
                Roelof<br>
                <br>
                <br>
                <br>
                <br>
                Alex Hammel schreef op 12-5-2015 om 20:19:<br>
              </div>
              <div>
                <div class="h5">
                  <blockquote type="cite">
                    <div dir="ltr">
                      <div>The relevant part of that error message is
                        this:<br>
                        <br>
                        <span>> The function ‘[1, 2]’ is applied to
                          one argument, but its type </span>
                        <div style="font-size:14px">> [<span>t0</span>]<br>
                        </div>
                        <div style="font-size:14px">> has none<br>
                        </div>
                        <br>
                      </div>
                      Which means that you're trying to call a list
                      literal as though it were a function (with one
                      argument). Which probably means that you've got a
                      ($) out of place.<br>
                      <div>
                        <div>
                          <div><br>
                          </div>
                        </div>
                      </div>
                    </div>
                    <br>
                    <div class="gmail_quote">On Tue, 12 May 2015 at
                      11:16 Roelof Wobben <<a moz-do-not-send="true"
                        href="mailto:r.wobben@home.nl" target="_blank">r.wobben@home.nl</a>>
                      wrote:<br>
                      <blockquote class="gmail_quote" style="margin:0 0
                        0 .8ex;border-left:1px #ccc
                        solid;padding-left:1ex">
                        <div bgcolor="#FFFFFF" text="#000000">
                          <div>Thanks, <br>
                            <br>
                            Now I see the last error on the main line :
                            <br>
                            <br>
                            <div>src/Main.hs@7:28-7:39 </div>
                            <div><span>Couldn't match expected type
                                ‘[t1] -> [a0]’ with actual type </span>
                              <div style="font-size:14px">[<span>t0</span>]</div>
                              <span> The function ‘[1, 2]’ is applied to
                                one argument, but its type </span>
                              <div style="font-size:14px">[<span>t0</span>]</div>
                              <span> has none</span><span title="Click
                                to show/hide extra information"> …</span><span
                                style="display:inline"> In the second
                                argument of ‘($)’, namely ‘[1, 2] [3,
                                4]’ In the expression: print . plusplus'
                                $ [1, 2] [3, 4]<br>
                                <br>
                                Roelof<br>
                                <br>
                              </span></div>
                            <br>
                            <br>
                            <br>
                            Alex Hammel schreef op 12-5-2015 om 20:11:<br>
                          </div>
                        </div>
                        <div bgcolor="#FFFFFF" text="#000000">
                          <blockquote type="cite">
                            <div dir="ltr">
                              <div>You're missing the parens around
                                (x:yx) in the last clause.<br>
                              </div>
                            </div>
                            <br>
                            <div class="gmail_quote">On Tue, 12 May 2015
                              at 11:02 Roelof Wobben <<a
                                moz-do-not-send="true"
                                href="mailto:r.wobben@home.nl"
                                target="_blank">r.wobben@home.nl</a>>
                              wrote:<br>
                              <blockquote class="gmail_quote"
                                style="margin:0 0 0 .8ex;border-left:1px
                                #ccc solid;padding-left:1ex">
                                <div bgcolor="#FFFFFF" text="#000000">
                                  Hello, <br>
                                  <br>
                                  I try to re implement ++ <br>
                                  <br>
                                  So far I have this ; <br>
                                  <br>
                                  plusplus' :: [a] -> [a] -> [a]<br>
                                  plusplus' [] (xs) = xs <br>
                                  plusplus' [] [] = [] <br>
                                  plusplus' (xs) [] =  xs<br>
                                  plusplus' (x:xs) yx = plusplus' xs
                                  x:yx<br>
                                  <br>
                                  main = print . plusplus' $ [1,2] [3,4]<br>
                                  <br>
                                  <br>
                                  But I still get this error message : <br>
                                  <br>
                                  <div>src/Main.hs@5:23-5:37 </div>
                                  <div><span>Couldn't match expected
                                      type </span>
                                    <div style="font-size:14px"><span>a</span></div>
                                    <span> with actual type </span>
                                    <div style="font-size:14px">[<span>a</span>]</div>
                                    <span> </span>
                                    <div style="font-size:14px"><span>a</span></div>
                                    <span> is a rigid type variable
                                      bound by the type signature for
                                      plusplus' :: [a] -> [a] ->
                                      [a] at
                                      /home/app/isolation-runner-work/projects/112825/session.207/src/src/Main.hs:1:14
Relevant



                                      bindings include yx :: [a] (bound
                                      at
                                      /home/app/isolation-runner-work/projects/112825/session.207/src/src/Main.hs:5:18)




                                      xs :: [a] (bound at
                                      /home/app/isolation-runner-work/projects/112825/session.207/src/src/Main.hs:5:14)




                                      x :: a (bound at
                                      /home/app/isolation-runner-work/projects/112825/session.207/src/src/Main.hs:5:12)




                                      plusplus' :: [a] -> [a] ->
                                      [a] (bound at
/home/app/isolation-runner-work/projects/112825/session.207/src/src/Main.hs:2:1)</span><span
                                      title="Click to show/hide extra
                                      information"> …<br>
                                      <br>
                                      <br>
                                    </span></div>
                                  <br>
                                  <br>
                                  <br>
                                  <hr
style="border:none;color:#909090;background-color:#b0b0b0;min-height:1px;width:99%">
                                  <table
                                    style="border-collapse:collapse;border:none">
                                    <tbody>
                                      <tr>
                                        <td
                                          style="border:none;padding:0px
                                          15px 0px 8px"> <a
                                            moz-do-not-send="true"
                                            href="http://www.avast.com/"
                                            target="_blank"> <img
                                              moz-do-not-send="true"
                                              alt="Avast logo"
                                              border="0"> </a> </td>
                                        <td>
                                          <p
style="color:#3d4d5a;font-family:"Calibri","Verdana","Arial","Helvetica";font-size:12pt">
                                            Dit e-mailbericht is
                                            gecontroleerd op virussen
                                            met Avast antivirussoftware.
                                            <br>
                                            <a moz-do-not-send="true"
                                              href="http://www.avast.com/"
                                              target="_blank">www.avast.com</a>
                                          </p>
                                        </td>
                                      </tr>
                                    </tbody>
                                  </table>
                                  <br>
                                </div>
_______________________________________________<br>
                                Beginners mailing list<br>
                                <a moz-do-not-send="true"
                                  href="mailto:Beginners@haskell.org"
                                  target="_blank">Beginners@haskell.org</a><br>
                                <a moz-do-not-send="true"
                                  href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners"
                                  target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
                              </blockquote>
                            </div>
                            <br>
                            <fieldset></fieldset>
                            <br>
                            <pre>_______________________________________________
Beginners mailing list
<a moz-do-not-send="true" href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a>
<a moz-do-not-send="true" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a>
</pre>
                          </blockquote>
                          <br>
                          <br>
                          <br>
                          <hr
style="border:none;color:#909090;background-color:#b0b0b0;min-height:1px;width:99%">
                          <table
                            style="border-collapse:collapse;border:none">
                            <tbody>
                              <tr>
                                <td style="border:none;padding:0px 15px
                                  0px 8px"> <a moz-do-not-send="true"
                                    href="http://www.avast.com/"
                                    target="_blank"> <img
                                      moz-do-not-send="true" alt="Avast
                                      logo" border="0"> </a> </td>
                                <td>
                                  <p
style="color:#3d4d5a;font-family:"Calibri","Verdana","Arial","Helvetica";font-size:12pt">
                                    Dit e-mailbericht is gecontroleerd
                                    op virussen met Avast
                                    antivirussoftware. <br>
                                    <a moz-do-not-send="true"
                                      href="http://www.avast.com/"
                                      target="_blank">www.avast.com</a>
                                  </p>
                                </td>
                              </tr>
                            </tbody>
                          </table>
                          <br>
                        </div>
                        _______________________________________________<br>
                        Beginners mailing list<br>
                        <a moz-do-not-send="true"
                          href="mailto:Beginners@haskell.org"
                          target="_blank">Beginners@haskell.org</a><br>
                        <a moz-do-not-send="true"
                          href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners"
                          target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
                      </blockquote>
                    </div>
                    <br>
                    <fieldset></fieldset>
                    <br>
                    <pre>_______________________________________________
Beginners mailing list
<a moz-do-not-send="true" href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a>
<a moz-do-not-send="true" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a>
</pre>
                  </blockquote>
                  <br>
                  <br>
                  <br>
                  <hr
style="border:none;color:#909090;background-color:#b0b0b0;min-height:1px;width:99%">
                  <table style="border-collapse:collapse;border:none">
                    <tbody>
                      <tr>
                        <td style="border:none;padding:0px 15px 0px 8px">
                          <a moz-do-not-send="true"
                            href="http://www.avast.com/" target="_blank">
                            <img moz-do-not-send="true" alt="Avast logo"
                              border="0"> </a> </td>
                        <td>
                          <p
style="color:#3d4d5a;font-family:"Calibri","Verdana","Arial","Helvetica";font-size:12pt">
                            Dit e-mailbericht is gecontroleerd op
                            virussen met Avast antivirussoftware. <br>
                            <a moz-do-not-send="true"
                              href="http://www.avast.com/"
                              target="_blank">www.avast.com</a> </p>
                        </td>
                      </tr>
                    </tbody>
                  </table>
                  <br>
                </div>
              </div>
            </div>
            <br>
            _______________________________________________<br>
            Beginners mailing list<br>
            <a moz-do-not-send="true"
              href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
            <a moz-do-not-send="true"
              href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners"
              target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
            <br>
          </blockquote>
        </div>
        <br>
        <br clear="all">
        <div><br>
        </div>
        -- <br>
        <div class="gmail_signature">Jonathan Skårstedt<br>
          Bergsgårdsgärdet 39<br>
          Lgh 1108<br>
          424 32 Göteborg<br>
          Mobil: 073 - 76 20 20 7<br>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Beginners mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Beginners@haskell.org">Beginners@haskell.org</a>
<a class="moz-txt-link-freetext" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a>
</pre>
    </blockquote>
    <br>
  
<br /><br />
<hr style='border:none; color:#909090; background-color:#B0B0B0; height: 1px; width: 99%;' />
<table style='border-collapse:collapse;border:none;'>
        <tr>
                <td style='border:none;padding:0px 15px 0px 8px'>
                        <a href="http://www.avast.com/">
                                <img border=0 src="http://static.avast.com/emails/avast-mail-stamp.png" alt="Avast logo" />
                        </a>
                </td>
                <td>
                        <p style='color:#3d4d5a; font-family:"Calibri","Verdana","Arial","Helvetica"; font-size:12pt;'>
                                Dit e-mailbericht is gecontroleerd op virussen met Avast antivirussoftware.
                                <br><a href="http://www.avast.com/">www.avast.com</a>
                        </p>
                </td>
        </tr>
</table>
<br />
</body>
</html>