f# - Point free function wouldn't cause recursion but normal function would here? -


as side question here what's easiest way delegate multicast in f# think maybe better raise full question proper title.

this version wouldn't cause recursion: (here notify seems immutable in d)

let mutable notify = fun x -> x let wrap f = f(i);  let x = printf "%a" x let d = (notify >> (wrap a)) // point free notify <- d  notify "ss" 

this version would. (here notify seems mutable in d)

let mutable notify = fun x -> x let wrap f = f(i);  let x = printf "%a" x   let d x =     (notify >> (wrap a)) x // normal function notify <- d  notify "ss" // endless loop 

another fail version:

let mutable notify = fun x -> x let wrap f = f(i);  let x = printf "%a" x   let d =     fun x -> (notify >> (wrap a)) x // here notify <- d  notify "ss" // endless loop 

where can find guideline or more resource why have behaviours discrepancy . tied particularly compiler/ language or there theory applied functional languages?

uncontrolled mutability reason behavior. other languages haskell provides controlled mutability using software transaction memory techniques avoid these kind of problems. also, eager evaluation plays important role here.

let d = (notify >> (wrap a)) : in case whatever value of notify has composed (wrap a) , result assigned d

let d x = (notify >> (wrap a)) x : here, body of function not executed untill call d function , hence mutated value of notify


Comments