| 36:6dfa8001eed2 | 37:f8be66557e0f |
|---|---|
| 15 ############## | 15 ############## |
| 16 # Our exports | 16 # Our exports |
| 17 ############## | 17 ############## |
| 18 | 18 |
| 19 export curry, | 19 export curry, |
| 20 curryflip | 20 curryflip, |
| 21 maybe | |
| 21 | 22 |
| 22 ########### | 23 ########### |
| 23 # Currying | 24 # Currying |
| 24 ########### | 25 ########### |
| 25 | 26 |
| 55 | 56 |
| 56 function curryflip(f::Function, y...; kwargs...) | 57 function curryflip(f::Function, y...; kwargs...) |
| 57 return x ->f(x, y...; kwargs...) | 58 return x ->f(x, y...; kwargs...) |
| 58 end | 59 end |
| 59 | 60 |
| 61 """ | |
| 62 `maybe(f, x)` | |
| 63 | |
| 64 Returns `nothing` if `x` is `nothing, otherwise `f(x)`. | |
| 65 """ | |
| 66 maybe( :: Function, :: Nothing) = nothing | |
| 67 maybe(f :: Function, x :: T) where T = f(x) | |
| 68 | |
| 60 end # module | 69 end # module |