// break down into tuple
open System.Drawing
let (|RGB|) (col:System.Drawing.Color) = (col.R, col.G, col.B)
let (|HSB|) (col:System.Drawing.Color) = (col.GetHue(), col.GetSaturation(),col.GetBrightness())
//parsing
open System
let (|Int|_|)(x:string) =
let mutable y =0.0
if System.Double.TryParse(x, &y) then Some(x)
else None
let PrintRGB x =
match x with
| RGB (r,g,b) -> printfn"%d %d %d" r g b
let Parse x =
match x with
| Int t -> printfn "%A" t
| _ -> printfn "not integer"
Tuesday, June 14, 2011
F# Active Parttern to break down data
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment