P.S. (/: norm S:0) or (/: norm&>) might be nicer, but for such a small data set I would not be concerned about efficiency.
Thanks again, -- Raul On Sat, Dec 21, 2013 at 9:51 AM, Raul Miller <[email protected]> wrote: > It looks to me like you are relying on the files to be already sorted > in the result from this line: > > fn =. {. |: 1!:0 jpath dir,pfx,'*',sfx > > If you want them sorted numerically, wouldn't we want to sort them? > > Here's some example "unsorted" data: > > pfx=: 'page ' > sfx=: '.png' > fns =: |. pfx,L:0 (":&.> 1+i.18),L:0 sfx > > And here's an example of how we might sort them in numerical order: > > norm=: 0 ". (#pfx) }. (-#sfx) }. ] > (/: norm L:0) fns > > Note that this particular sort implementation will group any > "non-numeric" files at the 0 position. > > Thanks, > > -- > Raul > > > > On Sat, Dec 21, 2013 at 9:26 AM, Brian Schott <[email protected]> wrote: >> Dan, I've run into another small problem when the number of pages extends >> to 2 digit numbers in the file names. The problem seems to be that >> somewhere sorting on filename is putting all the original filenames >> beginning with alphabetic 1's and 10`s before the 2, 3, 4, ... . >> >> Below is an example. I need to run out for a while, but will be looking for >> a fix when I return. Thanks. >> >> >> 'page png' flipOddPages '...' >> ---------+-----------+ >> |page 1.png |page 18.png| >> +-----------+-----------+ >> |page 10.png|page 7.png | >> +-----------+-----------+ >> |page 11.png|page 8.png | >> +-----------+-----------+ >> |page 12.png|page 5.png | >> +-----------+-----------+ >> |page 13.png|page 6.png | >> +-----------+-----------+ >> |page 14.png|page 3.png | >> +-----------+-----------+ >> |page 15.png|page 4.png | >> +-----------+-----------+ >> |page 16.png|page 1.png | >> +-----------+-----------+ >> |page 17.png|page 2.png | >> +-----------+-----------+ >> |page 18.png|page 1.png | >> +-----------+-----------+ >> |page 2.png |page 15.png| >> +-----------+-----------+ >> |page 3.png |page 16.png| >> +-----------+-----------+ >> |page 4.png |page 13.png| >> +-----------+-----------+ >> |page 5.png |page 14.png| >> +-----------+-----------+ >> |page 6.png |page 11.png| >> +-----------+-----------+ >> |page 7.png |page 12.png| >> +-----------+-----------+ >> |page 8.png |page 9.png | >> +-----------+-----------+ >> |page 9.png |page 10.png| >> +-----------+-----------+ >> |page.png |page 17.png| >> +-----------+-----------+ >> >> -- >> >> (B=) >> ---------------------------------------------------------------------- >> For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
