diff --git a/README.md b/README.md index 51a0878..b960aed 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ R.add(date(1,2,3), date(1,2,3)) # float('nan) - [x] 0.3.0 ap - [ ] aperture - [x] 0.1.2 append -- [ ] apply +- [x] apply - [ ] applySpec - [ ] applyTo - [ ] ascend diff --git a/ramda/__init__.py b/ramda/__init__.py index aeb2460..8f5bb5e 100644 --- a/ramda/__init__.py +++ b/ramda/__init__.py @@ -7,6 +7,7 @@ from .any import any from .ap import ap from .append import append +from .apply import apply from .binary import binary from .chain import chain from .clone import clone diff --git a/ramda/apply.py b/ramda/apply.py new file mode 100644 index 0000000..b1f8cbc --- /dev/null +++ b/ramda/apply.py @@ -0,0 +1,3 @@ +from .private._curry2 import _curry2 + +apply = _curry2(lambda fn, args: fn(*args)) diff --git a/test/test_apply.py b/test/test_apply.py new file mode 100644 index 0000000..2b5aecc --- /dev/null +++ b/test/test_apply.py @@ -0,0 +1,16 @@ + +import unittest + +import ramda as R + +""" +https://github.com/ramda/ramda/blob/master/test/apply.js +""" + + +class TestApply(unittest.TestCase): + def test_applies_function_to_argument_list(self): + self.assertEqual(42, R.apply(max, [1, 2, 3, -99, 42, 6, 7])) + +if __name__ == '__main__': + unittest.main()