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

[REBOL] Obtaining a word's value

From: joel::neely::fedex::com at: 5-Jul-2001 11:49

Hi, all, As a break in the discussion of whether to include our thumbs when we count on our fingers... ;-) let me pose the following question: Given a word A which currently "has" an associated value, how many distinct means does REBOL offer by which can we retrieve that value? A starter list of answers for the simple case
>> a: "this is a test" ;== "this is a test"
would include
>> a ;== "this is a test" >> :a ;== "this is a test" >> do [a] ;== "this is a test" >> do "a" ;== "this is a test" >> first reduce [a] ;== "this is a test" >> get 'a ;== "this is a test" >> get/any 'a ;== "this is a test" >> get first [a] ;== "this is a test" >> get to-word "a" ;== "this is a test" >> (a) ;== "this is a test" >> any [a] ;== "this is a test"
By "distinct means" I hope to exclude variations on any theme that really don't add new/distinct capabilities. For example, since do [a] is on the list above, is there any point in adding do [do [do [a]]] and, since any [a] is already listed, can we pass over trivial variations such as any [false a] any [none false a] or are there actual differences (beyond increased run-time) for some possible values of A ? -jn- ___________________________________________________________________ The purpose of computing is insight, not numbers! - R. W. Hamming joel'dot'neely'at'fedex'dot'com