Skip to main content
better explanation
Source Link
chunes
  • 27.8k
  • 3
  • 32
  • 55

Factor, 28 bytes

[ 2 group [ = ] assoc-all? ] 

Try it online!

  • 2 group Split a sequence every 2 elements, e.g. { 1 1 2 2 3 3 } -> { { 1 1 } { 2 2 } { 3 3 } }
  • [ = ] assoc-all? Does every pair in a sequence consist of equal values?

Factor, 2626 24 bytes

[ 2 group flip ?first21 cut = ] 

Try it online!Try it online!

Thanks to @Bubbler!
-2 bytes from me

  • flip Transpose a matrix. e.g. { { 1 1 } { 2 2 } { 3 3 } } -> { { 1 2 3 } { 1 2 3 } }
  • ?first21 cut GetSplit the matrix in two between its first 2 elements of a sequenceand second rows. If there isn't a second onerow, outputoutputs f{ }. e.g. { { 1 2 3 } { 1 2 3 } } -> { { 1 2 3 } } { { 1 2 3 } }
  • = Are they equal?

Factor, 28 bytes

[ 2 group [ = ] assoc-all? ] 

Try it online!

  • 2 group Split a sequence every 2 elements, e.g. { 1 1 2 2 3 3 } -> { { 1 1 } { 2 2 } { 3 3 } }
  • [ = ] assoc-all? Does every pair in a sequence consist of equal values?

Factor, 26 bytes

[ 2 group flip ?first2 = ] 

Try it online!

Thanks to @Bubbler!

  • flip Transpose a matrix. e.g. { { 1 1 } { 2 2 } { 3 3 } } -> { { 1 2 3 } { 1 2 3 } }
  • ?first2 Get the first 2 elements of a sequence. If there isn't a second one, output f.
  • = Are they equal?

Factor, 28 bytes

[ 2 group [ = ] assoc-all? ] 

Try it online!

  • 2 group Split a sequence every 2 elements, e.g. { 1 1 2 2 3 3 } -> { { 1 1 } { 2 2 } { 3 3 } }
  • [ = ] assoc-all? Does every pair in a sequence consist of equal values?

Factor, 26 24 bytes

[ 2 group flip 1 cut = ] 

Try it online!

Thanks to @Bubbler!
-2 bytes from me

  • flip Transpose a matrix. e.g. { { 1 1 } { 2 2 } { 3 3 } } -> { { 1 2 3 } { 1 2 3 } }
  • 1 cut Split the matrix in two between its first and second rows. If there isn't a second row, outputs { }. e.g. { { 1 2 3 } { 1 2 3 } } -> { { 1 2 3 } } { { 1 2 3 } }
  • = Are they equal?
add Bubbler's alternative
Source Link
chunes
  • 27.8k
  • 3
  • 32
  • 55

Factor, 28 bytes

[ 2 group [ = ] assoc-all? ] 

Try it online!

  • 2 group Split a sequence every 2 elements, e.g. { 1 1 2 2 3 3 } -> { { 1 1 } { 2 2 } { 3 3 } }
  • [ = ] assoc-all? Does every pair in a sequence consist of equal values?

Factor, 26 bytes

[ 2 group flip ?first2 = ] 

Try it online!

Thanks to @Bubbler!

  • flip Transpose a matrix. e.g. { { 1 1 } { 2 2 } { 3 3 } } -> { { 1 2 3 } { 1 2 3 } }
  • ?first2 Get the first 2 elements of a sequence. If there isn't a second one, output f.
  • = Are they equal?

Factor, 28 bytes

[ 2 group [ = ] assoc-all? ] 

Try it online!

  • 2 group Split a sequence every 2 elements, e.g. { 1 1 2 2 3 3 } -> { { 1 1 } { 2 2 } { 3 3 } }
  • [ = ] assoc-all? Does every pair in a sequence consist of equal values?

Factor, 28 bytes

[ 2 group [ = ] assoc-all? ] 

Try it online!

  • 2 group Split a sequence every 2 elements, e.g. { 1 1 2 2 3 3 } -> { { 1 1 } { 2 2 } { 3 3 } }
  • [ = ] assoc-all? Does every pair in a sequence consist of equal values?

Factor, 26 bytes

[ 2 group flip ?first2 = ] 

Try it online!

Thanks to @Bubbler!

  • flip Transpose a matrix. e.g. { { 1 1 } { 2 2 } { 3 3 } } -> { { 1 2 3 } { 1 2 3 } }
  • ?first2 Get the first 2 elements of a sequence. If there isn't a second one, output f.
  • = Are they equal?
Source Link
chunes
  • 27.8k
  • 3
  • 32
  • 55

Factor, 28 bytes

[ 2 group [ = ] assoc-all? ] 

Try it online!

  • 2 group Split a sequence every 2 elements, e.g. { 1 1 2 2 3 3 } -> { { 1 1 } { 2 2 } { 3 3 } }
  • [ = ] assoc-all? Does every pair in a sequence consist of equal values?