小编joh*_*aci的帖子

ocaml中的持续传递风格

我对这个概念有点困惑.所以我有以下功能

    let rec sumlist lst =
          match lst with
             | [] -> 0
             | (h::t) -> h + (sumlist t)
Run Code Online (Sandbox Code Playgroud)

继续,它可以写成

let rec cont_sumlist lst c =
match lst with
| [] -> (c 0)
| (h::t) -> cont_sumlist t (fun x -> c (h + x))
Run Code Online (Sandbox Code Playgroud)

我仍然对c手段及其作用感到困惑

ocaml continuation-passing

2
推荐指数
2
解决办法
502
查看次数

如何比较Ocaml中的字符串

我该如何比较字符串?例如"a"和"b",因为"a"出现在"b"之前,那么我会放入这样的元组("a","b").对于"c"和"b",它就像这样("b","c")

string ocaml

1
推荐指数
1
解决办法
6588
查看次数

标签 统计

ocaml ×2

continuation-passing ×1

string ×1