From 4cc21461ab5c56064d19ff085ef9a16afd818c19 Mon Sep 17 00:00:00 2001 From: skylarmt Date: Mon, 13 Apr 2015 12:38:59 -0600 Subject: [PATCH] Merge code completion files (they were completely redundant). --- .../apocalypselabs/symat/CodeCompleter.java | 2 +- src/net/apocalypselabs/symat/functions.py | 6 ++- .../{jsfunctions.txt => functions.txt} | 1 + .../symat/resources/pyfunctions.txt | 46 ------------------- 4 files changed, 7 insertions(+), 48 deletions(-) rename src/net/apocalypselabs/symat/resources/{jsfunctions.txt => functions.txt} (94%) delete mode 100644 src/net/apocalypselabs/symat/resources/pyfunctions.txt diff --git a/src/net/apocalypselabs/symat/CodeCompleter.java b/src/net/apocalypselabs/symat/CodeCompleter.java index 8ecb687..e51712d 100644 --- a/src/net/apocalypselabs/symat/CodeCompleter.java +++ b/src/net/apocalypselabs/symat/CodeCompleter.java @@ -82,7 +82,7 @@ public class CodeCompleter { for (String fileid : files) { BufferedReader reader = new BufferedReader( new InputStreamReader( - CodeCompleter.class.getResourceAsStream("resources/" + lang + fileid + ".txt"))); + CodeCompleter.class.getResourceAsStream("resources/" + (fileid.equals(files[0]) ? "" : lang) + fileid + ".txt"))); String line; while ((line = reader.readLine()) != null) { switch (fileid) { diff --git a/src/net/apocalypselabs/symat/functions.py b/src/net/apocalypselabs/symat/functions.py index e80d603..a643572 100644 --- a/src/net/apocalypselabs/symat/functions.py +++ b/src/net/apocalypselabs/symat/functions.py @@ -67,4 +67,8 @@ def md5sum(a): def save(a,b): return _.save(a,b) def load(a): - return _.load(a) \ No newline at end of file + return _.load(a) +def powermod(a,b,m): + return _.powermod(a,b,m) +def gcd(a,b): + return _.gcd(a,b) \ No newline at end of file diff --git a/src/net/apocalypselabs/symat/resources/jsfunctions.txt b/src/net/apocalypselabs/symat/resources/functions.txt similarity index 94% rename from src/net/apocalypselabs/symat/resources/jsfunctions.txt rename to src/net/apocalypselabs/symat/resources/functions.txt index cfd382d..7ea9013 100644 --- a/src/net/apocalypselabs/symat/resources/jsfunctions.txt +++ b/src/net/apocalypselabs/symat/resources/functions.txt @@ -39,6 +39,7 @@ floor(0)|Round the number down to the next integer. log(0)|Natural log of number. max(0,1,...)|Returns the highest number given. min(0,1,...)|Returns the lowest number given. +powermod(a,b,m)|Find pow(a,b) mod m, or modular inverse if b=-1. pow(x,y)|Raise x to y and calculate. sin(0)|Find the sine. cos(0)|Find the cosine. diff --git a/src/net/apocalypselabs/symat/resources/pyfunctions.txt b/src/net/apocalypselabs/symat/resources/pyfunctions.txt deleted file mode 100644 index 479e3a2..0000000 --- a/src/net/apocalypselabs/symat/resources/pyfunctions.txt +++ /dev/null @@ -1,46 +0,0 @@ -notify("")|Display a message in a box. -ask("")|Ask a question in a box. Supply question text. -diff('',"x")|Find the derivative of the function passed with respect to the second argument. -integrate('',"x")|Find the integral of the function passed with respect to the second argument. -rad(0)|Convert a given number in degrees to radians. -deg(0)|Convert a given number in radians to degrees. -subs('',"x")|Solve an equation for the second argument. -plot()|Show the plot window. -plot('')|Graph the given function. -plotname("")|Sets the title of the graph window. -plotname()|Gets the title of the graph window. -xlim(min,max)|Sets the x-axis min and max values. Cannot be used after a formula has been graphed. -plotclr()|Reset the graph. -drawdot(x, y)|Places a dot at the given coordinates. -simplify('')|Simplify the given function. -readfile("")|Read a text file from the given filename. -savefile(data,"")|Save the text data to a file. -save(key,val)|Save the text val to text key. -load(key)|Load the saved text related to key. -rand()|Random fraction from 0 (inclusive) to 1 (exclusive) -rand(min,max)|Random number between min and max, inclusive -randb()|Random boolean (true or false) -add(n1,n2,...)|Add the given numbers. -subtract(n1,n2,...)|Subtract the given numbers. -times(n1,n2,...)|Multiply the given numbers. -divide(n1,n2,...)|Divide the given numbers. -mod(n1,n2,...)|Divide the numbers and return the remainder. -vpa('')|Computes numerical value or simplifies. -factorial(n)|Get the factorial (n!) of n as a string. -factor(n)|Get an array of all the factors of n. -perms(items)|Array of all possible combinations. -fabs(0)|Absolute value of number. -asin(0)|Arcsine of number. -acos(0)|Arccosine of number. -atan(0)|Arctangent of number. -ceil(0)|Round the number up to the next integer. -exp(0)|e^x. -floor(0)|Round the number down to the next integer. -log(0)|Natural log of number. -max(0,1,...)|Returns the highest number given. -min(0,1,...)|Returns the lowest number given. -pow(x,y)|Raise x to y and calculate. -sin(0)|Find the sine. -cos(0)|Find the cosine. -tan(0)|Find the tangent. -print("")|Prints the supplied text or formula to the output. \ No newline at end of file