Fill in the blanks in the following lambda expression. The lambda should take two Numbers as inputs and return a Number that's the product of the two input Numbers.
a: ____
b: ____
c: ____
a: lam
b: x, y
or y, x
c: end
Can all lambda expressions be rewritten as functions?
( ) Yes
( ) No
(X) Yes
( ) No
You can think of lambda expressions as short-hand for one-line functions.
What will happen if we write the following in the definitions window and then click 'Run'?
Try to answer without using Pyret.
( ) 25 will be output in the interactions window
( ) Nothing
( ) "The declaration of the identifier named num shadows a previous declaration of an identifier also named num"
( ) Error: "The identifier 'num' is unbound"
( ) Error: "The declaration of the identifier named square shadows a previous declaration of an identifier also named square"
(X) 25 will be output in the interactions window
( ) Nothing
( ) "The declaration of the identifier named num shadows a previous declaration of an identifier also named num"
( ) Error: "The identifier 'num' is unbound"
( ) Error: "The declaration of the identifier named square shadows a previous declaration of an identifier also named square"
Since square(num)
is 25.
What concept from this week of class is least clear to you?