Raul Miller wrote:
On 4/17/07, bill lam <[EMAIL PROTECTED]> wrote:
Raul Miller wrote:
> wderrok_z_=: 0 0 $ [: 11!:0 ::0:&> (0;wdstates;1(127})';"*'i.a.) ;: ]
>
> (Note: for pre-unicode J, replace 127 with 255).
127{a. for J601 (255{a. for J504) is also used as delimiter, does your
parser
handle them or not?
The code, as written, assumes J601.
If you need support for both versions, I'd use something like:
wddelim=: 127+128*'5'=1{9!:14''
wderrok_z_=: 0 0 $ [: 11!:0 ::0:&> (0;wdstates;1 wddelim}';"*'i.a.) ;: ]
Note, however, that I have not actually tested this on J504.
From efficiency point of view, I don't know if I'll buy it.
Decisions based on efficiency can only be valid when supported
by relevant measurements.
define
parse=: (0;wdstates;1(127})';"*'i.a.) ;: ]
DEL=: 127{a.
parse 'pc ',DEL,'"abc',DEL,';pn "123"'
+------------------+
|pc "abc;pn "123"|
+------------------+
this is incorrect because it should be parsed as two commands.
I'm not skeptical on your parser, but the in-efficiency from repeated calling wd
rather than calling once only.
--
regards,
bill
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm