[REBOL] Re: Nested blocks - retrieving and setting with variables
From: carl:cybercraft at: 24-Sep-2004 18:01
On Friday, 24-September-2004 at 1:30:14 you wrote,
> Howdy. First post in a long time; haven't been playing with REBOL much.
>However, I have a problem I wanted to handle in REBOL, and I'm kind of stuck
>at a point.
>matrix: [[0 1 2 3 4] [1 0 0 0 0] [2 0 0 0 0]]
> I want to set one value within one of the nested blocks to another value.
>However, i and j are variable, and this is looped, and I need to modify i
>and j in the process of using them. For instance, this is what I've got
>right now, and I really don't like it:
>do rejoin compose ["matrix/" (i + 1) "/" (j + 1) ": " x]
> Also, I get x by comparing a couple values within matrix. For instance,
>in another language I work in that's C-like:
>min(mtx[si][ti + 1] + 1, mtx[si + 1][ti] + 1, mtx[si][ti] + cost);
> Shy of using 'pick' a dozen times, or compose like above, anyone have
>recommendations as to how best (simplest) to do that? I know I can do
> But I can't do math on the variables there. Suggestions? Thanks.
poke pick matrix i + 1 j + 1 x