<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Thanks, <br>
      <br>
      The right solution was this : <br>
      <br>
      init' (x:xs) = Just (x:fromMaybe xs (init' xs))<br>
      <br>
      if I understand it right x:fromMaybe xs takes care that from xs
      the just or Nothing is removed ?<br>
      <br>
      Roelof<br>
      <br>
      <br>
      <br>
      Alexey Shmalko schreef op 12-5-2015 om 16:33:<br>
    </div>
    <blockquote
cite="mid:CAFC2PC5SDQGj5XzCsosV5+WFf-7k=ChX8VDoCR8oXqXF3T1Ewg@mail.gmail.com"
      type="cite">
      <div dir="ltr">Try fromMaybe [1]. Examples<br>
        <br>
        <div>Prelude Data.Maybe> fromMaybe [] (Just [1,2,3])</div>
        <div>[1,2,3]</div>
        <div>Prelude Data.Maybe> fromMaybe [1,2,3] Nothing</div>
        <div>[1,2,3]</div>
        <div><br>
        </div>
        <div>[1]: <a moz-do-not-send="true"
href="https://hackage.haskell.org/package/base-4.8.0.0/docs/Data-Maybe.html#v:fromMaybe">https://hackage.haskell.org/package/base-4.8.0.0/docs/Data-Maybe.html#v:fromMaybe</a><br>
        </div>
      </div>
      <br>
      <div class="gmail_quote">On Tue, May 12, 2015 at 5:28 PM Roelof
        Wobben <<a moz-do-not-send="true"
          href="mailto:r.wobben@home.nl">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>Oke, <br>
              <br>
              And how do I do this.  Haskell is a difficult one to
              learn,<br>
              <br>
              Roelof<br>
              <br>
              <br>
              <br>
              Alexey Shmalko schreef op 12-5-2015 om 16:24:<br>
            </div>
          </div>
          <div bgcolor="#FFFFFF" text="#000000">
            <blockquote type="cite">
              <div dir="ltr">Before cons'ing the result of init', you
                should check whether it's Just or Nothing. What you're
                doing now is something along the line with 5 : Just 3 --
                this won't typecheck.<br>
              </div>
              <br>
              <div class="gmail_quote">On Tue, May 12, 2015 at 5:22 PM
                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>Brandon Allbery schreef op 12-5-2015 om 16:16:<br>
                    </div>
                  </div>
                  <div bgcolor="#FFFFFF" text="#000000">
                    <blockquote type="cite">
                      <div dir="ltr">
                        <div class="gmail_extra">
                          <div class="gmail_quote">On Tue, May 12, 2015
                            at 10:11 AM, 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>
                            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>I do not understand what you are
                                  saying to me.<br>
                                  <br>
                                  I know that init produces a Maybe [a]
                                  . That is why I did put a Just before
                                  it.<br>
                                </div>
                              </div>
                            </blockquote>
                            <div><br>
                            </div>
                            <div>You are invoking it again though, and
                              using its result as if it produces [a]
                              instead of Maybe [a].</div>
                          </div>
                          <div><br>
                          </div>
                          -- <br>
                          <div>
                            <div dir="ltr">
                              <div>brandon s allbery kf8nh              
                                                sine nomine associates</div>
                              <div><a moz-do-not-send="true"
                                  href="mailto:allbery.b@gmail.com"
                                  target="_blank">allbery.b@gmail.com</a>
                                                                 <a
                                  moz-do-not-send="true"
                                  href="mailto:ballbery@sinenomine.net"
                                  target="_blank">ballbery@sinenomine.net</a></div>
                              <div>unix, openafs, kerberos,
                                infrastructure, xmonad        <a
                                  moz-do-not-send="true"
                                  href="http://sinenomine.net"
                                  target="_blank">http://sinenomine.net</a></div>
                            </div>
                          </div>
                        </div>
                      </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>
                  </div>
                  <div bgcolor="#FFFFFF" text="#000000"> What is then
                    the right way to do. I still do not understand what
                    you are trying to make clear to me.</div>
                  <div bgcolor="#FFFFFF" text="#000000"><br>
                    <br>
                    Roelof</div>
                  <div bgcolor="#FFFFFF" text="#000000"><br>
                    <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"
                                src="http://static.avast.com/emails/avast-mail-stamp.png"
                                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"
                        src="http://static.avast.com/emails/avast-mail-stamp.png"
                        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 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>