This file contains hidden or 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
package curves | |
Curve_Kind :: enum u8 { | |
Linear, | |
Bezier, | |
Hermite, | |
Catmull_Rom, | |
B_Spline, | |
} |
This file contains hidden or 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
//----------------------------------------------------------------------------------------------- | |
// SquirrelNoise5.hpp | |
// | |
#pragma once | |
///////////////////////////////////////////////////////////////////////////////////////////////// | |
// SquirrelNoise5 - Squirrel's Raw Noise utilities (version 5) | |
// | |
// This code is made available under the Creative Commons attribution 3.0 license (CC-BY-3.0 US): |
This file contains hidden or 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
open System.Collections.Concurrent | |
type T = T with static member getOrAdd (cd:ConcurrentDictionary<_,'t>) (f:_ -> _) k = cd.GetOrAdd (k, f) | |
let inline memoize (f:'``(T1 -> T2 -> ... -> Tn)``): '``(T1 -> T2 -> ... -> Tn)`` = (T $ Unchecked.defaultof<'``(T1 -> T2 -> ... -> Tn)``>) f | |
type T with | |
static member ($) (_:obj, _: 'a -> 'b) = T.getOrAdd (ConcurrentDictionary ()) | |
static member inline ($) (T, _:'t -> 'a -> 'b) = T.getOrAdd (ConcurrentDictionary ()) << (<<) memoize | |