Last active
February 15, 2017 14:54
-
-
Save deque-blog/80846e9a72a8791c702ff288dc8ad4a4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
opsGen :: Gen Expr -> Int -> Gen Expr | |
opsGen simpleTermGen = go where | |
go n = do | |
m <- choose (0, n) | |
if m == 0 | |
then simpleTermGen | |
else elements [add, mul] <*> replicateM m (go (div n (m + 1))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment