update foldl example with ternary