<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Roelof Wobben schreef op 1-2-2015 om
      12:08:<br>
    </div>
    <blockquote cite="mid:54CE091B.2070301@home.nl" type="cite">
      <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
      <div class="moz-cite-prefix">Bob Ippolito schreef op 1-2-2015 om
        11:24:<br>
      </div>
      <blockquote
cite="mid:CACwMPm86AgNr6DQZMmJFoSqZiT-G+7B1w3Ck5dDqjJncoopRew@mail.gmail.com"
        type="cite">
        <div dir="ltr">The goal is to solve the problem as stated such
          that it would work for *any* example, not just that one. It's
          very easy to come up with an example that does not work with
          your implementation.
          <div><br>
          </div>
          <div>Perhaps you should read the source for the lists module,
            and take the time to try and understand it. <a
              moz-do-not-send="true"
              href="https://github.com/erlang/otp/blob/maint/lib/stdlib/src/lists.erl">https://github.com/erlang/otp/blob/maint/lib/stdlib/src/lists.erl</a></div>
        </div>
        <div class="gmail_extra"><br>
          <div class="gmail_quote">On Sun, Feb 1, 2015 at 2:14 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">Hello,<br>
              <br>
              I have this exercise of the Erlang programming book.<br>
              <br>
              Write a function that, given a list of lists, will
              concatenate them.<br>
              Example:<br>
              concatenate([[1,2,3], [], [4, five]]) ⇒ [1,2,3,4,five].<br>
              Hint: you will have to use a helpfunction and concatenate
              the lists in several steps.<br>
              <br>
              But I do not need to use a helper function because it can
              be solved like this :<br>
              <br>
              concatenate( [List1 , List2 , List3] ) -><br>
                  List1 ++ List2 ++ List3.<br>
              <br>
              Or is this not the solution that is meant on this exercise
              ?<br>
              Do I need to solve it by using pattern matching ?<br>
              <br>
              Roelof<br>
              <br>
              _______________________________________________<br>
              erlang-questions mailing list<br>
              <a moz-do-not-send="true"
                href="mailto:erlang-questions@erlang.org"
                target="_blank">erlang-questions@erlang.org</a><br>
              <a moz-do-not-send="true"
                href="http://erlang.org/mailman/listinfo/erlang-questions"
                target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
            </blockquote>
          </div>
          <br>
        </div>
      </blockquote>
      <br>
      Thanks, I will do this,<br>
      <br>
      But there is one problem.<br>
      <br>
      The source is full of -spec and in programming erlang that is
      explained in chapter 18 where Im trying exercises of chapter 3.<br>
      <br>
      Roelof<br>
      <br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
erlang-questions mailing list
<a class="moz-txt-link-abbreviated" href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a>
<a class="moz-txt-link-freetext" href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a>
</pre>
    </blockquote>
    <br>
    <br>
    This solution better ?<br>
    <br>
    concatenate([]) -><br>
        [].<br>
    <br>
    concatenate([List] ) -><br>
        concatenate2(List1, []).<br>
    <br>
    concatenate2([], List) -><br>
        List; <br>
    <br>
    concatenate2([Head| Tail], List) -><br>
        concatenate2(Tail, [Head | List])<br>
    <br>
    Roelof<br>
    <br>
  </body>
</html>