pub fn root_scope() -> ScopeExpand description
Builds a fresh scope in which every built-in name is available.
The built-ins live in a parent scope, and the returned scope is an empty
child of it, so user code can shadow a built-in name without changing it.
The global names created by the bind and label built-ins go into the
returned scope.
Every evaluation session should start from a scope created here (or from a child of one).
ยงExamples
use swan_core::builtins::root_scope;
use swan_core::evaluator::eval;
use swan_core::lexer::Lexer;
use swan_core::parser::Parser;
let scope = root_scope();
let mut parser = Parser::new(Lexer::new("1+2"));
let ast = parser.parse();
assert_eq!(eval(&ast, &scope), swan_core::value::Value::Numb(3.0));