Examine individual changes

Abuse Filter navigation (Home | Recent filter changes | Examine past edits | Abuse log)
Jump to navigation Jump to search

This page allows you to examine the variables generated by the Abuse Filter for an individual change.

Variables generated for this change

VariableValue
Edit count of the user (user_editcount)
0
Name of the user account (user_name)
'Anulick'
Age of the user account (user_age)
223245
Page ID (page_id)
8479
Page namespace (page_namespace)
0
Page title (without namespace) (page_title)
'Deadfish x'
Full page title (page_prefixedtitle)
'Deadfish x'
Action (action)
'edit'
Edit summary/reason (summary)
'Added Haskell implementation of the interpreter'
Old content model (old_content_model)
'wikitext'
New content model (new_content_model)
'wikitext'
Old page wikitext, before the edit (old_wikitext)
''''Deadfish x''' is a superset of Jonathan Todd Skinner's [[Deadfish]]. There are twice as many commands and uses the XKCD variant. I ([[User:firefly431]]) will be writing a Python interpreter, but you guys can write whatever you want. == Commands == {| class="wikitable" |- | x || Add 1 to x. |- | k || Output x to the console. |- | c || Square x. |- | d || Subtract 1 from x. |- | X || Start a function. The next character is the function name. |- | K || Output x as an ASCII character. |- | C || End the function or execute a function. |- | D || Set x to 0. |} == Rules == X (the variable) can only go from 0 to 255. If it goes above or below, it will be set to 0. You can type as many commands as you want on a line, but the prompt will only be shown when you push enter. == Sample Programs == To run these, save them and run them, or just copy and paste. <pre><nowiki> xxcxxxxcxxxxxxxxKDxxcxxxxxxcxKxxxxxxxKKxxxKDxxxxxxxcdddddKDxxxxxxcddddKDxxxcxxcddKddddddddKxxxKddddddKddddddddKDxxxxxxcdddK </nowiki></pre> Prints out "Hello, world!" <pre><nowiki> XUxKCxxcxxxxcCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCU </nowiki></pre> Prints out the entire alphabet. == Interpreter == === Python === My interpreter. Put something here if you find a bug. <pre><nowiki> # Deadfish x Programming Language # By firefly431 # This is free and unencumbered software released into the public domain. # Visit <http://unlicense.org/> for the full thing. x = 0; funcname = ""; curfunc = ""; lastc = ''; functions = {}; q_="i;iyratnrt gatmivpo"; _q=[0, 14, 17, 18, 4, 6, 10, 5, 7, 9, 2, 11, 8, 12, 16, 15, 13, 3, 1]; tar = []; for i in _q: tar.append(q_[i]); tar="".join(tar); import webbrowser; def openxkcd(num): webbrowser.open("http://xkcd.com/"+str(num)+"/"); def process(c): #Finite State Machine global x; global funcname; global curfunc; global lastc; global functions; if x<0 or x>255: x=0; if (lastc == 'X'): #we are starting a function funcname = c; print("Function start: "+c); lastc = ''; #so if the name is C or X we don't process it return; if (lastc == 'C'): #we are executing a function print("Execute function: "+c); lastc = ''; #same thing if (c in functions): for q in functions[c]: #c is taken process(q); else: print("Function '"+c+"' does not exist."); return; if funcname != "" and c != 'C': #We are in a function print("In function"); curfunc += c; lastc = c; return; #check commands, function commands pass. if c == "x": x+=1; elif c == "k": print(str(x)); elif c == "c": x*=x; elif c == "d": x-=1; elif c == "X": pass; elif c == "K": print(chr(x),end=""); elif c == "C": if funcname != "": print("End Function"); lastc = ''; #so we don't execute a function functions[funcname] = curfunc; funcname = ""; curfunc = ""; return; elif c == "D": x=0; lastc = c; def getInput(str = ""): global x; global tar; if str=="": inp = input(">> "); #change this to raw_input() if using python 2.x else: inp = str; if inp == tar: openxkcd(1061%354); for c in inp: process(c); import sys; fname = ""; lines = []; if len(sys.argv)>1: fname = sys.argv[1]; if fname != "": try: fp = open(fname,"r"); lines = fp.readlines(); fp.close(); except: print("Could not open file '"+fname+"'."); if len(lines)>0: for line in lines: getInput(line); else: try: while True: getInput(); except KeyboardInterrupt: print("Bye!"); </nowiki></pre> === Lua === <pre><nowiki> -- Deadfish x in pure Lua -- By Atenfyr local functions = {} function deadfishx(str, tx) local ignore = {} local tx = tx or 0 for i = 1, #str do if tx < 0 or tx > 255 then tx = 0 end if not ignore[i] then local instr = str:sub(i, i) if instr == "x" then tx = tx + 1 elseif instr == "k" then io.write(tx) elseif instr == "c" then tx = tx ^ 2 elseif instr == "d" then tx = tx - 1 elseif instr == "X" then local _, nextC = str:sub(i+2):find("C") nextC = nextC+i+1 for n = i+1, nextC do ignore[n] = true end functions[str:sub(i+1, i+1)] = str:sub(i+2, nextC) elseif instr == "K" then io.write(string.char(tx)) elseif instr == "C" then ignore[i+1] = true tx = deadfishx(functions[str:sub(i+1, i+1)]:sub(1, -2), tx) elseif instr == "D" then tx = 0 end end end return tx end -- If it's being loaded as a library (for some reason), then they now have the deadfishx function and the file can be closed if pcall(debug.getlocal, 4, 1) then return end local q_ = "i;iyratnrt gatmivpo" local _q = {1, 15, 18, 19, 5, 7, 11, 6, 8, 10, 3, 12, 9, 13, 17, 16, 14, 4, 2} local tar = {} for _, i in pairs(_q) do tar[#tar+1] = q_:sub(i, i) end tar = table.concat(tar, "") local function openXKCD(n) if package.config:sub(1,1) == "\\" then os.execute('start "" "http:///xkcd.com/' .. n .. '/" >nul 2>&1') else -- I don't want to install Linux so if this breaks Linux users please let me know os.execute("xdg-open http://xkcd.com/" .. n .. "/ &> /dev/null") end end local x = 0 local tArgs = {...} if tArgs[1] then local open = io.open(tArgs[1], "r") if not open then print("File does not exist!") os.exit() end local content = open:read("*a"):gsub("\r\n", ""):gsub("\n", "") open:close() deadfishx(content, x) os.exit() end while true do io.write(">> ") local cmd = io.read() if cmd == tar then openXKCD(1061%354) else x = deadfishx(cmd, x) end io.write("\n") end </nowiki></pre> [[Category:Joke languages]] [[Category:Output only]] [[Category:Implemented]] [[Category:Languages]]'
New page wikitext, after the edit (new_wikitext)
''''Deadfish x''' is a superset of Jonathan Todd Skinner's [[Deadfish]]. There are twice as many commands and uses the XKCD variant. I ([[User:firefly431]]) will be writing a Python interpreter, but you guys can write whatever you want. == Commands == {| class="wikitable" |- | x || Add 1 to x. |- | k || Output x to the console. |- | c || Square x. |- | d || Subtract 1 from x. |- | X || Start a function. The next character is the function name. |- | K || Output x as an ASCII character. |- | C || End the function or execute a function. |- | D || Set x to 0. |} == Rules == X (the variable) can only go from 0 to 255. If it goes above or below, it will be set to 0. You can type as many commands as you want on a line, but the prompt will only be shown when you push enter. == Sample Programs == To run these, save them and run them, or just copy and paste. <pre><nowiki> xxcxxxxcxxxxxxxxKDxxcxxxxxxcxKxxxxxxxKKxxxKDxxxxxxxcdddddKDxxxxxxcddddKDxxxcxxcddKddddddddKxxxKddddddKddddddddKDxxxxxxcdddK </nowiki></pre> Prints out "Hello, world!" <pre><nowiki> XUxKCxxcxxxxcCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCUCU </nowiki></pre> Prints out the entire alphabet. == Interpreter == === Python === My interpreter. Put something here if you find a bug. <pre><nowiki> # Deadfish x Programming Language # By firefly431 # This is free and unencumbered software released into the public domain. # Visit <http://unlicense.org/> for the full thing. x = 0; funcname = ""; curfunc = ""; lastc = ''; functions = {}; q_="i;iyratnrt gatmivpo"; _q=[0, 14, 17, 18, 4, 6, 10, 5, 7, 9, 2, 11, 8, 12, 16, 15, 13, 3, 1]; tar = []; for i in _q: tar.append(q_[i]); tar="".join(tar); import webbrowser; def openxkcd(num): webbrowser.open("http://xkcd.com/"+str(num)+"/"); def process(c): #Finite State Machine global x; global funcname; global curfunc; global lastc; global functions; if x<0 or x>255: x=0; if (lastc == 'X'): #we are starting a function funcname = c; print("Function start: "+c); lastc = ''; #so if the name is C or X we don't process it return; if (lastc == 'C'): #we are executing a function print("Execute function: "+c); lastc = ''; #same thing if (c in functions): for q in functions[c]: #c is taken process(q); else: print("Function '"+c+"' does not exist."); return; if funcname != "" and c != 'C': #We are in a function print("In function"); curfunc += c; lastc = c; return; #check commands, function commands pass. if c == "x": x+=1; elif c == "k": print(str(x)); elif c == "c": x*=x; elif c == "d": x-=1; elif c == "X": pass; elif c == "K": print(chr(x),end=""); elif c == "C": if funcname != "": print("End Function"); lastc = ''; #so we don't execute a function functions[funcname] = curfunc; funcname = ""; curfunc = ""; return; elif c == "D": x=0; lastc = c; def getInput(str = ""): global x; global tar; if str=="": inp = input(">> "); #change this to raw_input() if using python 2.x else: inp = str; if inp == tar: openxkcd(1061%354); for c in inp: process(c); import sys; fname = ""; lines = []; if len(sys.argv)>1: fname = sys.argv[1]; if fname != "": try: fp = open(fname,"r"); lines = fp.readlines(); fp.close(); except: print("Could not open file '"+fname+"'."); if len(lines)>0: for line in lines: getInput(line); else: try: while True: getInput(); except KeyboardInterrupt: print("Bye!"); </nowiki></pre> === Lua === <pre><nowiki> -- Deadfish x in pure Lua -- By Atenfyr local functions = {} function deadfishx(str, tx) local ignore = {} local tx = tx or 0 for i = 1, #str do if tx < 0 or tx > 255 then tx = 0 end if not ignore[i] then local instr = str:sub(i, i) if instr == "x" then tx = tx + 1 elseif instr == "k" then io.write(tx) elseif instr == "c" then tx = tx ^ 2 elseif instr == "d" then tx = tx - 1 elseif instr == "X" then local _, nextC = str:sub(i+2):find("C") nextC = nextC+i+1 for n = i+1, nextC do ignore[n] = true end functions[str:sub(i+1, i+1)] = str:sub(i+2, nextC) elseif instr == "K" then io.write(string.char(tx)) elseif instr == "C" then ignore[i+1] = true tx = deadfishx(functions[str:sub(i+1, i+1)]:sub(1, -2), tx) elseif instr == "D" then tx = 0 end end end return tx end -- If it's being loaded as a library (for some reason), then they now have the deadfishx function and the file can be closed if pcall(debug.getlocal, 4, 1) then return end local q_ = "i;iyratnrt gatmivpo" local _q = {1, 15, 18, 19, 5, 7, 11, 6, 8, 10, 3, 12, 9, 13, 17, 16, 14, 4, 2} local tar = {} for _, i in pairs(_q) do tar[#tar+1] = q_:sub(i, i) end tar = table.concat(tar, "") local function openXKCD(n) if package.config:sub(1,1) == "\\" then os.execute('start "" "http:///xkcd.com/' .. n .. '/" >nul 2>&1') else -- I don't want to install Linux so if this breaks Linux users please let me know os.execute("xdg-open http://xkcd.com/" .. n .. "/ &> /dev/null") end end local x = 0 local tArgs = {...} if tArgs[1] then local open = io.open(tArgs[1], "r") if not open then print("File does not exist!") os.exit() end local content = open:read("*a"):gsub("\r\n", ""):gsub("\n", "") open:close() deadfishx(content, x) os.exit() end while true do io.write(">> ") local cmd = io.read() if cmd == tar then openXKCD(1061%354) else x = deadfishx(cmd, x) end io.write("\n") end </nowiki></pre> == Haskell == <pre><nowiki> import Data.Char thd :: (a,b,c) -> c thd (_,_,x) = x mySnd :: (a,b,c) -> b mySnd (_,x,_) = x myFst :: (a,b,c) -> a myFst (x,_,_) = x parse code = reverse $ myFst $ go (filter (not . isSpace) code) 0 [] [] go "" state output funtions = (output,state,funtions) go [x] state output functions |x == 'x' = (output,state,functions) |x == 'k' = (intToDigit state : output,state,functions) |x == 'c' = (output,state,functions) |x == 'd' = (output,state,functions) |x == 'X' = error "function defined without name!" |x == 'K' = (chr state:output,state,functions) |x == 'C' = error "function called without name" |x == 'D' = (output,state,functions) go (x:xs) state output functions | x == 'x' = go xs (cor ((state + 1) `mod` 256)) output functions | x == 'k' = go xs state (intToDigit state : output) functions | x == 'c' = go xs (cor (state * state)) output functions | x == 'd' = go xs (cor (state - 1)) output functions | x == 'X' = go (tail (dropWhile (/= 'C') xs)) state output (newFunc (takeWhile (/= 'C') xs) functions) | x == 'K' = go xs state (chr state : output) functions | x == 'C' = let func = case lookup (head xs) functions of Nothing -> error "function not found" Just b -> b result = go func state output functions in go (tail xs) (mySnd result) (myFst result) (thd result) | x == 'D' = go xs 0 output functions | x `elem` map fst functions = error "Incorrect Function call" | otherwise = error "Syntax error!" newFunc "" ls = error "Function defined with no name" newFunc "a" ls = error "Function defined with no code" newFunc (x:xs) ls = (x,xs) : ls cor x = if x >= 0 && x < 256 then x else 0 </nowiki></pre> [[Category:Joke languages]] [[Category:Output only]] [[Category:Implemented]] [[Category:Languages]]'
Unified diff of changes made by edit (edit_diff)
'@@ -242,4 +242,56 @@ end </nowiki></pre> + +== Haskell == +<pre><nowiki> + +import Data.Char + +thd :: (a,b,c) -> c +thd (_,_,x) = x + +mySnd :: (a,b,c) -> b +mySnd (_,x,_) = x + +myFst :: (a,b,c) -> a +myFst (x,_,_) = x + +parse code = reverse $ myFst $ go (filter (not . isSpace) code) 0 [] [] + +go "" state output funtions = (output,state,funtions) +go [x] state output functions + |x == 'x' = (output,state,functions) + |x == 'k' = (intToDigit state : output,state,functions) + |x == 'c' = (output,state,functions) + |x == 'd' = (output,state,functions) + |x == 'X' = error "function defined without name!" + |x == 'K' = (chr state:output,state,functions) + |x == 'C' = error "function called without name" + |x == 'D' = (output,state,functions) +go (x:xs) state output functions + | x == 'x' = go xs (cor ((state + 1) `mod` 256)) output functions + | x == 'k' = go xs state (intToDigit state : output) functions + | x == 'c' = go xs (cor (state * state)) output functions + | x == 'd' = go xs (cor (state - 1)) output functions + | x == 'X' = go (tail (dropWhile (/= 'C') xs)) state output (newFunc (takeWhile (/= 'C') xs) functions) + | x == 'K' = go xs state (chr state : output) functions + | x == 'C' = let + func = case lookup (head xs) functions of + Nothing -> error "function not found" + Just b -> b + result = go func state output functions in + go (tail xs) (mySnd result) (myFst result) (thd result) + | x == 'D' = go xs 0 output functions + | x `elem` map fst functions = error "Incorrect Function call" + | otherwise = error "Syntax error!" + +newFunc "" ls = error "Function defined with no name" +newFunc "a" ls = error "Function defined with no code" +newFunc (x:xs) ls = (x,xs) : ls + +cor x = if x >= 0 && x < 256 then x else 0 + +</nowiki></pre> + [[Category:Joke languages]] '
New page size (new_size)
7701
Old page size (old_size)
5982
Lines added in edit (added_lines)
[ 0 => '', 1 => '== Haskell ==', 2 => '<pre><nowiki>', 3 => '', 4 => 'import Data.Char', 5 => '', 6 => 'thd :: (a,b,c) -> c', 7 => 'thd (_,_,x) = x', 8 => '', 9 => 'mySnd :: (a,b,c) -> b', 10 => 'mySnd (_,x,_) = x', 11 => '', 12 => 'myFst :: (a,b,c) -> a', 13 => 'myFst (x,_,_) = x', 14 => '', 15 => 'parse code = reverse $ myFst $ go (filter (not . isSpace) code) 0 [] []', 16 => '', 17 => 'go "" state output funtions = (output,state,funtions)', 18 => 'go [x] state output functions', 19 => ' |x == 'x' = (output,state,functions)', 20 => ' |x == 'k' = (intToDigit state : output,state,functions)', 21 => ' |x == 'c' = (output,state,functions)', 22 => ' |x == 'd' = (output,state,functions)', 23 => ' |x == 'X' = error "function defined without name!"', 24 => ' |x == 'K' = (chr state:output,state,functions)', 25 => ' |x == 'C' = error "function called without name"', 26 => ' |x == 'D' = (output,state,functions)', 27 => 'go (x:xs) state output functions', 28 => ' | x == 'x' = go xs (cor ((state + 1) `mod` 256)) output functions', 29 => ' | x == 'k' = go xs state (intToDigit state : output) functions', 30 => ' | x == 'c' = go xs (cor (state * state)) output functions', 31 => ' | x == 'd' = go xs (cor (state - 1)) output functions', 32 => ' | x == 'X' = go (tail (dropWhile (/= 'C') xs)) state output (newFunc (takeWhile (/= 'C') xs) functions)', 33 => ' | x == 'K' = go xs state (chr state : output) functions', 34 => ' | x == 'C' = let', 35 => ' func = case lookup (head xs) functions of', 36 => ' Nothing -> error "function not found"', 37 => ' Just b -> b', 38 => ' result = go func state output functions in', 39 => ' go (tail xs) (mySnd result) (myFst result) (thd result)', 40 => ' | x == 'D' = go xs 0 output functions', 41 => ' | x `elem` map fst functions = error "Incorrect Function call"', 42 => ' | otherwise = error "Syntax error!"', 43 => '', 44 => 'newFunc "" ls = error "Function defined with no name"', 45 => 'newFunc "a" ls = error "Function defined with no code"', 46 => 'newFunc (x:xs) ls = (x,xs) : ls', 47 => '', 48 => 'cor x = if x >= 0 && x < 256 then x else 0', 49 => '', 50 => '</nowiki></pre>', 51 => '' ]
Unix timestamp of change (timestamp)
'1740105150'