We’re rewarding the question askers & reputations are being recalculated! Read more.
3 ⍋∘⍋ ≢ ⍋
source | link

APL (Dyalog Unicode), 18 17 bytes

1 byte saved thanks to @Adám for using ⍤1 instead of ∘↑(...)¨ and by changing the input format from a nested array to a matrix

(⍋-⍒)(⍎¨∊∘⎕D⊆⊢)⍤1

Try it online!

Takes the input as a matrix of chars as the right argument, where each version string is on its own row. Outputs ¯1 1, 0 0, 1 ¯1 for <, =, > respectively.

(⍎¨∊∘⎕D⊆⊢)⍤1 on each row

  • ∊∘⎕D⊆⊢ group all occurrences of digits, that is, split on .

  • ⍎¨ and convert each of these occurrences to a number

convert to a matrix, where the first input is on the top row and the second one in the bottom, padding with 0s where necessary

(⍋-⍒) and

  • - subtract
    • the indices ofinto the rows sortedwhich would sort them in descending order
    • from the indices ofsame as the rows sorted intop but for ascending order

APL (Dyalog Unicode), 18 17 bytes

1 byte saved thanks to @Adám for using ⍤1 instead of ∘↑(...)¨ and by changing the input format from a nested array to a matrix

(⍋-⍒)(⍎¨∊∘⎕D⊆⊢)⍤1

Try it online!

Takes the input as a matrix of chars as the right argument, where each version string is on its own row. Outputs ¯1 1, 0 0, 1 ¯1 for <, =, > respectively.

(⍎¨∊∘⎕D⊆⊢)⍤1 on each row

  • ∊∘⎕D⊆⊢ group all occurrences of digits, that is, split on .

  • ⍎¨ and convert each of these occurrences to a number

convert to a matrix, where the first input is on the top row and the second one in the bottom, padding with 0s where necessary

(⍋-⍒) and

  • - subtract
    • the indices of the rows sorted in descending order
    • from the indices of the rows sorted in ascending order

APL (Dyalog Unicode), 18 17 bytes

1 byte saved thanks to @Adám for using ⍤1 instead of ∘↑(...)¨ and by changing the input format from a nested array to a matrix

(⍋-⍒)(⍎¨∊∘⎕D⊆⊢)⍤1

Try it online!

Takes the input as a matrix of chars as the right argument, where each version string is on its own row. Outputs ¯1 1, 0 0, 1 ¯1 for <, =, > respectively.

(⍎¨∊∘⎕D⊆⊢)⍤1 on each row

  • ∊∘⎕D⊆⊢ group all occurrences of digits, that is, split on .

  • ⍎¨ and convert each of these occurrences to a number

convert to a matrix, where the first input is on the top row and the second one in the bottom, padding with 0s where necessary

(⍋-⍒) and

  • - subtract
    • the indices into the rows which would sort them in descending order
    • same as the top but for ascending order
2 remember that `⍤` ≡ `"` now okayh
source | link

APL (Dyalog Unicode), 1818 17 bytes

1 byte saved thanks to @Adám for using ⍤1 instead of ∘↑(...)¨ and by changing the input format from a nested array to a matrix

(⍋-⍒)∘↑(⍎¨∊∘⎕D⊆⊢)¨⍤1

Try it online!Try it online!

Takes the input as an arraya matrix of stringschars as the right argument, where each version string is on its own row. Outputs ¯1 1, 0 0, 1 ¯1 for <, =, > respectively.

(⍎¨∊∘⎕D⊆⊢)¨⍤1 on each inputrow

  • ∊∘⎕D⊆⊢ group all occurrences of digits, that is, split on .

  • ⍎¨ and convert each of these occurrences to a number

convert to a matrix, where the first input is on the top row and the second one in the bottom, padding with 0s where necessary

(⍋-⍒) and

  • - subtract
    • the indices of the rows sorted in descending order
    • from the indices of the rows sorted in ascending order

APL (Dyalog Unicode), 18 bytes

(⍋-⍒)∘↑(⍎¨∊∘⎕D⊆⊢)¨

Try it online!

Takes the input as an array of strings as the right argument. Outputs ¯1 1, 0 0, 1 ¯1 for <, =, > respectively.

(⍎¨∊∘⎕D⊆⊢)¨ on each input

  • ∊∘⎕D⊆⊢ group all occurrences of digits, that is, split on .

  • ⍎¨ and convert each of these occurrences to a number

convert to a matrix, where the first input is on the top row and the second one in the bottom, padding with 0s where necessary

(⍋-⍒) and

  • - subtract
    • the indices of the rows sorted in descending order
    • from the indices of the rows sorted in ascending order

APL (Dyalog Unicode), 18 17 bytes

1 byte saved thanks to @Adám for using ⍤1 instead of ∘↑(...)¨ and by changing the input format from a nested array to a matrix

(⍋-⍒)(⍎¨∊∘⎕D⊆⊢)⍤1

Try it online!

Takes the input as a matrix of chars as the right argument, where each version string is on its own row. Outputs ¯1 1, 0 0, 1 ¯1 for <, =, > respectively.

(⍎¨∊∘⎕D⊆⊢)⍤1 on each row

  • ∊∘⎕D⊆⊢ group all occurrences of digits, that is, split on .

  • ⍎¨ and convert each of these occurrences to a number

convert to a matrix, where the first input is on the top row and the second one in the bottom, padding with 0s where necessary

(⍋-⍒) and

  • - subtract
    • the indices of the rows sorted in descending order
    • from the indices of the rows sorted in ascending order
1
source | link

APL (Dyalog Unicode), 18 bytes

(⍋-⍒)∘↑(⍎¨∊∘⎕D⊆⊢)¨

Try it online!

Takes the input as an array of strings as the right argument. Outputs ¯1 1, 0 0, 1 ¯1 for <, =, > respectively.

(⍎¨∊∘⎕D⊆⊢)¨ on each input

  • ∊∘⎕D⊆⊢ group all occurrences of digits, that is, split on .

  • ⍎¨ and convert each of these occurrences to a number

convert to a matrix, where the first input is on the top row and the second one in the bottom, padding with 0s where necessary

(⍋-⍒)∘ and

  • - subtract
    • the indices of the rows sorted in descending order
    • from the indices of the rows sorted in ascending order