teaching machines

CS 330 Lecture 20 – Static vs. Dynamic

March 16, 2015 by . Filed under cs330, lectures, spring 2015.

Agenda

TODO

Code

charAt.html

<!DOCTYPE html>
<html>
<head>
  <title>...</title>

  <script>

function at(stuff, index) {
  if (typeof stuff == 'string') {
    return stuff.charAt(index);
  } else if (typeof stuff == 'number') {
    var shifted = stuff / Math.pow(10, index);
    return Math.floor(shifted % 10);
  }
}

  </script>
</head>
<body>

<script>

document.write(at("la madrugada", 3));
document.write('<br/>');
document.write(at(1213, 3));

</script>
  
</body>
</html>

Haiku

on dynamic typing
Meals with him are slow
Before each bite, he must check
“You’re still an apple?”