Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Six years of professional Clojure development. Parent comment
The following is fine therein and statically type checks:
(let ([x (if (condition) "string" (list "a list"))]) (if (string? x) (string-length? x) (length? x)))
There are no comments on this comment yet.
The following is fine therein and statically type checks:
By process of elimination, because the type of the variable is `(U string? (List-of string?))`, the type checker can prove that if `(string? x)~ be false, the type of `x` must be `list?`, and that `(length x)` succeeds.