<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Rick Pettit schreef op 29-1-2015 om
20:16:<br>
</div>
<blockquote
cite="mid:55690AB8-242D-4061-BC51-97846B0E76DB@vailsys.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
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 moz-do-not-send="true"
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 moz-do-not-send="true"
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 moz-do-not-send="true"
class="moz-txt-link-abbreviated"
href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a>
<br class="">
<a moz-do-not-send="true"
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>
</div>
</div>
</blockquote>
<br>
Because of this output : <br>
<br>
<div data-row="1" class="terminal-row">10> c(db). </div>
<div data-row="2" class="terminal-row">db.erl:8: Warning: variable 'Db' is unused </div>
<div data-row="3" class="terminal-row">{ok,db} </div>
<div data-row="4" class="terminal-row">11> Db1 = db:new(). </div>
<div data-row="5" class="terminal-row">[] </div>
<div data-row="6" class="terminal-row">12> Db2 = db:destroy(Db1). </div>
** exception error: no match of right hand side value ok <br>
<br>
When I do this : <br>
<br>
-module(db).<br>
<br>
-export([new/0, destroy/1, write/3]).<br>
<br>
new() -><br>
[].<br>
<br>
destroy(Db) -><br>
ok.<br>
<br>
write(Key, Element, Db) -><br>
[ {Key, Element} | Db ]. <br>
<br>
Roelof<br>
<br>
<br>
<br>
</body>
</html>