I'd like to make a command \exactseq such that, for example,
\exactseq{A,f,B,g,C}
corresponds to
\xymatrix{A \ar[r]^{f} & B \ar[r]^{g} & C}
and such that this works for inputs of arbitrary length, not just for some fixed length. To be precise, I want to input a list and have the nth element of the list made into an entry in an xymatrix when n is odd, and to be an arrow when n is even.
Edit: As Werner asks about below, I'd usually have entries and arrows that are more than one character long, and may not be plain text, e.g. \Omega, or f_{i}, or \mathbb{Z}. The simpler example given above was just for illustration purposes.
I've been trying to accomplish this using the etoolbox package's list commands; as an initial attempt (without even defining \exactseq), I tried
\documentclass[11pt]{article}
\usepackage{amsmath,amssymb,amsthm,amsfonts}
\usepackage{etoolbox}
\usepackage[all]{xy}
\begin{document}
\newcounter{obfun}
\setcounter{obfun}{0}
\renewcommand*{\do}[1]{\ifnumodd{\value{obfun}}{\ar[r]^{#1} &}{#1}\stepcounter{obfun}}
\[\xymatrix{\docsvlist{A,f,B,g,C}}\]
\end{document}
but this produced a massive collection of errors, mostly relating to missing or misplaced \cr's (I'm afraid I don't understand what that means). I tried putting \expandafter before \xymatrix, but that didn't help.
How can I create a command to make writing exact sequences more automated? Of course, it doesn't have to use etoolbox, or xy for that matter.
Edit: egreg's answer does work, but I'm not familiar with all of these new commands introduced by expl3 so I don't really understand how it works, and I wouldn't know how to go about modifying it if I wanted to later. Thus, I'd like to request a "lower-tech" solution (perhaps using packages that are more common or "basic" in some sense), or just other solutions if you see any. If there don't seem to be any others, I'll accept egreg's answer.
Perhaps there's a way using this TikZ code that could also work for more general arrays of objects and arrows?

obfunfunction is supposed to do? – T. Verron Sep 22 '12 at 5:47obfunis just a counter to keep track of whether an element of the list of inputs is to be considered an ob ject or a fun ction. Every time the\docsvlistcommand processes an element of the list, it increments the counter, changing whether or not it's odd or even, which is what\ifnumoddtests for. – frustrated Sep 22 '12 at 5:57