tally: func [b [block!] /local c t v n] [
c: sort copy b
t: copy []
while [not tail? c] [
v: first c
n: 0
while [all [not tail? c v = first c]] [
n: n + 1
c: next c
]
append/only t reduce [v n]
]
t
]
Now you can analyze all your data, look the example:
>> tally [$4 22 $4 $4 22 12:30 "hello" 12:30 ]
== [[22 2] [$4.00 3] [12:30 2] ["hello" 1]]
tally function returns you a block with the data and how many occurrences of that data in the series.
Nice one.
ReplyDelete