I'd like to define:
anglearray(\A,\I,\L) = array(\A,Mod(\I,\L)) + 360*floor((\I+0.1)/\L);
but I get strange errors about "! Missing number, treated as zero." and the "array" part appears to evaluate to 0. Here is a fairly minimal example that shows a really dumb-looking work-around (that more or less loses any of the advantages of writing it as a function).
\documentclass{article}
\usepackage{tikz}
\begin{document}
\newcommand{\showB}[1]{\typeout{\string#1=\meaning#1}}.
\begin{tikzpicture}[
declare function={
anglearray1(\AI,\I,\L) = \AI + 360*floor((\I+0.1)/\L);
anglearray2(\A,\I,\L) = array(\A,Mod(\I,\L)) + 360*floor((\I+0.1)/\L);
}
]
% Spin around a circle stopping at 10 and 190 degrees
\foreach \i in {-10,...,10} {
\pgfmathsetmacro{\X}{anglearray1(array({10,190},Mod(\i,2)),\i,2)}
\showB\X
}
% Spin around a circle stopping at 10 and 190 degrees; doesn't work
\foreach \i in {-10,...,10} {
\pgfmathsetmacro{\X}{anglearray2({10,190},\i,2)}
\showB\X
}
\end{tikzpicture}
\end{document}
I'm using PGF 2.10 from TexLive 2011 of today.
