A library providing common functional combinators, currying, partial application, and composition utilities for Elixir.
Quark is an Elixir library that provides common functional programming constructs, such as currying, partial application, and classic combinators, to fill gaps in Elixir's standard library. It enables developers to write more expressive, reusable, and concise functional code by offering a suite of utilities for deeper functional composition. The library emphasizes practicality and expressiveness while aligning with Elixir's strengths in concurrency and fault-tolerance.
Elixir developers seeking to leverage advanced functional programming patterns, such as currying, point-free style, and combinator logic, in their codebases. It is particularly useful for those building libraries or applications where functional composition and code reuse are priorities.
Developers choose Quark over alternatives because it offers a comprehensive, integrated set of functional programming tools specifically tailored for Elixir, including macros for currying and partial application, composition operators, and classic combinators like SKI and BCKW systems. Its focus on practicality and expressiveness allows for more concise and reusable code without sacrificing Elixir's native concurrency features.
Common combinators for Elixir
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Provides `defcurry` and `defcurryp` macros for creating fully-curried functions with minimal boilerplate, as demonstrated in the Quick Start examples with functions like `div`.
The `defpartial` macro generates all possible arities for a function, supporting bare, partially applied, and curried forms, which enhances code reusability in functional pipelines.
Includes SKI, BCKW, and fixed-point combinators like `y` and `fix`, with friendly aliases such as `const` and `id`, enabling expressive algorithm design without custom implementations.
Offers `defx` for defining functions through composition without explicit arguments, improving code readability and composability in functional workflows.
As noted in the README, using `defpartial` consumes the full arity-space for a function name, restricting flexibility in function overloading and naming within modules.
The SKI system combinators, while theoretically complete, are admitted to be inefficient for practical algorithms, potentially leading to performance bottlenecks in real-world use.
Requires deep familiarity with advanced functional programming concepts like fixed-point combinators and pointfree style, making it inaccessible for developers not versed in these areas.