Skip to content

Explore potential applications for a macro that maps variables to a gradient #79

Open
@FL03

Description

@FL03

It may be possible to generate a macro that represents the gradient;

extern crate acme;

use acme::operator;

fn main() {
    let dx = mul_gradient!(x: 10f64);

    let (x, y) = (3f64, 4f64);
    let dx = mul_gradient!(x);
    let dy = mul_gradient!(y);

    assert_eq!(dx, y);
    assert_eq!(dy, x);
}

#[operator]
pub fn mul<A, B, C>(x: A, y: B) -> C where A: core::ops::Mul<B, Output = C> {
    x * y
}

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestmacroAny additions or improvements to procedural macrosrustImprovements or additions that update the Rust code

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions