Skip to content

Instantly share code, notes, and snippets.

@supposedly
Last active November 2, 2020 22:00
Show Gist options
  • Save supposedly/ccefc257a244bada61633dea25d118cc to your computer and use it in GitHub Desktop.
Save supposedly/ccefc257a244bada61633dea25d118cc to your computer and use it in GitHub Desktop.
(use a string in Ans to pass a program to this, so e.g. ">+.":prgmBRAINF)
seq(inString("<>-+.,[]",sub(Ans,S,1)),S,1,length(Ans->L2
cumSum((Ans=7)-(Ans=8->L3
seq(Ans(X),X,dim(Ans),1,~1->L4
1->P:DelVar L11->dim(L1 //this is the same as DelVar L1:1->dim(L1 as DelVar does not require a colon or newline after its argument
For(S,1,dim(L2
L2(S->T
P-(T=1)+(T=2->P
dim(L1
Ans+(P-Ans)(P>Ans->dim(L1
L1(P)-(T=3)+(T=4->L1(P
If T=5
Disp Ans
If T=6:Then
Input V
V->L1(P
End
If T=7 and not(L1(P
S+2+sum(not(cumSum(L3(S)-1=seq(L3(X),X,S+1,dim(L3->S
1-S+dim(L3
If T=8 and L1(P
S-sum(not(cumSum(L4(Ans)=seq(L4(X),X,Ans+1,dim(L4->S
End
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment