I'm very new to Haskell, and I have a simple question.
What function can I use with a and b that will result in a, b times.
Example:a = 4 | b = 3
Would return:[4, 4, 4]
Thanks!
replicate
:
replicate 3 4
will be:
[4,4,4]
When you know what's the type of the function you need (in this case it was quite obvious that the function you needed had a type similar to Int -> a -> [a]
) you can use Hoogle in order to find it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With