Since this example is basically a loop
let rec ListBuilder
...
ListBuilder
C3 outputlist, , outputlist , C1 C2
C3 firstMultiple .
then firstMultiple // "C3"
C1 C2, firstMultiple bound, , , bound not set mutated
let firstMultiple = nextInput * factor
[nextInput], inputList.Tail, firstMultiple
C1 firstMultiple , firstMultiple A B C3, . , , firstMultiple C3, .
, :
let temp = nextInput * factor
[nextInput], inputList.Tail, temp
[nextInput], inputList.Tail, (nextInput * factor)
firstMultiple at C1 C2 - - , .
:
"B" firstMultiple "C2", "A".
, B , , B. , .
let newOutputList, remInputList, firstMultiple = // "B"
match outputList with
| [] -> //first pass, capture firstMultiple now
let firstMultiple = nextInput * factor // "C1"
[nextInput], inputList.Tail, firstMultiple // "C2"
| _ ->
let lastOutput = outputList.Head
let multiple =
if useFirstMultiple then firstMultiple // "C3"
else lastOutput * factor
let newOutputList =
if (myfunc multiple nextInput: bool) then
nextInput :: outputList
else
outputList
let remInputList =
if not (myfunc multiple nextInput: bool) then
inputList.Tail
else
inputList
newOutputList, remInputList, firstMultiple
, ,
[nextInput], inputList.Tail, firstMultiple
newOutputList, remInputList, firstMultiple
B firstMultiple ,
let myFunc firstMultiple = ...
,
let newOutputList, remInputList, firstMultiple = // "B"
firstMultiple B
C1
let firstMultiple = nextInput * factor // "C1"
C2
[nextInput], inputList.Tail, firstMultiple