new saturate step archetecture: call saturate only at the end, speedup

This commit is contained in:
ProgramSnail 2025-11-18 16:27:05 +03:00
parent 15cbf78ed5
commit 75dafdab5e
3 changed files with 73 additions and 43 deletions

View file

@ -14,7 +14,8 @@ data Oracle = Oracle { oracleTypes :: TypeConf,
data Conf = Conf {confInput :: [Value],
confOracle :: Oracle,
confExamples :: [[Value]]}
confExamples :: [[Value]],
confTryFindExamples :: Bool}
-- TODO: check
structuralLess :: Value -> Value -> Bool
@ -100,9 +101,9 @@ eval conf (SelfE es) = do recInput <- foldM (\es e -> consValsM es (eval conf e)
then RecError $ "self call on >= exprs, new=" ++ show recInput ++ " old=" ++ show (confInput conf)
else do
case (oracleFunc $ confOracle conf) recInput of
Just recOutput -> if recInput `elem` confExamples conf
Just recOutput -> if recInput `elem` confExamples conf || not (confTryFindExamples conf) -- TODO: better way
then return recOutput
else NewExamples $ trace ("newExample: " ++ show [(recInput, recOutput)]) [(recInput, recOutput)]
else NewExamples $ trace ("New example: " ++ show [(recInput, recOutput)]) [(recInput, recOutput)]
Nothing -> FatalError $ "no oracle output on " ++ show recInput
where consValsM :: [Value] -> Result Value -> Result [Value]
consValsM vs (Result v) = Result $ v : vs