From 4a4aeb821e96bfb68f5520310af40c382e2c5e2a Mon Sep 17 00:00:00 2001 From: Alex Chapman Date: Thu, 13 Mar 2008 15:22:16 +1100 Subject: [PATCH] semantic-db: got rid of uniq in favour of prune --- extra/semantic-db/hierarchy/hierarchy.factor | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/extra/semantic-db/hierarchy/hierarchy.factor b/extra/semantic-db/hierarchy/hierarchy.factor index 7d5f976909..7465d67664 100644 --- a/extra/semantic-db/hierarchy/hierarchy.factor +++ b/extra/semantic-db/hierarchy/hierarchy.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2008 Alex Chapman ! See http://factorcode.org/license.txt for BSD license. -USING: accessors db.tuples kernel new-slots semantic-db -semantic-db.relations sorting sequences sequences.deep ; +USING: accessors db.tuples hashtables kernel new-slots +semantic-db semantic-db.relations sorting sequences ; IN: semantic-db.hierarchy TUPLE: tree id children ; @@ -34,9 +34,6 @@ C: tree : get-node-hierarchy ( node-id -- tree ) dup children [ get-node-hierarchy ] map ; -: uniq ( sorted-seq -- seq ) - f swap [ tuck = not ] subset nip ; - : (get-root-nodes) ( node-id -- root-nodes/node-id ) dup parents dup empty? [ drop @@ -45,4 +42,4 @@ C: tree ] if ; : get-root-nodes ( node-id -- root-nodes ) - (get-root-nodes) flatten natural-sort uniq ; + (get-root-nodes) flatten prune ;