Here's yet another one, a simple alternative to Threshold
. It's slower than some of the other ones for integer input, but it's actually the fastest if your values are Real
s:
f[list_, value_] := Chop[list, value]
Just to be clear, for integer input, you'd need use N@list
and then convert the result back to an integer via some form of rounding, which slows down the function.
Running Bob's speedtest:
kumar[list_, value_] := UnitStep[list - value] list
hanlon[list_, value_] := Threshold[list, value - 1]
alan[list_, value_] := If[# < value, 0, #] & /@ list
woll[list_, value_] := Clip[list, {value, \[Infinity]}, {0, 0}]
nasser[list_, value_] := ReplacePart[list, Position[list, x_ /; x - value < 0] -> 0]
ender[list_, value_] := Chop[list, value]
list = N@{2, 3, 5, 4, 6, 7, 3, 7, 5, 4};
value = 5;
{#, RepeatedTiming[Do[temp = #[list, value], {10000}];
temp]} & /@ {hanlon, woll, alan, kumar, nasser, ender} // Grid

The integer variant clocks in at about half the speed of Bob's Threshold
solution.
It's worth noting that this assumes that the values are all positive (because it would also keep values less than -value
).