| Bytes | Lang | Time | Link |
|---|---|---|---|
| 003 | BQN | 250416T185131Z | DLosc |
| 004 | Uiua | 231019T191545Z | chunes |
| 012 | Raku Perl 6 rakudo | 250416T145050Z | xrs |
| 021 | JavaScript nontrivial | 210421T022614Z | rydwolf |
| 140 | SAKO | 250416T042401Z | Acrimori |
| 045 | YASEPL | 240208T170552Z | madeforl |
| 075 | TSQL | 240208T163433Z | Sam CD |
| 014 | Labyrinth | 240207T061306Z | Bubbler |
| 026 | sed | 231020T061254Z | Dillon D |
| 006 | Ly | 220509T062022Z | cnamejj |
| 013 | Headass | 231020T021457Z | thejonym |
| nan | 210421T014154Z | lyxal | |
| 015 | Arturo | 230104T164244Z | chunes |
| 003 | K ngn/k | 221004T141849Z | oeuf |
| 015 | Juby | 221008T025644Z | Jordan |
| 005 | K ngn/k | 220508T001513Z | oeuf |
| 028 | Nim | 221005T101308Z | Michael |
| 027 | dc | 221005T001835Z | manatwor |
| nan | Fig | 221004T013740Z | south |
| 024 | Desmos | 220507T184233Z | Aiden Ch |
| 018 | AWK | 210505T001408Z | Pedro Ma |
| 005 | TIBasic | 220508T204155Z | Youserna |
| 012 | Julia 1.0 | 210421T132655Z | MarcMush |
| 093 | Batch | 220508T212828Z | Youserna |
| 016 | Python | 220508T201813Z | loopy wa |
| 006 | J | 220508T192004Z | naffetS |
| 022 | Python 3 | 220508T153046Z | Sapherey |
| 025 | Mascarpone | 210628T010620Z | Soup Gir |
| 004 | Golfscript | 210526T103222Z | EsoJihun |
| 066 | Whitespace | 210527T065521Z | Kevin Cr |
| 008 | Zsh o extendedglob | 210421T124513Z | pxeger |
| 015 | R | 210421T015709Z | Giuseppe |
| 369 | MMIX | 210505T013641Z | NoLonger |
| 019 | Pari/GP | 210505T004423Z | Joe Slat |
| 004 | K oK | 210430T144650Z | mkst |
| 057 | CSASM v2.4.0.2 | 210426T041623Z | absolute |
| 006 | x8616 machine code | 210425T100752Z | user1032 |
| 002 | Husk | 210425T063625Z | Dominic |
| 005 | APL Dyalog Unicode | 210424T034121Z | Andrew O |
| 032 | C gcc | 210421T064921Z | AZTECCO |
| 017 | Ruby | 210422T010428Z | Sony San |
| 040 | brainfuck | 210421T232803Z | Hand-E-F |
| 013 | Perl 5 p | 210421T165236Z | Xcali |
| 018 | Racket | 210421T142901Z | MLavrent |
| 014 | Scala | 210421T130934Z | user |
| 018 | Excel | 210421T125053Z | Engineer |
| 007 | Retina 0.8.2 | 210421T101409Z | Neil |
| 005 | Charcoal | 210421T101229Z | Neil |
| 003 | Japt | 210421T085647Z | Shaggy |
| 014 | Ruby | 210421T074324Z | G B |
| 025 | Red | 210421T064958Z | Galen Iv |
| 016 | Haskell | 210421T063313Z | ovs |
| 006 | Raku | 210421T053050Z | Sean |
| 008 | Vim | 210421T052214Z | kops |
| 021 | JavaScript | 210421T051521Z | l4m2 |
| 017 | PowerShell | 210421T021829Z | wasif |
| 010 | V vim | 210421T035347Z | Razetime |
| 003 | Pip | 210421T025216Z | DLosc |
| 027 | Branch | 210421T021847Z | hyperneu |
| 002 | Pyth | 210421T021524Z | hakr14 |
| 002 | Jelly | 210421T021326Z | caird co |
| 018 | JavaScript Node.js | 210421T020634Z | hyperneu |
| 018 | Python 3 | 210421T015509Z | wasif |
| 002 | Arn 1.0 s | 210421T015421Z | ZippyMag |
| 002 | Jelly | 210421T014429Z | caird co |
| 007 | Proton | 210421T014518Z | hyperneu |
BQN, 3 bytes
⌈´⊐
Returns a truthy integer if the items are not all the same. Returns 0 (falsey) if the items are all the same. Try it at BQN online!
Explanation
The code actually returns the number of distinct items in the list, minus one:
⊐ Classify: associate each distinct item with a number starting at 0, and
replace each item in the list with its associated number
⌈´ Get the maximum
Alternate 3-byters
+´⊐ Classify and get the sum
∨´⊐ Classify and get the logical OR
∧≡∨ Sort ascending is identical to sort descending
⍋≡⍒ Grade up is identical to grade down
⍋≡⊒ Grade up is identical to occurrence count
JavaScript (non-trivial), 22 21 bytes
Thanks to @l4m2 for -1
d=>!d.some(x=>x-d[0])
This one's different from the new Set approach because it returns an actual truthy/falsy value. Although it's not as short (by just 4B, surprisingly), it's what you'd probably use if you needed this in real life, so it's definitely worth having here.
You could make it a byte shorter by removing the !, but then it returns false if all items are the same and true otherwise.
SAKO, 140 bytes
CALKOWITE:*N,I
BLOK(9):N
CZYTAJWIERSZ:N
I=-1
3)I=I+1
GDYN(I+1)=58:2,INACZEJ1
1)GDYN(I)=N(I+1):3,INACZEJ4
4)I=-1
2)DRUKUJ(0):I+1
STOP2
KONIEC
Input list as numbers without separators. Returns 0 for True and a positive number for False.
Takes input as a string thanks to consistent range [0, 9].
Then we just loop over the list comparing each element, and when the end is reached I is printed.
YASEPL, 45 bytes
=a=1'±comma=c®1=d¥0,1`1=e¥a,1}7,d,3!+}2,c`3!<
input list as numbers seperated by commas (like 5,16,24,26,29,12,1)
outputs the list's length if true, outputs the first occurrence of a different number if false
T-SQL 75 bytes
declare @x table (y int) insert @x values...
select top 1 1 from @x a where not exists (select*from @x b where b.y!=a.y)
will return 1 for true, nothing for false
Labyrinth, 14 bytes
:,:
" }
=*$
@!
Takes input from stdin without any separators. Prints a negative integer if the items are equal, a positive integer otherwise.
:,: Precondition: top of stack is either 0 (first iteration)
" } or the previous char (the rest)
=*$ First iteration: [(implicit 0) | ]
:,: dup; getchar; dup [ 0 0 c c | ]
} move data to right [ 0 0 c | c ]
$* xor; mul [ 0 | c ]
top is 0; go straight
= swap tops [ c | 0 ]
top is positive; turn right
" no-op
Next iterations: [ c | ]
:,: [ c c c2 c2 | ]
} [ c c c2 | c2 ]
$* [ c*(c^c2) | c2 ]
top is zero iff c == c2. if so, go straight
= [ c2 | ... ]
otherwise, turn left to exit the loop
! print c*(c^c2)
the value is negative if c2 < 0 (EOF), positive otherwise
@ halt
Since the main conditional looks like
if some value is zero, keep running the loop
otherwise exit
there has to be a straight path somewhere in the loop, so a loop of size 8 is unavoidable.
sed, 26 bytes
$!{N;/^\(.*\)\n\1$/D;Q1};Q
Try it online! - Takes input as a newline separated list of numbers, exits with a non-zero exit code for "false" (i.e. not a uniform list).
Explanation
$!{ } if not last line, do these
N; append next input line to pattern space
/^\(.*\)\n\1$/ if pattern space is two identical lines
D; delete first line, and GOTO beginning
Q1 quit with exit code 1 (no printing)
;Q quit with exit code 0 (no printing)
Ly, 6 bytes
a0I=u;
This one works by sorting the list of number and comparing the top and bottom of the stack.
a - sort the stack, implicitly reads the numbers first
0I - copy the bottom entry to top of the stack
= - compare the top two entries
u; - print boolean result, exit to stop from auto printing the stack
jq, 14 bytes
unique[1]//"T"
This one generates a list of unique numbers, then attempts to print the second member of that list. The // operator catches the exception and substitutes T if there's only one number.
Headass, 13 bytes
U{N(+)P:R(U)}
Try It Online! - prints 1 for truthy and nothing for falsy
Explanation
U{N(+)P:R(U)} full program
U ready first
{N(+) : } while inputs remain
R(U) if readied input != next input, terminate program
U (while running this conditional, ready next input)
P print 1
Trivial Built-in Answers
This is the post for all of the languages where this is a built-in
Vyxal, 1 byte
≈
Jelly, 1 byte
E
05AB1E (legacy), 1 byte
Ë
Wolfram Language (Mathematica), 5 bytes
Equal
SameQ also works.
Brachylog, 1 byte
=
Husk, 1 byte
E
Haskell + hgl, 2 bytes
lq
Factor, 3 bytes
std
Outputs 0.0 if they're the same, or something else if not. all-eq? and all-equal? are longer built-ins that output booleans. all-equal? uses = (ordinary equality) and all-eq? uses eq? (strict object reference equality), but they behave the same for integers.
Thunno, \$2 \log_{256}(96) \approx\$ 1.65 bytes
ze
Thunno 2, 1 byte
ạ
Arturo, 19 15 bytes
$->a->[]=a--a\0
$->a-> ; a function taking an argument a
[]= ; is the empty block equal to...
a--a\0 ; the input with the value of its first element removed everywhere?
K (ngn/k), 10 3 bytes
#?:
Down 7 bytes thanks to Steffan
Dead simple. 1 for true, and >1 for false.
Explanation:
#?: Main function. Takes implicit input
: Right (apply what's on the left to the right)
? Unique
# Length
J-uby, 15 bytes
Same technique as Sony Santos.
:uniq|~:[]&1|:!
Explanation
:uniq | # Get unique elements
~:[] & 1 | # Get element at index 1 (will be nil if there is only one unique)
:! # Negate (number becomes false, nil becomes true)
K (ngn/k), 5 bytes
1=#?:
-2 bytes thanks to ngn
Returns 1 for true, 0 for false.
Checks if 1 is equal to the length of unique elements in x
dc, 27 characters
?[0p3Q]sq[d3R!=qz0<c]dscx1p
Sample run:
bash-5.1$ dc -e '?[0p3Q]sq[d3R!=qz0<c]dscx1p' <<< '1 1 1 1 1 1 1'
1
bash-5.1$ dc -e '?[0p3Q]sq[d3R!=qz0<c]dscx1p' <<< '6 9 6 9 6'
0
Try all test cases online!
(Note that choosing dc as interpreter and running the test separately fails both in TIO and ATO. ☹)
Fig, \$2\log_{256}(96)\approx\$ 1.646 bytes
LU
If you test input cases, the Fig site demands no spaces, ie. [x,y,z] not [x, y, z]. Outputs 1 if all equal, else >1.
LU
U : Uniquify with implicit input
L : Length
Desmos, 24 bytes
f(l)=(l[2...]-l)^2.total
Returns 0 for truthy, and a positive number (not 0) for falsey.
AWK, 18 bytes
1,$0=NF~gsub($1,e)
Revisiting my former answer, I realized that if I wanted $0 to be printed every time, I can use range patterns. In fact, if begpat (the left part) is always true, then the range pattern is always true. So I substituted the appending ( )e technique to the range pattern 1,, saving one byte.
AWK, 19 bytes (former answer)
$0=(NF~gsub($1,e))e
In details:
gsub($1,e) Searches and substitutes every occurrence of the first number
of the input ($1) for a null variable (e). It returns the
number of substitutions made.
NF~ Matches the Number of Fields (i.e., number of items) and the
number of substitutions.
We expect 1 or 0 as result, but there will be no output when
it parses as 0. (AWK skips falsey patterns, and 0 is falsey.)
( )e Appending a null variable converts 1 to "1" and 0 to "0".
That's good, because strings are always true.
$0= Sets the original input to the resulting "1" or "0".
As the pattern is a string, it is printed.
TI-Basic, 5 bytes
min(Ans=min(Ans
Takes input in Ans. Outputs 0 for falsey, and 1 for truthy.
Julia 1.0, 12 bytes
length∘∪
- outputs 1 if all numbers are equal, >1 else
∘is for function composition∪isunion, equivalent touniquefor a single argument.Setwould also work for the same number of bytes (but∪is nicer)
Julia 1.8, 8 bytes
allequal
Attempt This Online! when ATO updates to 1.8
- the boring solution
Julia 0.6, 3 bytes
var
- outputs
0orNaNfor truthy, anything else for falsy - for Julia 1.0+, add
using Statistics stdwould work the same way
Batch, 93 bytes
@set i=%1
:l
@if %i:~,1%==%i:~-1% (if %i% gtr 9 (set/ai=%i%/10&goto:l)else echo 1)else echo 0
Takes input from the command line as a string of numbers. Outputs 0 for falsey, and 1 for truthy.
Python, 16 bytes
def f(a):b,={*a}
Signals by exit code.
Python NumPy, 16 bytes
lambda a:a.ptp()
Takes a numpy array and returns 0 for True and 1 or more for False.
J, 6 bytes
1=#&~.
Outputs 0 for falsey, and 1 for truth.
How?
1=#&~.
& Compose:
# The length of
~. The nub (of the input)
1= Is it equal to one?
Python 3, 22 bytes
lambda n:len(set(n))<2
Set function takes all the unique elements of the group only.
Mascarpone, 25 bytes
,['0.]v*1['1.]v*']<[:,>!]v*' <:' >,<:,>!
This program accepts strings similar to this one:
"[2 8 1 6 4]"
and prints either '1' or '0' to stdout, with no newline.
Explanation
,['0.]v*1['1.]v*']<[:,>!]v*' <:' >,<:,>!
,['0.]v*1 First we take and ignore the first input
character '[', and create an interpreter
for which the default operation is to print
['1.]v*']< '0'. Next we bind the operation "print '1'"
to the symbol ']' under this interpreter.
[:,>!]v* Now we push an operation that takes a symbol
from stdin, extracts the operation associated
with that symbol from the interpreter on the
stack, and executes it.
' < We now bind this operation to the space
:' > character. Immediately, we extract the
operation back out of the interpreter, and
,< bind it to the next symbol from stdin, which
is the first number in the list. Finally, we
:,>! manually execute the function once, to begin
the cycle. Now, the interpreter will continue
to take input until it receives a symbol that
is neither space nor the first number. The
program will print '1' if that symbol is ']',
otherwise it will print '0'.
I wrote a solution in 36 characters, however the input/output format is inconvenient enough that I don't think it qualifies:
,[$.]v*1['1.]v*']<[:,$,>!]v*,<:,$,>!
It takes strings similar to this:
"[2 8 1 6 4 ]"
and prints '1' if the items are all equal, and '[' otherwise.
As Mascarpone is character-set-agnostic (provided the set contains the 17 symbols used by the initial interpreter) and only 26 unique characters are needed for this program to succeed (the 17 original instructions, the space character, and the characters 2-9), we require only 5 bits per character. By this logic, the solutions would be 25 bytes and 22.5 bytes in size, respectively.
Golfscript, 4 bytes
~.&,
For the input: a set of numbers should be placed in '[]' without commas.
For the output: 1 is a truthy value while integers greater than 1 are falsey.
Explanation:
I hope this does not count as a 'trivial solution'... :)
~ # Evals the input to generate a list.
. # Duplicates the list.
& # Does setwise AND. Doing AND on two same lists will have the effect of removing duplicate elements.
, # Returns the length of the remaining list.
Whitespace, 66 bytes
[S S S N
_Push_0][S N
S _Duplicate_0][T N
T T _Read_STDIN_as_integer][T T T _Retrieve_input][N
S S N
_Label_LOOP][S N
S _Duplicate_first_input][S N
S _Duplicate][S N
S _Duplicate][T N
T T _Read_STDIN_as_integer][T T T _Retrieve_input][S N
S _Duplicate][N
T T S N
_If_neg_Jump_to_Label_DONE][T S S T _Subtract][N
T S N
_If_0_Jump_to_Label_LOOP][T N
S T _Print_as_integer][N
N
N
_Exit_program][N
S S S N
_Create_Label_DONE][T N
S T _Print_as_integer]
Letters S (space), T (tab), and N (new-line) added as highlighting only.
[..._some_action] added as explanation only.
Takes the input-list new-line separated with -1 to indicate we're done with the inputs. Outputs -1 as truthy, and the first input as falsey (+4 bytes to output 0 instead if this is not allowed).
Try it online (with raw spaces, tabs and new-lines only).
Explanation in pseudo-code:
Integer firstInput = STDIN as integer
Start LOOP:
Integer next = STDIN as integer
If (next == -1):
Print next as integer to STDOUT
(Stop program with error: no exit defined)
If (firstInput == next):
Go to next iteration of LOOP
Else:
Print firstInput as integer to STDOUT
Stop program
Zsh -o extendedglob, 8 bytes
>$@
<^$1
Outputs via exit code; 1 for all the same, 0 for not all the same
>$@: create files according to the input. This de-duplicates elements because a file can only be created once^$1: find a file that doesn't match the first element of the input (-o extendedglobis necessary to enable the^feature)<: and try to read from it. If there is no matching file (because all elements are the same) this will fail and exit with1
R, 17 15 bytes
sd(scan()+!1:2)
Outputs 0 for truthy and nonzero for falsey.
Using sd is a classic R golfing trick: the standard deviation is 0 if and only if all elements are equal. Unfortunately, sd returns NA for length one input (since it divides by n-1). A neat workaround found by pajonk uses R's recycling: !1:2 is coerced to a vector c(0,0) and is added to the input vector. A length-one input is recycled to be length 2 (so the sd is guaranteed to be 0), and for input of length more than 1, the zeros are recycled to the length of the longer vector, which won't change the standard deviation.
sd(rep(scan(),2))
MMIX, 36 bytes (9 instrs)
Takes array of bytes and length as two arguments, C conventions
00000000: 83020000 27010101 82ff0001 32ffff02 ³£¡¡'¢¢¢²”¡¢2””£
00000010: 52ff0002 f8000000 5b01fffb e3000001 R”¡£ẏ¡¡¡[¢”»ẉ¡¡¢
00000020: f8010000 ẏ¢¡¡
Disassembly and explanation:
alleq LDBU $2,$0,0 // x = *a
0H SUBU $1,$1,1
LDBU $255,$0,$1 // loop: t = a[--l]
CMPU $255,$255,$2
PBZ $255,0F // iflikely(t == x) goto skp
POP 0,0 // return 0 (abuses how POP works)
0H PBNZ $1,0B // skp: iflikely(l) goto loop
SETL $0,1
POP 1,0 // return 1
K (oK), 4 bytes
Solution:
1=#?
Explanation:
Is the count of the unique items equal to 1?
1=#? / the solution
? / unique
# / count
1= / equal to 1?
CSASM v2.4.0.2, 57 bytes
Pops an ~arr:i32 from the stack, then pushes true (all elements are the same) or false (some elements are different).
func a:
dup
len
swap
newset
conv ~arr
len
comp.gt
push $f.o
ret
end
Explanation + Full Program:
.asm_name AllSame
func main:
.local i : ~arr:i32,5
.local j : ~arr:i32,5
; Initialize the arrays
; i = [ 1, 1, 1, 1, 1 ]
push i
push 1
stelem 0
push i
push 1
stelem 1
push i
push 1
stelem 2
push i
push 1
stelem 3
push i
push 1
stelem 4
; j = [ 1, 2, 3, 4, 5 ]
push [1..5]
conv ~arr
pop j
clf.o
; Get the first result
push i
call a
; Print it
push "Is 'i' all same? "
swap
add
print.n
clf.o
; Get the second result
push j
call a
; Print it
push "Is 'j' all same? "
swap
add
print.n
ret
end
func a:
dup
; [ array, array ]
len
; [ array, length ]
swap
; [ length, array ]
newset
; [ length, set ]
conv ~arr
; [ length, set elements ]
len
; [ length, element count ]
comp.gt
; If "length" is greater than "element count", then the set had duplicate
; entries which were removed
; Push the comparison flag
push $f.o
ret
end
```
x86-16 machine code, 6 bytes
Hexdump:
0000:0000 89 F7 AC F3 AE C3 ......
Explanation
; Routine A. [All The Same?]
; Expects CX = Length of input,
; SI = Initial address of list.
0000:0000 89F7 MOV DI, SI ; A1 [Load]. Set DI to SI.
0000:0002 AC LODSB ; AL = [SI++].
0000:0003 F3AE REPZ SCASB ; A2 [Compare].
; ZF = 1
; Loop CX times:
; If AX != [DI]:
; ZF = 0
; Proceed to A3
; DI ++
0000:0105 C3 RET ; A3 [End]. End of algorithm.
; ZF = 0 if not all same.
; ZF = 1 if all same. █
Husk, 2 bytes
And thanks to Razetime for some other 2-byters
(the 1-byte Husk built-in is E (same))
hg
Returns truthy (nonempty list) if all elements are not the same, falsy (empty list) if they're all the same. Collects groups of equal values and returns the head by discarding the last group.
(Other 2-byters with various truthy/falsy & falsy/truthy return values: ËI, Ë=, #≠, and some 3-byters: ΠẊ=, hk=, hġ=, hü=)
APL (Dyalog Unicode), 5 bytes
×/⊢=⊃
×/ ⍝ product reduce
⊢=⊃ ⍝ three train, each element equal to first element
C (gcc), 35 32 bytes
f(int*l){l=~l[1]&&*l-*++l+f(l);}
- recursive function taking an array -1 ended
- return False if all elements are equal, True otherwise
{l= - return using eax trick
~l[1]&& - return False if next item is end and skip next part ending recursion
*l-*++l - 0 if different
+f(l);} - plus check next item
Ruby, 17 bytes
f=->a{!a.uniq[1]}
Explanation: a.uniq is an array with unique elements of a. If all elements are the same, its second element [1] will be nil, and !nil is true.
Older answer was more readable:
f=->a{a.uniq.size==1}
brainfuck, 40 bytes
Works for all characters, not just 0 to 9! (except NUL)
Returns zero for true and non-zero for false.
,[>,]<[->+<]<[[->+>-<<]>>[<[-]>>>]<<<]>.
Perl 5 -p, 13 bytes
$_=/^(.)\1*$/
Since the input is all single digit numbers, this wants the input without spaces.
Racket, 37 18 bytes
(λ(x)(apply = x))
-19 thanks to Wezl
This takes advantages of the fact that = in Racket can take any number of arguments. Note that the tio seems to run an old version that requires at least 2 arguments to = and so fails on the singleton list, but this works on my local Racket 8 installation.
Excel, 18 bytes
=MAX(A:A)=MIN(A:A)
Input is in column A. The formula can be input anywhere not in column A.
Retina 0.8.2, 7 bytes
D`.
^.$
Try it online! Link includes test cases. Takes input as a string of digits. Explanation:
D`.
Remove duplicate digits.
^.$
Check that only one digit is left.
Charcoal, 5 bytes
⁼⌊θ⌈θ
Try it online! Link is to verbose version of code. Takes input as a string of digits by default but you can feed it an array if you insist. Outputs a Charcoal boolean, i.e. - for equal, nothing if not. Explanation: Simply compares the minimum and maximum input element.
Red, 25 bytes
func[s][single? unique s]
Doesn't work in TIO - apparently single? has been added in the subsequent versions.
Using parse, 54 bytes
func[s][parse s[set t skip(r: reduce['quote t])any r]]
Much longer, but a bit more interesting.
Explanation:
Red's parse works not only on strings, but on all types of series (block! paren! string! file! url! path! lit-path! set-path! get-path! vector! hash! binary! tag! email! image!).
f: func[s][
parse s [ ; parse the input
set t skip ; sets `t` to the first item
; a literal integer can't be used as a parse rule
(r: reduce['quote t]) ; that's why set `r` to `t`'s quoted value
any r ; zero or more `r`
]
]
Raku, 7 6 bytes
2>*.Set
+*.Set
*.Set converts the input list into a set. That set's size is then compared with returned.2
-1 byte thanks to Razetime
Vim, 8 bytes
:g/<C-r><C-w>/d
This uses the assumption that list elements are one character. Ctrl+RCtrl+W inserts the word under the cursor, so this solution applies the delete command to any line which contains the first element of the list. This results in an empty file if they're all the same, or some non-empty lines if they aren't.
If we weren't allowed to assume that items are in the range [0,9] then we could give false positives on numbers which are supersets of each other. We could fix this by using a regex instead for one more byte:
Vim, 9 bytes
:%s/<C-r><C-w>\n
Vim doesn't have a concept of truthy/falsey values but if one were to believe that a buffer containing only newlines was falsey, then we could drop the \n from this regex to get a 7 byte solution.
V (vim), 10 bytes
:sor u
Gd{
Input as a list of lines. Outputs a falsy value (Empty output) for all items equal, and outputs a number otherwise.
Gets the unique lines, goes to the last line and deletes till the beginning.
Pip, 3 bytes
$=g
Full program; takes the items from command-line arguments. Try it online!
Alternately, a function solution that takes a list as its argument (also 3 bytes):
$=_
Explanation
Not quite a builtin.
Pip, like Python, has chaining comparison operators: 1<5>=3 means 1<5 & 5>=3, and 1=1=1=2 means 1=1 & 1=1 & 1=2. Unlike Python, Pip also has the meta-operator $, which folds a list on a binary operator. For example, $+ folds a list on addition, returning the sum; and $= folds a list on =. Because = chains, this returns the result we want: 1 if all elements are equal and 0 otherwise. The program $=g applies this compound operator to the full arglist g.
Branch, 27 bytes
1O,[^\,N![o#)]n^=/;^\o^*On]
Try it on the online Branch interpreter!
There's got to be a much shorter way to do this...
Pyth, 2 bytes
l{
Outputs 1 if all elements are equal, and some integer* greater than 1 otherwise.
* Number of unique elements.
Jelly, 2 bytes
IẸ
Outputs reversed (0 if all are equal, 1 if not)
How it works
IẸ - Main link. Takes a list L on the left
I - Increments of L
Ẹ - Are any non-zero?
JavaScript (Node.js), 18 bytes
a=>new Set(a).size
Couldn't find the name of the Set builtint. Thanks dingledooper :P (outputs using the 1,>1 method that pretty much everyone is using now)
Previously...
JavaScript (Node.js), 39 bytes
a=>a.map(x=>a[0]==x).reduce((x,y)=>x&y)
Arn 1.0 -s, 2 bytes
:@
Outputs 1 if all the same, >1 if they aren't all the same. Try it online (works in older version)
:@ groups identical values, -s takes size. This could be written as (:@)# as well, which would be 4 bytes («×+0)
Jelly, 2 bytes
QL
Husk, 2 bytes
Lu
05AB1E, 2 bytes
Ùg
APL(Dyalog Unicode), 2 bytes SBCS
≢∪
Thanks to Bubbler for pointing this out!
Outputs 1 for truthy, \$>1\$ for falsey. These all use the same method: counting the number of unique elements.
If the same approach is also this trivial/short in your language, feel free to edit it in if you don't want to post an answer
