[erlang-questions] How to return all records in dets
Anthony Ramine
n.oxyde@REDACTED
Mon Jun 2 10:10:21 CEST 2014
This, that’s all we need.
And there is no need for a separate commit policy, make a pull request and members of the community will review it if they want.
There is no need for a trimmed-down version of the manual either, anyone is free to add to their favourite module’s documentation a summary of the provided features and what the most common use cases are, with code examples.
Regards,
--
Anthony Ramine
Le 1 juin 2014 à 20:00, Garrett Smith <g@REDACTED> a écrit :
> Given the effort of installing a commenting facility, not to mention
> the gamble that anyone will find this useful, why not submit a pull
> request for the applicable doc page?
>
> I haven't done this, so maybe installing a commenting facility *is* easier.
>
> But it seems like one could write a sentence or two to clarify how a
> module might be used. And add an example or two on how a function
> might be used. This strike me as being a pretty direct solution to the
> problem you're raising.
>
> Ease of making these changes and then getting them integrated is of
> course the big question. If it's a substantial barrier, lowering that
> friction is something probably worth investing in.
>
> As to moderation, if the docs were under a separate commit policy
> (separate repo?) members of the community could pitch in directly,
> saving the OTP time some hassle.
>
> On Sun, Jun 1, 2014 at 12:18 PM, <lloyd@REDACTED> wrote:
>> Hi Loïc,
>>
>> Seems to me that there are four issues here:
>>
>> - Who are the Erlang docs (man pages and/other authoritative guides) intended to serve?
>>
>> As a not-so-noobie-but-still-vastly-ignorant Erlang aspirant, I can say that current man pages, while helpful to a degree, leave much to be desired.
>>
>> - How can Erlang docs provide greater clarity to intended audiences?
>>
>> From my point-of-view they could provide more examples, say three or four across a range of simplest possible application of the function to a golly-gee-wiz-this-function-can-do-this example
>>
>> Don't forget to note why and where this module/function is useful.
>>
>> Great gains would be come, in my view, by backing up man pages with authoritative noobie-friendly tutorials. By authoritative I mean dated, 100% functional, expressing best practices
>>
>> Loïc, ask me, you have been doing a great job in this regard with Cowboy.
>>
>> - From a technical point-of-view, how can Erlang docs be maintained most conveniently
>>
>> I can't speak to this other than harness the power of the language. I do think there needs to be three tracks: a template or policy statement for consistent, quality docs, man pages, and tutorials
>>
>> - From a community point of view, who does all this?
>>
>> This is the 64-dollar-question that every volunteer organization faces.
>>
>> Part of the problem of mobilizing a volunteer community is cultivating community spirit. That comes down to determining how everyone stands to gain by participating. I think we all know this. But it may require frequent reminders.
>>
>> It's also very important to serve the noobies well. I saw the vibrant forth community die out, in part, because it failed in this.
>>
>> I see Erlang as a humongous toolkit that includes a vast range including use-everyday tools to use-once-in-a-career exotic. So a good place to start is setting priorities and putting out calls of what needs to be done next. Keep the focus small and keep the pressure on. I have no doubt that the committed brilliant folks in the community will respond if they have a clear sense of direction. Who sets the direction? Whoever will step up.
>>
>> My two cents for what it's worth.
>>
>> Thanks to all,
>>
>> Lloyd
>>
>> -----Original Message-----
>> From: "Loïc Hoguin" <essen@REDACTED>
>> Sent: Sunday, June 1, 2014 10:04am
>> To: "Mark Nijhof" <mark.nijhof@REDACTED>, "Joe Armstrong" <erlang@REDACTED>
>> Cc: "Erlang Users' List" <erlang-questions@REDACTED>
>> Subject: Re: [erlang-questions] How to return all records in dets
>>
>> I'm all for comments, but I don't see how it would be at all usable
>> using disqus. Take this page for example:
>> http://www.erlang.org/doc/man/erlang.html
>>
>> Where do you put the comments? They're going to be unnoticed, and
>> they're going to cover a wealth of different topics so much that they'll
>> become entirely useless.
>>
>> Make one comment zone per function? Disqus is already painfully slow to
>> load when there's one, so imagine 50 or 100.
>>
>> Joe's solution is nice and tidy on the other hand. But there's one
>> problem though, who's going to moderate?
>>
>> There's no real quick way to that kind of stuff. At least not with this
>> amount of content.
>>
>> On 06/01/2014 11:38 AM, Mark Nijhof wrote:
>>> Just a thought on commenting, but adding a disqus comment section to
>>> each page might be a real quick way to enable that. Just add it to the
>>> templates you use for generating the html. Later it should also be
>>> rather easy to migrate them somewhere else if needed.
>>>
>>> -Mark
>>>
>>> On Jun 1, 2014 11:09 AM, "Joe Armstrong" <erlang@REDACTED
>>> <mailto:erlang@REDACTED>> wrote:
>>>
>>>
>>>
>>>
>>> On Sat, May 31, 2014 at 8:44 PM, <lloyd@REDACTED
>>> <mailto:lloyd@REDACTED>> wrote:
>>>
>>> Hi Joe,
>>>
>>> I've resorted to approach 0 many times and much appreciate the
>>> generous help I've received from the community. Indeed, response
>>> from the author of my Erlang bible is particularly awesome. I
>>> hope one day to be competent enough to play it forward.
>>>
>>> I also spend a great deal of time in the Erlang man pages.
>>> Problem is that I'm one of those soft-headed liberal arts types.
>>> So, I often find the man pages near incomprehensible (and not
>>> only Erlang). Yes, I perhaps should have taken more math classes
>>> to grasp the elegant concision. But my mind doesn't seem to be
>>> wired that way.
>>>
>>> I can't tell you how many times I've looked at the foldl/n docs
>>> and tried to understand what the hell is going on. I get the
>>> general drift, but can't bring it down to useful code. There's
>>> just too much inside-baseball.
>>>
>>> As a self-taught-from-books-and-web Erlang aspirant, I find
>>> concrete examples and well-written tutorials most helpful. This
>>> gives me leverage to apply your approach 3. In general, the
>>> concepts of Erlang are simple enough once I grasp them. In fact,
>>> I marvel at the pragmatic elegance. Your books provide
>>> particularly lucid explications. But the man pages? My how I
>>> wish I had the time and chops to write a parallel set for noobies.
>>>
>>> Indeed, would it be helpful if I walked through and commented on
>>> the man doc items that give me headaches?
>>>
>>>
>>> Absolutely - There is a problem here - which I think should be
>>> addressed as soon as
>>> possible - "It is not easy to common and ask question about man pages" -
>>> I'd really like to see commenting in the style of the real world
>>> Haskell book.
>>>
>>> If you're interested take a look at
>>> http://book.realworldhaskell.org/read/types-and-functions.html - in
>>> particular look at how comments are added to the text.
>>>
>>> The erlang man pages are generated from XML so a commenting system
>>> should be
>>> easy to make.
>>>
>>> I'd like to see questions about the man pages discussed "inside the
>>> man pages"
>>> if you see what I mean - not "outside the man pages" (ie here)
>>> ...
>>>
>>> Folds are very common there are the "iterators with an accumulator"
>>>
>>> In an imperative language you might say
>>> state = state0
>>> for(i in x){
>>> state = update(state, f(i))
>>> }
>>>
>>> In erlang this is a fold
>>>
>>> fold(F, State0, X)
>>>
>>> F is a function of I and State which returns a new state, and I iterates
>>> over the values in X
>>>
>>> so
>>>
>>> fold(fun(I, S) -> I + S end, 0, L)
>>>
>>> is the same as
>>>
>>> S = 0;
>>> for(I in L){
>>> S = S + I
>>> }
>>>
>>> This is a very common programming pattern
>>>
>>> Cheers
>>>
>>> /Joe
>>>
>>>
>>>
>>> Many thanks again for your kind help,
>>>
>>> Lloyd
>>>
>>> -----Original Message-----
>>> From: "Joe Armstrong" <erlang@REDACTED <mailto:erlang@REDACTED>>
>>> Sent: Saturday, May 31, 2014 1:53pm
>>> To: "Lloyd Prentice" <lloyd@REDACTED
>>> <mailto:lloyd@REDACTED>>
>>> Cc: "Erlang-Questions Questions" <erlang-questions@REDACTED
>>> <mailto:erlang-questions@REDACTED>>
>>> Subject: Re: [erlang-questions] How to return all records in dets
>>>
>>> The thing to Google for is "dets man erlang" - which should get
>>> you the man
>>> page
>>> (even better is to store the man pages locally and do "erl -man
>>> dets")
>>>
>>> You want to "list" all records (I'm not sure what list means
>>> here - it
>>> might mean
>>> "print" or "make a list of").
>>>
>>> To make a list of all records you could say:
>>>
>>> dets:foldl(fun(X, L) -> [X|L] end, [], Name)
>>>
>>> (Most collections - ie dets, ets, dict, etc. offer some kind of fold
>>> operation that
>>> traverses all objects in the collection)
>>>
>>> To print all records
>>>
>>> dets:traverse(Name, fun(X) ->
>>> io:format("~p~n",[X]),
>>> continue
>>> end)
>>>
>>> No need to worry about match specifications.
>>>
>>> The best place to start is usually by reading the man pages.
>>>
>>> Now that Erlang is is becoming popular you'll find a lot of
>>> incorrect
>>> solutions to problems posted on stackoverlow.
>>>
>>> Best approach is
>>>
>>> 0) ask an expert
>>> 1) read the man pages for the module, in question
>>> 2) experiment with the functions in the man pages in the shell
>>> 3) ask/tell this list if the manual pages are ambiguous or
>>> incomprehensible
>>> 4) search Google/stackoverflow
>>>
>>> Cheers
>>>
>>> /Joe
>>>
>>>
>>>
>>> On Fri, May 30, 2014 at 9:56 PM, <lloyd@REDACTED
>>> <mailto:lloyd@REDACTED>> wrote:
>>>
>>>> Hello,
>>>>
>>>> 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.
>>>>
>>>> Can some kind soul give me a query that works?
>>>>
>>>> Many thanks,
>>>>
>>>> LRP
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> erlang-questions mailing list
>>>> erlang-questions@REDACTED <mailto:erlang-questions@REDACTED>
>>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> erlang-questions mailing list
>>> erlang-questions@REDACTED <mailto:erlang-questions@REDACTED>
>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>
>>>
>>>
>>> _______________________________________________
>>> erlang-questions mailing list
>>> erlang-questions@REDACTED
>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>
>>
>> --
>> Loïc Hoguin
>> http://ninenines.eu
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>>
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
More information about the erlang-questions
mailing list