<div dir="ltr">The thing to Google for is "dets man erlang" - which should get you the man page<div>(even better is to store the man pages locally and do "erl -man dets")</div><div><br></div><div>You want to "list" all records (I'm not sure what list means here - it might mean</div>
<div>"print" or "make a list of").</div><div><br></div><div>To make a list of all records you could say:</div><div><br></div><div> dets:foldl(fun(X, L) -> [X|L] end, [], Name)</div><div><br></div>
<div>(Most collections - ie dets, ets, dict, etc. offer some kind of fold operation that</div><div>traverses all objects in the collection)</div><div><br></div><div>To print all records</div><div><br></div><div> dets:traverse(Name, fun(X) -></div>
<div> io:format("~p~n",[X]),</div><div> continue</div><div> end)</div><div><br></div><div>No need to worry about match specifications.</div>
<div><br></div><div>The best place to start is usually by reading the man pages.</div><div><br></div><div>Now that Erlang is is becoming popular you'll find a lot of incorrect solutions to problems posted on stackoverlow.</div>
<div><br></div><div>Best approach is</div><div> </div><div> 0) ask an expert</div><div> 1) read the man pages for the module, in question</div><div> 2) experiment with the functions in the man pages in the shell</div>
<div> 3) ask/tell this list if the manual pages are ambiguous or incomprehensible</div><div> 4) search Google/stackoverflow</div><div><br></div><div>Cheers</div><div><br></div><div>/Joe</div><div><br></div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Fri, May 30, 2014 at 9:56 PM, <span dir="ltr"><<a href="mailto:lloyd@writersglen.com" target="_blank">lloyd@writersglen.com</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'm cross-eyed from looking at match specifications. All I want to do is list all records in my small dets table. I once ran across a very neat query to accomplish that, but for the life can't Google it up.<br>
<br>
Can some kind soul give me a query that works?<br>
<br>
Many thanks,<br>
<br>
LRP<br>
<br>
<br>
<br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div><br></div>