Created
September 7, 2022 07:13
-
-
Save baweaver/8c82642be77f99c943ea474751f64e05 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IDENTITY = -> v { v } | |
def proc_line(**fns) | |
fns.reduce(IDENTITY) { |fn, (m, args)| | |
fn >> m.to_proc.then { |m_proc| -> v { m_proc.call(v, *args) } } | |
} | |
end | |
[50, 100, 300, 5000].map(&proc_line( | |
to_s: 2, chars: nil, reverse: nil, join: nil, to_i: 2 | |
)) | |
# => [19, 19, 105, 569] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment