apply lambda in finding line functions