From d6e445df1f77dfec5e8b311f133722a24373a45c Mon Sep 17 00:00:00 2001 From: Daniel Ehrenberg <ehrenbed@carleton.edu> Date: Mon, 17 Dec 2007 15:29:21 -0500 Subject: [PATCH] XML attrs --- extra/xml/data/data.factor | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/extra/xml/data/data.factor b/extra/xml/data/data.factor index 58ff2a3f6c..725d6da3cc 100644 --- a/extra/xml/data/data.factor +++ b/extra/xml/data/data.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2005, 2006 Daniel Ehrenberg ! See http://factorcode.org/license.txt for BSD license. -USING: kernel sequences sequences.private assocs arrays ; +USING: kernel sequences sequences.private assocs arrays vectors ; IN: xml.data TUPLE: name space tag url ; @@ -60,7 +60,8 @@ M: attrs set-at 2dup attr@ nip [ 2nip set-second ] [ - >r assure-name swap 2array r> push + [ >r assure-name swap 2array r> ?push ] keep + set-delegate ] if* ; M: attrs assoc-size length ; @@ -68,14 +69,15 @@ M: attrs new-assoc drop V{ } new <attrs> ; M: attrs >alist delegate >alist ; : >attrs ( assoc -- attrs ) - V{ } assoc-clone-like - [ >r assure-name r> ] assoc-map - <attrs> ; + dup [ + V{ } assoc-clone-like + [ >r assure-name r> ] assoc-map + ] when <attrs> ; M: attrs assoc-like drop dup attrs? [ >attrs ] unless ; M: attrs clear-assoc - delete-all ; + f swap set-delegate ; M: attrs delete-at tuck attr@ drop [ swap delete-nth ] [ drop ] if* ;