ninetynine-1.3.0: Ninety-Nine Haskell Problems
CopyrightCopyright (C) 2021 Yoo Chung
LicenseGPL-3.0-or-later
Maintainerdev@chungyc.org
Safe HaskellSafe-Inferred
LanguageGHC2021

Problems.P18

Description

Part of Ninety-Nine Haskell Problems. Some solutions are in Solutions.P18.

Synopsis

Documentation

slice :: [a] -> Int -> Int -> [a] Source #

Extract a slice from a list.

Given two indices, i and k, the slice is the list containing the elements between the i'th and k'th element of the original list, with both limits included. Start counting the elements with 1.

Examples

>>> slice "abcdefghijk" 3 7
"cdefg"