CSE 130 Lecture Notes - Lecture 8: Function Application, Kolmogorov Space, Length Function

30 views3 pages

Document Summary

Lambda abstraction ( x. e) t0 = t1 t2. Function declaration (f x = e) t0 = t1 t2. Function application (f x) t0 = t1 t2. Int t4 = int->int->int t3 t4 = int -> int -> int t3 (t1 t6) = int->int->int t1 t6 = int->int t1 = int, t6 = int. T0 = (int->t4) t4 f :: (int->t4)->t4. Polymorphic function (polymorphism) f :: (int->t4) -> t4. Function that takes a function as an argument, an int as an argument and returns . Haskell polymorphic function: f is compiled to 1 function. C++ templated function: give you the same expressibility . Tradeoff: for c++, you don"t have to check the type in runtime! You have to deal with linkage issues (haskell knows it"ll work for all cases!) Parametricity - the more general the type, the more restricting the implementation! Eg: apply :: (a->b) -> a -> b (we don"t know its type we can"t do many things with it)

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers