I'm looking for a verb to flatten every J data to a single character string,
with the same display.
I've found that the verb flatten (defined in format.ijs) does not work
properly with some arguments (when rank of y is >2); example:

   load 'format'
   ]myarr=: ,:('Hello',LF,'World'),:'bye'
Hello
World
bye        
   flatten myarr
Hello World
bye

I think this happens because there is a boxing inside the verb, where LF is
lost.
My current solution (to be improved and tested) is:

myflatten=: 3 : 0
r=. _1
y=. ,&LF"1 ": y
while. 2 < # $ y do.
  r=. <:r
  y=. (,&LF)@,"2 y
end.
r }. ,y
)

-- 
View this message in context: 
http://old.nabble.com/flatten-data-to-a-string-tp28179263s24193p28179263.html
Sent from the J Programming mailing list archive at Nabble.com.

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to