Consider the following (pseudo-)function definition:
f[l_] := Let[{
a = Length[l],
b = First[l],
c = b/a,
}, c*10]
So for instance, f[{2,3,4,5}]
should output 5
.
Currently, I only know variants for Let
that
- set
a
,b
andc
globally (on the first call off
) or - don't allow the definition of
c
becausea
andb
are not defined.
What is the most simple way to define local variables whose definitions may depend on each other (upwards)?