Like PolGab wrote in his comment, you have some possibilities to use an array with pgfmath. Here some examples from the pgfmanual :
\def\myarray{{7,-3,4,-9,11}}
\pgfmathparse{\myarray[3]} \pgfmathresult
\def\print#1{\pgfmathparse{#1}\pgfmathresult}
\def\identitymatrix{{{1,0,0},{0,1,0},{0,0,1}}}
\tikz[x=0.5cm,y=0.5cm]\foreach \i in {0,1,2} \foreach \j in {0,1,2}
\node at (\j,-\i) [anchor=base] {\print{\identitymatrix[\i][\j]}};
\pgfmathparse{array({9,13,17,21},2)} \pgfmathresult
Bad news : len
of an array does not exist in pgfmath. It's not very complex to add this possibility to pgfmath. Here a simple way without a new package. It's not very efficient but it's simple.
\documentclass[11pt]{scrartcl}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\def\getlen#1{%
\pgfmathsetmacro{\lenarray}{0}%
\foreach \i in #1{%
\pgfmathtruncatemacro{\lenarray}{\lenarray+1}%
\global\let\lenarray\lenarray}%
}
\begin{tikzpicture}
\node[draw,minimum width=2cm,minimum height=5cm,fill=blue!30,opacity=.5 ] (rec) at (2cm,1cm) {REC};
\def\mar{1,2}
\getlen{\mar}
\path let \p1=($(rec.west)-(rec.east)$),
\p2=($(rec.north)-(rec.south)$),
\n1 = {veclen(\p1)*0.16},
\n2 = {veclen(\p2)/\lenarray}
in node[draw,minimum width = \n1,
minimum height = \n2,
anchor=north west,fill=orange!30,opacity=.5
] at (rec.north west) {foobar};
\end{tikzpicture}
\end{document}

\p3
needs to be ap
oint but you are assigning a number. Also as far as I know there is no array counter yet (Maybe in the CVS version). What exactly do you want to do with\p3
? – percusse Aug 6 '12 at 22:37\mar
is a simple list. An array should be defined by\def{{1,2}}
(p.529, section 63.1, pgfmanual v2.10). – Paul Gaborit Aug 7 '12 at 8:11