[Thread Prev][Thread Next][Index]
Re: [ferret_users] Eddy tracking algorithm
Hi,
I agree that there are many problems which Ferret is not a suitable programming language to solve in. Here I'd just like to comment on the following issue.
> 1. Delayed mode evaluation
> Ferret evaluates all expressions only when it meets an action command (Ch3 Sec2. EXPRESSIONS).
> This means that you cannot use expressions like
>
> let var = var * something_else
>
> One may think this is not a serious problem and a new variable name can be used for such steps.
> But in experience, this is a serious problem.
That is a problem, for example, when you want to loop. But, lazy evaluation is necessary in Ferret:
let speed = (u*u + v*v)^0.5 ! big 4D arrays
fill/k=1/l=1 speed ! I only need a slice
Ferret computes only the necessary part of the big array, which is a blessing. In an eager-evaluation language like C and Fortran, the first line would consume a lot of time and memory. You can't do this
let var = var + something
because the (partial) evaluation of the right-hand side occurs only when its value is required. In other words, "let" is a "definition", not an "assignment", in Ferret.
In Ferret, you don't usually use loops; you use functions. In such a case, lazy evaluation saves time and memory because computation occurs only when necessary. (There are computer languages that behave like that; Haskell is a primary example. You don't use loops in such a language; you use functions.)
> Another aspect is that you cannot use a variable
> name which is already there in any of the opened datasets.
I think this is a separate issue, and I agree that a fine-grained namespace would be very nice for programming.
Regards,
Ryo
[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce /
NOAA /
OAR /
PMEL /
Ferret
Privacy Policy | Disclaimer | Accessibility Statement