[erlang-questions] Help for a newbie...

Bruno Girin brunogirin@REDACTED
Tue May 14 10:47:33 CEST 2013


Hi Richard,

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> 
wrote:
> 
> On 12/05/2013, at 2:22 AM, Bruno Girin wrote:
> 
>>  Another question from a newbie based on your code above. In this 
>> line:
>>  
>>  [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?
>> 
> Yes.
>>  
>>  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?
>> 
> Yes.
> 

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 
> unfinished,
> 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.

Bruno


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130514/c5a53687/attachment.htm>


More information about the erlang-questions mailing list