Chris Burke wrote:
> I suggest that we add two new definitions to the files script. One is
> Joey's verb to read a LF-terminated block from a file, the other is
> Oleg's adverb to apply a function to each line of a file.

There was typo in the second definition, which should be:

fapplylines=: 1 : 0
y=. 8 u: y    NB. for j601
s=. 1!:4 <y
if. s = _1 do. return. end.
p=. 0
while. p < s do.
  dat=. 1!:11 y;p,1e6<.s-p
  len=. 1 + dat i: LF
  p=. p + len
  if. len > #dat do.
    if. p > s do.
      dat=. dat, LF
    else.
      'file not in LF-delimited lines' 13!:8[3
    end.
  else.
    dat=. len {. dat
  end.
  u ;._2 dat -. CR
end.
)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to