果冻, 35 32 27 25 字节
-2感谢Dennis(转移排列以避免 %32
)
Oị“¡\ḣḶɼz3ç³ƝMƒ§’Œ?¤ḃ2FŒḂ
以大写形式输入;输出是1
为真,0
为假。
在线尝试!或查看测试套件。
怎么样?
Oị“...’Œ?¤ḃ2FŒḂ - Link: list of characters (in [A-Za-z]), S e.g. 'FoOl'
O - to ordinals [70,111,79,108]
%32 - modulo by 32 (A->1, a->1, ...) [6,15,15,12]
¤ - nilad followed by link(s) as a nilad:
“...’ - base 250 literal = 41482574787853596522350494865
Œ? - first permutation of [1,N] which resides at that
- index when all permutations of [1,N] are sorted
- = [8,16,10,24,26,27,18,20,4,23,25,11,1,17,13,15,3,22,12,19,6,5,14,21,28,9,7,2]
- index into (modular-indexing & vectorises) [17,14,14,19]
ḃ2 - to bijective base 2 (vectorises) [[1,1,2,1],[2,2,2],[2,2,2],[1,2,1,1]]
F - flatten [1,1,0,1,0,0,0,0,0,0,1,0,1,1]
ŒḂ - is palindromic? 1
以前的35字节解决方案(也需要大写输入)...
ØẠḣ29“...’œ?iⱮ⁸d⁴BnⱮ/€FŒḂ - Link: list of characters (in [A-Z] only), S
ØẠ - alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
ḣ29 - head to index 29 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabc'
“...’ - base 250 literal = 1222276956185766767980461920692
œ? - permutation at index = 'EAIWRUSJPaLbFVHcTNMDKGOBXCYZQ'
⁸ - chain's left argument = S e.g. 'FOOL'
Ɱ - map with:
i - first index of (char in 'EAI...') [13,23,23,11]
⁴ - literal 16 16
d - divmod [[0,13],[1,7],[1,7],[0,11]]
B - to binary (vectorises) [[[0],[1,1,0,1]],[[1],[1,1,1]],[[1],[1,1,1]],[[0],[1,0,1,1]]]
€ - for each:
/ - reduce by:
Ɱ - map with:
n - not equal [[1,1,0,1],[0,0,0],[0,0,0],[1,0,1,1]]
F - flatten [1,1,0,1,0,0,0,0,0,0,1,0,1,1]
ŒḂ - is palindromic? 1