Module Utils

This module defines some utility functions for the partial evaluator.

Author: Björn Peemöller

Version: September 2015

Summary of exported operations:

none :: (a -> Bool) -> [a] -> Bool   
Does no element satisfy the predicate?
sameLength :: [a] -> [b] -> Bool   
Do two lists have the same length?
count :: a -> [a] -> Int   
Count the number of occurrences of an element in a list.
countBy :: (a -> Bool) -> [a] -> Int   
Count the number of elements in a list that satisfy the given predicate.
disjoint :: [a] -> [a] -> Bool   
Check if the two lists are disjoint.
dropLast :: Int -> [a] -> [a]   
Drop the last n elements from a given list.
lpad :: Int -> String -> String   
Pad a string to a specific length with space from the left side.
rpad :: Int -> String -> String   
Pad a string to a specific length with space from the right side.
indentStr :: Int -> String -> String   
Indent a String, possibly containing multiple lines via newline, by a given number of spaces for each single line.
(+\+) :: String -> String -> String   
String concatenation with newline in between.

Exported operations:

none :: (a -> Bool) -> [a] -> Bool   

Does no element satisfy the predicate?

sameLength :: [a] -> [b] -> Bool   

Do two lists have the same length?

count :: a -> [a] -> Int   

Count the number of occurrences of an element in a list.

countBy :: (a -> Bool) -> [a] -> Int   

Count the number of elements in a list that satisfy the given predicate.

disjoint :: [a] -> [a] -> Bool   

Check if the two lists are disjoint.

dropLast :: Int -> [a] -> [a]   

Drop the last n elements from a given list.

lpad :: Int -> String -> String   

Pad a string to a specific length with space from the left side.

rpad :: Int -> String -> String   

Pad a string to a specific length with space from the right side.

indentStr :: Int -> String -> String   

Indent a String, possibly containing multiple lines via newline, by a given number of spaces for each single line.

(+\+) :: String -> String -> String   

String concatenation with newline in between.

Further infos:
  • solution complete, i.e., able to compute all solutions