Skip to content

Syntactic sugar for partials #6

@leMaik

Description

@leMaik

It would be cool if there was some more syntactic sugar for partial function definitions.

  • (fn _ 42) should be equivalent to (partial fn (math/const 42) 1)
  • (fn 42) (where fn is known to be a function with more than one parameter) should be equivalent to (partial fn (math/const 42) 0)
  • The above should also work with non-lambda functions, i.e. (math/add 1) should be equivalent to (defco bindAdd [param] (partial (fn [x y] (+ x y)) param 0)) (bindAdd 1). Note that the optimizer will be able to remove these cases, so there would be no performance penality at all.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions