Skip to main content
golfed
Source Link

CJam, 4847

q~]_~q~_~-g"is
equal greater less
to than"N/Sf/f=*S*

Try it onlineTry it online

Explanation:

q~     read and evaluate the input (array of 2 numbers)
]_ _    put them induplicate anthe array and duplicate it
~-     dump one array on the stack and subtract the numbers
g      get signum (-1 for <, 0 for ==, 1 for >)
"…"    push that string
N/     split into lines
Sf/    split each line by space
f=     get the corresponding word (for the signum) from each line
*      join the array of 2 numbers by the array of words
        it effectively inserts the words between the numbers
S*     join everything with spaces

CJam, 48

q~]_~-g"is
equal greater less
to than"N/Sf/f=*S*

Try it online

Explanation:

q~     read and evaluate the 2 numbers
]_     put them in an array and duplicate it
~-     dump one array on the stack and subtract the numbers
g      get signum (-1 for <, 0 for ==, 1 for >)
"…"    push that string
N/     split into lines
Sf/    split each line by space
f=     get the corresponding word (for the signum) from each line
*      join the array of 2 numbers by the array of words
        it effectively inserts the words between the numbers
S*     join everything with spaces

CJam, 47

q~_~-g"is
equal greater less
to than"N/Sf/f=*S*

Try it online

Explanation:

q~     read and evaluate the input (array of 2 numbers)
_      duplicate the array
~-     dump one array on the stack and subtract the numbers
g      get signum (-1 for <, 0 for ==, 1 for >)
"…"    push that string
N/     split into lines
Sf/    split each line by space
f=     get the corresponding word (for the signum) from each line
*      join the array of 2 numbers by the array of words
        it effectively inserts the words between the numbers
S*     join everything with spaces
added explanation
Source Link

CJam, 48

q~]_~-g"is
equal greater less
to than"N/Sf/f=*S*

Try it online

Explanation:

q~     read and evaluate the 2 numbers
]_     put them in an array and duplicate it
~-     dump one array on the stack and subtract the numbers
g      get signum (-1 for <, 0 for ==, 1 for >)
"…"    push that string
N/     split into lines
Sf/    split each line by space
f=     get the corresponding word (for the signum) from each line
*      join the array of 2 numbers by the array of words
        it effectively inserts the words between the numbers
S*     join everything with spaces

CJam, 48

q~]_~-g"is
equal greater less
to than"N/Sf/f=*S*

Try it online

CJam, 48

q~]_~-g"is
equal greater less
to than"N/Sf/f=*S*

Try it online

Explanation:

q~     read and evaluate the 2 numbers
]_     put them in an array and duplicate it
~-     dump one array on the stack and subtract the numbers
g      get signum (-1 for <, 0 for ==, 1 for >)
"…"    push that string
N/     split into lines
Sf/    split each line by space
f=     get the corresponding word (for the signum) from each line
*      join the array of 2 numbers by the array of words
        it effectively inserts the words between the numbers
S*     join everything with spaces
golfed
Source Link

CJam, 5248

q_~@~q~]_~-g"equal tog"is
equal greater than
less
to than"N/="is"\@]S*Sf/f=*S*

Try it onlineTry it online

CJam, 52

q_~@~-g"equal to
greater than
less than"N/="is"\@]S*

Try it online

CJam, 48

q~]_~-g"is
equal greater less
to than"N/Sf/f=*S*

Try it online

Source Link
Loading