不过,这样的かんば て,也是不能继续太久的呢…… 至少身体条件不允许啊,现在又要去上学了
即便可以的话,虽然看起来现在是好多了,也不觉得自己是能够立刻解决所有问题的天才啊,很多在学校想一会的问题,到这里来,我都得想很久才能实现(有的时候也是因为开始想的幼稚,不过不上机居然是最快的)
即便可以的话,虽然看起来现在是好多了,也不觉得自己是能够立刻解决所有问题的天才啊,很多在学校想一会的问题,到这里来,我都得想很久才能实现(有的时候也是因为开始想的幼稚,不过不上机居然是最快的)
duangsuse::Echo
果然是 UTF-8 和 UTF-16 编码不兼容的问题…… 我这里 r2 上看到的『恭喜发财』是 3*4 字节,也难怪了
不过不管怎么样,我觉得 Java 那个真的是有很大问题,比方说你这有个文件echo -n NiHaoShiJie >helloworld hexdump helloworld 如你所见肯定是 11 个字(char8, Ni Hao Shi Jie, 9+2)
可是你用
java.io.File 的输入流 API 一读import java.io.File
val f = File("helloworld")
val fin = f.inputStream()
println(fin.read()) 欸,怎么好像是我的问题……
我一直很奇怪为什么
Reader.InMemory 和 Reader.File 在 readInt8, readChar16 的时候都会先弄出一 (-1) 一 (-2)....糟了,好像连 java.io.RandomAccessFile 和 java.io.DataInputStream 都不会弄出这档子事…… 这世界是怎么了
Welcome to Kotlin version 1.2.51 (JRE 1.8.0_222-b10)emmm 怎么又好了?又没有这个 bug 了?readChar16 也正常???WTF????
Type :help for help, :quit for quit
>>> import org.duangsuse.dokuss.*
>>> val r = Reader.File("helloworld")
>>> r.readInt8()
78
>>> r.readInt8()
105
This media is not supported in your browser
VIEW IN TELEGRAM
duangsuse::Echo
如果可能的话还想写点 Rust extern 和 unsafe 的内容呢... btw. (其实是完全无关的)想自动内存管理的时候突然想到 Xor 的 HexagonVM 使用了一个比较 trivial 的 naive dfs tracing GC,内存分配是基于 Rust std 类型的 https://github.com/losfair/hexagon/blob/master/src/object_pool.rs#L143 /// Run the garbage collector with…
let ROOT_STATICS = 0usize;Rust 的写起来相信会难看许多,因为它首先要 lifetime……(或许,如果推断不出的话)
fun visit_child(&mut self, &mut dfs: Vec<usize>, id: usize) {
let prod = &self.objects[id].as_ref().unwrap().as_object();
dfs.push_all(prod.get_children());
}
pub fn collect(&mut self, stack: &CallStack) {
let mut id_alive = vec![false; self.objects.len()];
let mut dfs: Vec<usize> = Vec::new();
dfs.push(ROOT_STATICS);
dfs.push_all(stack.collect_objects());
while let Some(id) = dfs.pop() {
if id_alive[id] { continue }
id_alive[id] = true;
self.visit_child(dfs, id);
}
for id in id_visited {
if !self.objects[id].is_some() || id_alive[id]
|| self.objects[id].as_ref().unwrap().has_native_refs()
{ continue }
self.objects[id].as_ref().unwrap().gc_notify();
self.deallocate(i);
}
}
然后是,我不知道 push_all 什么的能不能用
self.objects 居然是 Indexable<Optional<ProdVal>>, 也是奇怪,欸不对,是 index 这个操作本身 partial function…… 所以 Optional不过 Rust 还是有自己的风格,但是到处
.as_ref().unwrap().…… ,还不如写该写的……fun collectGarbage() {
val visited: MutableSet<ProdVal> = mutableSetOf() //....
}This media is not supported in your browser
VIEW IN TELEGRAM
duangsuse::Echo
😊 Sticker
#home duangsuse 返校,哦不是回家快乐……
这次,我要完成的一些事情:
+ Zhuazhou 的细节修改,此外,为了代码复用,我还得完成 num_preety.js, stream.js 和 zhang.js 插件
+ Dokuss 的 unsigned write (Byte, Short, Char.uext; Int.byteIterator) 和 Doku 封装,(即将)重写
如果使用 Dokuss 的 Java class serializer 和 AXML serializer 都成功的话
+ Badge.dex 和
+ RingBuffer 重写
+ Parser.kt (想了很久,也打了不少稿子)
+ Reflex (一门 JVM 脚本语言,送的,因为我正好需要解决
+ Montage.py (其实已经不重要了,因为之前的已经很多了…… 这个就是一个 DrawPlan, TintedDrawable, Range2D, Averager 和 samplePixel, colorInBound, ratioGT)
backgroundColor = hexcolor('#FFFFFF')
bound = (0x00, 0x00, 0x00)
shouldDrawText = compose(ratioGT(percent(50.0)), project(colorInBound(bound, backgroundColor)), samplePixel)
其中,
这次,我要完成的一些事情:
+ Zhuazhou 的细节修改,此外,为了代码复用,我还得完成 num_preety.js, stream.js 和 zhang.js 插件
+ Dokuss 的 unsigned write (Byte, Short, Char.uext; Int.byteIterator) 和 Doku 封装,(即将)重写
如果使用 Dokuss 的 Java class serializer 和 AXML serializer 都成功的话
+ Badge.dex 和
@builder kapt+ RingBuffer 重写
+ Parser.kt (想了很久,也打了不少稿子)
+ Reflex (一门 JVM 脚本语言,送的,因为我正好需要解决
TypeEqualizer 没写出来的问题)+ Montage.py (其实已经不重要了,因为之前的已经很多了…… 这个就是一个 DrawPlan, TintedDrawable, Range2D, Averager 和 samplePixel, colorInBound, ratioGT)
backgroundColor = hexcolor('#FFFFFF')
bound = (0x00, 0x00, 0x00)
shouldDrawText = compose(ratioGT(percent(50.0)), project(colorInBound(bound, backgroundColor)), samplePixel)
其中,
project: ((Iterable<E>) -> R) -> (Iterable<E>) -> Pair<Iterable<E>, R>RingBuffer.kt
3.8 KB
#Kotlin 我又写了一遍,不太好看,之前想的时候觉得是很清楚的,坐在屏幕前的时候就麻烦了
>>>
listOf(1,2,3).zipWith(listOf(4,5,6)) { a,b->println("$a $b") }.take(2)
1 4
2 5
3 6
[kotlin.Unit, kotlin.Unit]
好像正常,为什么刚才测试的时候 addMany 好像不正确?RingBuffer.kt
3.5 KB
我修改了一下代码,比如移除了不适合的类型抽象、改进了
until (新模型),现在看起来代码更好看了>>> r.addAll(listOf(1,2,3))好。
>>> r.viewport()
[1, 2, 3]
>>> r.pop()
1
>>> r.add(2)
>>> r.viewport()
[2, 3, 2]
>>> r
Ring[[2, 2, 3]; ^1, _1, 3]
RingBuffer.kt
4 KB
#Kotlin 『用四种方法写 RingBuffer……』