https://gist.github.com/hoyeunglee/9016d6e583f4135c9b259ff8d8673c7b
MA([1,2], MB([2,3], MC([3,4], [4,5])))
i discover the function getAllTreesFromList
needed 4 parameters in order to generate one function which contain 3 operators
i have already chosen 4 parameters saved in allparams1
*Main> let alltrees1a = [ (x, sum $ (eeval1 x)) | x <- allexprs1]
<interactive>:377:38:
Couldn't match expected type `Mree [Double]'
with actual type `[Mree [Double]]'
In the first argument of `eeval1', namely `x'
In the second argument of `($)', namely `(eeval1 x)'
In the expression: sum $ (eeval1 x)
:l trees3a.hs
let input2 mm = replicateM mm [(1,MA), (2,MB), (3,MC), (4,MD), (5,ME), (6,MF), (7,MG), (8,MH)]
let {isSorted :: (Ord a) => [(a, Operation)] -> Bool; isSorted [] = True; isSorted [x] = True; isSorted (x:y:xs) = (fst x) > (fst y) && isSorted (y:xs)}
let {doall mm = do let {input1 = input2 mm};writeFile ("logic3layer"++show(mm)++".txt") (unlines $ map show $ filter isSorted input1)}
let input1 = input2 3
let oplist = filter isSorted input1
let getoperationlist = [map snd (oplist!!i) | i <- [0..((length oplist)-1)]]
let fullytruerownum = 162
let fullytrue = 162.0
let logic3row = replicateM 3 [0.0, 1.0, 2.0]
let logic3col = [[logic3row!!i!!3 | i <- [0..(81-1)]],[logic3row!!i!!2 | i <- [0..(81-1)]],[logic3row!!i!!1 | i <- [0..(81-1)]],[logic3row!!i!!0 | i <- [0..(81-1)]]]
let allparams1 = replicateM 4 logic3col
let alltrees1 nn = [getAllTreesFromList (getoperationlist!!nn) c | x <- allparams1, c <- [x]]
let allexprs1 = alltrees1 40
let alltrees1a = [ (x, sum $ (eeval1 x)) | x <- allexprs1]
let alltrees1b = [ (eeval1 x, sum $ (eeval1 x)) | x <- allexprs1]
let alltrees1c = [ (eeval1 x, (x, sum $ (eeval1 x))) | x <- allexprs1]
let bb1map = filter (\n -> snd (snd n) < fullytrue) alltrees1c
let bb1true = [ (x,162.0) | (x,162.0) <- alltrees1a ]
let bb1others = filter (\n -> snd n < fullytrue) alltrees1b
length alltrees1a
length bb1true
length bb1others
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 293 |
Nodes: | 16 (2 / 14) |
Uptime: | 214:36:47 |
Calls: | 6,619 |
Calls today: | 1 |
Files: | 12,168 |
Messages: | 5,317,487 |