--Sherlock, Ric wrote:
> However I think it has a logic bug.
> As currently defined ftype will not handle the case where a
> non-existing directory path ending with a path separator is given.
A more elegant potential solution?
ftype1=: 3 : 0
d=. (}:^:(PATHSEP_j_={:)) ucp y
d=. 1!:0 fboxname d
if. #d do.
>: 'd' = 4 { > 4 { ,d
else.
0
end.
)
The original ftype doesn't use "ucp y" the first time it does calls 1!:0
. I'm not sure if this was intentional, but I can't think why it would
be a problem?
ftype1 (jpath '~system')
2
ftype1 (jpath '~system'),PATHSEP_j_
2
ftype1 (jpath '~system/notexist')
0
ftype1 (jpath '~system/notexist'),PATHSEP_j_
0
ftype1 (jpath '~system/main/trig.ijs')
1
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm