implement getVals
getPattern function
implement generic getPattern
try to generalize to numVars === 1
fix one var case
working for 1 and for 2 vars