[Thread Prev][Thread Next][Index]

Re: embedded expressions

On Mon, 18 Feb 2002, Adil Sozer wrote:
> I am using beta version ferret_v533 on a redhat7.1. Is there a way to
> use to use embedded expressions in embedded expressions, like;
> yes? let string={"s1","s2","s3"}
> yes? let `string[i=1]`=5
>  !-> DEFINE VARIABLE s1=5 i    #(this works)
> yes? let m=1
> yes? let `string[i=`m=1`]`=5   #(this doesnt)

Hi Adil,

One way is to define a "command string" and then execute it:
   yes? def sym com let \`string[i=`m`]\`=5; ($com)

In a loop, you need extra backslashes.  Not sure why; perhaps the repeated
command is first converted to a string.  So:
   yes? rep/j=1:3 (def sym com let \\`string[i=`j`]\\` = 5; ($com))

Hope this helps,


Andrew Wittenberg          Program in Atmospheric and Oceanic Sciences
andyw@splash.princeton.edu                        Princeton University

[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement