teaching machines

CS 318: Lab 20 – Animations

Dear students, Today we explore transitions to add a little life to our webpages using CSS transitions. As an example, we’ll create a list whose items pop out when hovered. We start with a list: <ul> <li>one</li> <li>two</li> <li>three</li> <li>four</li> </ul> Let’s add some background color to each item: li { background-color: blue; color: white; […]

CS 330: Lecture 27 – Lambdas and Higher-Order Functions

Dear students: Let’s start with a Program This: Using composition and point-free style, write a function that yields the square of the elements’ sum. Using sum and ^. It might help to start without composition and point-free style. Here’s my solution. squaredSum :: Num a => [a] -> a squaredSum list = sum list ^ […]

Multiple Assignment in Twoville

As I dream up animations in Twoville, I find myself generating a lot of shapes that share properties with other shapes. For instance, these two circles have the same radius and color: a = circle() b = circle() a.radius = 10 b.radius = 10 a.rgb = [1, 1, 0] b.rgb = [1, 1, 0] I […]

CS 330: Lecture 26 – Ways of Making Functions: Composition and Lambdas

Dear students: There are at least four ways of defining functions in Haskell: by defining a named abstraction of some algorithm by partially applying parameters to an existing function to get a new function expecting only the remaining parameters by composing a gauntlet of functions together by defining unnamed lambdas We’ve seen the first two. […]

CS 318: Lab 19 – Forms

Dear students, Thus far we have focused on one half of the communication process: the “speaking” of our ideas to our sites’ visitors. Generally this is not enough. We would like to hear back from our visitors. We want them to join a mailing list, make an order, contribute an idea, vote, and who knows […]

CS 330: Lecture 25 – Ways of Making Functions: Composition

Dear students: Let’s warm back up to Haskell by writing some functions to review the ideas we’ve seen in Haskell so far. Here’s our first: Given three points in 2D space, find a fourth which forms a parallelogram. There are many possible answers to this. The trick is to find the vector between two of […]

CS 318: Lab 18 – Tabbed Viewing

Dear students, Last time we started implementing dropdown menus. We decided to continue that effort today, though I do want to add one extra and related exercised: a tabbed viewer. Here’s your TODO list: Breathe easy! See you next time! Sincerely, Lab First, we finish up our lab 17 exercise on switching between small and […]

With Blocks in Twoville

In my software engineering class in college, Dr. Drake dropped on us a half-written piece of software that managed a database of movies. Our challenge was to improve it. It was the first and only time I’ve touched Visual Basic, and I remember only one thing about the project and the language: with-statements. Suppose you’re […]

CS 330: Lecture 24 – Local Variables, Lists, and Pattern Matching

Let’s write a function. Turn to a neighbor and discuss how you’d solve this: You are given two points. On the perimeter of what circle do both points lie? Write things down and draw pictures to help your thinking. A very natural thing to do is start off with something like this: circletween :: Double […]

CS 318: Lab 17 – Hamburger Menus

Dear students, Today’s lab is designed around something I saw in a lot of your mockups: dropdown navigation menus. There aren’t a lot of new ideas here, but application of old ones. So, I won’t talk much. However, in this lab we start to incorporate a few of the pseudoclass selectors that you met in […]

1 54 55 56 57 58 204