I am searching for a way to conditionally handle some items in a TikZ \foreach specially using an \ifthenelse condition. However, the compiler responds
! Undefined control sequence.
<argument> \isin
when processing this document.
\documentclass{standalone}
\usepackage{tikz, xifthen}
\newcommand\groupedges[2]{
\begin{tikzpicture}
\foreach \name/\position in {a/30, b/40, c/20}
\node (\name) at (\position:5cm) {\name};
\foreach \name/\position in {d/120, e/150, f/170, g/90, h/100}
\node (\name) at (\position:5cm) {\name};
\node (left) at (-1, 0) {left};
\node (right) at (1, 0) {right};
\foreach \name in {#1}
\path (\ifthenelse{\isin{\name}{#2}}{right}{left}) edge (\name);
\end{tikzpicture}
}
\begin{document}
\groupedges{a,b,d,e,g,h}{abc}
\end{document}
I initially thought of expressing the conditional with pgfkeys, but found this to be too cumbersome, especially when used in a \newcommand, which I need for the more complex intended case this serves as an example for.
I also tried to implement it using pure TeX, which has an \ifin@ conditional. This results in the same error.
Are TikZ and ifthen (or xifthen) combinable? Is there an easy pgfkeys or pure TeX solution? Or may there even be more suggestions to implement decisions on the \foreach elements?

