Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
8
Task/Function-composition/Ruby/function-composition.rb
Normal file
8
Task/Function-composition/Ruby/function-composition.rb
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
def compose(f,g)
|
||||
lambda {|x| f[g[x]]}
|
||||
end
|
||||
s = compose(Math.method(:sin), Math.method(:cos))
|
||||
p s[0.5] # => 0.769196354841008
|
||||
|
||||
# verify
|
||||
p Math.sin(Math.cos(0.5)) # => 0.769196354841008
|
||||
Loading…
Add table
Add a link
Reference in a new issue