I can't quite figure it out. I'd like to be able to process the entries in a table, but > and < aren't (quite) acting as I expect them to. Here's a repro:
\documentclass{article}
\usepackage{array}
\newcolumntype{Z}{>{\foo}c<{\bar}}
\def\foo#1\bar{foo #1 bar}
\begin{document}
\begin{tabular}{ZZZZ}
A & B & C & D \\
E & F & G & H
\end{tabular}
\end{document}
When I run this through xelatex I get the following output:
$ xelatex repro
This is XeTeX, Version 3.14159265-2.6-0.99998 (TeX Live 2017/MacPorts 2017_0) (preloaded format=xelatex)
restricted \write18 enabled.
entering extended mode
(./repro.tex
LaTeX2e <2017-04-15>
Babel <3.10> and hyphenation patterns for 5 language(s) loaded.
(/opt/local/share/texmf-texlive/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/opt/local/share/texmf-texlive/tex/latex/base/size10.clo))
(/opt/local/share/texmf-texlive/tex/latex/tools/array.sty) (./repro.aux)
! Misplaced \cr.
\reserved@c ->\ifnum 0=`{}\fi \cr
l.8 E &
F & G & H
?
Oddly, it works as I expect if I use {ZZcc} as the preamble, but that must surely be only lucky. How do I use > and < column specifiers to process table entries?

collcell(mentioned in the answers to that question) looks like it will help! – ruds Jul 31 '17 at 19:46collcellis a great package for this kind of thing. It's not needed for simple things, but for more complicated processing of the cell it makes life a lot easier. – Alan Munn Jul 31 '17 at 19:48