Domanda

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

replicate 'A' 5 ~> "AAAAA"
È stato utile?

Soluzione

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.

Altri suggerimenti

It's replicate in the prelude.

replicate 5 'A'

returns: "AAAAA"

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top