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

[REBOL] Re: Passing word in a block as an argument

From: tim:johnsons-web at: 9-Feb-2003 18:35

* Tim Johnson <[tim--johnsons-web--com]> [030209 18:23]:
> Hello Rebols: > I'd like to be able to initialize a block of words, > pass that block to a function and then get the values > in the words by referencing the names of the words. > > Here's an example of what I'm trying to do, just doesn't > work: :-( > rebol[] > test: func[e[block!]][ > ?? e > print get 'a > ] > blk: [1 2 3 4 5 6 7 8 9 10 11 12] > cols: [a b c d] > foreach :cols blk[ > ?? a ?? b ?? c ?? d > test cols > ] > ; and here's the <sigh>results</sigh>: > >> do %test.r > Script: "Untitled" (none) > a: 1 > b: 2 > c: 3 > d: 4 > e: [a b c d] > ** Script Error: a has no value > ** Where: test > ** Near: print get 'a > > So: how do I get the values of a,b,c and d?
I'm sort of answering my own question here, but it raises another. I can use forskip with the desired result, as in: forskip blk length? cols[ set cols blk ?? a ?? b ?? c ?? d test cols ] ; so why is there a difference? -- Tim Johnson <[tim--johnsons-web--com]> http://www.alaska-internet-solutions.com http://www.johnsons-web.com