I am reading through an example on RosettaCode and do not exactly know what the following line is doing.
let min,subheap = findMin heap' in let rtn = root topnode
It seems that findMin heap'
is self contained unit of execution. I do not know how it relates to the "in" operator nor do I understand the use of the let statement in the "in" operator.
Here is the whole method
let rec private findMin heap =
match heap with | [] -> raise Empty_Heap //guarded so should never happen
| [node] -> root node,[]
| topnode::heap' ->
let min,subheap = findMin heap' in let rtn = root topnode
match subheap with
| [] -> if rtn.k > min.k then min,[] else rtn,[]
| minnode::heap'' ->
let rmn = root minnode
if rtn.k <= rmn.k then rtn,heap
else rmn,minnode::topnode::heap''
[Edit] Even after sepp2k explained it, the documentation for "let" does not explain this. You have to look at that "Verbose Syntax (F#)" documentation.