Using the Set type

Category:
Data Types
Description: Create a set of particular unicode characters using a Microsoft.FSharp.Collections.Set.
Code:
let SampleSet1() =
let data = "The quick brown fox jumps over the lazy dog"
let set =
data.ToCharArray()
|> Set.ofSeq
for c in set do
printfn "Char : '%c'" c


Execution Result:
Char : ' '
Char : 'T'
Char : 'a'
Char : 'b'
Char : 'c'
Char : 'd'
Char : 'e'
Char : 'f'
Char : 'g'
Char : 'h'
Char : 'i'
Char : 'j'
Char : 'k'
Char : 'l'
Char : 'm'
Char : 'n'
Char : 'o'
Char : 'p'
Char : 'q'
Char : 'r'
Char : 's'
Char : 't'
Char : 'u'
Char : 'v'
Char : 'w'
Char : 'x'
Char : 'y'
Char : 'z'

Last edited Sep 14, 2011 at 3:28 AM by ttliu2000, version 1

Comments

No comments yet.