scala - Applying logical and to list of boolean values -
consider following list of boolean values in scala
list(true, false, false, true)
how using either foldright or foldleft emulate function of performing logical , on of values within list?
val l = list(true, false, false, true) val andall = l.foldleft(true)(_ && _)
Comments
Post a Comment