Title
- list
- with
- nested
- items
| open Core.Std | |
| let solveCaptcha digits = | |
| let rec loop ls sum = match ls with | |
| | hd::[] when (List.hd_exn digits) = hd -> sum + hd | |
| | hd::sd::tl when hd = sd -> loop (sd::tl) (sum + hd) | |
| | hd::tl -> loop tl sum | |
| | _ -> sum | |
| in | |
| loop digits 0 |
https://flowtype.org/try is broken since the flow team pushed v0.36.0 three hours ago. 😕 I filed an issue here: facebook/flow#3003 To run any of the below examples, alter the version dropdown in to top right to v0.36.0
Flow can actually infer the parameter and return types of the function: https://flowtype.org/try/#0GYVwdgxgLglg9mABBO4oBM4HcwBU4DCAFgE4wDOUAtgIbkAU6NUApgJSIDeAUIsgpURMAnuQAyLYFEQBeRACYALIgC0Q5i269EMYIkY1REqYgB8iAAwcefPiRZQQJJAAMAJJxHjJUAL7rRRFgAG2DEYjJKWnIAQhdtX25E7hQwQSZWWUQwFixEABENejYAOgBzB0LWYpTUMAxsPEJSCmo6A1ZSqDgAVQAHPpYSAjoWYqA
| // @flow | |
| type Iteratee<T> = Array<string> | {[key: string]: T} | string | |
| // Try and fix this | |
| type Iteratee$Weak<T> = Array<string> | {[key: string]: T} | string | Function | |
| type Collection<T> = Array<T> | {[key: string]: T} | |
| declare module 'lodash' { | |
| declare var VERSION: string |
| // @flow | |
| type Iteratee<T> = Array<string> | {[key: string]: T} | string | |
| // Try and fix this | |
| type Iteratee$Weak<T> = Array<string> | {[key: string]: T} | string | Function | |
| type Collection<T> = Array<T> | {[key: string]: T} | |
| declare module 'lodash' { | |
| /** |