Итак, вам нужна функция типа [Char] -> [Int] -> [(Char, Int)]
. Позвольте мне познакомить вас с Hoogle :
<a href="https://hackage.haskell.org/package/base/docs/Prelude.html#v:zip" rel="nofollow noreferrer">zip :: [a] -> [b] -> [(a, b)]</a>
base Prelude Data.List GHC.List GHC.OldList, Cabal Distribution.Compat.Prelude.Internal, ghc GhcPrelude
. zip takes two lists and returns a list of corresponding pairs.
zip [1, 2] ['a', 'b'] = [(1, 'a'), (2, 'b')]
If one input list is short, excess elements of the longer list are discarded:
zip [1] ['a', 'b'] = [(1, 'a')]
zip [1, 2] ['a'] = [(1, 'a')]
zip is right-lazy:
zip [] _|_ = []
zip _|_ [] = _|_
zip is capable of list fusion, but it is restricted to its first list argument and its resulting list.
<a href="https://hackage.haskell.org/package/hspec/docs/Test-Hspec-Discover.html#v:zip" rel="nofollow noreferrer">zip :: () => [a] -> [b] -> [(a, b)]</a>
hspec Test.Hspec.Discover, base-compat Prelude.Compat, protolude Protolude, rio RIO.List RIO.Prelude, universum Universum.List.Reexport, dimensional Numeric.Units.Dimensional.Prelude, rebase Rebase.Prelude, ghc-lib-parser GhcPrelude, xmonad-contrib XMonad.Config.Prime, stack Stack.Prelude, LambdaHack Game.LambdaHack.Core.Prelude Game.LambdaHack.Core.Prelude, mixed-types-num Numeric.MixedTypes.PreludeHiding, heart-core Heart.Core.Prelude, intro Intro, hledger-web Hledger.Web.Import, tonalude Tonalude, brittany Language.Haskell.Brittany.Internal.Prelude
zip takes two lists and returns a list of corresponding pairs.
zip [1, 2] ['a', 'b'] = [(1, 'a'), (2, 'b')]
If one input list is short, excess elements of the longer list are discarded:
zip [1] ['a', 'b'] = [(1, 'a')]
zip [1, 2] ['a'] = [(1, 'a')]
zip is right-lazy:
zip [] _|_ = []
zip _|_ [] = _|_
<a href="https://hackage.haskell.org/package/safe/docs/Safe-Exact.html#v:zipExact" rel="nofollow noreferrer">zipExact :: Partial => [a] -> [b] -> [(a, b)]</a>
safe Safe.Exact
zipExact xs ys =
| length xs == length ys = zip xs ys
| otherwise = error "some message"
zip :: () => [a] -> [b] -> [(a, b)]
numeric-prelude NumericPrelude NumericPrelude.Base, distribution-opensuse OpenSuse.Prelude
zip takes two lists and returns a list of corresponding pairs. If one input list is short, excess elements of the longer list are discarded. zip is right-lazy:
zip [] _|_ = []
(+*+) :: [a] -> [b] -> [(a, b)]
universe-base Data.Universe.Helpers
cartesianProduct (,)
...
Первое обращение