Ocaml 相当于 Lisp 的 let*?
如果可能的话,我宁愿使用 let ... and ... and ... in
而不是嵌套的 let
,但正常的 let 语法不允许这样做对于相互依赖的表达式。
不允许:
let encrypt password =
let seed = int 16
and keys = xlat seed (length password)
and plaintext = map code (explode password) in
map2 logxor plaintext keys
OCaml 是否有相当于 Lisp 的 let*
的功能,它允许这样做?
I'd rather use let ... and ... and ... in
than nested let
's when possible, but the normal let syntax doesn't allow this for expressions that depend on each other.
Not allowed:
let encrypt password =
let seed = int 16
and keys = xlat seed (length password)
and plaintext = map code (explode password) in
map2 logxor plaintext keys
Does OCaml have an equivalent to Lisp's let*
, which does allow this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
嵌套的
let
不需要嵌套缩进,所以这就足够了。Nested
let
's don't need nested indentation, so that's good enough.