text:
Write a program that reverses the name of its source file
In a single file, write a program that requires no input and produces no output. When run it should reverse the name of the file it is contained in, regardless of what the name is, without altering the code or producing other lasting side effects.
Any way of achieving this is fine. It only matters that once the program is run the only lasting change is that its file name has been reversed. e.g. no new files should be in the directory.
Running the program again should reverse the name back. Indeed, the program should be able to be run arbitrarily many times.
For the purposes of this challenge:

You may assume filenames are always strings of lowercase letters (a-z) between 1 and 127 characters long. (If your language requires files to have extensions to run then just reverse the part before the extension, e.g. mycode.bat → edocym.bat.)
You may assume the code file is in a directory by itself so it will not have naming conflicts (except with itself).
You may not assume the filename is not a palindrome, i.e. the same when reversed. Filenames that are palindromes should work just as well as those that aren't.
You may read your file's contents or metadata. There are no quine restrictions here.
You may assume your program will be run on a particular, modern, commonplace operating system (e.g. Windows/Linux), since not all shells have the same command set.

As a concrete example, say you have a Python program in a file called
  mycode in its own directory. Running
python mycode

in the terminal should result in the filename being reversed to
  edocym. The file edocym should be alone in its directory - no file
  named mycode should exist anymore. Running
python edocym

will reverse the name back to mycode, at which point the process can
  be repeated indefinitely.
If the same Python file was renamed racecar (without changing the code) and then run
python racecar

nothing should visibly change since "racecar" is a palindrome.
  That same goes if the filename were, say, a or xx.

The shortest code in bytes wins. Tiebreaker is higher voted answer.

Does the current working directory matter?

@BradGilbertb2gills You should be able to copy the folder with the program to somewhere else and still have it work (assuming you have permissions and whatnot). You can assume the working directory of the shell will be the folder the file is in.

What if we are using a compiled language? How does the executable affect your rules?

Request to clarify 'accepts no input and produces no output'. Technically, the name of the file is an input that must ne retrieved from the file system and the changed name must be sent to the file system. These are input and output.  It may be worthwhile to specify that no other outputs are allowed.

Additionally, do you consider use of child processes to be violations of the input/output rules? That is, calling a separate process to perform part of the task, like reversing the name, would require sending the other process the name (output from your code and input to the app) and receive the value from the process (output of the process and input to the app).

@EMBLEM I guess the executable should reverse its own filename. Tbh I didn't consider this and your own reasonable interpretation of the rules is probably fine.

@atk You're overthinking, splitting hairs. User input should not be required. No output should be visible when running the program in a normal way. Think of it like a function with no args that returns void.

Bash + common linux utils, 13 bytes
My method is similar to @DigitalTrauma's but a bit shorter due to the pipe with ls:
mv * `ls|rev`

Oh - very good.

Welcome to Programming Puzzles & Code Golf! This is a very nice first answer. :)

Only works if there is no other file in the directory.

@WGroleau && terdon:  both your comments are right but the question already handles those 2 assumptions.

@JuliePelletier ah, yes, you're quite right. I missed that file names can only consist of lower case letters.

I was looking into a quick way to reverse lines in a file/stdin for another problem; but of course there's a rev standard utility. Why wouldn't there be...

C#,  153 bytes
void f(){var x=System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name;File.Move(x,new string(x.Reverse().ToArray()).Substring(4)+".exe");}

OO is cool and all untill you have a variable defined:
System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name
thats just mean

Bash + common linux utils, 15

1 byte saved thanks to @Dennis

Assumes that the script is in a directory by itself.
mv * `rev<<<$0`

You may assume the code file is in a directory by itself, so $0 can be replaced with *.

Sorry but there's a small bug in your update and it doesn't work as is.  The simplest fix is to go back closer to what you had before with $0 instead of the last *.

@JuliePelletier It seemed to work before when I tried it, but yes, you're right - * globbing expansion doesn't happen to the right of a <<<.

MATLAB, 50 46 bytes
e='.m';x=mfilename;movefile([x e],[flip(x) e])

Thanks to @Suever for removing 4 bytes and for the testing!
Tested on OS X El Capitan and Debian Jessie, both with Matlab version R2014a.
On Windows a flag 'f' is needed (    e='.m';x=mfilename;movefile([x e],[flip(x) e]),'f')  to change file name while the file is being used.
How it works
e='.m';                       % Store file extension '.m' in variable `e`
x=mfilename;                  % Get name of file being run, without the extension
movefile([x e],[flip(x) e])   % Move (rename) file. `flip` is used for reversing the
                              % name without extension. [...] is (string) concatenation

What OS are you on that the 'f' is required?

@Suever Windows. Isn't it needed on Mac?

Not needed on Mac of Linux it seems.

@Suever Thanks! 4 bytes off :-)

@Suever Can you indicate the exact OS this works on?

OS X El Capitan and Debian Jessie, both R2014a

Julia, 51 bytes
d,f=splitdir(@__FILE__)
cd(d)do
mv(f,reverse(f))end

This program should be operating system agnostic, though it was only tested on OS X.
Ungolfed:
# Get the directory and file name of the current source file
d, f = splitdir(@__FILE__)

# Change the working directory temporarily to d
cd(d) do
    # Overwrite the file with the reverse of its name
    mv(f, reverse(f))
end

Congrats! 20k!!!

Most answers seem to assume that the file is in the current directory, so I don't think you need the cd. In this case f=readdir()[] would be even shorter.

Batch, 109 bytes
@echo off
set f=%0
set r=
:l
set r=%f:~0,1%%r%
set f=%f:~1%
if not .%f%==. goto l
ren %0.bat %r%.bat

Note 1: Batch files must end in .bat; it is assumed that the batch file is executed by its name without extension, and that the .bat is not to be reversed. For example, reverse would attempt to rename reverse.bat to esrever.bat.
Note 2: CMD.EXE errors out after renaming the batch file. (COMMAND.COM wouldn't, except that it's incapable of string manipulation in the first place.)
Edit: Saved 2 bytes by using the guarantee that the file name is alphabetic (based on @CᴏɴᴏʀO'Bʀɪᴇɴ's comment).

WHY AREN'T YOU SHOUTING? 2. I think you can save a byte by doing if ]%f% NEQ ] goto l

@CᴏɴᴏʀO'Bʀɪᴇɴ Ah yes, the file name is alphabetic, so I can in fact save 2 bytes, but thanks for the hint.

YOU NEED TO SHOUT IN BATCH UNLESS YOU ARE USING OOBL AKA SMALLTALK-80

C, 102 bytes
main(c,v)char**v;{char*b=strdup(*v),*n=strrchr(*v,47),*t=strchr(b,0);for(;*++n;*--t=*n);rename(*v,b);}

Breakdown:
                            // No #include lines required (for GCC at least)
main(c,v)char**v;{          // K&R style function to save 2 bytes
    char*b=strdup(*v),      // Duplicate args[0] (script path)
        *n=strrchr(*v,47),  // Find last "/" in input
        *t=strchr(b,0);     // Go to end of output string
    for(;*++n;*--t=*n);     // Reverse input into output character-by-character
    rename(*v,b);           // Rename the file
}                           // Implicit return 0

Finally a challenge where C isn't (quite so hopelessly) uncompetitive!

If we take "You can assume the working directory of the shell will be the folder the file is in" to mean that the program will always be invoked as ./myexecutable, we can simplify *n=strrchr(*v,47) to *n=*v+1 to save 10 characters, but this isn't entirely valid (it could be invoked as ././myexecutable, for example).

Also if you want to keep a file extension (e.g. ".out") in-tact, you can change *t=strchr(b,0) to *t=strrchr(b,46), costing 2 bytes. Not required though.

Nice - I'd never looked to see what rename does if src==dest; it appears you satisfy the palindrome constraint for free.

Note that this requires a file system where codepoint 47 is the separator.  I think this includes POSIX (or does that allow EBCDIC / in a corner case?)

@TobySpeight yeah I checked http://www.gnu.org/software/libc/manual/html_node/Renaming-Files.html for some clarification, but the closest I found was "One special case for rename is when oldname and newname are two names for the same file. The consistent way to handle this case is to delete oldname. However, in this case POSIX requires that rename do nothing and report success—which is inconsistent. We don’t know what your operating system will do.", so I guess there's an outside chance it will just delete the file on non-POSIX compliant systems. So yeah, real code should check!

I just checked http://linux.die.net/man/3/rename and it confirms that Linux handles it POSIX compliantly: "If the old argument and the new argument resolve to the same existing file, rename() shall return successfully and perform no other action."

I was going with the Debian manpage: "If oldpath and newpath are existing hard links referring to the same file, then rename() does nothing, and returns a success status" - if the strings are identical, they refer to the same file.

Suggest index() instead of strchr(), rindex() for strrchr() and int**v; instead of char**v;

Ruby, 24 bytes
File.rename$0,$0.reverse

Fairly self-explanatory. ($0 is the name of the file being executed.)
Run with ruby whatever with a working directory of the directory that contains the file.

Vitsy + *sh, 15 bytes
iG:`?r.iG' mr',

Explanation
iG:`?r.iG' mr',
i               Push -1 to the stack. (this assumes that no arguments are passed)
 G              Get the use name of the class specified by the top item of the
                stack. (-1 refers to the origin class, so this class)
  :             Duplicate stack and jump to it.
   `            Read a file with the current stack as its name, replacing the stack
                with the file's contents.
    ?           Shift one stack to the right.
     r          Reverse the current stack.
      .         Write a file with the name specified by the top stack and the
                contents as the second-to-top stack.
       iG       Get the name of the current class again.
         ' mr'  Push 'rm ' to the stack.
              , Execute the current stack as a command.

Note that this submission must use the non-safe version of Vitsy (cannot be done on Try It Online!)

Perl 5, 18 bytes
A bit like the Ruby one (run perl nameofscript):
rename$0,reverse$0

Taking a possible path into account is uglier (47 bytes)
($a,$b)=$0=~/(.*\/)?(.*)/;rename$0,$a.reverse$b

Hello, and welcome to PPCG! Great first post!

Python 3, 105 bytes
import os;a=__file__.split('\\')[::-1][0].split('.');os.rename('.'.join(a),'.'.join([a[0][::-1],a[1]]))

-Alex.A removed 1 byte.
-Digital Trauma showed me os.rename() which took away 62 bytes.
-muddyfish removed 7 bytes.

I think you can save a byte by removing the space after the comma in the import

import os,sys;f=sys.argv[0];os.rename(f,f[::-1]) should do the trick for 48 bytes

doing f[::-1] reverses not only the file name, but the entire path. However, thanks for introducing me to the os.rename() feature.

@Magenta For me, sys.argv[0] just returns the filename only without the path when the script is run in its own directly.  Helka indicated this is ok

@DigitalTrauma when I ran the program on its own, sys.arg[0] returned the full path. Ill add a second solution where sys.argv[0] is just the filename.

@DigitalTrauma Also, your solution flips the file name entirely, including the extension, so it would change Hi.py tp yp.iH.

Can't you use __file__?

You can simply do without the .py extension.  Python doesn't need it if called explicitly with the interpreter: "python mygolf" is fine; "python mygolf.py" is not necessary

PHP, 84, 70, 54 bytes
rename($f=__FILE__,strrev(basename($f,$e='.php')).$e);

EDIT: removed 14 bytes thanks to insertusernamehere in the comments

EDIT: removed 16 bytes thanks to Martijn in the comments

You can get it down to 70 bytes: rename($f=__FILE__,__DIR__."/".strrev(pathinfo($f)[filename]).".php");.

Excelent!!! but your code it's better, wow you got 31 bytes

Can't you make it relative? WOuld save 7 bytes: rename($f=__FILE__,"./".strrev(pathinfo($f)[filename]).".php");

or even smaller: rename(__FILE__,strrev(basename(__FILE__,'.php')).'.php');

Cool! Adding vars I got now 54 bytes

Don´t you need PHP tags for an executable PHP script?

@Titus yes, but I think in golfing is not mandatory since the idea is to count pure code

V, 29 26 bytes
:se ri
izyw:!mv z "
dd

Since this contains unprintables, here is a hex dump:
00000000: 3a73 6520 7269 0a69 127a 1b79 773a 216d  :se ri.i.z.yw:!m
00000010: 7620 127a 2012 220a 6464                 v .z .".dd

Note: this will not run  on v.tryitonline.net since TIO does not allow file access.
Explanation:
:se ri            "Turn on 'reverse mode' (all text is inserted backwards)
i<C-r>z<esc>      "Enter the path to the file in reverse
yw                "Yank a word. This first word is the name we will save the new file as

"Run an "mv" in the terminal with the contents of register 'z' (the path to the file)
"And the contents of register '"' (the word we yanked)
:!mv <C-r>z <C-r>"

dd                "Delete a line so that we don't have any text printed.

PowerShell, 39 bytes
mi *(-join((ls).name)[-5..-999]+'.ps1')

Hi, and welcome to PPCG! Nice first post!

Python 2, 41 bytes
import os;s=__file__;os.rename(s,s[::-1])

Demo on Bash.
Python really doesn't care the file extension, so we can just flip the entire file name.

JavaScript (Node), 108 104 68 bytes
36 bytes saved, thanks to Downgoat!
Windows version:
require("fs").rename(F=__filename,F.split(/.*\\|/).reverse().join``)

Other version:
require("fs").rename(F=__filename,F.split(/.*\/|/).reverse().join``)

@Upgoat I don't need to, I don't think. I'm matching js at the end of the filepath, preceded by a character. This will always be a ..

PHP, 31 bytes
Nothing much to explain I guess:
rename($x=$argv[0],strrev($x));

Perl 6,  70  27 bytes
If it needed to work in a different working directory you would need something like this:
$_=$*PROGRAM;.rename: .basename.flip.IO.absolute: .absolute.IO.dirname

Since the working directory will be the same directory as the program it can be simplified to just:
$_=$*PROGRAM;.rename: .flip

Explanation:
$_ = $*PROGRAM;  # IO::Path object

$_.rename:
    $_.basename
      .flip      # reverse characters
      .IO        # turn into an IO object (IO::Path)
      .absolute: # turn it into an absolute path Str in the following dir
        $_.absolute.IO.dirname

JavaScript ES6 (Node.js) 70 Bytes
No Regex Yay!
require("fs").rename(a=__filename,[...a].reverse().join``.split`/`[0])

Any help is appreciated

Python (2.7 or 3.4+), 61 49 bytes
I believe this is close to the optimal Python solution:
import os;a=__file__;os.rename(a,a[-4::-1]+".py")

Inspired by s4b3r6's answer, but uses list slicing instead of reverse, and saves __file__ to a variable to save bytes when using it twice.
Note: This assumes that the filename is always *.py. A slightly more generic solution that can handle any two-character file extension would be to use a[-3:] to replace ".py", at the cost of 1 extra byte.
Update: Saved 12 bytes by using the list slicing trick a[-4::-1] to remove the file extension, instead of splitting and then reversing with a.split(".")[0][::-1].

PowerShell v4+, 68 bytes
$a,$b=($c=(ls).Name)-split'\.';mv $c "$(-join($a[$a.length..0])).$b"

Only works because the script is guaranteed to be in a directory all by itself. Performs an ls (alias for Get-ChildItem) and takes the .Name of the resultant object(s). We store that in $c and then -split it on literal period to get the filename and extension, and store those in $a and $b, respectively.
Next is the mv (alias for Move-Item) command, where we're moving $c to $a(reversed).$b.
Example
PS C:\Tools\Scripts\golfing\reverse> ls

    Directory: C:\Tools\Scripts\golfing\reverse

Mode                LastWriteTime     Length Name
----                -------------     ------ ----
-a---         6/13/2016   7:58 AM         88 reverse.ps1

PS C:\Tools\Scripts\golfing\reverse> .\reverse.ps1

PS C:\Tools\Scripts\golfing\reverse> ls

    Directory: C:\Tools\Scripts\golfing\reverse

Mode                LastWriteTime     Length Name
----                -------------     ------ ----
-a---         6/13/2016   7:58 AM         88 esrever.ps1

Powershell, 112 bytes
I'm not going to beat the unix cmds, just adding my two pence for fun :-)
gci * | % { $n=($_.basename[-1..-(($_.basename).length)] -join “”)+$_.Extension; mv -Path $_.Fullname -Dest $n }

Welcome to PPCG! We require that answers display their score, so I've edited it in for you. Also, you can format your code by highlighting it and selecting the button that looks like brackets {}, or by adding 4 spaces before your code.

Python (2 & 3), 88 78 bytes
import os;os.rename(__file__,''.join(reversed(__file__.split(".")[0]))+".py"))

Exploits the fact that the filename is given by sys.argv (as the working directory is the folder the file is in), and makes use of os.rename. Annoyingly, reversed returns an iterator, so we have to use join.
Edit: Saved 10 bytes by using __file__ instead of sys.argv[0], as suggested by @muddyfish to @DigitalTrauma.

PowerShell, 50 bytes
mv *(-join($f=(ls).BaseName)[$f.Length..0]+'.ps1')

There is only one file, so mv * shell wildcard will only have one result. The destination name is (ls).basename which lists all the files (alias for 'dir'), calls for the BaseName property - and since there's only one file, PowerShell will unpack the 1-item array into a string. Store that filename in $f, then index it with a countdown and -join the reversed characters back up into a string. Add the mandatory .ps1 suffix.

AutoIt, 45 bytes
$a=@ScriptName
FileMove($a,StringReverse($a))

Python 2.7, 68 bytes

import os;a=__file__;os.rename(a,a.split("\\")[-1][:-3][::-1]+".py")

This is probably the best I can get it.
I just proved myself wrong.

tcl, 42
file rename $argv0 [string reverse $argv0]

Visual Basic Script, 44 Bytes
WScript.Echo(StrReverse(WScript.ScriptName))

Example output for file called reverse.vbs (Run with cscript):
sbv.esrever

sfk, 83 bytes
list -maxfiles=1 . +setvar n +getvar n +swap +setvar m +ren -var . /#(n)/#(m)/ -yes

Try it online!

SmileBASIC 60 bytes
P$=PRGNAME$()FOR I=1-LEN(P$)TO.Q$=Q$+P$[-I]NEXT
RENAME P$,Q$

Alternative:
P$=PRGNAME$()T$=P$*1WHILE""<T$Q$=Q$+POP(T$)WEND
RENAME P$,Q$


text:
Ain't there nothing up my sleeves

Note: reference to Nothing up my sleeve number.
Your task is to take no input and generate this exact output:
d76aa478 e8c7b756 242070db c1bdceee f57c0faf 4787c62a a8304613 fd469501
698098d8 8b44f7af ffff5bb1 895cd7be 6b901122 fd987193 a679438e 49b40821
f61e2562 c040b340 265e5a51 e9b6c7aa d62f105d 02441453 d8a1e681 e7d3fbc8
21e1cde6 c33707d6 f4d50d87 455a14ed a9e3e905 fcefa3f8 676f02d9 8d2a4c8a
fffa3942 8771f681 6d9d6122 fde5380c a4beea44 4bdecfa9 f6bb4b60 bebfbc70
289b7ec6 eaa127fa d4ef3085 04881d05 d9d4d039 e6db99e5 1fa27cf8 c4ac5665
f4292244 432aff97 ab9423a7 fc93a039 655b59c3 8f0ccc92 ffeff47d 85845dd1
6fa87e4f fe2ce6e0 a3014314 4e0811a1 f7537e82 bd3af235 2ad7d2bb eb86d391

A trailing newline is optional.
The MD5 hash for the version with trailing newline is:

FC1D37B5295177E7F28509EC9197688F

The MD5 hash for the version without trailing newline is:

FAC194EC5EFD2E5A5AC07C2A4925699B

How the string is generated
Those 64 strings are actually the 64 hexadecimal numbers used in the MD5 hash.
The pseudocode for them:
numbers = floor(2^32 × abs(sin(i))) for i in [1,2,...,64]

The reference Python code:
from math import*
for i in range(8):print" ".join("{:08x}".format(int(abs(2**32*sin(-~j))))for j in range(8*i,8*i+8))

Ungolfed:
from math import*
for i in range(8):
    temp = []
    for j in range(8*i,8*i+8):
        temp += ["{:08x}".format(int(abs(2**32*sin(j+1))))]
    print " ".join(temp)

So we need to add one newline every 8 numbers?

@DenkerAffe Yes.

Jelly, 26 24 23 bytes
64RÆSA‘æ«32Ḟb⁴Ḋ€‘ịØhs8G

Try it online!
How it works
64RÆSA‘æ«32Ḟb⁴Ḋ€‘ịØhs8G  Main link. No arguments.

64R                      Yield [1, ..., 64].
   ÆS                    Apply sine to each.
     A                   Take absolute values.
      ‘                  Increment.
                         This avoid padding the hex strings to 8 characters.
       æ«32              Left-shift by 32 units.
           Ḟ             Floor.
            b⁴           Convert to base 16 (list of integers).
              Ḋ€         Remove the first digit of each, undoing the increment.
                ‘        Increment each base 16 digit (for 1-based indexing).
                 ịØh     Index into "0123456789abcdef".
                    s8   Split into chunks of length 8.
                      G  Grid; separate columns by spaces, rows by linefeeds.

Python 2, 86 77 76 bytes
import math
n=0;exec(",\nn+=1;print'%08x'%(2**32*abs(math.sin(n)))"*8)[1:]*8

Test it on Ideone.
How it works
Python 2's print statement has a quirk: It appends a newline to the result of its expression, unless it is followed by a trailing ,; in this case, it appends a space. While that's usually annoying when golfing (as there's no short way to print without trailing whitespace), it's perfect for this task.
We repeat the string ,\nn+=1;print'%08x'%(2**32*abs(math.sin(n))) eight times, chop off the leading comma with [1:], and repeat the result eight times. The string that exec executes composed of eight identical copies of the following code.

n+=1;print'%08x'%(2**32*abs(math.sin(n))),
n+=1;print'%08x'%(2**32*abs(math.sin(n))),
n+=1;print'%08x'%(2**32*abs(math.sin(n))),
n+=1;print'%08x'%(2**32*abs(math.sin(n))),
n+=1;print'%08x'%(2**32*abs(math.sin(n))),
n+=1;print'%08x'%(2**32*abs(math.sin(n))),
n+=1;print'%08x'%(2**32*abs(math.sin(n))),
n+=1;print'%08x'%(2**32*abs(math.sin(n)))

Each line increments the variable n (initialized by n=0), applies the format string %08x (lowercase hexadecimal representation, left-padded with zeroes to length 8, of the integer part of its argument) to 232 times the absolute value of the sine of n, and prints the resulting string either with a trailing space or a trailing linefeed.

Pyth, 31 27 bytes
Thanks to @Dennis for saving 4 bytes!
jjL;c8mt.Hs*^2 32h.a.tdZS64

Try it here!
Explanation

jjL;c8mt.Hs*^2 32h.a.tdZS64

      m                 S64   # map over [1...64]
          s*^2 32h.a.tdZ      # floor(2^32 * abs(sin(d))+1)
       t.H                    # convert to hex-string and discard the first digit
    c8                        # split into 8 parts
jjL;                          # join on whitespaces and then on newlines

You can save a few bytes with jjL;c8mt.Hs*^2 32h.a.tdZS64.

@Dennis Thats clever, thanks! :)

MATL, 28 bytes
64:Y,|32W*k16YAkZ{Zc72e!3LZ)

Try it online!
Pretty straightforward computation. Getting the required output format takes almost half the byte count.

PHP, 131 81 bytes
for(;++$i<65;){echo str_pad(dechex(2**32*abs(sin($i))),8,"0",0).($i%8?" ":"\n");}

This is a pretty straight-forward loop with a few conditions for spacing.
@insertusernamehere's shortcuts cut it down by 50 bytes.

Hello and welcome to PPGC! A few quick tips about your answer : You can get rid of the <? tag for posting answers here. As for your code itself, you can get down to 92 bytes by getting rid of the ifand the multiple echo : for($i=1;$i<65;$i++){echo (($i%8==1)?"\n":" ").str_pad(dechex(2**32*abs(sin($i))),8,"0",0);}

You can get it down to 72 bytes: for(;++$i<65;)echo str_pad(dechex(2**32*abs(sin($i))),8).($i%8?" ":"⏎"); (replace ⏎  with a real newline).

Julia, 69 63 58 bytes
[@printf "%08x%c"√sin(n)^2÷.5^32 n%8>0?32:10for n=1:64]

Try it online!
How it works
For each n between 1 and 64, we compute √sin(n)^2÷.5^32 and n%8>0?32:10, apply string formatting with "%08x%c" and print to STDOUT.

√sin(n)^2 computes the absolute value of sin(n). abs(sin(n)) is equally short (in bytes), but it would require a space to separate it from the format string.
÷.5^32 divides the previous result by 0.532 = 1 / 232, effectively multiplying it by 232. However, ÷ performs integer divsion, so the result is truncated.
n%8>0?32:10 returns 32 (the code point of a space) whenever n is not divisible by 8 and 10 (the code point of a linefeed) otherwise.
"%08x%c" turns the first result into lowercase hexadecimal representation, left-padded with zeroes to length 8; and the second result into a character.

Finally, the array comprehension returns an array of 64 instances of Nothing, the return value of @printf. Outside a REPL, this does not affect output.

JavaScript (ES7), 115 bytes
_=>`_ _ _ _ _ _ _ _
`.repeat(8).replace(/_/g,_=>(0+(Math.abs(Math.sin(++n))*2**32>>>0).toString(16)).slice(-8),n=0)

Includes the trailing newline.

///, 568 567 bytes
/!/ f//@/fa/d76aa478 e8c7b756 242070db c1bdceee!57c0@f 4787c62a a8304613!d469501
698098d8 8b44f7af!fff5bb1 895cd7be 6b901122!d987193 a679438e 49b40821
f61e2562 c040b340 265e5a51 e9b6c7aa d62f105d 02441453 d8a1e681 e7d3fbc8
21e1cde6 c33707d6!4d50d87 455a14ed a9e3e905!ce@3f8 676f02d9 8d2a4c8a
ff@3942 8771f681 6d9d6122!de5380c a4beea44 4bdec@9!6bb4b60 bebfbc70
289b7ec6 eaa127@ d4ef3085 04881d05 d9d4d039 e6db99e5 1@27cf8 c4ac5665
f4292244 432aff97 ab9423a7!c93a039 655b59c3 8f0ccc92!feff47d 85845dd1
6@87e4f!e2ce6e0 a3014314 4e0811a1!7537e82 bd3af235 2ad7d2bb eb86d391

Try it online!
Too bad I can only golf 6 7 bytes :-(
To convince you that I can't golf it further, I challenge you to do better in just ///, should you accept it. If you do, you're a magician, since Martin Ender's code says otherwise (checked)!
People that won the challenge and are worth of crediting (format: name (id), bytes_golfed):

daHugLenny (56258), 1

Golfed one more byte.

@daHugLenny It seems my +/-s need to update...

K4, 48 bytes
Solution:
-1@" "/:'8 8#(,/$4_0x0\:)'_abs sin[1+!64]*/32#2;

Example:
q)k)-1@" "/:'8 8#(,/$4_0x0\:)'_abs sin[1+!64]*/32#2;
d76aa478 e8c7b756 242070db c1bdceee f57c0faf 4787c62a a8304613 fd469501
698098d8 8b44f7af ffff5bb1 895cd7be 6b901122 fd987193 a679438e 49b40821
f61e2562 c040b340 265e5a51 e9b6c7aa d62f105d 02441453 d8a1e681 e7d3fbc8
21e1cde6 c33707d6 f4d50d87 455a14ed a9e3e905 fcefa3f8 676f02d9 8d2a4c8a
fffa3942 8771f681 6d9d6122 fde5380c a4beea44 4bdecfa9 f6bb4b60 bebfbc70
289b7ec6 eaa127fa d4ef3085 04881d05 d9d4d039 e6db99e5 1fa27cf8 c4ac5665
f4292244 432aff97 ab9423a7 fc93a039 655b59c3 8f0ccc92 ffeff47d 85845dd1
6fa87e4f fe2ce6e0 a3014314 4e0811a1 f7537e82 bd3af235 2ad7d2bb eb86d391

Explanation:
First pass, probably a few tricks left to golf further...
-1@" "/:'8 8#(,/$4_0x0\:)'_abs sin[1+!64]*/32#2; / the solution
                                           32#2  / take 2, 32 times (2 2 2 2 2...)
                                         */      / product beginning with left argument
                               sin[     ]        / built-in sine function
                                     !64         / range 0..63
                                   1+            / add 1, so 1..64
                           abs                   / built-in abs function
                          _                      / floor
             (          )'                       / do this together for each
                   0x0\:                         / convert to byte representation
                 4_                              / drop first 4 elements
                $                                / convert to string
              ,/                                 / flatten
         8 8#                                    / reshape to 8x8
   " "/:'                                        / join each with a single space
-1@                                            ; / print to stdout and swallow return

Perl 5, 56 54 52 bytes
printf'%08x%s'x64,map{0|2**32*abs sin,$_%8?$":$/}1..64

Saved 2 4 bytes thanks to @XCali
Try it online!

Save 2 bytes

Thanks! forgot about that trick :)

Actually, you can take off two more by eliminating that altogether.  The %x format only considers the integer portion.  Try it online!

Racket 125 bytes
(λ()(for((i(range 1 65)))(printf"~x "(inexact->exact(floor(*(expt 2 32)(abs(sin i))))))(when(= 0(modulo i 8))(printf"~n"))))

Ungolfed:
(define f
  (λ ()
    (for ((i (range 1 65)))
      (printf "~x " (inexact->exact(floor (*(expt 2 32) (abs (sin i)) ))))
      (when(= 0 (modulo i 8)) (printf "~n"))
      )))

Testing:
(f)

Output:
d76aa478 e8c7b756 242070db c1bdceee f57c0faf 4787c62a a8304613 fd469501
698098d8 8b44f7af ffff5bb1 895cd7be 6b901122 fd987193 a679438e 49b40821
f61e2562 c040b340 265e5a51 e9b6c7aa d62f105d 2441453 d8a1e681 e7d3fbc8
21e1cde6 c33707d6 f4d50d87 455a14ed a9e3e905 fcefa3f8 676f02d9 8d2a4c8a
fffa3942 8771f681 6d9d6122 fde5380c a4beea44 4bdecfa9 f6bb4b60 bebfbc70
289b7ec6 eaa127fa d4ef3085 4881d05 d9d4d039 e6db99e5 1fa27cf8 c4ac5665
f4292244 432aff97 ab9423a7 fc93a039 655b59c3 8f0ccc92 ffeff47d 85845dd1
6fa87e4f fe2ce6e0 a3014314 4e0811a1 f7537e82 bd3af235 2ad7d2bb eb86d391

Pip, 37 bytes
36 bytes of code, +1 for -S flag.
0X8-#_._MMLC(2**32*ABSI++,64)TB16<>8

Pretty straightforward implementation. Unfortunately, 10 bytes are needed to left-pad some of the values with 0. Try it online!
                         ,64          Numbers 0 to 63
                       ++             Increment to get 1 to 64
                     SI               Sine
                   AB                 Absolute value
             2**32*                   Multiply by 2^32
            (               )TB16     Convert to hex (implicitly truncating to int)
          LC                          Lowercase--Pip's base conversion uses uppercase :(
                                 <>8  Group into sublists of size 8
        MM                            Map this function to each item of each sublist:
  8-#_                                  1 if item is length 7, 0 if length 8
0X                                      That many zeros
      ._                                Concatenate to beginning of item
                                      Print separated first by newline then by space (-S)

Burlesque, 34 bytes
64{Tsab2 32**.*pd-.b68'0lp}GO8cosp

Try it online!
64      # Literal 64
{
 Ts     # Sin
 ab     # Abs
 2 32** # 2**32
 .*     # Times-by
 pd     # Floor
 -.     # Decrement by 1
 b6     # To base 16
 8'0lp  # Left pad to length 8 with 0s
}GO     # Range from [1, 64] and map
8co     # Chunks of 8
sp      # Pretty print array

05AB1E, 19 17 bytes
64LÅ½ÄžJ*hl8jð0:8ô»

-2 bytes by taking inspiration from @Dennis' Jelly answer regarding the leading 0s, so make sure to upvote him!
Outputs with trailing newline.
Try it online.
Explanation:
64L                # Push a list in the range [1,64]
   Å½              # Take the sine of each
     Ä             # Take the absolute value of that
      >            # Increase it by 1 (to avoid having to pad leading 0s later on)
       žJ*         # Multiply it by builtin 4294967296
          h        # Convert it from integer to hexadecimal
                   # (which implicitly truncates the decimals; and uses uppercase [A-F])
           l       # Convert that hexadecimal string to lowercase
            €¦     # Remove the first character from each (undoing the earlier increment)
              8ô   # Split the list into parts of size 8
                »  # Join each inner list by spaces, and then those strings by newlines
                   # (after which it is output implicitly with trailing newline)

source: Stack Exchange

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

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Is my emoji dry?
This is my pet emoji, Billy:
-_-

Emojis don't like to be in the rain, so Billy is sad... Let's draw him an umbrella to make him feel better!
  /\
 /  \
/    \

  -_-

This is good, he is entirely covered by his umbrella! Here is an example where only part of him is covered:
  /\
 /  \
/    \

     -_-

In this case, sections 2 and 3 of his body are exposed to the rain.
Umbrellas come in many shapes and sizes, but they're always made up from a series of ascending slashes / followed by a series of descending backslashes \. For example, these are all valid umbrellas:
  /\
 /  \
/    \

/\

    /\
   /  \
  /    \
 /      \
/        \

And these are not:
/   \

\/

  \
 / \
/   \

 0\
/  \

//\\
/  \

You need to determine which parts of my emoji are exposed to the rain.
Clarifications

Your program (or function) will take a 2d string as input. This can be in whatever format is most convenient or natural to your language. An array of strings, an array of arrays of characters, a string with newlines in it etc.

You must output which sections of the emoji are exposed to the rain. This can be zero-indexed or one-indexed, as long as you make this clear. Output can be in any reasonable format. If the entire emoji is protected from the rain, output nothing (or an empty array).

You can assume that all inputs will have a valid umbrella, and the same emoji: -_-. The emoji will always be on the last line of the input, however their might be several empty lines between the umbrella and the emoji.

Everything that isn't part of the umbrella or the emoji will be a space   character or newline.

The input will be padded with spaces so that the length of each line is the same.

Standard loopholes apply, and the shortest answer in bytes wins!
Test IO:
All of the sample cases will use one-indexing.
  /\
 /  \
/    \

  -_-

Outputs: []

----------------

   /\
  /  \

     -_-

Outputs: [2, 3]

----------------

    /\
   -_-

Outputs: [1]

----------------

     /\
    /  \
   /    \
  /      \
 /        \
/          \

               -_-

Outputs: [1, 2, 3]

Can we output the parts of the emoji that are in the rain? i.e. ["_","-"].

If our language supports strings, can we still accept a 2D array of characters? For example, Array in JavaScript has different functions available to it than String does.

@PatrickRoberts Yes, that is acceptable.

@EᴀsᴛᴇʀʟʏIʀᴋ No, you should output the numbers.

I think you mean emoticon.  Dry emoji would be  (or ☂ I suppose)

05AB1E, 18 17 15 bytes
Code:
|…-_-123:)ø€J€ï

Explanation:
|                  # Take all input as a list of strings.
 …-_-              # 3-char string, which results into "-_-".
     123:)         # Replace "-_-" with 123.
          ø        # Zip, resulting into the columns of the 2D array.
           €J      # Join each of them.
             €ï    # For each, convert to integer. If this is not possible, it will ignore
                     the result.
                   # Implicitly output the array.

Uses the CP-1252 encoding. Try it online! (make sure to pad all lines with spaces to the same length..

JavaScript (ES6), 95 bytes
a=>[...a[n=0]].map((_,i)=>a.map(s=>(c=s[i])>"-"&c<"_"?p=1:n+=!++c,p=0)|p<!c&&o.push(n),o=[])&&o

Input should be an array of strings, with each line padded with spaces to form a square. Output is an array of 1-indexed numbers.
Explanation

var solution =

a=>
  [...a[n=0]].map((_,i)=>  // n = current index of emoji, for each column i of input
    a.map(s=>              // for each line s
      (c=s[i])             // c = character in column
      >"-"&c<"_"?p=1       // p = 1 if column is protected from rain
      :n+=!++c,            // increment n if emoji character found, c = 1 if last line
                           // contained a space in the current column
      p=0
    )
    |p<!c&&o.push(n),      // if the emoji is not protected in the current column
    o=[]
  )
  &&o
<textarea id="input" rows="6" cols="40">   /\
  /  \

     -_-</textarea>

<button onclick="result.textContent=solution(input.value.split('\n'))">Go</button>

V, 20 19 bytes (non-competing)
G^R123?/
f\GddHÍó

Alternate, competing version (21 bytes):
G^R123?/
f\òjòddHÍó

Try it online! (Note, tryitonline.net uses a slightly old version of V. To compensate for this, it uses this slightly longer version)
Explanation:
G^          "Move to the first non-whitespace character on the last column
  R123<esc> "Replace the emojii with '123'

?/          "Move backwards to the last '/' character
  <C-v>     "Start a blockwise selection
       f\G  "Move the selection to the next '\', and then to the last line
d           "Delete the block selection
 dH         "Delete the umbrella

This alone produces the correct result in 17 bytes. However, it also creates some extra whitespace. I don't mind it, but I don't want to give myself an unfair advantage, so I'm adding two bytes:
Íó          "Remove all whitespace

JavaScript (ES6), 92 bytes
a=>a.map(s=>s.replace(/\S/g,(c,i)=>c>'-'&c<'_'?u[i]=3:++n&u[i]||r.push(n)),n=0,u=[],r=[])&&r

Accepts a ragged array of lines and returns a 1-indexed result. Explanation:
a=>a.map(               Loop through all lines
 s=>s.replace(/\S/g,    Loop through all non-whitepsace
  (c,i)=>c>'-'&c<'_'    If it's part of the umbrella
   ?u[i]=3              Mark that column as dry
   :++n&                Add 1 to the emoji index
     u[i]||             If the column is not dry
      r.push(n)         Add the emoji index to the result
  ),n=0,u=[],r=[]       Initialise variables
 )&&r                   Return result

Java 8 lambda, 241 218 201 191 185 184 (or 161) characters
Because ya know, also Java needs dry emojis.
import java.util.*;f->{int e,i=e=-1,c,l=f.length-1;while(++e<f[l].length&&f[l][e]!=45);List p=new Stack();l:for(;++i<3;){for(char[]r:f)if((c=r[e+i])==47|c==92)continue l;p.add(i);}return p;}

It returns an ArrayList a HashSet a Stack containing the parts of the emoji which are exposed to the rain (indexing starts at 0). The whole thing unwrapped:
import java.util.*;

public class Q82668 {
    static List isEmojiDryRevE(char[][] fieldToCheck) {
        int emojiStart, i = emojiStart = -1, j, rows = fieldToCheck.length - 1;

        while (++emojiStart < fieldToCheck[rows].length && fieldToCheck[rows][emojiStart] != 45)
            ;

        List parts = new Stack();
        emojiLoop: for (; ++i < 3;) {
            for (j = -1; ++j < rows;) {
                if (fieldToCheck[j][emojiStart + i] > 46) {
                    // umbrella part found
                    continue emojiLoop;
                }
            }
            // no umbrella part found
            parts.add(i);
        }
        return parts;
    }
}

Updates
I did some basic golfing. This includes putting the declarations together, compare with the ascii values to save some characters and shorten the loops.
Thanks to @user902383 for pointing out my dump mistake using ArrayLists instead of just Lists. I replaced the ArrayLists/Lists with HashSets/Sets which saves some more characters. Also thanks for his tip to use a foreach loop in the inner loop! Through that change I am able to create a variable for the index of the last grid row which shortens it a bit more. Overall 17 characters have been saved!
@KevinCruijssen suggested to remove the generics in the initialization, I went one step further: Remove all the generics. This saves another 10 characters.
I switched back from the foreach loop to the for loop. This makes it possible to skip comparing the last line which in turn allows me to shorten the comparison of the ascii values. In this context only '/', '\' and '_' have an ascii value over 46. If we don't check the last line we can use a > 46 check instead to checks for the actual value.
Thanks again to @user902383 for showing me that I use a lambda and can use List+Stack instead of Set+HashSet to shave off another character.

String returning version
@user902383 pointed out I can instead just create a String with the digits. This sounds very cheaty but others seem to solve it this way so here is a shorter version using a String return:
f->{int e,i=e=-1,c,r=f.length-1;while(++e<f[r].length&&f[r][e]!=45);String p="";l:for(;++i<3;){for(char[]o:f)if((c=o[e+i])==47|c ==92)continue l;p+=i;}return p;}

Ungolfed:
public class Q82668 {
    public static String isEmojiDryRevD(char[][] fieldToCheck) {
        int emojiStart, i = emojiStart = -1, c, rows = fieldToCheck.length - 1;

        while (++emojiStart < fieldToCheck[rows].length && fieldToCheck[rows][emojiStart] != 45)
            ;

        String parts = "";
        emojiLoop: for (; ++i < 3;) {
            for (char[] row : fieldToCheck) {
                if ((c = row[emojiStart + i]) == 47 | c == 92) {
                    // umbrella part found
                    continue emojiLoop;
                }
            }
            // no umbrella part found
            parts += i;
        }
        return parts;
    }
}

you broke rule number 1 always program to an interface,  if you use List instead ArrayList you can save 5 bytes

I think inner for loop could be replaced by foreach loop which should give you additional couple of bytes

So I deleted my last comment, as I thought this was an answer to another question... You're absolutely right, how could I do that wrong :O I'll change it in the next couple minutes.

As nowhere is specified output has to be a number, and i has single digit values, you could change your function to output you string instead array. it sounds reasonable, and it could save you lot od bytes

@user902383 It sounds very cheaty, but others seem to do it just like that so I'll add a version which uses strings.

Not entirely sure, but =new HashSet<>(); can most likely be golfed to =new HashSet();.

@KevinCruijssen the compiler produces a warning, so it is possible, but is it allowed?

@Frozn Why wouldn't it be allowed? I know the compiler produces a warning, which happens a lot during code-golfing. What I'm not sure of is if your code still works the same, haven't tested it. If it does, than removing the <> saves you 2 bytes. :)

in your longer solution if you change Set back to List and use Stack as implementation, you could save 1 byte

@user902383 I don't get that improvement... It still has the same length with Stack as the Set version

@Frozn im not sure ,Set p=new HashSet(); seems is longer than List p=new Stack(); to me

@user902383 yes, but I also need to change the return value. It is Set(3), Set(3) and HashSet(7) with a total length of 13 against List(4), List(4) and Stack(5) also 13 characters long. Good idea though...

@Frozn you would be right in good old java, but now we have lambda, and in lambda notation you don't specify type. hence you have Set(3) HashSet(7) against List(4) and Stack(5).

@user902383 Of course! That's what happens if you forget you write a lambda... I always write the function in the ungolfed version and then golf this into a lambda and the method of course needs a return type. Silly me!

@Frozn not sure did you realized, but i think you didn't updated your golfed versions

JavaScript (ES6), 117 112 bytes
s=>s.map(r=>r.map((c,i)=>~'-_'[o='indexOf'](c)&&!s.some(a=>~'/\\'[o](a[i]))?i-r[o]('-'):-1)).pop().filter(n=>~n)

Accepts a ragged array of strings arrays of characters, and returns 0-indexed results.
s=>s.map(     // for each row
  r=>         // row
    r.map(    // for each character
      (c,i)=> // character, index
        ~'-_'[o='indexOf'](c) // if character is part of emoji
        &&                    // and
        !s.some(              // none of the rows have umbrella in this column
          a=>~'/\\'[o](a[i])
        )
        ? // then return 0-index of emoji
          i-r[o]('-')
        : // else return -1
          -1
  )
)
.pop()         // get last element of string array
.filter(n=>~n) // filter out -1s

Demo

f=s=>s.map(r=>r.map((c,i)=>~'-_'[x='indexOf'](c)&&!s.some(a=>~'/\\'[x](a[i]))?i-r[x]('-'):-1)).pop().filter(n=>~n)
i.oninput=()=>o.value=f(i.value.split`\n`.map(r=>r.split``))
i.oninput()
<textarea rows=6 cols=20 id=i>
   /\
  /  \

     -_-</textarea>

<input readonly id=o>

I like your comments!

Retina, 56 bytes
Byte count assumes ISO 8859-1 encoding.
m`(?<!(?(2)!)^(?<-2>.)*\S(.*¶)+(.)*).(?<=([-_]+))|\D
$.3

Try it online!
This is a single substitution stage, where the regex matches one of the emoji characters, provided that there's a non-space character (i.e. a / or \) somewhere above in the same horizontal position, and then we capture the number of emoji characters up to that point. This match is replaced with the length of that last capture, which gives us the index of this unsheltered emoji character. The regex also contains a |\D to match everything else which gets replaced with nothing at all, so we remove all the other characters.

Can you explain more how this regex looks above the emoji characters?

@sintax It uses balancing groups to count the characters preceding it on its own line. This measures its horizontal position. Then after I've matched the / or \, I'm popping from that group again while matching the stuff preceding that, and then make sure I've completely depleted the group. This basically ensures that the horizontal position of the emoji and the roof character match.

Pyth, 27 23 bytes
0-indexed.
-m.xsd;.T:R"-_-"s`M3.zd

Try it online!
Explanation
-m.xsd;.T:R"-_-"s`M3.zd

                    .z   all lines of input, as a list
         :R"-_-"s`M3     replace "-_-" by "012"
                         "012" is generated by s`M3
       .T                transpose, return all columns
                         The sample input becomes:
                           0
                           1
                          /2
                         /
                         \
                         \
 m   d                   for each line:
  .xs                        attempt to convert to integer.
      ;                      if errors, replace to space
-                     d  remove all spaces

History
27 bytes: sM:#"^ *\d"0.T:R"-_-"s`M3.z (Try it online!)

Matlab, 43 bytes
@(x)find(sum((x(:,x(end,:)~=' '))~=' ')==1)

This code finds column positions of non-space characters in the final row of the input, sums the number of non-space characters in those columns, and finds where there's only one such character (the emoji's character, un-shielded by umbrella!). This code only returns proper results for well-formed umbrellas (it assumes any character above our emoji is part of a well-formed umbrella).
Here is a bit of utility code for writing test cases and checking my work:
ws = @(x) repmat(' ',1,x);  %  for making strings of spaces
% for writing three-storey umbrellas over an emoji located left-edge at position x
thrht = @(x) strvcat([ws(3) '/\' ws(3); ws(2) '/  \' ws(2); ws(1) '/' ws(4) '\' ws(1); ws(8)], [ws(x-1) '-_-']);
twht = @(x) strvcat([ws(3) '/\' ws(3); ws(2) '/  \' ws(2); ws(8)], [ws(x-1) '-_-']);

Running x = thrht(7) gives
x =

   /\
  /  \
 /    \

      -_-

Or
    x = twht(0)
gives
x =

   /\
  /  \

 -_-

Python 2, 114 111 bytes
def f(a):c=a.find("\n")+1;r=a.rfind;g=lambda i:([i],[])[r("\\")%c>=r("-")%c-2+i>=r("/")%c];print g(0)+g(1)+g(2)

Uses 0 based indexing.
Try it here.

APL, 31 bytes
{(⍳3)∩,(~∨⌿⍵∊'/\')/+\+\'-_-'⍷⍵}

This takes a character matrix as input.
Tests:
      t1 t2 t3 t4
┌──────┬────────┬──────┬─────────────────┐
│  /\  │   /\   │    /\│     /\          │
│ /  \ │  /  \  │   -_-│    /  \         │
│/    \│        │      │   /    \        │
│      │     -_-│      │  /      \       │
│  -_- │        │      │ /        \      │
│      │        │      │/          \     │
│      │        │      │                 │
│      │        │      │                 │
│      │        │      │                 │
│      │        │      │                 │
│      │        │      │              -_-│
└──────┴────────┴──────┴─────────────────┘
      {(⍳3)∩,(~∨⌿⍵∊'/\')/+\+\'-_-'⍷⍵} ¨ t1 t2 t3 t4
┌┬───┬─┬─────┐
││2 3│1│1 2 3│
└┴───┴─┴─────┘

Explanation:

'-_-'⍷⍵: in a matrix of zeroes the size of the input, mark the position of the beginning of '-_-' in the input with a 1.
+\+\: Running sum over rows. The first one makes 0 0 0 1 0 0 ... into 0 0 0 1 1 1 ..., the second one then makes it into 0 0 0 1 2 3 ....
⍵∊'/\': mark all occurrences of '/' and '\' in the input with 1s.
∨⌿: or over columns. This marks with an 1 all positions on the last row that are covered by the umbrella.
~: not, because we need the opposite
(...)/...: Select all uncovered columns from the running sum matrix from earlier
,: Get a list of all values in the resulting matrix.
(⍳3)∩: Intersection between that and 1 2 3 (this gets rid of any selected 0s or higher values, which would be spaces).

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


text:
The teacher is always wrong, flip his answer
Your dumb teacher is always wrong, so flip his answer.
Change these responses
True -> False
Yes -> No
0 -> 1
Yeah -> Nope

and vice versa. Keeping punctuation and the first letter's capitalization counts. Only one condition will be passed to the program.
You only need to accept the following test cases:
True <-> False
True. <-> False.
true <-> false
true. <-> false.
Yes <-> No
Yes. <-> No.
yes <-> no
yes. <-> no.
0 <-> 1
Yeah <-> Nope
yeah <-> nope
Yeah. <-> Nope.
yeah. <-> nope.

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

05AB1E, 45 41 40 39 38 bytes
Code:
“‰¦žä¥æ€¸pe…Ü€¸“ð¡2ôDí«D€™«vy`:D_D¹Êiq

Explanation:
It first starts with the compression:
“‰¦žä¥æ€¸pe…Ü€¸“

This is a compressed version of "true false yeah nope yes no". After that, we split on the spaces with ð¡, resulting into:
['true', 'false', 'yeah', 'nope', 'yes', 'no']

We slice this array into pieces of 2 with 2ô, resulting into:
[['true', 'false'], ['yeah', 'nope'], ['yes', 'no']]

We duplicate this array and reverse each element of it with Dí. Then we append this to our first array with «, resulting into:
[['true', 'false'], ['yeah', 'nope'], ['yes', 'no'], ['false', 'true'], ['nope', 'yeah'], ['no', 'yes']]

To get the titlecased words, we duplicate the array again and convert each word to titlecase with €™. Finally, this is appended to the initial array. So, the final list is:
[['true', 'false'],
 ['yeah', 'nope'],
 ['yes', 'no'],
 ['false', 'true'],
 ['nope', 'yeah'],
 ['no', 'yes'],
 ['True', 'False'],
 ['Yeah', 'Nope'],
 ['Yes', 'No'],
 ['False', 'True'],
 ['Nope', 'Yeah'],
 ['No', 'Yes']]

The imporant part here is that Nope comes before No. Eventually, we get to this part of the code:
vy`:D_D¹Êiq

Explanation:
v            # For each in the array...
 y`          #   Push the array (containing 2 words) and flatten.
   :         #   Replace the first word with the second.
    D_       #   Duplicate and negate (resulting 0 into 1 and 1 into 0).
                 If this is not possible, this results into nothing.
      D      #   Duplicate the top of the stack again.
       ¹Ê    #   If it's not equal to the inital input string...
         iq  #     Quit the program and implicitly print the processed string.

Uses the CP-1252 encoding. Try it online!.

Pyth, 44 bytes
j\.XXXcz\.`M2)Jc."<unprintables>"\b)rR3J

Hexdump:
00: 6A5C 2E58 5858 637A 5C2E 604D 3229 4A63
10: 2E22 6179 0862 3C40 D23B 9A54 C2B4 A20A
20: FEE7 8701 225C 6229 7252 334A

Test suite.

updated question.

What are ""?

See hexdump or test-suite.

TI-Basic, 217 bytes
Longer than I thought it would be...
Input Str1
If Str1="0
Then
Disp 1
Stop
End
"e"=sub(Str1,2,1
sub("FalsefalseNopenope",1+5not(Ans)(sub(Str1,1,1)="t")+10Ans+4Ans(sub(Str1,1,1)="y"),5-Ans-2(sub(Str1,3,1)="s"))+sub(" .",1+(sub(Str1,length(Str1),1)="."),1

Can’t you save a byte by using ‘Return’ instead of ‘Stop’, since Return is a 1-byte token?

@HelloGoodbye Good question. "Return" could be used instead of "Stop" here; since there are no subprograms, the behavior would be identical. However, Stop is also a 1-byte token (0xD9), so there is no compelling reason to use one over the other.

Hmm. My brain was for some reason telling me that Stop was 2 bytes. I must have been thinking of something else. Sorry!

@HelloGoodbye No problem! Here's a useful page (which you may already know about) that I refer to frequently to check if tokens are 1 byte: http://tibasicdev.wikidot.com/one-byte-tokens

Yep, that’s the one I use!

Python 3, 227 bytes
def f(x):l=["True","False","True.","False.","true","false","true.","false.","Yes","No","yes","no","Yes.","No.","yes.","no.","0","1","Yeah","Nope","Yeah.","Nope.","yeah","nope","yeah.","nope."];r=l.index(x);return l[r+1-2*(r%2)]

Ungolfed form:
def f(x):
    l=["True","False","True.","False.","true","false","true.","false.","Yes","No","yes","no","Yes.","No.","yes.","no.","0","1","Yeah","Nope","Yeah.","Nope.","yeah","nope","yeah.","nope."]
    r=l.index(x)
    return l[r + 1 -2*(r % 2)]

Hello, and welcome to PPCG!

Pyke, 51 44 bytes
.d̾ॗǣ/ற㻯dc2cDMl4+D.F\.+)+T`]1+Dm_+Y@

Try it here!
.d̾ॗǣ/ற㻯dc2c                         - {'yeah': 'nope', 'true': 'false', 'yes': 'no'}
             DMl4+                    - ^ += map(^, str.title())
                  D.F\.+)+            - ^ += map(^+".")
                          T`]1+       - ^ += [repr(10)]
                               Dm_+   - ^ += map(^, reversed)
                                   Y@ - dict(^)[input]

Hexdump: 2E64 CCBE E0A5 97C7 A32F E0AE B1E3 BBAF 6463 3263 444D 6C34 2B44 2E46 5C2E 2B29 2B54 605D 312B 446D 5F2B 5940

It is actually 44 bytes, unless there's a null byte somewhere.

@LeakyNun I'm still getting 45 bytes... It doesn't have a null byte in it

Mind putting down your hexdump?

2e 64 06 CC BE E0 A5 97 C7 A3 2F E0 AE B1 E3 BB AF 64 63 32 63 44 4d 6c 34 2B 44 2e 46 5C 2E 2B 29 2B T 60 5D 31 2B 44 6d 5f 2B 59 40 - Ok, 44 then

Well, there's a 06 in the third byte in your hexdump.

Hexdump: 2E64 06CC BEE0 A597 C7A3 2FE0 AEB1 E3BB AF64 6332 6344 4D6C 342B 442E 465C 2E2B 292B 5460 5D31 2B44 6D5F 2B59 40 (45 bytes)

That was by looking at the URL in the try-it link

Perl 6,  86  81 bytes
{my@a=<true yes yeah 1 0 nope no false>;my%h=@a Z=> reverse @a;S:ii/(@a)/{%h{lc $0}}/}
{my@a=<true yes yeah 1 0 nope no false>;S:ii/(@a)/{%(@a Z=> reverse @a){lc $0}}/}
Explanation:
{
  # list of responses ordered in such a way that
  # reversing it will give you the opposite response
  my @a = <true yes yeah 1 0 nope no false>;

  # create a lookup table
  my %h = @a Z=> reverse @a;

  # the :samecase / :ii modifier causes the regex to call .samecase
  # on the replacement, and also turns on :ignorecase / :i
  S:samecase /
    (@a) # match against the values in @a
  /{
    %h{lc $0}
  }/
}

Test:
#! /usr/bin/env perl6

use v6.c;
use Test;

my @tests = (
  < True False >, < True. False. >, < true false >, < true. false. >,
  < Yes  No >, < Yes. No. >, < yes  no >, < yes. no. >,
  < 0 1 >,
  < Yeah Nope >, < yeah nope >, < Yeah. Nope. >, < yeah. nope. >,
);

plan @tests * 2;

my &answer-flip = {my@a=<true yes yeah 1 0 nope no false>;my%h=@a Z=> reverse @a;S:ii/(@a)/{%h{lc $0}}/}

for @tests -> ($a,$b) {
  is answer-flip($a), $b, "$a => $b";
  is answer-flip($b), $a, "$b => $a";
}

Which prints out 1..26 on a line, followed by 26 lines of ok ... messages.

Java, 332 274 205 bytes
String s(String p){String[]l={"True","true","Yes","yes","Yeah","yeah","0","1","nope","Nope","no","No","false","False"};for(int j=0;j<14;j++)if(p.matches(l[j]+".?"))return p.replace(l[j],l[13-j]);return"";}

Gotta love the uncreative Java golf! Credit to @Leaky Nun for helping!

for(int j=0;j<14;j++)if(p.matches(l[j]))return p.replace(l[j],l[14-j]); (I'll let you figures out which 14 strings to keep :p )

Python 154 bytes
a=['True','True.','true','Yes','Yes.','yes','Yeah','Yeah.','yeah','0','False','False.','false','No','No.','no','Nope','Nope.','nope',1]
a[a.index(i)+10]

Emacs Lisp 221 Bytes
(defun g(a b)(when(string-match a s)(throw s(replace-match b'()'()s))))
(defun f(s)(catch s(dolist(l'(("true"."false")("yeah"."nope")("yes"."no")("0"."1")))(let((a(car l))(d(cdr l))(case-fold-search t))(g a d)(g d a)))))

Ungolfed:
(defun g (a b)
  ;; when a is in s (dynamical scope) throws the replacement string
  (when (string-match a s)
    (throw s (replace-match b nil nil s))))

(defun f (s)
  (catch s ; catch replacement
    (dolist (l'(("true"."false")("yeah"."nope")("yes"."no")("0"."1")))
      (let ((a(car l))
            (d(cdr l))
            ;; Emacs string-match ignores case, when case-fold-search is true.
            ;; The standard is t, but through customization/local variables
            ;; this can change. Therefore we set it explicitly.
            ;; We could have saved 20 bytes here...
            (case-fold-search t))
        (g a d)
        (g d a)))))

The main "feature" here, is that string-match can be made to ignore case and that replace-match is somewhat intelligent with replacing. For instance, this would also work with TRUE and FALSE. We also exploit dynamical scope to save typing.

PowerShell, 113 bytes
$x=($s=(echo True False Yes No 0 1 Yeah Nope)|%{$_;$_|% *wer}|%{$_;"$_."}).indexOf("$args")
$s[$x+4-8*($x%8-ge4)]

Try it online!

Python 3, 121 bytes
def f(i):a=[(w,w.title())[i<'a']+'.'[i[-1]>'.':]for w in'true yes yeah 1 false no nope 0'.split()];return a[a.index(i)-4]

Try it online!

05AB1E, 32 bytes
l'.¡“0žä€¸€¸pe¥æ…Ü‰¦ 1“#Â‡'.ýs.Ï

Try it online!

JavaScript (Node.js), 103 bytes
x=>x.replace(a=/%|Y|y|T|t|rue|0|ope|o|es|eah|1|alse|f|F|n|N|%/g,x=>G[17-G.indexOf(x)],G=(a+0).split`|`)

Try it online!


text:
Turn an Array into a Math Problem
Given a nonempty list of nonnegative integers, consider rewriting it as an arithmetic problem where:

A plus sign (+) is inserted between pairs of numbers that increase from left to right (a.k.a. from the start of the list to the end).
A minus sign (-) is inserted between pairs of numbers that decrease from left to right.
A multiplication sign (*) is inserted between pairs of numbers that are equal.

Said another way: any sublist a,b becomes a+b if ab, and a*b if a==b.
For example, the list
[12, 0, 7, 7, 29, 10, 2, 2, 1]

would become the expression
12 - 0 + 7*7 + 29 - 10 - 2*2 - 1

which evaluates to 75.
Write a program or function that takes in such a list and evaluates it, printing or returning the result.

Order of operations matters. Multiplications should be done before any addition or subtraction.
If the input list has one number, that should be what it evaluates to. e.g. [64] should give 64.
Use of eval or exec or similar constructs is allowed.

Here are some additional examples:
[list]
expression
value

[0]
0
0

[1]
1
1

[78557]
78557
78557

[0,0]
0*0
0

[1,1]
1*1
1

[2,2]
2*2
4

[0,1]
0+1
1

[1,0]
1-0
1

[1,2]
1+2
3

[2,1]
2-1
1

[15,4,4]
15-4*4
-1

[9,8,1]
9-8-1
0

[4,2,2,4]
4-2*2+4
4

[10,9,9,12]
10-9*9+12
-59

[1,1,2,2,3,3]
1*1+2*2+3*3
14

[5,5,4,4,3,3]
5*5-4*4-3*3
0

[3,1,4,1,5,9,2,6,5,3,5,9]
3-1+4-1+5+9-2+6-5-3+5+9
29

[7637,388,389,388,387,12,0,0,34,35,35,27,27,2]
7637-388+389-388-387-12-0*0+34+35*35-27*27-2
7379

The shortest code in bytes wins. Tiebreaker is earlier answer.

Regarding "order of operations matters" it might be good to state explicitly that addition and subtraction are left-associative and have the same precedence.

Python 2, 63 bytes
p=s='print-'
for x in input():s+='*+-'[cmp(x,p)]+`x`;p=x
exec s

Constructs and evals the expression string. The arithmetic symbol is chosen by comparing the previous number p to the current one x. The symbol is appended followed by the current number.
The first number is handled with a clever trick from Sp3000. The initial value of p is set to a string, which is bigger than any number and therefore causes a - before the first number. But, s is initialized to print- at the same time that makes the result start with print-- (thanks to xsot for saving 2 bytes by initializing with print.)

I think you can move print into the string and use exec instead of eval.

Pyth, 31 26 19 17 16 15 bytes
Expressions with * won't evaluate online, but they would theoretically work.
2 bytes thanks to Maltysen.
vsm+@"*-+"._-~k

Test suite (with evaluation).
The other cases (without evaluation).
History

31 bytes: M+G@"*-+"->GH<GHv+sgMC,JsMQtJ\x60e
26 bytes: M+G@"*-+"->GH<GHv+sgVQtQ\x60e
19 bytes: vtssVm@"*-+"->Zd<~Z
17 bytes: vtssVm@"*-+"._-~Z
16 bytes: vssVm@"*-+"._-~k
15 bytes: vsm+@"*-+"._-~k

Why won't multiplication work online? If you're not sure it works it may be best to test a bit more before answering.

Because security stuff (evaluation only works for + and - online)

@HelkaHomba I didn't have a chance to try it offline yet, but it should work. The online interpreter uses the --safe switch, which replaces eval with ast.literal_eval.

Ok, fair enough.

Confirmed, this works with the offline interpreter.

I tried the latest revision.

nice one, have an upvote

Jelly, 18 16 15 14 bytes
I0;ð1g×⁹⁸œṗP€S

Uses no built-in eval. Try it online! or verify all test cases.
How it works
I0;ð1g×⁹⁸œṗP€S  Main link. Input: A (list)

I               Increments; compute the deltas of all adjacent items of A.
 0;             Prepend a 0.
   ð            Begin a new, dyadic chain.
                Left argument: D (0 plus deltas). Right argument: A
    1g          Compute the GCD of 1 and each item in D.
                This yields 1 for non-negative items, -1 for negative ones.
      ×⁹        Multiply each 1 or -1 with the corresponding item of A.
                This negates every item in A that follows a - sign.
        ⁸œṗ     Partition the result by D. This splits at occurrences of non-zero
                values of D, grouping items with identical absolute value.
           P€   Take the product of each group.
             S  Sum; add the results.

I out-golfed you!

Nicely done. I should add Python's eval as an atom...

I out-out-golfed you. :P

Nicely done, your turn!

MATL, 12 bytes
Y'^l6MdZSh*s

This uses @aditsu's very nice idea of run-length encoding.
Try it online!
Explanation
       % Take input vector implicitly
Y'     % RLE. Produces two vectors: values and lengths
^      % Rise each value to the number of consecutive times it appears. This
       % realizes the product of consecutive equal values
l      % Push 1
6M     % Push vector of values again
d      % Consecutive differences
ZS     % Sign function. Gives 1 or -1 (no 0 in this case)
h      % Concatenate horizontally with previous 1
*      % Multiply. This gives plus or minus depending on increasing character
s      % Sum of vector. This realizes the additions or subtractions
       % Display implicitly

Haha had just written up something similar. RLE works out well for this

@Suever I see :-D

CJam, 20
q~e`{~_W-g\:W@#*}%:+

Try it online
Explanation:
q~       read and evaluate the input (array of numbers)
e`       RLE encode, obtaining [count number] pairs
{…}%     map each pair
  ~_     dump the count and number on the stack, and duplicate the number
  W-     subtract the previous number (W is initially -1 by default)
  g      get the sign of the result
  \      swap with the other copy of the number
  :W     store it in W (for next iteration)
  @#     bring the count to the top, and raise the number to that power
  *      multiply with the sign
:+       add all the results together

JavaScript (ES6), 54
p=>eval(0+p.map(v=>x+='*-+'[(p>v)+2*(p<v)]+(p=v),x=1))

eval receives a comma separated list of expressions and returns the value of the last one.
Test

f=p=>eval(0+p.map(v=>x+='*-+'[(p>v)+2*(p<v)]+(p=v),x=1))

t=p=>(0+p.map(v=>x+='*-+'[(p>v)+2*(p<v)]+(p=v),x=1))

function Test() {
  var a=I.value.match(/\d+/g).map(x=>+x) // convert input to a numeric array

  var x=f(a),y=t(a)
  O.textContent='Value '+x+'\n(no eval '+y+')'
}

Test()
#I { width:80%}
<input value='12, 0, 7, 7, 29, 10, 2, 2, 1' id=I>
<button onclick='Test()'>Test</button>

That's the worst abuse of the comma operator that I can remember seeing on this site...

Julia, 76 57 bytes
!x=[[" ""-*+"[2+sign(diff(x))]...] x]'|>join|>parse|>eval

My first time golfing Julia, so maybe there are obvious improvements.
Try it online!
Dennis saved a ton of bytes.

Nice job. I didn't realize you can define a custom function for !.

@Eᴀsᴛᴇʀʟʏ Iʀᴋ http://codegolf.stackexchange.com/a/81028/12012

Pyth - 23 22 20 bytes
As with Kenny's, multiplication doesn't work online.
vs.i+\+@L"*+-"._M-Vt

Test Suite without doing eval.

Whoo is Kevin ?

@LeakyNun I forgot your name after a while >_>

@Maltysen Haha, you're thinking of kevin-not-kenny Lau

Sorry, I was eating, so I could not golf my solution. Your turn.

@LeakyNun almost there

Oh, thanks for the ._, didn't know of that

R, 92 bytes
There's likely still some good golfing that can be done here.
eval(parse(t=paste(i<-scan(),c(ifelse(d<-diff(i),ifelse(d>0,"+","-"),"*"),""),collapse="")))

Ungolfed:
i = scan()                # Read list from stdin
d = diff(i)               # Calculate difference between each element of list
s = ifelse(d,             # If d!=0
             ifelse(d>0,  # And if d>1
                    "+",  # Return plus
                    "-"), # Else return minus
             "*")         # Else (i.e. d==0) return multiply.
s = c(s,"")               # Pad the list s with an empty string, so it's the same
                          # length as i
p = paste(i,s,collapse="")# Paste the elements of i and s into one long string.
eval(parse(t=p))          # Evaluate the string as a language object.

I managed to save just one byte using an indexing approach

Brachylog, 34 32 bytes
~b≜ḅ⟨h⟨h≡^⟩l⟩ᵐs₂ᶠ{zh>₁&ttṅ|tt}ᵐ+

Try it online!

TI-BASIC, 146 bytes
I'll format it nicely when not on mobile. Sleep escapes me, so you get this. Enjoy.
Prompt L₁
"(→Str1
For(A,1,dim(L₁
{0,1→L₂
{0,L₁(A→L₃
LinReg(ax+b) L₁,L₃,Y₁
Equ►String(Y₁,Str2
sub(Str2,1,-1+inString(Str2,"X→Str2
If A>1
Then
L₁(A-1
2+(Ans>L₁(A))-(Ans<L₁(A
Str1+sub("+*-",Ans,1→Str1
End
Str1+Str2→Str2
End
expr(Str1

Javascript ES6, 64 62 chars
a=>eval(a.map((x,i)=>x+('*+-'[xa[i])*2])).join``+1)

Should not this be a function and a a parameter?

This is invalid as-is.

@edc65, yes, it should. But in fact it was counted (61 specified, but real code length was 59), I just badly copied a new code (the edit should be a[i+1]...a[i+1] => a[++i]...a[i] - 2 chars shorter, but I mistakenly replaced the whole code dropping a=>).

@EᴀsᴛᴇʀʟʏIʀᴋ, it's just a wrong paste. See comment above and edit history for more detailes.

@Qwertiy okay cool. Nice answer btw..

I count 62 chars - can we get a recount?

@Bevo, fixed...

Java, 384 bytes
int s(int[]l){int n=l[0],m;for(int i=0;i<l.length-1;i++)if(l[i]<l[i+1])if(i<l.length-2&&l[i+1]!=l[i+2])n+=l[i+1];else{m=l[i+1];while(i<l.length-2&&l[i+1]==l[i+2])m*=l[(i++)+1];n+=m;}else if(l[i]>l[i+1])if(i<l.length-2&&l[i+1]!=l[i+2])n-=l[i+1];else{m=l[i+1];while(i<l.length-2&&l[i+1]==l[i+2])m*=l[(i++)+1];n-=m;}else{m=l[i];while(i<l.length-1&&l[i]==l[i+1])m*=l[i++];n+=m;}return n;}

Ungolfed try online
int s(int[] l)
{
    int n=l[0], m;

    for(int i=0; i<l.length-1; i++)
    {
        if(l[i] < l[i+1])
        {
            if (i<l.length-2 && l[i+1]!=l[i+2])
            {
                n += l[i+1];
            }
            else
            {
                m = l[i+1];
                while(i<l.length-2 && l[i+1]==l[i+2]) m *= l[(i++)+1];
                n += m;
            }
        }
        else if(l[i] > l[i+1])
        {
            if (i<l.length-2 && l[i+1]!=l[i+2])
            {
                n -= l[i+1];
            }
            else
            {
                m = l[i+1];
                while(i<l.length-2 && l[i+1]==l[i+2]) m *= l[(i++)+1];
                n -= m;
            }
        }
        else
        {
            m = l[i];
            while(i<l.length-1 && l[i]==l[i+1]) m *= l[i++];
            n += m;
        }
    }

    return n;
}

Some quick golfs: int a=l.length, && => &, put the int i=0 on the same "line" as int n=l[0],m.

In if(i<l.length-2&&l[i+1]!=l[i+2])n+=l[i+1];else{m=l[i+1];while(i<l.length-2&&l[i+1]==l[i+2])m*=l[(i++)+1];n+=m;, you can just replace this with the content inside the else block.

Perl, 49 bytes
48 bytes code + 1 for -p
s/\d+ (?=(\d+))/$&.qw(* - +)[$&<=>$1]/ge;$_=eval

Usage
perl -pe 's/\d+ (?=(\d+))/$&.qw(* - +)[$&<=>$1]/ge;$_=eval' <<< '12 0 7 7 29 10 2 2 1'
75

Notes
I learnt here that you can capture a lookahead in PCRE, although it's a little unintuitive ((?=(\d+)) instead of ((?=\d+))). It does make sense after reading though as you would be capturing a zero-length match (the lookahead) with the latter, and instead capture the match with the former).
Thanks to @ninjalj for saving 8 bytes!

@LeakyNun I never know exactly what to count for that, I can't find the relevant meta post, I'm happy to bump the count, but I thought that since you can run with -e for free, adding a p making it -pe was +1? Will update for now, but if you could find a source I could quote/link to going forward, that'd be awesome!

@DomHastings 1 is correct, per the reason you say + this meta post

Thanks @Sp3000! I couldn't find that post for the life of me! @LeakyNun meta post for +1 as per comment from Sp3000

Instead of using chained conditional operators, you can use the spaceship operator to select from a list: $&.qw(* - +)[$&<=>$1] in the replacement part of the s/// operator.

@ninjalj Of course! amazing, thanks! -8 with that!

Javascript ES6, 79 chars
a=>eval(`${a}`.replace(/(\d+),(?=(\d+))/g,(m,a,b)=>a+('*+-'[+a<+b|(+a>+b)*2])))

Actually, 30 bytes
;2@VpXdX`i-su"+*-"E`M' @o♀+εj≡

Unfortunately, because the eval (≡) command only evaluates literals on TIO, this program does not work on TIO.
Explanation:
;2@VpXdX`i-su"+*-"E`M' @o♀+εj≡
;                               duplicate input
 2@V                            overlapping sublists of length <= 2
    pXdX                        discard first and last element (length-1 sublists)
        `i-su"+*-"E`M           map: for each pair of elements
         i-su                     flatten, subtract, sign, increment (results in a 0 if b  a)
             "+*-"E               select the correct operation
                     ' @o       put a space at the beginning of the list to pad it properly
                         ♀+     pairwise addition (since addition is not defined for strings and integers, this just zips the lists and flattens the result into a single flat list)
                           εj   join with empty string
                             ≡  eval

R, 120 44 bytes
r=rle(scan());c(1,sign(diff(r$v)))%*%r$v^r$l

Try it online!
The algorithm is similar to this answer's, but I only realized it after coding my answer. Much better than my original answer that was using eval(parse).
Fully leverages R's vectorized operations - does the * operation first using rle(x)$values ^ rle(x)$lenghts and dot-products this vector with sign( diff( rle(x)$values ) ) (predended with 1).

05AB1E (legacy), 17 16 15 bytes
ü.S…*-+sè‚ζJJ.E

-2 bytes thanks to @Emigna.
Try it online or verify all test cases.
Explanation:
ü                  # Pair-wise loop over the (implicit) input-list
                   #  i.e. [12,0,7,7] → [[12,0],[0,7],[7,7]]
 .S                # Calculate the signum of the pair (-1 for ab)
                   #  i.e. [[12,0],[0,7],[7,7]] → [1,-1,0]
   …*-+sè          # Index over "*-+" (with wrap-around)
                   #  i.e. [1,-1,0] → ['-','+','*']
         ‚ζ        # Zip the two lists together (appending the operands to the numbers)
                   #  i.e. [12,0,7,7] and ['-','+','*','+']
                   #   → [[12,'-'],[0,'+'],[7,'*'],[7,' ']]
           JJ      # Join them together
                   #  [[12,'-'],[0,'+'],[7,'*'],[7,' ']] → '12-0+7*7 '
             .E    # Evaluate as Python code
                   #  i.e. '12-0+7*7' → 61

Due to modular indexing, you can remove > by moving + to the end of the string.

@Emigna Not sure how I missed that.. Thanks!

You can save another byte by removing Ć and ¨, if you use ‚ζ instead of ø

@Emigna Oh, now that is smart! Thanks. I knew the enclose was a bit of a weird work-around, but didn't knew how to fix it. ‚ζ is a perfect alternative work-around, since the space is ignore in the eval. Thanks again. :)

PHP, 103 bytes
Neat challenge. This got longer than expected. I think using array_map or similar won't improve the byte count, as anonymous functions are still expensive in PHP.
foreach(fgetcsv(STDIN)as$v)(0<=$p?$o.=$p.('*-+'[($p>$v)+2*($p<$v)]):_)&&$p=$v;echo eval("return$o$v;");

Runs from command line, will prompt for a comma separated list, like:
php array_to_math.php
12, 0, 7, 7, 29, 10, 2, 2, 1

PowerShell v2+, 62 bytes
-join($args|%{"$o"+'*+-'[($o-lt$_)+2*($o-gt$_)];$o=$_})+$o|iex

Takes input as space-separated command-line arguments, which gets converted into automatic array $args. We iterate through each element, using helper variable $o each iteration to remember what our previous entry was. We use a indexed-string to pull out the appropriate operator, done by performing math on the implicitly-converted Boolean values (e.g., if the previous entry is smaller, the [] evaluates to 1+2*0 so '*+-'[1] means the + is selected).
The concatenated strings are left on the pipeline. We collect all of those snippets together (e.g., 3-, 1+, 4-, etc.) with a -join operation, concatenate on the final number (implicitly converted to string), and pipe it to iex (alias for Invoke-Expression and similar to eval).

A concern is that if the caller has already given $o a value (say $o = 999) then the expression in this entry will not compute the correct value.  An initialization of $o needs to be added to this solution.

@Bevo This is intended to be a full script, executed via the command line, and not a function or via the interactive shell. The vast majority of my submissions are as such, since in such a scenario, there is no predefined variables to worry about and thus the code can be a bit shorter.

Japt, 25 bytes
Would like to cut it shorter, but I couldn't make an eval-less version work.
S+Uä!- ®"*+-"gZÎÃ¬)íU
OxU

Try it online!

Got it down to 22 bytes but still think it can be improved on.

Japt -x, 21 19 bytes
änJ f mÎí*Uò¦ ®ÎpZÊ

Try it

Explanation
                        :Implicit input of array U
  J                     :Prepend -1
än                      :Get deltas
    f                   :Filter (remove 0s)
      m                 :Map
       Î                : Signs
        í               :Interleave
          U             :  Original input
           ò            :  Partition on
            ¦           :   Inequality
              ®         :  Map each sub-array Z
               Î        :    Get first element
                p       :    Raise to the power of
                 ZÊ     :     Length of Z
         *              :Reduce each pair of elements by multiplcation
                        :Implicitly reduce by addition and output


text:
7-segment differences
I think most people around here know what a 7-segment display for digits is:
 _         _   _         _    _    _    _    _
| |    |   _|  _|  |_|  |_   |_     |  |_|  |_|
|_|    |  |_   _|    |   _|  |_|    |  |_|   _|

We can define the 7-segment difference (7SD) between two digits to be the number of segments that need to be toggled to switch from one to the other. E.g. the 7SD between 1 and 2 is 5 (the three horizontal segments and the lower two vertical segments need to be toggled), and the 7SD between 6 and 8 is 1.
Furthermore, we can define the 7SD between two numbers to be the sum of 7SDs between their corresponding digits. If one number is longer than the other, we assume they are right-aligned and add the number of segments needed to display the additional most-significant digits of the larger number. As an example, consider the 7SD between 12345 and 549:
  x:  1 2 3 4 5
  y:      5 4 9
7SD:  2+5+2+0+1 = 10

Your task is to compute 7SD between n and n+1, given n.
For convenience, here is the full table of 7SDs between individual digits. The row _ represents an empty position.
   _ 0 1 2 3 4 5 6 7 8 9

_  0 6 2 5 5 4 5 6 3 7 6
0  6 0 4 3 3 4 3 2 3 1 2
1  2 4 0 5 3 2 5 6 1 5 4
2  5 3 5 0 2 5 4 3 4 2 3
3  5 3 3 2 0 3 2 3 2 2 1
4  4 4 2 5 3 0 3 4 3 3 2
5  5 3 5 4 2 3 0 1 4 2 1
6  6 2 6 3 3 4 1 0 5 1 2
7  3 3 1 4 2 3 4 5 0 4 3
8  7 1 5 2 2 3 2 1 4 0 1
9  6 2 4 3 1 2 1 2 3 1 0

Input

Input is a single positive integer n.
You may write a program or function, taking input via STDIN (or closest alternative), command-line argument or function argument.
You may assume that the input is at most one less than the largest number which can be represented by your language's standard integer type, as long as that type supports at least values up to and including 127.

Output

You should print a single integer, the 7SD between n and n+1.
You may output via STDOUT (or closest alternative), function return value or function (out) argument.

Scoring
Standard code-golf rules apply, shortest code (in bytes) wins.
Test Cases
For some obscure reason, this sequence isn't in OEIS yet, although there is the closely related sequence A123587. Here are the first 100 numbers (starting with n = 1, 2, 3, ...):
5, 2, 3, 3, 1, 5, 4, 1, 4, 4, 5, 2, 3, 3, 1, 5, 4, 1, 7, 4, 5, 2, 3, 3, 1,
5, 4, 1, 4, 4, 5, 2, 3, 3, 1, 5, 4, 1, 5, 4, 5, 2, 3, 3, 1, 5, 4, 1, 5, 4,
5, 2, 3, 3, 1, 5, 4, 1, 3, 4, 5, 2, 3, 3, 1, 5, 4, 1, 7, 4, 5, 2, 3, 3, 1,
5, 4, 1, 6, 4, 5, 2, 3, 3, 1, 5, 4, 1, 3, 4, 5, 2, 3, 3, 1, 5, 4, 1, 6, 4

The first input for which the 7SD is greater than 9 is 1999 which should yield 11. Here are some other larger examples:
n          7SD
1999        11
12345        1
999999      14
5699999     15
8765210248   1

Jelly, 25 22 21 20 bytes
‘DṁDḟ"DFị9979482ḃ5¤S

Try it online! or verify all test cases.
Background
We first increment the input n and discard all digits of n + 1 that haven't changed.
For example, if n is 5699999, we get the following.
n     : 5700000
n + 1 : 5699999
Result:  700000

All digits in this result have a fixed number of segments that have to get toggled. We can convert the list of toggles to bijective base 5 to save some bytes.
digit:   1 2 3 4 5 6 7 8 9 0
toggles: 4 5 2 3 3 1 5 4 1 2

The output is simply the sum of the individual toggles.
This works for most values of n, but special care must be taken if n + 1 has more digits than n. In this case, all digits must be 9's, and we solve this problem by chopping off a trailing 0 from n + 1.
For example, if n is 999999, we get the following.
n     :  999999
n + 1 : 1000000
Result: 100000

This works because the leading 1 evaluates to 4 toggles (distance between 0 and 1), while the actual amount of toggles is 2 (distance between 0 and 1), and suppressing one trailing 0 removes its 2 toggles from the sum.
How it works
‘DṁDḟ"DFị9979482ḃ5¤S  Main link. Argument: n

‘                     Compute n+1.
 D                    Convert n+1 from integer to base 10.
   D                  Convert n from integer to base 10.
  ṁ                   Mold the left result as the right result.
                      This chops of a 0 if n+1 has more digits than n.
    ḟ"D               Vectorized filter-false with the base 10 digits of n.
                      This removes the digits from n+1 that are identical to
                      the corresponding digits of n.
       F              Flatten the resulting list of lists.
         9979482ḃ5¤   Convert 9979482 to bijective base 5.
                      This yields [4, 5, 2, 3, 3, 1, 5, 4, 1, 2].
        ị             Retrieve the digits at the right that correspond to the
                      indices at the left.
                   S  Compute the sum of the results.

JavaScript (ES6), 46 40 bytes
f=n=>n?+"452331541"[n%10]||f(n/10|0)+2:2

Alternative formulation, also 46 40 bytes:
f=n=>n?26523308>>n%10*3&7||f(n/10|0)+2:2

Edit: Saved 6 bytes thanks to @xsot.

If the logical or operator in ES6 behaves like the one in python you can further shorten your second code. Refer to my submission for an example.

@xsot Actually I can shorten both! I don't think it helps me to change the zero special-case because that's only 4 bytes as it is.

Wow, I'm surprised that the first one works. I expected an error.

@xsot javascript does not simply error out. It just does whatever seemed like the most correct approach during those ten days Javascript was born. . Later versions let you opt into an a bit stricter behavior, but why would anyone here do that? Shortcircuiting behavior of logical operators is pretty common, though, only PHP doing the wrong thing by always returning a boolean.

@JanDvorak Actually, I was surprised by the fact that you can access an index of a string bigger than the length of the string.

@xsot That's because it's not an index, it's a property reference, so all I end up doing is referencing an undefined, hence falsey, property.

Can someone explain the magic numbers and where they came from?

@PatrickRoberts It's the string reversed and converted from base 8 to decimal.

Oh, I just found the explanation of the string here

Python, 50 48 bytes
f=lambda n:26523308-0**n*2>>n%10*3&7or f(n/10)+2

Explanation
This function operates on the least significant digit of the number n, summing the 7SD of the digits when incremented by one until after the first non-9 digit.
26523308 is a bitmask that encodes the mapping for the digits 0-8. When n=0, which only occurs when n comprises only 9s, the answer will be off by two. This is compensated by the expression 0**n*2. As for the digit 9, the bitmask evaluates to zero which will trigger the recursive call while adding 2 to the 7SD.

Can we have some explanation of how this does the transformation? I mean, +1 for cleverness but I got lost in the clever.

05AB1E, 31 30 28 27 26 bytes
Code:
9Ü©T%•2X›ùì•sè¹g®g-·¹Ú9Q·O

Explanation (outdated):
9Ü                              # Trim off trailing 9's
  ©                             # Copy this into the register
   T%                           # Get the last non-9 digit
     žh                         # Short for 0123456789
       •2X›ùì•§                 # Compressed version of 4523315412
               ‡                # Transliterate

We are changing the following to the last non-9 digit:
0 -> 4
1 -> 5
2 -> 2
3 -> 3
4 -> 3
5 -> 1
6 -> 5
7 -> 4
8 -> 1
9 -> 2

For the special cases:
                ¹g              # Get the length of the input
                  ®g            # Get the length of the input with all trailing 9 gone
                    -           # Substract, giving the number of 9's at the end of
                                  the input
                     2*         # Multiply by two
                       O        # Sum everything up
                        ¹Ú      # Uniquify the input
                          9Qi   # If this is equal to 9 (only 9's in the input)
                             Ì  #   Increment by 2 (_ -> 1)

Uses the CP-1252 encoding. Try it online!.
28 byte alternative: D[¤©•2X›ùì•sès®9Ê#¨]\rÚ9Q4*O.

Java, 63 bytes
The world is righted as Python passes Java once more.
Cause, ya know, Java.
int f(int n){return n>0?n%10<9?26523308>>n%10*3&7:2+f(n/10):2;}

See it on ideone
Maxes out at 2147483647, as that is Java's Integer.MAX_VALUE.
This is a port of my Python answer which is a port of the ES6 answer.

MATL, 61 39 36 bytes
tQvV15\'3dAsMh818RG5'6Y27WZaw)Z}Z~Bz

Try it online!
Explanation
tQv            % Implicit input. Duplicate, add 1, concatenate vertically
V              % Convert to 2D char array: each number in a row, possibly left-padded
               % with a space
15\            % Modulo 15. With modular indexing this corresponds to the order
               % '9', ' ', '0', '1', ..., '8'
'3dAsMh818RG5' % This string encodes active segments for each of the 11 chars
6Y2            % Source alphabet printable ASCII chars (predefined literal)
7W             % Target alphabet: [0 1 ... 127]
Za             % Base conversion: decode string into vector of 11 numbers, where each
               % number from 0 to 127 encodes the 7-segment representation of a digit,
               % in the order '9', ' ', '0', '1', ..., '8'
w              % Swap top two elements in stack
)              % Use as index. Gives 2-row array, where each column is a digit
Z}             % Split into the two rows
Z~             % Bitwise XOR, elementwise
B              % Convert to binary. Each number gives a row
z              % Number of nonzero elements. Implicitly display

Julia, 44 bytes
!x=x<1?2:(t=x%10÷1)<9?3045058÷6^t%6:2+!.1x

Try it here.
Dennis saved a byte!

Out of curiosity, why not just use the numbers?

I can't believe there's a Julia TIO. Welp, time to learn Julia then...

Python, 71 66 bytes
48 bytes by xsot. Even more magic maths!
f=lambda n:(2+f(n/10)if n%10==9else 26523308>>n%10*3&7)if n else 2

See it on ideone
Because the prior Python answer doesn't work and is far from optimal. A simple port of a previous ES6 version. Now using bit twiddling (from the ES6 alternate formulation) to cut out a cast!
Can be made to work with Python 3 by explicitly using floordiv for +1 byte.

you can take out the space after 9

@Maltysen apparently you are correct. I thought it would error because e is a valid letter after a num in, for example, 9e9.

This is longer than my Java answer! How can we remedy this? Note that reversing the comparison from n%10==9 to n%10<9 doesn't save as the if doesn't need a space in this order.

And I come back to see xsot has made a much shorter Python version. Well done!

Pyth - 78 30 27 bytes
That first one was embarrassing.
s@LjC"
(J"ThC{I#.tjRThBQT

Test Suite.

26 bytes

26 bytes

Jolf, 32 bytes
Ώ?H?<γ%Ht9P."452331541"γ+2Ώc/Ht2

Try it here!
Explanation
This is a transpilation of Neil's answer.
Ώ?H?<γ%Ht9P."452331541"γ+2Ώc/Ht2
Ώ                                 define a function Ώ of H
 ?H                            2  (when H is zero, return is 2)
      %Ht                         H mod 10
     γ                            γ = ^
   ?<    9                        is it less than 9?
                                  if so:
           ."452331541"γ           get the γth element of that string
          P                        as a number
                                  else
                        +2         add two to
                          Ώ        Ώ over
                           c/Ht    int(H / 10)

J, 53 bytes
2:`((2+10$:@<.@%~[)`(6|3045058<.@%6^])@.(9>])10&|)@.*

Originally based on @Neil's solution. Then improved by saving a byte using the same formula in @Lynn's solution.
The 54 byte version based on the string is
2:`((2+10$:@<.@%~[)`('452331541'".@{~])@.(9>])10&|)@.*

Usage
   f =: 2:`((2+10$:@<.@%~[)`(6|3045058<.@%6^])@.(9>])10&|)@.*
   f 1999
11
   f 1999 12345 999999 5699999 8765210248
11 1 14 15 1

Retina, 34 bytes
M!`.9*$
^9
0
T`d`4523315412
.
$*
.

Try it online! (The first line just allows the processing of multiple test cases at once.)
Explanation
Like most answers have discovered by now, we don't need to use the full table, since only the least-significant non-9 digit changes when incrementing. That's also how this answer works.
M!`.9*$

This matches (M) the regex .9*$ i.e. the first digit that is only separated by 9s from the end. The ! tells Retina to replace the input with this match, discarding everything that doesn't affect the 7SD.
^9
0

If the input now starts with a 9 that means, the input itself consisted only of 9s, so the 7-segment display needs to prepend a 1 which costs 2. The simplest way to handle this is to replace the leading 9 in this case with a 0, since the cost of incrementing a 9 (to 0) is 2 and the cost of incrementing 0 (to 1) is 4, so this raises the overall cost by 2 as required.
T`d`4523315412

Now we have a transliteration stage which replaces each digit with its cost for incrementing it (since the d expands to 0123456789). Note that this is the first subdiagonal of the 7SD table.
.
$*

This replaces each digit n with n copies of 1, i.e. it converts each digit to unary, and since there are no separators immediately adds them together.
.

Finally, we count the number of characters (i.e. number of matches of .) in the result, which converts the unary sum back to decimal.


text:
Counting Eisenstein primes
Introduction
Eisenstein integers are complex numbers of the form
a+bω
Where a,b are integers, and
ω = e^(2πi/3)
The Eisenstein integers form a triangular lattice in the complex plane:

We say that an Eisenstein integer z=a+bω is prime if it cannot be written as the product of two non-unit (not 1,-1,ω,-ω,ω^2, or -ω^2) Eisenstein integers
Program
Input: A natural number n.
Output: The number of Eisenstein primes which are of the form a+bω for which a,b are natural numbers (including zero) less than or equal to n
Test Cases
0 → 0
1 → 0
2 → 5
3 → 9
4 → 13
5 → 20
Scoring
This is code-golf, so least amount of bytes wins

Could you provide some test cases?

I don't understand the test cases. The number of a,b pairs for 2 is only 4 so how could 5 of them be prime?

@Maltysen let me rewrite the definition

@user3502615 i'm talking about the part where you say "are of the form a+bω for which a,b are natural numbers (including zero) less than n"

@Maltysen There are 5 numbers: 2ω, 2ω+1,2ω+2,ω+2, and 2

The title is somewhat misleading: the obvious interpretation would be OEIS A003627.

@user3502615 you had less than, not equal to before. it makes sense now

Jelly, 24 bytes
Rð_²+×µ€µ³RḊm3,µÆP×1¦3FS

Roughly the same approach as my Julia answer.
                          Initial argument: n
R                           Compute [1, 2, …, n]
 ð_²+×                      (λ, ρ) —→ (λ − ρ)² + λρ (which is λ² − λρ + ρ²)
      µ€                    Zip with itself. Call this Q.

        µ                 Refocus argument: Q
         ³                  The initial argument n
          RḊm3              Compute candidate green line primes: [2, 5, 8, …, n]
              ,             Call this P. Make pair with argument.

               µ          Refocus argument: [P, Q]
                ÆP          Check primality
                  ×1¦3      Multiply the first element by 3
                      FS    Sum everything
                            (The result is 3·countprimes(P) + countprimes(Q))

Julia, 66 62 60 bytes
!n=sum(isprime,[a<1<b%3?b:a^2-a*b+b^2for a=[0;0;0:n],b=0:n])

Try it online!
Explanation
We’re interested in the primes in this parallelogram on the complex plane (example for n = 4):

We can split them into primes on the green lines, and on the gray lines.
Wikipedia tells me an Eisenstein number z is a green line Eisenstein prime iff |z| is a natural prime equal to 2 mod 3.
It also says z is a gray line Eisenstein prime iff |z|² = a² − ab + b² is a natural prime.

So we loop over a = 0…n and b = 0…n, and check:

If (a = 0 or b = 0 or a = b) and max(a, b) % 3 = 2, then count whether max(a, b) is a prime.
Else, count whether a² − ab + b² is a prime.

However, we can abuse the distribution’s symmetry. Instead of counting each green line once, we can just count one green line thrice! That is, only check a = 0 and increment the counter by three when we find a green line prime. The a=[0;0;0:n] achieves exactly this.
Since we know we’re only considering the green line a = 0, we can replace max(a, b) by b.
The “green line condition” is nicely expressed in Julia using operator chaining: a<1<b%3.
(For the remaining green lines, we will never return a false positive: if a = b or b = 0 then a² − ab + b² = a², which can’t be prime.)
Ideas
Maybe, instead of writing a^2-a*b+b^2, I can conditionally replace the exponent at b by 1 when a<1<b%3 – then the expression reduces to b. This doesn’t seem to be shorter, but it’s neat!

CJam (34 bytes)
qi,:)_2m*{_:*\:-_*+}%\1>3%3*+:mp1b

Online demo