CSE 130 Lecture Notes - Lecture 3: Syntactic Sugar, Evaluation Strategy, Function Application
Document Summary
Control flow, operators, classes, etc w/ syntactic sugar: ( () => { Use lambda calculus to extend to different features. Evaluation strategy - only evaluate if it needs to be used. Semantics - the meaning of the program and how we interpret it. Expressions : e ::= x | x. e | e 1 e 2. Same a s x => e in js. Assume 2 and + are encoded by functions. In js: x => 2 + x ( x. (2+x)) 5. In js: (x => 2+x) (5) x = > { return 2 + x; } ( f. (f 3)) ( x. (x + 1)) In js: ( f => f(3) ) ( x => x+1 ) In js: f => (x => f ( (x))) //argument f that returns a function which takes in x as an argument and. Js: ((f => (x => f (f (x)))) (x => x+1)) (4)