Make your language *mostly* unusable (Robber's thread)

C (GCC/Linux) by Sisyphus

This snippet closes the provided function and starts a new one (classic code injection), which itself redefines close so that instead of closing the fd, runs our desired code.

}
int close(int x) {
  int a, b;
  scanf("%d %d", &a, &b);
  printf("%d\n", a + b);

  exit(0);

Python, Wheat Wizard's solution here

import sys
c="".join(open(__file__).read().split('\n')[4:])
if set(c)-set(' &)(,.:[]a`cdfijmonrt~')or"import"in c:sys.setrecursionlimit(1)
f=lambda\
:[]                                                      # my code starts here
sys.setrecursionlimit(1000)
print(int(input())+int(input()))

I mean, you can just set the recursion limit back, and nothing bad happens...

Works on TIO

Note

This is my first ever CnR submission, so if this breaks any rules, please tell me and I'll delete this.


Haskell by Ben

import Prelude(getLine,print)
a=a
[]++s=s
(a:as)++s=a:(as++s)
r""=""
r(c:s)=(r s)++[c]
t(_:r)=r
ts l=l:ts(t l)
x[_](v:_)=v
x(_:r)(_:s)=x r s
d(a:_:_:_:_:_:_:_:_:_:r)=a:d r
(a:_)!!""=a
l!!(n:m)=d(x['0'..n](ts l))!!m
a+b=[[0..]!!a..]!!b
a-b=let n=[0..]!!a;m=[0..]!!b in
    case [n..m] of
      [] ->   x[m..n][0..]
      l  -> -(x l    [0..])
add('-':x)('-':y)= -(r x+r y)
add('-':x)y=r y-r x
add x('-':y)=r x-r y
add x y=x+y
main=do a<-getLine;b<-getLine;print(add a b)

I still have literal numbers and chars (I use 0, '0' and '-'), and [a..] and [a..b] which are very useful. And I have unary -, but I could do without.

I recreate ++ to implement r (reverse) and define t and ts which are tail and tails. x a b returns the nth element of b, where n is the length of a minus one. x could usually be defined as snd.last.zip. The function d takes a list and returns a list with the elements from those positions that are multiples of ten. l!!s returns the nth element of l, where s is the reversed string representation of n. + returns as integer the sum of two natural numbers given as reversed strings, likewise - for the difference. add returns as integer the sum of two possibly negative integers given as strings.

I wonder if this is somewhat similar to what Ben had in mind.