CS135 Lecture Notes - Lecture 1: Functional Programming

155 views2 pages

Document Summary

Imperative: based on frequent changes to data (java, turing, c++) Function: based on the computation of new values rather than the transformation of old ones. Easier to design and reason about programs. Syntax (how to say it), expressiveness (how easy it is to say and understand), and semantics (the meaning of what"s being said) Definition of a function consists of function name and parameters. We evaluate each of the arguments to yield values. Only apply a function when all of its arguments are values (not general expressions). g(4, f(2)) = g(4, 4) = 8. The drracket environment (6 4)(3 + 2) becomes ( ( 6 4) (+ 3 2)) Expressions whose values are not rational numbers are flagged as being inexact. A function definition consists of: a name for the function, a list of parameters, a single body expression. define is a special form (looks like a racket function, but not all of its arguments are evaluated).

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

Related Documents