A record (where the two fields are floats)
A character is a unit of textual information; a grapheme is a unit of writing
A code point
name with value "Alice" and the second of which has the label location whose value is a tuple over the values -8 and 33.831, respectively.
&(name: "Alice", location: (-8, 33.831))
A literal directly represents a value; a variable stores a value
JavaScript generators always produce objects, even when they have finished
Python generators always produce dictionaries, even when they have finished
JavaScript generators throw an exception when exhausted
Python generators raise an exception when exhausted
An expression evaluates to a value; a statement performs an action
A function having a single parameter which is an object, expressed with an object pattern and called with an object expression
x || y as a conditional expression.
x ? x : y
a+(b-c) and (a+b)-c produce different results?
Lots of ways! (1) Overflow: for the Swift type Int8, 100+(50-30) is 120 but (100+50)-30 crashes. (2) Roundoff: 0.1+(0.2-0.1) is 0.2 but (0.1+0.2)-0.1 is 0.20000000000000004. (3) Types: In JS, "5"+(1-8) is "5-7" but ("5"+1)-8 is 43.
match statement is reasonable but JavaScript’s switch statement is an abomination?
JavaScript switch cases fall through
for i := 1,10,3 do print(i) end in JavaScript and TypeScript?for (let i = 1; i <= 10; i += 3) { console.log(i); }
d1 and d2 in Python? (By merge we mean a shallow merge, i.e., returns a new dictionary with shallow copies.) Circle the best answer.
d1 | d2 {*d1, *d2} {**d1, **d2} d1.merge(d2) {...d1, ...d2}
-0 "" [] A function without a return statement
$(\textsf{Nat}^* \times \textsf{Nat}^*) \to (\textsf{Bool} \mid \textsf{Int64})$
thirdElement that accepts a list of elements of type $t$, that somehow returns its third element if it exists. (This question is assessing your ability to define this function well, given that the argument may not have a third element.)
$\textsf{thirdElement}\!: t* \to t\textsf{?}$
$\textsf{thirdElement}\,[\,] = \textsf{none}$
$\textsf{thirdElement}\,(x \textsf{::} [\,]) = \textsf{none}$
$\textsf{thirdElement}\,(x \textsf{::} y \textsf{::} [\,]) = \textsf{none}$
$\textsf{thirdElement}\,(x \textsf{::} y \textsf{::} z \textsf{::} w) = \textsf{some}\;z$
Static+Strong Static+Weak Dynamic+Strong Dynamic+Weak
With the type T|undefined for some type T
TypeError in JavaScript? Circle the best answer.
Accessing a property of an object that does not exist
Invoking a class name as a function without the new operator
Invoking a number as a function
Using null as an index into an array