<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Comments inline below.<div class=""><br class=""></div><div class="">-Rick</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 29, 2015, at 1:14 PM, Roelof Wobben <<a href="mailto:r.wobben@home.nl" class="">r.wobben@home.nl</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">
  
    <meta content="text/html; charset=windows-1252" http-equiv="Content-Type" class="">
  
  <div bgcolor="#FFFFFF" text="#000000" class="">
    <div class="moz-cite-prefix"><a class="moz-txt-link-abbreviated" href="mailto:e@bestmx.net">e@bestmx.net</a> schreef op 29-1-2015 om
      20:06:<br class="">
    </div>
    <blockquote cite="mid:54CA84BD.6090908@bestmx.net" type="cite" class="">
      <blockquote type="cite" class="">So i have to make a tuple of the data and
        add it in a list.
        <br class="">
        <br class="">
        I thought I could do something like this :
        <br class="">
        <br class="">
        write(Key, Data, Db) ->
        <br class="">
           [ {key, data} | Db ]
        <br class="">
        <br class="">
        but then I see some error messages.
        <br class="">
      </blockquote>
      <br class="">
      what messages?
      <br class="">
      <br class="">
      as far as i can _theorize_
      <br class="">
      the most probably your Db is not a list, and it should be.
      <br class="">
      _______________________________________________
      <br class="">
      erlang-questions mailing list
      <br class="">
      <a class="moz-txt-link-abbreviated" href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a>
      <br class="">
      <a class="moz-txt-link-freetext" href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a>
      <br class="">
      <br class="">
    </blockquote>
    <br class="">
    Here is my code so far : <br class="">
    <br class="">
    -module(db).<br class="">
    <br class="">
    -export([new/0, destroy/1]).<br class="">
    <br class="">
    new() -><br class="">
      [].<br class="">
    <br class="">
    destroy(Db) -><br class="">
      {ok}.<br class=""></div></div></blockquote><div><br class=""></div><div>Why are you returning a tuple here instead of simply ‘ok’ ?</div><br class=""><blockquote type="cite" class=""><div class=""><div bgcolor="#FFFFFF" text="#000000" class="">
    write(Key, Element, Db) -><br class="">
       [ [{key, data}] | Db ] <br class=""></div></div></blockquote><div><br class=""></div><div>I’m assuming you want to actually store the Key and Element passed in, and not the atoms ‘key’ and ‘data’, no?</div><div><br class=""></div><div>Also, looks like you forgot the full-stop / period in that function.</div><div><br class=""></div><div>-Rick</div><br class=""><blockquote type="cite" class=""><div class=""><div bgcolor="#FFFFFF" text="#000000" class="">
    <br class="">
    <br class="">
    and this the output of c(db).<br class="">
    <br class="">
    <input class="terminal-input">                                                                                                                                                                               
    <br class="">
    <div data-row="4" class="terminal-row">3> c(db).                                                                                                                                                                              </div>
    <div data-row="5" class="terminal-row">db.erl:12: syntax error before:                                                                                                                                                        </div>
    <div data-row="6" class="terminal-row">db.erl:8: Warning: variable 'Db' is unused                                                                                                                                             </div>
    error   <br class="">
    <br class="">
    Roelof<br class="">
    <br class="">
    <br class="">
  </div>

_______________________________________________<br class="">erlang-questions mailing list<br class=""><a href="mailto:erlang-questions@erlang.org" class="">erlang-questions@erlang.org</a><br class="">http://erlang.org/mailman/listinfo/erlang-questions<br class=""></div></blockquote></div><br class=""></div></body></html>