Thanks, Bill, for your suggestions! However, I could get none of them
to work correctly.
I have simplified my select/case examples to the following two, a
numeric match and a literal match:
select6 =: 3 : 0 NB. seek numeric match
opID =: 6
select. opID
wdinfo 'val:'; opID
wdinfo 'shape:'; ($opID)
wdinfo 'datatype:'; (3!:0 opID)
case. 1;2;3 do.
wdinfo 'case 1,2,3'; opID
case. 4;5;6 do.
wdinfo 'case 4,5,6'; opID
case. do.
wdinfo 'no case match'; ''
end.
)
select6a =: 3 : 0 NB. seek literal match
opID =: '6'
select. opID
wdinfo 'val:'; opID
wdinfo 'shape:'; ($opID)
wdinfo 'datatype:'; (3!:0 opID)
case. '1';'2';'3' do.
wdinfo 'case 1,2,3'; opID
case. '4';'5';'6' do.
wdinfo 'case 4,5,6'; opID
case. do.
wdinfo 'no case match'; ''
end.
)
Invoking select6'' and select6a'' , neither of these two functions
seem to match correctly--they both report "no case match". What am I
missing about matching values in J?
By the way, in my original script the value of the first argument (the
one passed to a function containing select/case) was the literal value
'6' extended to 11 characters via fill (to match the other boxed
argument values). This means the literal value '6 ' (that's 6
followed by 10 spaces, in case it's mangled in email) is passed to my
original DoFileRead function. How does one "trim" all trailing (or,
for that matter, leading) spaces from text/literal values so that they
can be used for matching in select/case (and other) situations?
(Perhaps this "extended" literal caused some other problems in my
original matching attempt besides what I'm asking about above.)
Thanks to everyone for any insights, explanations, and guidance to
documentation!
Harvey
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm