pub fn core_at_em(&mut self, chunk: &Chunk, i: usize) -> i32 {
        if self.stack.len() < 3 {
            print_error(chunk, i, "at! requires three arguments");
            return 0;
        }

        let val_rr = self.stack.pop().unwrap();

        let key_str_rr = self.stack.pop().unwrap();
        let key_str_rrb = key_str_rr.borrow();
        let key_str_pre = key_str_rrb.to_string();
        let key_str_opt = to_string_2(&key_str_pre);

        let hash_rr = self.stack.pop().unwrap();

        {
            let mut hash_rrb = hash_rr.borrow_mut();
            match (&mut *hash_rrb, key_str_opt) {
                (Value::Hash(map), Some(s)) => {
                    map.insert(s.to_string(), val_rr);
                }
                (_, Some(_)) => {
                    print_error(chunk, i, "first at! argument must be hash");
                    return 0;
                }
                _ => {
                    print_error(
                        chunk,
                        i,
                        "second at! argument must be key string",
                    );
                    return 0;
                }
            }
        }
        self.stack.push(hash_rr);
        return 1;
    }
/// Takes a hash value, a key string, and a value as its
/// arguments.  Puts the value into the hash against the specified
/// key, and puts the updated hash back onto the stack.
Takes a hash value, a key string, and a value as its
arguments.  Puts the value into the hash against the specified
key, and puts the updated hash back onto the stack.
Takes a hash value a key string and a value as its arguments . Puts the value into the hash against the specified key and puts the updated hash back onto the stack .
pub fn core_at_em(&mut self, chunk: &Chunk, i: usize) -> i32 {
        if self.stack.len() < 3 {
            print_error(chunk, i, "at! requires three arguments");
            return 0;
        }
        let val_rr = self.stack.pop().unwrap();
        let key_str_rr = self.stack.pop().unwrap();
        let key_str_rrb = key_str_rr.borrow();
        let key_str_pre = key_str_rrb.to_string();
        let key_str_opt = to_string_2(&key_str_pre);
        let hash_rr = self.stack.pop().unwrap();
        {
            let mut hash_rrb = hash_rr.borrow_mut();
            match (&mut *hash_rrb, key_str_opt) {
                (Value::Hash(map), Some(s)) => {
                    map.insert(s.to_string(), val_rr);
                }
                (_, Some(_)) => {
                    print_error(chunk, i, "first at! argument must be hash");
                    return 0;
                }
                _ => {
                    print_error(
                        chunk,
                        i,
                        "second at! argument must be key string",
                    );
                    return 0;
                }
            }
        }
        self.stack.push(hash_rr);
        return 1;
    }
pub fn core_at_em ( & mut self , chunk : & Chunk , i : usize ) -> i32 { if self . stack . len ( ) < 3 { print_error ( chunk , i , " " ) ; return 0 ; } let val_rr = self . stack . pop ( ) . unwrap ( ) ; let key_str_rr = self . stack . pop ( ) . unwrap ( ) ; let key_str_rrb = key_str_rr . borrow ( ) ; let key_str_pre = key_str_rrb . to_string ( ) ; let key_str_opt = to_string_2 ( & key_str_pre ) ; let hash_rr = self . stack . pop ( ) . unwrap ( ) ; { let mut hash_rrb = hash_rr . borrow_mut ( ) ; match ( & mut * hash_rrb , key_str_opt ) { ( Value :: Hash ( map ) , Some ( s ) ) => { map . insert ( s . to_string ( ) , val_rr ) ; } ( _ , Some ( _ ) ) => { print_error ( chunk , i , " " ) ; return 0 ; } _ => { print_error ( chunk , i , " " , ) ; return 0 ; } } } self . stack . push ( hash_rr ) ; return 1 ; }
Takes a hash value, a key string, and a value as its
arguments.
Takes a hash value a key string and a value as its arguments .
&mut self
chunk
&Chunk
i
usize