[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] Check whether the elements of a list are all true



On Tue, Dec 24, 2019 at 7:59 PM <alberto.decampo@xxxxxxxxx> wrote:
> [true, true, false].every(_ == true)
> [true, true, false].any(_ == false)

If the elements are all Boolean, then:

[true, true, false].every
[true, true, false].any(_.not)

(But of course you have to be sure they are all Boolean -- which is
why, in some places in my extensions, I write `someFlag == true` to
allow nil to act as "false." `== true` is safer.)

hjh

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/