public ProgramState PopValues(int numberOfValuesToPop) { if (numberOfValuesToPop <= 0) { return(this); } var newStack = ImmutableStack.CreateRange( ExpressionStack.Skip(numberOfValuesToPop).Reverse()); return(new ProgramState( Values, Constraints, ProgramPointVisitCounts, newStack, Relationships)); }