René's URL Explorer Experiment


Title: Chain

Open Graph Title: Python itertools.chain and (++)

Description: To concatenate two Python iterators, we use ‘itertools.chain’. The resulting iterator consists of each element from the first argument, followed by each element of the second argument. The corresponding Haskell function is called (++). The ‘chain’ function is variadic; it can accept any number of arguments, not just two. This makes it easy to chain together any number of iterators without having to use nested function applications. Haskell doesn’t have variadic functions, but it does let you define infix operators, which can be used to get a similar convenient effect. The (++) function concatenates exactly two lists, but infix notation makes it easy to chain together as many concatenations as you like. If you aren’t chaining together some fixed number of lists, but rather a list of lists, you can use ’chain.from_iterable’. The Haskell equivalent is called ‘concat’.

Open Graph Description: To concatenate two Python iterators, we use ‘itertools.chain’. The corresponding Haskell function is called (++).

X: @typeclasses

direct link

Domain: typeclasses.com

theme-color#31365f
og:imagehttps://static.typeclasses.com/twitter-python__itertools-chain-c196d36b30.png
og:typearticle
article:taglists
twitter:cardsummary_large_image

Links:

https://typeclasses.com/
Pricinghttps://typeclasses.com/pricing
Sign uphttps://typeclasses.com/sign-up
Log inhttps://typeclasses.com/log-in
https://typeclasses.com/
Transition to Haskellhttps://typeclasses.com/learn-haskell/from-other-languages
From Pythonhttps://typeclasses.com/python
Iteratorshttps://typeclasses.com/python/iterators
https://typeclasses.com/python/iteration-to-infinity
https://typeclasses.com/python/map
infix operatorhttps://typeclasses.com/index/infix-operator
iteratorshttps://typeclasses.com/index/iterators
listshttps://typeclasses.com/index/lists
itertools.chainhttps://docs.python.org/3/library/itertools.html#itertools.chain
https://typeclasses.com/python/itertools-chain#cb1-1
https://typeclasses.com/python/itertools-chain#cb2-1
https://typeclasses.com/python/itertools-chain#cb2-2
(++)https://hackage.haskell.org/package/base-4.12.0.0/docs/Data-List.html#v:-43--43-
semigrouphttps://typeclasses.com/semigroup
Join Type Classeshttps://typeclasses.com/pricing
Abouthttps://typeclasses.com/company
Contact ushttps://typeclasses.com/contact
Privacyhttps://typeclasses.com/privacy
https://twitter.com/typeclasses
https://github.com/typeclasses

Viewport: width=device-width, initial-scale=1


URLs of crawlers that visited me.