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 attention from curators or moderators?
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

J, 4 bytes

-:|.

Try it online!

Checks if the input array matches itself reversed. This is a tacit form and is executed monadically as x f (g x).

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

1 comment thread

This requires parentheses to work, so shouldn't they be counted? (4 comments)
This requires parentheses to work, so shouldn't they be counted?
torres‭ wrote over 2 years ago

This requires parentheses to work, so shouldn't they be counted?

south‭ wrote over 2 years ago

Honestly, that's a good question. I had not thought of that. If I am reading this right, though, parens are not required.

torres‭ wrote over 2 years ago

By that description it would seem that the parentheses don't count. My concern is that, when they wrote the definition, they may have not known that in J there is a distinct difference between how "(-%)" works versus "-%".

south‭ wrote over 2 years ago

Most times I explicitly state what type of submission it is as to avoid confusion.