text:
Alex-style Addition
Inspired by Alex's glorious Learn you an R for great good, we are going to humbly recreate Alex's "one true R program" -- but with a twist.
Alex-style Addition works like this -- it has a 90% chance of simply returning the sum of the two numbers given and a 10% chance of recursively Alex-adding the first number and the second number + 1. This means that, potentially, an addition could be off by 1 or more.
Challenge
Write a full program or function that takes two integers and Alex-adds them as defined. You may assume that your program will not stack overflow if your language doesn't have tail recursion. (Note that you do not have to implement it recursively, as long as the probabilities are the same.)
Reference Implementation (Groovy)
int alexAdd(int a, int b) {
  int i = new Random().nextInt(11);
  if(i == 1) {
    return alexAdd(a,b+1);
  } else {
    return a + b;
  }
}

Try this fiddle online.
Leaderboard

var QUESTION_ID=66522,OVERRIDE_USER=8478;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

So it gives the sum of two numbers plus a geometric random variable with failure probability 1/10?

@xnor Essentially, yes. I defined it recursively so that it is easier to understand, but you don't have to do it recursively (CJam solution does not, for instance)

Can the two integers be taken as a two-element array? (input [3 4] instead of inputs 3 and 4)

@LuisMendo This is fine. I'm not too picky about the input format.

Why was this sandboxed for 20 minutes? That seems to be missing the point of the sandbox.

@PeterTaylor The one minor issue with it was fixed almost immediately, and the question was so simple I didn't think it needed to stay in the sandbox for that long  (it had already been looked at by 10 people which I thought was sufficient peer review for such a simple challenge). The main reason I had it in the sandbox was to see if people thought it was too simple.

I would say it still has a major issue, in that it's not clear whether you insist on implementations being written as recursive functions or just on giving the right distribution, but it's far too late to do anything about clarifying that now.

I didn't mean for it to come off as requiring recursion. Fixed.

Is it required for submissions to have some chance (assuming true randomness) of giving an answer >15, even if the float precision is 15 digits?

I'm not sure I understand. Do you mean "to have some chance of adding 15 or more to the number?"

So depending on the size of your stack, there could potentially be a fairly large chance of a stack overflow... just by adding.

In your reference implementation, I would use the clearer b+1 instead of ++b.

@PaŭloEbermann I'm not sure why I had ++b there... Fixing

The leader board appears to be borked.

Pyth, 8
u+G!OTsQ

Try it online
This uses Pyth's second mode on reduce, that looks for repeated input then exits.
Explanation
u+G!OTsQ  ##  Implicit: Q=eval(input())
u     sQ  ##  reduce with 2 arguments, which causes a loop until the reduce gets the
          ##  same argument twice
 +G       ##  lambda G,H: G + ...
   !OT    ##  boolean not of random value from 0 to 9 inclusive

If the extra alex-add occurs it will run again, but if not then it exits.

This... is pure black magic. O_o

This... is ridiculous.

R, 60 47 28 bytes
function(a,b)a+b+rgeom(1,.9)

This is an unnamed function object that accepts two numbers and returns a number. It does not use recursion.
As xnor pointed out in a comment, this problem can be viewed as simply adding two numbers plus a geometric random variable with failure probability 1/10.
Why is that true? Think about it in terms of recursion, as it's described in the post. In each iteration we have a 10% chance of adding 1 and recursing, and a 90% chance of exiting the function without further addition. Each iteration is its own independent Bernoulli trial with outcomes "add 1, recurse" (failure) and "exit" (success). Thus the probability of failure is 1/10 and the probability of success is 9/10.
When dealing with a series of independent Bernoulli trials, the number of trials needed to obtain a single success follows a geometric distribution. In our case, each recursion means adding 1, so when we do finally exit the function, we've essentially counted the number of failures that occurred before the first success. That means that the amount that the result will be off by is a random variate from a geometric distribution.
Here we can take advantage of R's expansive suite of probability distribution built-ins and use rgeom, which returns a random value from a geometric distribution.
Ungolfed:
f <- function(a, b) {
    a + b + rgeom(n = 1, prob = 0.9)
}

Minkolang 0.14, 19 11 12 bytes
This is the "function" version; it assumes a and b are already on the stack, pops them off and pushes the modified version of a+b. The closest equivalent to functions in Minkolang is to use F, which pops off b,a and jumps to (a,b) in the codebox. Then when the program counter hits an f, it jumps back to where F was used.
(+$01$h`d)xf

This is the full program version, 15 bytes. (nn takes two numbers from input and N. outputs the result and stops.)
nn(+$01$h`d)xN.

I stole the algorithm from Doorknob's answer; the while loop repeats so long as the generated random number is less than 0.1, adding 1 each time. Try it here (full program version) and run it 100 times here.
Explanation
(              Open a while loop
 +             Adds the top two items of the stack
  $0           Pushes 0.1
    1$h        Pushes a random number between 0.0 and 1.0, inclusive
       `       Pops b,a and pushes a > b
        d      Duplicate the top of stack
         )     Close the while loop when the top of stack is 0
          x    Dump the extra, leading 0

The cleverest part here is d. The top of stack at that point in time will be either 0 or 1. If it's 0, the while loop exits. Otherwise, it continues. As I duplicate the top of stack, it will be [a+b,1] the second time through the loop, so the + at the beginning adds the 1 (and likewise for subsequent trips).

Is this really a function? I quickly scanned through the language documentation, and couldn't find anything describing function definitions. Based on the explanation, it looks more like a code fragment.

@RetoKoradi: I can put such a "code fragment" on it's own line, jump to it with 0kF (where k is some number), and jump back with f at the end. That's the closest you'll get to a function in Minkolang.

Isn't that technically like saying "my CJam code fragment is a function; you just have to surround it with curly braces"? At the very least, you should probably include the f at the end in the char count (and technically the preceding newline if you're feeling extra-pedantic, but I don't think that's necessary).

If the language doesn't have functions, you can always post full programs. My understanding is that when it says "function", it either has to be a named function, or an anonymous function (which is typically an expression that can be assigned to a function variable). I once posted something similar to this in CJam, and Martin quickly called me out on it, saying that it was a code fragment, and not a function.

@RetoKoradi: Alright, that's understandable. What do you think of Doorknob's suggestion?

@RetoKoradi: Is my edit satisfactory?

CJam, 12 11 bytes
{{+Amr!}h;}

Thanks to @MartinBütter for saving a byte with this super clever trick!
{         }
 {     }h    Do-while that leaves the condition on the stack.
  +          Add: this will add the numbers on the first iteration...
   Amr!      ... but a `1` (i.e. increment) on future ones.
         ;   Pop the remaining 0.

Old answer:
{+({)Amr!}g}

Try it online.
Explanation:
{          }  A "function."
 +            Add the input numbers.
  (           Decrement.
   {     }g   A while loop.
    )         Increment.
     Amr      Random number [0,9).
        !     Boolean NOT.

The basic algorithm is "while (0.1 chance), increment the number," which eliminates the need for the recursion.

Javascript ES6, 38 bytes
f=(a,b)=>Math.random()<.1?f(a,b+1):a+b

f=(a,b)=>new Date%10<1?f(a,b+1):a+b for 35 bytes

@WallyWest Unfortunately the probability when using the Date timestamp won't be accurate because if it evaluates true it will keep adding 1 for the rest of the millisecond.

I tried the geometric distribution f=(a,b)=>a+b-~~Math.log10(Math.random()) but it is 2 bytes longer.

Can input currying to save few bytes

MATL, 14 13 12 bytes
is`r.1<tb+w]

This is just the loop method, add the inputs (entered as [a b]) then keep adding one while a uniform random number between 0 and 1 is less than 0.1. Full description below:
i         % input [a b]
s         % sum a and b
`         % do...while loop
  r       % get a uniformly distributed pseudorandom numbers between 0 and 1
  .1      % push 0.1 onto the stack
  <       % is the random number less than 0.1?
  t       % duplicate the T/F values
  b       % bubble a+b to the top of the stack
  +       % add the T/F to a+b
  w       % swap elements in stack to get the other T/F back to exit/continue the loop
]         % end

Took off 1 byte by changing input spec (from ii+ to is).

The old way was based on taking the base-10 log of a random number between 0 and 1 to work out the amount to add to a+b, however it would only work up to 15 repetitions due to floating point accuracy.
iir10,2$YlZo-+

In this code, 10,2$YlZo- does base-10 logarithm of the random number and rounds up to the nearest integer.

Fair comment, although I'd like to see you generate 15 with any other solution presented :P Another way, for 15 bytes, is the simple looping version: ii+`10Yr1=tb+w], not golfed yet.

Actually I can amke the loop shorter! Thanks @ThomasKwa!

Very nicely done!

TI-BASIC, 15 bytes
While rand<.1
Ans+.5
End
sum(Ans

This takes the input as a two-element list from Ans. While a random number is less than 0.1, it does vectorized addition to 0.5 on the list. Increasing each element by 0.5 increases the sum by 1. I believe this is the shortest TI-BASIC solution.
The 9-byte program sum(Ans)-int(log(10rand doesn't work, because rand only has 14 digits of precision, and thus it can't give a number less than 10-14.

Worth noting that for it to add 14, you'll also have to watch pigs fly and Hell freeze over. And by the time you add 14, I'll have done something with my life.

Python, 66 65 64 63 bytes
from random import*
g=lambda*s:randint(0,9)and sum(s)or g(1,*s)

Try it online
Thanks to Sherlock9 for the corrections and the byte saved.
Thanks to Mathias Ettinger for another byte.
Thanks to mbomb007 for a byte.

62?

the smart way is 76 :(

@ASCII-only Using .9>random() isn't quite 9-out-of-10, because of uneven distribution of floats

Binary-Encoded Golfical, 32 29+1 (-x flag) = 30 bytes
Hexdump (manually edited to correct for a bug in the image-to-binary part of the transpiler, which has since been fixed):
00 B0 02 15 14 0C 01 14 15 14 1B 1E 3A 14 0C 01
14 00 0A 14 38 00 01 23 1D 4C 14 17 14

This encoding can be converted back into the original graphical representation using the included Encoder utility, or run directly using the -x flag.
Original image:

Magnified 50x:

Explanation: The top row is the main block. It reads a number, copies it to the right, reads another number, adds them, copies the result to the right, does some RNG stuff, and, with probability 90%, prints the result of the addition. The rest of the time, it is sent to the bottom row, where it puts a one in the first cell and goes back to the main row just before the addition instruction (using a north turn then an east turn).

Can you add an explanation? This is super cool.

Julia, 30 bytes
f(a,b)=rand()>0.9?f(a,b+1):a+b

This is a recursive function f that accepts two numbers and returns a number of the same type. It should work fine for any numeric type.
First we check whether a random float between 0 and 1 is greater than 0.9. If so, we recurse with a little extra somethin' somethin', otherwise we just add.

Vitsy, 12 10 bytes
aR)[1+0m]+
aR          Get a random number in [0,10)
  )[    ]   If its truncated int is 0, do the stuff in brackets.
    1+0m    Add 1 to one of the items and execute the 0th index of code.
         +  Add the numbers together.
Try it online!
Note that this has a tiny chance of a stack overflow error. We're talking (.1)^400 chance. It also exits on error due to how I caused recursion.

APL, 17 bytes
{1=?10:⍺∇⍵+1⋄⍺+⍵}

This is an unnamed dyadic function.
Ungolfed:
{1=?10:            ⍝ If a random number between 1 and 10 is 1,
       ⍺∇⍵+1       ⍝ Recurse on the inputs with one incremented
            ⋄⍺+⍵}  ⍝ Otherwise return the sum of the inputs

Pyth, 14 12 bytes
KsQW!OT=hK;K

My first real Pyth golf!
Takes input on STDIN in the format a,b.
Explanation:
KsQ       read STDIN, assign sum to variable K
W         while...
  !OT       not rand(10)
  =hK;      increment K
K         implicit-output of K

Thanks to @FryAmTheEggman for shaving off two chars by giving me a shorter way to increment a variable!

Seriously, 10 bytes
,Σ1±╤_G_\+

This program generates a random variable from a geometric distribution by transforming a uniform distribution. It takes input as a list: [2,3] (braces optional). Try it online.
Explanation:
,Σ1±╤_G_\+
,Σ          get sum of input
  1±╤_      push ln(0.1)
      G_    push ln(random(0,1))
        \   floored division
         +  add

Given a random variable X ~ Uniform(0, 1), it can be transformed to a random variable Y ~ Geometric(p) with the formula Y = floor(log(X)/log(p)).

Lisp, 58 bytes
My first time writing Lisp!
(defun +(a b)(if(<(random 10)9)(- a(- b))(- a(-(+ b 1)))))

You can use this special addition exactly as you would usually add in Lisp:
> (+ 1 3)
4
> (+ 1 3)
5

I would love to hear suggestions as I am brand new to the language.

Would (- a(- -1 b)) work? Saves you 2 bytes if it does.

@Neil, I don't think that works because the function should be recursive

Thanks for explaining why the expression looks so cumbersome.

Microscript, 29 21 bytes
isi+vzr10!{l1vzr10!}l

I tried to make a Microscript II answer but for some reason I couldn't get the addition loop to work right :(

Mathematica, 32 bytes
If[RandomReal[]<.1,+##,#0@##+1]&

Explanation:
                               &   A function returning
If[                           ]     if
   RandomReal[]                       a random number in [0,1)
               <                     is less than
                .1                    .1
                  ,                 , then
                   +                 the sum of
                    ##                all arguments
                      ,             , otherwise,
                       #0@            this function applied to
                          ##           all arguments
                            +        plus
                             1        one.

Note that this function works for any number of inputs.

Mouse-2002, 41 39 38 bytes
No recursion.
&TIME &SEED ??&RAND k*&INT 9=[+1+!|+!]

Explained:
&TIME &SEED               ~ painfully obvious

? ?                       ~ get some input
&RAND 10 * &INT 8 >       ~ get a random number 0-1 * 10, make it an int & check if >8
[                         ~ if true
  + 1 + !                 ~ add the input then add 1 and print
|                         ~ else
  + !                     ~ add and print
]                         ~ endif
$                         ~ (implicit) end of program

Or, if you're a functional programming fanboy, and recursion is your deal then 57 bytes:
&TIME &SEED #A,?,?;!$A&RAND k*&INT 9=[#A,1%,2%1+;|1%2%+]@

Explained:
&TIME &SEED            ~ painfully obvious

#A, ?, ?; !            ~ call with input & print

$A                     ~ begin a definition of a function A

  &RAND 10 * &INT 8 >  ~ same as above
  [
    #A, 1%, 2% 1 +;    ~ call with args and add 1
  |
    1% 2% +            ~ else just add
  ]
@                      ~ end func
$                      ~ as above

TeaScript, 18 bytes 21
#$r<.1?f(l,i¬):l+i

This is a TeaScript function. Assign it to a variable or just run it directly.
Try it online

Candy, 11 bytes
+#10H{.}10g

The long form is:
add          # add two numbers on the stack
number digit1 digit0 rand  # random int from 0 to 9
if           # if non-zero
  retSub     # terminate loop
endif
digit1       # push 1 to stack
digit0 goto  # loop to start

APL (Dyalog Unicode), 13 12 bytesSBCS
Basically the same as FryAmTheEggman's Pyth solution. -1 thanks to Erik the Outgolfer.
Anonymous tacit infix function.
{⍵+1=?10}⍣=+

Try it online!
+ add the arguments
{…}⍣= apply the following function until two successive applications have the same result:
 ?10 random integer in the range 1–10
 1= is one equal to that? (i.e. 1⁄10th chance)
 ⍵+ add the argument to that

You can take two integers as two arguments and remove the /.

@EriktheOutgolfer Yeah.

C, 71 51 39 37 bytes
First code-golf, done in C... I don't think it will beat anything, and may be golfed down a lot
EDIT 3: cuted 2 bytes thanks to @Mego , by writing .1 instead of 0.1 and rewriting the ternary operator
a(x,y){return(rand()<.1?a(1,y):y)+x;}

EDIT 2: cuted 12 bytes, following gnu99, every variable is an int if not stated otherwise. Same goes for the return type of function
a(x,y){return rand()<0.1?a(x,y+1):x+y;}

EDIT : cuted 20 bytes, forgot that basic .h aren't necessary in C99 (using gcc for instance). It will produce a warning :)
int a(int x,int y){return rand()<0.1?a(x,y+1):x+y;}

71 Bytes solution :
#include <stdlib.h>
int a(int x,int y){return rand()<0.1?a(x,y+1):x+y;}

If you want to see lots of output, you can use the following code
#include <stdio.h>
#include <stdlib.h>
int a(int x,int y){return rand()<0.1?a(x,y+1):x+y;}

int main(void)
{
    int i,j;
    for(i=0;i<10;i++)
        for(j=0;j<10;j++)
            printf("%d + %d = %d\n",i,j,a(i,j));
    return 0;
}

that isn't how rand() works. it returns an integer 0 >= x >= RAND_MAX. the probability here isn't 1/10, it's 1/(RAND_MAX+1)

MATL, 12 13 14 bytes
r.1H$YlY[ihs

Input is of the form [3 4], that is, a row vector with the two numbers.
Example
>> matl r.1H$YlY[ihs
> [3 4]
7

Explanation
This generates the geometric random variable without loops, by directly applying a a transformation to a uniform random variable. Note that log0.1 a is used instead of log a / log 0.1 to save 1 byte.
r        % random number with uniform distribution in (0,1)
.1       % number 0.1
H$       % specify two inputs for next function
Yl       % logarithm in specified base (0.1)
Y[       % floor. This produces the geometric random variable with parameter 0.1
i        % input vector of two numbers
h        % concatenate horizontally with the previously generated random value
s        % sum of vector elements

Jelly, 7 bytes
‘⁵XỊ¤¿+

Try it online!
How it works
‘⁵XỊ¤¿+  Main link. Arguments: n, m (integers)

    ¤    Combine the three atoms to the left into a niladic chain.
 ⁵       Yield 10.
  X      Pseudo-randomly generate a positive integer not greater than 10.
   Ị     Insignificant; test if the generated integer is 1 (or less).
     ¿   While chain yields 1:
‘          Increment n.
      +  Add m to the result.

Java 8, 57 56 bytes
4 years and no Java answer? Shame.
int a(int a,int b){return.1>Math.random()?a(a,b+1):a+b;}

Try it online!
-1 byte thanks to ceilingcat

Vyxal RṀ, 7 bytes
+{₀℅¬|›

Try it Online!
Vyxal, 8 bytes
+{₀ʁ℅¬|›

Try it Online!
+        # Add the two (implicitly input) numbers
 {       # While...
    ℅    # Random choice of...
   ʁ     # range 0 to...     (Unnecessary in flagged version)
  ₀      # 10 (exclusive)
     ¬   # Is 0
      |› # Increment

7 bytes

Julia 1.0, 27 bytes
a\b=rand()<.1 ? 1+a\b : a+b

Try it online!
Bonus: for 2 additionnal bytes, we can overwrite the + function for even more fun:
a+b=rand()<.1 ? -~a+b : a- -b

Try it online!

Seriously, 13 bytes
,,1W+9uJYWDkΣ

Uses a similar strategy to Doorknob's CJam answer (increment number while random float is less than 0.1), except it uses integers, and increments while random integer in [0,9] is less than 1. The lack of easy recursion hurts.
Try it online (needs manual input)
Explanation:
,,1W+9uJYWDkΣ
,,1            get input, push 1
   W     W     while loop:
    +            add top two elements
     9uJ         push a random integer in [0, 9]
        Y        push 1 if random value is falsey (0) else 0
          DkΣ  decrement top value and add everything together

The while loop leaves the stack like this:
n: the # of times the random value was < 0.1, plus 1
b: the second input
a: the first input

Shifting n up by 1 is necessary to get the while loop to run, since 0 is falsey. It's easily dealt with by decrementing n after the while loop, so the final result is a + b + (n - 1).

Perl 6, 26 bytes
Actually doing it recursively:
sub f{.1>rand??f |@_,1!![+] @_} # 31 bytes

Create a possibly empty sequence of 1s followed by the arguments, then sum them all together.
{[+] {1}...^{rand>.1},|@_} # 26 bytes

( it can actually take any number of arguments )
usage:
# give the lambda a name
my &f = {...}

say f 1,2; # one of 3,4,5 ... *

23 bytes

Pyth, 11 bytes
+sQ-18l`hO0

A direct Pyth port of my Python answer.
+             Add up
 sQ            the sum of the input and
   -           the difference of
    18          18 and
      l`         the string length of
        hO0       one plus a random number in [0,1)

Octave, 20 bytes
@(a,b)a+b+geornd(.9)

Sum of the inputs, plus a random sample from the geometric distribution with parameter 0.9.

MATLAB  , 51 bytes
function f(a,b)
if rand > .1;a+b;else;f(a,b+1);end

Result is found in the 'ans' automatic variable

F#, 66 bytes
let rec a x y=(if(System.Random()).Next(10)=9 then a x 1 else x)+y

Try it online!
The if statement is like a function itself. If the random number is 9 (in the range [0, 10)) then perform Alex-addition on x and 1 and return that value. Otherwise return just x.
Then add the result of the if statement to y, and return it.

APL (Dyalog Unicode), 10 bytes
+-{⌈10⍟?0}

Try it online!

Brachylog, 10 bytes
∧9ṙ9&↰+₁|+

Try it online!
Takes input as a list of numbers. The TIO header runs the predicate on the input infinitely and prints the results.
  ṙ           A random integer from zero to
 9            nine
∧             which is not necessarily the input
   9          is nine,
    &         and the input
     ↰        passed through this predicate again
      +₁      plus one
        |     is the output, or, the input
         +    summed
              is the output.

Factor, 41 bytes
: a ( x y -- z ) .1 [ 1 + a ] [ + ] ifp ;

Try it online!
ifp is a version of if that takes a probability instead of a boolean. Otherwise, it's just a simple recursive definition (which is verbose in Factor because of the mandatory stack effect declaration).

Ruby, 32 bytes
Can't believe there was no Ruby answer. Here's a pretty basic lambda function:
f=->a,b{rand(10)<1?f[a,b+1]:a+b}

But why not do it properly? Here's some ungolfed meta-Alexification:
module Alex
  def +(other)
    other += 1 if rand(10) == 7
    super
  end
end

[Fixnum, Bignum, Float].each { |klass| klass.prepend(Alex) }

# testing
p 1000.times.count { 1 + 1 == 3 } #=> 87
p 1000.times.count { 1 + 1 == 4 } #=> 19
p 1000.times.count { 1 + 1.3 == 5.3 } #=> 1

Tcl, 52 bytes
proc A n\ m {expr {rand()>.9?[A $n [incr m]]:$n+$m}}

Try it online!

SmileBASIC 3, 54 bytes
Recursive function that takes two numbers.
DEF A(B,C)IF RND(10)THEN RETURN B+C
RETURN A(B,C+1)END

Kotlin (1.3+), 60 bytes
fun a(b:Int,c:Int):Int=if((0..9).random()<1)a(b,c+1)else b+c

A solution that uses the new cross-platform random features added in Kotlin 1.3.
Try it online!

Kotlin (JVM), 59 bytes
fun a(b:Int,c:Int):Int=if(Math.random()<.1)a(b,c+1)else b+c

Try it online!
Works on the JVM version because java.lang.Math is automatically imported.

Kotlin (<1.3), 65 bytes
This version is "cross-platform" Kotlin since it doesn't depend on any Java features.
fun a(b:Int,c:Int):Int=if((0..9).shuffled()[0]<1)a(b,c+1)else b+c

Try it online!
The "randomness" is obtained by shuffling the inclusive range 0..9, which generates a List<Int>, and then checking the first element of that list. Assuming shuffled() is perfectly random (I have no idea how random it actually is) there is a 10% chance of the first element being 0.

05AB1E, 15 14 13 8 bytes
+[TLΩ≠#>

-5 bytes thanks to @Emigna by placing the > (increment by 1) after the # (break loop).
Try it online.
Explanation:
            # Implicit inputs `a` and `b`
+           # Sum of these two inputs
 [          # Start an infinite loop
    Ω       #  Random integer
  TL        #   in the range [1, 10]
     ≠      #  If this integer isn't exactly 1:
      #     #   Stop the loop
       >    #  Increase the result by 1
            # Implicitly output the result

+[TLΩ≠#> for 8 bytes

@Emigna Ah, smart.. I guess I'm too used to languages like C and JS were 0 == false and anything else == true. In 05AB1E 1 == true, and anything else == false. Also, placing the increment > after the break is pretty obvious (now that I see it ;p). Thanks!

Thunno 2, 7 bytes
+(Tɼḅ;⁺

Try it online!
Explanation
+(Tɼḅ;⁺  # implicit input
+        # add the two inputs together
 (       # (while)
  Tɼ     #   random item from [1..10]
    ḅ    #   is equal to 1
     ;   # (do)
      ⁺  #   increment
         # implicit output

C (gcc), 33 bytes
f(x,y){x=rand()%10?x+y:1+f(x,y);}

Try it online!

INTERCAL, 91 bytes
DOWRITEIN.1+.2PLEASE(1000)NEXTDO.1<-.3DO%10COMEFROM(1)(1)DON'T(1020)NEXTONCEPLEASEREADOUT.1

Try it online!
Explanation:
DO WRITE IN .1 + .2        // Get input numbers
PLEASE (1000) NEXT         // Add them together
DO .1 <- .3                // Copy the result into .1
DO %10 COME FROM (1)       // Loop back 10% of the time
(1) DON'T (1020) NEXT ONCE // Increment .1 every loop iteration except the first
PLEASE READ OUT .1         // Output result
                           // Fallthrough to stdlib syntax error/exit

R 33 bytes
f=function(a,b)a+b+rbinom(b,b,.1)

Edit: now simulates recursive application of +1 for each 1 in b.

I think it should be rgeom(1,.9).

Perl 5 -p, 23 bytes
$_+=<>;$_++while.1>rand

Try it online!

Python 2, 63 bytes
Returns the result as a string.
from random import*
f=lambda a,b:random()>.1and`a+b`or f(a,b+1)

Try it online!
Test program showing probability distribution: Try it online!

PowerShell Core, 46 bytes
param($a,$b)while(!(get-random 10)){++$a}$b+$a

Try it online!

It is not full program or function. It is a code snippet. Full program for PS means "you can save the code to a standalone script file, run the script with optional parameters (not statements) and get a valid result".

From the msdn about Functions, A filter is a type of function that runs on each object in the pipeline. I think it does match?

I don't think the definition from MSDN matches the definition on this site. See comments from @AdmBorkBork and standard loopholes on this site and meta

λ-2d, 100 squares
Found this language on Hackernews yesterday and I wanted to try it at a small program
You can test it by going to this page and going to "file" -> "load JSON" with a file containing this content
{"22,6":"func_def","24,6":"func_def","23,6":"end_s","25,6":"end_s","26,6":"end_s","24,8":"func_call","24,11":"func_call","25,7":"wire_nw","24,7":"wire_se","25,8":"wire_sw","25,9":"wire_ns","24,10":"wire_sw","25,10":"func_call","23,9":"wire_ns","23,8":"wire_ns","23,7":"wire_ns","23,10":"wire_ne","25,11":"wire_nw","26,9":"wire_ns","26,8":"wire_ns","26,7":"wire_ns","26,10":"wire_nw","24,12":"op_plus","22,5":"wire_se","23,5":"label","24,5":[0,0,1,0,0,0,1,0,1,0,0,1,1,1,0,1,0,0,0,1,1,0,0,0,1],"32,8":"func_call","33,9":"func_call","33,8":"wire_sw","34,9":"wire_nw","34,8":"func_call","34,7":"func_def","35,7":"end_s","36,7":"end_e","35,8":"wire_sw","36,9":"func_call","35,9":"wire_ns","35,10":"wire_ne","36,10":"wire_nw","36,8":"func_def","37,8":"end_s","37,7":"wire_nw","37,6":"wire_ns","37,5":"joint_nse","38,6":"func_call","38,7":"op_plus","38,5":"wire_sw","39,6":"wire_sw","39,7":"wire_ne","40,7":"wire_nw","40,6":"func_call","40,5":"num_1","41,6":"wire_sw","38,8":"end_e","37,9":"wire_we","42,4":"wire_sw","39,4":"wire_we","40,4":"wire_we","41,4":"wire_we","36,4":"func_def","37,4":"end_s","38,4":"end_e","36,3":"wire_se","37,3":"label","38,3":[0,0,1,1,0,0,0,0,0,1,0,1,0,1,0,1,1,1,0,0,0,1,0,1,0],"24,9":[0,0,1,1,0,0,0,0,0,1,0,1,0,1,0,1,1,1,0,0,0,1,0,1,0],"33,16":"entry","34,16":"end_s","35,16":"end_e","36,16":"frame_tl","47,16":"wire_sw","47,18":"wire_nw","36,18":"wire_ne","36,17":"wire_ns","47,17":"wire_ns","37,16":"wire_we","38,16":"wire_we","39,16":"wire_we","40,16":"wire_we","41,16":"wire_we","42,16":"wire_we","43,16":"wire_we","44,16":"wire_we","45,16":"wire_we","46,16":"wire_we","46,18":"wire_we","45,18":"wire_we","44,18":"wire_we","43,18":"wire_we","41,18":"wire_we","40,18":"wire_we","38,18":"wire_we","37,18":"wire_we","39,18":"wire_we","42,18":"wire_we","35,20":"func_call","34,17":"wire_ns","34,18":"wire_ns","34,19":"wire_ns","34,20":"wire_ns","36,20":"wire_sw","36,21":"wire_nw","35,21":"wire_nswe","34,21":"wire_ne","35,22":"wire_nw","34,22":"wire_se","34,23":"wire_ns","34,24":"wire_ns","34,25":"wire_ne","35,25":"wire_nswe","35,24":"func_call","36,25":"wire_nw","36,24":"wire_sw","35,26":[0,0,1,0,0,0,1,0,1,0,0,1,1,1,0,1,0,0,0,1,1,0,0,0,1],"35,19":"num_1","35,23":"num_1","19,3":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"30,7":"func_call","31,9":"func_call","33,10":"op_if","30,8":"op_rand","30,6":"num_1","31,6":"num_1","32,7":"num_1","31,7":"wire_sw","31,8":"wire_ns","32,9":"wire_nw","31,10":"op_gt","41,7":"func_call","41,8":[0,0,1,1,0,0,0,0,0,1,0,1,0,1,0,1,1,1,0,0,0,1,0,1,0],"42,7":"wire_sw","42,8":"wire_ns","42,9":"wire_nw","41,9":"wire_we","39,8":"wire_we","40,8":"wire_sw","40,9":"wire_ne","39,9":"wire_sw","43,6":"wire_sw","42,6":"wire_ne","39,10":"wire_ne","43,10":"wire_nw","42,5":"wire_ns","43,7":"wire_ns","43,8":"wire_ns","43,9":"wire_ns","38,9":"wire_we","40,10":"wire_we","41,10":"wire_we","42,10":"wire_we"}

The screenshot and square count only show the function, the full program also have a call to the function using this structure

where you can replace both 42 by the input you want

pseudo code using a jslike syntax
alexAdd = a => b => a + maybeInc(b)
maybeInc = c => random(11) > 1 ? c : maybeInc(c + 1)

You can get knowledge of how to read the program by reading the cheatsheet sample in the editor and the release blog post

Raku, 30 bytes
{@_.sum+sum (.1>rand)xx*...!*}

Try it online!

Swift, 64 bytes
func f(a:Int,b:Int)->Int{.random(in:0...9)==0 ?f(a:a,b:b+1):a+b}

SwiftFiddle link to try it yourself. The code should be fairly straightforward.


text:
Squish-unsquish ligatures
Here is a list of some common
ligatures in Unicode (the
ones I could create with my Compose key on Debian):
Orig  Ascii  Lig
ae    [ae]   æ
AE    [AE]   Æ
oe    [oe]   œ
OE    [OE]   Œ
ij    [ij]   ĳ
IJ    [IJ]   Ĳ
ff    [ff]   ﬀ
fi    [fi]   ﬁ
fl    [fl]   ﬂ
ffi   [ffi]  ﬃ
ffl   [ffl]  ﬄ

You have two options in this challenge: use the actual UTF-8 ligatures, or use
the ASCII-only variant. If you use the actual UTF-8 ligature variants, you gain
a 20% bonus. If you use the ASCII-only variant, you may assume square brackets
will never be involved except to signify a ligature.
The challenge: given a string as input, output the same string

with all original ligatures replaced by their expanded counterparts.

match greedily: affib becomes aﬃb (a[ffi]b), not aﬀib (a[ff]ib)
or afﬁb (af[fi]b).

with all "expanded" letter sequences replaced by ligatures.

for example, æOEfoo ([ae]OEfoo) becomes aeŒfoo (ae[OE]foo).

Do this completely independently: ﬀi ([ff]i) becomes ffi (ffi), not ﬃ
([ffi]).
Sound simple enough? There's a catch: every time two non-ligatures overlap by
exactly one character, both of the ligatures must be inserted into the
string. Here's a few test cases to demonstrate:
Input   Ascii-output      Output
fij     [fi][ij]          ﬁĳ
fIJ     f[IJ]             fĲ     * remember, capitalization matters!
fffi    [ff][ffi]         ﬀﬃ
fff     [ff][ff]          ﬀﬀ
ffffi   [ff][ff][ffi]     ﬀﬀﬃ
ffffij  [ff][ff][ffi][ij] ﬀﬀﬃĳ

Be careful: the same greedy matching applies (note especially the last few test
cases).
code-golf, so shortest code in bytes wins.

@Mego What's the big deal? If your language of choice cannot handle æ natively, just print 0xc3 0xa6, its UTF-8 encoding.

If a language can't facilitate a given task, don't use that language for that task. That shouldn't be a big deal.

JavaScript (ES6), 213 bytes - 20% bonus = 170.4
s=>eval('for(p=o="";m=s.match(r="ﬄ|ﬃ|ﬂ|ﬁ|ﬀ|Ĳ|ĳ|Œ|œ|Æ|æ|ffl|ffi|fl|fi|ff|IJ|ij|OE|oe|AE|ae",x=r.split`|`);s=s.slice(i+t.length-(p=t<"z")))o+=s.slice(p,i=m.index)+x[(x.indexOf(t=m[0])+11)%22];o+s.slice(p)')

Explanation
s=>                           // s = input string
  eval(`                      // use eval to avoid writing {} or return
    for(                      // iterate over each ligature match
      p=                      // p = 1 if the last match was a non-unicode ligature
        o="";                 // o = output string
      m=s.match(              // find the next ligature

        // r = regex string for ligatures (unicode and non-unicode)
        r="ﬄ|ﬃ|ﬂ|ﬁ|ﬀ|Ĳ|ĳ|Œ|œ|Æ|æ|ffl|ffi|fl|fi|ff|IJ|ij|OE|oe|AE|ae",
        x=r.split\`|\`        // x = arrray of r

      );
      s=s.slice(i+t.length    // remove the part that has been added to the output
        -(p=t<"z"))           // if we matched a non-unicode ligature, keep the last
    )                         //     character so it can be part of the next match
      o+=s.slice(p,i=m.index) // add the text before the match to the output
        +x[(x.indexOf(        // add the opposite type of the matched ligature
          t=m[0]              // t = matched text
        )+11)%22];            // (index + 11) % 22 returns the opposite index
    o+s.slice(p)              // return o + any remaining characters
  `)

Test

var solution = s=>eval('for(p=o="";m=s.match(r="ﬄ|ﬃ|ﬂ|ﬁ|ﬀ|Ĳ|ĳ|Œ|œ|Æ|æ|ffl|ffi|fl|fi|ff|IJ|ij|OE|oe|AE|ae",x=r.split`|`);s=s.slice(i+t.length-(p=t<"z")))o+=s.slice(p,i=m.index)+x[(x.indexOf(t=m[0])+11)%22];o+s.slice(p)')
<input type="text" id="input" value="ﬀiffffij" oninput="result.textContent=solution(input.value)" />

Can r="ﬄ|ﬃ|ﬂ|ﬁ|ﬀ|Ĳ|ĳ|Œ|œ|Æ|æ|ffl|ffi|fl|fi|ff|IJ|ij|OE|oe|AE|ae",x=r.split\|`be rewritten asx="ﬄ|ﬃ|ﬂ|ﬁ|ﬀ|Ĳ|ĳ|Œ|œ|Æ|æ|ffl|ffi|fl|fi|ff|IJ|ij|OE|oe|AE|ae".split`|`` for -4 bytes?

@Dendrobium The match call requires the string separated with | characters.

Anyone arriving from Google, you're looking for String.normalize(): https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize

source: Stack Exchange

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

sort: votes


text:
Flip the switches
After you wake in a dark room, you see a rectangular grid of lights with corresponding switches. You decide to use a coordinate system with the bottom left light representing (1,1) and the coordinates increasing as you go up (y  direction) and to the right (x direction). The grids are identical in that flipping the switch at (a,b) toggles (turns from off to on or from on to off) the light at (a,b) as well as the lights in the same column or same row as (a,b).
Your input will be a rectangular grid of two distinct characters representing on and off (I use 1 and 0, respectively). Also, a part of the input will be a series of at least one coordinate pair (with whatever format and separation you want) that will represent switches that you flip.
The output will be the same grid, with the "flip" applied at each of the coordinate pairs that were given as input. You may choose how to format your input, though the output must be a grid, not an array.

Samples
Sample input 1
111111
111111
111111
111111

(3,2)

Sample output 1
110111
110111
000000
110111

Sample input 2
01101
10100
00010
11111
10110

(1,1), (5,5)

Sample output 2
00010
00101
10011
01110
01000

Sample input 3
1

(1,1)

Sample output 3
0

Sample input 4
00000
11111
00000
11111

(2,3), (2,3)

Sample output 4
00000
11111
00000
11111

This is code golf. Standard rules apply. Shortest code in bytes wins.

Related: http://codegolf.stackexchange.com/questions/65738/crack-the-safe. Not the same problem, though. The goal of the other challenge was to find out which moves to make, this one is about applying a given list of moves.

@RetoKoradi It's also not quite the same operation. (The fact that the chosen cell itself is toggled too makes this significantly trickier.)

Can I request the input be like <grid><RETURN><coordinate_x><RETURN><coordinate_y><RETURN>?

whichever format and separation: Does that mean they can be separate inputs (that is, "separator" is "enter" key)?

@LuisMendo Yes, if that works.

What do you mean with "output must be a grid"? Is a list of lists a grid? Or do we have to print a graphical representation (newline separated rows)? If the latter, does the "two distinct characters" rule still apply, i.e. no spaces or other separators in-between?

Dyalog APL, 20 bytes
{⍵≠⊃⊃≠/∘.∨/¨⍺=⊂⍳¨⍴⍵}

This is a dyadic function that takes the initial grid on the right and the list of coordinates on the left.
To input a single coordinate pair, use e.g. (⊂2 3) as the left argument.
Try it here.

CJam, 37 36 bytes
qN/W%(~{1$::!\{1a\Te[f.|z}/..^}/W%N*

Input should have the grid first, using any two non-NULL characters that only differ in the last bit (so 0 and 1 work), followed by a CJam-style list of coordinate pairs.
01101
10100
00010
11111
10110
[[1 1] [5 5]]

Test it here.

MATL, 39 bytes
i,-1H$X!tyZ}:XJx:!XIxi"I@1)=J@2)=|+]2\X!

Input is of the following form (the example corresponds to sample input 2 in the challenge):
[0 1 1 0 1; 1 0 1 0 0; 0 0 0 1 0; 1 1 1 1 1; 1 0 1 1 0]
[1 5; 1 5]

First input is a matrix defining the grid of 0 and 1.  ; is the row separator. Second input is a matrix of coordinate pairs, where each column is a pair.
Example
>> matl i1_2$X!tyZ}:XJx:!XIxi"I@1)=J@2)=|+]2\X!
> [0 1 1 0 1; 1 0 1 0 0; 0 0 0 1 0; 1 1 1 1 1; 1 0 1 1 0]
> [1 5; 1 5]
0 0 0 1 0
0 0 1 0 1
1 0 0 1 1
0 1 1 1 0
0 1 0 0 0

Explanation
i,           % input matrix
-1H$X!       % rotate clockwise to accomodate input to matrix coordinates
tyZ}         % get numbers of rows (r) and of cols (c)
:XJx         % row vector 1,2,,...,c. Copy to clipboard J and delete
:!XIx        % col vector 1,2,,...,r. Copy to clipboard I and delete
i            % input coordinates (matrix; each col is a coordinate)
"            % for each col of coordinate matrix
    I@1)=    % compare col vector of rows with row from coordinate
    J@2)=    % compare row vector of cols with col from coordinate
    |        % "or" with singleton expansion to generate mask
    +        % add that to matrix of values
]            % end for
2\           % modulo 2 to transform result into zeros and ones
X!           % undo rotation

please let me know if there is an online compiler available for matl

Not online yet, sorry. Only the Matlab-based one I linked in the title

Ruby 114 bytes
Takes as input:
g, an array of arrays representing the starting grid.
o, an array of points, each point being an array with two elements, like [x, y].
->g,o{o.map{|i|(r=g[i[1]-1])[e=(i[0]-1)]-=1;r.map!{|j|j+1};g.map{|x|x[e]+=1}};puts g.map{|i|i.map{|j|j%2}.join""}}

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


text:
Letters, Get Moving!
Given a string you must move each letter (starting from the first letter) by its position in the alphabet. If you reach the end of the string you must wrap around. Non-letters don't need to be moved.
Example:
Dog
D is the fourth letter in the alphabet so we move it four spots to the right. After wrapping around, that changes the string to oDg. o is the 15th letter, (15 mod 3) = 0, so it does not move. g is the 7th letter - (7 mod 3) = 1, so the string becomes goD.
hi*bye

h is the 8th letter, move it 8 spots - hi*bye => i*hbye
i is the 9th letter, move it 9 spots - i*hbye => *hbiye
b is the 2nd letter, move it 2 spots - *hbiye => *hiybe
y is the 25th letter, move it 25 spots - *hiybe => *hibye
e is the 5th letter, move it 5 spots - *hibye => *hibey

Non-letters don't need to be moved, but they still take up space.

cat => tca
F.U.N => .F.NU
mississippi => msiisppssii

Do we have to do a standalone program or a function is enough? Also, do we have to print the string?

What characters can appear in the input? Printable ASCII? Linefeeds? Any ASCII? Any Unicode?

Also a test case with repeated letters would be good.

@Martin Any ASCII.

@Katenkyo function is allowed. If you are using a function, then output is the return value.

CJam, 44 42 40 bytes
qN+ee_{Xa/~\+XW=eu__el=!\'@-*m<Xa+}fXWf=

Output contains a trailing linefeed.
Test it here.
Explanation
Instead of moving the letters through the string, I repeatedly remove a letter, rotate the string accordingly, and then reinsert the letter. There's one catch for doing this: we need to be able to distinguish the beginning of the string from the end of the string (which we can't after a simple rotation). That's why we insert a linefeed at the end as a guard (letter before the linefeed is the end of the string, letter after it is the beginning). The bonus is that this automatically returns the final string to the correct rotation where the linefeed actually is at the end of the string.
lN+     e# Read input and append a linefeed.
ee      e# Enumerate the array, so input "bob" would become [[0 'b] [1 'o] [2 'b] [3 N]]
        e# This is so that we can distinguish repeated occurrences of one letter.
_{      e# Duplicate. Then for each element X in the copy...
  Xa/   e# Split the enumerated string around X.
  ~     e# Dump the two halves onto the stack.
  \+    e# Concatenate them in reverse order. This is equivalent to rotating the current
        e# character to the front and then removing it.
  XW=   e# Get the character from X.
  eu    e# Convert to upper case.
  _     e# Duplicate.
  _el=! e# Check that convert to lower case changes the character (to ensure we have a
        e# letter).
  \'@-  e# Swap with the other upper-case copy and subtract '@, turning letters into 1 to
        e# 26 (and everything else into junk).
  *     e# Multiply with whether it's a letter or not to turn said junk into 0 (that means
        e# everything which is not a letter will be moved by 0 places).
  m<    e# Rotate the string to the left that many times.
  Xa+   e# Append X to the rotated string.
}fX
Wf=     e# Extract the character from each pair in the enumerated array.

To see why this ends up in the right position, consider the last iteration of the hi*bye example. After we've processed the e, the enumerated string is in this position:
[[4 'y] [6 N] [2 '*] [0 'h] [1 'i] [3 'b] [5 'e]]

First, we split around the linefeed and concatenate the parts in reverse order:
[[2 '*] [0 'h] [1 'i] [3 'b] [5 'e] [4 'y]]

The linefeed would now be either at the beginning or the end of this string. But since the linefeed is just a guard that marks the end of the string, this means that the characters are actually in the right order. Now the linefeed is not a letter, so that the array is not rotated at all. Thus, when we append the linefeed, it goes where it belongs, and everything is in the order we're looking for:
[[2 '*] [0 'h] [1 'i] [3 'b] [5 'e] [4 'y] [6 N]]

Some additional results if someone wants to compare longer test cases:
Hello, World!
,W oeHlo!lrld

Programming Puzzles & Code Golf
ago fgliPomomnrr elP& uC dezzsG

The quick brown fox jumps over the lazy dog
t eg chbi ko qfTounyzrj omw epx ueoahs rlvd

abcdefghijklmnopqrstuvwxyz
aqbrcdsetfguhivjwklxmnyozp

zyxwvutsrqponmlkjihgfedcba
abcdefghijklmnopqrstuvwxyz

I like that last one. :)

Pyth needs chop list on list.

@isaacg Nah, I'm sure it doesn't. ;)

Could you make it so it supports multi-line strings?

@geokavel Oh right, fixed.

The sith is pleased, Darth Büttner.

Ruby 125 130 132 139 bytes
->q{a=q.chars.map{|c|[c,c=~/[a-z]/i&&c.ord%32]}
while i=a.index{|c,s|s}
c,s=a.delete_at i
a.insert (i+s)%q.size,[c]
end
a*''}

Online demo with tests: http://ideone.com/GYJm2u
The initial (ungolfed version): http://ideone.com/gTNvWY
Edit: Big thanks to manatwork for his suggestions!
Edit 2: fixed character count (I was initially counting CRLF line endings.)

Just barely tested: c.upcase.ord-64 → c.ord%32.

@manatwork That works fine, thanks!

Looking again… Wait! a.join??? Who are you and what have you done with w0lf? He would certainly write it as a*''.

@manatwork :) I was so upset about having a while ... end in my code that I forgot to do that. Thanks for noticing!

can't you turn that while ... end into (...)while ...?

@MartinBüttner I tried, but did not manage to get a shorter version. That's because of the i variable, which needs to be initialized to something before the first while condition is hit. I'm still thinking of a fix for that.

@w0lf Why does (c,s=...;a....)while i=a.index... not work?

@MartinBüttner I get a NameError: undefined local variable or method i'. Initializing i to something sensible (0in this case) before the() while` will end up taking as many characters as the current version.

@MartinBüttner This is what I tried: http://ideone.com/e7DgnA

Python 3, 278 275 273 270 260 258 249 248 243 238 bytes
I should really golf this down better, but here is my solution, with thanks to katenkyo for his help with the logic, and to Cyoce and Mego for their help with the golfing.
Edit: At last, I got it down to one comparison statement. WOO! (And yes, I could move that z=-z into a,m=m,a bit, but that doesn't save bytes and it muddled the code more than I thought was necessary)
Edit: Byte count was off.
def m(s):
 l=len(s);r=range(l);p=[[i,s[i]]for i in r]
 for i in r:
  if s[i].isalpha():
   a=p[i][0];p[i][0]=m=(a+ord(s[i])%32)%l;z=1
   if a>m:a,m=m,a;z=-z
   for j in r:p[j][0]-=z*(j!=i)*(a<=p[j][0]<=m)
 return''.join(dict(p).values())

Ungolfed:
def move(string):
 length = len(string)
 places = [[i,string[i]]for i in range(length)]
 for index in range(length):
  char = string[index]
  if char.isalpha():
   a = places[index][0]
   mov = (a + ord(char)%32) % length
   places[index][0] = mov
   for j in range(length):
    k = places[j][0]
    if a <= k <= mov and j!=index:
     places[j][0]-=1
    elif mov <= k <= a and j != index:
     places[j][0]+=1
 return''.join(dict(places).values())

I *believe* that p[j][0] can be reduced by setting J=p[j]; at the beginning, then replacing instances of p[j][0] with P[0]

@Cyoce I think the trouble is I need to edit p directly, and not a variable that had p[j] assigned to it. Also, if you look at my revision history, I did have a variable k = p[j][0] for a<=k<=m comparisons, but it turned out that dropping k was better because I saved more bytes on indents from the extra line to set k than I saved by using k.

J, 92 84 bytes
{~(g=.i.@#@[)([/:g(]+]-*@-)#@[|g+(={.)*1{])~&;/@([|.@;;/@,.)[:(26&|+52&>)Alpha_j_&i.

Attempt This Online!
-8 thanks to rdm!

(26&|+52&>) would give the same result as (52&~:*1+26&|) here

Well observed, thanks @rdm.

Another thing that would help: remove the &; from {~ on the left and use &;/ instead of &.>/

Thanks, I'll take a look tonight.

While I'm at it... you can replace (]+2%~@-~) with (]+]-@-)

K (ngn/k), 46 45 bytes
-1 byte from @Traws' improvement
{x{?[x^z;(#x)!y+x?z;z]}/[;a*27>a:96!_x].&=#x}

Try it online!
A bit complicated to unpack. Takes input as x.

&=#x generate two copies of 0..count[input] (e.g., (0 1 2 3 4;0 1 2 3 4))

{...}/[;...]. set up a seeded-reduce, fixing the second (y) arg, and passing the pair of ranges as the first (x) and third (z) args. x represents the to-be-shuffled indices of the input, y the number of positions to shift each character in the input, and z the initial position of each character

a*27>a:96!_x determine the number of positions to shift each character in the input; non-letters are shifted 0 places, leaving them in the same position
{?[x^z;(#x)!y+x?z;z]}/ set up a ?[x;indices;values] splice. each iteration is run on the original input (x), a single number of positions to move (y), and a single initial position (z)

x^z remove the current item being shifted
(#x)!y+x?z determine where it should be after being moved (offset by where it is now (x?z), and with wrap-around (#x)!)
z re-insert the value/index at the correct position

{x{...}...} index back into the original input, and (implicitly) return

cool answer. you can save one byte with 0^(!27)? -> a*27>a:

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


text:
Solve a mathematical expression from alternating sides
Create a program that solves a mathematical expression using the elements from alternating sides of the expression. The way it’s done is, instead of reading from left to right, you read the first character, then the last, then the second, then the second to last etc. This will give you a new expression that you must evaluate and output.
a*b/c+d-e
135798642  <-- Order you read the expression in
ae*-bd/+c  <-- Order of operation.

Example:
1*3/2+4-5
15*-34/+2 = -255

If the expression doesn’t «work», a 1 must be inserted in the necessary positions to make it work.
A few examples will probably illustrate it better:
Input: 1+1+1+1+1
Result: 23     // Because 1+1+1+1+1 -> 11++11++1 -> 23

Input: 1+2-3+12-5
Result: -19    // Because 1+2-3+12-5 -> 15+-22-13+ -> 15+-22-13+1 -> -19
               //                                 |
               //                                 Not valid expression

Input: 2*2*2*2*2
Result: 968    // Because 2*2*2*2*2 -> 22**22**2 -> 22*1*22*1*2 -> 968
               //                        ||  ||
               //                        Not valid, 1 must be inserted

Input: 17/2
Output: 127    // Because 17/2 = 127/ -> 127/1 -> 127

The operators that must be supported are + - * /. There won't be parentheses. Normal math rules and "syntax" is used, so for instance ** does not mean exponentiation. a++++1 is equivalent to a+1 (i.e. MATLAB style, not C++).
In case there's any doubt, some valid operations are:
-a
+a
a++b
a+-b
a*-b
a*+b
a*++b
a/b
a/-b
a/+b
-a/--b

While all of the following are not valid. It's shown what they should be substituted with:
a+      | a+1
a-      | a-1
a++++   | a++++1   (This is equivalent to a+1)
a*+++   | a*+++1   (This is equivalent to a*1)
a**b    | a*1*b
a*/b    | a*1/b
a/*b    | a/1*b
a*      | a*1
*a      | 1*a
***a    | 1*1*1*a

Rules:

The code can be a function or a full program
The input can be STDIN or function argument
The input must be a valid mathematical expression, without quotation marks, '' or "".
The output should be the answer to the new expression, as an integer, decimal or a simplified fraction.
At least three digits after the decimal point must be supported. So 1/3 = 0.333, not 0.33. 0.333333333 is accepted.
ans = ... is accepted.
Leading and trailing newlines and spaces are accepted.
The input will only be integers
Division by zero can result in an error, NaN, Inf etc. Outputting a number is not accepted.

As always, the shortest code in bytes win. A winner will be selected one week from the day the challenge was posted. Answers posted later may still win if it's shorter than the current leader.

is there a max length on input string or count of operators/integers input? also, do I have to support math up to 2^64, and should it error or wrap if you go over?

"the output should be the answer [ . . . ] simplified fraction ..." so can I just return 0/0 if the expression evals to integer division or modulo by zero?

If the answer gives division by zero, then x/0 is a valid output. As long as it doesn't output an incorrect answer it's OK. Error and "Not a number" is by definition correct, and infinity is "correct enough",

Just to be sure - eval can be used, right?

Yes, eval is ok.

Perl, 108 100 bytes
$_="";while(@F){$_.=shift@F;$_.=pop@F}s@(\*|/)\1+@\1@g;s@^[*/]@1$&@;s@\D$@$&1@;s@\D@$&@g;$_=eval

The code is 96 bytes, plus 4 for the command-line argument -pF//, where

-p inserts while (<>) { .. } continue { print } and
-F// splits the input and puts it in @F.

Note that the input should not have a trailing newline, so use /bin/echo -n 'formula' | perl ...
Less golfed:
$_='';              # reset $_
while(@F) {         # reorder input
   $_.=shift @F;    # take first element off of @_
   $_.=pop @F       # idem for last; if @F is empty, undef is appended
}

s@(\*|/)\1+@\1@g;   # replace 2 or more '*' or '/' with just one: *1 and /1 = nop
s@^[*/]@1$&@;       # if expression starts with * or / prepend a 1
s@\D$@$&1@;         # if expression doesn't end with a number, append 1
s@\D@$& @g;         # eval doesn't like '++1': add spaces after operators
$_ = eval           # set $_ to 3v1l, so the `-p` will print the new value

Testing
Put the above in a file called 114.pl, and the below test script in a file next to it:
%test = (
    '1+1+1+1+1' =>   23,
    '1*3/2+4-5' => -255,
    '1+2-3+12-5'=>  -19,
    '2*2*2*2*2' =>  968,
    '17/2'      =>  127,
    '--/-1-2-'  =>   -2,
    '**2*'      =>    2,
    '++1++'     =>    1,
    '/2/'       =>  0.5,
    '10/'       =>   '',
);

printf "%-20s -> %5s: %5s\n", $_, $test{$_}, `/bin/echo -n '$_' | perl -pF// 114.pl`
for keys %test;

Running it outputs:
++1++                ->     1:     1
**2*                 ->     2:     2
17/2                 ->   127:   127
10/                  ->      :
1+1+1+1+1            ->    23:    23
1*3/2+4-5            ->  -255:  -255
2*2*2*2*2            ->   968:   968
1+2-3+12-5           ->   -19:   -19
--/-1-2-             ->    -2:    -2
/2/                  ->   0.5:   0.5

Note that 1/0 causes a division by zero error: the eval outputs undef, which is represented by the empty string.

A few more test cases! I'm going to use them

JavaScript ES6, 105 106
Edit Saved 1 byte thx @Kenney
t=>eval("for(t=[...t],p=o='';c=t.reverse().pop();p=c)o+=p<'0'?(c=='/'|c<'+'||' ')+c:c;eval(p<'0'?o+1:o)")

// Less golfed
t=>{
  for(t = [...t], p = o = '';
      c = t.reverse().pop();
      p = c)
    o += p<'0'
     ? (c=='/' | c=='*' || ' ')+c  // '1' or ' '
     : c;
  return eval(p<'0' ? o+1 : o)
}

Test snippet

f=t=>eval("for(t=[...t],p=o='';c=t.reverse().pop();p=c)o+=p<'0'?(c=='/'|c<'+'||' ')+c:c;eval(p<'0'?o+1:o)")

console.log=x=>O.innerHTML+=x+'\n'

function test() { console.log(I.value + ' -> '+f(I.value)) }

;['1+1+1+1+1', '1*3/2+4-5', '1+2-3+12-5', '2*2*2*2*2',
  '17/2', '--/-1-2-', '**2*', '++1++', '/2/', '10/' ]
.forEach(t=>console.log(t+' -> '+f(t)))
Your test <input id=I><button onclick="test()">-></button>

Saved you a byte: p < '0' ? ( c=='/' | c<'+' || ' ' )+c : c ;.


text:
Novel Prime Factors of Repunits
The Background
Folks were talking prime factorization in chat and we found ourselves talking about repunits. Repunits are a subset of the numbers known as repdigits, which are numbers consisting of only repeating digits, like 222 or 4444444444444444, but repunits consist only of 1.
The first couple repunits are therefore 1, 11, 111, etc. These are referred to by Rn, so R1=1, R2=11, etc., and are generated by the formula R(n) = (10^n - 1)/9, with n > 0.
Prime factorization of these repunit numbers follows sequence A102380 in the OEIS. For example:

R1 = 1
  R2 = 11
  R3 = 111 = 3 * 37
  R4 = 1111 = 11 * 101
  R5 = 11111 = 41 * 271
  R6 = 111111 = 3 * 7 * 11 * 13 * 37
  R7 = 1111111 = 239 * 4649
  ...

The Challenge
Write a program or function which, when given an input integer n with n >= 2 via STDIN or equivalent, outputs or returns the novel prime factors for Rn, in any convenient format. "Novel prime factors" here means all x where x is a prime factor of Rn, but x is not a prime factor for any previous Rk, with 1 <= k < n (i.e., if we write the prime factors for all R in sequence, we've not seen x before).
The Examples
Input: 6
Output: 7, 13
(because 3, 11, and 37 are factors of a smaller R_k)

Input: 19
Output: 1111111111111111111
(because R_19 is prime, so no other factors)

Input: 24
Output: 99990001
(because 3, 7, 11, 13, 37, 73, 101, 137, 9901 are factors of a smaller R_k)

Input: 29
Output: 3191, 16763, 43037, 62003, 77843839397
(because no factors of R_29 are also factors of a smaller R_k)

The Extras:

Your code can do anything or nothing if n < 2.
You can assume a "reasonable" upper limit for n for testing and execution purposes -- your code will not be expected to output for n = 10000000, for example, but your algorithm should work for such a case if given unlimited computing power and time.
Here is a site dedicated to the factorizations of repunits for reference.
I've not gone through the math, but I propose a hypothesis that every n has a distinct result for this algorithm -- that is, no n exists such that Rn has no novel factors. I'll offer a 250-point bounty if someone proves or disproves that in their answer. Thomas Kwa proposed an elegant proof, and I awarded the bounty.

Built-in prime checking and factorisation are fair game?

@MartinBüttner No restrictions.

OEIS A204845

@alephalpha Because of course there's an OEIS link ;-) Thanks!

Your link to reference factorizations is stale. worldofnumbers: repunits: Sources has good links.

Pyth, 16 14 13 bytes
-F_m{P/^Td9SQ

As best I can tell, 19 takes forever.
-F_m{P/^Td9SQ      Implicit: Q = input
           SQ      Inclusive range 1 to Q
                        Implicit lambda d:
    {P                  unique primes dividing
       ^Td              10**d
      /   9                  //9
   m               map lambda over the range
   m{P/^Td9SQ      Unique prime factors of all repunits up to the Qth
  _                Reverse the list
-F                 Reduce by set difference

Try it here.

If you run it from the command line and have SymPy installed, 19 completes in under a second. The first one that takes over 2 seconds is the input 38.

Proof that every repunit has a novel prime factor
Using Zsigmondy's Theorem, the proof is simple. From Wikipedia:

In number theory, Zsigmondy's theorem, named after Karl Zsigmondy,
states that if a > b > 0 are coprime integers, then for any integer n
≥ 1, there is a prime number p (called a primitive prime divisor) that
divides an − bn and does not divide ak − bk for any positive integer k
< n, with the following exceptions: [things that don't apply here].

Consider the repunits times 9: that is, 10n-1. By Zsigmondy's Theorem with a=10, b=1, there is some prime p | 10n-1 that does not divide any 10k-1, k < n.

Since p is prime and 10n-1 = 9 · Rn, it must divide either 9 or Rn.

p cannot divide 9, since 9 = 101-1.

Therefore p divides Rn.

p cannot divide any Rk, since it doesn't divide 10k-1 = 9 · Rk.

Therefore the p from Zsigmondy's Theorem is a novel prime factor of any Rn, n ≥ 2. ∎

An example of a repeated novel prime factor
The prime 487 is a repeated prime factor of R486:
By the Fermat-Euler theorem, 10487-1 ≡ 1 (mod 487). The order of 10 mod 487, that is, the smallest power of 10 that is 1 mod 487, therefore must be a divisor of 486. In fact, the order is equal to 486. It also happens that not only is 10486 ≡ 1 (mod 487), it's also 1 (mod 4872).
See here that the order of 10 mod 487 is 486; that is, that no smaller 10k-1 is divisible by 487. Obviously, 487 doesn't divide 9, so it must divide R486.

CJam, 18 bytes
{{)'1*imf}%W%:-_&}

Test it here.
Starting at 19 (the first repunit prime after 2) it will take a fairly long time.
Explanation
This is an unnamed block (CJam's equivalent of a function), which expects the input number n on the stack and leaves a list of prime factors instead:
{      e# Map this block over [0 1 ... n-1]...
  )'1* e#   Increment and create a string of that many 1s.
  i    e#   Convert to integer.
  mf   e#   Get its prime factors.
}%
W%     e# Reverse the list.
:-     e# Fold set difference onto the list, removing from the first list the elements of
       e# all other lists.
_&     e# Remove duplicates. Unfortunately, this necessary. Thomas Kwa found that the 486th
       e# repunit contains 487^2 (where 487 is a novel prime factor).

Did ... did you seriously just golf from 20 to 16 in the past three minutes? >.>

@TimmyD Sort of... I had to go up to 18 again for now, because it turned out my code was based on an assumption which I can neither prove or disprove right now.

Ooo, that's an interesting case - duplicate novel factors. Nice catch.

Haskell 86 bytes
import Data.Numbers.Primes
f n=[x|x<-primeFactors$div(10^n-1)9,notElem x$f=<<[1..n-1]]

Usage example: f 8 -> [73,137].
Takes a lot of time and memory for big n.
Direct implementation of the definition: take all prime factors x of Rn which do not show up before (f=<<[1..n-1] are all prime factors of R1 ... R(n-1)).

Mathematica 82 74 63 bytes
With 11 bytes saved thanks to alephalpha.
Complement@@Reverse@FactorInteger[(10^Range@#-1)/9][[;;,;;,1]]&

Prime factors of R70
(10^70 - 1)/9 = 1111111111111111111111111111111111111111111111111111111111111111111111
FactorInteger[(10^70 - 1)/9]

{{11, 1}, {41, 1}, {71, 1}, {239, 1}, {271, 1}, {4649, 1}, {9091,
    1}, {123551, 1}, {909091, 1}, {4147571, 1}, {102598800232111471,
    1}, {265212793249617641, 1}}

Novel prime factors of R70
Complement@@Reverse@FactorInteger[(10^Range@#-1)/9][[;;,;;,1]]&[70]

{4147571, 265212793249617641}

Complement@@Reverse@FactorInteger[(10^Range@#-1)/9][[;;,;;,1]]&

Kindly explain the meaning of [[;;,;;,1]] or [[1 ;; All, 1 ;; All, 1]].  I'm puzzled!

@DavidCarraher It takes the first element of every element of every element of a list.

@DavidCarraher [[;;,;;,1]] is the same as [[All,All,1]].

Now that makes sense.  BTW, your re-location of Range was very clever.

LabVIEW, 33 LabVIEW Primitives
19 takes forever...
Work by saving all Primes and deleting elements from the last set when they are found in the other array.

MATL, 25 bytes
This works for input up to 16:
10,i:^9/Y[t0)Yftb!w\~s1=)

The following version uses 31 bytes and works up to 18. For 19 it requires about 4 GB memory (I haven't been able to run it).
10,i:^9/Y[t0)5X2Y%Yfotb!w\~s1=)

Example
>> matl
 > 10,i:^1-,9/t0)5X2Y%Yfotb!w\~s1=)
 >
> 6
7 13

Explanation
Consider for concreteness input 6. First the prime divisors of 111111 are computed; in this case the results are 3, 7, 11, 13, 37. Then the modulo operation (division remainder) is computed for all combinations of numbers 1, 11, ... 111111 and the computed divisors. This exploits MATL's implicit singleton expansion. The result is in this case a 6x5 matrix, with each column corresponding to one of the divisors. Accepted divisors (columns) are those for which only 1 value (namely the last) gives zero remainder.
10,i:^9/Y[   % generate vector with `1`, `11`, ... depending on input number, say "n"
t0)          % pick the last element: `111...1` (n ones)
5X2Y%        % * convert to uint64, so that larger numbers can be handled
Yf           % prime factors
o            % * convert to double precision, so that modulus can be done
t            % duplicate
b            % bubble up element in stack
!            % transpose
w            % swap elements in stack
\            % modulus after division (element-wise, singleton expansion)
~s           % number of zero values in each column
1=           % is equal to 1? (element-wise, singleton expansion)
)            % index divisors with that logical index

(*) Removed in short version

That's a clever way of doing it.

Julia, 103 bytes
R(n)=[keys(factor((10^n-1)÷9))...]
n->(r=R(n);isprime(r)?r:setdiff(r,reduce(vcat,[R(i)for i=1:n-1])))

This is an unnamed function that calls a helper function R. To call it, give the main function a name, e.g. f=n->....
Ungolfed:
function R(n::Integer)
    collect(keys(factor((10^n - 1) ÷ 9)))
end

function f(n::Integer)
    r = R(n)
    if isprime(r)
        r
    else
        setdiff(r, reduce(vcat, [R(i) for i = 1:n-1]))
    end
end

J, 24 bytes
[:({:-.}:)@:q:[:+/\10^i.

Expects extended-precision numerics after 6 (e.g. 19x instead of 19).
Try it online!
There's probably a shorter way to generate the repunits which avoids the caps, too.
Explanation
[: ({: -. }:) @: q: [: +/\ 10 ^ i.
                                i. Range [0, input)
                           10 ^    10 raised to the power of the range
                       +/\         Running sum of this list (list of repunits)
                 q:                Prime factors of the repunits
              @:                   Composed with
   ({: -. }:)                      Unique prime factors of last repunit
    {:                              Factors of last repunit (tail of matrix)
       -.                           Set subtraction with
          }:                        Rest of the matrix (curtail)

How it works, visually
I think that these sorts of visual explanations are easier to stomach for those who don't know J. These are results from the REPL.
   10 ^ i.6
1 10 100 1000 10000 100000

   +/\ 10 ^ i. 6
1 11 111 1111 11111 111111

   q: +/\ 10 ^ i. 6
 0   0  0  0  0
11   0  0  0  0
 3  37  0  0  0
11 101  0  0  0
41 271  0  0  0
 3   7 11 13 37

   ({: -. }:) q: +/\ 10 ^ i. 6
7 13


text:
Why was 6 afraid of 7?
Why was 6 afraid of 7? Because 7 8 9!
Given a string apply the following transformations:

If there is a 6 next to a 7 remove the 6 (6 is afraid of 7)
If the sequence "789" appears remove the 8 and the 9 (7 ate 9)

(If I'm not mistaken it doesn't matter what order you do the transformations in)
Keep applying these transformations until you can no longer.
Example:
78966
First we see "789", so the string becomes "766". Then we see "76", so we take out the 6, and the string becomes "76". Then we see "76" again, so we are left with "7".
Test Cases:

987 => 987 (Not in the right order. Does nothing.)
6 7 => 6 7 (The whitespace acts as a buffer between 6 and 7. Nothing happens)
676 => 7
7896789 => 77
7689 => 7
abcd => abcd

Why was Vista afraid of 7? Because 7 8 10.

Another test case 68978966897896 => 68977

@ThomasKwa Oh, I get it: Microsoft skipped Windows 9 because they were going along with the riddle. ;)

Why afraid of seven was five? Because six seven eight. --Yoda

I could be wrong but I'm sure this is an example of a Lindenmayer system.

@Pharap Link, please.

@geokavel Facinating stuff. Here's three as a start: 1 2 3

@Pharap Thanks for the links! I guess the difference is mine always makes the string smaller, so maybe it's an inverse L-System?

@geokavel Alphabet: 6789; Axiom: 78966; Rules: 67 -> 7, 789 -> 7; Not sure if that's entirely correct but you can see how it would be mapped to an L-system.

@Pharap Nice. Also, 76 -> 7.

@geokavel That too. If I knew of a language centred around L-Systems I'd submit an answer but I don't believe that there is one.

Six was afraid seven because seven had cold, dead eyes.

Because of the "Keep applying these transformations until you can no longer.", it would be good to add some test cases reflecting that.. Like 68978966897896 that @BradGilbertb2gills suggested almost 3 years ago, or 7689689 → 7.

Windows 9 doesn't exist - BECAUSE WINDOWS 7 8 IT

Why was Windows Vista afraid of 7? Because 7 8 9!

Retina, 12
Translation of the sed answer:
6*7(6|89)*
7

Try it online

Works in QuadR too!

Java, 126 81 66 58 bytes
Thanks to @GamrCorps for providing the lambda version of this code!
Thanks to @user902383 for pointing out an autoboxing trick!
...yup.
It's actually longer than I expected - Java replaces items in strings with replaceAll() once per match, not repeatedly until it stops changing. So I had to use a fancy for loop.
Lambda form:
x->{for(;x!=(x=x.replaceAll("67|76|789","7")););return x;}
Function form:
String s(String x){for(;x!=(x=x.replaceAll("67|76|789","7")););return x;}
Testable Ungolfed Code:
class B{
    public static void main(String[]a){
        System.out.print(new B().s(a[0]));
    }
    String s(String x){for(;x!=(x=x.replaceAll("67|76|789","7")););return x;}
}

Why not go with a lambda? Will save at least 15 bytes

@GamrCorps Don't know how to phrase that - never use functions.

what's the point of interface and not class?

@eis Interface removes the need to declare main as public, which gives the slightest advantage. See: http://codegolf.stackexchange.com/a/64713/44713

Lambda version: x->{for(;!x.equals((x=x.replaceAll("67|76|789","7"))););return x;}

Forgot to add the new byte count (66)

@user902383 The reduction you're making is by changing .equals to !=, which does not do the same thing. == (or !=) compares by object hex location, not by value. It's the same length otherwise. while() is 7 bytes, for(;;) is 7 bytes.

@FlagAsSpam i know, but seems it works when i test it

@user902383 Huh. Must be an autoboxing thing I never saw before. I'll test it here as well.

other thing is in your equal statement you have double bracket. equals(( statement ))

@user902383 Yes, that was for the reassignment of x, but I forgot that single-functions statements don't need the extra brackets.

Javascript ES6, 29 bytes
s=>s.replace(/6*7(89|6)*/g,7)

Test:
f=s=>s.replace(/6*7(89|6)*/g,7)
;`987 -> 987
6 7 -> 6 7
676 -> 7
7896789 -> 77
7689 -> 7
abcd -> abcd`
.split`\n`.every(t=>(t=t.split` -> `)&&f(t[0])==t[1])

Great, and since 9 is eaten, you only have 2 bytes and win with this answer :P

GNU Sed, 17
Score includes +1 for -r option.
s/6*7(6|89)*/7/g

Doesn't work for 67789 should return 77 but it instead returns 677

You can use  s/67|7(6|89)/7/ instead of s/6?7(6|89)/7/

Gee, I wonder where Larry came up with the idea of s///g?

Perl 6,  19  18 bytes

{S:g/6*7[6|89]*/7/} # 19 bytes

$ perl6 -pe 's:g/6*7[6|89]*/7/' # 17 + 1 = 18 bytes

( Note that [6|89] is the non-capturing version of (6|89) which is spelt as (?:6|89) in Perl 5. <[6|89]> is how you would write what's spelt as [6|89] in Perl 5)
usage:

$ perl6 -pe 's:g/6*7[6|89]*/7/' <<< '
987
6 7
6676689
7896789
7689
abcd
68978966897896
79|689
'

987
6 7
7
77
7
abcd
68977
79|689

I don't know Perl 6, but I assume this is a repeated substitution. If the 6* and the [6|89]* don't match anything, what stops the 7 being substituted for 7 ad infinitum?

@DigitalTrauma It swaps 7 with 7 then starts again at the next position, working its way until the end. :g is short for :global not repeat until it doesn't match anymore.

@DigitalTrauma To get s/67|76|789/7/ to work on 667 I would have to write it as something to the effect of: while s/67|76|789/7/ {} which of course would never stop if you wrote it as while s/6*7[6|89]*/7/ {} as you would expect. Also, the end of the previous comment may come off as mean spirited, that is not how it was inteded

Cool - thanks for the explanation!  No mean-spiritedness was given or taken :)  My motivation is purely curiosity which your explanation has satisfied - thanks

Shouldn't the [] be changed to ()?  You don't want to match pipes or 79999.

@jwodder No [] is the Perl 6 non-capturing version of (), what you are thinking of is spelled as <[6|89]> in Perl 6.

Pyth, 17 bytes
u:G"67|76|789"\7z

Try it here.
Leaky Nun has outgolfed this by a byte in the comments.

http://pyth.herokuapp.com/?code=%3Az%226%2a7%286%7C89%29%2a%22%5C7&test_suite=1&test_suite_input=987%0A6+7%0A676%0A7896789%0A7689%0Aabcd&debug=0

Perl 5, 17 bytes
perl -pe 's/6*7(6|89)*/7/g' # 16 + 1

usage:
$ perl -pe 's/6*7(6|89)*/7/g' <<< '
987
6 7
6676689
7896789
7689
abcd
68978966897896
'

987
6 7
7
77
7
abcd
68977

Mathematica, 52 bytes
StringReplace[#,"67"|"76"|"789"->"7"]&~FixedPoint~#&

Explanation:
                                                   &   A function returning
                                     &                   a function returning
              #                                            its first argument
StringReplace[ ,                    ]                     with
                "67"                                        "67"
                    |                                      or
                     "76"                                   "76"
                         |                                 or
                          "789"                             "789"
                               ->                         replaced with
                                 "7"                       "7"
                                    ~FixedPoint~        applied to
                                                #        its first argument
                                                        until it no longer changes.

The golfed code is clearer than the explanation code.. :)

@Rob Haven't made many explanations before, going for a systematic approach.

I was just teasing, mate :)

Ruby, 27 bytes
This solution is from comments, credit to Brad Gilbert b2gills.
->s{s.gsub /6*7(6|89)*/,?7}

Ruby, 37 bytes
(old solution)
This solution uses the fact that you will never need to replace more times than characters in the string.
->s{s.chars{s.sub! /67|76|789/,?7};s}

You can use chars instead of size.times to save a few bytes.

Doesn't Ruby have the global flag for regex substitution, or would that take more bytes to enable?

@BradGilbertb2gills, in Ruby is like in Awk: there are separate sub() and gsub() methods to replace first or all. So global is just one character longer.

@manatwork Then I would write this something like: ->s{s.gsub /6*7(6|89)*/,'7'}, and let gsub do all the looping work.

If I understand the rules of command line flags correctly, you could save 16 bytes by using the -p command line flag (+1) making it gsub /6*7(6|89)*/,?7 with usage ruby -pe "gsub /6*7(6|89)*/,?7" for a total of 20+1 bytes

@BradGilbertb2gills thank you for your help.

MATL, 17 bytes
jt"'789|76'55cYX]

Example
>> matl
 > jt"'789|76'55cYX]
 >
> 7896789
77

EDIT: Try it online!
Explanation
j                   % input string
t                   % duplicate
"                   % for each character. Iterates as many times as the string length
    '789|76'        % regular expression for replacement
    55c             % string to insert instead: character '7'
    YX              % regexprep
]                   % end for

This works by applying a regular expresion replacement for as many times as there are characters in the original string. This is enough, since each substitution reduces the number of characters.

Rust, 96 bytes
fn f(mut s:String)->String{for _ in 0..s.len(){for r in&["67","76","789"]{s=s.replace(r,"7")}}s}

Hopelessly long, as per usual for Rust...
Ungolfed:
fn seven_ate_nine(mut str: String) -> String {
    for _ in 0..str.len() {
        for to_replace in &["67","76","789"] {
            str = str.replace(to_replace, "7");
        }
    }
    s
}

At least it's not Java

Emacs Lisp, 59 bytes
(lambda(s)(replace-regexp-in-string"6*7\\(6\\|89\\)*""7"s))

It becomes a bit clearer with spaces:
(lambda (s) (replace-regexp-in-string "6*7\\(6\\|89\\)*" "7" s))

Japt, 15 bytes
Ur"6*7(89|6)*"7

Simple RegEx solution
Try it online

PowerShell, 27 bytes
$args-replace'6*7(89|6)*',7

e.g.
PS C:\temp> .\ate.ps1 "7689"
7

PS C:\temp> .\ate.ps1 "abcd"
abcd

PS C:\temp> .\ate.ps1 "68978966897896"
68977

Making use of:

someone else's regex pattern
the way -replace does a global replace by default in PowerShell
loop unrolling, where it will apply the -regex operator to the array $args by applying it to all the elements individually, and there's only one element here because there's only one script parameter, so it works OK and we can avoid having to index element [0].

Novelty previous attempt before realising a global replace would do it; 74 bytes of building a chain of "-replace -replace -replace" using string multiplication, as many times as the length of the string, then eval()ing it:
"'$($args)'"+("{0}6|6(?=7)'{0}89'"-f"-replace'(?<=7)")*$args[0].Length|iex

(With a bit of string substitution to shorten the number of replaces).

Seriously, 29 bytes
,;l`'7;;"67"(Æ"76"(Æ"789"(Æ`n

Takes input as a double-quoted string, like "6789". Try it online (you will need to manually quote the input).
Explanation:
,;l`'7;;"67"(Æ"76"(Æ"789"(Æ`n
,;l                            get input and push its length (we'll call it n)
   `                       `n  call the following function n times:
    '7;;"67"(Æ                   replace all occurrences of "67" with "7"
              "76"(Æ             replace all occurrences of "76" with "7"
                    "789"(Æ      replace all occurrences of "789" with "7"

CJam, 70 64 bytes
Thanks to @Peter Taylor for cutting {"789":I}{"76:":I}? to "789""76"?:I
"67":Iq:A{AI#:B){AB<7+A{BI,+}~>+s:A];}{"76"I={"789":I}{"76":I}?];}?}/A
"67":Iq:A{AI#:B){AB<7+A{BI,+}~>+s:A];}{"76"I="789""76"?:I];}?}/A
I know this could probably be golfed a lot further and your help would be greatly appreciated, but frankly I'm just happy I managed to get the answer. This was my first attempt at writing CJam.
Explanation:
"67":I                e# Assign the value of 67 to I
q:A                   e# Read the input and assign to A
{                     e# Opening brackets for loop
    AI#:B)            e# Get the index of I inside A and assign to B. The increment value by 1 to use for if condition (do not want to process if the index was -1)
    {                 e# Open brackets for true result of if statement
        AB<           e# Slice A to get everything before index B
        7+            e# Append 7 to slice
        A{BI,+}~>     e# Slice A to get everything after index B plus the length of string I (this will remove I entirely)
        +s:A          e# Append both slices, convert to string, and assign back to A
        ];            e# Clear the stack
    }                 e# Closing brackets for the if condition
    {                 e# Open brackets for false result of if statement
        "76"I=        e# Check if I is equal to 76
        "789"         e# If I is 76, make I 789
        "76"?:I       e# If I is not 76, make I 76
        ];            e# Clear the stack if I does not exist inside A
    }?                e# Closing brackets for false result of if statement
}/                    e# Loop
A                     e# Output A

I haven't attempted this question myself, so I'm not sure whether this is the best approach, but if you want to do splitting and joining then take a look at / and *. Also note that thinking in terms of stacks when you're used to C-like languages takes some adaptation. E.g. {"789":I}{"76":I}? can pull out the assignment to become "789""76"?:I, which can be further golfed to 78976`3/?:I.

Thank you! I couldn't quite understand how to use your second suggestion however.

Sorry, my mistake. 78976`3/ gives an array ["789" "76"]; then rather than using ? you would need to use = to index; but it's back-to-front, so it would need the index to be inverted, losing the advantage.

PHP, 36 bytes
preg_replace('/6*7(6|89)*/','7',$a);

regex solution, takes $a string and replaces via the expression.

GET parameters are not acceptable as an input method in PHP. You will need to either make this a function and pass the input as function parameters, or get input from $argv or STDIN.

@Mego There appears to be no consensus on the post you linked to.

@immibis Correct. A consensus is required to make an I/O method acceptable. The lack of one means it is not acceptable.

TL;DR you have serious disadvantages if you use PHP for codegolf.

Thue, 26 bytes
67::=7
76::=7
789::=7
::=

including a trailing newline.
Input is appended to the program before starting it.
Output is read off the program state when it terminates, similarly to a Turing machine.
(Thue does have an output stream, but it's difficult to use correctly, so I'm not sure whether this is an acceptable output method)

I don't think so. If you have a way to STDOUT, you have to. Sorry!

Yes, this is allowed according to the meta post.

R, 35 bytes
cat(gsub("6*7(6|89)*",7,scan(,"")))

I didn't know I could use gsub this way, a big thank you for every answer here that made me learn something new.

///, 19 bytes
/67/7//76/7//789/7/

You can't actually provide input in this language, so the supposed input goes to the right of the code, which is allowed by recent rules.

Note that Itflabtijtslwi is slashes but with input.

@FryAmTheEggman Although that one inputs characters, not strings.

Your link seems to be missing one slash.

Dyalog APL, 17 bytes
'6*7(6|89)*'⎕R'7'

'6* any number of sixes
7 followed by a seven
(…)*' followed by zero or more sequences of…
 6|89 a six or eight-nine
⎕R Replace that with
'7' a seven

Python 3, 46 bytes
import re
lambda s:re.sub(r'6*7(6|89)*','7',s)

Jolf, 15 bytes
Try it here! Do I really have to explain?
pi"6*7(6|89)*"7
p               replace any entity in
 i               the input
  "6*7(6|89)*"   that matches this regex
              7  with 7
                implicit output

Clojure, 71 bytes
Clojure is less-than-ideal for golfing due to its verbose nature - but nonetheless it's an interesting exercise:
Golfed version, using Java interop:
(defn f[s](let[x(.replaceAll s "67|76|789" "7")](if(= s x)s(recur x))))

Un-golfed version, using Java interop:
(defn six-fears-seven [s]
  (let [x (.replaceAll s "67|76|789" "7")]
    (if (= s x)
      s
      (recur x))))

Un-golfed "pure Clojure" version:
(defn six-fears-seven [s]
  (let [x (clojure.string/replace s #"67|76|789" "7")]
    (if (= s x)
      s
      (recur x))))

Bash, 102 82 67 (+7)? bytes
extglob version
x=$1
while v=${x/@(76|67|789)/7};[ $v != $x ];do x=$v;done
echo $v

This is meant to be put in a file and called with e.g. bash -O extglob 789.sh 6567678989689789656. The (+7)? bytes is for if the extglob option counts toward bytes.
Thanks to @BinaryZebra for pointing out extglob features!

Non-extglob version (82 bytes)
x=$1
while v=${x/76/7};v=${v/67/7};v=${v/789/7};[ $v != $x ];do x=$v;done
echo $v

This is meant to be put in a file and called with e.g. ./789.sh 65678989656.
It makes use of parameter expansion to search and replace in a loop. I involved a series of expansions to do the replacing since I'm not aware of a way to more effectively chain expansions.

Welcome to PPCG!

@BinaryZebra Ah, thanks for the @() syntax. I knew there had to be a way to combine those. And @Mego, thanks for the welcome!

PHP 51 characters
while($s!=$r=str_replace([789,67,76],7,$s)){$s=$r;}

Test case written in long hand
$s = '78966';
while ($s != $r = str_replace([789, 67, 76], 7, $s) )
{
    $s = $r;
}
echo $s; // 7;

This does the string comparison and the string replace both in the while condition. If while condition is met, it updates the left hand of the comparison with the result. Let me know of any improvements.

Japt v2.0a0, 12 bytes
e/6?7(6|89/7

Try it online!
How it works
String.e is recursive replace function. Japt 2 has a new regex syntax and auto-completion of parentheses inside regex, which saves one byte here. (In Japt 1.x, we had to pass strings in place of regexes, which was kinda clunky.)

05AB1E, 12 11 bytes
Δ67Â‚789ª7:

Try it online or verify all test cases.
Explanation:
Δ            # Continue doing the following until it no longer changes:
 67          #  Push 67 to the stack
   Â         #  Bifurcate (short for Duplicate & Reverse copy): 76
    ‚        #  Pair them together: [67,76]
     789ª    #  Append 789 to this list: [67,76,789]
         7:  #  Replace all occurrences of these three integers with 7
             #   i.e. 1789372 → 17372
             # (after the loop, output the result after implicitly)

67Â‚789ª could alternatively be •4BĆx•₄в for the same byte-count.

K (ngn/k), 27 bytes
{x{"7"/y@x}/(\'$67 76 789)}

Try it online!

$67 76 789 shorthand for ("67";"76";"789")
(\'...) create list of splitter functions, i.e. ("67"\;"76"\";"789"\)
x{...}/(...) set up a reduce, seeded with x (the input), run over the list of splitter functions

{"7"/y@x} split the input (x) using the current splitter function (y), then join the result with "7". feed this to the next iteration of the reduce


text:
Has someone been defenestrated?

Defenestration is the act of throwing someone or something out of a window.
—Wikipedia

Input
The input will consist of two parts:

A floor plan and a person inside the house/building.

v><^ represents a person, pointing in the direction signified by the arrow. The input will contain exactly one person.
- and | represent walls, and # represents a window.   is empty space.

This portion of the input may be taken as either a single string, or an array/list/etc. of lines. There will never be any trailing or leading spaces, and the input will always be a rectangle.
Example:
-----###---
|         |
|     ^   |
-----------

An integer ≥ 1 signifying how far (in characters) the person travels.

Output
The output should be

1 if the person ends up "inside" a window (i.e. after moving forwards the distance specified in the input, the person is on top of a #).
2 if the person has been defenestrated (come into contact with a # and then continued further on).
3 if the person has hit a wall (come into contact with a - or |. Once hitting the wall, the person stops and does not continue through it).
0 if none of the above are true (and all the person has done is travel through empty space).

Assumptions
All of the following can be assumed to be true:

The person will never travel "out of bounds" of the input area.
After being defenestrated, the person will never come into contact with another # or a -/| (so you don't have to worry about if 2 and 1 or 3 are both true).

Test cases
For the following "floor plan":
-----
|   |
|###|
|   |
| ^ |

In   Out
1    0
2    1
3    2

For this floor plan:
> | # |

In   Out
1    0
2-99 3    * that is, any input 2-99 outputs 3

For this floor plan:
||####|#|#|##|<

In   Out
any  3

Final test case:
|v|
|#|
| |
| |
| |
| |

In   Out
1    1
2-5  2

I propose the title of this challenge be changed to Defenestration testing.

Follow-up question: This, except with pit's.

@CᴏɴᴏʀO'Bʀɪᴇɴ Has someone been for-sparta'd?

Why did my edit get rejected ):

@cat Because it's an edit on someone else's question, that they must have input on.

@CᴏɴᴏʀO'Bʀɪᴇɴ I thought it was up to 1k+ users too, but it was just a title change

Can we assume that the input is left-and-right-padded with spaces to form a rectangle?

@CᴏɴᴏʀO'Bʀɪᴇɴ "There will never be any trailing or leading spaces." Yes, the input will always be a rectangle (editing that in).

JavaScript (ES6), 147 146 bytes
(p,n)=>eval('l=p.search`\n`+1;m=p.match`[<>v^]`;for(r=d=i=0;i++<n&r<3;r-1?0:d=2)r=(c=p[m.index+i*({v:l,"<":-1,">":1}[m]||-l)])>"#"?3:c>" ";+r||d')

Saved 1 byte thanks to @NinjaBearMonkey!
Explanation
Takes a floorplan as a string and the number of moves. Returns a number.
(p,n)=>                               // p = floor plan as string, n = number of moves
  eval(`                              // use eval to enable for loop without {} or return
    l=p.search\`\n\`+1;               // l = line length
    m=p.match\`[<>v^]\`;              // m = the position and orientation of the person
    for(
      r=                              // r = result at the current step
        d=                            // d = 2 if the person has been defenestrated
          i=0;                        // i = current step
      i++<n&r<3;                      // for each step while the person has not hit a wall
      r-1?0:d=2                       // set d to 2 once the person enters the window
    )
      r=(                             // r = 0 if on " ", 1 if on "#" or 3 if on "|" or "-"
        c=p[m.index+i*                // c = character after current step
          ({v:l,"<":-1,">":1}[m]||-l) // get the index offset of each step
        ]
      )>"#"?3:c>" ";
    +r||d                             // return the result of the current step or d
  `)

Test

var solution = (p,n)=>eval('l=p.search`\n`+1;m=p.match`[<>v^]`;for(r=d=i=0;i++<n&r<3;r-1?0:d=2)r=(c=p[m.index+i*({v:l,"<":-1,">":1}[m]||-l)])>"#"?3:c>" ";+r||d')
<textarea id="floorplan" rows="6" cols="30">-----
|   |
|###|
|   |
| ^ |</textarea>

Moves = <input type="text" id="moves" value="3" />
<button onclick="result.textContent=solution(floorplan.value,moves.value)">Go</button>

I like your testing snippet!

ಠ_ಠ I was just about to post pretty much the exact same thing.

@CᴏɴᴏʀO'Bʀɪᴇɴ Haha, I know that feeling all too well...

Nice answer, btw! Very smart.

You can save two bytes by making it a curried function and using a regular function - p=>n=>{l=p.search\\n`+1;m=p.match`[<>v^]`;for(r=d=i=0;i++<n&r<3;r-1?0:d=2)r=(c=p[m.index+i*({v:l,"<":-1,">":1}[m]||-l)])>"#"?3:c>" ";return+r||d}`