racket values video 0.9/4 — express values

December 17, 2019

Here’s Doctor Racket. Let’s use Intermediate Student With Lambda. We’ll talk
later about what that means. We need some graphics tools. Here’s how
we get them… We require them, in fact. F5 reads in those tools, so we can use them, and
Control-d gives us a bit more real estate to tinker with. Let’s get some graphics. Graphics are represented on computers as rectangular arrays of glowing pixels — colored dots. There’s a graphic. Let’s get some more. This graphic represents giraffes. I can copy it, and paste it into my
programming environment. I’ll copy and paste one more, but I bet you’ve already got the idea. We can manipulate these representations of graphics. For example, I can flip the array left
to right… looks like that. I can ask how many dots wide it is. I can ask how many dots tall it is. there’s some connecting theme about
these three graphics: dolphins, bicycles, and giraffes. Here’s what i have in mind. I can make a one-to-one correspondence
with little tally marks… five of them… on the bicycles. I can also do a one-to-one
correspondence with tallies on the giraffes… also five. I’ll do them slant-wise on the dolphins, just
to show that I’m not cheating… there are five dolphins. So the value I want to represent on the
computer is five, and here is how I represent it… not too surprising with the numeral five. I can represent a fraction five thirds… one-point-repeating-six. I can
represented it other ways too: right click, and i can do it is a mixed fraction, or as an improper fraction, or back again as
a decimal. Not so easy to exactly represent the
square root of 5/3… that hash-i says that this is an
inexact… just an approximation, and I can’t
represent it other ways. I can represent pretty big numbers, or at least ratios of some pretty big numbers. And, I’d also have the choice of viewing
those as mixed fractions or improper fractions. something else we represent on computer are strings of
characters. The number of characters in the string… called its length. Notice the double quote character at
either end of the string. We can represent truth and falsity, and
we can switch between them!

No Comments

Leave a Reply