CLASS:  ITEC 380—11
STUDENT:  Steve Oake
SCHOOL:  RADFORD
DATE: August 31, 2015

Karasch and Associates
Captioned by: Adina King
"This text is being provided in a rough draft format.  Communication Access Realtime Translation (CART) is provided in order to facilitate communication accessibility and may not be a totally verbatim record of the class."
		(Call started at 5:30)
» INSTRUCTOR:  Half hour earlier, half hour later, how do you feel about that?  If we say 5:45 how would you feel about that -- 5:45 to 8:45 -- there's a rough commute or if you're leaving work a little bit late?  Okay, so let's go ahead and type it here to make it official, but we'll put it here -- well, I'll nominate that we start at 5:45 next week -- if you don't like it send me an e—mail.  The official time is on the books -- anyone that says no, it's not good for me and I'll take that into account.  Now let's plan on -- send an e—mail if you're not so sure about that.
Okay.  Gosh, my screen sharing is not going so well, and that's kind of a problem.  Just has loading Adobe connect.
I might quit this and come back and see if that helps that.  See what Steve is saying.
It says loading Adobe connect -- I'm going to try to log out and back in -- sorry about this.  Let me stop this recording.  This will take about five minutes.  We don't need this part recording yet.  I'll be right back.  Stay there but just chat with each other.  If you want to go to by the way, there's a web page for the class.  I'm also getting the D2L set up, but I'll let you all look -- I'll paste in the URL.  I'll be checking that out as I log out analog back in again.
 » INSTRUCTOR:  Am I back with voice and video -- good.  Let me try again.  I started in Firefox and that seemed to work better.
I'm going to be sharing my entire desktop there.  Messages are kind of hard for me to see -- I need to start recording the meeting.
Okay.  So I apologize for that technical delay.  Every time I teach a class online a technical delay goes down about two minutes.
Okay.  There will be lecture slides.  Any materials I have, I will put on the web page that I posted there.  We'll use both desired to learn and that web page and I'll talk more about that -- we'll talk about interesting stuff of where to find stuff and so on and these recordings, these hour chunk blocks -- they're not the best way to recover material but they're recorded material.
Okay.  I'm sharing my screen and I will maybe sure the camera pod doesn't cover any of the chat window.  Let me move this down to that corner.  Okay.
Sounds good.  Again, if you leave messages, I'll see a quick pop up when a message comes up, if I don't get to it put an explanation point to come back and find it.
We're here and we're looking at programming languages.  Now can people see my web browser?  This is the same link that I posted, except I went to the lecture's link and there's only one lecture posted so far.
And a couple things that are pertinent, John (inaudible) you can never understand one language until you understand at least two -- let's see if that holds true.  If you believe that in a few weeks -- (inaudible) the -- the limits of my language -- it's to expand your programming world.  We'll see if I'm successful at that.  In particular other programming languages let you learn other approaches.  Even if you don't use other languages in your day—to—day work or applications, the ideas you encounter will still change the way you think about a problem, the way you approach it in whatever language you do use.
People ask programming languages we're going to learn 12 different languages, not really.  We'll look at several different languages, but trying to get different paradigms and ways of thinking they have that might be.
What else -- practice of learning new ideas to approaches.  We'll start thinking about -- you'll start realizing more -- thinking about things when you're using Java, what things Java is making easy for you and when it's in your way especially other languages you might have tried or looked at.
I had -- a while back we redid our kitchen a little bit and we got a new sink and she wanted a new sink when you tap it, it turns on or off -- I'm like that's cool -- the price tag -- for that much extra money I'm looking to move the northbound a half an inch -- I lost that battle.  And I was downstairs where we don't have that sink, I was doing something in the laundry room and I turned on the water and I just tapped it -- this is just a regular old sink, I go and turn it and washing stuff out.  I tap it again -- I need to turn the northbound again -- now I'm totally annoyed having these things -- turning the knob -- I'm used to the touch interface.  Maybe this class will have some things -- using Java or python -- you might get exposed to ideas -- I want to do it that way but I can in Java but it's really difficult and you might get from us straight the whole time.  If so then maybe I expanded your world about different ways to approach things.
Okay.  And what else?  I'm going to start sort of -- I know -- it's slightly a example -- arithmetic and how a choice of language -- I'm going to say a language helps steer the decisions you might make as a programmer.  Making some things easier than others perhaps.  I'm going to start with numbers.
So first let me bring up a little Java interpreter here -- I have a window -- but this pane here, I can type in a Java expression -- two plus three and it will come back 5 -- since Java comes back -- which is an INT -- is that legible to people?  That font?  It probably depends on the screen you're all using.
Chris says yeah.  So if you're trying to watch this case on your I—Phone while driving you're going to have a hard time.  So 2 plus 3 is 5.
Okay.  That's cool.  I have a nephew, five years old and I can ask him what's 2 plus 3 and he says 5.  I can ask him if you have two Apples and three Apples what's that -- if I say what's two billion plus 3 billion -- Java will come back and knows that that's error -- integer number two large -- let me try 2 billion plus 2 billion -- my nephew would be all over that -- Java, we get answer, negative 294 million -- what's the one word that we did that addition -- it's sort of a particular word that people use overflow.
 You're right, it wraps around.  Java will count up which way is forward to you -- think about going around the line -- one, two, three, -- when it gets up to 2 billion it will wrap around and come over here and keep counting up.  We can actually look at -- integer.max -- when you look at that expression -- integer is a name of a class -- max value is all class -- it's probably a constant field inside that class.  Integer.max -- is 2 billion 470 million -- if I take that -- I can't get that number 2,147,648, so we see it wraps around and we get a negative number.  We pass this 2.1 billion and wrap around at that point.
Wrapped around almost all the way back to zero.  Just a couple of million of zeros.
Okay.  Anyway so my little five year old nephew is better at Java than arithmetic -- Java gets 2 billion plus 2 billion -- what should we do instead in Java rather than using (inaudible) -- different data type -- so what the web page is -- maybe what people suggest or try doing -- I'm having (inaudible) -- what data type should I use?  Long -- it's built in.  And I can actually look inside, there's a classical L long -- if you know your Java -- I presume that your Java is pretty decent -- not really requiring it but I'll refer to things in that explanation -- if not read up on some of these things -- what's a constant field and a static field inside a class -- it's a wrapper class specifically designed to have one field that is a primitive long.
Java uses, INT by default -- it's much bigger -- it's a huge number but you will eventually overflow that.  If you add one on to that you will not get the correct answer.  So using (inaudible) you will overflow so -- all you've ever done is program in Java, you might think that's the way things are, that's just life.  Well let's look at python -- I'll pull up a terminal window here -- make it big enough.  Python I'm going to try the same thing here -- 2 billion plus 2 billion, now what are we going to get -- is it going to wrap around like Java or give the correct answer?  It will give the correct answer.  Python can handle big numbers -- let's see if you can get bigger than long -- let's type in a big number.
That's a pretty big number -- I'm going to add one to it.  Something adding 789 -- adding one -- I get a number ending in .90 -- it's not limited by (inaudible) and long -- it's not due to computer languages.
Let's go back and look at the Java for a second.  By the way if you want to use longs, you can do things like 43 -- if I put a capital L at the end of a number that will make it long by default so 43 L Java will give me a long.  So that's the closest you get to getting longs by default if you go in and thirty—three in an L.
So first of all, here's a question -- why does Java -- why do INS overflow at 2 billion?  Why do they overflow at all?  Why does it happen inside Java?
Any guesses -- ideas -- we're trying to read the mind of Java developers -- Shawn has it -- internally we're going to represent all our integers that's 32 bit numbers -- it's going to take 32 bits -- let me do another one.  This plus this plus -- how are these numbers stored internally?  It turns out this number doesn't fit into 32 bits.  Neither does this number here.  And yet I can do this and I can do arithmetic on it -- I can end in four -- so I must have correctly added these two numbers.  So if Java's understand is a 32 number -- it keeps the lowest 32 bits as your answer.  How does python represent these numbers you think?  The fact that we get numbers as big as we like, what do you think it's doing under the hood?  Here trying to guess, we don't really know for sure.
So some sort of carry.
What data structure do you think they're using?  Java data structure of a fixed 32 bit field, what is Java (inaudible) using?  Data structure from CS 2 come to mind?
I'm fishing here -- string -- not quite using a string because you think of these things as strings but strings are good for text, pulling out characters from the middle of them but not really good for addition, there is some representation going on.  Similar to a strange, I'm going to guess they're using some sort of as using a link list of digits.  An 8 followed by an 8, followed by a 9, followed by a 2, 3, 4 and however they get to the end of the list -- probably a link list.  It's not a list of (inaudible) it's not a list of strings -- it's a list of digits.
They're probably a little smarter -- you can get more efficient by putting two, three or four digits -- you can probably put a link list of numbers where each number is close to 2 billion and use those, use a link list of 32 bits -- and how do you add two lists of digits -- you can do the same thing you did in elementary school -- you take these two numbers, you line them up -- one over the other and add digit, to digit, to digit and do that carrying like Steve said.
So we'll use that algorithm  -- link is using digits -- 32 to the 32, which is better -- what are the tradeoffs?  We saw that python gets answers that Java gets wrong.  Why did Java choose to get the wrong answer -- what do they get in exchange for that?  Why do they choose not do what -- make sure Steve doesn't answer all the questions here -- it's going to be a trade off -- the Java designers are very smart people -- they're very aware of this trade off when they made it.  Shawn and Steve answering questions here.
Yes, so the Java designer said we're going to go ahead -- how long does it take these two to add these two links of digits -- it can take a long time -- it takes a little while to add very large numbers.  How long does it take to add two (inaudible) in Java -- this is done in hardware -- there's a hardware to add the two bits -- Java said we're not going to do the correct arithmetic but give you the wrong answer very quickly.
Python said we're going to always give you the right answer but it's going to take a long time sometimes if you have very large -- and they try to optimize -- they try to be smart if the digits are very small to fit in 32 bits or -- here's what I want to say -- if they're small enough to use in 32 bits then add them toed hardware -- it's basically what they do.  If the numbers are small they get good performance.  If you're in python and you grab a chunk of memory, do you need to know is this a number that's fitting in 32 bits or a number of the first digit of the whole linked list and I need to follow a link list and get more information.
That's a little bit -- here's a sketch -- they don't need all 32 bits, they're going to use -- let's try using 31 bits and that very first bit is going to be zero one -- this if that lead bit is a one it's going to mean the rest of your bits you have is not the whole number it's a beginning of the link list -- maybe it's a pointer to where the other digits are -- so that lead one bit is kind of a tag.  Basically take that lead bit as a tack and the remaining 31 bits are a real number if it fits in the number -- or it will tell us to do something else.
How do you handle negative numbers -- of the remaining 31 bitted that lead bit indicates the sign.
I'm using zero there, you get the same (inaudible) -- you can use the hardware overflow or the hardware to add the two numbers and it works correctly so it's a clever scheme there.
We're cause this tagging the data -- the chunk of memory plus the few tags -- here's how they do it -- they do it like this and probably very similar in python -- if that lead bit is a zero that lead bit (inaudible) -- if it's a one, the top three or four bits might be a tag and the next three or four might have values of it's a string, it's a double, it's a beginning of a link list of a really long integer -- but every piece of data has a few piece of tags saying what type is that.
Those are some of the ideas -- the python -- circuitry of working with numbers has to pay attention -- it has to provide that tag -- is it long int -- if you're on a 64 bit machine you might handle differently and use different tricks.
There's a quote that might be on the web page -- compute science is the art of seeing the trees and the forest simultaneously.  I had a class -- he may have told me that -- he what brought that quote to my attention meaning at the same time we're talking about high level interface just adding numbers -- what is the correct result for adding numbers and at the same time what is the low limitation, what ask the impact of cost performance -- every time you do addition in python, there are small numbers but there are checking that needs to be done on that very first tag bit.  So using regular small numbers you do pay some penalty.
Computers are awfully fast.  The pent may not be that bad in most situations.
Okay.  Don't worry, I have not forgotten the question of where are we going with this -- how does different languages change our attitudes on things, how does a language choice steer us through certain things -- we're seeing there's a difference between python and Java in numbers.
Let's go -- before we come back to full correct integer in Java -- this is not stuff that necessarily will be on the test but it is the issues that we're talking about.  I'm not going to quiz you exactly on how many bits does Java use or what is long max value -- that's stuff you can look up.  Knowing that there is this overflow and being aware of that, it's not intrinsic to the language that's the more important thing.
Let's talk about doubles -- let's talk about doubles -- I'm going to go back to Java -- I'm going to ask you -- let's look at -- 7 divided by 25 -- I'm going to make it easy -- 7 divided by 25 and take that result and multiply it back by 25—so what should the answer be?  Hopefully you're all good on this -- better get 7 right?  So I'm going to hit enter -- now your Java language -- any guesses what I'm going to get?  Hint -- the answer is not going to be 7 -- Mark suggested zero.  He is right on.
Why do we get zero?  Somebody besides Mark?  Why did Java say this is zero?  This is something that was covered in your Java one course -- and tripped you up several times as well.
One of my pet peeves -- I show people programming is fun and makes sense and they get things like this and it's doesn't make sense and it's definitely not none --
What is 7 divided by 25 -- that should be a fraction -- so I phrased it differently Shawn -- I would say slash in Java can mean two different things -- what can it mean in Java?
So it can mean int -- it can mean int for division or real division -- and it depends on context.  If you have a slash between two int year going to do integer division -- like 16/3 of 16 Apples and 3 friends -- everyone gets three Apples and everyone gets one Apple left over -- another way of saying this is how many times does 3 go into 16 -- it goes in 5 times with remainder of 1 -- if you're using int.
But if you're using doubles what is 2.5 divided 3.7 I'll get 0.6756756756757 as a double some here slash means real division.
What do you call it -- what do we call it one function -- overloaded -- slash is overloaded in Java.
Let's look here in python 3 -- we have 16 divided by 3 -- or 7 divided by 25 -- 16 slash slash three -- that gives integer division.  I figured the rule and python came along and said that's a pretty stupid function to overload.  It's confusing.  Two different functions let's give them two different names -- call it slash real division or slash slash for integer division.  I get back 45 minutes in my Java one class and I don't turn off a bunch of beginning programmers think they're getting stupid answers that don't make sense.
So that's one thing that python taught me -- you shouldn't overlook slash but the slash slash is a good name for this.
Okay.  Let's go back now where am I in Java -- so 7 divided by 25 times 25 -- so first this integer division -- that's there and we learned something interesting by comparing different language -- let's go back to floating point -- if I make these doubles then 7 divided by 25, that's going to be real value, 7 divided by 25 -- we can do that in our heads -- I can't divide 725 in my head -- what do I like about 25 -- it's a quarter of 100 -- 7 over 25 times 4 that's 28 over 100 or .28.
Any way -- I don't expect my 7 year old nephew to get.
He's on to me -- asking him a trick question -- this will give the answer of course of 7.00000001.  Round off error.
Round off error and you learn about this in your class and use doubles.  This is enough -- I'm going to write it down here -- I'll make sure it's on the web page as well.
A double is an proximate value approximation of the real answer.
When every you use double go ahead and think to yourself I'm using something that is close -- pretty good approximation, it's good to 14 decimal places but it is an approximation and if I ever use doubles I should be aware that I'm going to be a off.  When I do things like 7 divided 25 times 25 and is that equal equal to 7 -- I get false because they're not.  I want 0.001 -- if I have two things that are correct to the answer and I want to tell if they're equal I should look at them and see if they're both really close to each other.  If they to 12 decimal places I may say that is as doubles -- I'll call them equal because they're so close to each other I know they both contain some error and that's the best I can do.  Doubles are front with a little bit of parallel -- be careful when you use doubles -- and another caveat, doubles are approximation -- never use equal equal to compare doubles, instead see if the difference is small.
We can spend ten minutes talking about the right way to compare doubles and what does small mean and should I provide tolerance and a bunch of issues.  Just a programmer don't use equal to compare doubles.  It takes two doubles and tells if they're awfully close to each other.
Okay.  So Java has this issue with round off error and doubles and doubles are bad.  So now the question is that intrinsic to computers or no?  So the overflow of integer -- overflow integers and round off for doubles two different problems.  The overflow or integers was not intrinsic to computers and some things do the right thing by default.
So what about this -- let's go look at python and see what it does.
We can go and look at 7 divided by 25 times 25 -- their answer is -- python also has its round off error.
By the way once we know what's going on -- 7 times 25 divided by 25 -- how about this -- 14 times 25 divided by 25 -- the answer is not 14 -- you're onto me -- it's 14.000001 -- 14.00002 -- well he guess 14 is twice as big as 7 so maybe the error got doubled.  Okay.
Let me try 21.  What's 21 divided by 25 times 25 -- now you're like 21, that's three time 7 -- it's not exactly 21 -- maybe 0.00003 -- doubles they're not super predictable -- they take a lot of thinking.  Don't trust doubles.  They have the potential for a little bit of error and it's hard to predict compounds over time.  It can compound over time and become serious -- usually we ignore it and hope that the errors stay small --
Little more then would we'll take a break.
Is that a problem that is intrinsic with computers doing arithmetic that you have to lose accuracy when you're doing fractions?  You may have guessed?  The answer is no -- here's another large -- Racket -- we're using Racket in this course here.
I'm going to Racket and say what is 25 divided by 7 -- first of all, just to try that and I'll press this green run arrow -- there will be instructions on how to download Racket and we'll use that.
And 25 -- oops -- I wanted 7 divided by 25 -- hit the run arrow -- .28.  Okay.  So 7 divided by 25 is .28 -- this looks kind of weird --/725 with parentheses -- all of those are important -- and if you haven't seen this before it looks kind of weird.  Usually I write something like 7 divided by 25 in most languages -- if you think about it sort of like we're call ago function -- let me go back to here and let me call a function in Java, (inaudible) 2, 5 -- it comes back says 2 to the 5th -- open parentheses and the information you give to the function.
Here's 2 and 5 -- what's the answer -- the computer goes out -- here's the answer -- 32.  Well, why am I mentioning all this?  Division is a function.  We give it two numbers -- 7 and 25 and say division here's 7 and 25 what's the answer .28.
So usually when we look at languages -- it doesn't look like this a if you can -- math.pow -- we put the name of the function notice middle and the two inputs we put on either side so it's an infixed notation.
Rack itself doesn't do that.  It says we're going to put the name of the function first and then the two inputs like you did with math.pow -- other weird thing that's different from math.pow, composed functions -- rather than saying math.pow of 2, 5 -- EXPT for exponent -- I get two answers -- 0.28 and this gives me the 32 that I see down here.  So I don't write EXPT of 2, 5, that's what you're used to -- Racket says put that opening parentheses put it in front of the function name.  It's just you have to get used to it.
Then once we have that if we have the spaces we don't need the comma -- it doesn't allow the comma -- now you see that calling EXP on 25 or slash on 7 and 25 are similar things -- they didn't look as similar in Java.
That's a little side -- we'll get to the other functions in a second.  Let's get back to 7 divided by 25 times 25 approximately -- I want to take this -- I want to say 5 times 6 what would I type into Racket -- any guesses based on seeing this and -- just trying something?  Star 56, yeah -- I like those -- it turns out the parentheses are required in Racket.
So star 56 is how we call multiplication -- I'm not going to press the run button -- command R -- we see this -- 30.  Great.
Now we had a question -- I want to take something times 25 -- how do I multiply something by 25 between open paren and whatever I want -- I'm going to paste it in here -- the answer to all of this is exactly 7.
It turns out we can try this with 14 or 21 and we -- there's never ever round off error.  It handles these fractions correctly.  It computes the intermediate result but it doesn't round it off, it keeps things exactly.
Okay.  So the upshot is no, this round off error we saw in Java and in python -- python was doing better for integers that has the same problem with doubles, so but that's not intrinsic to a language -- computers have to be able to do it that way -- when you do arithmetic in Racket it keeps it at as a fraction -- two fields inside -- a numerator and denominator -- it can multiply, divide -- is there a price -- it takes a little bit longer to do arithmetic, yeah -- do you get something in return -- you don't have round off error, and you get rational arithmetic.  So that's kind of cool.
Still coming back to how a language choice effects all this.
Yeah, so one—third, if you get -- say one—third that doesn't have a nice thing -- first of all, internally, I'm going to show you something -- define my share of the apple pie.  My share is now bound to the value of one—third and keeping the track of this fraction of one—third.  There's two different issues -- computing the value and keeping track and presenting it on the screen.  I'm keeping it track how do you present one—third on the screen easily -- lets go ahead and try -- my share.  It actually prints 0.2 with an over bar -- there's -- you can print it as repeating decimal thing -- it will eventually repeat -- you may have non—repeating stuff -- it's a math theorem -- any fraction if you write as a fraction will eventually repeat -- so 227 -- okay.  And you can try these things on your own.  Try putting something that doesn't repeat for a thousand places and see what it does there.  It's kind of cute.
I will for the point that I think is interesting to take away, there's the value internally and how you present the value.  It's almost a side effect -- as lock as you're keeping track of the answers internally, how you present it is a detail.
Okay.  That's why I tried to do something where I did the division without printing to make that point -- those are two separate issues.
We'll come back to this and I'll talk about that again.
Some numbers can't be represented as fractions?  What are numbers -- what's it called that numbers that can't be represented as a fraction?  There are such numbers and they have a special name.
Irrational -- so let's go ahead and try something here -- I'm going to try the square root of 2.  -- in Java we say math.squirt of 2 and that will give an answer.  In Racket we say SQRT in 2, compare the text of these two things -- name the function open paren argument versus open paren name of function and the argument -- they're similar but you move the open paren from one place to another place in Racket.
What is this?  Here's the answer 1.4.4 blah, blah, blah 9.1 -- that's what the Java gave the answer and claiming it stopped there.  Racket is using doubles as well -- it's an (inaudible) sort of standard good use for arithmetic.  There's hash I -- it's making clear to you this is exact number -- they're reminding you of that -- you cannot remember this is not exact number as opposed to something as one—third -- it was keeping track of that exactly and having no error.
This is telling you this is double, something close to but not exactly the right answer.
So now this is where I like the philosophy -- python, Java, Racket -- we have one more thing to say -- I've been going for a while -- my throat is getting try -- I'll try to take a couple of five minutes breaks -- maybe ten minutes shy of three hours -- so let’s go ahead and take a break until -- let me go back to the other window here -- break until 1833.  And we'll pick up the discussion right back.
(BREAK TAKEN.
 » INSTRUCTOR:  Okay.  Is my voice and image better -- if somebody wants to confirm?  Okay, thanks Mark.
Starting recording again.
Okay.  So gosh, I, let me know if five minutes is too short if you want to power through -- I can't power through I need a few minutes to drink water and stuff.  But if you guys have suggestions for how to run the class, feel free to send me an e—mail or talk to me after class -- ways to make it more interactive or if I'm going off, talking too long or whatever -- let me know.
Let me hide this window, go back here.
So where are we?  The overall point is how different languages handle numbers differently and how you may not have realized -- first of all, issues about numeric computing, how to call these things in Python and Java and Racket, just the fact that hey, calling integer division -- don't overload slash -- so now I want to go back -- I have more to say about Racket numbers -- so again, Java, Python Racket, Java comes with arithmetic and double -- Java doesn't have problems with integers arithmetic but it does have a problem with double -- Racket doesn't have a problem with arithmetic -- you have to do a lot of division -- if you never take a square root you might not have that issue but there are still things you can't do in.
(AUDIO ISSUES) --
How do I represent the square root of two -- that's not going to win me any prizes for efficiency -- so keeping track of pi and square root of two is that intrinsically problem for computers -- I guess the answer is it's not intrinsically -- it's -- I'll pull another one here -- I downloaded a program -- it's like (inaudible) or maple and it's a program lack for math tenses and they take great plans to handle these irrational numbers correctly.
What are interesting things we can do in sage -- math version 6.8 -- let me make it better -- is that visible to people?
I'll default to yes.
If it was not visible to you, you would say no.
In general I am good with one answer.
So sage and do is 2 plus 3 is 5 -- so all makes sense.  We can do things like the square root of 2 -- it comes back --
(AUDIO ISSUES) --
 » INSTRUCTOR:  It says that's the square root of 2 -- then the -- square root of 2 times the square root of 2 -- now in -- Shawn is getting pauses and glitches -- I'll try not to talk too fast.
Okay, so maybe -- unfortunately there's not much I can do.  It might be the Internet connection on my end but there's not much I can do -- I can turn off my video.  Let's try that.
You guys are plotting -- we have to keep looking at his face let's tell him we're having problems -- good job.  Does that seem to be any better?  Or are we still glitching?
(AUDIO ISSUES.
 » INSTRUCTOR:  Definitely let me know -- there's not a whole lot --
(AUDIO ISSUES).
Let's look at the square root times the square root of two -- inform I'm going to try to leave the meeting and come right back.  In the meantime --
(AUDIO ISSUES).
You try if you have Java or Python -- I leave and reenter --
(AUDIO ISSUES) --
 Try square root 2 times (inaudible) --
(AUDIO ISSUES).
(AUDIO ISSUES.
 » INSTRUCTOR:  Yeah, I'm back.  Thanks.  You know what it may have been?  I've an ether net cable that I noticed it wiggled a little loose and I may have switched over to my wireless card and that may have done it.  Even though I'm on campus the wire may have did it.
It looks like I'm still recording.
Okay.  Thanks.
So now we're back and I wanted to look at in Java, so I'll go real quick here -- so square root of 2 times square root of 2 (inaudible) it was off -- when we square it, we have a little bit of error, we can see -- and as true here it's going to be true in Python, it's going to be true in Racket as well.  That's a good little review test -- so in Racket, how do I say square root of 2 times square root of 2 in Racket?  We know how to get square root of 2 by itself, so as practice for you putting together things I've already seen how do I say that thing multiplied by itself?  Yeah.  So two answers were both really close.  I think you have the right idea.  Star of something and something.
».
» We want that to be square root of 2 and that second something we want it to be square root of 2.  If he ever get lost about how to put all the parentheses I do it often just the way I typed it.  I start with open paren star and I put in dots and I know I'm going to fill them in -- but it helps me -- I get the paren before the star and that helps me stay on track.
So I do this in Racket and I get the same inexact answer -- to let me know it's inexact -- and the 2.0004 --
Now looking at this Sage session, here's kind of interesting square of to 2 -- I chose the wrong example -- it turns out -- square root of 2 times the square root of 2 gives 359ly 2 -- I can co—sine of pi -- and one—half of the square root of 3 -- it keeps track of square root 3 -- it kept track of rationals by keeping track of the numerator and domestic, whatever sage is doing it's more complicated than that -- it keeps track of arbitrary expressions -- I can say (inaudible) and get back this exact answer.
So that's kind of cool.
».
» The fact that we're keeping pi and so on -- it comes back and say that's pi, I can say hey, give me pi to 30 digits or to 300 digits.
So N is a function that takes in some sort of really truly exact number of value and this is like a two string -- give me this many digits of that expression.
Calling N -- something interesting -- if I called -- so we just learned in sage there's a function called N to give you decimal spaces -- if I called N pi and 300 you wouldn't be surprised to get 300 digits back -- digits equals 300 -- it's interesting.  We're giving the arguments by name, at least the second argument we give by name, the second we gay by position -- usually when I call a function I give them by position -- I give the first argument, the second argument or the third argument -- when you call math.pow -- (inaudible) -- we can go ahead and do a mixture -- we can pass the arguments by name as well as by position.
Other languages have this as well.  I'm throwing that in.  Python allow this and that's why sage allow this I think.
Anyway so that's all I wanted to say.  But yeah, that opens my eyes, even irrational numbers are not intrinsically -- you have to do more work perhaps but they're not intrinsically having to have errors in our computations.  That's all I'm going to mention on sage this entire semester.  But it's cool if you want to play around with it.
Okay.  I'm going to wrap up the discussion of numbers by going back to our example of 2 plus 2 or 2 billion plus 2 billion -- is there any way in Java I can add 2 billion plus 2 billion and not get overflow?  We already saw we can use longs -- it doesn't solve the problem it just postpones the problem -- what's the right way to do integer in Java if I don't want to have errors -- it was on the web page -- if you want to keep track of the link list of the digits of numbers I can write a whole class that does that and they do have a class -- what's that class called -- Java.math.big.integer -- I can call it (inaudible) -- let's say new -- I can give it a string -- it takes a string and it can be a big number -- bigger than long -- and I'll make one of these objects that's internally keeping track of the link list of things.
Now great, it gives me back this object reference, you can't see what's inside of it -- if I have an object I can say object and dot to string on it and get a representation -- let me take this here -- copy -- copy that and then go down here -- this whole thing is -- when I called it new it gave me back an object and the yellow reduces to (inaudible) and I'm saying (inaudible) do the two string.  Can I add two large numbers?  Yeah.  I can go ahead and if I have one number here -- by the way I could take this number and stick it into a variable.  I don't want to make an variable and initialize it so I'm going to use it right here without sticking in a variable.  It turns out the integers have an add method.  I can say big integer object call add on it and give it another big integer.  Let me do this -- (inaudible) big integer of -- type in some more things here.  And I'm going to call add on this -- what am I going to get as an answer?  I get back -- it's hard to tell because it's a big integer.  It's an object.  I want to take the result and call two string on it.  Let me go ahead and copy and paste that whole line there.
Granted it's long because I'm using long digits but in Python or Racket I would type the first number plus the second number and get my answer -- Java lets me do it.  Java supports the full arithmetic without round off.  Have I ever used big integer in any of my big programs?  How hard is it to add 2 plus 2 using big integer -- the answer is shortening down to the 2 plus 2 -- this is full big long line of code to add them and see what number it is.  I'm not going to do that.  Here's what I'm going to do in my Java programs, I'm going to use INT -- it's going to overflow -- hope nobody uses my program with numbers so big that it overflows.  If I try to read in a bunch of data I'm going to start having major problems.
I'll have a read me for my program and down I'll have a disclaimer saying don't do anything that gets too big and then I'm off the hook.  I'll have them click a little license and know all the problems using my program -- no they're not going to know that.
In Python I would not have that problem.  Why?  Because the language.  Java -- they both provide the same features, Java makes it so difficult to use exact arithmetic I don't -- I say forget it I'm using it.
Or maybe I'll remember to use long but that has a problem too.
So Excel that's another language that does correct arithmetic and it doesn't overflow.
You can say most of the time using INT does work okay -- doesn't have problems.  And if does have a problem it wouldn't kill anybody.  If it did it would be one or two people -- it wouldn't be hundreds of people.
Here's a story that came up over the summer -- I don't know in the screen is refreshed -- (inaudible) reboot once every 248 days.  It was having problems and they discovered a new problem every 248 days all the generators would cut out.  You have the generator and a back up and a back up, backup generator, it didn't it matter, they all cut out simultaneously after 248 days of the plane being on.  And they had to reboot the entire system and that solved it.
There's a tweak down here on the page -- I don't know zooming in probably doesn't work -- I'm using that.
But 248 days somebody figured out that if you take a 32 bit number or 31 -- those 2 billion -- if you're counting hundreds of a second, after 248 days you've reached 2 billion of them and are about to overflow.
Fortunately they discovered this problem while the plane was idling on the ground.  They didn't discover this in flight.  That's integer overflow using INT.
Let's go back and reflect on how Racket approaches numbers versus Java -- Java gives you the wrong answer quickly and makes you really work if you want the right answer for rational numbers -- big decimal class handles any number of precision as long as there's a finite number -- there's not a standard Java class to do arithmetic correctly, they're one off here and there from people -- they're not part of the standard Java release.
Is as opposed to Racket, we're going to give you Python -- gets closer, we're going it give you exact arithmetic by default and if you want to back up and use doubles you can.  In Racket it turns out if you want to use something like 14 25th's and there's a function called exact to inexact.  And if I give it 14 25th's it will come back (inaudible) and inexact they fit into 32 bits -- if I know 13 decimal places is all I need and it's going to be a little bit off -- round off error can accumulate, you can do extra work to get inexact numbers to get doubles, if you don't by default you're going to get correct arithmetic.  I think you should have to work to say I want to get speed and I'm willing -- I'm knowingly giving up precision to get that speed.
I get a new appreciation of when to use Java and when not to -- when it's helping me and when it's setting me up to have problems down the road.
Is it more precise than Java -- integer arithmetic will be exact by default and rational will be exact by default -- irrational will be using floating points -- sage (inaudible) -- so you sort of ask yourself where you want to be on that continuum and what the languages offer.  There's a trade off.  There's a trade off on speed and memory size.  In particular, here's an example where you might want to give up precision.  Say I'm writing a video game and I have a bullet flying through the air and I'm keeping track of the velocity of the bullet I want to keep count of resistance -- I want it to slow down -- every time step I want the velocity to increase by one percent -- to multiply by .99 -- first it's going to be 100, then 99, then 98.1 then it's going to be 97.011 or something -- and so when you start multiplying 95 repeatedly -- you're going to add on a couple of digits.  If you're adding on a couple of digits and you're playing this game at 60 frames per seconds -- you have hundreds of thousands of digits to know the velocity of this bullet -- that would be the exact arithmetic.
So that's the place where you might say I'm going to use an inexact to represent the velocity of this bullet or spaceship or whatever and I'm willing to take the inaccuracy in order for it to be faced -- I'm not bogged down for it being slow.
I want to aware that I'm making that trade off.  I want to -- I don't want the large to choose for me -- we're going to use the fast thing and that's good enough.  Your doubles are good enough because sometimes they're not.
And you can also -- these things cause security flaws, search for risks for them, look at ways people have cheated companies by rounding off pennies of accounts and so on.
What is my point -- the choice of language -- when I'm writing a Java program I choose -- even though I can do it correctly, I choose to write knowingly write bad programs and I cross my fingers and hope they're not going to be used where it really matters or big enough that it really matters.
And that's kind of a dangerous situation to be in.
Your choice of language -- that's not getting into the meat of the course -- what are the different ways languages approach thinking about a problem.
I'm going to step back a little bit -- this session -- it's going to mirror the on campus session, however I'm going to juggle things very slightly.  My on compass in the middle hour I was going to talk about the sell bus -- I'm going to do that but I'm going to do that at the end while we're fresher I'm going to maybe talk a little bit more about Racket and teach about Racket and then we'll come back and talk about the syllabus and stuff like that when we're totally brain dead after two and quarter hours of solid non—stop stuff.  Does that seem reasonable?
He see you typing and then it disappears.
We're going to use Racket in this course it -- not because I'm trying to teach you Racket but it's a language -- it gets in my way the least.  I'm going to teach you five keywords of Racket over the course of semester and do a lot of stuff with it.  This is the more fundamental things Java has all these keywords and you take a Java class and you learn two new keywords and your head gets felled with stuff.  We're going to see that's not fully necessary.  You can actually to interesting stuff with a much more minute mull language and still solve problems.  That's one thing we'll find out.
Let me go ahead and just talk about Racket for a little bit that we'll be using in some of the homework’s.  And we're going to talk about several languages -- I'm going to switch between Java and Racket, we'll do scripting -- I'll talk about all that in a moment.
First of all, let me talk about values and types.  What types of values does Racket have?  We already seen some different things that rack itself has -- we see there are numbers.  We seen there's two types of numbers -- exact numbers and inexact numbers -- if I want to say 2.3 is an inexact number I can type in hash I 2.3 -- it's the difference between double and INT in Java but it's not quite as rational number versus inexact --
So numbers we have 2 integers, we have 2.3, we have exact, we have inexact numbers -- and I'll let you play with this.  There's more types of numbers but I'm not going to worry about it.
One thing in I'm typing in -- there's instructions on the homework to get started.  This top half of the window is just an integer -- the bottom what is where I can type in expressions and get answers.  And when I press run what does it do -- it sends everything at the top half if I'm typing at the bottom half all at once.  And separately -- can you guess what a comment does in Racket?  (Inaudible) -- is a one line comment.  You'll see a couple of versions of comments -- I click run and you'll see these -- it goes top to bottom -- comments don't have any results -- when there's a result it gives that down to the bottom.
What other data types do you want in your language besides numbers?
I'll take nominations here.
Widgets -- we have to attack our own class in the future.  Strings -- yeah -- you won't be surprised, they're in double quotes.  What other data types?
Let's take primitive data types -- we'll have (inaudible) bullion -- how do I get a bullion -- turns out, hash true and hash faults are bullions -- so anything with a hash sign says I'm giving a literal value here, characters -- characters look wacky in Racket -- they look like this.  The letter A.  It's hash meaning there's literal value coming and backslash followed by the character.  This is the character A.  You say tick mark in Java.
Does anybody know how to do characters in Python?  Side question here -- I don't know any of you have used Python at all.
Just type it -- well, I mean -- that's not what I wanted --
Python -- if I want -- if I just say A that doesn't do it -- it says A is not defined -- there's no variable named A.  In Python I have strings -- I can do it in double quotes or single quotes in Python.  If you use PHP or Java script they also do that.  It works well with HTML --
It turns out if I want a single character -- this is weird in Python, Python doesn't have a separate data type character, it only has strict strings.
Okay, that's fair enough.  The reason it bothers me, what is a string -- it's zero or more characters strung together -- in Python what is a string -- you can't say it's characters -- it's string of length joined together -- now I'm using string to define string -- it seems -- it works but it doesn't have the solid foundation that I like.  That's a side note.  I think it's being that Python does not have the concept of a character -- it uses strings of length one where you want to use a character.
So we have bullions, we have strings, we have characters, different types of numbers.  Is that all we have?  Java (inaudible) -- bullion and then all the numeric types --
So that's pretty good.  We'll get compound things in a little while.
Compound types like lists and ararrays -- let's look at calling functions.
We've already seen functions like some helpful functions -- we saw things like plus for numbers and slash, what are some numbers that work on strings?
What's a number you want that works on strings?
So must on strings -- in Java it overloads plus -- it means one thing if you give it numbers and different thing if you give it strings -- not as confusing as the slash -- that doesn't really cause problems.  It's not called plus -- if I say plus of high there -- plus -- it's a pretty good error message.
So what might it be called -- is it ampersand?  It's called string a pen -- it gives me hi there.  And there's no space between the hi and the there.
One thing you'll notice there's a hyphen in the middle of this name.  In Java you can't have a hyphen in the middle of a name because it will treat it as subtraction.
Racket, hyphen, if used by itself, hyphen, 5 mine news 2 is three -- but hyphen surrounded by spaces or subtraction function -- hyphen by other characters is a bigger family.
This is one of the things that I love about Racket.  It's a small superficial thing -- what do you do in Java when you have a very long function name, the camel case -- and then one of the words is a an acronym itself -- it's kind of a pain.  It just looks ugly.
Topographers used (inaudible) and we can't do it in Java --
So string a pen -- what are some other functions that are kind of interesting -- how about another function -- substring.  So I'll let you go and try this.  This is just like Java substring -- you give it string and what index to start at and what index to finish at.
If we go ahead and run that we get the LL -- 01 index 2 is that first L -- we go up two but not including 4 -- that's how Java substring works.

We say open paren name of function -- rather than the other way around.  It's not object oriented so we don't say object.function name -- same information just slightly different order.
One handy thing, if you're sitting there and cursor is on (inaudible) -- I click on that and here we are -- here we have up in blue, it has the definition and a little bit of comment and a you couple of examples.
If you give the string a single argument it takes it to the end, which is the way Java substrings is of loaded as well.  One number or two numbers depending.
Python substring a little bit different and can mean different things -- so anyway again, getting back to Racket, if you're on something and you hit F 1, it will bring up the documentation for it, if you can't remember the name you can hit F 1 on anything go to the page and search the documentation and try to find some matches.
I don't care that you know these functions but a few common things -- let me give a couple of other names of functions.  Let me make sure I can see the comments people are typing.
Compare strings -- compare to see if two strings are equal -- let's work on two numbers are equal -- I want to go back I want to talk about the type of the function.
The type of the function -- what type -- string of pen -- I'm going to say -- I'm going to write it like this -- takes in a strange and a string and returns a new string as a result -- so you may have seen this notation before -- you've seen in math classes -- like square root takes in a real and returns a real or something like that -- the name of the function, colon, the type of the input, and arrow sign -- this is for the comment not for the leaning -- but when I look at the document take like for substring I'm like what type of things does it take in and what types does it return.
Go ahead for yourselves try writing something similar -- except for similar -- substrings takes in what types and returns in what types?  Fill in something that looks like this.  Don't worry about the overloading -- just worry about the version we just called.
Now that you've had a chance to think about it, let's see if you want to type it in chat window -- the type of substring.
People looking for the general pattern -- input types followed by an arrow and output type, return type.
So I like Mark's -- gives you two strings but gives you back a string -- the first was a string -- but the next two things were integers.  And the result, you all agree, yeah, result is a string.
So this would be the -- I'll call this signature of substring or type of substring.  When you do the search for the documentation that's what you're looking for -- it's the thing we're paying attention to all the time.  And if I really -- integer is not the type I use here, right -- it has to be a natural number.  It has to be zero or bigger.
I'll say INT here, even though it's a natural number.
Okay.  I'm still working up towards comparing strings.
How do I compare numbers?  How do I know if one number is bigger than another?  Can you guess -- how I say in rack itself, is 5 bigger than 4 -- how would I ask Racket -- hint?  We're going to call a function.  In some languages you would say 5 bigger than 4 -- we're going to say open paren and name of the function first.  It comes back as true -- five is bigger than four.  What is the signature for greater than?
It takes in how many pieces of information do we give to greater than?  How many arguments are we providing?  Two.
We get back an answer -- the two things you provide are going to be number -- it can be any number.  It be integer, rational, inexact numbers, so it can take reels or -- any type of number and the return time -- I'm not going to say output -- I'm going to type this -- this little ratio indicator, we don't need to type the word out -- so now how do I tell if two numbers are equal?  Is two plus two equal to four?  Yes.  See if you can go ahead and turn that into Racket.  Is two plus two equal to four?
I don't want you to add two and two together itself I want Racket to add it.
Shawn, other people typing -- if you want to type it if someone else put the same, or different that's cool.
He'll go back and fill in the first thing with two plus two -- how do I write that -- we saw that already -- and then four.  Sure enough two must two is equal to four.  I haven't forgotten too much.
Minor thing -- if I really want to nitpick -- I asked if two must two is four -- Chris said (inaudible) -- when you call it equal it doesn't matter what order you put the things in.  Sometimes does matter if I want to say two arararraysd to the three it's different than three arararraysd to the two.  I'm going to try to make it match exactly as the question as I can.
You always use one space to separate one argument from another -- you don't use comma -- you have to use at least one space.
I guess if I go ahead and you just put that four right after the close paren -- Racket will still give you the correct answer, (inaudible) will take half point off your homework because you should put spaces in between things and usually one space.
We'll see things that have multi lines and things like that.
What is the signature of equality?  It's going to be greater than -- it takes in two numbers and returns a (inaudible) --
Okay.  All of this is a long way of getting to say how do we compare strings?
So how do we compare if one string is equal to another?  The name for that is string equal question mark.  String equal question mark takes in a string and a string and returns a bullion.
String equals question mark of cafe with a -- I could just say, (inaudible) -- I could say cafe, I could do something like string append (inaudible) -- string wall of two things -- the second thing is a whole other expression by itself.
How do I tell if one string is bigger than another?  Any guesses?  What does it mean for one string to be bigger than another?
String length, string compare -- not string compare -- string length will tell me how long it is -- it will take two strings and say this one is bigger -- you can think about what it means in other languages as well -- string greater -- hint -- for numbers we use equal sign and greater than -- for string we use string equal with a question mark -- string greater than.
So it has its own internal consistency -- it takes a string and a string and returns a bullion.  What does it mean for one string to be bigger than another?  Let's see if we can find out.
Hi and by the way, -- is hi bigger than bye?  True?  Is hi bigger than bye -- bye is smaller than hi -- what is it doing -- how is it comparing -- let's try a couple others -- Radford and tech -- is Radford bigger than tech?  It said it's false.  So clearly it's looking up the student pop lakes of those strings -- Radford has bigger students -- alphabetically, it's the same thing that compare to does in strings in Java -- you have two strings and compare two method you get back an caution -- does one string come before the other -- is the page number on the dictionary bigger for Radford or tech -- Radford is bigger than -- R comes before T.
So those are a couple things.
Go ahead and Self—comparison for the number comparison they use greater than and equal.  For strings they use this thing here -- you'll see this name carried throughout other functions as well.
What else do I want to try?  Here's a function -- I want to convert a number to a string.  I might have the INT 472 and I want to make the string 472 because I want to string appendant -- that function is called number to string.
That's a nice family actually.  I look at this -- if I had not told you what this function does and tapped you on the shoulder and said what do you think this function does, it takes a number and turns it into a string.
What is the signature for this function?  See if you can go ahead and give me the signature the same way we did it up here.
The signature of number of string is number to string.
Pretty sneaky.
So yeah, okay.  That's good.  One more function I want to cover before we take a five minute break.
Is something a string and -- what is a signature, whatever it's called, what is the signature going to be -- I'm going to give it -- I'll fill this in here.  It's called string and it takes in anything and returns a bullion.  Let's try it -- string of hello -- true -- string of 234 false.
So string question mark goes ahead and returns is -- give it anything you want, any type in the world, yes or no is it a string.  You can give it a character -- what's the letter A again -- false.
You don't need to remember these functions -- you don't need to memorize them -- but you hopefully will -- we'll be using these a fair amount and hopefully they have pretty good names.  Of.
If you see a function whose name ends in a question mark, what can you tell me about that function?  It returns a bullion.  Exactly.  That's a very valuable clue and it makes a lot of sense when we're using it.  If you write a function that return a bullion, end it in a question mark.  You'll start doing that after a while and then you'll get frustrated in Java and want to name this thing in a question mark but you can't.
Okay.  One thing I want to mention there are two functions that look similar to each other but are very different.  String question mark and string equal question mark.  Those are two different functions -- they each make sense.  This one is something a string -- this one hey, give me two strings are they equal?  So they look very close -- be sure when you're typing them you don't confuse them -- they each make good sense in their own right.
Okay.  Gosh -- he wanted to get to more things but -- I shouldn't have talked about this -- I can give this on the web page -- face kind of fun to talk about as well.  I do want to -- we will be doing writing signatures for functions -- I'll ask you to write a signature for a function and ask how it's used -- you do this in Java.  This information is right when you declare a function it's part of the return type and the type of the parameters you declare.  So all that information is there.  It's there for Racket for well, it's not in the language it's in the comment.  By the way you can, if you try giving something -- if I give it hello and 99, I'm going to get a type error.  So it says I was expecting a string be you didn't give me one, so rack itself does keep track of types even though we don't declare them in our variables but it keeps tracks internally and if you try using a type in a wrong position it will give an error.
Okay.  Any questions before we break for five minutes?  Hearing none -- Steve is going to keep us here --
Yeah, I'll post some stuff -- I'll post a bunch of references and things like that.  The documentation is pretty decent.  And documentation tends to be one big page.  If you look for the -- say you want to know other string functions -- if you look for substring, let's try right now -- type in substring -- I hit F 1 -- it will bring up a browser and click on that -- here's substring, strict question mark, here's string greater than, greater than or equal, string less than, and so on.  String white space question mark.  Determines whether all letters are white space.  String upper—case depends whether it returns in a question mark -- string numeric -- there's a whole bunch of them.  If you go to the very top of the page on the left hand side you'll see a long list of things.  These are all the functions built into the beginning student language so it's a long, long page but going through here is a great way to figure out what's out there.
In real life you look things up when you need them, you don't memorize them -- you use them often enough that you automatically memorize them.
Back at 7:41 and we'll try to wrap up by 8:20 should be good.  Then we'll talk about syllabus and other stuff.
(BREAK TAKEN.
 » INSTRUCTOR:  Let's slowly start the recording again.
I would take -- I thank you for turning the music off as well.  I'm recording again.  My voice seems to be going.
What do I want to bring up?  Let's go over the sell bus a little bit.  Then the very end we'll come back and practice a few Racket expressions.
I'll try to get the three videos, each one hour long posted -- it will take me about 20 minutes after the end of class.  With the caveat I found it's kind of painful to go back and fry to fine stuff because it's like big files -- it's like jumping to the middle -- but they're better than nothing.  He can hit that record button, so they're there.
Okay.  We were talking about the class overall -- if you go to that web page I posted before and I'll make sure this link is on D2L as well.  We have the general information and from there, there are links to where the lecture notes -- I'll put the links to the video down near the bottom of all the text files and all the video links down the at bottom.
It's the same page I use for both sections.  Sometimes things will be a little bit weird because they apply for one section or the other but okay.
So yeah, what are we going to talk about in this class, history of programming -- we'll spend one day talking about notable things.  We're going to look at different paradigms, so yeah, we'll talk about different paradigms, the function of paradigm we're going to hit in depth.  Rather than doing a bunch of little things I would rather take one or two and internalize them.  We're going to use them in a functional way.  Java we can use in functional way.  What's about functional programming.  We'll look at declarative programming -- it will be about two weeks or so.
Then we'll talk about programming constructs.  That's the rest of these things are.  How to declare variables, a scope, visibility, the lifetime.  We'll talk about recursive functions over recursive data -- the reason we're going to do that is because we're going to build up trees and process trees because we're going to be building our own syntax trees and parsing and basically what this is, when you look at program, when Java, when you compile Java program, it looks at your integrity files and turns them into a parse tree that reflects the structure of your Java program and then it can exile it.
We're going to go ahead and write an interpreter and make a parse tree and it's going to be for our own little language and we're going to make up and decide on the details together, and then we're going to write an interpreter for it and have our own language that somebody else can write programs in and we'll take their text file and turn it into the answer.  And we're going to do that by processing the syntax through the parse tree that we build so we need to know how to build trees.
You've seen in other classes working with trees but we're going to revisit them -- it's going to be a lot easier than you've seen other ways of programming trees and getting things right and not having no point (inaudible) --
There are two sort of projects -- we'll have homework’s that are weekly and other section I'm going to break them up and have the same thing but they're going to be due multiple times during the week -- for you all, regardless of what the homework due date says on the homework your week's homework will be due at the beginning of our class on Monday nights.
And I'll try to make that clear on the homework of what the due dates are for you.  You won't have anything due on Wednesday.  If you look at desire to learn there are two homework’s out there.  Don't worry -- they're short and easy.  The first one is getting to know you a little bit and some background about you as well as short questions so I get an idea of what everybody's experience is, a few little problems.  But 15 or 20 minutes.  And the next one is here's a bunch of Racket expressions, type them in and see what comes back in as the answer and paste them in desires to learn.  Do that so you notice they can busy the language as you're doing T.
If you look at the due dates on desire to learn, those were due Wednesday and Friday already, for you guys they're due Monday night at 8:00.
I just realized there's going to be an issue for when I post solutions to the other class.
Okay.  So yeah, we'll have these homework’s roughly weekly.  Some of the weekly homework’s, this language they're we're going to build up it's going to be a sequence, near the end, three to four of the weekly homework’s -- they're going to be building this project up.  That project -- it's three weeks of homework, some are bigger homework, larger homework which is tougher for distance students, you have working jobs and have families and it's hard to put in the time and I understand but that's the homework -- it's the same as the class.
Okay.  Before we get to that, we'll have smaller homework’s getting you up to speed on different things.  I think one of the fun things in the class we're going to go and actually write a small video game -- one of the questions get to know you homework is video game you might be interested in writing -- we're going to do a small simple version of one -- we're going to do it in functional style.
In a nut shell we're going to write a program without ever assigning it to a variable.  Which should strike you as weird, as how is that even possible type of weird but that's what we'll talk about.
Okay.  A few notes here about packet goals we're looking for.  Definitely sounds weird.  It's when you look at different paradigms and changes how you look at programs Ring.  You come back to Java and assign different variables -- I might do things more in a functional approach than I would otherwise after taking this class.
Okay.  We never reassigned to variables -- variables that are constant but never reassign to a variable.  Office hours.  If you want online office hours you can send me suggestions and I can try to see -- my weekends are kind of tough -- I have a young son and wife are trying to get progressive of me without putting too much work in during the weekends.  There's some -- if you want some office hours on Saturday or Sunday let me know what might be a time and we'll see what we can do.
I can also have these office hours.  I can hold them online, I can have a window open.  We'll talk about that as we go.
Textbook.  I sent an e—mail over the summer.  So maybe you have gone ahead to get the textbook -- it's a cheaper textbook and if you want to get an older edition I'm okay, with that.  And we'll use parts of it as they apply to our class -- it has a lot of stuff in it.  We're not going to talk about everything the book has.  It's a really thing one -- it's not cheap but it's not super expensive -- it's in the $60 range -- there's a fourth edition that's not yet out.  That comes out -- the third edition will be cheaper or used copies.
I've an optional book here.  Done worry about that.  It's kind of for fun.  We'll have exams and quizzes -- quizzes include things that D2L might auto grade and so on.  And we'll have two longer exams where you sit down and write some code and answer some other questions.  In the past I've done the exams on paper.  We'll see in I continue that for my insession class, how that works for you all.
I try to make the exams so time is not an issue.  Where you have long enough for them.  Most of the homework -- learning happens to homework but I want enough wait on the various exams so to be sure you're understanding it.
Okay, cool.  I wonder how much class myself drives up the price of the integrity book -- in the summer 20 bucks but after people drive it for that price you're looking for the reserve pile.
We're meeting on breeze.  We will be writing programs.  ITEC 320 is a prerequisite for this class -- we may refer to (inaudible) -- mostly it's a programming maturity sort of getting more into things.
We'll be meeting next week, yes.  Unfortunately -- it is a school day for Radford.  Radford is holding classes on Labor Day whether on campus or not.
It's good in some ways because -- we meet only 14 times taking one of those out is like 7% is gone -- it's not fun for you all necessarily.
School is in session.  And I just follow -- if Radford takes Labor Day off we would not be meeting.
Late policy.  I'll give you a little bit more slack -- I know there's more issues that come up but get it in before the start of class and during class we can talk about details and answers and get into it.  That's my motto.  You can have one due over.  You do an assignment, I grade it you get it back and you're like I didn't do as well as I thought he did, especially I go over and look at the solution set.  I'll go ahead and let you return it -- I'll go ahead and let you take one homework and redo it -- I'll have a desire to learn folder and you'll stick it in there just for redo, so that can arararrays -- if you didn't do the homework at all you can do redo -- you can do them after looking up my solution.
 What does that mean?  You can look at the solution then set your solution aside then you have to write the program yourself.  My rational if you can write it from your own head then I'm happy you've internalized it.  If you seen the solution set and you can sit down and do it yourself, you're not doing a short term brain dump, you understood it and then can set down and do it.
So that's the idea of the do over.  Any questions if you have -- honor code -- you must be the direct author of all your submitted work.  If you want to talk to other people, what's this program mean -- talking about these things without sharing codes I recommend that, if you can.  Looking over the notes together and saying which problem of the note seems to correspond with this homework.  Every homework problem I give there's a similar problem in the notes that we talked about in lecture that we did -- you may not recognize it as a similar problem but hopefully there is.
Okay.  So those are -- everything there.
The grade scale is not --  -- I'll let you know as the semester goes on where I draw the guidelines -- it's not necessarily 90, 80, 70, 60 -- some projects are harder than others -- if you get an 87 on this that would still be an A.  Or maybe I give a bunch of multiple choice quizzes that are easy and you can take it, see if you get it wrong and take it again -- I do a lot of those I might say gosh, anybody can get a 71 on that real easy, that's not necessarily going to be by that grading scale.
So I'll grade -- it will be roughly 90, 80, 70 -- but we'll differ from that -- I do give pluses and minuses -- if you're software engineering you need to pass this class -- if you're a CSCS concentration you need to pass this class with a straight up C or better not a C minus only for the CSC concentration -- software concentration any passing grade meets the requirement.
Some people end up wondering about that, so.
Okay.  Anything else on here?  Any other questions you have -- again, the distance format arararrayss its own difficulties or challenges.  I'll try to run it like tonight.  Send me an e—mail if you want to change something -- we're supposed to meet three times -- 150 minutes per week, that works out to -- I go to for maybe 50 minutes and take a five minute break, 50 minutes five men break, 50 minutes and that ends up with -- is that ten minutes before or 20 minutes before 8:30ment I'll have to work on that.  We'll get out about 8:20 even though we've taken some breaks in the middle of it as well.
So next Monday, the things that are due this week are the two homework’s, the background get to know you homework’s, those will be due on Monday -- I'll give some people slack if you're not able to get the Racket running on your computer or something like that -- I'll give some leniency but we'll be able to talk about anything of the things in class on the beginning of Monday.  If you look on desire to learn there should be the two quizzes, both on desire to learn.
So they're listed as Wednesday and Friday but for you guys, I'll -- it turns out D2L will let you turn it in later -- it flags it as late but I'll ignore it as long as you get if in by Monday in class.  I'll make a note of that, but for this section due dates are the Monday at class time after the posted due date.  Does that make sense?
So basically you guys will always be a little bit -- your due dates will all be a little bit after their due dates.  And again D2L will say it's late but don't worry about it, you can still submit it and I'll know that it's not actually late.
Okay.  So, again, communicate with me, send me an e—mail if you have ideas how to run things differently, if you had off hour office hours and I'll see what I can do.  In general, just communicate, if there's something stressing you out.  Let me know.  I may not grant any exceptions but give me a try, keep me up—to—date.
This class tends to be challenging but not impossible.  You'll learn new things and bend your brain in a few places but it's reasonable and hopefully the homework -- I take great pains to try to layer the homework so every homework you actually have only a little bit of new concepts to learn.  The flip side is stay up on the homework.  Don't fall a week or two behind, if that happens then things get really difficult.
Okay, with that said, let's go and try a few more expressions in Racket to get familiarity with Racket.
I'll say real quick, we talked about how in math the fact that Java makes it hard to do exact integer arithmetic but Python and Racket makes it easy, and that tends to change -- you could do it in Java but you probably don't.  Similarly, another thing with Java, Java mistakes a arararrays really nice and easy, so easy that I'll use a arararrays very commonly and using something like a list that's like ararray but you can add and remove things while the program is running -- arararrays never grows or shrinks.  But to make it ararray there's -- to do something like that than to do something like this.  Initializing an error, there's a lot of ways to do it.  If I do it as a list then I add 7 and then add 9 then add 11 if I want those numbers in ararray, Java has it to make it super easy.  When I write my programs in Java I'm pulled using towards arararrays even though a list might be the more data structure.
And in practice I end up doing something like this.  If I want to make a list because I need to be adding and removing as the program runs, I tend to make an ararray to initialize it and initial values and call this static method.Java.(inaudible).add list -- you can shorten this a little bit but the fact that I run the list and make an ararray is an intermediate thing is kind of weird.  I wish I could say (inaudible) I wish I could pass it 72911 -- I can't -- brackets in Java mean a new block of code unless they're the right—hand side ararray -- that's the only time -- it's annoying because I can't use the curly bracket where I want to use the ararray using 72911 -- I make variables and use it elsewhere.
As for practice as a preview, if I want to make a list containing 72911 it's pretty straight forward.  If I'm in the full language level there's short hand -- I don't have to spell out the word list.  So we'll get to that more a little bit later.  But that's another example of how languages -- different languages in a superficial way can push you towards using one data structure or using arithmetic subject to overflow even if you don't need to.
Okay.  Those are just thoughts.
Racket case sensitive -- I'll let you go and give it a try.  Try calling some of these functions with different case and see what happens.  Good question.  I'm putting off not because I want to -- because I don't know the answer I'm putting it off I want you to play around and experiment and have fun and try different things and see what happens.
Okay.  I want to go through and just try a few different things here.  So we saw some examples already.  Here's was an example 14 divided by 25 and then multiply by 25 -- he have more parentheses and it looks different, a little bit less readable than Java's fixed notation.
But go ahead and see if you can come up with the square root of three over two.  Use what is a Racket expression that will give you a square root of three over two -- the top window is like editor -- the bottom went do you can type things -- anything you want to say is put in the top window hit run and it sends it down to the bottom.
Square to five over two -- how would I get that?  Before you hit enter, Steve -- it's not quite right -- but it's close.  Three over two -- do that one.
Hopefully you're all trying something and maybe you're unsure but yeah, Shawn -- Shawn gets it -- Steve's was dividing -- think of -- it's a little bit confusing but think of lifting up -- let's go -- let me come back to that order -- let me say, I can approach this bottom up or top down -- I can see there's square root of three -- great.  I've square root of three -- now I want to say what's that divided by two, I know if I want to divide something by another I say slash the first thing of the second thing so something divided by two is going to be something, slash of something and then two and now I can paste in this square root of three that I did up here.
Or you might come up with starting division saying overall I look at this division is the main thing that is happening here, something divided by something that's the final answer.  The square root of three -- square root of three, yeah, and what was the second thing, the division is two.  I write it -- I start filling these dots, it helps me figure out how to do these things.
How about the order -- how is it this and not the other way around?  When I tell you that Racket -- it's a text editor that knows a lot about Racket.  It has a bunch of keystrokes and I'm not going to -- put a little post if you want to find them -- keystrokes swamping two expressions or jumping across from one parenthesis -- what's the difference between these two things?  Wrong expression -- one is square root over -- think of picking this operate or up and sticking it in between the two others.
So again, you say plus of two three you think to yourself you're thinking of two plus three and similarly divide of 84 you think of that as 8 divided by 4, that's what you're thinking of in your head.
8 divided by 4.  I'm always doing that in my head.
So square root of three over two -- that eat one that we want.
How about the co—sine of pi six -- just like Java co—sine and functions take radiant amounts -- co—sine of pi six sounds intimidating -- we have all the tools if you can guess the name of the co—sine function -- cost.  Java it's math.cost.  Now co—sine of six -- how do I say pi of six -- that's division right?  So I'm saying it's going to be co—sine something divided by something, pi divided by six -- how do I say pi -- it turns out it's a belt in constant.  I forgot if I showed that earlier or not.
Actually we know -- you might remember from trig co—sine of pi six, 60 degrees is square root of three over two -- calculating gives almost the same answer -- they differ in the very last place.  Racket tells me their (inaudible) -- I shouldn't be too surprised of that.
Okay.  Let's try one more and call it an evening.
One plus the square root of five over two -- this is sometimes known as the golden ratio.  Before you type the answer into the window, pi six is a raid end -- the owns co—sine is a unitless amount but you give it an angel that is pi six and radiance -- before you type in the answer, everybody give this one plus a square root of five over two -- we have addition going on, square root going on Andy vision going on and I'll give you a hint, we'll have a set of parentheses for each of those Rackets -- open paren -- I like that start -- something divided by two -- see if you can replace this with one -- break that down further, one plus the square root of five -- that's -- what functional I calling -- one plus the square root of five?
We're missing a two There.  Mark got carried away -- he didn't do this and fill in the stuff -- and by the way, I write -- once plus the square root of five that's adding two things.  The other one it's adding is square root of five.  It's not as concise as it would be in Java.  In Java that would be math.squirt.  After a while you get the knack of writing and reading these expressions.  If you want to do things -- you want to make it clear here's the division of two things and I put them separate lines.  I hit return Racket did the indenting -- it's mart how to indent things -- I look at this it's pretty clear.  And also a handy hint putting your cursor next to a an open or close paren, helps to figure out where they're starting and finishing -- if you get them mixed up look at each one and think about is that the right thing.
Awesome observation to end the evening on.
Order of operations.
In Java you have a whole bunch of order of operations.  You learned in school.  In Java there are 13 levels of order of operations and 35 operators and it's a nightmare.  They mostly work for when they don't.  Here's something we're learning in the new language.  No -- there's no concept of precedence.  And the price of requiring every essential parentheses.  It's the trade off.
So anyway hopefully that helps.  Have a good remainder of the week.  Send me e—mails.  Look at the desire to learn, the homework’s -- I'll get these lecture notes posted in the next 15 minutes or so -- it will take me a few days to get the links working between the web page and desire to learn.  For practice go back and type in some of the things we typed in tonight for you to get practice with them.  I find the hardest thing when people are starting to use rack itself is putting that parenthesis before the operator.  You want to say square root of five you need to get your fingers to put that open parenthesis before the name of the operator.
The fact that the operator always comes first and not in the middle sometimes, in Java the square root comes in the beginning about the plus comes in the middle, that pile comes in the middle, slash in the mull of the arguments.  It's pretty clear that Racket is simple letter -- so you say plus one two not (inaudible) -- the biggest thing I find people goofing up is that paren.
Okay.  Sounds good.  I will see you all next week.  I'll post this again we'll meet at 5:45 next week.
I did get an e—mail from; Steve I haven't had a chance to look at it.  I got overwhelmed by stuff some I'll look at it and reply later tonight.  Good night all.  In tech about ten minutes before -- about an hour before this class I had a crown that fell out of my mouth so I'm making dentists appointments for tomorrow.  Okay.  If you have questions I'll stay on for another few minutes. 
		(Class ended at 8:22)
"This text is being provided in a rough draft format.  Communication Access Realtime Translation (CART) is provided in order to facilitate communication accessibility and may not be a totally verbatim record of the class."