[CLJ-1012] partial function should also accept 1 arg (just f) Created: 12/Jun/12 Updated: 18/Aug/12 Resolved: 18/Aug/12 |
|
| Status: | Closed |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4, Release 1.5 |
| Fix Version/s: | Release 1.5 |
| Type: | Defect | Priority: | Minor |
| Reporter: | Joel Martin | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Approval: | Ok |
| Description |
|
The partial function should accept just a function. This allows it to be properly used with apply. E.g. This breaks (but shouldn't) if args are nil: (apply partial f args) |
| Comments |
| Comment by Michel Alexandre Salim [ 13/Jun/12 5:18 AM ] |
|
Attached patch makes partial just returns f if called with only one argument. Not sure if this will have a performance impact or not; a Clojure/core member would probably be able to better judge if the use cases outweigh any performance hit. |
| Comment by Fogus [ 15/Aug/12 10:45 AM ] |
|
Attached a patch adding a test for this ticket. |
| Comment by Fogus [ 15/Aug/12 10:47 AM ] |
|
Original patch is trivial, but did not have a test. I added a test as a separate patch file. |