enumFromThenTo -package:prelude-safeenum
Used in Haskell's translation of
[n,n'..m] with
[n,n'..m]
= enumFromThenTo n n' m, a possible implementation being
enumFromThenTo n n' m = worker (f x) (c x) n m,
x =
fromEnum n' - fromEnum n,
c x = bool (>=) ((x
0)
f n y
| n > 0 = f (n - 1) (succ y)
| n < 0 = f (n + 1) (pred y)
| otherwise = y
and
worker s c v m
| c v m = v : worker s c (s v) m
| otherwise = []
Examples
enumFromThenTo 4 2 -6 :: [Integer] =
[4,2,0,-2,-4,-6]
enumFromThenTo 6 8 2 :: [Int] = []
O(n) Enumerate values from
x to
y with a
specific step
z.
WARNING: This operation can be very inefficient. If possible,
use
enumFromStepN instead.
Enumerate values with a given step.
WARNING: This operations is very inefficient. If at all
possible, use
enumFromStepN instead.
Enumerate values with a given step.
WARNING: This operation is very inefficient. If at all
possible, use
enumFromStepN instead.
O(n) Enumerate values from
x to
y with a
specific step
z.
WARNING: This operation can be very inefficient. If possible,
use
enumFromStepN instead.
O(n) Enumerate values from
x to
y with a
specific step
z.
WARNING: This operation can be very inefficient. If possible,
use
enumFromStepN instead.
O(n) Enumerate values from
x to
y with a
specific step
z.
WARNING: This operation can be very inefficient. If possible,
use
enumFromStepN instead.
O(n) Enumerate values from
x to
y with a
specific step
z.
WARNING: This operation can be very inefficient. If possible,
use
enumFromStepN instead.
hedgehog Hedgehog.Internal.Prelude,
base-compat Prelude.Compat,
protolude Protolude Protolude.Base,
relude Relude.Enum,
base-prelude BasePrelude,
classy-prelude ClassyPrelude,
numeric-prelude NumericPrelude NumericPrelude.Base,
Cabal-syntax Distribution.Compat.Prelude,
ihaskell IHaskellPrelude,
basement Basement.Compat.Base Basement.Imports,
numhask NumHask.Prelude,
clash-prelude Clash.HaskellPrelude,
foundation Foundation,
ghc-lib-parser GHC.Prelude.Basic,
prelude-compat Prelude2010,
dimensional Numeric.Units.Dimensional.Prelude,
rebase Rebase.Prelude,
mixed-types-num Numeric.MixedTypes.PreludeHiding,
xmonad-contrib XMonad.Config.Prime,
constrained-categories Control.Category.Constrained.Prelude Control.Category.Hask,
copilot-language Copilot.Language.Prelude,
incipit-base Incipit.Base,
LambdaHack Game.LambdaHack.Core.Prelude,
cabal-install-solver Distribution.Solver.Compat.Prelude,
faktory Faktory.Prelude,
yesod-paginator Yesod.Paginator.Prelude,
distribution-opensuse OpenSuse.Prelude,
hledger-web Hledger.Web.Import Used in Haskell's translation of
[n,n'..m] with
[n,n'..m]
= enumFromThenTo n n' m, a possible implementation being
enumFromThenTo n n' m = worker (f x) (c x) n m,
x =
fromEnum n' - fromEnum n,
c x = bool (>=) ((x
0) f n y | n > 0 = f (n - 1) (succ y) | n < 0 = f (n +
1) (pred y) | otherwise = y and
worker s c v m | c v m = v :
worker s c (s v) m | otherwise = [] For example:
enumFromThenTo 4 2 -6 :: [Integer] =
[4,2,0,-2,-4,-6]
enumFromThenTo 6 8 2 :: [Int] = []
O(n) Enumerate values from
x to
y with a
specific step
z.
WARNING: This operation can be very inefficient. If at all
possible, use
enumFromStepN instead.
O(n) Enumerate values from
x to
y with a
specific step
z.
WARNING: This operation can be very inefficient. If at all
possible, use
enumFromStepN instead.
O(n) Enumerate values from
x to
y with a
specific step
z.
WARNING: This operation can be very inefficient. If at all
possible, use
enumFromStepN instead.
O(n) Enumerate values from
x to
y with a
specific step
z.
WARNING: This operation can be very inefficient. If at all
possible, use
enumFromStepN instead.
Used in Haskell's translation of [n,n'..m].
O(n) Enumerate values from x to y with a specific step z.
If an enumeration does not use meaningful indices,
Nothing is
returned, otherwise,
Just containing a non-empty vector.
WARNING: This operation can be very inefficient. If at all
possible, use
enumFromStepN instead.
Enumerate values with a given step.
WARNING: This operation is very inefficient. If at all
possible, use
enumFromStepN instead.
bounded arithmetic sequence, with first two elements given [from,
then .. to]