Pardon me? That example would presumably return a sorting network or certain size and type; I'm not sure what you mean by "sort two networks". Memoization helps there because of recursive structure. I'll give another example that requires no explanation.
And before you ask: no, I do not foresee a need to produce two (different) Fibonacci sequences.sub fibonacci { my $n = shift; return 0+($n==1) if $n < 2; state @mem; $mem[$n] //= fibonacci($n-1) + fibonacci($n-2); }
In reply to Re^5: Variable scope
by Anonymous Monk
in thread Variable scope
by Alphaphi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |