COMP3141 Exercise 07 (Week #09)
Download the Haskell skeleton Ex07.hs.
Recall the type-level natural numbers and their addition using type families from the
lecture in Week #7:
Toggle line numbers
1 data Nat = Z | S Nat
2
3 type family (+) (n : Nat) (m :
COMP3421
Vector geometry, Clipping With Solutions
Transformations
Object in model co-ordinates
Transform into world co-ordinates
Represent points in object as 1D
Matrices
Multiply by matrices to transform them
Coordinate frames
We can now think of a c
import Graphics.Gloss
main = display (InWindow "Exercise One" (200, 200) (10, 10) black picture2
- Only alter the following two definitions.
picture1 = Color red (rectangleWire 100 50)
picture2 = pictures [Color green (rectangleSolid 200 100), picture1]
i
cfw_-# LANGUAGE GADTs, EmptyDataDecls, TypeFamilies, TypeOperators, DataKinds, FlexibleInstances
#-
module Ex05 where
data BinaryTree t a where
Leaf : BinaryTree Empty a
Branch : a -> BinaryTree t a -> BinaryTree t a -> NonEmpty BinaryTree a
top : BinaryT
module Ex06 where
data List a = Nil | a : List a
data Format (fmt : List *) where
X : Format Nil
L : str -> Format fmt -> Format fmt
S : Format fmt -> Format (String : fmt)
I : Format fmt -> Format (Int : fmt)
type family FormatArgsThen (fmt : List *) (ty
COMP3141 Exercise 01 (Week #03)
Getting Started
Install the Haskell Platform and the Gloss Library on your work
environment
See the section Haskell notes which includes instructions on setting up your work
environment.
Part 0: Writing a compiling program
COMP3141 Exercise 02
QuickCheck and Search Trees
Download the Haskell skeleton Ex02.hs. It includes the support code described in
the following as well as stubs for the three functions that you must implement. The
QuickCheck properties discussed below are
COMP3141 Exercise 05 (Week #07)
Before you begin, make sure that you have completed the reading assignment from
the Machine-checked properties notes.
Safe Partial Functions (3 Marks)
Download the Haskell skeleton Ex05.hs. It includes a GADT-syntax version
COMP3141 Exercise 04 (Week #06)
Before you begin, make sure that you have completed the reading assignment from
the Effects notes.
Basic I/O (3 Mark)
Download the Haskell skeleton Ex04.hs. It contains stubs for the two functions you
got to implement.
Firs
COMP3141 Exercise 06 (Week #08)
Download the Haskell skeleton Ex06.hs.
Recall the C function printf, which splices values into a special kind of string, called
a format string:
Toggle line numbers
1 printf("Hello ! you are 0 years old!","Bob",3) / Prints
COMP3141 Exercise 08 (Week #10)
Download the Haskell skeleton Ex08.hs.
For this exercise, you may need to install the parallel package as follows:
cabal install parallel
Given the following definition of a binary tree
Toggle line numbers
1 data BinaryTree
COMP3141 Sample Exam Question
The following could be an exam question. The exam contains four such
questions, each of which comprises multiple subquestions. Here are the
example subquestions:
1. What is (mathematical) logic and how does it compare to prog
COMP3141 Sample Exam Solutions
The following could be an exam question. The exam contains four such
questions, each of which comprises multiple subquestions. Here are the
example subquestions:
1. What is (mathematical) logic and how does it compare to pro
COMP3141 Exercise 03 (Week #05)
QuickCheck and Search Trees
Download the Haskell skeleton Ex03.hs. It includes the support code described in
the following as well as stubs for the various functions that you must implement.
However, it does not include the
COMP3141 Exercise 09 (Week #11)
Download the Haskell skeleton Ex09.hs.
This exercise is a continuation from last week. Again, we have
Toggle line numbers
1 data BinaryTree a = Leaf | Branch a (BinaryTree a) (BinaryTree a)
deriving (Read, Show, Eq)
and a m