Press CTRL+C or CMD+C to copy the selected text and close this dialog.
Tweet
9 people like it. Like the snippet!
Fast and GC friendly fixpoint combinator.
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15:
#time let rec Y f x = f (Y f) x let Y' f x = let r = ref Unchecked.defaultof<'a -> 'b> r := (fun x -> f !r x) f !r x let iter f x = if x = 100000000 then x else f (x + 1) // Real: 00:00:01.504, CPU: 00:00:01.497, GC gen0: 572, gen1: 1, gen2: 0 Y iter 1 // Real: 00:00:00.769, CPU: 00:00:00.780, GC gen0: 0, gen1: 0, gen2: 0 Y' iter 1