From: John Benediktsson Date: Fri, 19 Mar 2021 03:41:03 +0000 (-0700) Subject: linked-assocs: rollback to old clone method. X-Git-Tag: 0.99~2434 X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=fb8e897d9bb653fa3c5a4b7037e366daaef965f5 linked-assocs: rollback to old clone method. --- diff --git a/basis/linked-assocs/linked-assocs.factor b/basis/linked-assocs/linked-assocs.factor index 2b811c08ea..a341ecc572 100644 --- a/basis/linked-assocs/linked-assocs.factor +++ b/basis/linked-assocs/linked-assocs.factor @@ -4,8 +4,6 @@ USING: accessors arrays assocs classes deques dlists fry hashtables kernel parser sequences.private vocabs.loader ; IN: linked-assocs -SLOT: dlist ! FIXME: needed for change-dlist for some reason - TUPLE: linked-assoc { assoc read-only } { dlist dlist read-only } ; : ( exemplar -- assoc ) @@ -48,7 +46,7 @@ M: linked-assoc clear-assoc [ assoc>> clear-assoc ] [ dlist>> clear-deque ] bi ; M: linked-assoc clone - (clone) [ clone ] change-assoc [ clone ] change-dlist ; + [ assoc>> clone ] [ dlist>> clone ] bi linked-assoc boa ; INSTANCE: linked-assoc assoc diff --git a/extra/lru-cache/lru-cache.factor b/extra/lru-cache/lru-cache.factor index 5fed8f33f1..af297c4e86 100644 --- a/extra/lru-cache/lru-cache.factor +++ b/extra/lru-cache/lru-cache.factor @@ -32,6 +32,10 @@ M: lru-cache set-at ] [ drop ] if ] [ drop ] if* ; +M: lru-cache clone + [ assoc>> clone ] [ dlist>> clone ] [ max-size>> ] tri + lru-cache boa ; + TUPLE: fifo-cache < linked-assoc max-size ; : ( max-size exemplar -- assoc ) @@ -49,6 +53,10 @@ M: fifo-cache set-at ] [ drop ] if ] [ drop ] if* ; +M: fifo-cache clone + [ assoc>> clone ] [ dlist>> clone ] [ max-size>> ] tri + fifo-cache boa ; + TUPLE: lifo-cache < linked-assoc max-size ; : ( max-size exemplar -- assoc ) @@ -66,3 +74,7 @@ M: lifo-cache set-at [ dlist>> ] tri (delete-at) ] when ] when* call-next-method ; + +M: lifo-cache clone + [ assoc>> clone ] [ dlist>> clone ] [ max-size>> ] tri + lifo-cache boa ;