Best practices for writing efficient user commands

You’re doing fine @afre, indeed. First step is always to make something work as expected :slight_smile:
Then, it is just cosmetic.
Here is my proposal, from the version of @garagecoder, except I’m not using an image to store the log numbers, but a single variable s. There is almost no differences, I suspect @garagecoder’s version is even slightly faster by the way :slight_smile:

deets2 :
  r={[im,iM]} split_details 5
  l[^0]
    s={"s = vectorl(); for (k = 0, k<l, ++k, s[k] = log((ia#k - im#k)/sqrt(iv#k))); s/min(s)"}
    repeat $! *[$>] {arg(1+$>,$s)} done
  endl
  + n $r
1 Like