1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use crate::rail_machine::{self, RailDef, RailType};

use RailType::*;

pub fn builtins() -> Vec<RailDef<'static>> {
    vec![
        RailDef::on_state("stab", "FIXME", &[], &[Stab], |quote| {
            quote.push_stab(rail_machine::new_stab())
        }),
        RailDef::on_state("insert", "FIXME", &[Stab, Quote], &[Stab], |quote| {
            let (k, v, quote) = quote.pop_stab_entry("insert");
            let (mut st, quote) = quote.pop_stab("insert");
            st.insert(k, v);
            quote.push_stab(st)
        }),
        RailDef::on_state("extract", "FIXME", &[Stab, String], &[A], |quote| {
            let (k, quote) = quote.pop_string("insert");
            let (st, quote) = quote.pop_stab("insert");
            let result = st.get(&k).unwrap().to_owned();
            quote.push(result)
        }),
    ]
}