Core namespace of the YAROP library.
Core namespace of the YAROP library.
(=> value & functions)
Railway thread first macro.
Creates a success result from value
and applies to each
function conditionally, as long as the result is successful.
Railway thread first macro. Creates a success result from `value` and applies to each function conditionally, as long as the result is successful.
(apply-if-success f [value err])
Given a function f
(which returns result) and a result with
value
and err
, applies the function to value
if there is
no error. Otherwise, passes the input result forward.
Given a function `f` (which returns result) and a result with `value` and `err`, applies the function to `value` if there is no error. Otherwise, passes the input result forward.
(error->result e)
Returns a result with the given error e
.
The value of the created result is set to nil
.
Returns a result with the given error `e`. The value of the created result is set to `nil`.
(failure? res)
Checks to see if the result represents a failure?
A result is considered failure if the error is
not nil
, regardless of the value.
Checks to see if the result represents a failure? A result is considered failure if the error is not `nil`, regardless of the value.
(result v e)
Constructs a result with the given value v
and error e
.
Constructs a result with the given value `v` and error `e`.
(success? res)
Checks to see if the result represents a success?
A result is considered successful if the error is
nil
, regardless of the value.
Checks to see if the result represents a success? A result is considered successful if the error is `nil`, regardless of the value.
(value->result v)
Returns a successful result with the given value v
.
Returns a successful result with the given value `v`.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close