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.
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.
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.

People

Vote (1)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: