text:
Does the start equal the end?
The Task
In this challenge, your task is to write a program or function which takes in a String and outputs a truthy or falsey value based on whether the first character and the last character of the input String are equal.
Input
You may take input in any way reasonable way. However, assuming that the input is  present in a predefined variable is not allowed. Reading from a file, console, command line, input field etc., or taking input as a function argument is allowed.
Output
You may output in any reasonable format, except for assigning the result to a variable. Writing to a file, console, command line, modal box, function return statements etc. is allowed.
Additional Rules

The input can be empty String as well, for which you should return a falsey value.

Single-Char Input Strings should have a truthy result.

Your program should be case-sensitive. helloH should output a falsey value.

You can only have a single Truthy value and a single Falsey value. For example, outputting false for an Input String and 0 for another input String  as Falsey values is not allowed.

Standard loopholes are not allowed.

Test Cases
Input    ->    Output

"10h01"        Truthy
"Nothing"      Falsey
"Acccca"       Falsey
"eraser"       Falsey
"erase"        Truthy
"wow!"         Falsey
"wow"          Truthy
"H"            Truthy
""             Falsey

This is code-golf, so the shortest code in bytes wins!

What characters can appear in the input? Printable ASCII?

@MartinEnder Printable ASCII. Although, I don't think it matters much.

Of course it matters. Some languages can't process non-ASCII characters or null bytes, and in a regex I can match any printable ASCII character with ., but it wouldn't match linefeeds. In general, if you find yourself using the [tag:string] tag, specify exactly what characters can appear in the input.

@MartinEnder Okay. Will take care in future.

Suggested test case: AbAb => false

Jelly, 3 bytes
=ṚḢ

Try it online!

Python 3, 23 bytes
s=input()
s[0]!=s[-1]<e

Output is via exit code, so 0 (success) is truthy and 1 (failure) is falsy. If this is acceptable, a byte can be saved.
Try it online!
How it works
First of all, if s is an empty string, s[0] will raise an IndexError, causing the program to fail.
For non-empty s, if the first and last characters are equal, s[0]!=s[-1] will evaluate to False, so the program exits cleanly and immediately.
Finally, if the characters are different, s[0]!=s[-1] will evaluate to True, causing the compairson s[-1]<e to be performed. Since e is undefined, that raises a NameError.
If backwards compatibility with Python 2 is not desired,
s[0]!=s[-1]<3

works as well, since comparing a string with an integer raises a TypeError.

Save 1 byte with lambda

Yes, a regular function would also save a byte. While output via exit code is an established consensus, non-error/error for a function is not though. I've linked to the proposal in my answer.

What about using Python REPL?

I don't think that helps. It's still not an exit code.

JavaScript, 19 bytes
a=>a.endsWith(a[0])

Wow. I didn't even know that there exists an endsWith method of String object. Nice! :)

How did I forget about endsWith()?! I've been waiting for an opportunity to use it.

Brachylog, 4 bytes
h~t?

Try it online!
Explanation
h       The head of the Input...
 ~t?    ...is the tail of the Input

I really need to get round to implementing those constraint variables for the input; that'd mean we'd be able to do this in two.

05AB1E, 4 bytes
S¬Q¤

Try it online! or Try All Tests
S    # Split the input into individual characters
 ¬   # Get the first character
  Q  # Check all characters for equality to the first
   ¤ # Get the last value i.e. head == tail

ÂâćüQ to  be more confusing and to gain a byte!

ćsθQ is another 4-byter.

Just posted a 3 byter. :)

Retina, 13 12 bytes
^(.)(.*\1)?$

Try it online! Includes test suite. Edit: Saved 1 byte thanks to @Kobi.

Mathematica, 15 bytes
#&@@#===Last@#&

Takes an array of chars. Throws errors when the input is empty but can be ignored.

Nice job spotting the fact that === handles the empty case :)

Haskell, 21 bytes
c takes a String and returns a Bool.
c s=take 1s==[last s]

Try it online!

If not for empty strings, this could have been 16 bytes with c s=s!!0==last s.
take 1s gives a list that is just the first element of s unless s is empty, in which case it's empty too.
last s would error out on an empty string, but Haskell's laziness saves it: A string with a single element is always different from the empty string, without evaluating its element.

C++ (gcc), 40 bytes
[](auto s){return s[0]&&s[0]==s.back();}

Try it online!

I'm not the best in C++ (I typically use C), but could you change the instances of s[0] to *s to save two bytes each?

@MDXF, that will only work with C type arrays.

Python 2, 26 25 24 bytes
Thanks to @Dennis for saving a byte!
lambda x:""<x[:1]==x[-1]

Try it online!

Java, 81 77 bytes

-4 bytes, thanks @KevinCruijssen

Try Online
boolean f(String s){int l=s.length();return l>0&&s.charAt(l-1)==s.charAt(0);}

Returns true if they're equal, otherwise false, false for empty string

Array Version, 60 bytes
boolean f(char[]s){int l=s.length;return l>0&&s[0]==s[l-1];}

Why long instead of int?

@corvus_192 a unicode character can be 1-6 bytes.

The difference between two chars can be at most Charcter.MAX_VALUE - Character.MIN_VALUE, which is 65535

@corvus_192 I see, I've fixed it now

You can change the -1 to 2. When it would output 2 you wouldn't know if it's because the difference between the first and last char is 2 or it's an empty String, but it doesn't matter for the challenge: Simply 0 = true; everything else = false is enough.

Hmm, nevermind my previous comment.. I just read this rule in the challenge: "You can only have a single Truthy value and a single Falsey value. For example, outputting false for an Input String and 0 for another input String as Falsey values is not allowed.", which means your current answer is also not valid by returning the difference between the chars. It should become something like int f(String s){int l=s.length();return l>0&&s.charAt(l-1)-s.charAt(0)==0?1:0;} or just a boolean for the same byte-count: boolean f(String s){int l=s.length();return l>0&&s.charAt(l-1)-s.charAt(0)==0;}

@KevinCruijssen For the last, s.charAt(l-1)==s.charAt(0) would save two bytes.

An empty String is "", so boolean f(String s){return s!=""&&s.charAt(s.length()-1)==s.charAt(0);} would work, right?

@JollyJoker yes, I've changed it now, also -1 byte by inverting the check to return""!=s to remove the space

@JollyJoker nononononono! This fails for f(new String("")); You cannot assume that the strings are interned!

@SocraticPhoenix you're right, I've fixed it now.

@SocraticPhoenix Ok, you're right. And equals becomes too long so declaring the length as an int is better.

@SocraticPhoenix Then again, with all the "takes input as unary from the command line"-type restrictions in code golf answers, requiring interned strings should be a standard trick for java golfing :)

@JollyJoker possible, except that'd require writing a full program.

@JollyJoker I feel that the distinction there is that one requires a specific method of input, versus requiring a specific instance of an object which resides in the string pool.

MATL, 5 bytes
&=PO)

Try it at MATL Online!
Explanation
       % Implicitly grab input as a string (of length N)
&=     % Perform an element-wise equality check yielding an N x N matrix
P      % Flip this matrix up-down
O)     % Get the last value in the matrix (column-major ordering)
       % Implicitly display the result

In the case, that an empty input string must be handled, then something like the following (8 bytes) would work
&=POwhO)

This solution simply prepends a 0 to the front of the N x N matrix such that for an empty input, when the matrix is 0 x 0, there's still a 0 value that is then grabbed by 0)
Try it at MATL Online

Very clever approach!

Also 5 bytes: 5L)d~.

Just a heads-up: neither my comment nor your answer handle empty input. This has (in my opinion convincincly) been argued against in the comments, so I expect this requirement to change. However, as it stands, this entry is invalid.

(of course, you could do tn?&=PO)}F to deal with empty input; not sure if there is a more efficient way)

brainfuck, 43 bytes
+>,[<,[>[->+<<->],]]<[[-]-<]-[----->+<]>--.

Try it online!
Explanation
The main loop is [>[->+<<->],].  After each iteration, the cell to the right of the current position is the first byte of the string, and the cell to the left is the difference between the most recently handled character and the first.  <[[-]-<] converts the final result to -1 if nonzero, and the rest converts -1 and 0 to 48 and 49 ("0" and "1") respectively.

APL (Dyalog), 4 bytes
⊃⌽=⊃

Try it online!
Explanation
  =                     Compare
   ⊃                    The first element of the right argument with
 ⌽                      The right argument reversed
                        This will return an array of the length of the reversed argument. Each element in the resulting array will be either 0 or 1 depending on whether the element at that position of the reversed argument equals the first element of the original right argument
                        So with argument 'abcda', we compare 'a' with each character in 'adcba' which results in the array 1 0 0 0 1
⊃                       From this result, pick the first element.

Here is the reason this works on empty strings. Applying ⊃ to an empty string returns a space  . But reversing an empty string still returns an empty string, so comparing an empty string with a non-empty string (in this case  ) gives an empty numerical vector. And applying ⊃ to an empty numerical vector returns 0. Hence passing an empty string returns 0.

This is actually really cool answer, but your explanation is not right. It would be right for (⊃⌽)=⊃ or ⊢/=⊃, but neither of those give the right result. Instead ⌽=⊃ compares the reversed string to its first character, and then picks the first element of that. If the string is empty, it ends up comparing a space to an empty string, which gives an empty Boolean list, of which the (coerced) first element ⊃ is 0 – the correct answer for empty strings. Your expression is equivalent to ⊃⊃=⌽ because = is commutative.

@Adám Thank you for helping me see the mistake in my explanation.

You're welcome. Now your note is not correct. ⊃⌽=⊃ is not the same as (⊃⌽)=⊃. It is more expensive, as it compares all the elements instead of just the first and last. Also it wouldn't work had the OP used numbers instead of strings.

The first argument reversed → The right argument reversed

You may also want to explain why this works on empty strings.

@Adám I added the explanation on empty strings, is it correct?

Yes, that is correct. Now you just need to rephrase an array comparing equality between the first character of the argument with its reverse. You are not comparing the equality ;-)

Japt, 6 bytes
tJ ¥Ug

Try it online!

Hmm, doesn't work for the empty string (should give false). I think you can fix this with tJ ¥Ug

Java, 52 43 bytes
s->!s.isEmpty()&&s.endsWith(""+s.charAt(0))

To make it work, feed this into a function such as the following that makes a lambda "go":
private static boolean f(Function<String, Boolean> func, String value) {
  return func.apply(value);
}

You can shave off 9 chars using s.endsWith(""+s.charAt(0)) instead of s.charAt(0)==s.charAt(s.length()-1)

s->""!=s&&s.endsWith(""+s.charAt(0))

@JollyJoker that does not work: try feeding new String() into the lambda. It will throw an exception. Reference semantics do not work here.

@KevinCruijssen The short circuiting effect of && is necessary to avoid an index out of bounds exception on the charAt(0) for an empty string

Ruby, 26 24 bytes
Saved two bytes thanks to @philomory!
->e{!!e[0]>0&&e[0]==e[-1]}

First post on codegolf -))

Welcome to PPCG!

Welcome to PPCG! Nice first golf. Good luck for future!

You could save 4 bytes by just doing e[0]&&e[0]==e[-1], since if e is empty, e[0] will be nil. Actually, come to think of it, nil is no good since it's falsey but not the same falsey that the comparison returns; still, after adding !! you're still saving 2 characters.

JavaScript, 20 bytes
Add f= at the beginning and invoke like f(arg).
_=>_[0]==_.slice(-1)

f=_=>_[0]==_.slice(-1)

i.oninput = e => o.innerHTML = f(i.value);
<input id=i>

Explanation
This function takes in an argument _. In the function body, _[0]==_.slice(-1) checks whether the first element of _ (at 0th index) equals the last element of it, and returns the appropriate true or false boolean.

PHP>=7.1, 23 Bytes
prints 1 for equal and nothing if the character is different

<?=$argn[0]==$argn[-1];

GNU grep, 12 bytes
^(.)(.*\1)?$

Run in extended or PCRE mode.
I don't know if this is considered cheating or not.

Does this handle the empty string case?

@ConfusedMr_C Yep, empty string ⇒ code 1.

shortC, 27 26 25 24 bytes
f(C*s){T*s&&*s==s[Ss)-1]

How it works:
f(C*s){                     declare int-returning function that takes a string
       T                    return
        *s                  provided string has any length
          &&                and
            *s==s[Ss)-1]    the first character equals the last one

Try it online!

Wouldn't it be T instead of R?

@Okx Wow, can't believe I missed that!! Thanks!

@MDXF, I like your shortC concept! I will be sending you some suggestions.

Yes, will chat soon.

For me it is not ok for gain just one char make possible "Ss)-1" it has to be "S(s)-1"...(if I understand well...)

@RosLuP Nope, I improved shortC so that opening parenthesis are usually unnecessary. Check out the GitHub repo for details about this language.

><>, 39 33 bytes
 2i&01. >~&-?v1v
  i:1+?!^01. >0>n;

This is my first time both using ><> and playing code golf, so helpful suggestions would be appreciated.
The code is in three basic sections.
2i&01. Pushes an arbitrary number (2 in this case, this causes an empty string to print 0) onto the stack and puts the input's first character in the register.

>i:1+?!^01. Main loop. Pushes the next character onto the stack. If the string has been read completely, then go to the last section

>~&-?v1v
     >0>n;  Compare the first and last characters. Print 1 if they're the same, 0 if not

Hello! Welcome to PPCG! Nice first golf! Good luck for future! :)

Google Sheets, 33 Bytes
Takes input from cell [A1] and outputs 1 for truthy input and 0 for falsey input.
=(A1<>"")*Exact(Left(A1),Right(A1

It is noted that the parentheticals in Exact( and Right( are left unclosed as Google Sheets automatically corrects this as soon as the user has input the formula text and pressed enter to leave that cell.
Output

Does the version of Excel matter? In my copy of 2013, this fails because you can't use & like that. Also, it considers A=a to be true. The shortest I can get is 38 bytes: =AND(EXACT(LEFT(A1),RIGHT(A1)),A1<>"") or the alternative =IFERROR(CODE(A1)=CODE(RIGHT(A1)),1=0).

I tried it in Excel Online (16.0.9222.5051) and it returns TRUE for any non-error input. (screenshot) Does it work in your copy for all test cases? ExcelGuy has an answer that ends up like mine above for the same reasons.

@EngineerToast you are completely correct, I should have been using * instead & for the binary and statement, but that still leaves the "A"="a" issue, which I had completely overlooked. All of that and a bit of syntax corrections leads me to =EXACT(LEFT(A1),RIGHT(A1))*(A1<>"") for 35, but I have switched the language to Google Sheets, which allowed me to drop the terminal double parenthetical in the Exact statement, rendering =(A1<>"")*Exact(Left(A1),Right(A1 for 33 bytes

C#, 38 30 bytes
s=>s!=""&&s[0]==s[s.Length-1];

Saved 8 bytes thanks to @raznagul.

Instead of checking the length of s just compare it with "". Also you don't need the ?:-Operator. Using && has the same result.

@raznagul Good spots thanks, I can't check if it works at the moment so hopefully it does! Also wouldn't & have the same effect too?

@TheLeathalCoder: No just & doesn't work. With && the second expression is not validated if the first expression is false. With & the seconds expression is always validated and fails with a IndexOutOfRangeException on the empty string test case.

@raznagul Oh yeah... brain fart.

Perhaps its a bit late but you can save 5 bytes if you use s.Last() instead of s[s.Length-1]

@BojanB No I can't because I then have to include using System.Linq; into the byte count.

@TheLethalCoder, Oh Right, I keep forgetting about the usings

@BojanB No worries it takes a little bit to get used to what needs and doesn't need to be included in the byte count. And of course it changes between questions and their specs.

Swift, 46 bytes
var s=readLine()!,a=Array(s);a[0]==a.last ?1:0

Edited the code.

Welcome to PPCG! Is the space after a.last necessary?

Either I can add brackets around a.last or I can add space after a.last

R, 40 bytes
function(x)x>""&&rev(y<-charToRaw(x))==y

Thanks to Nitrodon for -2 bytes.
Thanks to MickyT for -8 bytes.
Test:
f=function(x)x>""&&rev(y<-charToRaw(x))==y
test <- c("10h01", "Nothing", "Acccca", "wow!", "wow", "H", "")
sapply(test, f)
all(sapply(test, f) == c(T, F, F, F, T, T, F))

Output:
> f=function(x)x>""&&rev(y<-charToRaw(x))==y
> test <- c("10h01", "Nothing", "Acccca", "wow!", "wow", "H", "")
> sapply(test, f)
  10h01 Nothing  Acccca    wow!     wow       H
   TRUE   FALSE   FALSE   FALSE    TRUE    TRUE   FALSE
> all(sapply(test, f) == c(T, F, F, F, T, T, F))
[1] TRUE

You can remove one set of parentheses with rev(y<-el(strsplit(x,"")))==y.

also unnamed functions are acceptable, so you can remove the f=

and charToRaw can be used to split the string for comparison function(x)x>""&&rev(y<-charToRaw(x))==y

R, 50 43 41 40 64
Second solution with 41 bytes for a callable function - thanks to @niczky12 & @Giuseppe - amended for x=""
r=function(x,y=utf8ToInt(x))ifelse(x=="","FALSE",(y==rev(y))[1])

First with 50 bytes but not for the challenge
function(x){charToRaw(x)[1]==rev(charToRaw(x))[1]}

You can replace charToRaw with utf8ToInt to produce NAs when the string is empty.

You can also remove the curly braces {} around the function body.

I think (y==rev(y))[1] is shorter by a byte

This challenge requires using only one Truthy and one Falsey value, but this produces NA for empty string but FALSE for "ab". Try it online!.

@ØrjanJohansen thanks for your comment, so  "ab" should not give FALSE?

It may give FALSE, but then the empty string must give FALSE too. I don't really know R, but reading and testing more I don't think you can use NA, because it doesn't seem to be "falsey" in if() expressions, which is the accepted PPCG definition.

Mornington Crescent, 2585 bytes
Take Northern Line to Bank
Take Circle Line to Hammersmith
Take District Line to Mile End
Take District Line to Bank
Take Northern Line to Charing Cross
Take Northern Line to Charing Cross
Take Northern Line to Bank
Take Circle Line to Hammersmith
Take District Line to Upminster
Take District Line to Hammersmith
Take Circle Line to Victoria
Take District Line to Parsons Green
Take District Line to Bank
Take Circle Line to Hammersmith
Take District Line to Upney
Take District Line to Hammersmith
Take District Line to Bow Road
Take District Line to Acton Town
Take Piccadilly Line to Heathrow Terminals 1, 2, 3
Take Piccadilly Line to Acton Town
Take District Line to Acton Town
Take District Line to Parsons Green
Take District Line to Bank
Take Circle Line to Hammersmith
Take District Line to Barking
Take District Line to Hammersmith
Take District Line to Mile End
Take District Line to Bank
Take Circle Line to Bank
Take Northern Line to Charing Cross
Take Northern Line to Charing Cross
Take Northern Line to Bank
Take Circle Line to Bank
Take Circle Line to Notting Hill Gate
Take Circle Line to Notting Hill Gate
Take District Line to Upminster
Take District Line to Upminster
Take District Line to Temple
Take District Line to Barking
Take District Line to Bank
Take Circle Line to Hammersmith
Take District Line to Upney
Take District Line to Barking
Take District Line to Hammersmith
Take Circle Line to Aldgate
Take Circle Line to Aldgate
Take Metropolitan Line to Chalfont & Latimer
Take Metropolitan Line to Aldgate
Take Circle Line to Hammersmith
Take District Line to Upminster
Take District Line to Bank
Take Circle Line to Bank
Take Circle Line to Aldgate
Take Circle Line to Aldgate
Take Metropolitan Line to Chalfont & Latimer
Take Metropolitan Line to Moorgate
Take Circle Line to Moorgate
Take Northern Line to Angel
Take Northern Line to Bank
Take Circle Line to Temple
Take District Line to Bow Road
Take District Line to Upney
Take District Line to Bank
Take Circle Line to Hammersmith
Take District Line to Bow Road
Take District Line to Hammersmith
Take Circle Line to Aldgate
Take Circle Line to Aldgate
Take Metropolitan Line to Chalfont & Latimer
Take Metropolitan Line to Aldgate
Take Circle Line to Victoria
Take Circle Line to Aldgate
Take Circle Line to Aldgate
Take Metropolitan Line to Chalfont & Latimer
Take Metropolitan Line to Moorgate
Take Circle Line to Moorgate
Take Northern Line to Angel
Take Northern Line to Bank
Take District Line to Upney
Take District Line to Bank
Take Circle Line to Bank
Take Northern Line to Mornington Crescent

Try it online!
I thougt, this was easier...
Outputs 0 for false and 1 for true
// Prepare input for right substring
Take Northern Line to Bank
Take Circle Line to Hammersmith
Take District Line to Mile End

// Get char code of first character
Take District Line to Bank
Take Northern Line to Charing Cross
Take Northern Line to Charing Cross

// Put it in Upminster for later calculation
Take Northern Line to Bank
Take Circle Line to Hammersmith
Take District Line to Upminster

// Also save it for later check for null string # Victoria = char code of first
Take District Line to Hammersmith
Take Circle Line to Victoria

// Save 0 # Upney = 0, Bow Road = 0 (for second loop)
Take District Line to Parsons Green
Take District Line to Bank
Take Circle Line to Hammersmith
Take District Line to Upney
Take District Line to Hammersmith
Take District Line to Bow Road

// Save 1 # Barking = 1
Take District Line to Acton Town
Take Piccadilly Line to Heathrow Terminals 1, 2, 3
Take Piccadilly Line to Acton Town
Take District Line to Acton Town
Take District Line to Parsons Green
Take District Line to Bank
Take Circle Line to Hammersmith
Take District Line to Barking

// Get char code of last letter of input
Take District Line to Hammersmith
Take District Line to Mile End
Take District Line to Bank
Take Circle Line to Bank
Take Northern Line to Charing Cross
Take Northern Line to Charing Cross

// Bitwise NOT, so we get -(char count)-1
Take Northern Line to Bank
Take Circle Line to Bank
Take Circle Line to Notting Hill Gate
Take Circle Line to Notting Hill Gate

// Add it to the char code of first letter. If they match, the result is -1.
Take District Line to Upminster

// Save the result in Upminster
Take District Line to Upminster

// ********************************************************************************
// * Add some logic. This is quite puzzling because the only control structure    *
// * in Mornington Crescent is a post-test loop. You don't have something like    *
// * an if-else. You can't skip code. You can only define how often a loop should *
// * be repeated.                                                                 *
// * My solution to this is: When checking if the first and last character        *
// * are the same (first char code - last char code = 0), I swap the positions    *
// * of the 0 and 1 variables, then multiply the result of the equality check     *
// * with the new position of 1. If the characters are the same, the loop will    *
// * exit after the first run. If not, it will run another time, swapping the     *
// * 0 and 1 back and exiting after the second run, because it multiplies the     *
// * new equality check with 0.                                                   *
// ********************************************************************************

// Set starting line of loop
Take District Line to Temple

// Swap 0 and 1 # Upney = 1, Barking = 0 (on the first run)
Take District Line to Barking
Take District Line to Bank
Take Circle Line to Hammersmith
Take District Line to Upney
Take District Line to Barking

// Save 1 in Chalfont & Latimer for later multiplication
Take District Line to Hammersmith
Take Circle Line to Aldgate
Take Circle Line to Aldgate
Take Metropolitan Line to Chalfont & Latimer

// Add 1 to Upminster, to check for equality
Take Metropolitan Line to Aldgate
Take Circle Line to Hammersmith
Take District Line to Upminster

// Multiply the result with 1 in the first run, or 0 in the second run
Take District Line to Bank
Take Circle Line to Bank
Take Circle Line to Aldgate
Take Circle Line to Aldgate
Take Metropolitan Line to Chalfont & Latimer

// If the result is not 0, run the loop again
Take Metropolitan Line to Moorgate
Take Circle Line to Moorgate
Take Northern Line to Angel

// **********************************************************************
// * Another control loop to check for empty string.                    *
// * The previous loop will return true if an empty string was entered. *
// **********************************************************************

// Set start of loop
Take Northern Line to Bank
Take Circle Line to Temple

// Swap 0 and 1 # Upney = 0, Bow Road = 1 (on the first run, if previous loop ran once)
//              # Upney = 0, Bow Road = 0 (if previous loop ran twice)
Take District Line to Bow Road
Take District Line to Upney
Take District Line to Bank
Take Circle Line to Hammersmith
Take District Line to Bow Road

// store 1 in Chalfont & Latimer for later multiplication
Take District Line to Hammersmith
Take Circle Line to Aldgate
Take Circle Line to Aldgate
Take Metropolitan Line to Chalfont & Latimer

// Multiply by char code of first char (0 if empty string)
Take Metropolitan Line to Aldgate
Take Circle Line to Victoria
Take Circle Line to Aldgate
Take Circle Line to Aldgate
Take Metropolitan Line to Chalfont & Latimer

// Loop again if input not empty
Take Metropolitan Line to Moorgate
Take Circle Line to Moorgate
Take Northern Line to Angel

// Fetch result and go home for output
Take Northern Line to Bank
Take District Line to Upney
Take District Line to Bank
Take Circle Line to Bank
Take Northern Line to Mornington Crescent

BRASCA, 3 bytes
This looks like a job for M!
M=n

Try it online!
Explanation
M        - Move the bottom of the stack to the top
 =       - Are they the same? Push 1 if it is, 0 if it isnt.
  n      - Output as number.

Knight, 20 bytes
O<!=xP?AxA Gx-Lx 1 1

Try it online!
Takes a line from stdin and prints true if equal and false otherwise.
O                           Output the result of:
  < ! (= x P)                 x = input; x is not null and
    ? A x                       the first char's ord is equal to
      A (G x (- L x 1) 1)       the (length-1)th char's ord

You could save a few bytes by going Gx-Lx 1 1 to Gx-LxT1

Fireball, 4 bytes
d1╡├

Explanation:
d      Duplicate implicit input
 1╡    Get the first character
   ├   Check whether the input ends with the first character

Alternative program:
d↔♥├

Explanation for the alternative program?

@MDXF It's pretty much the same. ╡ gets the first n characters, 1 in this case, and ↔♥ just gets the first character.

I have removed the striked 6. If you want to show that there was a 6-byte version, please include it in the post, otherwise it doesn't make sense. ;)

@EriktheOutgolfer I've seen plenty of answers where previous versions weren't shown in the answer, as there's a thing called revision history. Edit: Never mind, the 6 byte wasn't in the revision history.

@EriktheOutgolfer When you change your answer within 5 minutes you won't see the history of it. I had it a few times myself, posting an answer, realizing I can golf it 3 minutes later, and when you change it it's not showing any history, but it does show the crossed out byte-count of the previous answer.

@KevinCruijssen I know that happens, except if someone else comments. Anyways it didn't make sense at all right there.

Sorry to bother, but if I may ask, what has happened to the Fireball repo?

JavaScript (ES6), 25 bytes
s=>/^(.)(.*\1)?$/.test(s)

21 bytes if we can return true for the empty string.
s=>s[0]==[...s].pop()

Try it

f=
s=>/^(.)(.*\1)?$/.test(s)
o.innerText=f(i.value="10h01")
i.oninput=_=>o.innerText=f(i.value)
<input id=i>

Fails for test cases Acccca and wow!. I think this needs ^ and $ in the regex.

Octave, 16 bytes
@(s)s(1)==s(end)

It takes a string s as input, and compares the first s(1) element with the last s(end).
This could be @(s)s(1)-s(end) if it was OK to swap true/false to false/true.

out of bound for empty string...

Common Lisp, 83 74 61 58 bytes
Original: 83 bytes
I've just started learning Common Lisp, so I feel like I'm bringing a putter to a driving range. There must be some kind of recursive macro wizardry or array manipulation possible here that I'm not seeing.
This is an anonymous function that accepts a string as its input:
(lambda (s) (let ((n (- (length s) 1))) (when (> n 0) (eq (char s 0) (char s n)))))

Prettified:
(lambda (s)
  (let ((n (- (length s) 1)))
    (when (> n 0)
      (eq (char s 0)
          (char s n)))))

Would love to see a slicker solution!
Revision 1: 74 bytes
Gotta love those standard library functions!
Ugly:
(lambda (s) (when (> (length s) 0) (eq (elt s 0) (elt (reverse s) 0))))

Pretty:
(lambda (s)
  (when (> (length s) 0)
    (eq (elt s 0)
        (elt (reverse s) 0))))

Revision 1.5: 61 bytes
Whitespace!
(lambda(s)(when(>(length s)0)(eq(elt s 0)(elt(reverse s)0))))

Revision 2: 58 bytes
Ugly:
(lambda(s)(and(>(length s)0)(not(mismatch s(reverse s)))))

Pretty:
(lambda (s)
  (and (> (length s) 0)
       (not (mismatch s (reverse s)))))

That's all for now! I think I'm smarter already.

Suggest if instead of and and (mismatch(reverse s)s) instead of (mismatch s(reverse s))

S.I.L.O.S, 81 bytes
loadLine
a=256
c=get a
lblb
t=s
s=get a
a+1
if s b
t-c
if t d
i+1
lbld
printInt i

Try it online!

AWK, 29 34 bytes
This one might be cheating slightly, because it requires invoking AWK with the option:
`-F ''`

In GNU Awk you can use the long-form synonyms:
`--field-separator=''`

So I added 5 bytes to the total to account for this.
Ugly:
NR==1{a=$1}END{print(a==$NF)}

Pretty:
NR == 1
{
    a = $1
}

END
{
    print(a == $NF)
}

I believe the rule is that you can use flags/options, but you need to include them in the byte count.

With the -F '' in effect, I think this will work 1,$0=$1==$NF

C, 50 40 36 bytes
Saved 10 bytes thanks to Dennis.
#define f(s)(*s&&*s==s[strlen(s)-1])

Equates to 0 if the first and last characters are different, or if the string is empty.
You could call f with something like:
int main(void)
{
    char s[100] = {0};
    gets(s);
    printf("%d\n",f(s));
}

Or, try it online!

You could save one more byte by changing the logical AND (&&) comparison to a bitwise AND operation (&).

@CodyGray I don't think that would work if *s was odd.

Pyth, 9 bytes
.xqhzez!1

Try it online!
Could make it 5 bytes if I didn't have to deal with "", probably even less if I was good at Pyth.

consistency @Svetlana it has to return a false value to keep with the false value returned by q

Casio Basic, 46 bytes
StrLeft s,1,a
StrRight s,1,b
Print judge(a=b)

Strings aren't very nice to work with in this language. We need to take the first character from the left and right of the string, assign them to a and b, then print whether a is equal to b.
45 bytes for the code, 1 byte to enter s as parameter.

Python 3, 31 24 Bytes
lambda a:a[0]==a[-1]!=''

Old code:
def f(a):return a[0]==a[-1]!=''

This is pretty self explanatory; It takes a string a and checks if the first and last chars are equal, but I then had to add the !='' in order to satisfy the requirement "The input can be empty String as well, for which you should return a falsey value" because Python returns True for an empty string.
EDIT:
-7 Bytes thanks to @numbermaniac

You could save bytes by making this a lambda, so you wouldn't need the word return.

I'm not so good at lambdas, I did originally consider doing it but I couldn't get them working: lambda a: a[0]==a[-1]!='' returns <function <lambda> at ...>

Yeah, it returns a lambda function, which you can then assign to a variable to use. In this case, to use it would be f=lambda a: a[0]==a[-1]!='' and then simply f("whatever"). But you don't need to assign it to f to answer the question, so your lambda is fine.

This gives an IndexError when called on an empty string. Not sure if that's within the rules.

Ruby, 16 17 bytes
Outputs true or false. Now with fixed syntax error.
p !! ~/./&~/#$&$/

Try it online!

The TIO link gives a syntax error. If I add a space before ~ it runs, but it uses two different falsy values, which the OP forbids.

p !!(~/./&&~/#$&$/) works.

@ØrjanJohansen Fixed. I didn't use your solution, though; I found a shorter solution by leveraging Ruby's bitwise AND when literal true/false is the first operand.

Python, 51 bytes
s=input()
if s:print(s[0]==s[-1])
else:print(False)

Try it online!

Welcome to PPCG and nice first answer! This solution can be golfed by not using if-else statements like so: Try it online!

Bash, 37 bytes
[ -n "$1" ]&&[ ${1:0:1} == ${1: -1} ]

Takes command line input and returns with exit status 0 (truthy) or 1 (falsy).
Test with:
bash test.sh "helloH" ; echo $?

The -n operator is the same as no operator, so you can remove it. The equality operator may be written as single =. As the substring expansion expects arithmetic expressions, so if offset is empty string (${1::1}), will still evaluate to 0. And instead a list of 2 simple expressions you can use a single compound expression: [ "$1" -a ${1::1} = ${1: -1} ]. Or in Bash-specific way: [[ $1 && ${1::1} = ${1: -1} ]]. The later having the advantage of not crashing when input contains whitespace characters.

PowerShell, 24 bytes
!("$args"[0,-1]|gu).Rank

Try it online!

Labyrinth, 27 20 bytes
,)!@
 : !
,} _
")=-:

Try it online!
-7 bytes thanks to Jo King.
Basic flow goes like this: start at the upper left corner, filter away the empty input at the first T-junction, take the rest of the string at the 2x2 loop, and test for equality at the last T-junction.
How it works
x marks the alternative paths at junctions, which should make the explanation easier to follow.
,)!@   Take char input (possibly EOF == -1), increment
 x     If EOF, top is 0, so go straight, print 0 and halt

 x     Otherwise, the string is not empty
 :     Duplicate the first char and move to aux. stack
,}     Go around the 2x2 loop `,")}`:
")x    Take next char input, increment, move to aux. stack
       until it hits EOF, where the stack is [first 0 | last ... first]
  @
  !    `=`: Swap the top of two stacks, giving [first last | (ignored)]
  _    Then calculate first - last
x=-x   If nonzero, take the north branch `_!@`: Push 0, print, halt

x)!@
 :     If zero, go all the way back to the first branch
x} x   (Eventually print 1 and halt)
x)=-:

Lexurgy, 27 bytes
a:
([]$1) []* !$1=>*
[]+=>a

Outputs an empty string for falsey, and a otherwise.
Explanation:
a:                # change...
([]$1)            # the first character
       []*        # then 0 or more any character, regex /.*/
           !$1    # then a character that's not the first
              =>* # change to an empty string
# equivalent regex: /(.).*\1/
[]+=>a            # replace the leftovers with "a"

Julia, 22 bytes
!s=s>""&&s[1]==s[end]
Attempt This Online!

MUMPS, 27 bytes
 w x]""&($e(x)=$e(x,$l(x)))

Try it online!

There is a leading space character so w is interpreted as a command and not a label.
w is short for the write command which prints the following expression to the console.
x]"" checks that x is not empty. ] is the "follows" operator and everything non-empty follows the empty string.
$l is short for $length which returns the length of a string.
$e is short for $extract which gets characters from a string. $e(x) gets the first character of x and $e(x,$l(x)) gets the last character of x.

It could be further reduced to 23 bytes in Intersystems Caché/IRIS by replacing $l(x) with *.
 w x]""&($e(x)=$e(x,*))

Welcome to Code Golf! For TIO, the Footer field will just be appended to the code, with a newline IIRC. The Input is just fed into the interpreter/compiled binary's STDIN, and each of the Arguments are command line options for the interpreted code/compiled binary. I'm not sure how MUMPS uses its STDIN/command line arguments, though.

Thanks, that helped clear up a little confusion. I've never used M with command line arguments so I'll just have to figure that out.

C#, 25 21 bytes
Uses the index operator ^ from C# 8 to get the last character in the string.
x=>x!=""&&x[0]==x[^1]

Try it online!
-4 bytes thanks to the default

You can remove the parentheses around x and use x!="" instead of x.Any().

Python, 31 bytes
lambda x:bool(x)and x[0]==x[-1]

You can eliminate the explicit call to bool and save 5 bytes:
lambda x:x and x[0]==x[-1]

@musicman523 It wouldn't follow the rules then.

My bad (see thread above)

J, 8 bytes
1 byte thanks to Kritixi Lithos.
1{.{.=|.

Try it online!

7 bytes: {:@{.@=

Python 2, 36 35 bytes
-1 byte thanks to Erik the Outgolfer
lambda s:s[0]==s[-1]if s else False

Try it online!

You can use and instead of conditionals and save many bytes: lambda s:s and s[0]==s[-1]

If I try to golf further, I'll end up copying the other answers.

@musicman523 that does not work for the empty string

@Mr.Xcoder It would return the empty string, I thought this would be considered a falsey value since bool('') == False

@musicman523 Answers to this challenge have to choose a specific falsey value to return. You're not allowed to output '' for some inputs and False for others.

You could use a shorter false like 1>2.

Standard ML - 52 54 bytes
open String
fn s=>s<>""andalso sub(s,0)=sub(s,size s-1)

This raises uncaught exception Subscript, you need size s-1.

QBIC, 12 11 bytes
?_s;|=_s_fA

Explanation:
?              PRINT
     =         -1 if equal, 0 if not, between
 _s;|          QBIC's Substring function takes a variable amount of parameters.
                 With only a string as argument it takes the leftmost char of it.
                 The ; takes a string from the cmd line and names it A$
                 | closes the call to Substring
      _s_fA    _f flips string A, _s without arguments takes the left 1 char again.

Original 12 byter, which takes a substring of 1 from the left and 1 from the right:
?_s;|=_sA,-1

Explanation of the second substring:
      _sA,-1   Another call to Substring
                 A$ is implicitly defined by the ; in the other substring
                 -1 sets the starting index at the last position
                 No argument for length = 1 char by default.
               No closing |, auto-added at EOF

CJam, 6
q_W>#!

Try it online
Explanation:
q_     read and duplicate the input
W>     get the substring starting from the last position (W=-1)
        the result is empty if the input is empty
#      find the position of that substring within the initial string
        a bit surprising, position of empty string within itself is -1 (not found)
!      negate (0->1, non-zero->0)

Note: I consider the behavior of # with an empty substring to be a bug in CJam⩽0.6.5 and I will probably fix it in the next version. It's useful for this challenge though.

C, 34 bytes
f(char*s){s=*s&&*s==s[puts(s)-2];}

Try it online
C, 35 bytes
f(char*s){s=*s&&!strrchr(s,*s)[1];}

Try it online

Java 8, 29 bytes
s->s.matches("^(.)(.*\\1)?$")

Port of @Neil's Retina answer.
Try it here.

Brain-Flak, 51 bytes
Includes +1 for -a
{(<([({})<{({}<>)<>}<>>]{})((){[()](<{}>)}{})>)}{}

Try it online!
Outputs 1 on top of the stack for truthy, and either nothing or 0 on top of the stack for falsy. These are consistent with Brain-Flak's "if" statement: {...}.
{(<                                          >)}{} # If there is input...
     ({})<            >                            #   Evaluate to the first char after...
          {({}<>)<>}<>                             #     reversing the entire stack
   ([                  ]{})((){[()](<{}>)}{})      # Check if the top 2 are equal
                                                   # I.e. first == last

Some competition :)

Perl 5: 28 bytes
exit$ARGV[0]=~/^(.)(.*\1)?$/

Similar to perl 6 but it seems to be shorter as a program.

PowerShell, 42 bytes
$a=(read-host);$a-ne""-and$a[0]-ceq$a[-1]

Brain-Flak, 55 bytes
(({})<(())>)({}[<{({}<>)<>}><>{}]<>)((){[()](<{}>)}{})

Try it online!

I don't think this works for single character input or empty input.

Actually, 10 bytes
;;lb)F@N=*

Try it online!
Explanation:
;;lb)F@N=*
;;          copy input twice
  lb        length of input, cast to boolean
    )F      first character
      @N    last character
        =   compare equality
         *  multiply by boolean casted length (to make empty strings falsey)

This fails for an empty string.

@ØrjanJohansen Fixed

Excel VBA, 52 48 40 38 37 36 34 Bytes
Anonymous VBE immediate window function that takes input of type variant and expected type variant\String from cell [A1] on the ActiveSheet object and outputs boolean response to the VBE immediate window.
?[A1]<>""=([Left(A1)]=[Right(A1)])

Fails on blank cell. Returns error message instead of falsey.

@EngineerToast I have corrected for this, though it was more costly than I would have hoped

I never knew you could use bracketed addresses as a shorthand for the cell value from the active sheet. I learned a thing. Also, I think you can save 4 bytes with Left(a,1)=Right(a,1) instead of the Mids. Right?

You are absolutely correct @EngineerToast, and on top of that it Left and Right do not return error on empty string input so I can drop the If statement! Thanks :)

Perl 5, 22+1 (-p flag)=23 bytes
/^(.).*(.)/;$_=$1 eq$2

Outputs 1 for truthy and an empty string for falsey.

REXX 32 Bytes
a=arg(1)
say abbrev(a,right(a,1))

Tests if the last character is a valid abbreviation of the whole string.

Chip, 91+3 = 94 bytes
*Z~.
,-{mA
>{xmB
|BA|
|CD|AvB
>{xmC+G
>-{mD+H
>{-mE+~t
>x{mF^S
|EF|
|HG|
>x{mG
>{-mH
Z--)~a

+3 for -z
Outputs the byte 0x0 for falsey, and 0x1 for truthy. This is a lot bigger than I was hoping, sadly.
Try it online! (Note about the TIO: it includes an extra line e*f to map the output to ASCII digits. TIO also includes the verbose flag -v, which gives extra debug output via stderr.)
The first line produces a signal on only the first byte, allowing us to store that byte's bits, and to detect the empty string. (If we could give a truthy value for the empty string, -3 bytes.)
The last line deals with output, producing truthy only if the first and most recent bytes match, and if it isn't the first byte. Output is given one byte after the end of the input, with the help of -z. If not, we would be unable to detect the end of the string. (If we swapped truthy and falsey, -2 bytes, or if combined with empty string savings above, -4 for the both.)
The blob to the right, surrounding the +'s, is what triggers the end of input behavior. This actually looks for a zero byte, meaning that incorrect results may occur if one is given as input.
The remainder of the elements perform the actual comparison. This comparison performed is equivalent to, in C-ish: !(input[0] xor input[n]). In Chip, however, this must be performed for each bit individually, hence the eight sets of memory cells m, xor-gates {, and so on.
There is an interesting caveat to this implementation, in that it can handle 8 bits, but is unaware of unicode. So, effectively, this compares the first and last bytes, rather than chars.

Uh! That's a lot of explanation! Thanks for that! :)

Yeah, but I figured it would be rather opaque without it. As far as I'm aware, I'm the only one that's used this language more than trivially. :P

J, 12 bytes
'({.={:)*.*@#

{. means start, = means equals, and {: means end. *.*@# means "logical and with the length of the string", i.e., if the length is 0, it returns 0.

Axiom, 30 bytes
f(a)==(#a=0=>false;a.1=a.(#a))

this below seems not to be ok
f(a)==(#a=0=>false;a.#a=a.1)

TI-Basic (TI-84 Plus CE), 17 bytes
sub(Ans,1,1)=sub(Ans,length(Ans),1

Run with "string":prgmNAME. Returns 1 for true and 0 for false.

Powershell, 30 bytes
"$args"|%{!($_[0]-$_[-1]+!$_)}

Try it online

Clojure: 21, 27 or 34 bytes
depending on the handling of "" test case
true for "aba" and "", false for "abc":
#(=(first %)(last %))

true for "aba", nil for "", false for "abc":
#(first(map =(reverse %)%))

true for "aba", nil for "" and "abc":
#(or(first(map =(reverse %)%))nil)

This fails for the empty string.

In comments it was discussed whether it makes sense to define the "correct" answer for an empty string. In Clojure first and last return nil (null) for empty sequences, and nil = nil.

The discussion ended with keeping the empty string test case as false, because so many answers already had adapted to it.

PowerShell, 25 Bytes
($a="$args")[0]-ceq$a[-1]

gets the first char and last char, performed a case-sensitive comparison of them.

q/kdb+, 21 20 18 bytes
Solution:
{#:[x]&(1#x)~-1#x}

Example:
q){#:[x]&(1#x)~-1#x}"abc"
0
q){#:[x]&(1#x)~-1#x}"abca"
1
q){#:[x]&(1#x)~-1#x}""
0

Explanation:
Take the first and last elements of the list, check for equality (return boolean 1 or 0), then check length of string, return the minimum of these two results.
{                } / anonymous lambda function
             -1#x  / take (#) 1 item from end of list
       (1#x)       / take (#) 1 item from start of list
            ~      / are they equal
 #:[x]             / count (#:) length of list x
      &            / minimum

Ruby, 22 20 bytes
->x{x[0]===x[-1]||p}

Excel, 38 bytes
=1*IFERROR(CODE(A1)=CODE(RIGHT(A1)),0)

Surprisingly longer than I expected, in order to get the same truthy/falsy for all cases.  Text conditionals ignore case by default in excel, so "A"="a" is TRUE.  Empty cells yield an error for CODE().  Multiplied by 1 to force everything to a number, rather than having TRUE, FALSE, or 0 cases.

Batch, 52 bytes
@set s=!=
@set/ps=
@if "%s:~,1%"=="%s:~-1%" echo 1

Outputs 1 if equal, nothing if not. set/p doesn't change the variable if nothing is entered, so I can initialise it to a failure case, and != seemed appropriate.

Perl 6,  18  17 bytes
{?m/^(.)[.*$0]?$/}

Test it
{?/^(.)[.*$0]?$/}

Test it
Expanded:
{  # bare block lambda with implicit parameter ｢$_｣

  ?        # Boolify the following

  /        # match implicitly against ｢$_｣

    ^      # beginning of string

    (.)    # character ｢$0｣

    [

      .*   # followed by any number of characters
      $0   # and itself

    ]?     # optionally (Str with a single char)

    $  # end of string
  /
}

Save a byte: {?/$(/^./&&$/)$/}: matches a character at the start, then if true matches $/ before the end. { ? / $(/^./ && $/) $/ }

Or even just delete the m...

Husk, 4 bytes
Γ·=→

Try it online!
Takes a string as an argument to the program, returns 0 for falsy cases and 1 for truthy cases.
Explanation:
Γ is list deconstruction. The version I'm using (listN) takes a binary function and returns a function that takes a list. This new function returns the default type (0 in this case) for an empty string, and otherwise applies the given function to the head and tail of the string. The binary function I'm giving it is = (equality), composed on the second argument (·) with → (last element of a list).

Tcl, 34 bytes
proc C s {regexp ^(.)(.*\\1)?$ $s}

Try it online!

Vim, 30 bytes
:s/\v^(.)(.*\1)?$/1
:s/^..\+/

Leaves you with 1, if the string starts and ends with the same character, or nothing, if it doesn't.

Julia 0.6, 29 bytes
f(x)=x==""?false:x[1]==x[end]

Try it online!

SmileBASIC 3, 36 bytes
In SmileBASIC, 0 is false and 1 (or nonzero) is true.
LINPUT S$L=LEN(S$)?L&&S$[0]==S$[L-1]

Explainer:
 LINPUT S$                'read line from console to string S$
 L=LEN(S$)                'store length of line in L
 ? L && S$[0] == S$[L-1]
'| |          |
'| |          \-----------first char equals last char
'| \----------------------length is false if zero, && shortcuts
'\------------------------print

><>, 11 bytes
l?!<{:}=n;!

Try it online!
Takes input through the -s flag. You'll need to remove the flag for an empty input.
How it works
l?!<  Go right if there is input, left is there is none
    {:  If there is input, rotate the stack and dupe the first element
        This creates two copies of a one character input
      }=n;  Print if the last character is equal to the first
l  If there is no input, push the length of the stack (0)
        n;!  Wrap around and print the 0

Brachylog, 4 bytes
h.&t

Try it online!
and
Brachylog, 4 bytes
h~t?

Try it online!
are both predicates which try to unify the first and last elements of the input, outputting through success or failure (which prints true. or false. when it's run as a program).

GolfScript, 7 bytes
)\(@=\;

Try it online!
Explanation
)       # The last character
 \(     # And the first character
   @=\; # Are they equal

Burlesque, 6 bytes
l_-]==

Try it online!
l_ # Non-destructive tail, leaving the rest of the string on top of the stack
-] # Destructive head
== # Equal

MAWP, 21 29 bytes
|1A<1:.>1M\%_1A<1:.>\A{0:.}1:

Try it!
Fixed for empty input(and single character input, after Lyxal pointed out). If input is empty, it checks if the existing 1 on the stack is still at the top. then checks the length of the input.

05AB1E (legacy), 3 bytes
Ć`Q

Try it online or verify all test cases.
Explanation:
Ć    # Enclose the (implicit) input-string; append its own head
 `   # Pop and push all characters separated to the stack
  Q  # Check if the top/last two are the same
     # (after which the result is output implicitly)

The empty test case only works in the legacy version of 05AB1E, because Q on an empty stack and without input is apparently falsey. Whereas in the new version of 05AB1E an empty input is interpret as an empty string, in which case ""=="" is truthy.

Vyxal, 3 bytes
Ṙ=h

Try it Online!
Input as a list of chars.

Perl 5 + -plF, 15 bytes
This matches the char at the last index of @F ($#F) against the beginning of the string (/^.../) and sets $_ to the result only if $_ is truthy (non-empty).
$_&&=/^$F[$#F]/
Try it online!

Perl 5 + -plF/^.*(.)$/, 11 bytes
If we abuse -F so that it will only include the final char, we can save four more bytes. The trailing /x is necessary as @F will contain two indices, empty string at 0 and the desired char at 1 which when interpolated results in a leading space.
$_&&=/^@F/x
Try it online!

K (ngn/k), 16 15 10 bytes
{0^*|x=*x}

Try it online!
-5 bytes thanks to ngn!

(*|x)~*x could be *|x=*x and then you can use a zero fill for the case of empty input: {0^*|x=*x}

9 bytes: 0^*|=/*:\ though you'll need to change your "H" test line to something like f@,"H" ("H" is a char, not a string).

{0^*x=|x} is another 9 byter

brev, 48 bytes
(as-list(fn(if(null? x)#f(eq?(car x)(last x)))))

Examples:
(map (as-list(fn(if(null? x)#f(eq?(car x)(last x)))))
     '("10h01"
       "Nothing"
       "Acccca"
       "eraser"
       "erase"
       "wow!"
       "wow"
       "H"
       ""))

The null check adds a lot!

Go, 50 49 bytes
func(s string)bool{return""<s&&s[0]==s[len(s)-1]}

Attempt This Online!

-1 by @The Thonnu

-1 by replacing the != with <

Japt -¡, 5 bytes
©Î¶UÌ

Try it
©Î¶UÌ     :Implicit input of string U
©         :Logical AND with
 Î        :First character of U
  ¶       :Is equal to
   UÌ     :Last character of U
          :Implicit output as a Boolean

I take it this is Japt, did you mean to forget the header?

I managed to overwrite my post with the explanation somehow, @lyxal! :\

Golang, 27 bytes
if n[0:1] == n[(len(n))-1:]

Full Program
package main
import (
    "fmt"
)
func f(x string) string {
    if x[0:1] == x[(len(x))-1:] {
        return "Truthy"
    } else {
        return "Falsey"
    }
}
func main() {
    var n string
    fmt.Scanf("%q", &n)
    fmt.Printf("%q", f(n))
}

Try it online!

Cubix, 20 bytes
@O0UA?n\.\1.1\2ntc?U

Returns 0 for false and 1 for true.
Cubified:
    @ O
    0 U
A ? n \ . \ 1 .
1 \ 2 n t c ? U
    . .
    . .

explanation:
A - read in input as chars; so input of abc has the stack -1,99,98,97
? - turn left if negative (empty string), right if positive
if negative:
   0 - push 0
   U - left u-turn
   O - output as int
   @ - end program
if positive:
\ - reflect so we are moving to the right
2 - push 2
n - negate top of stack
t - pop top of stack, move that item from the bottom to the top; moves the last character to top of stack
c - xor
? - turn right if positive, go straight if negative
if 0:
   U - left U-turn
   1 - push 1
   \ - reflect so we point up
   O - output 1
   @ - end program
if positive
   n - negate
   \ - reflect
   n - negate
   ? - righthand turn
   0 - push 0
   U - lefthand U-turn
   O - output
   @ - end program

Try it online!
Watch it online

Tcl, 59 bytes
proc C s {expr {[string in $s 0]==[string in $s e]&$s!=""}}

Try it online!

C (gcc), 45 bytes
f(s,j)char*s;{for(j=*s;*s;s++);j=j&&j==*--s;}

Try it online!

SmileBASIC, 29 bytes
DEF E S?S>""&&POP(S)==S[0]END

Pretty simple, but it's important that the POP is done after the first character is checked, so it will work on 1 character long strings.

ActionScript 2.0, 49 57bytes
function a(b){trace(b!=""?b.substr(0,1)==b.slice(-1):0);}

Old version (v) doesn't output false for "", but the new, longer version does.
function a(b){trace(b.substr(0,1)==b.slice(-1));}

I'm fairly sure this is the shortest way to do it, but...
The semicolon can be removed and it'll still compile in JPEXS.
This is a pretty simple function - if the argument is not "", output whether the (0, 1) substring of the argument (basically a way of getting the first character) is equal to the last character, obtained by slicing the string at its last character, otherwise 0. Tracing is shorter than returning.

What does this do for the empty string?

Fixed. Now it checks for the empty string and returns 0.

jq, 23 characters
(20 characters code + 3 characters command line option)
.>""and.[:1]==.[-1:]

Sample run:
bash-4.4$ jq -R '.>""and.[:1]==.[-1:]' <<< $'10h01\nNothing\nAcccca\nwow!\nwow\nH\n'
true
false
false
false
true
true
false

Try it online!
jq, 25 characters
(22 characters code + 3 characters command line option)
endswith(.[:1])and.>""

Just to show that jq also has endswith() function. But unfortunately all strings are considered to end with empty string, so is not shorter. ☹

MAWP 2.0, 28 bytes
=A|_!=W1-W0-*{`=M~M-{0=A}}A:

Try it!

Ly, 6 bytes
i0I=u;

Try it online!
One caveat about this one...  Ly can't detect null input, so it doesn't handle that use case.
i       - read STDIN onto the stack a codepoints
 0I     - copy the bottom of stack to the top
   =    - compare top two entries on the stack
    u   - print the result
     ;  - exit to avoid print the rest of the stack

K (ngn/k), 12 bytes
{0^*(*x)=|x}

Try it online!
A port of @user41805's APL answer.

(*x)=|x compare the first character of the input against each character of the reversed input
0^* take the first value; *emptyIntegerList will return 0N, which needs to be filled with 0 via 0^

Zsh, 13 bytes
>_$1<*${1[1]}
Attempt This Online!

Regex fullmatch (Java / Boost / Python / PCRE2), 11 9 bytes
(.).*\1|.

Try it online! / Attempt This Online! - Java
Try it online! - Boost
Try it online! / Attempt This Online! - Python
Try it online! / Attempt This Online! - PCRE2
Simple non-complicated regex. Would have been even less complicated if not for the fact that you had to match single char strings. Matches a string only if the first and last characters are equal.
(.).*\1|.  # The regex
     \1    # Does the last character equal...
(.)        # The first character?
   .*      # Allow anything in between
       |.  # Or match a string 1 character in length

False negative on "H"

@Sandra oops, thanks for noticing. I have fixed it

this returns true for eraser (and some others). It only works in your ATO link because you used re.fullmatch instead of the normal match

This is because your ^ and $ are separate between the |. You can fix this for +2 bytes: ^((.).*\2|.)$ or ^(.).*\1$|^.$

@Steffan argh. why wouldnt fullmatch be acceptable? i specifically stated that it would match the string, not a substring

that's not raw regex. if you're using fullmatch, then you might as well remove the ^ at the beginning and the $ at the end - it makes no difference in the result due to them being parsed wrong. fullmatch exists in python but not necessarily in other langs. for example in JS, we just have to use test, so you need to properly wrap it in ^ and $

Not "any flavor", you can't use this solution in Go, for example, because of how Go's regex dialect disallows backreferences.

@bigyihsuan got it

@naffetS has already explained this, so I will be more detailed. You need to make up your mind and go with either ^((.).*\2|.)$ (13 bytes) or (.).*\1|. (9 bytes). Your current choice is senseless; without fullmatch, it would match any non-empty string, because that's what .$ does; the ^((.).*\2 at the beginning would do absolutely nothing, because it doesn't match anything that .$ doesn't.

Furthermore, if you want this to be a "generic" regex, you can't keep the fullmatch; most regex flavors, including GNU ERE, ECMAScript, Perl, Ruby, and .NET, don't have it. Ones that have it include Java, Boost, Python, and PCRE. But with PCRE, you need to call it from C/C++ using the PCRE2_ANCHORED and PCRE2_ENDANCHORED flags to get this functionality. Most programming languages' wrappers of PCRE do not give access to both of those flags at once.

For example, PHP's PCRE wrapper offers only the A flag which means PCRE2_ANCHORED. Julia has startswith and endswith, but offers no function that does both. Also note that if you combine the Anchored and global flags in PCRE, this anchors only the first match to the string's start, with each subsequent match being anchored to the end of the last match.

If you go with ^((.).*\2|.)$, that is something I'd label as "# Regex (GNU ERE or better), 13 bytes". It's not fully generic, because it uses a backreference. Some examples of engines that don't support backreferences are POSIX ERE, RE2, and D.

As for fullmatch – I have never used that in any of my pure-regex answers, i.e. those labeled "Regex (<flavor(s)>)", but if you do, it needs to be shown in the language name like a flag. Except, there's no standard name for it. I suppose you could call it fullmatch, even though that's specific to Python... so the full heading could be something like "Regex fullmatch (Java / Boost / Python / PCRE), 9 bytes". But if you do that, you should really provide a test harness for each of those flavors. I'd be happy to do that for you if you'd like.

@Deadcode I dont have time rn, id be glad if you could do that

@Seggan Okay, did it.

Jellyfish, 14 bytes
P
=<,1
v
, I
2

Try it online! (The input requires a trailing newline to handle the empty string case correctly.)
Explanation
A straightforward solution would be 7 bytes if we didn't have to handle empty strings:
P
=<
vI

I inputs a string, which goes to both < (first element) and v (last element). The results of both of these functions go to =, and the comparison result gets printed by P.
However, < and v error when the string is empty, so we have to add some workarounds. Note that strings in Jellyfish are lists of characters, and lists can contain values with different data types.
<,1

 I

Append 1 to the input and take the first element: either a character, or 1 if the input was empty.
v
, I
2

Prepend 2 to the input and take the last element: either a character, or 2 if the input was empty.
P
=

Compare and print the result, as before.

Dart, 38 bytes.
c(s)=>s.length>0&&s[0]==s[s.length-1];

Nothing amazing. Introducing a variable for s.length takes one character more. Splitting an empty string, or using s.runes/s.charCodes, gives an empty list, which needs special casing anyway.

PHP, 46 bytes
$f=fn($x)=>fn($y)=>($x==$y&&($y!=""))?'T':'F';

Try it online!

The rules don't allow taking the first and last character, you have to take the whole string.

You can simply do 25 bytes: fn($x)=>$x&&$x[0]==$x[-1]. Try it online!

Thanks for correcting :)

Stax, 6 bytes
¢₧/#HL

Run and debug it
This is  a function which takes input as  a string.
This is PackedStax which unpacks to the following 7 bytes:
%_:EE=I

Run and debug it
Explanation
%     I # input length is > 0 and
 _:E    # input string first and last value
    E=  # are equal

This fails on an empty string; the output should be falsey.

@Shaggy Should be fixed now.

JavaScript, 30 bytes
i=>!!(i[0]===i[i.length-1]&&i);

PowerShell, 32 bytes
if($a){return $a[0]-ceq$a[-1]}!1

Try it online!

Regex (GNU ERE or better), 12 bytes
^(.)(.*\1)?$

This regex was already used in the following answers, shown in chronological order:

eush77's 12 byte GNU grep answer (GNU ERE / PCRE)
Neil's edited 12 byte Retina answer (.NET)
Kevin Cruijssen's 29 byte Java 8 answer (Java)
Shaggy's edited 25 byte JavaScript answer (ECMAScript)
Tom Tanner's 28 byte Perl answer (Perl)
oktupol's 30 byte Vim answer (GNU ERE)
sergiol's edited 34 byte Tcl answer (Tcl ARE)

But here it is demonstrated in the form of a pure regex, in a wider variety of regex engines:
Try it online! / Attempt This Online! - GNU ERE
Try it online! / Attempt This Online! - Tcl ARE
Try it online! - ECMAScript (SpiderMonkey)
Try it online! / Attempt This Online! - ECMAScript 2018 (Node.js)
Try it online! / Attempt This Online! - Perl
Try it online! / Attempt This Online! - Java
Try it online! - Boost
Try it online! / Attempt This Online! - Python
Try it online! / Attempt This Online! - Ruby
Try it online! / Attempt This Online! - PCRE
Try it online! - .NET
^       # Anchor to start of string
(.)     # \1 = Consume one character
(       # Begin grouped expression
    .*      # Skip any number of characters, minimum zero
    \1      # Consume a character if it matches the one captured in \1,
            # otherwise fail to match.
)?      # Evaluate the above group optionally; if it fails to match, it will
        # be skipped.
$       # Assert that we've reached the end of the string

See also Seggan's answer, in which a feature is used that is not present in all regex engines, allowing that regex to be just 9 bytes (the regex is matched against only the entire string, and doesn't attempt substring matches).
Regex (ECMAScript or better), 13 bytes
^(?=(.)).*\1$

Try it online! - ECMAScript (SpiderMonkey)
Try it online! / Attempt This Online! - ECMAScript 2018 (Node.js)
Try it online! / Attempt This Online! - Perl
Try it online! / Attempt This Online! - Java
Try it online! - Boost
Try it online! / Attempt This Online! - Python
Try it online! / Attempt This Online! - Ruby
Try it online! / Attempt This Online! - PCRE
Try it online! - .NET
Doesn't beat the 12 byte version in golf or in range of compatibility (GNU ERE isn't supported due to lack of lookaheads, and Tcl ARE isn't supported due to lack of support for captures or backreferences inside lookaheads), but included anyway, to demonstrate another method that's rather elegant.
Already used in Neil's original 13 byte Retina answer before being edited down to 12 bytes.
^         # Anchor to start of string
(?=       # Lookahead
    (.)   # \1 = one character
)
.*        # Skip any number of characters, minimum zero (if more than zero
          # characters are skipped, the first of them will be the one captured
          # in the lookahead above)
\1        # Consume a character if it matches the one captured in \1,
          # otherwise fail to match.
$         # Assert that we've reached the end of the string


text:
Random Golf of the Day #8: Shuffle an infinite list
About the Series
First off, you may treat this like any other code golf challenge, and answer it without worrying about the series at all. However, there is a leaderboard across all challenges. You can find the leaderboard along with some more information about the series in the first post.
Hole 8: Shuffle an infinite list
You should write a function or program which takes an infinite list as input and returns a shuffled version of that list.
About infinite I/O
There are several ways you can take input and produce output for this challenge:

You can either take a list of positive integers, or a string representation thereof, or a string or list of printable ASCII characters (0x20 to 0x7E, inclusive). The output format must match the input format. I'll just refer to the data as "the list" from now on, regardless of which option you choose.
You can read the list from an infinite standard input stream and write the output continuously to an infinite standard output stream. The solution should not depend on any particular value or sequence of values to ensure that the output stream is regularly written and flushed (e.g. you can't just write output whenever there's a 5 in the input list). Of course, if you read a string representation of a list, it's fine to wait until encountering the list separator.
In languages that support them, you can write a function that takes and returns a lazy infinite list or string.
In languages that support them you may implement an infinite generator that takes another generator as input.
Alternatively, you can write a function which takes no arguments and returns one output value each time it is called. In this case, you can assume that a function has been defined which takes no arguments and returns the next input value each time it is called. You may freely choose that function's name.

You may assume that your program runs forever and that infinite memory is available. (It's possible to solve this with a finite amount of memory, but what this means is that you're allowed to leak memory.)
About the randomness
For any value v which is read at a position i of the infinite input, there must be a positive probability for it to end up in any of the positions i-9 to i+9 of the infinite output (unless that position would be negative). These probabilities don't have to be the same for different output positions or even for different input positions. It's fine if your solution can also shuffle the values to other position that are further away.
Hence, it's not necessary that your solution can shuffle the first value very far down the list, or that it can shuffle a very late value up to the first position, although it's fine if it does, as long as all positions 9 steps from the input are possible.
E.g. if you took the following string as input, the ___ indicates all the positions the X must be able to end up in the output:
                  ___________________
 abcdefghijklmnopqrstuvwxyzXabcdefghijklmnopqrstuvwxyz...

If your language lacks a built-in random number generator or you don't want to use it, you may take an additional seed value as input, and implement your own suitable RNG using the seed. This page may be helpful for that.
Regardless of the actual distribution your solution uses, it must almost surely produce the next value after a finite (but arbitrary) time.
Please include a short explanation about how your implementation satisfies these requirements.
Scoring
This is code-golf, so the shortest valid answer – measured in bytes – wins.
Leaderboard
The first post of the series generates a leaderboard.
To make sure that your answers show up, please start every answer with a headline, using the following Markdown template:
# Language Name, N bytes

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:
# Ruby, <s>104</s> <s>101</s> 96 bytes

(The language is not currently shown, but the snippet does require and parse it, and I may add a by-language leaderboard in the future.)

May we assume infinite time/memory available?

If the language does have something called a random number generator, are we really required to use it?

@Mego Infinite time, obviously. And infinite memory, yes as usual for challenges that require programs to process data forever (it's possible to solve this in finite memory, but I don't want to punish languages that are forced to leak memory).

@feersum I should probably specify the requirements of a self-built random number generator a bit more precisely, but I can't imagine implementing your own to be shorter than a built-in RNG in most cases?

@feersum I've clarified that part a bit and linked to our standard definition for randomness.

Can all items in the list be identical?

@Shaggy Sure. You may be given any possible infinite sequence of the permitted values.

Python 3, 78 bytes
from random import*
l=[]
while[shuffle(l)]:l[9:]and print(l.pop());l+=input(),

Try it online!
Takes input from STDIN (one per line), prints to STDOUT.
Keeps a buffer l of up to 10 elements. The buffer is shuffled with each step. When its length is 10, the last element is printed and removed.
If an element happens to be printed as soon as it was inserted, it has skipped ahead of 9 other elements waiting in the buffer, so it appears 9 spots left. An element can wait in the buffer arbitrarily long, so its position can move any amount right.
There doesn't seem to be a nice way to produce and remove a random element from a list. Shuffling seems like overkill. It's 2 bytes longer to use l.pop(randint(0,9)) (which uses that the list has 10 elements).
from random import*
l=[]
while 1:l+=input(),;l[9:]and print(l.pop(randint(0,9)))

It's no better to do x=choice(l);l.remove(x).A language with poprandom like
poprandom = lambda l:l.pop(randrange(len(l)))

could very cleanly do
from random import*
l=[]
while 1:l+=input(),;l[9:]and print(poprandom(l))

Befunge (quirkster flavor), 4 bytes
?,?~

, reads a character from the stream and pushes it onto the stack. ~ pops the top character from the stack (if present) and prints it. ? randomizes which command is executed next. So the algorithm here is "In an infinite loop, with equal probability either push a character or pop a character." I think this satisfies the requirements: a character can see arbitrarily many characters added above it in the stack, so it can move arbitrarily far to the right, and it can be printed when the stack is arbitrarily big, so it can move arbitrarily far to the left.

Doesn't this output null bytes if the stack is empty?

The implementation I linked doesn't; I agree by the Befunge spec it should.

Funny, the browser eats null bytes. It calls its implementation of putchar("\0"), but FF purges it from the HTML:  >> document.getElementById("output").innerHTML = "a\0b"
>> document.getElementById("output").innerHTML
"ab"

Aha, I wondered if something weird was happening in the browser. I guess my Chrome does that too. Well, that is a heck of a technicality then, but I guess it's more or less in the spirit of the site to post a solution that only works in some interpreters run in some environments.

C (gcc), 94 bytes
L;i;f(s){srand(s);int B[9]={0};for(L=0;;)L>9&&putchar(B[i=rand()%10]),B[L>9?i:L++]=getchar();}

Try it online!
Ok, a TIO link doesn't make much sense. For ease of testing, I created the following C program that will output random ascii characters, or repeat an string infinitely.
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
int main(int argc, char** argv){
    srand(time(NULL));
    if(argc < 1) {
        for(;;){
            printf("%c", rand() % 95 + 32);
        }
    } else {
        char* s = argv[1];
        int i = 0;
        for(;;){
            if(s[i] == 0)
                i = 0;
            printf("%c", s[i++]);
        }
    }
}

This program will be referred to as iro.
Program correctness
What I do here is read 9 values into a buffer. After this, random indices are chosen from this array and are outputted, then replaced by the next character in the stream.

S.I.L.O.S, 149 bytes
b=1
lbla
x=15+b*15
b=1
lblb
readIO
queue 0 i
x-1
if x b
a=0
lblx
x=rand*2
queuePop 0
if x X
printInt m
a+1
b=15-a
if b x
GOTO a
lblX
queue 0 m
GOTO x

Try it online!
Essentially it keeps taking input (on the online interpreter through arguments, but on the offline official interpreter it will allow you type into the console (infinitely)) in blocks of 15 at a time (30 the first block).
It loads the input into a temporary queue and picks a lucky 15 (randomly, but not equally distributed in terms of probablity or distribution).
The rest remain in as new inputs fill the queue, the first input could be shuffled all the way to the end, (basically I think the characters follow a normal distribution). It's interesting to note that this program is only twice as verbose as python and perhaps "golfier" than Java.

To better see the results I have a non-compliant version which takes input as a string (however it can only take in 8,000 or so characters).
Try it online!
Just for fun, here is this post fed through the string version.

 [.L.Ooy" 9beS.I.S],"14 ts  b1
 nly

  =ll
   x=1b 15   1
5b  a*b=  lb  rd#  + lb eaI O    e
 x
 ifquu
1 0x b
   =

    e
0
   i lblxa -d*2
    quu   x=rn
   x Xea p0
   pnInt o r   a
   mf =   iePit
  ba 1
   GTO  1 f b x+ Oa

 qe -lblX u0 m    GOOue
[rlT

 tnn5 !I.STii][S.LO ie

htpsgthyx]:iub.om/jhujh.. tcraa.I.O.o /TytonieSu:wl/.L lnn!:tt/iS
[ in hsto.un/nuslprxRUCoDsio/]:e#NzZn6j4c/2xNQFnF7y0aLzkrosd9Dov2yxJNx774HBrgPUdi9CySI09sCLw5TJwB7jlB1XVeQFE7m1VMsIQvDOjBmdtME3umNzYXs9unFbqRamVDfUDw@RT3NHoL7/i04bz16DCoP4eulOU7jPD8OmYjATpynkuMDuBPYmtnIJzseyyhaNkMyQgXG2R782vqMDIiUm6Kq4Q3mJkxlUsR1rrldPw./l28Z SL.XS – IONuscOT "
senallyxMz.stiitkp ingN"
 eestaint on heeInliinrprt (oe e  toghr tetgpnmntuon eruEuut r h ofi off,bhenecil inretea.atr  ialoks tirilw upeitfleptly ty  honso (e oote cenfine iwllbc 15 atly) nitloo  aim( te)nikfte3 firs bck)
hs 0It te
 lodshipo alauttt.mpra quuet i reanicks a lck eooy d  randomyn p 15( u o equl,unbtty drbutedaynistinems oftrly ordisrprob ill abition h  ibttmin.Tet ri)
 a nwit u ree nusfil th queusen
pte ftip,ae uldsfuesis ob hl rlelth weual  t tc hdyoend,f tbaaly thi an elnkhecarcthe(sc h o  noreiItrolwaaldibtio  lmiru.t' iereaf ) tsng tetntiottssht prasnon  hogIms only twieatisi s vroscpythonadprs a hbapolfi" e r n e ehanava.
 tte s/"gt
obterelIe  tsvea non-omhTrehs  a plntvesion hcahihk ine teuts sriprics at rwvritcaw aa g(hoee n onl kein n00 orscat ,0  cter).

[Tyauoas  it onine!hrhrys:.ru]p//o/lsslo#jVd(tinnexi3E@KDpit/LrhtwXwVEUuscxPmJjFFCaNimMzlHiQEcMmdVIT7vqs8mNgxU3mD/J1AwX q/ivbao1j@nb4I6/m93655bThmb4cy5TUX3xvI018cZzrXItuO5B@NX5JD/HzyE@G@D5eqrGem3l0HPGRutZfpi2PzVA@d3CVRTm4zJxnZdcFSTEO0JOT9KhDI6byjnLhS0cNmGz7hJrTdAgORT8Ndvv7DgZSbJdkp9v5al8qMyNCb9tXe0ChrShXRTOt@7fFgV3zTkbVbsD@JpKina2oKgNVakjsjLCpD29u7l0XVRWalVTyArF1FqypQAxXb/BedqUqpJGOPVyxOjLj0jXup8cE277L2I6@lSowK5pA7nGldRBiJwyKxF6z2c3kW/sJ4EYBbbpSuBxs55nyI9sdnu@nJJeGqtKprGEUbc6NDGMjjO2tN/KuKTWh2WWbbRRLVaq/P6KqkoMNWGRgTQZLlbXfQI050bY0rz0xmzCVZ4vowjpV0dCmkDFq0VNa5GSDzVn5Qw7idwPTxu5xTAtLQCDN/YIApfAn4dsDmYksCqUU27sRggpzRK4SmdjmPUPQO4j5FmgHMFRWS2eI1CfA2YIcf7JlylFjdZypVTH0IJu4ZJHiUviyBFKqhrkCjgXAAB8d710NhHgDwcJksuvPPprcfzHPTaJGFX8OIExW/cBZjaPiY7a4WD6rTYmOouBVucROlwvuBJiHWdJQjjbobNGTd7M1P6z8dw/A@GU02hgjCcrjjQHkAdS6r7UjQ6wAPqB@sIgxkKcbZDixeWS6mn160CKQpn7aUwGLK22u9I0oX6YIwPMhFVaX5uYon0AyoNTCZvnmtilVhV3/pgTGc7r39lIS5PmqM/NGnUSLnTw9eTJ7qqrNQKsJHz@Tt8mDZVWKCKTkBro1PuQAksDdN1yaVGiVXElRW9i5M11cINmxNGYAg9TD7sxtEDI2OkKMaBXgvO5dOplUQQIdpb2w66NePBScMmEnAX8ydGSiiHlss@hOLZzInnIoTevRtEm/TGHWOkly5ljMK4FkgDDSWCWBW3YwmEVYCIBV@GMIg3TZtGwMFWXVxQwBb5iD6PfS7h7Sric1ib5ZYIvW6n3tlaK7/6@3OAHy4LjOuW@tzaBP3@mFbJpHsVsQKPfeui/o1@aBcbZ4TK96T8tp3QjeA1vDXMKBIqdK@HZs2vsMlQE36YmrBEnVRUvAGNuCt44e0RB0sL0MkNu1Q5wOwliTT2JQzVrOnHAmSXIU//sqjdG6jdT2r1v@@lGjouzkGWoD4zhnzJBxo0OT6OTbBDgeDFRnY8TMXZbMPdxsCtbXeUxIBqST4VRwkpbgwChBcJxMx6hLIVZhfuylDvF1l26Nbl3xRLgQnatSCMigx@PCT6lcG1ebdk/86UBUFp9UkxjoCGSJnlxMtUdHf6IjkMnil5aua9L@xXsdHEKW@8JpVqlgKsr12bAKG2Typfv@Yy4CkUydETWphcdmdpWq7egtxqP8pYI2rSaSuYBwW0tNTdXn4qcjnZ9JKhuVwaWRycwCWt247LSflsCHsB3u0KoLTQJzL1uMl0duij/IF7LCc5FSpIPW7gcjOYj@jQdpQHv0WUz/IbMhS0XmFiWm1i0cTbxXjsjLxt6nGmQNQoKfREklc8pTFyHub7jUg8TR4QrZ2w3YjaLWNi@FFerCnNgY0LqgrA6qkWg8H/7Pv6YhtqeZzvoB0yD5Wm1eLL1Vf/SouI0Q/fox7eQlXieZB1F1v2/in/btqyVPtubWhDIKH8WaTlry43N6HgOEzX5HOjv1@lamBeZlJpqJnG3B2LZe8sXUafdAcVvVjBBlqxbEThCdjpelc7YVuYXOqM8MyVV3iPxbqYu@nmbHnoKpK1Eww11sA9aiwN8kMe0ioVO7qnucL1A8wHJ4wTsdltrm3CC4bpCd5hMhyDGXSdGgdKvnCKUpNB9nH@wXLgu5iUEcfJbDKZFjx6gI9i8fCcUFiQXxeSbKnwhT6@v/I6yS/Ew9k@tgI68/lO@4jjx0PZBpSo5vWLCDi4zb@TJejQQPtvlgde98MDGJ4vUW3T@iJTA89gGhUJIgy@MDBpaz3s7PT2ZIwStVANsxpCmhghh68huncD0VdumQt0lT/Su6HW3kMLFfo/FphQ0QhtoZ5iRN/@hZ/DmHq8UZEgiblprekkw1I366fMhePmDclSxirOlYH2Hwe3fom3aoe1@yaQYwi5ZPd2FcITXO7cu9@6tiHZJc7lKSB8e3/mXx34xYH/8F@TUxx/5vs5yHsYBL4ekscycqT1BnuV19/ "SFE/iRAIL.O NqUXAm. T3zDreu).S –IOxs."d

Your header may break the leaderboard - if you want to participate in the Random Golf of the Day competition it would be a good idea to use the standard format.

@wizzwizz4 fixed

Ruby, 43 bytes
l=[];loop{l<<gets;l[9]&&$><<l.shuffle!.pop}

My original answer used a lazy-evaluated infinite list, but this is shorter. Oh well.

Aceto, 24 bytes, non-competing
Non-competing because I had to fix a bug in the interpreter.
^

OYpO
r^`!
?d0=   >

Takes an infinite stream of lines and yields them in a random order. Every element has a chance of occurring at any random point.
We start with a ? in the bottom left corner, which moves us in a random direction. If that is down or left, we get pushed right back.
If we're moved upwards, we read a value, shuffle the stack (Y), and jump back to the Origin.
If we're moved to the right, we duplicate the top stack value, push a 0 and test for equality (since we're reading strings, we can't ever have the integer 0). If the values are equal, that means we've reached the bottom of the stack (from which we don't want to print). We negate the comparison (!), and print only if (`) the things were not equal. Then we also jump back to the Origin.

05AB1E, 13 bytes
[I)˜¼¾T›i.rć,

Try it online! (modified to take 20 elements)
[             # Infinite loop
 I)˜          # Add the next element from input to the array
    ¼         # Increment the counter variable
     ¾T›i     # If the counter variable is greater than 10...
         .r   #   Get a random permutation of the array
           ć, #   Print and remove the first element

MATL, 11 bytes
`rEkN*?D}iT

Try it online!
Port of histocrat's Befunge answer.
Explanation: (Thanks to Luis Mendo for -1 byte)
`         T % Start do-while (`) .... true (T)
 rEk        % 50-50 chance of outputting or inputting:
            %   Random number between 0...1, multiplied by 2 and converted to logical.
    N       % Check if there is anything on the stack to output
     *?     % If there is anything on the stack and (*) we want to output:
       D    % Output. Sadly, D errors when the stack is empty, requiring the N*
        }i  % Else, input.

This outputs almost surely in finite time, and almost surely requires only finite memory.
For completeness, here is a 15-byte version which keeps a 10-element buffer and outputs a random element from that:
`htnt9>?Yr&)wDT

I like this version for the very idiomatic (as far as golfing languages can be idiomatic) tn...Yr&), which pops a random element from the list and returns the list without that element. However, the particular logistics of this challenge add a lot of bytes (the required w for the display, the t9>? to check if the list is full enough...).

Alice, 7 bytes
a&IdU,O

Try it online!
This should work on an infinite input with infinite time and memory, but it's not so easy to test in practice :)
Explanation
a&I         Push 10 characters from the input to the stack.
     d        Push the depth of the stack.
      U       Pop a number (d), push a random number in [0,d)
        ,       Pop a number (n), move the element which is n elements below the top to the top of the stack.
         O    Output the character on top of the stack.

                Execution loops back to the beginning of the line.

At each iteration 10 characters are read from input and only one goes to the output, so memory usage increases linearly during execution. With a finite input this quickly reaches EOF, from which ten -1 will be pushed to the stack at each iteration. Trying to output -1 as a character has no effect, but it's unlikely that all the characters of the input will be printed in a reasonable amount of time.
Position i of the output can be taken by any character in the input up to position 10i, this complies with the challenge requiring at least a range from i-9 to i+9.

C, 214 bytes
c;i;char B[19]={0};char*I;
S(p,q){if(B[p]-B[q])B[p]^=(B[q]^=(B[p]^=B[q]));}
R(n){while(n--)putchar(B[c]),B[c]=*I,c=++i%19,I++;}
main(c,v)char**v;{srand(time(0));I=v[1];R(19);i=9;for(;;){S(i,rand()%19);R(1);i=++i%19;}}

How it works

Try Online (UNIX)
#include <stdio.h>
#include <unistd.h>

// animation speed
#define ANIMATION_SLOW 600000
#define ANIMATION_NORMAL 400000
#define ANIMATION_FAST 200000

c;i;char Buffer[19]={0};char*input;
Swap(p,q){if(Buffer[p]!=Buffer[q])Buffer[p]^=(Buffer[q]^=(Buffer[p]^=Buffer[q]));}
Read(n){while(n-->0)putchar(Buffer[c]),Buffer[c]=*input,c=++i%19,input++;}

main(int argc, char**argv)
{
    // initialization
    srand(time(0));
    input=argv[1];
    Read(19);i=9;

    // shuffle machine
    while(1)
    {
        usleep(ANIMATION_NORMAL);
        Swap(i,rand()%19);
        Read(1);
        i=++i%19;
    }
}

What does the "swap" in your diagram mean?

@MartinEnder it means that Vi is swapped with Vj where j =  RAND [ i-9, i+9 ] to satisfy the question criteria  v which is read at a position i of the infinite input, there must be a positive probability for it to end up in any of the positions i-9 to i+9 of the infinite output

Ah that makes sense, thanks.

Can I ask what tool you used to create your diagram?

@Dada Gliffy

Bash, 17 bytes
xargs -n9 shuf -e

Try it online!
xargs continuously takes 9 letters from STDIN and sends them to shuffle
an infinite list can be generated by:
yes {a..z}

which prints a b c d e .. z infinite times.
Test could be done by:
yes {a..z} | xargs -n9 shuf -e

not sure if xargs shuf -e satisfies the requirements

Javascript, 78 bytes
for(l=[];;){l.push(prompt());l.length==10&&alert(l.splice(Math.random()*9,1))};x.sort(()=>Math.random()<0.5);alert(x)}

Uses the same method as xnor's answer.

R, 70 bytes
x=NULL;repeat{x=sample(c(x,scan()));if(sum(x|1)>9){cat(x[1]);x=x[-1]}}

Starts with an empty vector x. In an infinite loop, it takes a new value from STDIN, then shuffles the vector. Then it checks if the length of the built up list is 10 or higher. If it is, it can start printing. This way the vector has a buffer of 10 inputs, each getting shuffled in every iteration. So it is possible for input to be printed 10 places earlier, and infinitely many places later (following a geometric distribution with p=1/10). When the buffer is long enough, the first element is printed and removed from the vector.

Perl 5, 39 bytes
38 bytes of code + -n flag.
print splice@F,rand 10,1if 9<push@F,$_

Try it online!
Add each element to @F array (with push@F,$_). When @F contains 10 elements (push returns the number of elements in the array, hence 9<push...), a random element is removed and printed (splice@F,rand 10,1 to remove the element, print to print it).
The output starts happening after then 10th element has been read. Hence, each element can start appearing at least 9 positions before its original one, and can be shifted to the right infinitely.

SmileBASIC, 61 58 bytes
@L
B$=B$+R()IF I>8THEN R=RND(9)?B$[R];:B$[R]="
I=I+1GOTO@L

Each character of the infinite list is added to the end of the buffer. When the buffer length is 11, a random character is printed and removed.
Function R generates the next character.

Prolog, 70 bytes
s(L):-get0(C),(length(L,9)->random_select(H,L,R),put(H);L=R),s([C|R]).

Sorry, I didn't say how to call it:  s([]). E.g. with an empty list.

Welcome to PPCG! Could you explain how this works? I'm not sure what you mean by "e.g. with an empty list". Solutions should work (and only need to work) with infinite lists.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes