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

[REBOL] Re: Block of words

From: andrew:wxc at: 26-Feb-2001 15:45

> I have used the following method to get a list of name:value pairs in
practice and it is working fine.
> >> my-block: [name "Rod" age 37 profession "Developer"] > >> print select my-block 'name > > To me the above doesn't feel right. The approach I would prefer is to
have the list in the block to be words themselves that could be dereferenced to get to the value. How about using an object? Like:
>> Person: make object! [
[ Name: "Rod" [ Age: 37 [ Profession: "Developer" [ ]
>> >> person/name
== "Rod"
>> person/age
== 37 The words in a object is:
>> first person
== [self Name Age Profession] and the values in a object is:
>> second person
== [ make object! [ Name: "Rod" Age: 37 Profession: "Developer" ] "Rod" 37 "Developer"] Where the first value is 'self, and the next three are name, age and profession. I hope that helps! Andrew Martin ICQ: 26227169 http://members.nbci.com/AndrewMartin/