{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Lecture15PatternsOfComputation

# Lecture15PatternsOfComputation - Lecture 15 CS 2603 Applied...

This preview shows pages 1–6. Sign up to view the full content.

CS2603 Applied Logic for Hardware and Software Rex Page – University of Oklahoma 1 Lecture 15 — CS 2603 Applied Logic for Hardware and Software Patterns of Computation

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
CS2603 Applied Logic for Hardware and Software Rex Page – University of Oklahoma 2 Type Specifications Every Haskell Entity Has a Type x, y, z :: Integer -- this is a type spec, not an axiom x, y, and z have type Integer Examples of equations defining x, y, and z x = 1 -- this is an axiom: x means 1 y = 3 + 7 -- another axiom: y means 10 z = sum[49, 12, 22, -19] -- the variable z means 64 xs, ys :: [Integer] xs and ys are sequences with elements of type Integer Examples of axioms defining xs and ys xs = [29, -2, x, 3*y, 0, x+z] Equivalent axiom: xs = [29, -2, 1, 30, 0, 65] ys = [1 .. 4] ++ xs Equivalent axiom: ys = [1, 2, 3,4] ++ [ 29, -2, 1, 30, 0, 65] Another equivalent axiom: ys = [1, 2, 3,4, 29, -2, 1, 30, 0, 65]