Blyx Nest Blyx language
Registry / Framework
framework · v0.1.2

Distill Cache

Seal teacher predictions at a pinned teacher revision and invalidate stale targets when it changes.

Source repository · Package JSON

Use Distill Cache

use vendor::distill_cache::distill_cache;

Run the example

nest demo distill_cache@0.1.2
blyxc native-run distill_cache-demo/main.blyx
Example source and expected output
use std::cli;
use std::text;
use vendor::distill_cache::distill_cache;

fn main() {
    let arguments = cli_args();
    if args_len(arguments) > 0 {
        if args_len(arguments) % 2 != 0 {
            stderr_line("Expected event and value pairs");
            process_exit(2);
        }
        let mut live = distill_cache_start();
        let mut i = 0;
        while i < args_len(arguments) {
            let input = args_at(arguments, i + 1);
            if !text_is_number(input) {
                stderr_line("Expected a whole numeric event value");
                process_exit(2);
            }
            live = distill_cache_step(live, args_at(arguments, i), text_number(input));
            let command = distill_cache_command(live);
            println!(command);
            if command == "reject" { process_exit(1); }
            i += 2;
        }
        return;
    }
    let mut state = distill_cache_start();
    state = distill_cache_step(state, "teacher", 5.0);
    println!(distill_cache_command(state));
    state = distill_cache_step(state, "cached", 5.0);
    println!(distill_cache_command(state));
    state = distill_cache_step(state, "teacher", 6.0);
    println!(distill_cache_command(state));
    state = distill_cache_step(state, "cached", 6.0);
    println!(distill_cache_command(state));
    state = distill_cache_step(state, "student", 6.0);
    println!(distill_cache_command(state));
    state = distill_cache_step(state, "finish", 6.0);
    println!(distill_cache_command(state));
}

Expected output

generate_targets
freeze_targets
invalidate_targets
freeze_targets
fit_student
save_student

Published versions

VersionPackageSource commitSHA-256
0.1.2Download ZIP · Browse filesa2593da86652f49d71f7050c66a50248b9130dccac2006f797f7063e21fcea853110cbdebb
0.1.1Download ZIP · Browse files5c8d3eba114468f2e095cdd9857416d6dd80c9362426d88fae7f6163478a7d9b6d31c4f818
0.1.0Download ZIP · Browse files6349f23784254641378df9950d11927790941a9122ce3a8a06d42152a0ddcc77baa5f8b060