pub fn core_push(&mut self, chunk: &Chunk, i: usize) -> i32 {
        if self.stack.len() < 2 {
            print_error(chunk, i, "push requires two arguments");
            return 0;
        }

        let element_rr = self.stack.pop().unwrap();
        let lst_rr = self.stack.pop().unwrap();

        {
            let mut lst_rrb = lst_rr.borrow_mut();
            match *lst_rrb {
                Value::List(ref mut lst) => {
                    lst.push_back(element_rr);
                }
                _ => {
                    print_error(chunk, i, "first push argument must be list");
                    return 0;
                }
            }
        }

        self.stack.push(lst_rr);
        return 1;
    }
/// Takes a list and a value as its arguments.  Pushes the value
/// onto the list and places the updated list onto the stack.
Takes a list and a value as its arguments.  Pushes the value
onto the list and places the updated list onto the stack.
Takes a list and a value as its arguments . Pushes the value onto the list and places the updated list onto the stack .
pub fn core_push(&mut self, chunk: &Chunk, i: usize) -> i32 {
        if self.stack.len() < 2 {
            print_error(chunk, i, "push requires two arguments");
            return 0;
        }
        let element_rr = self.stack.pop().unwrap();
        let lst_rr = self.stack.pop().unwrap();
        {
            let mut lst_rrb = lst_rr.borrow_mut();
            match *lst_rrb {
                Value::List(ref mut lst) => {
                    lst.push_back(element_rr);
                }
                _ => {
                    print_error(chunk, i, "first push argument must be list");
                    return 0;
                }
            }
        }
        self.stack.push(lst_rr);
        return 1;
    }
pub fn core_push ( & mut self , chunk : & Chunk , i : usize ) -> i32 { if self . stack . len ( ) < 2 { print_error ( chunk , i , " " ) ; return 0 ; } let element_rr = self . stack . pop ( ) . unwrap ( ) ; let lst_rr = self . stack . pop ( ) . unwrap ( ) ; { let mut lst_rrb = lst_rr . borrow_mut ( ) ; match * lst_rrb { Value :: List ( ref mut lst ) => { lst . push_back ( element_rr ) ; } _ => { print_error ( chunk , i , " " ) ; return 0 ; } } } self . stack . push ( lst_rr ) ; return 1 ; }
Takes a list and a value as its arguments.
Takes a list and a value as its arguments .
&mut self
chunk
&Chunk
i
usize