How can I remove duplicates in an F# sequence without using references

前端 未结 6 387
南方客
南方客 2021-01-20 09:07

I have a sorted sequence and want to go through it and return the unique entries in the sequence. I can do it using the following function, but it uses reference variables a

6条回答
  •  说谎
    说谎 (楼主)
    2021-01-20 09:41

    Seq.distinct (1::[1..5]) returns seq [1; 2; 3; 4; 5]. Is that what you meant?

提交回复
热议问题