Example #1
0
def vector_cas_bang_cont(vec, pos_idx, old_val, new_val, env, cont, _vals):
    from pycket.interpreter import check_one_val, return_value
    current_vec_val = check_one_val(_vals)
    if equal.eqp_logic(current_vec_val, old_val):  #eq?
        return vec.vector_set(pos_idx, new_val, env,
                              vector_cas_success(env, cont))
    return return_value(values.w_false, env, cont)
Example #2
0
 def find_cm(self, k, not_found=None):
     from pycket.prims.equal import eqp_logic
     l = self.marks
     while l is not None:
         if eqp_logic(l.key, k):
             return l.val
         l = l.next
     return not_found
Example #3
0
File: cont.py Project: 8l/pycket
 def find_cm(self, k):
     from pycket.prims.equal import eqp_logic
     l = self.marks
     while l is not None:
         if eqp_logic(l.key, k):
             return l.val
         l = l.next
     return None
Example #4
0
 def find_cm(self, k, not_found=None):
     from pycket.prims.equal import eqp_logic
     l = self.marks
     while isinstance(l, Link):
         if eqp_logic(l.key, k):
             return l.val, None
         l = l.next
     marks = l.cont if isinstance(l, ForwardLink) else None
     return not_found, marks
Example #5
0
 def find_cm(self, k, not_found=None):
     from pycket.prims.equal import eqp_logic
     l = self.marks
     while isinstance(l, Link):
         if eqp_logic(l.key, k):
             return l.val, None
         l = l.next
     marks = l.cont if isinstance(l, ForwardLink) else None
     return not_found, marks
Example #6
0
 def update_cm(self, k, v):
     from pycket.prims.equal import eqp_logic
     l = self.marks
     while isinstance(l, Link):
         if eqp_logic(l.key, k):
             l.val = v
             return
         l = l.next
     self.marks = Link(k, v, self.marks)
Example #7
0
 def update_cm(self, k, v):
     from pycket.prims.equal import eqp_logic
     l = self.marks
     while isinstance(l, Link):
         if eqp_logic(l.key, k):
             l.val = v
             return
         l = l.next
     self.marks = Link(k, v, self.marks)
Example #8
0
def assq(a, b):
    while isinstance(b, values.W_Cons):
        head, b = b.car(), b.cdr()
        if not isinstance(head, values.W_Cons):
            raise SchemeException("assq: found a non-pair element")
        if eq_prims.eqp_logic(a, head.car()):
            return head
    if b is not values.w_null:
        raise SchemeException("assq: reached a non-pair")
    return values.w_false
Example #9
0
def assq(a, b):
    while isinstance(b, values.W_Cons):
        head, b = b.car(), b.cdr()
        if not isinstance(head, values.W_Cons):
            raise SchemeException("assq: found a non-pair element")
        if eq_prims.eqp_logic(a, head.car()):
            return head
    if b is not values.w_null:
        raise SchemeException("assq: reached a non-pair")
    return values.w_false
Example #10
0
 def _set(self, w_vector, i, w_val):
     if not we_are_translated():
         from pycket.prims.equal import eqp_logic
         self.indexcheck(w_vector, i)
         assert eqp_logic(w_val, self._storage(w_vector)[0])
Example #11
0
 def is_correct_type(self, w_vector, w_obj):
     from pycket.prims.equal import eqp_logic
     val = self._storage(w_vector)[0]
     return eqp_logic(val, w_obj)
Example #12
0
def vector_cas_bang_cont(vec, pos_idx, old_val, new_val, env, cont, _vals):
    from pycket.interpreter import check_one_val, return_value
    current_vec_val = check_one_val(_vals)
    if equal.eqp_logic(current_vec_val,old_val): #eq?
        return vec.vector_set(pos_idx, new_val, env, vector_cas_success(env, cont))
    return return_value(values.w_false, env, cont)
Example #13
0
File: box.py Project: yws/pycket-1
def box_cas(box, old, new):
    if eq_prims.eqp_logic(box.value, old):
        box.value = new
        return values.w_true
    return values.w_false
Example #14
0
def box_cas(box, old, new):
    if eq_prims.eqp_logic(box.value, old):
        box.value = new
        return values.w_true
    return values.w_false
Example #15
0
 def cmp_value(a, b):
     from pycket.prims.equal import eqp_logic
     return eqp_logic(a, b)
Example #16
0
 def cmp_value(a, b):
     from pycket.prims.equal import eqp_logic
     return eqp_logic(a, b)
Example #17
0
 def _set(self, w_vector, i, w_val):
     if not we_are_translated():
         from pycket.prims.equal import eqp_logic
         self.indexcheck(w_vector, i)
         assert eqp_logic(w_val, self._storage(w_vector)[0])
Example #18
0
 def is_correct_type(self, w_vector, w_obj):
     from pycket.prims.equal import eqp_logic
     val = self._storage(w_vector)[0]
     return eqp_logic(val, w_obj)