[Jprogramming] Bug/Inconsistency among namelist verbs from z locale
Raul Miller
rauldmiller at gmail.com
Mon Sep 26 23:12:31 HKT 2011
On Mon, Sep 26, 2011 at 10:50 AM, The Geeko <theGeeko61 at gmail.com> wrote:
> Marshall Lochbaum <mwlochbaum <at> gmail.com> writes:
>> Step 1 is a problem. You never want to define global variables x and y . In
>> fact, if you inspect the code for nl, you will find the line
>
> You are right about the line... as I have confirmed. But my point is that this
> is a flaw in the implementation of nl. For a more thorough discussion, see my
> earlier reply regarding the inconsistency issue.
Which part?
> If nl is simply going to treat 'x' and 'y' special (in an ad-hoc fashion)...
> then, for consistency, let's also treat 'm', 'n', 'u' and 'v' special. All 6 of
> these are used within definitions -- but *not* reserved by the language
> specification (as best as I can discern what that is).
But x and y are "more special" than m, n, u and v.
m=:n=:u=:v=:x=:y=: 0
F=:4 :'m,n'
G=:4 :'u,v'
H=:4 :'x,y'
'a'F'b'
0 0
'a'G'b'
0 0
'a'H'b'
ab
> At the very least, correct the issue with namelist, which currently (and
> correctly so, imho) reports 'x' and 'y' thereby creating the "GOTCHA!"
> experienced with nl and names.
If you wanted, you could define:
nl_z_=: 4!:1@(] -. -.~)&(i.4)
Note, however, that this would deprive you of the left argument for names.
For example other words, currently:
'~wd' names_z_''
gives you all the z locale names which do not contain wd and
'*wd' names_z_''
gives you all the z locale name which do contain wd and
'wd' names_z_''
gives you all the z locale names which begin with wd. But with the
definition for nl which I have proposed here all of them would give a
domain error.
Meanwhile, changing the definition of nl_z_ does not eliminate the
GOTCHAs -- it changes them, but does not eliminate them.
--
Raul
More information about the Programming
mailing list