added implementation in f#