Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
FL03 opened this issue Apr 22, 2024 · 0 comments
Open
Assignees
Labels
enhancement New feature or request macro Any additions or improvements to procedural macros rust Improvements or additions that update the Rust code
Milestone

Comments

@FL03
Copy link
Owner

FL03 commented Apr 22, 2024

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
}
@FL03 FL03 self-assigned this Apr 22, 2024
@FL03 FL03 added enhancement New feature or request rust Improvements or additions that update the Rust code macro Any additions or improvements to procedural macros labels Apr 22, 2024
@FL03 FL03 added this to the Future milestone Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request macro Any additions or improvements to procedural macros rust Improvements or additions that update the Rust code
Projects
None yet
Development

No branches or pull requests

1 participant