Using DeleteElements
:
DeleteElements[{1/3, 1/2, 3/4, 1/2, 1/2, 1/2}, 1 -> {1/2}]
(*{1/3, 3/4, 1/2, 1/2, 1/2}*)
For 12.1 version, you can use SubsetReplace
:
SubsetReplace[{1/3, 1/2, 3/4, 1/2, 1/2, 1/2}, {1/2} -> Nothing, 1]
(*{1/3, 3/4, 1/2, 1/2, 1/2}*)
Your DeleteFirstCase
using PositionIndex
and KeyTake
:
DeleteFirstCase[l_List, item_] :=
Module[{rules},
rules = Flatten[
Thread /@ (If[#[[2]] === item,
Rest[#[[1]]] -> #[[2]], #] & /@ (Reverse /@
Normal@PositionIndex[l]))];
(Join @@ Normal[KeyTake[rules, #] & /@ Range[Length[l]]])[[All, 2]]]
Test:
DeleteFirstCase[arr, item]
(*{1/3, 3/4, 1/2, 1/2, 1/2}*)
Using DeteleFirstCase
with FixedPointList
:
FixedPointList[DeleteFirstCase[#, item] &, arr] // Grid

?DeleteCases
. $\endgroup$