and_then | R Documentation |
Evaluate a maybe returning function on a maybe value
and_then(.m, .f, ...)
bind(.m, .f, ...)
.m |
A maybe value |
.f |
A maybe returning function to apply to the maybe value |
... |
Named arguments for the function |
A maybe value
safe_sqrt <- maybe(sqrt, ensure = not_infinite)
just(9) %>% and_then(safe_sqrt)
just(-1) %>% and_then(safe_sqrt)
nothing() %>% and_then(safe_sqrt)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.