copilot-libraries-3.2: Libraries for the Copilot language.
Copyright(c) 2011 National Institute of Aerospace / Galois Inc.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Copilot.Library.Utils

Description

Utility bounded-list functions (e.g., folds, scans, etc.)

Synopsis

Functions similar to the Prelude functions on lists

take :: (Integral a, Typed b) => a -> Stream b -> [Stream b] Source #

tails :: Typed a => Stream a -> [Stream a] Source #

cycle :: Typed a => [a] -> Stream a Source #

Folds

nfoldl :: (Typed a, Typed b) => Int -> (Stream a -> Stream b -> Stream a) -> Stream a -> Stream b -> Stream a Source #

nfoldl1 :: Typed a => Int -> (Stream a -> Stream a -> Stream a) -> Stream a -> Stream a Source #

nfoldr :: (Typed a, Typed b) => Int -> (Stream a -> Stream b -> Stream b) -> Stream b -> Stream a -> Stream b Source #

nfoldr1 :: Typed a => Int -> (Stream a -> Stream a -> Stream a) -> Stream a -> Stream a Source #

Scans

nscanl :: (Typed a, Typed b) => Int -> (Stream a -> Stream b -> Stream a) -> Stream a -> Stream b -> [Stream a] Source #

nscanr :: Typed a => Int -> (Stream a -> Stream b -> Stream b) -> Stream b -> Stream a -> [Stream b] Source #

nscanl1 :: Typed a => Int -> (Stream a -> Stream a -> Stream a) -> Stream a -> [Stream a] Source #

nscanr1 :: Typed a => Int -> (Stream a -> Stream a -> Stream a) -> Stream a -> [Stream a] Source #

Indexing

case' :: Typed a => [Stream Bool] -> [Stream a] -> Stream a Source #

Case-like function: The index of the first predicate that is true in the predicate list selects the stream result. If no predicate is true, the last element is chosen (default element)

(!!) :: (Typed a, Eq b, Num b, Typed b) => [Stream a] -> Stream b -> Stream a Source #

Index. WARNING: Very expensive! Consider using this only for very short lists.