Liking cljdoc? Tell your friends :D

fr33m0nk.optional


=clj

(= _optional)
(= optional another-optional)
(= optional another-optional & more-optionals)

returns a boolean checks equality for Optionals

returns a boolean
checks equality for Optionals
sourceraw docstring

filterclj

(filter predicate optional)
(filter predicate optional logger-fn)
(filter predicate optional logger-fn log-exception-message)

returns empty Optional if predicate evaluates to false or predicate throws Exception or returns Optional with value if predicate evaluates to true Multi arity versions also take a logger If logger is a macro e.g. clojure.tools.logging, create logger-fn using utils/macro->fn and supply that as argument e.g. (def logger-fn (utils/macro->fn clojure.tools.logging/info)) The reason is Clojure functions can't take macros as argument

returns empty Optional if predicate evaluates to false or predicate throws Exception or
returns Optional with value if predicate evaluates to true
Multi arity versions also take a logger
If logger is a macro e.g. clojure.tools.logging, create logger-fn using utils/macro->fn and supply that as argument
e.g. (def logger-fn (utils/macro->fn clojure.tools.logging/info))
The reason is Clojure functions can't take macros as argument
sourceraw docstring

flat-mapclj

(flat-map f optional)
(flat-map f optional logger-fn)
(flat-map f optional logger-fn log-exception-message)

returns empty Optional if f throws Exception or returns Optional with transformed value if f transforms value Un-nests Optionals and returns a single Optional e.g. Optional<Optional<T>> -> Optional<T> This is useful when working with fn that return Optional values Multi arity versions also take a logger If logger is a macro e.g. clojure.tools.logging, create logger-fn using utils/macro->fn and supply that as argument e.g. (def logger-fn (utils/macro->fn clojure.tools.logging/info)) The reason is Clojure functions can't take macros as argument

returns empty Optional if f throws Exception or returns Optional with transformed value if f transforms value
Un-nests Optionals and returns a single Optional e.g. Optional<Optional<T>> -> Optional<T>
This is useful when working with fn that return Optional values
Multi arity versions also take a logger
If logger is a macro e.g. clojure.tools.logging, create logger-fn using utils/macro->fn and supply that as argument
e.g. (def logger-fn (utils/macro->fn clojure.tools.logging/info))
The reason is Clojure functions can't take macros as argument
sourceraw docstring

getclj

(get optional)
(get optional other-value)

return nil for empty Optional returns value contained in Optional Two arity version also takes another value that would be returned if Optional is empty

return nil for empty Optional
returns value contained in Optional
Two arity version also takes another value that would be returned if Optional is empty
sourceraw docstring

has-value?clj

(has-value? optional)

returns a boolean. checks if supplied Optional has any value

returns a boolean.
checks if supplied Optional has any value
sourceraw docstring

mapclj

(map f optional)
(map f optional logger-fn)
(map f optional logger-fn log-exception-message)

returns empty Optional if f throws Exception or returns Optional with transformed value if f was applied successfully Multi arity versions also take a logger If logger is a macro e.g. clojure.tools.logging, create logger-fn using utils/macro->fn and supply that as argument e.g. (def logger-fn (utils/macro->fn clojure.tools.logging/info)) The reason is Clojure functions can't take macros as argument

returns empty Optional if f throws Exception or returns Optional with transformed value if f was applied successfully
Multi arity versions also take a logger
If logger is a macro e.g. clojure.tools.logging, create logger-fn using utils/macro->fn and supply that as argument
e.g. (def logger-fn (utils/macro->fn clojure.tools.logging/info))
The reason is Clojure functions can't take macros as argument
sourceraw docstring

optional->sequenceclj

(optional->sequence optional)

returns Clojure sequence from Optional<T>

returns Clojure sequence from Optional<T>
sourceraw docstring

optional-ofclj

(optional-of)
(optional-of value)

returns an Optional Zero arity version returns an empty Optional Single arity version returns an Optional of value

returns an Optional
Zero arity version returns an empty Optional
Single arity version returns an Optional of value
sourceraw docstring

warp-return-in-optionalclj

(warp-return-in-optional f)
(warp-return-in-optional f logger)
(warp-return-in-optional f logger log-exception-message)

takes a Clojure Fn and returns a Clojure Fn that is wrapped in try catch block returned fn when executed returns Optional of value if application was successful or empty Optional when execution of supplied function throws an Exception Multi arity versions also take a logger If logger is a macro e.g. clojure.tools.logging, create logger-fn using utils/macro->fn and supply that as argument e.g. (def logger-fn (utils/macro->fn clojure.tools.logging/info)) The reason is Clojure functions can't take macros as argument

takes a Clojure Fn and returns a Clojure Fn that is wrapped in try catch block
returned fn when executed returns Optional of value if application was successful
or empty Optional when execution of supplied function throws an Exception
Multi arity versions also take a logger
If logger is a macro e.g. clojure.tools.logging, create logger-fn using utils/macro->fn and supply that as argument
e.g. (def logger-fn (utils/macro->fn clojure.tools.logging/info))
The reason is Clojure functions can't take macros as argument
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close