Jelly, (削除) 43 41 40 25 24 23 22 21 14 (削除ここまで) 13 bytes
-7 bytes thanks to fireflame241 (0ị=1ị$->=ṚḢ and use of IIA=2,2 to test for the 4 rotations)
-1 Thanks to Kevin Cruijssen (use of previously unavailable nilad Ø2 which yields [2,2])
=ṚḢȧOIṠIIA=Ø2
TryItOnline
Or all test cases (plus "RULES")
###How?
How?
An infinity word has:
- the same first and last letter;
- length 5;
- no equal letters next to each other;
- sum of its four alphabet deltas equal to zero;
- sum of its four alphabet deltas signs equal to zero;
- two positive alphabet deltas or two negative alphabet deltas in a row.
All but (1) and (equivalently) (4) may be boiled down to a condition that the alphabet delta signs are some rotation of [1,1,-1,-1] (where the sign of 0 is 0)
fireflame241 noted that this is then equivalent to the deltas of the deltas of the alphabet delta signs being in [[2,2],[2,-2],[-2,2],[-2,-2]] which may be tested by the absolute values being equal to [2,2]!
###How?
How?
=ṚḢȧOIṠIIA=Ø2 - Main link: word
Ṛ - reverse word
= - equals? (vectorises)
Ḣ - head (is the first character equal to the last?)
ȧ - and
O - cast word to ordinals
I - increments - the alphabet deltas (or just [] if 1st != last)
Ṡ - sign (vectorises)
I - increments - deltas of those signs
I - increments - deltas of those
A - absolute value (vectorises)
Ø2 - literal [2,2]
= - equals? (non-vectorising version)
Jelly, (削除) 43 41 40 25 24 23 22 21 14 (削除ここまで) 13 bytes
-7 bytes thanks to fireflame241 (0ị=1ị$->=ṚḢ and use of IIA=2,2 to test for the 4 rotations)
-1 Thanks to Kevin Cruijssen (use of previously unavailable nilad Ø2 which yields [2,2])
=ṚḢȧOIṠIIA=Ø2
TryItOnline
Or all test cases (plus "RULES")
###How?
An infinity word has:
- the same first and last letter;
- length 5;
- no equal letters next to each other;
- sum of its four alphabet deltas equal to zero;
- sum of its four alphabet deltas signs equal to zero;
- two positive alphabet deltas or two negative alphabet deltas in a row.
All but (1) and (equivalently) (4) may be boiled down to a condition that the alphabet delta signs are some rotation of [1,1,-1,-1] (where the sign of 0 is 0)
fireflame241 noted that this is then equivalent to the deltas of the deltas of the alphabet delta signs being in [[2,2],[2,-2],[-2,2],[-2,-2]] which may be tested by the absolute values being equal to [2,2]!
###How?
=ṚḢȧOIṠIIA=Ø2 - Main link: word
Ṛ - reverse word
= - equals? (vectorises)
Ḣ - head (is the first character equal to the last?)
ȧ - and
O - cast word to ordinals
I - increments - the alphabet deltas (or just [] if 1st != last)
Ṡ - sign (vectorises)
I - increments - deltas of those signs
I - increments - deltas of those
A - absolute value (vectorises)
Ø2 - literal [2,2]
= - equals? (non-vectorising version)
Jelly, (削除) 43 41 40 25 24 23 22 21 14 (削除ここまで) 13 bytes
-7 bytes thanks to fireflame241 (0ị=1ị$->=ṚḢ and use of IIA=2,2 to test for the 4 rotations)
-1 Thanks to Kevin Cruijssen (use of previously unavailable nilad Ø2 which yields [2,2])
=ṚḢȧOIṠIIA=Ø2
TryItOnline
Or all test cases (plus "RULES")
How?
An infinity word has:
- the same first and last letter;
- length 5;
- no equal letters next to each other;
- sum of its four alphabet deltas equal to zero;
- sum of its four alphabet deltas signs equal to zero;
- two positive alphabet deltas or two negative alphabet deltas in a row.
All but (1) and (equivalently) (4) may be boiled down to a condition that the alphabet delta signs are some rotation of [1,1,-1,-1] (where the sign of 0 is 0)
fireflame241 noted that this is then equivalent to the deltas of the deltas of the alphabet delta signs being in [[2,2],[2,-2],[-2,2],[-2,-2]] which may be tested by the absolute values being equal to [2,2]!
How?
=ṚḢȧOIṠIIA=Ø2 - Main link: word
Ṛ - reverse word
= - equals? (vectorises)
Ḣ - head (is the first character equal to the last?)
ȧ - and
O - cast word to ordinals
I - increments - the alphabet deltas (or just [] if 1st != last)
Ṡ - sign (vectorises)
I - increments - deltas of those signs
I - increments - deltas of those
A - absolute value (vectorises)
Ø2 - literal [2,2]
= - equals? (non-vectorising version)
Jelly, (削除) 43 41 40 25 24 23 22 21 14 (削除ここまで) 1413 bytes
-7 bytes thanks to fireflame241 (0ị=1ị$->=ṚḢ and use of IIA=2,2 to test for the 4 rotations)
-1 Thanks to Kevin Cruijssen (use of previously unavailable nilad Ø2 which yields [2,2])
=ṚḢȧOIṠIIA=2,2=ṚḢȧOIṠIIA=Ø2
TryItOnline TryItOnline
Or all test cases all test cases (plus "RULES")
###How?
An infinity word has:
- the same first and last letter;
- length 5;
- no equal letters next to each other;
- sum of its four alphabet deltas equal to zero;
- sum of its four alphabet deltas signs equal to zero;
- two positive alphabet deltas or two negative alphabet deltas in a row.
All but (1) and (equivalently) (4) may be boiled down to a condition that the alphabet delta signs are some rotation of [1,1,-1,-1] (where the sign of 0 is 0)
fireflame241 noted that this is then equivalent to the deltas of the deltas of the alphabet delta signs being in [[2,2],[2,-2],[-2,2],[-2,-2]] which may be tested by the absolute values being equal to [2,2]!
###How?
=ṚḢȧOIṠIIA=2,2=ṚḢȧOIṠIIA=Ø2 - Main link: word
Ṛ - reverse word
= - equals? (vectorises)
Ḣ - head (is the first character equal to the last?)
ȧ - and
O - cast word to ordinals
I - increments - the alphabet deltas (or just [] if 1st != last)
Ṡ - sign (vectorises)
I - increments - deltas of those signs
I - increments - deltas of those
A - absolute value (vectorises)
2,2Ø2 - literal [2,2]
= - equals? (non-vectorising version)
Jelly, (削除) 43 41 40 25 24 23 22 21 (削除ここまで) 14 bytes
-7 bytes thanks to fireflame241 (0ị=1ị$->=ṚḢ and use of IIA=2,2 to test for the 4 rotations)
=ṚḢȧOIṠIIA=2,2
TryItOnline
Or all test cases (plus "RULES")
###How?
An infinity word has:
- the same first and last letter;
- length 5;
- no equal letters next to each other;
- sum of its four alphabet deltas equal to zero;
- sum of its four alphabet deltas signs equal to zero;
- two positive alphabet deltas or two negative alphabet deltas in a row.
All but (1) and (equivalently) (4) may be boiled down to a condition that the alphabet delta signs are some rotation of [1,1,-1,-1] (where the sign of 0 is 0)
fireflame241 noted that this is then equivalent to the deltas of the deltas of the alphabet delta signs being in [[2,2],[2,-2],[-2,2],[-2,-2]] which may be tested by the absolute values being equal to [2,2]!
###How?
=ṚḢȧOIṠIIA=2,2 - Main link: word
Ṛ - reverse word
= - equals? (vectorises)
Ḣ - head (is the first character equal to the last?)
ȧ - and
O - cast word to ordinals
I - increments - the alphabet deltas (or just [] if 1st != last)
Ṡ - sign (vectorises)
I - increments - deltas of those signs
I - increments - deltas of those
A - absolute value (vectorises)
2,2 - literal [2,2]
= - equals? (non-vectorising version)
Jelly, (削除) 43 41 40 25 24 23 22 21 14 (削除ここまで) 13 bytes
-7 bytes thanks to fireflame241 (0ị=1ị$->=ṚḢ and use of IIA=2,2 to test for the 4 rotations)
-1 Thanks to Kevin Cruijssen (use of previously unavailable nilad Ø2 which yields [2,2])
=ṚḢȧOIṠIIA=Ø2
TryItOnline
Or all test cases (plus "RULES")
###How?
An infinity word has:
- the same first and last letter;
- length 5;
- no equal letters next to each other;
- sum of its four alphabet deltas equal to zero;
- sum of its four alphabet deltas signs equal to zero;
- two positive alphabet deltas or two negative alphabet deltas in a row.
All but (1) and (equivalently) (4) may be boiled down to a condition that the alphabet delta signs are some rotation of [1,1,-1,-1] (where the sign of 0 is 0)
fireflame241 noted that this is then equivalent to the deltas of the deltas of the alphabet delta signs being in [[2,2],[2,-2],[-2,2],[-2,-2]] which may be tested by the absolute values being equal to [2,2]!
###How?
=ṚḢȧOIṠIIA=Ø2 - Main link: word
Ṛ - reverse word
= - equals? (vectorises)
Ḣ - head (is the first character equal to the last?)
ȧ - and
O - cast word to ordinals
I - increments - the alphabet deltas (or just [] if 1st != last)
Ṡ - sign (vectorises)
I - increments - deltas of those signs
I - increments - deltas of those
A - absolute value (vectorises)
Ø2 - literal [2,2]
= - equals? (non-vectorising version)
Jelly, (削除) 43 41 40 25 24 23 22 21 (削除ここまで) 2114 bytes
-7 bytes thanks to fireflame241 (0ị=1ị$->=ṚḢ and use of IIA=2,2 to test for the 4 rotations)
9BḤ’ṙ4R¤
0ị=1ị$aOIṠe¢=ṚḢȧOIṠIIA=2,2
TryItOnline TryItOnline
Or all test cases all test cases (plus "RULES")
fireflame241 noted that this is then equivalent to the deltas of the deltas of the alphabet delta signs being in [[2,2],[2,-2],[-2,2],[-2,-2]] which may be tested by the absolute values being equal to [2,2]!
###How?
9BḤ’ṙ4R¤ - Link 1=ṚḢȧOIṠIIA=2, make the four rotations of2 [1,1,-1,-1] (no arguments,Main AKAlink: niladic)word
9B - 9 converted to binary ->Ṛ [ 1, 0, 0, 1]
Ḥ - double (vectorises)reverse word
= -> [ 2, 0, 0, 2]
’ - decrementequals? (vectorises) -> [ 1,-1,-1, 1]
¤ - nilad followedḢ by link(s) as a nilad
4R - head range(4) -> [ 1, is the 2,first character equal to the last?)
ȧ 3, - 4]and
ṙ - rotate left by O -> [[-1,-1,1,1],[-1,1,1,-1],[1,1,-1,-1],[1,-1,-1,1]]
0ị=1ị$aOIṠe¢ - Main link:cast word
$ to ordinals
- lastI two links as a monad
0ị - increments - the alphabet deltas (or -just element[] atif index1st 0!= (last character)
= - equals?
1ịṠ - element at index 1sign (first charactervectorises)
a - and
I O - increments - castdeltas wordof tothose ordinalssigns
I - increments - thedeltas alphabetof deltasthose
ṠA - signabsolute value (vectorises)
e 2,2 - existsliteral in[2,2]
= ¢ - call last- linkequals? (1) as anon-vectorising niladversion)
Jelly, (削除) 43 41 40 25 24 23 22 (削除ここまで) 21 bytes
9BḤ’ṙ4R¤
0ị=1ị$aOIṠe¢
TryItOnline
Or all test cases (plus "RULES")
###How?
9BḤ’ṙ4R¤ - Link 1, make the four rotations of [1,1,-1,-1] (no arguments, AKA niladic)
9B - 9 converted to binary -> [ 1, 0, 0, 1]
Ḥ - double (vectorises) -> [ 2, 0, 0, 2]
’ - decrement (vectorises) -> [ 1,-1,-1, 1]
¤ - nilad followed by link(s) as a nilad
4R - range(4) -> [ 1, 2, 3, 4]
ṙ - rotate left by -> [[-1,-1,1,1],[-1,1,1,-1],[1,1,-1,-1],[1,-1,-1,1]]
0ị=1ị$aOIṠe¢ - Main link: word
$ - last two links as a monad
0ị - element at index 0 (last character)
= - equals?
1ị - element at index 1 (first character)
a - and
O - cast word to ordinals
I - increments - the alphabet deltas
Ṡ - sign (vectorises)
e - exists in
¢ - call last link (1) as a nilad
Jelly, (削除) 43 41 40 25 24 23 22 21 (削除ここまで) 14 bytes
-7 bytes thanks to fireflame241 (0ị=1ị$->=ṚḢ and use of IIA=2,2 to test for the 4 rotations)
=ṚḢȧOIṠIIA=2,2
TryItOnline
Or all test cases (plus "RULES")
fireflame241 noted that this is then equivalent to the deltas of the deltas of the alphabet delta signs being in [[2,2],[2,-2],[-2,2],[-2,-2]] which may be tested by the absolute values being equal to [2,2]!
###How?
=ṚḢȧOIṠIIA=2,2 - Main link: word
Ṛ - reverse word
= - equals? (vectorises)
Ḣ - head (is the first character equal to the last?)
ȧ - and
O - cast word to ordinals
I - increments - the alphabet deltas (or just [] if 1st != last)
Ṡ - sign (vectorises)
I - increments - deltas of those signs
I - increments - deltas of those
A - absolute value (vectorises)
2,2 - literal [2,2]
= - equals? (non-vectorising version)