duangsuse::Echo
712 subscribers
4.24K photos
127 videos
583 files
6.46K links
import this:
美而不丑、明而不暗、短而不凡、长而不乱,扁平不宽,读而后码,行之天下,勿托地上天国。
异常勿吞,难过勿过,叹一真理。效率是很重要,盲目最是低效。
简明是可靠的先验,不是可靠的祭品。
知其变,守其恒,为天下式;穷其变,知不穷,得地上势。知变守恒却穷变知新,我认真理,我不认真。

技术相干订阅~
另外有 throws 闲杂频道 @dsuset
转载频道 @dsusep
极小可能会有批评zf的消息 如有不适可退出
suse小站(面向运气编程): https://WOJS.org/#/
Download Telegram
记忆力太差 module Main (..) where

import Browser
import Html exposing (Div, text, Button)
import Html.Events exposing (KeyUp)
import Random

type Dice = { newFace: Int }
type Message = Dice | NewFace Int

view d =
Div [], [
Button [KeyUp Dice], []
]

update d m =
case m of
Dice -> (d, Random.run (randint 0 2) )
(NewFace x) -> (Dict { newFace = x }, Cmd.none)

main = Browser.element { init = Dice { newFace = 0 }, view = view, update = update }
duangsuse::Echo
记忆力太差 module Main (..) where import Browser import Html exposing (Div, text, Button) import Html.Events exposing (KeyUp) import Random type Dice = { newFace: Int } type Message = Dice | NewFace Int view d = Div [], [ Button [KeyUp Dice], [] ] update…
刚才我在 online editor 上在线默写学习,就快要成功的时候,忍不住偷看了一下,结果给 Firefox 卡死了…… 两次……
不过算是已经了解了, init : () -> (Message, Cmd a) 的事实, subscriptions : () -> ??? 呢?
🤔 ParserKt 里需要定义一个辅助的 sealed class Eiter<A, B> { data class Left, Right }
Left/Right 都持有 val value 整个 Either,我计划提供 val left: A?, right: B?
fun mustLeft():A, mustRight():B
fun <T, R> map(transform: (T) -> R): Either<R, R> where A: T, B: T
(存疑?)
fun <R> fold(trans_left: (A) -> R, trans_right: (B) -> R): R
Forwarded from 螺莉莉的黑板报
https://microsoftedge.microsoft.com/addons/detail/hokifickgkhplphjiodbggjmoafhignh
【本报讯】微软发布了 Grammarly 的竞品 Microsoft Editor,所有用户均可免费使用基本功能,M365(O365)用户可以使用高阶功能。
Forwarded from 一碗脑脊液。
2010 年 3 月 23 日,谷歌中国发表声明退出国内市场

2010 年 3 月 30 日,中国政府正式通过 DNS 污染等官方手段 封杀其所有域名及相关服务

=

2020 年 3 月 30日,十年。
This media is not supported in your browser
VIEW IN TELEGRAM
我又要继续写关系式求解器了……
首先来看看 six primitives : State, Variable, Introduce
然后 Equal, Both, Either

那么怎么对 unification 进行可扩展的建模呢…… 先写点东西
草,不可以,其实我是想指定 A: T, B: T,我想让 T 限定为 A, B 的 union type,现在 T 是 intersection 了…… 其实我是想让 (T) -> R 在输入 A 和 B 的时候都可用,只有 T 是 A并B的时候才可以,如果 T 是A交B,作为函参限定当然不可以了(但是作为输入可以)
草,直接禁止类型参数关联……
This media is not supported in your browser
VIEW IN TELEGRAM
其实这个 Either.map 总体上来看实现是错误的(即便这次通过了也是不对的),请不要效仿。
又是一个弱智操作……(草) 什么鬼 *注:正经的是 fun mapLeft, mapRight;到此为止。
sealed class Either<A, B> {
data class Left<A>(val value: A): Either<A, Nothing>()
data class Right<B>(val value: B): Either<Nothing, B>()
val left: A? get() = (this as? Left<A>)?.value
val right: B? get() = (this as? Right<B>)?.value
fun mustLeft() = left ?: throw AssertionError("$this not left")
fun mustRight() = right ?: throw AssertionError("$this not right")

fun <R> fold(trans_left: (A) -> R, trans_right: (B) -> R): R = when (this) {
is Left -> trans_left(this.value)
is Right -> trans_right(this.value)
}
}
https://mohu.pincong.rocks/question/
🤔 最近膜乎的链接都过期了,有简单的等价链接,我找不到合理的 URL replace Firefox 插件,自己写一个去。

function onLink(url) {
for (let [pat, dst] of settings.replaceMap) {
let match = pat.exec(url);
if (match != null) { redirect(format(dst, i => match[i])); }
}
}

function drop(n, str) { return str.substring(n, str.length); }
function format(str, replace, prefix = '\\', take = view => /(\d+)/y.exec(view)[1], transform = Number.parseInt) {
let view = str;
let replaced = [];
while (view.length > 0) {
if (view.startsWith(prefix)) {
let took = take(view);
view = drop(took.length, view);
replaced.push( replace(transform(took)) );
} else {
let prefixIdx = view.indexOf(prefix);
if (prefixIdx == (-1)) prefixIdx = view.length;
replaced.push( view.substring(0, prefixIdx) );
view = drop(prefixIdx, view);
}
}
return replaced.join("");
}

🤔我简直是变态…… 为什么要写 format()……
function drop(n, str) { return str.substring(n, str.length); }
function format(str, replace, prefix = '\\' , take = view => /(\d+)/.exec(view)[0], transform = Number.parseInt) {
let view = str;
let result = [];
while (view.length != 0) {
let prefixIdx = view.indexOf(prefix); if (prefixIdx == (-1)) break;
result.push( view.substring(0, prefixIdx) );
view = drop(prefixIdx+prefix.length, view);
let took = take(view);
if (took == null) throw SyntaxError(`Unexpected ${view} after ${prefix}`);
result.push( replace(transform(took)) );
view = drop(took.length, view);
}
result.push(view);
return result.join("");
}
This media is not supported in your browser
VIEW IN TELEGRAM
我太蠢了,不知道要把 muKanren 的 Kotlin 复制设计为可扩展的形式需要多久。
<ul>
<li> <input id="fmt"> <input id="dst">
🤔现在还需要知道设置界面……