def longMixedTerm(length, **aargs): return multimap( functionSource(trees.randomBinaryTree, length), [ mapI(trees.treeTerm(**aargs)) , mapI(trees.cleverFold) , mapI(snd) , avoidDuplication ])
def myrandrange(a, b): return functionSource(randrange, a, b)
mediumOrderOfOperation = multimap( longMixedTerm(5), [ orderOfOperation , resultBetween(-200, 200) , renderSymbols]) hardOrderOfOperation = multimap( longMixedTerm(7, numbers=(randrange, [1, 24], {})), [ orderOfOperation , doubleBrackets , resultBetween(-700, 700) , renderSymbols]) longDivision = multimap( functionSource(divisionOhneRest), [ renderSymbols ]) hardLongDivision = multimap( functionSource(divisionOhneRest, divisor=[2,25], quotient=[1000, 7000]), [ renderSymbols ]) simpleMix = randomlyMix( [ additionUpTo(100) , substractionUpTo(30) , smallMultiplicationTable ]) mediumMix = randomlyMix( [ additionUpTo(1000) , substractionUpTo(200) , bigMultiplicationTable
def longMixedTerm(length, **aargs): return multimap(functionSource(trees.randomBinaryTree, length), [ mapI(trees.treeTerm(**aargs)), mapI(trees.cleverFold), mapI(snd), avoidDuplication ])
simpleOrderOfOperation = multimap( longMixedTerm(3), [orderOfOperation, nonNegative, renderSymbols]) mediumOrderOfOperation = multimap( longMixedTerm(5), [orderOfOperation, resultBetween(-200, 200), renderSymbols]) hardOrderOfOperation = multimap( longMixedTerm(7, numbers=(randrange, [1, 24], {})), [ orderOfOperation, doubleBrackets, resultBetween(-700, 700), renderSymbols ]) longDivision = multimap(functionSource(divisionOhneRest), [renderSymbols]) hardLongDivision = multimap( functionSource(divisionOhneRest, divisor=[2, 25], quotient=[1000, 7000]), [renderSymbols]) simpleMix = randomlyMix( [additionUpTo(100), substractionUpTo(30), smallMultiplicationTable]) mediumMix = randomlyMix([ additionUpTo(1000), substractionUpTo(200), bigMultiplicationTable, simpleOrderOfOperation ]) # -- define the outputs