Comments on Are All Elements Equal?
Parent
Are All Elements Equal?
Challenge
Given a list of integers >= 0 , check if all of them are equal.
Tests
[1,1,1,1,1] -> true
[0,1,1,6,7] -> false
[1] -> true
[] -> undefined(you do not need to handle this)
You may take the integers in any form(strings, list, codepoints, etc.)
You can output two distinct values for true or false, or simply a truthy or falsy value in your language.
Trivial builtins are allowed, but it is encouraged to edit them into the trivial builtins answer, or try a different approach.
Zsh, 8 bytes >$@ <^$ …
3y ago
Japt, 3 bytes e¡g Tr …
3y ago
[APL (Dyalog Unicode)], 3 byte …
3y ago
Rockstar, 76 bytes Takes in …
3y ago
[Python 3], 20 bytes …
3y ago
[Haskell], 16 bytes …
3y ago
[C (gcc)], 46 bytes …
3y ago
[Ruby], 15 bytes ```ruby - …
3y ago
[brainfuck], 40 bytes Outpu …
3y ago
JavaScript, 20 bytes Output …
3y ago
J, 4 bytes ``` -:|. ``` …
3y ago
Ruby, 14 bytes ```ruby ->{ …
3y ago
[Jelly], 1 byte E Tr …
3y ago
Trivial answers [Husk], 1 b …
3y ago
J, 5 char ``` 2>#. ``` …
2y ago
MATL, 4 bytes ``` tPX= ``` …
2y ago
Post
J, 4 bytes
-:|.
Checks if the input array matches itself reversed. This is a tacit form and is executed monadically as x f (g x)
.
2 comment threads