From d47994217a2df8d80a244e8fcbad980bbcfd00c7 Mon Sep 17 00:00:00 2001 From: muqiuhan Date: Mon, 27 May 2024 02:37:20 +0000 Subject: deploy: 74dc3d892d8e10bfddfa931b1cae8bdc462132a0 --- search.xml | 119 +++++++++++++++++++++++++++++++------------------------------ 1 file changed, 61 insertions(+), 58 deletions(-) (limited to 'search.xml') diff --git a/search.xml b/search.xml index 3512f5f3..49e0c6c7 100644 --- a/search.xml +++ b/search.xml @@ -667,6 +667,38 @@ OCaml + + 过度疲劳的六种表现 + /2023/10/12/%E8%BF%87%E5%BA%A6%E7%96%B2%E5%8A%B3%E7%9A%84%E5%85%AD%E7%A7%8D%E8%A1%A8%E7%8E%B0/ + +
  • 不知不觉就睡着了, 比如在地铁, 公交车这一类很吵闹的地方无意识睡着了。
  • +
  • 刚起床就感觉很累,怎么睡都睡不够,醒来就很累,很疲惫,身心俱疲的无力感
  • +
  • 长溃疡,结节甚至是囊肿,免疫力下降,反复溃疡,年纪轻轻身上一堆结节和囊肿
  • +
  • 比较严重的体臭,口臭,头发油臭,和正常的味道不同,肝功能下降,氨随汗液排出,这种“疲劳臭”很难闻。
  • +
  • 脱发长痘痘,痘痘反复发作,年纪轻轻头发大把大把掉,梳头一地头发。
  • +
  • 对任何事物都感到厌烦,对任何事物都提不起兴趣,第一反应是很烦,做什么都烦
  • + +

    身体不舒服应该第一时间去医院,如果你打算明天去医院看看的话,那今天就不要剧烈运动了,也不要再过度劳累,好今晚好好泡一个热水澡早点睡觉噢。

    +]]>
    + + Life + +
    + + 隐藏一些OCaml Effect的机制,让其语法在精神上更接近delimcc + /2023/06/28/%E9%9A%90%E8%97%8F%E4%B8%80%E4%BA%9BOCaml-Effect%E7%9A%84%E6%9C%BA%E5%88%B6%EF%BC%8C%E8%AE%A9%E5%85%B6%E8%AF%AD%E6%B3%95%E5%9C%A8%E7%B2%BE%E7%A5%9E%E4%B8%8A%E6%9B%B4%E6%8E%A5%E8%BF%91delimcc/ + delimcc_of_fxhandler这个库在OCaml5的effect handlers上实现了一些delimcc原语(shift/reset, control/prompt这些):

    +
    let p = new_prompt () in
    assert ([] = push_prompt p (fun () ->
    1::2::take_subcont p (fun _k -> [])));
    assert ([1;2] = push_prompt p (fun () ->
    1::2::take_subcont p (fun k -> push_subcont k [])));
    assert (135 =
    let p1 = new_prompt () in
    let p2 = new_prompt () in
    let p3 = new_prompt () in
    let pushtwice sk =
    sk (fun () ->
    sk (fun () ->
    shift0 p2 (fun sk2 -> sk2 (fun () ->
    sk2 (fun () -> 3))) ()))
    in
    push_prompt p1 (fun () ->
    push_prompt p2 (fun () ->
    push_prompt p3 (fun () -> shift0 p1 pushtwice ()) + 10) + 1) + 100);

    print_endline "Success!"
    + +

    另外, avsm这里可以看到一些OCaml的Effect Syntax进展。

    +

    还有 multi-shot continuations in OCaml,在这个仓库里面还讨论了一些有趣的问题,例如,OCaml 编译器和runtime会做出一些假设从而进行一些优化,这些优化在使用multi-shot continutation时是不可取的(或完全错误的)。编译器优化导致错误的一个例子是堆到栈的转换,例如:

    +
    (* An illustration of how the heap to stack optimisation is broken.
    * This example is adapted from de Vilhena and Pottier (2021).
    * file: heap2stack.ml
    * compile: ocamlopt -I $(opam var lib)/multicont multicont.cmxa heap2stack.ml
    * run: ./a.out *)

    (* We first require a little bit of setup. The following declares an
    operation `Twice' which we use to implement multiple returns. *)
    type _ Effect.t += Twice : unit Effect.t

    (* The handler `htwice' interprets `Twice' by simply invoking its
    continuation twice. *)
    let htwice : (unit, unit) Effect.Deep.handler
    = { retc = (fun x -> x)
    ; exnc = (fun e -> raise e)
    ; effc = (fun (type a) (eff : a Effect.t) ->
    let open Effect.Deep in
    match eff with
    | Twice -> Some (fun (k : (a, _) continuation) ->
    continue (Multicont.Deep.clone_continuation k) ();
    continue k ())
    | _ -> None) }

    (* Now for the interesting stuff. In the code below, the compiler will
    perform an escape analysis on the reference `i' and deduce that it
    does not escape the local scope, because it is unaware of the
    semantics of `perform Twice', hence the optimiser will transform
    `i' into an immediate on the stack to save a heap allocation. As a
    consequence, the assertion `(!i = 1)' will succeed twice, whereas
    it should fail after the second return of `perform Twice'. *)
    let heap2stack () =
    Effect.Deep.match_with
    (fun () ->
    let i = ref 0 in
    Effect.perform Twice;
    i := !i + 1;
    Printf.printf "i = %d\n%!" !i;
    assert (!i = 1))
    () htwice

    (* The following does not trigger an assertion failure. *)
    let _ = heap2stack ()

    (* To fix this issue, we can wrap reference allocations in an instance
    of `Sys.opaque_identity'. However, this is not really a viable fix
    in general, as we may not have access to the client code that
    allocates the reference! *)
    let heap2stack' () =
    Effect.Deep.match_with
    (fun () ->
    let i = Sys.opaque_identity (ref 0) in
    Effect.perform Twice;
    i := !i + 1;
    Printf.printf "i = %d\n%!" !i;
    assert (!i = 1))
    () htwice

    (* The following triggers an assertion failure. *)
    let _ = heap2stack' ()
    +]]>
    + + Technique + OCaml + +
    WiscKey: Separating Keys from Values in SSD-conscious Storage /2023/07/21/WiscKey-Separating-Keys-from-Values-in-SSD-conscious-Storage/ @@ -953,6 +985,20 @@

    或许应该换句说法,

    这个世界将会是我们义无反顾的绝对热爱。


    +]]> + + gallery + +
    + + 二〇二四年三月二十二日 + /2024/03/22/%E4%BA%8C%E3%80%87%E4%BA%8C%E5%9B%9B%E5%B9%B4%E4%B8%89%E6%9C%88%E4%BA%8C%E5%8D%81%E4%BA%8C%E6%97%A5/ + 毛毛在人群中牵着我,却很难融入人群,我在林中面对着毛毛,树木的思想却千姿百态地向我涌来。
    它说,它要将灵魂撕裂,让它暴露在最灼热的阳光下灼烧,要让风刺进来,硬生生扯开一道口子,要让原有的赤色消失殆尽,只留下一堆松散的灰色颗粒,任雨打浮萍。

    +

    毛毛和我看到了宇宙熵增,和我见到了熙攘的街道,现在变成了我耳边的风声。
    是啊,是啊,你不再身陷囹圄,自由不再是攀在高墙上爬山虎的叶子,不再是吹进风间的花粉,不再是藏躲进阴暗土地里的水,不再是破碎割手的杯子片块。
    但是这个世界还是越来越美了,我独自一人,却很自在,别无所求,只想被阳光晒透,被狂风穿过。渴望成熟,要准备好死去,也准备好重生。

    +
    +

    小土堆上长出了狗尾巴草,当我靠近时,狗尾巴草会向我轻轻晃动,就像它小时候向我跑来时那样,不同的是,当我向前跑的时候,背后没有一个小小的身影再追过来了,但当我回望小土堆,狗尾巴草依然在摇晃,就像当初给予我回应那样。

    +
    +

    狗儿要听狗儿歌,
    毛毛下雨要回家,
    小狗小狗画梅花,
    直走就是我们家。

    ]]>
    gallery @@ -1256,18 +1302,18 @@
    - 二零二二年九月二十二日 - /2022/09/22/%E4%BA%8C%E9%9B%B6%E4%BA%8C%E4%BA%8C%E5%B9%B4%E4%B9%9D%E6%9C%88%E4%BA%8C%E5%8D%81%E4%BA%8C%E6%97%A5/ - 似是而非的脸,和我的吉他,低头呢喃细语,抬头语焉不详,麦浪,烈日,溪水,咳嗽,敲打,药丸碰撞罐壁。

    + 二零二二年三月十四日 + /2022/03/14/%E4%BA%8C%E9%9B%B6%E4%BA%8C%E4%BA%8C%E5%B9%B4%E4%B8%89%E6%9C%88%E5%8D%81%E5%9B%9B%E6%97%A5/ + 我很庆幸能在那年中秋的傍晚出门走走。我看到了落日藏进天边,看到了圆月晕开情绪,我感受到了小山包上的晚风,感受到了落叶翻进衣领清扫锁骨,它们让我留在这个小地方做个平凡且平庸的人,过着平静且平安的生活,尽管生活平常且饭菜平淡,但这日子的每分每秒都是我对生活的爱意。

    ]]>
    gallery
    - 二零二二年三月十四日 - /2022/03/14/%E4%BA%8C%E9%9B%B6%E4%BA%8C%E4%BA%8C%E5%B9%B4%E4%B8%89%E6%9C%88%E5%8D%81%E5%9B%9B%E6%97%A5/ - 我很庆幸能在那年中秋的傍晚出门走走。我看到了落日藏进天边,看到了圆月晕开情绪,我感受到了小山包上的晚风,感受到了落叶翻进衣领清扫锁骨,它们让我留在这个小地方做个平凡且平庸的人,过着平静且平安的生活,尽管生活平常且饭菜平淡,但这日子的每分每秒都是我对生活的爱意。

    + 二零二二年九月二十二日 + /2022/09/22/%E4%BA%8C%E9%9B%B6%E4%BA%8C%E4%BA%8C%E5%B9%B4%E4%B9%9D%E6%9C%88%E4%BA%8C%E5%8D%81%E4%BA%8C%E6%97%A5/ + 似是而非的脸,和我的吉他,低头呢喃细语,抬头语焉不详,麦浪,烈日,溪水,咳嗽,敲打,药丸碰撞罐壁。

    ]]>
    gallery @@ -1286,20 +1332,6 @@ 二零二二年十一月月三日 /2022/11/03/%E4%BA%8C%E9%9B%B6%E4%BA%8C%E4%BA%8C%E5%B9%B4%E5%8D%81%E4%B8%80%E6%9C%88%E6%9C%88%E4%B8%89%E6%97%A5/ 我独自冒着冷风,去薄霜铺地的林子里,为听鸟语,为盼朝阳,为寻泥土里渐次苏醒的花草,但春信不至。我是如此单独而完整,在无数个夜晚,独自顶着冷风 伫立在老橘树下的桥头,只为听一曲夜莺的哀歌,倚暖了石栏上的青苔,青苔凉透了我的心坎,但夜莺不来,夜莺不来啊。

    -]]>
    - - gallery - -
    - - 二〇二四年三月二十二日 - /2024/03/22/%E4%BA%8C%E3%80%87%E4%BA%8C%E5%9B%9B%E5%B9%B4%E4%B8%89%E6%9C%88%E4%BA%8C%E5%8D%81%E4%BA%8C%E6%97%A5/ - 毛毛在人群中牵着我,却很难融入人群,我在林中面对着毛毛,树木的思想却千姿百态地向我涌来。
    它说,它要将灵魂撕裂,让它暴露在最灼热的阳光下灼烧,要让风刺进来,硬生生扯开一道口子,要让原有的赤色消失殆尽,只留下一堆松散的灰色颗粒,任雨打浮萍。

    -

    毛毛和我看到了宇宙熵增,和我见到了熙攘的街道,现在变成了我耳边的风声。
    是啊,是啊,你不再身陷囹圄,自由不再是攀在高墙上爬山虎的叶子,不再是吹进风间的花粉,不再是藏躲进阴暗土地里的水,不再是破碎割手的杯子片块。
    但是这个世界还是越来越美了,我独自一人,却很自在,别无所求,只想被阳光晒透,被狂风穿过。渴望成熟,要准备好死去,也准备好重生。

    -
    -

    小土堆上长出了狗尾巴草,当我靠近时,狗尾巴草会向我轻轻晃动,就像它小时候向我跑来时那样,不同的是,当我向前跑的时候,背后没有一个小小的身影再追过来了,但当我回望小土堆,狗尾巴草依然在摇晃,就像当初给予我回应那样。

    -
    -

    狗儿要听狗儿歌,
    毛毛下雨要回家,
    小狗小狗画梅花,
    直走就是我们家。

    ]]>
    gallery @@ -2293,23 +2325,6 @@ Life
    - - 过度疲劳的六种表现 - /2023/10/12/%E8%BF%87%E5%BA%A6%E7%96%B2%E5%8A%B3%E7%9A%84%E5%85%AD%E7%A7%8D%E8%A1%A8%E7%8E%B0/ - -
  • 不知不觉就睡着了, 比如在地铁, 公交车这一类很吵闹的地方无意识睡着了。
  • -
  • 刚起床就感觉很累,怎么睡都睡不够,醒来就很累,很疲惫,身心俱疲的无力感
  • -
  • 长溃疡,结节甚至是囊肿,免疫力下降,反复溃疡,年纪轻轻身上一堆结节和囊肿
  • -
  • 比较严重的体臭,口臭,头发油臭,和正常的味道不同,肝功能下降,氨随汗液排出,这种“疲劳臭”很难闻。
  • -
  • 脱发长痘痘,痘痘反复发作,年纪轻轻头发大把大把掉,梳头一地头发。
  • -
  • 对任何事物都感到厌烦,对任何事物都提不起兴趣,第一反应是很烦,做什么都烦
  • - -

    身体不舒服应该第一时间去医院,如果你打算明天去医院看看的话,那今天就不要剧烈运动了,也不要再过度劳累,好今晚好好泡一个热水澡早点睡觉噢。

    -]]>
    - - Life - -
    金匮要略 /2023/03/04/%E9%87%91%E5%8C%AE%E8%A6%81%E7%95%A5/ @@ -3577,21 +3592,6 @@ Medicine - - 隐藏一些OCaml Effect的机制,让其语法在精神上更接近delimcc - /2023/06/28/%E9%9A%90%E8%97%8F%E4%B8%80%E4%BA%9BOCaml-Effect%E7%9A%84%E6%9C%BA%E5%88%B6%EF%BC%8C%E8%AE%A9%E5%85%B6%E8%AF%AD%E6%B3%95%E5%9C%A8%E7%B2%BE%E7%A5%9E%E4%B8%8A%E6%9B%B4%E6%8E%A5%E8%BF%91delimcc/ - delimcc_of_fxhandler这个库在OCaml5的effect handlers上实现了一些delimcc原语(shift/reset, control/prompt这些):

    -
    let p = new_prompt () in
    assert ([] = push_prompt p (fun () ->
    1::2::take_subcont p (fun _k -> [])));
    assert ([1;2] = push_prompt p (fun () ->
    1::2::take_subcont p (fun k -> push_subcont k [])));
    assert (135 =
    let p1 = new_prompt () in
    let p2 = new_prompt () in
    let p3 = new_prompt () in
    let pushtwice sk =
    sk (fun () ->
    sk (fun () ->
    shift0 p2 (fun sk2 -> sk2 (fun () ->
    sk2 (fun () -> 3))) ()))
    in
    push_prompt p1 (fun () ->
    push_prompt p2 (fun () ->
    push_prompt p3 (fun () -> shift0 p1 pushtwice ()) + 10) + 1) + 100);

    print_endline "Success!"
    - -

    另外, avsm这里可以看到一些OCaml的Effect Syntax进展。

    -

    还有 multi-shot continuations in OCaml,在这个仓库里面还讨论了一些有趣的问题,例如,OCaml 编译器和runtime会做出一些假设从而进行一些优化,这些优化在使用multi-shot continutation时是不可取的(或完全错误的)。编译器优化导致错误的一个例子是堆到栈的转换,例如:

    -
    (* An illustration of how the heap to stack optimisation is broken.
    * This example is adapted from de Vilhena and Pottier (2021).
    * file: heap2stack.ml
    * compile: ocamlopt -I $(opam var lib)/multicont multicont.cmxa heap2stack.ml
    * run: ./a.out *)

    (* We first require a little bit of setup. The following declares an
    operation `Twice' which we use to implement multiple returns. *)
    type _ Effect.t += Twice : unit Effect.t

    (* The handler `htwice' interprets `Twice' by simply invoking its
    continuation twice. *)
    let htwice : (unit, unit) Effect.Deep.handler
    = { retc = (fun x -> x)
    ; exnc = (fun e -> raise e)
    ; effc = (fun (type a) (eff : a Effect.t) ->
    let open Effect.Deep in
    match eff with
    | Twice -> Some (fun (k : (a, _) continuation) ->
    continue (Multicont.Deep.clone_continuation k) ();
    continue k ())
    | _ -> None) }

    (* Now for the interesting stuff. In the code below, the compiler will
    perform an escape analysis on the reference `i' and deduce that it
    does not escape the local scope, because it is unaware of the
    semantics of `perform Twice', hence the optimiser will transform
    `i' into an immediate on the stack to save a heap allocation. As a
    consequence, the assertion `(!i = 1)' will succeed twice, whereas
    it should fail after the second return of `perform Twice'. *)
    let heap2stack () =
    Effect.Deep.match_with
    (fun () ->
    let i = ref 0 in
    Effect.perform Twice;
    i := !i + 1;
    Printf.printf "i = %d\n%!" !i;
    assert (!i = 1))
    () htwice

    (* The following does not trigger an assertion failure. *)
    let _ = heap2stack ()

    (* To fix this issue, we can wrap reference allocations in an instance
    of `Sys.opaque_identity'. However, this is not really a viable fix
    in general, as we may not have access to the client code that
    allocates the reference! *)
    let heap2stack' () =
    Effect.Deep.match_with
    (fun () ->
    let i = Sys.opaque_identity (ref 0) in
    Effect.perform Twice;
    i := !i + 1;
    Printf.printf "i = %d\n%!" !i;
    assert (!i = 1))
    () htwice

    (* The following triggers an assertion failure. *)
    let _ = heap2stack' ()
    -]]>
    - - Technique - OCaml - -
    关于 /about.html @@ -3605,12 +3605,15 @@
  • 邮箱: muqiu-han@outlook.com

  • -

    如果你正处在失真的旷野,那我希望能给你带来空寂中的回响,夏夜中的虫鸣,山谷里的清泉。

    -

    这是世间所有清澈美好的声响汇聚而成的礼物。

    -

    让我们一起钻进祝福的云朵,享受被温暖和柔软包裹的梦境之中。

    -

    盘绕在树上的藤蔓开出了最美丽的花。

    -

    微笑的花朵向着天空,被树木守护,被一缕透过云层的阳光,穿透了大树的树叶,照耀着,

    -

    相拥而眠。

    +
    + +
    + + +

    如果你正在失真的荒野上,渴求那空寂中的一抹回响

    +

    我想给你带来冬日暖阳与暮秋山林所描绘的风的形状

    +

    这是一方小世界中的部分美好所汇聚而成的礼物

    +

    我爱这个因为有我而变得温柔的一方世界,这将是我与周遭一切,热爱一生,共度一生的地方

    ]]>
    -- cgit v1.2.3