Can anyone please tell me what I did wrong?? I cann't get the second number of tests to work correctly (and the command appears to be the same argument as done manually)
\magnification\magstep1
\hsize 5.5 true in
\hoffset 0.5 true in
\vsize 8.25 true in
\voffset = 2\baselineskip
\vbadness11000
\parskip\smallskipamount \tolerance1000
\font\narbold=cmb10 %% Bold non-extended
\font\titlefont=cmbx10 scaled \magstep3 %% For heading
\font\smc=cmcsc10 %% For running head
\parindent=0pt
\centerline{\titlefont What is wrong with this implementation}
\nobreak\bigskip\hrule\bigskip
\global\newcount\containsnum%
\global\containsnum=0 % 1 they contain that number
% 0 they don't contain that number
\def\dead#1xxx,{}%
\def\endpiece{xxx}%
%based on the following code
%TeX by Topic unknown number of arguments p105
%\White(K1a,Q2b,3c,P4d)%
\def\xContains#1,{\def\temp{#1}%
\ifx\temp\endpiece% no more to process
\else
\ifx\temp\tosearch
\global\containsnum=1%
\let\xxContains=\dead
% we no longer need the rest of the row it has been found
\else
\fi%
\expandafter\xxContains%
\fi}%
\def\Contains(#1)#2{\let\xxContains=\xContains\global\containsnum=0%\foundfalse
\def\tosearch{#2}\expandafter\xxContains#1,xxx,}%
This is a list of test for contains where the row (4,5,6,7,9,10,11) is input manually
as an argument (this works correctly)
\Contains(4,5,6,7,9,10,11){1}
1 is \ifodd\containsnum \else NOT \fi found
\Contains(4,5,6,7,9,10,11){2}
2 is \ifodd\containsnum \else NOT \fi found
\Contains(4,5,6,7,9,10,11){5}
5 is \ifodd\containsnum \else NOT \fi found
\Contains(4,5,6,7,9,10,11){11}
11 is \ifodd\containsnum \else NOT \fi found
\Contains(4,5,6,7,9,10,11){15}
15 is \ifodd\containsnum \else NOT \fi found
\def\listtypeno{1}
\expandafter\def\csname giveAttToFile\listtypeno\endcsname{4,5,6,7,9,10,11}
\def\testrow{(\expandafter\csname giveAttToFile\listtypeno\endcsname)}
This is a list of test for contains where the row is input from a command \testrow
and for some reason this doesn't work correctly?? why??
\expandafter\Contains\testrow{1}
1 is \ifodd\containsnum \else NOT \fi found
\expandafter\Contains\testrow{2}
2 is \ifodd\containsnum \else NOT \fi found
\expandafter\Contains\testrow{5}
5 is \ifodd\containsnum \else NOT \fi found
\expandafter\Contains\testrow{11}
11 is \ifodd\containsnum \else NOT \fi found
\expandafter\Contains\testrow{15}
15 is \ifodd\containsnum \else NOT \fi found
\bye
(\expandafter\csname
the\expandafter
does nothing, instead you need two expansion steps to reach the list.