Why is functional Currying right associative in rust?
⚓ Rust 📅 2025-05-22 👤 surdeus 👁️ 11As you can see, the right expression is returned and used as the input for the left closure. This process is called querying. Why is it right-associative in Rust?
fn calculate_translation(border: f32, current_number: f32) -> f32 {
(|half_border| {
current_number
+ rand::rng().random_range(match current_number {
n if n >= half_border => -40.0..0.0,
n if n <= -half_border => 0.0..40.0,
_ => -40.0..40.0,
})
})(border / 2.0)
}
10 posts - 8 participants
🏷️ rust_feed