I’ve got a function peg:
peg: {{$[abs[log x%y]>0.06;y;x]} scan x}
The 0.06 is a parameter that I’d like to pass to peg from the outside, so I can do something like 0.06 peg x.
What’s a clean way of passing this variable through?
>Solution :
You could rewrite the function to add explicit variables so you can keep the local variable names as x and y. Below I’ve added a new argument v for the value you want to pass.
peg: {[v;x]{[v;x;y]$[abs[log x%y]>v;y;x]}[v] scan x}
peg[0.06;x]
I don’t think there’s any other easy way to do this.