Charles:

> but I think I will run into problems if the target-id is non-unique.

Then I'd apply the following hack:


lst: ["Charlie" 11111 "Peter" 239823 "Sam" 11111 "Tiana" 92348]
target: "Sam"
target-id: select lst target
 if not none? target-id [
    remove at lst 1 + index? find lst target
    alter lst target
    append lst target
    append lst target-id
    ]

This code is "inefficient" in that in searches lst three times (select + find 
+ alter). You could attempt to "optimise" it by saving the initial position 
in a variable. But unless you are intending to execute it a zillion times a day 
on megabyte long blocks, it's hardly worth the effort.

Should work if you have duplicate target-ids and/or duplicate targets (more 
than one "sam").

Likely to go astray if a target can be the same as a target-id (not currently 
a problem as they are in different domains -- string! vs number!)

Sunanda.
-- 
To unsubscribe from the list, just send an email to rebol-request
at rebol.com with unsubscribe as the subject.

Reply via email to