Hi all,

Here is an O(n) prune which still preserves order:

: (prune) ( hash vec elt -- )
     pick dupd hash-member?
     [ 3drop ] [ rot dupd dupd set-hash swap push ] if ;

: prune ( seq -- newseq )
     dup length <hashtable> over length <vector> rot
     [ >r 2dup r> (prune) ] each nip ;

Slava

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to