[REBOL] Re: help List with block and occurrence
From: greggirwin:mindspring at: 22-Jan-2004 10:50
Hi Philippe,
llff> datas in block looks like :
llff> user1 01-01-2004 08:07 test1
llff> ...
llff> I want to get after my loop result (block ? array ??) by day,
llff> and classified by unique names and number of occurrence with
llff> them like :
llff> 01-01-2004 [ user1 3 user2 1]
llff> 02-02-2004 [ user1 1 user2 1 user3 1]
Something like this?
tally: func [data /local result pos] [
result: copy []
emit: func [date name] [
if not find/skip result date 2 [
repend result [date copy reduce [name 0]]
]
either pos: find/skip result/:date name 2 [
change next pos add 1 result/:date/:name
][
repend result/:date [name 1]
]
]
foreach [name date time note] data [emit date name]
result
]
-- Gregg