Skip to content

Instantly share code, notes, and snippets.

@murasesyuka
Last active March 21, 2017 13:53
Show Gist options
  • Select an option

  • Save murasesyuka/e6f11fb9c80ef4252b6da69deb30c028 to your computer and use it in GitHub Desktop.

Select an option

Save murasesyuka/e6f11fb9c80ef4252b6da69deb30c028 to your computer and use it in GitHub Desktop.
Samples F# of Generic
open Microsoft.FSharp.Collections
open System.Collections.Generic
open System.Numerics
let inline baymax a b = if a > b then a else b
let inline fffact n =
let one = LanguagePrimitives.GenericOne
let zero= LanguagePrimitives.GenericZero
if n = zero then one
else LanguagePrimitives.MultiplyDynamic n (fact (n-one))
[<EntryPoint>]
let main argv =
printfn "hello %A" argv
printfn "%d" (baymax 123 256)
printfn "%d" (baymax -256L 123L)
printfn "%d" (int32 (baymax 256I 123I))
//printfn "fact %d" (fffact 5)
printfn "fact %d" (fffact 5L)
//printfn "fact %d" (fffact 5I)
0 // 整数の終了コードします
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment