From 0503fb6e1e3b806bc5751fd1690651a76b570138 Mon Sep 17 00:00:00 2001 From: Ted Reed Date: Wed, 22 Jul 2009 17:45:27 -0700 Subject: [PATCH] Reimplement Array.uniq to ensure that the order stays the same. --- src/classes/Array.pir | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/classes/Array.pir b/src/classes/Array.pir index 06cd289..d63f488 100644 --- a/src/classes/Array.pir +++ b/src/classes/Array.pir @@ -246,24 +246,26 @@ Return a sorted copy of the list loop: if i == len goto done - val = self[i] + key = self[i] unless block_flag, finish key = block(key) - $P0 = hash.'value?'(key) - if $P0 goto skip finish: - hash[key] = val + $I0 = exists hash[key] + if $I0 goto skip + + $P0 = self[i] + uarray.'push'($P0) + hash[key] = $P0 skip: inc i goto loop done: - uarray = hash.'values'() .return (uarray) .end