diff --git a/arc.arc b/arc.arc index 5a6833e57..85334e859 100644 --- a/arc.arc +++ b/arc.arc @@ -954,6 +954,17 @@ See [[atomic]]." (= x 2 y 4) _) +(mac or= args + `(do ,@(map [cons 'or-assign _] (pair args)))) + +(mac or-assign (slot value) + `(atomic + ,(if (ssyntax slot) + `(or-assign ,(ssexpand slot) ,value) + (alist slot) + `(or ,slot (= ,slot ,value)) + `(or (if (bound ',slot) ,slot) (= ,slot ,value))))) + (def lastcons (xs) "Returns the absolute last link of list 'xs'. Save this value to efficiently append to 'xs'." @@ -2750,11 +2761,6 @@ of 'x' by calling 'self'." (3 4) (4))) -(mac or= (place expr) - (let (binds val setter) (setforms place) - `(atwiths ,binds - (or ,val (,setter ,expr))))) - (defextend iso (x y) (isa x 'table) (and (isa x 'table) (isa y 'table)