Text processing/1: Difference between revisions
Content added Content deleted
(→Process file in chunks: add commentary) |
(→Common utilities: formatting) |
||
Line 517: | Line 517: | ||
<lang j> |
<lang j> |
||
require 'files' NB. for fread/freadblock/fapplylines |
require 'files' NB. for fread/freadblock/fapplylines |
||
NB. Utility verbs |
NB. Utility verbs |
||
mean=: +/ % # |
mean=: +/ % # |
||
summarize=: # , +/ , mean NB. count , sum , mean |
summarize=: # , +/ , mean NB. count , sum , mean |
||
filter=: #~ 0&< NB. keep left arg where 0 < right arg |
filter=: #~ 0&< NB. keep left arg where 0 < right arg |
||
NB. |
NB. Find longest run(s) of successive invalid measurements and return |
||
NB. length and date of last measurement(s) in run(s) |
|||
NB. Takes matrix of flags as right argument |
|||
findLongestRuns=: 3 : 0 |
findLongestRuns=: 3 : 0 |
||
badflags=. , 0 >: y |
badflags=. , 0 >: y |
||
Line 552: | Line 554: | ||
) |
) |
||
</lang> |
</lang> |
||
=== Process whole file at once === |
=== Process whole file at once === |