Hi, Mat,

You're almost there!  Here's a complete example (using a string for
the original raw data)...

rawdata: {
Saloon:Red
Coupe:Red
Coupe:Yellow
Pickup Truck:Red
Pickup Truck:Yellow
Pickup Truck:Orange
Pickup Truck:Blue
}

finaldata: []

foreach line parse/all rawdata "^/" [
    if parse/all line [
        copy type to ":" skip copy color to end
    ][
        either colors: select finaldata type [
            if none? find colors color [
                append colors color
            ]
        ][
            append finaldata reduce [
                type reduce [color]
            ]
        ]
    ]
]

foreach [type colorlist] finaldata [
    print [type ":" tab colorlist]
]


Mat Bettinson wrote:

> 
> CarLines: read/lines %file
> 
> foreach CarLine CarLines [
>   Car: pick (parse CarLine none) 1
>   Colour: pick (parse CarLine none) 2
>   ;
>   ; ???
>   ;
>   ]
> 

... or, more simply...

    foreach carline read/lines %file [
    ;...
    ]

since you can use the block of lines directly in FOREACH.

>
>   ;
>   ; But how do we poke it back? We don't have a position to do a poke?
>   ;

You don't.  Blocks are mutable values, so when you APPEND to a block
you are modifying its content -- even if it happens to live inside
another block.

Hope this helps!

-jn-
-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to