好无聊啊,突然 doesn't feel like to do anything 🕊
不想写一个基于 Feed 架构支持 boolean, number, string, name 的函数组织语言
连 State,Variable,introduce,Eq,Both,Either 的关系式求解器也不想写了
也不想继续写 ParserKt 和 org.duangsuse.bin
不对,我想继续写 org.duangsuse.bin ……
想写能看树结构的 GUI …… 🤔
突然觉得那个给 ACE 等 web code editor 支持 parser 的 AGL 好厉害啊,虽然我都没看见 AGL 的 parser 在哪,而且 ParserKt 利用 codegen 也可以做到
……不对,用不着 codegen,反正 Pattern 可以 dynamic construct
我在哪我是谁我要干什么……
不想写一个基于 Feed 架构支持 boolean, number, string, name 的函数组织语言
连 State,Variable,introduce,Eq,Both,Either 的关系式求解器也不想写了
也不想继续写 ParserKt 和 org.duangsuse.bin
不对,我想继续写 org.duangsuse.bin ……
想写能看树结构的 GUI …… 🤔
突然觉得那个给 ACE 等 web code editor 支持 parser 的 AGL 好厉害啊,虽然我都没看见 AGL 的 parser 在哪,而且 ParserKt 利用 codegen 也可以做到
……不对,用不着 codegen,反正 Pattern 可以 dynamic construct
我在哪我是谁我要干什么……
https://github.com/itorr/homo/blob/master/homo.js#L1 #JavaScript #code
核心代码,首先我们有一个类似这样的表,
核心代码,首先我们有一个类似这样的表,
eval(xs[i]) == i : ["1", "2"]function divmod(a, b) { return [Math.trunc(a/b), a%b]; }
function ordFinder(xs, cmp, is_descending = false) {
const sorted = is_descending? xs.sort((a, b) => b-a) : xs.sort();
return function finder(n) {
for (let x of xs) if (cmp(x, n)) return x;
};
}
const findMaxLT = ordFinder(predefined, (a, b) => a < b, true);
function demolish(num) {
if (typeof num != "number") return "";
if (num < predefined.length) return predefined[num];
let [k, div] = divmod(num, findMaxLT(num) );
return `({demolish(k)}*{div}+{deomolish(mod)})`. replace(/\*\(1\)/, "") //*1=itself
}
开始我还以为是自动构造数学表达式然后 filter 呢……GitHub
homo/homo.js at master · itorr/homo
💩「恶臭数字论证器」数字恶臭化工具. Contribute to itorr/homo development by creating an account on GitHub.
duangsuse::Echo
https://github.com/itorr/homo/blob/master/homo.js#L1 #JavaScript #code 核心代码,首先我们有一个类似这样的表,eval(xs[i]) == i : ["1", "2"] function divmod(a, b) { return [Math.trunc(a/b), a%b]; } function ordFinder(xs, cmp, is_descending = false) { const sorted = is_descending?…
对
如果你想要它相对高效地返回项目的索引,必须创建一个 item index <=> sorted index 的双向映射。
ordFinder(xs, cmp, is_descending) 更简单一点的版本是:function simpleOrdFinder(xs, is_max, is_lt) {
return ordFinder(xs, is_lt? (a, b) => a<b: (a, b) => a>b, is_max);
} 如果你想要它相对高效地返回项目的索引,必须创建一个 item index <=> sorted index 的双向映射。
Forwarded from dnaugsuz
你大可放宽心,别去计较。
我上次被他们那些人踢,都是因为我太较真(讨论的言辞并不激烈,但他们说我对线)
我上次被他们那些人踢,都是因为我太较真(讨论的言辞并不激烈,但他们说我对线)
Forwarded from dnaugsuz
他喷了一下 Python 的 venv 等依赖版本控制策略
说点个人看法,我觉得以上言辞…… 要我还不至于就会直接 ban
说点个人看法,我觉得以上言辞…… 要我还不至于就会直接 ban
Forwarded from dnaugsuz
如果你经常看黑 node_modules 的消息, 你就会发现他们都是善意嘲讽
这个言辞略微有点激烈了
这个言辞略微有点激烈了
Forwarded from dnaugsuz
可能只是你最开始了解的他不完善而已,现在你知道他的另一面了。
脸熟网友变脸的事情我也经常遇到
脸熟网友变脸的事情我也经常遇到