Clojure

partial function should also accept 1 arg (just f)

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: Release 1.4, Release 1.5
  • Fix Version/s: Release 1.5
  • Component/s: None
  • Labels:
    None
  • 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)

Activity

Hide
Michel Alexandre Salim added a comment -

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.

Show
Michel Alexandre Salim added a comment - 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.
Michel Alexandre Salim made changes -
Field Original Value New Value
Attachment 0001-Extend-partial-function-to-also-handle-one-argument-.patch [ 11315 ]
Michel Alexandre Salim made changes -
Patch Code [ 10001 ]
Rich Hickey made changes -
Approval Vetted [ 10003 ]
Fix Version/s Release 1.5 [ 10150 ]
Fogus made changes -
Assignee Fogus [ fogus ]
Hide
Fogus added a comment -

Attached a patch adding a test for this ticket.

Show
Fogus added a comment - Attached a patch adding a test for this ticket.
Fogus made changes -
Attachment CLJ-1012-partial-1-arity-test.diff [ 11433 ]
Hide
Fogus added a comment -

Original patch is trivial, but did not have a test. I added a test as a separate patch file.

Show
Fogus added a comment - Original patch is trivial, but did not have a test. I added a test as a separate patch file.
Fogus made changes -
Patch Code [ 10001 ] Code and Test [ 10002 ]
Approval Vetted [ 10003 ] Screened [ 10004 ]
Assignee Fogus [ fogus ]
Rich Hickey made changes -
Approval Screened [ 10004 ] Ok [ 10007 ]
Stuart Halloway made changes -
Resolution Completed [ 1 ]
Status Open [ 1 ] Closed [ 6 ]

People

Vote (1)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: