Skip to main content
add explanation
Source Link
smls
  • 4.5k
  • 16
  • 19

Perl 6Perl 6, 25 bytes

{[le] .comb or[ge] .comb} 

How it works:

  • .comb splits the input into a sequence of characters.
  • le and ge are the "less or equal" and "greater or equal" string comparison operators.
  • [ ] around an infix operator, reduces ("folds") the argument list with that operator. (It's smart enough to return True if the input has only zero or one characters.)
  • or returns True if the expressions on either side of it is true.

Perl 6, 25 bytes

{[le] .comb or[ge] .comb} 

Perl 6, 25 bytes

{[le] .comb or[ge] .comb} 

How it works:

  • .comb splits the input into a sequence of characters.
  • le and ge are the "less or equal" and "greater or equal" string comparison operators.
  • [ ] around an infix operator, reduces ("folds") the argument list with that operator. (It's smart enough to return True if the input has only zero or one characters.)
  • or returns True if the expressions on either side of it is true.
Source Link
smls
  • 4.5k
  • 16
  • 19

Perl 6, 25 bytes

{[le] .comb or[ge] .comb}