我正在努力理解mathematica中以下积分的输出:
Root [c#1 ^ 4 + a#1 + b&1]
这到底是什么意思?我已经查看了#和&的文档,但将所有内容放在一起以了解上述表达式有点令人困惑。
谢谢!
答案 0 :(得分:0)
#和&的东西是将值注入函数调用的一种方式,这就是我倾向于阅读它的方式。
例如
struct Player { name: String, age: u8, description: String }
impl Player {
fn namefn(&self) -> &String {
&self.name
}
}
fn immutable_borrow_nok(borrowed: &reqwest::blocking::Response) -> Result<()> {
// println!("I am some json, I don't work {:#?}", borrowed.text()); <-- if I get uncommented I won't compile
Ok(())
}
fn immutable_borrow(borrowed: &Player) -> Result<()> {
println!("I am {}, I've been immutably borrowed", borrowed.namefn());
Ok(())
}
fn main() -> Result<()>{
let our_player = Player { name: "Jones".to_string(), age: 25, description: "Just a happy guy.".to_string() };
immutable_borrow(&our_player);
println!("My name is {}, and I am being used after an immutable borrow", our_player.namefn());
let res = reqwest::blocking::Client::new().post("http://httpbin.org/anything").send()?.error_for_status()?;
immutable_borrow_nok(&res);
println!("I am also some json but I *do* work... {:#?}", res.text());
Ok(())
}
会将右边列表中的值注入到左边的Print []调用中。
从形式上看,Slot []函数的定义确实有用。