Represent atom [] as empty list

This commit is contained in:
bakaq
2024-08-16 00:01:25 -03:00
parent 12aaae5fc0
commit 7afc08af47

View File

@@ -302,7 +302,12 @@ impl Value {
*/ */
if arity == 0 { if arity == 0 {
term_stack.push(Value::Atom(name.as_str().to_string())); let atom_name = name.as_str().to_string();
if atom_name == "[]" {
term_stack.push(Value::List(vec![]));
} else {
term_stack.push(Value::Atom(atom_name));
}
} else { } else {
let subterms = term_stack let subterms = term_stack
.drain(term_stack.len() - arity ..) .drain(term_stack.len() - arity ..)