Skip to main content
deleted 4 characters in body
Source Link
Dennis
  • 211.7k
  • 41
  • 380
  • 830

Haskell, 54 50 bytes

t a=or[and(zipWith(<=)`f`tail$a)|f<-[(=<<),(<*>)]] 

Usage example: t "defggh" -> True. Try it online!Try it online!.

Maybe using sort like may other answers is shorter although it requires import Data.List. Here's a different approach:

For every function f from [(=<<),(<*>)], calculate and(zipWith(<=)`f`tail$a) and require any of the results to be True. The functions are

((=<<) (zipWith(<=)) tail) a ((<*>) (zipWith(<=)) tail) a 

which both perform comparisons of neighbor elements of the input list a with <=, but one with the arguments flipped resulting in a >=. and checks if all comparisons are True.

Haskell, 54 50 bytes

t a=or[and(zipWith(<=)`f`tail$a)|f<-[(=<<),(<*>)]] 

Usage example: t "defggh" -> True. Try it online!.

Maybe using sort like may other answers is shorter although it requires import Data.List. Here's a different approach:

For every function f from [(=<<),(<*>)], calculate and(zipWith(<=)`f`tail$a) and require any of the results to be True. The functions are

((=<<) (zipWith(<=)) tail) a ((<*>) (zipWith(<=)) tail) a 

which both perform comparisons of neighbor elements of the input list a with <=, but one with the arguments flipped resulting in a >=. and checks if all comparisons are True.

Haskell, 54 50 bytes

t a=or[and(zipWith(<=)`f`tail$a)|f<-[(=<<),(<*>)]] 

Usage example: t "defggh" -> True. Try it online!.

Maybe using sort like may other answers is shorter although it requires import Data.List. Here's a different approach:

For every function f from [(=<<),(<*>)], calculate and(zipWith(<=)`f`tail$a) and require any of the results to be True. The functions are

((=<<) (zipWith(<=)) tail) a ((<*>) (zipWith(<=)) tail) a 

which both perform comparisons of neighbor elements of the input list a with <=, but one with the arguments flipped resulting in a >=. and checks if all comparisons are True.

added 15 characters in body
Source Link
nimi
  • 36k
  • 4
  • 35
  • 100

Haskell, 5454 50 bytes

t a=or$map(\f->and(fa=or[and(zipWith(<=))tail$a)`f`tail$a)|f<-[(=<<),(<*>)]]] 

Usage example: t "defggh" -> True. Try it online!Try it online!.

Maybe using sort like may other answers is shorter although it requires import Data.List. Here's a different approach:

Map the lambdaFor every function \f-> ...f over the list of functionsfrom [(=<<),(<*>)], calculate and(zipWith(<=)`f`tail$a) and require any of the results to be True. The lambda resolves tofunctions are

((=<<) (zipWith(<=)) tail) a ((<*>) (zipWith(<=)) tail) a 

which both perform comparisons of neighbor elements of the input list a with <=, but one with the arguments flipped resulting in a >=. and checks if all comparisons are True.

Haskell, 54 bytes

t a=or$map(\f->and(f(zipWith(<=))tail$a))[(=<<),(<*>)] 

Usage example: t "defggh" -> True. Try it online!.

Maybe using sort like may other answers is shorter although it requires import Data.List. Here's a different approach:

Map the lambda \f-> ... over the list of functions [(=<<),(<*>)] and require any of the results to be True. The lambda resolves to

((=<<) (zipWith(<=)) tail) a ((<*>) (zipWith(<=)) tail) a 

which both perform comparisons of neighbor elements of the input list a with <=, but one with the arguments flipped resulting in a >=. and checks if all comparisons are True.

Haskell, 54 50 bytes

t a=or[and(zipWith(<=)`f`tail$a)|f<-[(=<<),(<*>)]] 

Usage example: t "defggh" -> True. Try it online!.

Maybe using sort like may other answers is shorter although it requires import Data.List. Here's a different approach:

For every function f from [(=<<),(<*>)], calculate and(zipWith(<=)`f`tail$a) and require any of the results to be True. The functions are

((=<<) (zipWith(<=)) tail) a ((<*>) (zipWith(<=)) tail) a 

which both perform comparisons of neighbor elements of the input list a with <=, but one with the arguments flipped resulting in a >=. and checks if all comparisons are True.

Source Link
nimi
  • 36k
  • 4
  • 35
  • 100

Haskell, 54 bytes

t a=or$map(\f->and(f(zipWith(<=))tail$a))[(=<<),(<*>)] 

Usage example: t "defggh" -> True. Try it online!.

Maybe using sort like may other answers is shorter although it requires import Data.List. Here's a different approach:

Map the lambda \f-> ... over the list of functions [(=<<),(<*>)] and require any of the results to be True. The lambda resolves to

((=<<) (zipWith(<=)) tail) a ((<*>) (zipWith(<=)) tail) a 

which both perform comparisons of neighbor elements of the input list a with <=, but one with the arguments flipped resulting in a >=. and checks if all comparisons are True.