This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let inline drawQuadTexture (x0, y0, u0, v0, c0) (x1, y1, u1, v1, c1) (x2, y2, u2, v2, c2) (x3, y3, u3, v3, c3) add vbo = | |
vbo |> add x0 y0 u0 v0 c0 | |
vbo |> add x1 y1 u1 v1 c1 | |
vbo |> add x3 y3 u3 v3 c3 | |
vbo |> add x1 y1 u1 v1 c1 | |
vbo |> add x2 y2 u2 v2 c2 | |
vbo |> add x3 y3 u3 v3 c3 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[<Struct;StructLayout(LayoutKind.Explicit, Pack=1,Size=32)>] | |
type Bucket = | |
struct | |
[<FieldOffset(0)>]val mutable Free : int64 | |
[<FieldOffset(8)>]val mutable FreeCount: int | |
[<FieldOffset(12)>]val mutable Used: int | |
[<FieldOffset(16)>]val mutable Size: int | |
[<FieldOffset(20)>]val mutable Full: bool | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let makeQuad a b h= | |
let x0, y0, z0 = a | |
let x1, y1, z1 = b | |
let c = x1, y1 + h, z1 | |
let d = x0, y0 + h, z0 | |
(a, b, c), (a, c, d) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let count = cval 10 | |
let set = cset { | |
let! c = count | |
for i = 1 to c do yield int64 i | |
} | |
let sum = set |> CSet.sumBy id | |
count.SetValue 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let rec fib n = | |
match n with | |
| 0 -> 1 | |
| 1 -> 2 | |
| x -> fib (x - 1) + fib (x - 2) | |
Seq.initInfinite fib | |
|> Seq.takeWhile (fun n -> n <= 4_000_000) | |
|> Seq.filter (fun n -> n % 2 = 0) | |
|> Seq.sum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let isPrime (n: int) = | |
let max = sqrt (float32 n) |> int | |
let rec check m = | |
if m > max then true | |
elif n % m = 0 then false | |
else check (m+1) | |
check 2 | |
let n = 600851475143L // |
OlderNewer