[comp.text.tex] need help with list macros

rom@xor.Eng.Sun.COM (Circuit Group) (12/30/90)

\toksdef\ta=0
\ta={{apple}\\{fruitroll}}

\def\lop#1\to#2{\expandafter\lopoff#1\lopoff#1#2}
\long\def\lopoff\\#1#2\lopoff#3#4{\def#4{#1}\def#3{#2}}

\def\delr#1{\edef#1{\expandafter\xy#1\xy}}
\long\def\xy\\#1#2{\ifx#2\xy\yz
  \else\noexpand\\{#1}\fi\xy#2}
\long\def\yz#1\xy\xy{\fi}

%\delr\ta
%\lop\ta\to\shorta \shorta

Ok, I give up! 
The above macros lop and delr come from the \TeX book,
pages 378--379.  I believe I have typed them in correctly --- they
don't work.  They should work, but if you uncomment them (one at a time) you'll
get some error messages about use of xxx doesn't
match it's definition.

What I would like is a macro that can take a token list and place
the left item into a control sequence and shorten the token list
by one token.  Can anyone help?



\end


-Ram
rom@xor.eng.sun.com
--
-Rom
rom@xor.sun.com