Examples · learn/25-js-interop · 279 of 339
task-2.solution
run: --yes
tin run examples/learn/25-js-interop/task-2.solution.tin// run: --yes
import js "./shapes.mjs"
extern fn hypot(a: float, b: float): float
/// The length of a vector. Runs JavaScript, so a person approves each call.
guarded tool fn length(x: float, y: float): float => hypot(x, y)
agent Geometer { model: "mock", tools: [length] }
fn main() {
print(Geometer("length 3 4"))
}