1
0
forked from GitHub/gf-core

random gen to fill given term

This commit is contained in:
aarne
2004-04-30 11:28:35 +00:00
parent 36a68bce6a
commit c9d10ab5ed
8 changed files with 23 additions and 14 deletions

View File

@@ -173,15 +173,17 @@ execC co@(comm, opts0) sa@((st,(h,_)),a) = case comm of
CTranslate il ol -> do
let a' = opST2CommandArg (optParseArgErr opts (sgr il)) a
returnArg (opTS2CommandArg (optLinearizeTreeVal opts (sgr ol)) a') sa
CGenerateRandom n -> case a of
ASTrm _ -> do
case s2t a of
ATrms [trm] -> do
CGenerateRandom n -> do
let
a' = case a of
ASTrm _ -> s2t a
_ -> a
case a' of
ATrms (trm:_) -> do
g <- newStdGen
case (goFirstMeta (tree2loc trm) >>= refineRandom g 41 cgr) of
Ok trm' -> returnArg (ATrms [loc2tree trm']) sa
Bad s -> returnArg (AError s) sa
_ -> returnArg a sa
_ -> do
ts <- randomTreesIO opts gro (optIntOrN opts flagNumber n)
returnArg (ATrms ts) sa