Step 2
This commit is contained in:
parent
ff13b144e6
commit
36ad96d129
|
@ -1,7 +1,15 @@
|
|||
module type Config = {let shape: DistributionTypes.xyShape;};
|
||||
|
||||
exception ShapeWrong(string);
|
||||
|
||||
module Make = (Config: Config) => {
|
||||
let validateHasLength = (): bool => Array.length(Config.shape.xs) > 0;
|
||||
let validateSize = (): bool =>
|
||||
Array.length(Config.shape.xs) == Array.length(Config.shape.ys);
|
||||
if (!validateHasLength()) {
|
||||
raise(ShapeWrong("You need at least one element."));
|
||||
};
|
||||
if (!validateSize()) {
|
||||
raise(ShapeWrong("Arrays of \"xs\" and \"ys\" have different sizes."));
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user