COMPSCI 1JC3 Lecture 4: comp sci lecture 4 - sep 14

82 views3 pages

Document Summary

Note **type the statement within the quotation marks import html exposing (text) ** Example: a function called fun, defined as below: fun x = 7 * x. This line has two definitions, the definition of x and the definition of fun. Can use the definition of x elsewhere as well. Input the function fun into your main statement main = text ( tostring (fun 2) ) Next is going back to tower of hanoi from previous class to define new type of thing use the word type type platform = a | b | c. Can put together any combination of numbers and letters, as long as letter is capital. Can call platform whatever you want as long as it"s a capital letter. Only one input to tower, that input is the height. 0 -> [] n -> (tower (n-1)) ++ [n] ++ (tower (n-1)) The above is using the divide and conquer strategy.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents