Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Comments on Are All Elements Equal?

Parent

Are All Elements Equal?

+10
−0

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.

History
Why does this post require moderator attention?
You might want to add some details to your flag.
Why should this post be closed?

2 comment threads

Trivial builtins (2 comments)
CW trivial builtins answer? (5 comments)
Post
+1
−0

Trivial answers

Husk, 1 byte

E

Try it online!

History
Why does this post require moderator attention?
You might want to add some details to your flag.

1 comment thread

You don't need signum (4 comments)
You don't need signum
Razetime‭ wrote over 2 years ago

You don't need signum

user‭ wrote over 2 years ago

Razetime‭ But they're not distinct values otherwise, they're either 0 or some arbitrary positive integer. Is that alright?

Razetime‭ wrote over 2 years ago

they're correct by the definition of truthy and falsy values in husk.

user‭ wrote over 2 years ago

Oh great, I'll remove it then!