Use Map to apply the inner tokenizer to every element of the list returned
by the first tokenizer.  In other words,

Result={Map {String.tokens Input &\n} ParseLine}

where the function ParseLine tokenizes the line using character &, and makes
a tuple with the result.  It can be defined as

fun {ParseLine L}
   {List.toTuple line {String.tokens L &,}}
end

Cheers,
raph

On Fri, Aug 29, 2008 at 9:32 AM, mark richardson <[EMAIL PROTECTED]>wrote:

> Hi,
>
> Again, I should have been more specific.
> I know I need to use String.tokens, what I can't 'get my head around' is
> how to nest the two successfully in one operation.
> Ie.
> Can they be nested in a {String.tokens {String.tokens &,} &\n} manner or if
> not, how else would I do it.
> I'm still not entirely comfortable with things like using procedures with
> nesting markers in {List.forAll} functions.
>
> Regards
> Mark
>
>
> Torsten Anders wrote:
>
>> Dear Mark
>>
>> You already pointed out the tool you could use yourself. You can use
>> String.tokens for splitting a string (a list of chars) at each new line, and
>> likewise you can split the resulting sublists at every comma (&,).
>>
>> BTW: for more complex parsers you may consider using Gump.
>>
>> Best
>> Torsten
>>
>> --
>> Torsten Anders
>> Interdisciplinary Centre for Computer Music Research
>> University of Plymouth
>> http://strasheela.sourceforge.net
>> http://www.torsten-anders.de
>> ________________________________________
>> From: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf
>> Of mark richardson [EMAIL PROTECTED]
>> Sent: 28 August 2008 21:48
>> To: Mozart users
>> Subject: List processing
>>
>> Hi,
>>
>> I wonder if anyone can help.
>>
>> I have a program that reads in a csv( comma separated values)
>> spreadsheet file into a list named Temp.
>> I can tokenise the list using
>>   Temp2={String.tokens Temp &\n}
>> which gives me a list of lists where each sublist represents each line
>> of the spreadsheet.
>>
>> What is the easy way at this point to further tokenise Temp2 using &, as
>> a seperator to give me further sublists which represent each column data?
>>
>> I actually want to end up with a record structure holding all this, so
>> that feature one is line one which is a record with n-features
>> representing each cells data on that line.
>> I know this should be really straightforward but I just can't get my
>> head round it successfully!
>>
>> Any help as always is gratefully received.
>>
>> Regards
>>
>> Mark Richardson
>>
>> --
>> Mark Richardson
>> Final year undergraduate
>> University of Teesside
>>
>>
>> _________________________________________________________________________________
>> mozart-users mailing list
>> [email protected]
>> http://www.mozart-oz.org/mailman/listinfo/mozart-users
>>
>> _________________________________________________________________________________
>> mozart-users mailing list
>> [email protected]
>> http://www.mozart-oz.org/mailman/listinfo/mozart-users
>>
>>
>>
>
>
> --
> Mark Richardson
> Final year undergraduate
> University of Teesside
>
> _________________________________________________________________________________
> mozart-users mailing list
> [email protected]
> http://www.mozart-oz.org/mailman/listinfo/mozart-users
>
_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to