AllSameBy
AllSameBy[{e1,e2,…},f]
tests whether all the f[ei] are the same.
Examples
open allclose allProperties & Relations (1)
AllSameBy can be implemented by applying f to all elements and then checking whether the results are all the same:
The difference becomes apparent when there are side effects.
AllSameBy will cease evaluation if any variation in f[en] is found:
Whereas Map would evaluate on all elements prior to checking SameQ:
Text
Wolfram Research (2024), AllSameBy, Wolfram Language function, https://reference.wolfram.com/language/ref/AllSameBy.html.
CMS
Wolfram Language. 2024. "AllSameBy." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/AllSameBy.html.
APA
Wolfram Language. (2024). AllSameBy. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AllSameBy.html