문제

For example say I had 'A' I could call the function like so:

replicate 'A' 5 ~> "AAAAA"
도움이 되었습니까?

해결책

Yes, exact same name but the arguments are switched.

http://hackage.haskell.org/package/base-4.6.0.1/docs/Prelude.html#v:replicate

If you go to hoogle you can search functions by type signature and name.

http://www.haskell.org/hoogle/?hoogle=Char+-%3E+Int+-%3E+String

See that replicate was the 3rd result.

다른 팁

It's replicate in the prelude.

replicate 5 'A'

returns: "AAAAA"

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top