]> Repositorios git - scryer-prolog.git/commitdiff
Represent atom [] as empty list
authorbakaq <[email protected]>
Fri, 16 Aug 2024 03:01:25 +0000 (00:01 -0300)
committerbakaq <[email protected]>
Fri, 16 Aug 2024 03:01:25 +0000 (00:01 -0300)
src/machine/parsed_results.rs

index 06a8873b3d07cd1b4e3f707c4171993021358bfe..305e6a4d73e617b0064887d4cede20e8cf8e39b7 100644 (file)
@@ -302,7 +302,12 @@ impl Value {
                     */
 
                     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 {
                         let subterms = term_stack
                             .drain(term_stack.len() - arity ..)