[erlang-questions] Help for a newbie...
Tue May 14 10:47:33 CEST 2013
Thanks for your reply. I'm posting this back to the list as I think
some of the answers can be useful to others.
On Tue, 14 May, 2013 at 2:29 AM, Richard A. O'Keefe <ok@REDACTED>
> On 12/05/2013, at 2:22 AM, Bruno Girin wrote:
>> Another question from a newbie based on your code above. In this
>> [Time,_|Dishes] = string:tokens(User_Entry, ","),
>> The way I understand it, Time will point to the first token,
> s/point to/be/
Ah yes, I'm used to object oriented languages where everything is
always a point to the actual object :-)
>> the second will be dropped (as it maps to _) and Dishes will be the
>> rest of the list. Am I correct?
>> If yes, did you include _ to reflect the original code where
>> lists:nthtail(AllTokens, 2) would have resulted in Dishes starting
>> at the 3rd token effectively ignoring the 2nd token?
Good, I'm glad I understand something about Erlang then!
>> I'm not sure that's what was intended based on the description.
> You may well be right.
>> Also, would it be sensible to add space as a separator to avoid
>> having them included in tokens?
> Dunno. Ask the original poster. The whole thing looked a bit
> so it's not clear that at this stage there _is_ a right answer.
True, I was trying to guess the OP's intent which is never a good thing
to do with code.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions