Partition an integer x into n primes: Difference between revisions
Content added Content deleted
(Added Rust Solution) |
m (→{{header|Haskell}}: Tidying) |
||
Line 754: | Line 754: | ||
=={{header|Haskell}}== |
=={{header|Haskell}}== |
||
<lang haskell>import Data. |
<lang haskell>import Data.List (delete, intercalate) |
||
import Data.Numbers.Primes (primes) |
import Data.Numbers.Primes (primes) |
||
import Data. |
import Data.Bool (bool) |
||
-------------------- PRIME PARTITIONS --------------------- |
-------------------- PRIME PARTITIONS --------------------- |
||
Line 785: | Line 785: | ||
[ justifyLeft 9 ' ' (show (x, n)) |
[ justifyLeft 9 ' ' (show (x, n)) |
||
, let xs = partitions x n |
, let xs = partitions x n |
||
in bool |
in bool |
||
(tail $ concatMap (('+' :) . show) xs) |
|||
"(no solution)" |
|||
(null xs) |
|||
]) <$> |
]) <$> |
||
concat |
concat |