use polydat::dsl::{CompileOptions, compile_polydat_kernel_with_options};
fn main() {
let stdlib = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join("..")
.join("polydat-core")
.join("stdlib");
let mut kernel = compile_polydat_kernel_with_options(
r#"
input cycle: u64
// Calls `hashed_id` from identity.polydat, a library
// module rather than a built-in node.
uid := hashed_id(cycle, 1000000)
"#,
&CompileOptions {
lib_paths: vec![stdlib.clone()], context: "library_and_loader example".into(),
..CompileOptions::default() },
None,
)
.expect("compile failed");
println!("library loaded from: {}", stdlib.display());
for c in 0..5u64 {
kernel.set_inputs(&[c]);
let uid = kernel.pull("uid").as_u64();
println!(" cycle={c} → uid={uid}");
assert!(uid < 1_000_000);
}
}