[BREAKING] Feat: quotation is now using ()

This commit is contained in:
2026-02-28 20:25:59 +01:00
parent ec98274dfe
commit 651ed1219d
24 changed files with 182 additions and 169 deletions

View File

@@ -38,14 +38,14 @@ fn coin_binary() {
#[test]
fn chance_zero() {
// 0.0 probability should never execute the quotation
let f = run("99 { 42 } 0.0 chance");
let f = run("99 ( 42 ) 0.0 chance");
assert_eq!(stack_int(&f), 99); // quotation not executed, 99 still on stack
}
#[test]
fn chance_one() {
// 1.0 probability should always execute the quotation
let f = run("{ 42 } 1.0 chance");
let f = run("( 42 ) 1.0 chance");
assert_eq!(stack_int(&f), 42);
}
@@ -281,7 +281,7 @@ fn wchoose_negative_weight() {
#[test]
fn wchoose_quotation() {
let f = forth_seeded(42);
f.evaluate("{ 10 } 0.0 { 20 } 1.0 2 wchoose", &default_ctx())
f.evaluate("( 10 ) 0.0 ( 20 ) 1.0 2 wchoose", &default_ctx())
.unwrap();
assert_eq!(stack_int(&f), 20);
}