문제

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?

도움이 되었습니까?

해결책

Nested let's don't need nested indentation, so that's good enough.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top