And here's a version that's shorter and nicer to use. Can any one think of a
shorter version?
[
Rebol [
Title: "Associate"
Name: 'Associate
File: %Associate.r
Author: "Andrew Martin"
Email: [EMAIL PROTECTED]
Date: 16/September/2000
]
Associate: function [Block [block!] Key Value] [Index] [
Value: reduce [Value]
either found? Index: find Block Key [
either none? Value [
remove/part Index 2
][
change/only next Index Value
]
][
append Block reduce [Key Value]
]
Block
]
Associate?: function [Block [block!] Key] [Value] [
Value: select Block Key
either none? Value [none] [first Value]
]
]
Andrew Martin
ICQ: 26227169
http://members.ncbi.com/AndrewMartin/
http://members.xoom.com/AndrewMartin/
-><-
[
Rebol [
Title: "Associate"
Name: 'Associate
File: %Associate.r
Author: "Andrew Martin"
Email: [EMAIL PROTECTED]
Date: 16/September/2000
]
Associate: function [Block [block!] Key Value] [Index] [
Value: reduce [Value]
either found? Index: find Block Key [
either none? Value [
remove/part Index 2
][
change/only next Index Value
]
][
append Block reduce [Key Value]
]
Block
]
Associate?: function [Block [block!] Key] [Value] [
Value: select Block Key
either none? Value [none] [first Value]
]
]