Utility Functions and Types¶
Helper Classes¶
-
class
hymn.utils.
CachedSequence
(iterable)¶ Bases:
object
sequence wrapper that is lazy while keeps the items
Helper Functions¶
-
hymn.utils.
compose
(*fs)¶ function composition
-
<|
alias of
compose()
Note
.
cannot be used as hy and python already using it, <|
was chosen because we use |>
as alias of pipe()
function
-
hymn.utils.
const
(value)¶ constant function
-
hymn.utils.
suppress
(*exceptions)[source]¶ Context manager to suppress specified exceptions
After the exception is suppressed, execution proceeds with the next statement following the with statement.
- with suppress(FileNotFoundError):
- os.remove(somefile)
# Execution still resumes here if the file was already removed
-
hymn.utils.
pipe
(*fs)¶ reversed function composition
-
|>
alias of
pipe()
Note
|>
is different from the same function in OCaml and F#, which is
more like the threading macro ->>
in hy