Skip to main content

core language - Custom operator form for system functions?


There are some functions for which an operator form would make sense but isn't implemented. For example, I'd like to make this work:


RandomSample[3] @ Range[10] 

You can do something like this:


Unprotect[RandomSample]; Off[RandomSample::lrwl]
RandomSample[n_][x_] := RandomSample[x, n]

But I wonder if there is a standard technique to define operator forms for system functions?




Comments