Created
May 21, 2017 17:16
-
-
Save saschatimme/9fc6a6091d6e51e64040dcbbdf2a5d1e to your computer and use it in GitHub Desktop.
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
module Experiment1 = { | |
type t = | |
| Disabled | |
| Control | |
| VarA | |
| VarB; | |
let equal a b => | |
switch (a, b) { | |
| (Disabled, Disabled) => true | |
| (Control, Control) => true | |
| (VarA, VarA) => true | |
| (VarB, VarB) => true | |
| _ => false | |
}; | |
let getVariant () => { | |
let variantIndex = Random.int 3; | |
switch variantIndex { | |
| 1 => Control | |
| 2 => VarA | |
| 3 => VarB | |
| _ => Disabled | |
} | |
}; | |
}; | |
module Experiment2 = { | |
type t = | |
| Disabled | |
| Control | |
| VarX | |
| VarY; | |
let equal a b => | |
switch (a, b) { | |
| (Disabled, Disabled) => true | |
| (Control, Control) => true | |
| (VarX, VarX) => true | |
| (VarY, VarY) => true | |
| _ => false | |
}; | |
let getVariant () => { | |
let variantIndex = Random.int 3; | |
switch variantIndex { | |
| 1 => Control | |
| 2 => VarX | |
| 3 => VarY | |
| _ => Disabled | |
} | |
}; | |
}; | |
let myExp = Experiment1.getVariant (); | |
let color = | |
if (Experiment1.equal myExp Experiment1.VarA) { | |
"blue" | |
} else { | |
"red" | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment