Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Associative data store Re:(3)

From: al:bri:xtra at: 16-Sep-2000 10:51

This is a multi-part message in MIME format. ------=_NextPart_000_0281_01C01FCC.0245EB60 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit 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: [Al--Bri--xtra--co--nz] 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/ -><- ------=_NextPart_000_0281_01C01FCC.0245EB60 Content-Type: text/x-rebol; name="Associate.r" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="Associate.r" [ Rebol [ Title: "Associate" Name: 'Associate File: %Associate.r Author: "Andrew Martin" Email: [Al--Bri--xtra--co--nz] 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] ] ] ------=_NextPart_000_0281_01C01FCC.0245EB60--