RosettaCodeData/Task/Reverse-a-string/F-Sharp/reverse-a-string-1.fs

4 lines
270 B
Forth
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
// Reverse a string. Nigel Galloway: August 14th., 2019
let strRev α=let N=System.Globalization.StringInfo.GetTextElementEnumerator(α)
List.unfold(fun n->if n then Some(N.GetTextElement(),N.MoveNext()) else None)(N.MoveNext())|>List.rev|>String.concat ""