pub fn heap_bound_deref(heap: &[HeapCellValue], mut value: HeapCellValue) -> HeapCellValue {
    loop {
        let new_value = read_heap_cell!(value,
            (HeapCellValueTag::AttrVar | HeapCellValueTag::Var, h) => {
                heap[h]
            }
            _ => {
                value
            }
        );

        if new_value != value && new_value.is_var() {
            value = new_value;
            continue;
        }

        return value;
    }
}
// sometimes we need to dereference variables that are found only in
// the heap without access to the full WAM (e.g., while detecting
// cycles in terms), and which therefore may only point other cells in
// the heap (thanks to the design of the WAM).
sometimes we need to dereference variables that are found only in
the heap without access to the full WAM , and which therefore may only point other cells in
the heap (thanks to the design of the WAM).
sometimes we need to dereference variables that are found only in the heap without access to the full WAM and which therefore may only point other cells in the heap ( thanks to the design of the WAM ) .
pub fn heap_bound_deref(heap: &[HeapCellValue], mut value: HeapCellValue) -> HeapCellValue {
    loop {
        let new_value = read_heap_cell!(value,
            (HeapCellValueTag::AttrVar | HeapCellValueTag::Var, h) => {
                heap[h]
            }
            _ => {
                value
            }
        );
        if new_value != value && new_value.is_var() {
            value = new_value;
            continue;
        }
        return value;
    }
}
pub fn heap_bound_deref ( heap : & [ HeapCellValue ] , mut value : HeapCellValue ) -> HeapCellValue { loop { let new_value = read_heap_cell ! ( value ( HeapCellValueTag AttrVar HeapCellValueTag Var h ) { heap [ h ] } { value } ) ; if new_value != value && new_value . is_var ( ) { value = new_value ; continue ; } return value ; } }
sometimes we need to dereference variables that are found only in
the heap without access to the full WAM (e.g., while detecting
cycles in terms), and which therefore may only point other cells in
the heap (thanks to the design of the WAM).
sometimes we need to dereference variables that are found only in the heap without access to the full WAM ( e . g . while detecting cycles in terms ) and which therefore may only point other cells in the heap ( thanks to the design of the WAM ) .
heap
&[HeapCellValue]
value
HeapCellValue
heap
&[HeapCellValue]
value
HeapCellValue