irgendwas mit es6

This commit is contained in:
Flummi 2017-12-11 18:09:16 +01:00
parent b9d997b652
commit 20c5ea20de

View File

@ -11,7 +11,7 @@ const hsimports = [
"Data.Ord", "Data.Set", "Data.String", "Data.Tuple", "Data.Word" "Data.Ord", "Data.Set", "Data.String", "Data.Tuple", "Data.Word"
].map(imp => { return `import qualified ${imp}`; }).join("\r\n"); ].map(imp => { return `import qualified ${imp}`; }).join("\r\n");
function sandbox(lang, code) { const sandbox = (lang, code) => {
const langs = { const langs = {
cpp: { cpp: {
"LanguageChoice": "7", "LanguageChoice": "7",
@ -83,18 +83,18 @@ function sandbox(lang, code) {
reject("Error!"); reject("Error!");
}) })
}); });
} };
function bfgen(text) { const bfgen = text => {
let out = "+".repeat(10) + "["; let out = "+".repeat(10) + "[";
let repeat = 0; let repeat = 0;
for (let i = 0; i < text.length; i++) for (let i = 0; i < text.length; i++)
repeat = text.charCodeAt(i) - text.charCodeAt(i) % 10; repeat = text.charCodeAt(i) - text.charCodeAt(i) % 10;
out += repeat > 10 ? '>' + "+".repeat(repeat / 10) : null; out += repeat > 10 ? ">" + "+".repeat(repeat / 10) : null;
out += "<".repeat(out.split(">").length - 1) + "-]"; out += "<".repeat(out.split(">").length - 1) + "-]";
for (let i = 0; i < text.length; i++) for (let i = 0; i < text.length; i++)
out += ">" + "+".repeat(text.charCodeAt(i) % 10) + "."; out += ">" + "+".repeat(text.charCodeAt(i) % 10) + ".";
return out; return out;
} };
export { maxoutput, sandbox, bfgen, hsimports }; export { maxoutput, sandbox, bfgen, hsimports };