Charles-Johnson / zia_programming

A language that can program itself
https://zia-lang.org
GNU General Public License v3.0
3 stars 0 forks source link

Determine truth of reduction expressions and defer Context mutation #6

Closed Charles-Johnson closed 5 years ago

Charles-Johnson commented 5 years ago

New features:

// Determine the truth of a reduction
assert_eq!(context.execute("a (-> d)"), "true");
assert_eq!(context.execute("d (-> a)"), "false");

// A concept never reduces to itself
assert_eq!(context.execute("a (-> a)"), "false");

// Cannot reduce a reduction expression between unrelated concepts
assert_eq!(context.execute("d (-> f)"), "d (-> f)");
// Can ask whether a reduction is true or false
assert_eq!(context.execute("(a (-> d)) (-> true)"), "true");
assert_eq!(context.execute("(d (-> a)) (-> false)"), "true");

Internal changes: