capture x param from enclosing function only once per 'lines'