Interisting piece of code, but win a spot in my tool chest.  I like where your
going with it though.  This sort functionality could be achieved in a more
standard way with the Pekr's 'locate vision. Example:

Rank: [ A-group [ Bobby 3 Mark 4 Jim 2 ] ] B-group [ Sam 1 Arnold 5 ] ]

change locate Rank 'Bobby 'Bob ; Change Bobby's name to Bob

; Exchange Sam's and Jim's ranks
change next locate Rank 'Sam 1
change next locate Rank 'Jim 2

Unfortuneately no one has written 'locate yet. Hmmm... I got some time this
weekend...

--Ryan

Mike Yaunish wrote:

> I have been working with complex paths in REBOL because I just love how
> easy they are
> to work with - however I have had some problems setting  variables within a
> complex
> path. I think I have a fairly good solution, but know if I expose it to the
> light of other REBOLers
> it can be even better. I have called this function "complex-set".
>
> complex-set: func ["Sets a complex path (from a block of literal words) to
> a specified value"
>                      complex-path [block!] "Block of literal and normal
> words that describe the complex path"
>                      value [any-type!] "Value to be set"
> ][
>      either lit-word? last complex-path [
>          prefix-path: copy/part complex-path ((length? complex-path) - 1 )
>          the-path: to-path reduce prefix-path
>          the-field: to-lit-word last complex-path
>          either ( found? find the-path the-field ) [
>              do bind reduce [to-set-path reduce complex-path  value] 'do
>          ][  ; field doesn't already exist so create it
>              append/only the-path the-field
>              append/only the-path value
>          ]
>      ][
>          do bind reduce [to-set-path reduce complex-path  value] 'do
>      ]
> ]
>
> address-book: [ [name [first "Joe" last "Blow" ] address [city "Goosebay"
> province "Labrador"]]
>            [name [first "Tim" last "Taylor" middle "Lee"] address [city
> "Calgary" province "Alberta"]]
> ]
>
>  >>index: 2
>  >>new-name: "Tiny"
>  >>complex-set [ 'address-book index 'name 'middle ] new-name
>
> "complex-set" also accomodates the creation of fields within a path.
> For example;
>
>  >>complex-set [ 'address-book 1 'name 'middle ] "Lincoln"
>  >>complex-set [ 'address-book 2 'address 'zip ] 90210
>
>  >> print mold address-book
> [[name [first "Joe" last "Blow" middle "Lincoln"] address [city "Goosebay"
> province "Labrador"]]
>      [name [first "Tiny" last "Taylor" middle "Tiny"] address [city
> "Calgary" province "Alberta" zip 90210]]
> ]
>
> There are some minor limitations - but it works great for REBOL named fields.
> Any comments would be appreciated.
>
> Mike Yaunish
> [EMAIL PROTECTED]
>
> --
> To unsubscribe from this list, please send an email to
> [EMAIL PROTECTED] with "unsubscribe" in the
> subject, without the quotes.

--


     Ryan Cole
 Programmer Analyst
 www.iesco-dms.com
    707-468-5400

"I am enough of an artist to draw freely upon my imagination.
Imagination is more important than knowledge. Knowledge is
limited. Imagination encircles the world." -Einstein


-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to