Safe HaskellSafe

S03

Contents

Description

Solutions to Exercises for November 16, 2018

Synopsis

Exercise 2

Exercise 3

ptriples :: (Enum c, Eq c, Num c) => c -> [(c, c, c)] Source #

The function ptriples computes all so called Pythagorean triples with components up to a certain size.

Exercise 4

prefixes :: [a] -> [[a]] Source #

The function prefixes computes all prefixes of a given list (including the list itself) in increasing order of length.

suffixes :: [a] -> [[a]] Source #

The function suffixes computes all suffixes of a given list (including the list itself) in decreasing order of length.

Exercise 5

sublists :: [a] -> [[a]] Source #

The function sublists computes all sublists of a given list in increasing order of length. Here, a sublist is obtained from a list by omitting arbitrarily many of its arguments.

Exercise 6

smartStack :: [Picture] -> Picture Source #

Variants of stack and spread that work for pictures of different dimensions (by centering smaller pictures with respect to bigger ones).

smartTile :: [[Picture]] -> Picture Source #

A variant of tile that works for pictures of different dimensions (by centering smaller pictures with respect to bigger ones).