WLJS LogoWLJS Notebook

AllSameBy

AllSameBy[{e1, e2, ...}, f] tests whether all the f[ei] are the same.

AllSameBy[f] represents an operator form of AllSameBy that can be applied to an expression.

Examples

Test if all elements have the same length:

AllSameBy[{"aa", "bb", "cc"}, StringLength]
(* True *)

Check if all numbers have the same sign:

AllSameBy[{1, 2, 3}, Sign]
(* True *)

Please visit the official Wolfram Language Reference for more details.

On this page