g | x | w | all
Bytes Lang Time Link
031AWK250825T162043Zxrs
005Uiua231125T085136Zchunes
005J171031T134251ZJonah
006Itr230814T125110Zbsoelch
018PowerShell230815T150006ZJames Fl
020Javascript230814T131418ZLuis fel
003Thunno 2230809T160447ZThe Thon
032ZSH230404T102709ZThor
004Vyxal230404T093609ZThe Thon
nan230404T093400ZThe Thon
020C# Visual C# Interactive Compiler220114T115635ZFichtelz
024Factor220114T065826Zchunes
013V170531T210756ZDJMcMayh
035C170604T040605ZMD XF
005APL Dyalog171031T130150ZJ. Sall&
nanPerl 5171031T014743ZXcali
046Lua170531T210759ZMCAdvent
023shortC170604T040801ZMD XF
024Crystal170601T094207ZDomii
041REXX170601T205508Zidrougge
027Clojure170601T171218ZNikoNyrh
022Python170531T210852Ztotallyh
057C++170601T043032ZHSchmale
018Ruby170601T092008Zreiterma
022Cubix170601T145644Zuser4854
051R170601T134336Zbouncyba
035Lua170601T105936ZFelipe N
008CJam170601T110057ZErik the
007Pyth170601T101557ZJim
036PHP>=7.1170531T220628ZJör
073C170601T094838Zsigvaldm
027C#170601T082603ZTheLetha
042Java 8170601T090310ZKevin Cr
025><> with this interpreter170601T053742ZNot a tr
011CJam170601T031117ZEsolangi
024Alice170601T022900ZNitrodon
nan170601T000611ZBrad Gil
034Mathematica170531T220545ZZaMoC
018QBIC170531T223951Zsteenber
022Haskell170531T223433Znimi
008Japt170531T222646ZLuke
004Jelly170531T213244Zfireflam
00505AB1E170531T210944ZRiley
026JavaScript ES6170531T211818ZETHprodu
022Octave170531T212448ZStewie G
005MATL170531T211042ZDJMcMayh

AWK, 31 bytes

$0=a[split($1,a,X)-$2+1]==a[$2]

Attempt This Online!

Prints 1 for truthy, nothing for falsey. Link is to version that prints 0 for falsey.

Uiua, 5 bytes

⊡:=⇌.

Try it!

⊡:=⇌.
    .  # duplicate
   ⇌   # reverse
  =    # elementwise equal
 :     # flip
⊡      # pick

J, 6 5 bytes

{]=|.

Try it online!

-4 bytes thanks to FrownyFrog for {(=|.)

See original answer explanation -- idea is similar enough, but this is accomplished with a dyadic hook whose right verb is itself a monadic hook.

Try it online!

original answer (10 bytes)

{=/@(,:|.)

,:|. right arg on top of reverse right arg

=/ are they elementwise equal?

{ take from that boolean list the index indicated by the left arg

Try it online!

Itr, 6 bytes

ä¡Y=à@

0-indexed

online interpreter

Explanation

ä       ; duplicate the first (implicit) input
 ¡      ; reverse it
  Y=    ; zip the two lists with equality
    à@  ; get the element at the index given by the second index
        ; implicit output

PowerShell, 18 bytes

$a[$b]-eq$a[-$b-1]

Try it online!

Javascript, 20 bytes

s=>n=>s[n]==s.at(~n)

Thunno 2, 3 bytes

Ḳ=i

Try it online!

Explanation

Ḳ=i  # Implicit input
Ḳ    # Bifurcate the input string
 =   # Check for equality (vectorised)
  i  # Index into this list
     # Implicit output

ZSH, 32

f(){read s n;[ $s[n] = $s[-n] ]}

Try it online!

Vyxal, 4 bytes

fḂ=i

Try it Online!

Explanation

fḂ=i  # Implicit input
f     # Flatten into a list of characters
 Ḃ    # Bifurcate: duplicate and reverse
  =   # Are they equal (vectorises)
   i  # Index in
      # Implicit output

Thunno, \$ 8 \log_{256}(96) \approx \$ 6.58 bytes

Drz.=sAI

Attempt This Online!

0-indexed. Change AI to AH if you want it to be 1-indexed.

Explanation

Drz.=sAI  # Implicit input
Dr        # Duplicate and reverse
  z.=     # Zipped equality
     sAI  # Swap and index in
          # Implicit output

C# (Visual C# Interactive Compiler), 20 bytes

I don't have enough reputation to comment on TheLethalCoder's answer, but in C# 8 you can save some more bytes.

s=>n=>s[n]==s[^++n];

Try it online!

Factor, 24 bytes

[ 2dup nth -rot nth* = ]

Try it online!

Explanation

nth* is like nth except it indexes from the back; if 0 nth is the first element, 0 nth* is the last.

             ! 1 "[][]"
2dup         ! 1 "[][]" 1 "[][]"
nth          ! 1 "[][]" 93
-rot         ! 93 1 "[][]"
nth*         ! 93 91
=            ! f

V, 26, 16, 13 bytes

ä$Àñã2xñVpøˆ±

Try it online!

Hexdump:

00000000: e424 c0f1 e332 78f1 5670 f888 b1         .$...2x.Vp...

1 indexed.

Explanation:

ä$                  " Duplicate this line horizontally
  Àñ   ñ            " Arg1 times...
    ã               "   Move to the center of this line
     2x             "   And delete two characters
        V           " Select this whole line
         p          " And replace it with the last pair of characters we deleted
          ø         " Count the number of matches of the following regex...
           <0x88>   "   Any character
                 ±  "   Followed by itself

For reference, my original answer was:

Àñx$x|ñxv$hhpÓ¨.©±/1
ñllS0

Try it online! (0 indexed)

Hexdump:

00000000: c0f1 7824 787c f178 7624 6868 70d3 a82e  ..x$x|.xv$hhp...
00000010: a9b1 2f31 0af1 6c6c 5330                 ../1..llS0

C, 36 35 bytes

#define f(s,n)s[n]==s[strlen(s)+~n]

Uses 0-based indexing, naturally.

Try it online!

APL (Dyalog), 10 5 bytes

⊃=⊃∘⌽

This is a tacit function, which needs to be assigned a name such as f←⊃=⊃∘⌽, and then called as int f string.

Thanks to @Adám for a whopping 5 bytes.

How it works:

⊃=⊃∘⌽  ⍝ Main function; tacit. 
       ⍝ Inputs are ⍺ = 1 (left) and ⍵ = 'abca' (right).
⊃      ⍝ ⍺⊃⍵, meaning 'pick the ⍺-th element of ⍵'
 =     ⍝ Compare to
    ⌽  ⍝ ⌽⍵, meaning 'invert ⍵'
  ⊃    ⍝ Again, ⍺⊃⍵, but:
   ∘   ⍝ Compose. This turns ⌽ into the right argument for ⊃,
       ⍝ which becomes 'pick the ⍺-th element from ⌽(the inverse of)⍵'

Try it online!

The 22 byte answer was edited out. If you want to see it, check the revision history.

Perl 5, 23 + 3 (-lF) = 26 bytes

say$F[$n=<>]eq$F[-1-$n]

Try it online!

Uses 0 indexing

Lua, 46 bytes

function f(s,n)return s:byte(n)==s:byte(-n)end

Try it online!

shortC, 23 bytes

Df(s,n)s[n]==s[Ss)-1-n]

Try it online!

Substitutions in this program:

Crystal, 26 24 Bytes

def c(s,n)s[n]==s[~n]end

-2 Bytes from Felipe Nardi Batista, thanks.

Try it online!

REXX, 41 bytes

parse arg n,=(n)l+1''-(n)r+1 .
return l=r

Arguments are given in n,s order since n is required for parsing s.

Clojure, 27 bytes

#(nth(map =(reverse %)%)%2)

Wow, this was shorter than I expected.

Python, 24 22 bytes

-2 bytes thanks to Adnan.

lambda s,n:s[n]==s[~n]

Try it online!

C++, 57 Bytes

Assuming header includes don't count.

bool c(std::string s,int i){return s[i]==s[s.size()-i];}

Ruby, 22 20 18 bytes

->s,n{s[n]==s[~n]}

Cubix, 22 bytes

..@.IAp):tBvpptc?1.\O0

1-indexed, takes input as index,string, separated by a space.

Try it online

Cubified

    . .
    @ .
I A p ) : t B v
p p t c ? 1 . \
    O 0
    . .

Explanation

This is mostly linear. The main logic is

IAp):tBpptc

IA           Get the first input as an int and the rest as a string.
  p):        Move the index to the top of the stack, increment it, and copy it.
     t       Look up the appropriate character in the string.
      Bpp    Reverse the stack and put the index and character back on top.
         t   Look up the appropriate character in the reversed string.
          c  XOR the two characters.

We then branch with ? to Output 1 if the result is 0 and 0 otherwise.

R 51 bytes

function(s,n){s=el(strsplit(s,''));s[n]==rev(s)[n]}

Anonymous function, uses 1-based indexing

Lua, 35 bytes

Uses 1-indexing.

s,n=...print(s:byte(n)==s:byte(-n))

Try it online!

CJam, 8 bytes

l~_W%.==

Try it online!

0-indexed index goes first.

Pyth, 8 7 bytes

q@zQ@_z

With the input reversed: first the index, then the string. It is 0-indexed.

Explanations:

q@zQ@_z
 @zQ        Get the nth (Qth) character
     _z     Reverse the string
    @       Get the nth character of the reversed string. Implicit input of the index
q           Test equality

Try it online!

PHP>=7.1, 36 Bytes

[,$t,$p]=$argv;echo$t[$p]==$t[~+$p];

Online Version

C, 73 bytes

Compiles as-is with GCC 6.3.1 (no flags). Some unnecessary obfuscation included.

main(c,v)char**v;{c=atoi(v[2]);putchar((*++v)[c]-(*v)[strlen(*v+1)-c]);}

Usage

$./a.out abcdcba 6

Truthy = nothing, falsey = garbage.

C#, 28 27 bytes

s=>n=>s[n]==s[s.Length+~n];

Saved a byte thanks to @KevinCruijssen.

Compiles to a Func<string, Func<int, bool>>.

Java 8, 43 42 bytes

s->n->s.charAt(n)==s.charAt(s.length()+~n)

Try it here.

><> (with this interpreter), 25 bytes

i:0(?v
]&=n;>~{:}[:}]&r[}

It doesn't work in TIO: the TIO interpreter doesn't reverse the new stack when doing the [ instruction, but the fish playground does — compare "abcde"5[ooooo; run here and here, for example.

The string input is taken from STDIN, and we assume n is already on the stack. Uses 1-indexing.

The fish gets the nth character with [:}]&, which siphons off the first n things on the stack into a new, reversed stack, manipulates that a bit, then puts the things back and saves the nth character in the register. It then reverses the whole stack and does the same again, and returns 1 if the two characters are equal, and 0 otherwise.

This seems to work at TIO, for 26 bytes:

i:0(?v
]&=n;>~{:}[{:}]&r[{

CJam, 11 bytes

q~_2$=@@~==

Bad. Too much stack manipulation.

Alice, 24 bytes

/t.~e?/-mom
\I!RtI&1n;@/

Try it online!

Input consists of the string on one line, and the number on the second line. Output is Jabberwocky if the characters are the same, and nothing otherwise.

Explanation

This program is mostly in ordinal mode, with one command in cardinal mode. Linearized, the program is as follows:

I.ReI&1m;mt!~t?&-no

I  % Input first line
   % STACK: ["ppqqpq"]
.  % Duplicate top of stack
   % STACK: ["ppqqpq", "ppqqpq"]
R  % Reverse top of stack
   % STACK: ["ppqqpq", "qpqqpp"]
e  % Push empty string
   % STACK: ["ppqqpq", "qpqqpp", ""]
I  % Input next line
   % STACK: ["ppqqpq", "qpqqpp", "", "3"]
&  % (cardinal mode) Pop stack and repeat next command that many times
   % STACK: ["ppqqpq", "qpqqpp", ""], ITERATOR: [3]
1  % Append "1" to top of stack
   % STACK: ["ppqqpq", "qpqqpp", "111"]
m  % Truncate so the top two strings on the stack have the same length
   % STACK: ["ppqqpq", "qpq", "111"]
;  % Discard top of stack
   % STACK: ["ppqqpq", "qpq"]
m  % Truncate again
   % STACK: ["ppq", "qpq"]
t  % Extract last character
   % STACK: ["ppq", "qp", "q"]
!  % Move top of stack to tape
   % STACK: ["ppq", "qp"]
~  % Swap
   % STACK: ["qp", "ppq"]
t  % Extract last character
   % STACK: ["qp", "pp", "q"]
?  % Copy data from tape onto top of stack
   % STACK: ["qp', "pp", "q", "q"]
&  % Iterator: effectively a no-op in ordinal mode when the top of the stack is a 1-character string
   % STACK: ["qp", "pp", "q"], ITERATOR: ["q"]
-  % Remove occurrences: here, result is "" iff the characters are equal
   % STACK: ["qp", "pp", ""]
n  % Logical Not (for a consistent truthy value)
   % STACK: ["qp", "pp", "Jabberwocky"]
o  % Output top of stack

Perl 6, 27 bytes

{[eq] $^a.comb[$^b,*-1-$b]}

Test it

{ # bare block lambda with two placeholder parameters 「$a」 and 「$b」

  [eq]        # reduce using string equality operator

    $^a       # declare first positional parameter

    .comb\    # split that into individual characters

    [         # index into that sequence

      $^b,    # declare and use second parameter

      *-1-$b  # closure that subtracts one and the 
              # second parameter of the outer block
              # (「*」 is the parameter of this closure)

    ]
}

Mathematica, 34 Bytes

s=StringTake;s[#,{#2}]==s[#,{-#2}]&

QBIC, 18 bytes

?_s;,:,1|=_sA,-a,1

Explanation

?        =     PRINT -1 if equal, 0 otherwise, between
 _s     |      A substring of
   ;,:,1          A$ string (read from cmd line), from the n'th pos, length 1
 _sA,-a,1      And a substring of A$, n'th pos from the right, also 1 length
               The second Substring is auto-terminated because EOF.

Haskell, 22 bytes

s#n=s!!n==reverse s!!n

0-basd. Usage example: "letter" # 1 -> True.

Try it online!

Japt, 10 9 8 bytes

gV ¥Ug~V

Try it online!

Jelly, 5 4 bytes

=UƓị

Try it online!

There should be no shorter answers in Jelly. An program would need comparison, reversal/negation, an index call, and a byte for control flow (Ɠ in this case), which adds up to four bytes.

How it works

 =UƓị 
       - (implicit) input string
 =     - equals (vectorizing by characters because a string is a charlist)
  U    - the reversed string
    ị  - get the element at the index of:
   Ɠ   - the input index

-1 byte thanks to @ais523, using Ɠ

05AB1E, 7 5 bytes

-2 bytes thanks to Adnan

ÂøsèË

Try it online! or Try all tests

     # Add a reversed copy on top of the original string
 ø    # Zip
  sè  # Extract the nth element
    Ë # Check if they are equal

Try it online!

JavaScript (ES6), 26 bytes

s=>n=>s[n]==s.substr(~n,1)

Alternatively:

s=>n=>s[n]==s.slice(~n)[0]

This one almost works, but fails when n == 0 (because s.slice(-1,0) == ""):

s=>n=>s[n]==s.slice(~n,-n)

Another 26-byte solution that @RickHitchcock pointed out:

s=>n=>s[n]==s[s.length+~n]

Octave, 22 bytes

@(s,n)s(n)==s(end-n+1)

Try it online!

Or the same bytecount:

@(s,n)s(n)==flip(s)(n)

Try it online!

Explanation:

It's quite straight forward. The first one takes a string s and an integer n as inputs and checks the n'th element s(n) against the "last-n+1" element for equality.

The second one checks the n'th element s(n) against the n'th element of s reversed.

MATL, 5 bytes

tP=w)

Try it online!

Explanation:

t   % Duplicate the input

Stack:
    ['ppqqpq' 'ppqqpq']

P   % Reverse the top element of the stack

Stack:
    ['ppqqpq' 'qpqqpp']

=   % Equals. Push an array of the indices that are equal

Stack:
    [[0 1 1 1 1 0]]

w   % Swap the top two elements

Stack:
    [[0 1 1 1 1 0], 3]

)   % Grab the a'th element of b