问题
I have the following two lines of code. I've tried merge and append but keep getting errors of type.
The goal is to have one list that's BOTH a multiple of 5 or has exactly three factors.
For example : (function name) 100 -->
[4,5,9,10,15,20,25,30,35,40,45,49,50,55,60,65,70,75,80,85,90,95,100]
My two lines of code are :
mulitof5 x = [x | x <- [1..x], (x `mod` 5 == 0)]
isPrimes n = [n^2 | (n) <- [2..n-1], (all (\a -> mod n a /= 0) [2..n-1])]
Are merge and append the way to go?
Things I've tried:
mulitof5 x = [x | x <- [1..x], (x `mod` 5 == 0)| isprime n ]
isPrimes n = [n^2 | (n) <- [2..n-1], (all (\a -> mod n a /= 0) [2..n-1])]
fun n = merge (multiof 5, isPrime)
mulitof5 x = [x | x <- [1..x], (x `mod` 5 == 0)| [n^2 | (n) <- [2..n-1], (all (\a -> mod n a /= 0) [2..n-1])] ]
some of the things I've done
来源:https://stackoverflow.com/questions/59781958/how-do-i-combine-two-list-in-haskell