testing, 1, 2, 3, testing, 1, 2, 3.
	Hello, now my MIC seems to be on.
	Is anybody there.  Okay.
	Good evenings.  How did the homework go for people?  Did you get a good start, feel good about the parts you did work on?  Did they not make sense?  Part of what, I'm looking for in this, this I felt was a lot of following the template.  In particular template for a list of items but being able to say, I have, this here from the recursive call, I have this and I can put together to process the entire list, now that I have a list of helps with aliens how does that help with things like update world, things like that.
	And so, I think the biggest thing I'm trying to get through with this and somebody was asking, do we have more homework to add to the game, no this is the last of this.
	Sure we could do more, like I say adding alien bullets, would be a little more, and that might sort of cement things and drive it home but I'm happy with a what this homework asked for in terms of processing lists.  That's the point of this homework.  Let's see -- my solution, I need to make sure it doesn't overlap the chat window.
	See if it has anything about my solutions in here.  I don't know if you played with options in Racket.  One of view options is for show program contour, this thing on the right, it's birds eye view from the program of 30,000'.  After doing this I can recognize certain parts of code.  Yeah that was check-expect from such and such and my name constant thing was recognized where they all are right up there.
	I pulled them all into one place for this homework, but -- okay.  Why thank you -- it's been a long week, it's only Monday, I'm in trouble, aren't I.
	So sharing the desktop and start the recording.
	Eye I would have liked to phrase this homework as, right space invaders and leave it at that.  But, so part of learning process of this homework is saying I gave, it may have been confusing, why this function here, I see it's part of a bigger problem but this little bit, this little bit, and then we put them together into the bigger parts.  And, part of it was to get practice in separating things.
	One of things that functional language does differently, not that it's a core aspect of functional language but people tend to write smaller functions than other languages.  In Java, if your method is more than 20 lives you should break into different parts -- not sharing again, should be sharing -- I'll try -- okay.  Am I sharing know?  Didn't have my screen up, yeah.
	Okay.  Good.  Yeah, part of this, purpose of this homework is saying, for say move, draw alien last week and this week draw aliens plural and ideally follow the template and go ahead and draw aliens an recursive call gives back image, that's exactly what draw alien single one should be given, give it to that and get my exact answer.
	And so -- draw aliens, might be the going through and following list template, and does the list processing, draw alien singular does one particular alien, in Java somebody might say, within 20 lines I get have a loop and the loop will go ahead and draw each alien in detail of all alien drawing and more likely to get Java programmers do 2 different tasks in one function, when they're better separated.  So, this part of what we're talking about, conveying.  I think in Racket, more like, if I have a line more than 5 or 6 lines, I might start thinking about breaking it down or not, depending.
	But.  So yeah.  How you did exactly number 10, if you can go ahead and design from scratch, I feel great, I gave the way I go about it and help to avoid repeated code.
	What is left most, have a function left most that takes aliens an tells where left most alien is.  It's not that it forces you to, no reason we could not write a Java program that looks word-for-word identical to Racket program.  For this method, that method.  Just you tend to write smaller little chunks in functional language for whatever reason.  You're thinking more especially when you don't have mutable data, easier to breakdown into the chose chunks an pass pieces back and forth and have the test cases.  So -- I think it is worth noting before I forget, I'll throw in here, what are, is one -- well -- I'll write it down, come back to this -- I didn't have it explicit in my notes.  I'll going to come back, if I don't do this in this hour or next hour, the memory usage and how it looks like in this program that we wrote.
	Okay.  If I look at the here I'll go ahead and run my solution and I think make sure the big bang, I'll add that in -- and so I run that, and pops up this window.  Takes a second -- so I have, pretty lame graphics.  It's a fleet of 6 aliens up there, I can try to shoot it.  I have the -- for better or worst rather lame convention, exactly one bullet in the world at all times, now it's way above the screen and going up.  That's why when I shot, as soon as it hit I brick new bullet appeared on top of cannon rings I touched fire key once and happened to get lucky here.  And so I can do stuff.  I did implement speeding up.  It gets lower, requirement for fun only, not a requirement.
	So we go ahead and get that.  I'm curious --if I make sound it goes in through the microphone, I wonder where the speaker is, it turns out, for fun, in that, there is a way to play sound in Racket, there's a library that does that.  And if you happen to look inside that student extras, have access to that function there, play sound.
	I don't think you'll be able to hear anything, it won't be going through the mic -- but we'll see --(hear beeping, beeping.)
	PROFESSOR:  Sounds like it is going through the microphone, it is, sorry -- holy Molly, okay, -- you hear the sound on your end?  -- okay.  So, I thought one thing that was interesting about this -- okay, --
	At any rate, and when I finish it runs test case that's make a bunch of sounds in there.  One thing I thought was interesting, my wife, adding sounds made a world of difference, it went from being totally lame to yeah, lame but mildly interesting now that there's sound in it.  Psychologically the sound makes a big difference.
	How did I make it stop, I had a clause I added to the homework down in big bang, you give it, a bunch of stuff, when you call that big bang method, you see, again, when I grade I'm not going to look at big bang, I'm looking at just the test case cases, the other functions and their test cases.
	Big bang, give it on the on key, give it a function to call every time a key event happens, on tick, give me a function every time a timer event happens.
	Draw world, let me know how to draw this every now and then.
	In terms of stop-when, so, yeah, there's different things that you can do.  So you can pass stop when to big bang and, yeah, I passed a function when fleet was empty or what, you can see here, the bottom most of the alien fleet was very big below where my cannon was.  You don't need to do that, that's not part of homework, calling this big bang.  And the stop when.  When running test case I find it distracting if it pops up every time so I leave it commented out.
	I think it's interesting, what do we call this architecture, where we go ahead and have these, here is the key event handler, here is the -- how to draw this in the update world function.  What do we call that architecture, can anybody psychically guess the term I'm fishing for?  -- or what 3 words I'm fishing for?  -- so object oriented.  We're not really object-oriented here, I make struc but don't do any inheritance, without inheritance you're not really doing object-oriented programs.
	But, I'm thinking about this as model view controller.
	What is my view?  It is the function draw world.  That is exactly my view and I can go and switch to some interface, have the view that worked, on all tech terminal or have Twitter version of the game it tweets you the status of the game and exact same game, just draws differently.  All I would have to change is what, the, draw world function.
	And I would not have to change anything else.
	What is my controller?  It's the function world handle key.  I can point a code and say this code here is my controller and this code here is my view.
	And I guess everything else is the model.  The model is structures we're using and the main function that's work on those structures.  So update world and update aliens and things like that.  Move bullet.  The first time I saw this, that's model view controller, that makes more sense and, was sort of more vague distinction -- and then I saw people, Racket people doing this with big bang library, that is exactly model view controller in precise way, I can say which characters are part of source code, model or review.  So -- yeah, and the whole reason we like model view controller, if you have not heard before, it sort of separates, used to be games the drawing of the board and key press handling and mouse handling and lock I can to update the game would all be part of same function and that's, well, okay, it is what it is.
	Now you say, great I want the exact same thing but port it to a different display.  I want to move to color or black display or audio display that's not visual at all.  You have to make changes all over your code and it's not easy to do that.  Whereas model view controller says separate out these different concerns and put them in?  E in Java separate classes or separate files an makes easier to maintain the code and switch output.  If you want multiple views, some games, have, player has one view and might be audience view that doesn't show all the information, or shows more information, shows both sides in hands and resources an stuff like that.  Those are different views with the same model.
	So -- anyway.  That's another side effect to get out of this assignment.  Is being becoming familiar with the term and having a good feel for it.  What else?  With -- so here is going to be a little side digression.  Don't worry about this too much.  Playing the, playing the sound that I put in.  Great, one problem I ran into, I'm in the student language level, and play sound is a void function.  It just plays a vial and doesn't return a file.  In Racket, every function has one body expression and you need to return exactly one answer.  So -- and that was causing problems.
	How do I get to that.
	Turns out play sound actually returns, not quilt void, turns true, always returns true no matter what.
	-- and so I ended up having things like this in regular code, I did everything before I add that had last night, but regular sound, here I called move aliens.
	Okay -- great.  And I'm like, every time I move the aliens I want to play a sound.  Okay.  This actually is the part when I move the aliens down when they reach the left or right edge.
	Every time they move down I want to play a certain sound.  Here I went ahead and said, okay, gosh is how R here is how I get it to work, play sound   returns a Boolean, I'll stick inside IF statement.  I don't really want the IF statement.  It always returns true to the calling move aliens which I need to be the answer.
	But as a side effect, checking the condition it ended up playing a sound.
	Okay.  That's a little gross an clunky trying to fit this idea of not returning values and put them into this functional approach.
	In full Racket you can have, you can have statements that are void.  Do nothing.  So, full Racket if you have a function, if you have more, in our version we only have one expression and that's your answer.  And my example here, move fleet, this left star, that's the answer.
	One let star, whatever the answer to let star is the calling function.
	In you will full Racket you can have several expressions inside a function.  If you have 3, it evaluates 2 and throws away the result.  And evaluates the third one and that's the answer of third one, that's how Java does, right.  Each line, each statement, throws away the result.  Statement throws away any result, and unless there's the word return in front of it, it throws the result away.
	Now, in Java, those statements in addition to, they may or may not return an answer, but have side effect, change the contents of variable or (inaudible) like that.  They mostly don't return an answer, if they did.  It turns out if you have I plus plus on a line by itself, that actually returns a value, returns the incremented value of the counter, you don't use that expression, but it does return an expression.  It also has a side effect of changing the contents of a variable.
	student level I could not do that, I had convoluted dance that I D which made me realize something that I like to do.  -- it turns out something I do, next thing I try after I remember, I'm in stew dint language, can't put it thereby itself.  Before I get to putting inside if statement I try one more thing, I tried -- and of play sounds and name of sound file and so on followed by the things that I really wanted to return.
	Okay.  Now play sounds always return true, so what does the and function do, and evaluates this thing if true, and then evaluates the second one and comes back with the answer.
	If play sounds returned false, it would short circuit and stop.  
	And this, this again would work in full Racket and another thing that I often do when in full Racket, use an and.  But the problem is, the second expression is not a Boolean.  So the student language is a complain, and stew sent language, you give it Boolean an returns a Boolean.
	In full Racket, it turns out and most languages, and might be a little bit more generous, it might give it, if something, give it, might tree other value as true-or-false-ish.
	So -- yeah, so -- in fact, here is something I write in Racket code or could easily write.
	What does this little expression do online 5 and 6 here?  -- data might will he a list of stuff -- well, this goes ahead and if the, if my list was not, was not empty, what does it return, what does this whole and evaluate to, -- turns out, and evaluates to the first of data.  How does and work in full Racket and in quite a few languages?  It goes through and it looks for, if returns true, it keeps going, keeps going and last thing, if not false, it returns true, but it actually returns whatever that last thing is.  Okay?  And even, intermediate, if it's anything true-ish, if false-ish it might return false.
	This is a full Racket expression that's common.
	Give me first thing on the list, what if list is empty?  What does that expression return?  If data happen to be empty list, what does, what do lines 5, 6 return?  -- doesn't you are return the empty list, so if this is the empty list, then empty of that would be true -- not empty of that would be false.  And now an and comes along and sees Boolean false and short circuits, I don't care what comes over, never be the case both is true and returns false right away without trying to take the first of the list.
	So -- yes, this is nice because it doesn't generate and error if the list it empty even call s first here.  Why?  Guarding that call here and is often handy way of putting those together.
	How other languages handle this, parentheses get easier with experience?  If nothing else, think of this as the function -- and -- and passing it 2 things.  And first thing, not of something.  And that thing here is empty, of data.
	And this thing here is first of data.  Here is the same thing, exact same number of parens but I don't put the paren, in Racket, you put that parentheses before the function you're calling, here I'm putting it after.
	In Java, the and list is (Inaudible) function.
	And some, not, has special weird character and doesn't require parentheses, here is Java code that is, perfectly reasonable sort of Java code to write.  -- check both of -- I'm looking trying for similar things here.  -- 
	And first of data.  Something like that.  If you saw that in Java that would not be too many parentheses and that's the exact same number of parentheses up here.
	So -- they do tend to pile up in the end but we have Dr. Racket to keep track of that for us.
	So the answer is that, with experience, in fact you start not the parentheses after I while, the function between the indenting, meaningful indentation, you start ignoring parentheses you put them there exactly when the call the function and come back to that in related note, too.
	Okay.  Just keeping things light and easy, not stuff that will have homework questions on or anything, but this idea of false-ish and true-ish is different in different languages.
	So let me pull up my broader -- here -- and see if I have different, do a Google -- don't know what that is -- I don't need that any more -- do a Google search for -- I thought I had it up -- Java script true-ish, undefined versus true, I guess they spell true-ish with an E, -- I remember, what was that a code?  -- row set ta code -- ROSETTA code -- HA, -- why could I do the search so great before the class and now I'm having trouble finding a good -- da-da-da -- how about false-ish.  Yeah.  Rats I can't find the site.  Unfortunately I'm in FireFox for this, and I was doing that search in chrome.  And starting chrome takes forever because it opens tabs with video that's I have.  So -- da-da-da -- I'll go and Java script true-ish and forget the ROSETTA code site and find something close.  What does this site say? 

	Actually I think I wrote down some links -- no.  Okay, go ahead and try, put a block -- comment this out.  This is web page that is Java script and do things like, if, for, write, hi, else, write, see if this works.
	Okay, so, this one statement, notice that I don't need a Boolean in the if statement in this case I can have a number, Java doesn't let you do that, PHP also does this.  So 4 counts as true-ish -- let me run it, get rid of that for now.
	Okay.
	Whereas if you do something else, how about the string --s blah, is that going to be true-ish or false-ish?  What do you think?  -- run it, and blah is true-ish, what about the number 0.  Try that, 0 counts as false-ish -- yeah.
	While, and there are other things too, null and so on, null counts as false-ish, how about the string counting 0, that's string so it's true-ish, other languages might go differently.
	Here is a bring up text window and run PHP interactive, window, so first PHP I echo true and what's going to print?  Prints this one.
	Actually knows it's not the same as true.  If I say echo false, what is going to print?  -- yeah, so like a false clearly going to print 0.
	For whatever reason, false gets printed as the empty string.  But, okay.  How about this.  If, I'll do the same thing, if 4, echo true-ish, else echo false-ish, I try that, and that's probably going to be true-ish, sure enough.
	-- does PHP always give unexpected answers?  In a huge variety of cases, yeah.  There's a website, PHP sorrow.com, that just full of, just really crazy things that, PHP ends up doing.  You then read interviews with the guy that invented PHP and say language designers, don't make language but don't worry about designing them and you get surprising behaviors.
	Another example, 4 is true-ish, 0 is false-ish, okay.  What about the string containing 0.  In Java script that's true-ish because it was string, I'm sorry, what about the empty city string, it turns out to be false-ish, how about the string containing 0?  That turns out to be false-ish in PHP as well.  But the string containing a plus sign followed by 0.  That's counts as true-ish or 000, only the string that contains 0, yeah, oh, my goodness, goodness.  What about the string containing the letters FALAC, I don't know, that's true-ish right there, --yeah, so -- PHP has, particularly weird things, why does PHP treat the number, the string containing 0 as false-ish?  PHP is made to work, make it easier to work with web pages. 
That's one reasons, one innovation.  When you type in stuff in web form.  Fill out age and put in some number and send to web server, what type does the web server receive?  Just because you typed in 49.  It receives the string 49.  Why?  Because when you send things over the wire you send raw bites.  Think about sends ray characters, rebuilding everything but bunch of streams, characters coming in.  In Java if you want to -- (Inaudible) you have to, PHP is trying to say it's easy if you give me a string that looks like numeric I turn that into a number 4 for you.  If you string 43 equal equal to 41 plus 2.  Oops, need to say echo.
	
	It comes back and says true.
	It consider that's true.  -- yeah.  So, whatever, in fact here is weird thing, is 43 A equal to 41 plus 2?  And the answer is yes.
	Yeah, which is really weird, 43 A is not equal to the string 43, but 43 A is equal number 43, the number 43 is equal to the 3 (Inaudible) now equal equal is not transitive.
	If you follow that.
	A was equal to B, B equals to C, but A was not equal equal to C.  You can do that by having, so yeah.  43 ar, equal equal 43, 43 equal equal the string 43.  But, 43 A equal equal the string 43 is not true.
	So yeah, -- crazy things that PHP, you count and equal equal as being transitive, assume that, not even think twice.  The reason of your program that equals that and that equals that so those must equal that, but not necessarily those in PHP.
	PHP does have the equal equal operator, which is trying to be helpful, I find that I don't, too helpful, does too much stuff, there's equal equal equal that says are these 2 things the same without doing any type conversions and that gives you the answers you always expect.
	String 43 is not equal equal equal to the number 436,789 anyway.  What's the point?  Different languages have different ideas what is true and what is false.  Just try, what is true -- what is true-ish in Java script, that should give me something, no -- gives me the same things.
	First wants to -- stack overflow --yeah.
	Oh, well.
	So -- yeah, the different rules in different languages, why talking about all of this?  It's sort of related.  talking about different languages and how they handle things.
	Back to Racket example, this line 5 and 6 is thing I do in full Racket, in turns out in Racket, Racket considers false to be the only things that false-ish, any besides false is counts as true-ish, including empty string string, 0, 0 a I ray.  Java Script empty array counts as false-ish, just as empty string counts as false-ish, I like Rackets, they inherited from scheme, false is false, if using Boolean context will be true-ish, that works well for me and easy to remember.
	And, it helps to do things like this, as line 5, 6 thing that is convenient to have rather than some sort of F -- if statement.
	Those are thoughts as I was looking at my solution, different things I was doing.  Anything else I want to -- comes to mind -- are you totally sick of writing cons of cons of cons of cons to make your test cases?  Of course you are.
	And one thing we can do now, that I'll let you do to finish this homework, cut and paste helps but it's hard to even read, you know.
	We'll go ahead and let you now that we've done this homework I want to emphasize it, because, if I talk about using list too soon or let people use list too soon people start use anything function, when they want to use cons in their functions will.
	I want to stress how list are made.  It turns out function called list takes in as many things you want to give it.
	And makes a list out of them.  It does all the calls to cons for you.
	Like plus can take in as many things as like.  Oops.
	-- plus takes in as many arguments and adds them.  -- list takes in, you don't need to put the empty list at the end of it.  That's nice.  We can start writing things like -- like this.
	And it's a little easier to see what's going on.
	Use thing function list.  So, this is helpful, especially when making test cases.
	Not so useful inside my functions so much.  Cons is used inside functions.
	Why, if you I call list and pass at 3 things I get list with exactly 3 things in it, nevermore, never less.  Function doesn't want to return lists of any lengths, you call it you pass exactly some number of items.
	For test cases, I want 4 aliens and list, go ahead and to that no problem.
	Now finished homework, you can use the, use list if you like.
	So -- okay.  -- anything else in this string here?  One thing that was annoying to me, logic about, hitting the edge of the screen, when I first wrote it, my aliens go across and if they reach the edge of the screen -- go and find update world here -- update world called move fleet, move fleet is the one that moved all of the aliens, including figure to move to left, or move down, if it's off, if the fleet is off screen, that was a helper function I wrote, off screen, that helper function just used left most and right most.
	But, okay.  -- if it was off screen -- whatever direction they're suppose be moving.
	And that, was fine, here is what happened --
	DIANA: Losing -- going in and out.
	PROFESSOR:  Get off screen and move them down, move them straight down, and now, -- great I come and do update world again and still off the left edge of the screen, so I move them straight down and next time straight down, left edge of screen and go WHOMPH, all the way down, down one step every single iteration.  That's not what I wanted.  So, wanted to worry about saying, you know, when I'm off the screen then move down and what I ended up doing, if off the screen, go ahead and move down, this Y component is not 0 and gosh move backwards from the direction that you should be moving.
	If you're move to go the left and you're off the screen I move you down and right.
	And there's other code that's updating the whole world about what is the overall direction of the fleet, going to right or left.  That's in some other code there.  This is one place, where things didn't fit together nicely, the fact that I have to backtrack one step.
	To get it back.
	If you look, remember solution, aliens did good and turns out center of left most alien go off the screen before it moved down.
	One thing, some people have questions about, update world, -- was, gosh I have one thing for figuring out, what was it?  Move fleet, move the whole fleet right or left, I'm sorry, about the bullet.  So -- I don't think I have any nested if's here.  -- I don't have, if inside of an if.
	-- but, -- but yeah, if inside of the function yeah, that's handy.  Yeah, the one thing, confuse people, my bullet is hitting alien so I need to get rid of alien and bullet.  I made a function, asked you for a function, given a bunch of aliens return the survivors, give one's aliens remaining.  That's just worried about aliens.
	Separately, people are how do I get rid of bullet and I want to do it here, no, I have make world says, update the cannon, the cannon always stay the same, update fleet, helper function do the whole fleet and update the direction that they're going and so I probably should -- this is enough on the verge of putting in helper function, this whole 4 lines long and would read better, if update fleet direction of world.
	-- okay.  And then I had the list of aliens, sorry, I did the aliens moving aliens including getting rid of one that's hit bullet and here for the bullet I had to go ahead and say -- hey, -- for the bullet, the, I'm doing that, asking that kind of twice.  Is the bullet hitting any of the aliens.  Once I was asking give all alien that's survive and other time asking is it bullet colliding with alien.  But, sort of, in a sense similar work.  And I did it twice.  One for figuring out what new aid yes or no and once for figure out new bullet should be.
	That's another case, where people got confused.  They wanted to make one pass, is the bullet hitting aliens and both update 2 things.
	Give you back aliens an give you back the whether or not the bullet collided.  Okay.
	And you can do that, can have a function that return twos things.  Maybe I'll pack them both into a list and return this function this function will return a list of exactly 2 items.
	Updated aliens an date the bullet something like that.
	And you could do that.  And might do that.
	I was happy with saying, hey, updating the aliens is one thing, updating the bullet is its own thing here.  Here is where it's 3 lines, only 3 lines I'm happy to not have helper function to do that.  I do have helper function for alien collide bullet.  Aliens plural, collide bullet.
	But yeah.  So this will go through, list of aliens, and looking for collisions.  This goes through the list of aliens looking for collisions an happy to have that in 2 places.
	If I wanted to get rid of it have function to get rid of both pieces of information.
	Use left started, give a name to that list of length first and talk about the first and second item of that list to extract those.
	-- the one thing that, probably helped, or maybe confused you, is, you're saying, hey in my other languages I go through and set the list and going through and finding surviving aliens if bull bullet hits anybody I go ahead and set global variable.  Say, whatever, the bullet object and change it.  Because it went ahead and hit an alien.
	And that sort of nice here, have I to do that work in -- once I did that work for aliens and once for bullet, the way I did this.
	And gosh, isn't it nice, have to do once, and it is, on the flip-side, my code, goes ahead and updates something, updated bullet is being affected by code running entirely elsewhere about updating aliens an reaching in through that global variable and reaching into some code far away in code base and make it's harder to keep track of things.
	In general, people avoid global variables, look at guidelines, look at coding guidelines, make your data structures immutable when possible.  Don't, even set variables an try to pass those around.  Change fields.
	Makes everything immutable and makes your program easier, this is an overall win, this is one place people are confused by that.  How do I grade.  Do you have function that's make sense?  Do you have test cases for them.  It's a pain to make test cases, 40% of points for making test cases for a function.
	Is the function, do you have the all parts, purpose statement, contract, is the rough template right, is it pulls out different fields, cond with right number of branches, union type and that stuff.  Does if make sense for what the whole program needs to do.  Is it a helpful function.  So those are the main things.  And then finally, is it doing, is it not doing too much.  If you have something doing too much maybe you should go into its own helper function and some of this, it turns out, you know these lines are for playing the sound I stuck in the end.  It was this one and this was another field I stuck in for playing the sounds.
	So, my code was this long, and this was about the longest I would like to see, because these 4 lines I should probably have made a helper function to kept track ever what direction does the fleet need to go.  This is also the part.  I made it go faster, every time it moved down it went faster, there's add one in the middle of that.  It doesn't need to look like this at all.
	Follow the design recipe, do those steps.
	And look at test cases.
	Do test cases.
	Do you check for empty list, do you check for list of length one.
	I had a lot of students in office hours with things that didn't work, they don't know where the error is, you gave list of 5 things, failing the test case, make me, after writing test case for empty list, if failed empty list we can track that error down quick.  If it pass the empty case but failed the list of length once, we track that one quick too.  And those are all the errors that I got.  No error that's failed the list of 5 but had not fails length 0 or length one.
	Test cases test the small things.
	-- this is probably a more -- reasonable function size here.
	This is the moot fleet.  I use let star, -- survivors in 2 places here -- part of this is the play sound as well.  I have this sound playing and adding 2 lines to this.  6-line function.  My function off screen, fleet off screen, that was handy helper function that made things reasonable.
	It's single or statement.
	Right most bigger than the width of world, and that's called left most and right most, each of those was short.
	So -- okay.
	Yeah.  So does that answer your question Steven about the grading.  Test cases.  Following the steps of design recipe, that's a lot of points.
	Making sure it's done well and doesn't try to do too much.  Indentation, don't make me read poorly indented code.
	Okay.  So I'll post solution up there shortly.  Let's take a break -- and come back in 6 minutes.
		
	[Break Time] 
	[Break Time] 
	[Break Time]  

	PROFESSOR:  Back to discussion here.
	One thing I want to think about now that we sort of got more into to this, memory usage, thank you.
	Flipped is more useful for recovering thing.
	Hopefully video that's I post, in the hour long chunk, I don't have to time to the give things in smaller chunks in this one hour breeze thing, which is 45 minutes to an hour, there's a little unwieldy, -- if you want to find something, hard to remember where it was.
	I want to go here and talk about, comment maybe, what are advantages -- and, disadvantages of functional programming.
	Now written larger things, got more experience at least in using a functional approach.  So, I think it's kind of cool, you wrote entire video game without assigning to a single variables.
	Without changing a single field of an object.
	That's hopefully a little impressive.  Should give you pause.  I would have just before this, said, how can you program without assign to go variables.
	I seen, -- and you know -- how do we assign to variables in some sense, assign to variables by calling to another function and passing in as what we want the parameters, new variable that's we use.
	And we use, talking about tail recursion that, if I want to reassign to variable that's like making tail recursive call or making recursive call, I had parameters X and Y, I wish I can change them, make recursive call and pass in slightly different version of X around Y, X and Y have their new values.
	Maybe it's the same thing, but it still feels different.
	So, advantages an disadvantages punches functional approach.
	When I'm saying functional I go ahead and say, focusing on immutable data.  So no assignment to variables, no assign to go fields.
	High order functions is great, and that's often what people mean by functional programming but not the Hallmark to me.
	Anybody want to throw some, ideas out?  -- and by the way -- I'm not talking about Racket.  I can write the same program, write all the same functions I wrote here, write them in Java and it would still be a functional program written in Java.
	So not allowed to say the parentheses.
	So smaller, smaller declare functions, that's true, I think people tend to do that.  I'm not sure Y why you tend to have smaller functions an write better code because you have smaller well to find tasks.
	Happens to -- somehow -- encourage writing smaller more focused functions -- in Java you, you know, the guidelines say, if you have more than 20 or 30 lines of code break into sub parts, if you have more than 6 lines, start breaking it up.
	I'll pull that fairly down.  That's so intangible.  I'm not sure there tends to be that difference.
	Having types an type system.  That's not incompatible.  You write Racket, using functional programming and happens to be, dynamically typed language.  Those are unrelated issues, we can have functional programs, has hell and, stat (Inaudible) static type stinks they're also functional.
	So -- declaring new objects is smaller and simpler?  I'm not sure about that.  Calling new book in Java and make book in Racket is about the same size.  Same number of characters.
	Defining book, we had struct book versus class book, almost word-for-word, except we had types in comment where Java might have it in code.  That's the type system.  Which is not functional, yeah.  So, the thing I'm thinking of, is -- first of all, let me look at disadvantage.
	We never assigned to field of object.  We won't to manufacture to alien, what we do, suppose alien had 17 different fields.  We want to move it a little bit to the right.  Which is change X coordinate.  How we do that in rec cat?  we don't change the field, what do we do?  -- hey, you give me the alien update I'll give you back a whole new alien struct, make new object and copy 16 fields, and X coordinate you want me to change, I'll update that one.
	So in order to change one field, I actually made all 17 new fields, copy 16 of them over.  So -- yeah.  So what happened to that old alien, the alien we pass into the function we gave new alien back and we look at our code for move alien -- da-da-da -- here we are.
	So check-expect this here.
	So in our first version, even from previous homework we had one alien in the world.  What happened to -- that old ail yens much.  We had alien called update world, update world move ail yens and made New World that had the result of move alien.
	Yeah.  It's still in memory but, after, you know, gave this function update world to the big bang handler, the binge bang had idea of current world and every now and then, like sitting around waiting and, event happened, I'll take this world object and feed into update world and get back a New World object.  And this one here, whatever variable is holding that I don't worry any more, I have new one here.  The old one still in memory, sitting behind me, but yeah,   what happens to that?  That object.  Big bang will never go ahead, lost reference to that, thrown away, what happens to that memory?  --so old objects are garbage collected.
	Okay.
	And this can be done, automatically for us by the machine, so yeah.
	Struct that's you used and then didn't, end upkeeping any more.  Yeah those just, you call the new value and old one was just gone.  There's no way you can access it again.  The computer can realize there's no way to access that chunk of memory, that particular alien object and correct collect it at some point.  Let a bunch accumulate and garbage collector might run for a while?
	Run once every 15 seconds for a tenth of a second or something.
	-- okay.
	Or worse, could be worse.  -- rather than mutating field, copy entire struct, is that good or bad, old objects are garbage collected.  None of this is good or bad in itself -- but now can you give me a reason why you might not like this approach.
	You can come up with this.  We're not that tired yet.  We have not been doing -- particularly technical stuff so far.  Right?  -- you're still with me?  -- why would you say, I think it's better to change one field rather than copy everything over, why might you prefer that?  Yeah, it's a lot of, it extra overhead, extra time.
	Just to do the, to find memory, and copy everything over.  It's more CPU time, rather than just change one field, boom you're done.
	Time and memory, in particular -- that's a disadvantage.  We'll come back to that.
	And advantage Of functional programming.
	Racket (Inaudible) not inherit to functional programming per se.  Racket is like JavaScript, dynamic type system and interpreted, JavaScript object-oriented and mutates while Racket doesn't.
	Precision, I think it has number system.  I think we saw something about numbers of that, that's not inherent to the language, you easily have Java had better rational numbers -- that kept in precision.
	So Steven is -- yeah, again, JavaScript you don't declare your types either, that's not functional programming, that's a different issue of dynamically types versus statistically typed.  One thing about functional programming and not having immutable data, things that happened, if I'm looking at a function here -- the results of the function depend only on what I pass into it.  Nothing else.
	In particular, doesn't depend on, what some other function does later.  Say I have, you know -- this function returns a pep yi dog object but other function that has ail yens to it and changes some of its fields later on that can get hard to reason about.
	Since every function's result depends only on its inputs, no globals and no other function can mutate our fields.  That's another thing that happens in Java, you call some sub, make array and call another function and when that other function comes back your array is different than a moment ago.    might be the point of calling that function, but in general you might forget it's suppose to return some answer and happens to change things in array.  It's harder to reason about.  So every functions result depends only on its inputs, programs are much, I have sound?  Hello?  Hello?  Shows me as still making sound --okay.
	So it does mark and Sean.  Okay.
	When I say reason about, debug.
	Okay.  -- and, as a, also, known as any bug can be uncovered by unit test.
	Okay.  Oops -- yeah, if you have bug in the code it's only depends what you Fed into it and what you get back and be able to track it down with good unit tests.
	So maybe a slight exaggeration, but not really.  So this, I'll mark this as plus because that's a strengths while this is a weakness, a lot of people say functional programming and look at reuse that's awful because it's so inefficient, and I think, one answer is, maybe in 1970 there was a good reason why list didn't catch on and 4 tran did, because machines were so slow, any inefficiencies were compounding tings.
	But Java, in the late 90's, Java's string class, the C programs, looked at Java and said, what your string functions, your strings are immutable.  What if you want to capitalize the first letter of a string you have to copy every character of string -- that's insane.  That's so inefficient, you're making no sense.  And yet, Java strings work well.  No one is unhappy with Java strings being immutable.
	People, actually quite happy.  There's ease yir to reason about.  You don't give somebody a string, pass a string to helper function and some of letters in string have changed on you, yeah.
	What does ADA do?  -- lock it down hard, lock down the strings down hard?  Oh, the in parameters and out parameters.  Yeah ADA is, if you think about in parameters and out parameters, out parameters are way to return more than one piece of information.
	It's like I have, I have a function I want to compute something and give back 3 different answers.  Can only return one value.  I guess I can make a list of 3 items an return that, that's often what people do.  Or go ahead and say, return one value and have 2 out parameters.
	Yeah.
	And yeah, they sort of, really, and then your programmer or call the function that has out parameter.
	That is good to go change.
	I'm going to go back to point extra memory -- how much extra memory.
	So think about the -- update alien that's we did.  We have the whole world, we have aliens Marching a cross-examination the screen.
	We have a list of one hundred aliens an call move aliens and get a new list of one hundred aliens, so really there's 2,200 aliens going on.  One hundred we just had an, the ones creating to pass back as answer.
	We pass back that answer, the one hundred old ones, I'll probably lose a reference to them and they'll be ready for being garbage collected if need be.
	And then, I have this one hundred new aliens and take another step, take these hundred aliens and copy another hundred aliens, how many memory does that take?  If nothing else, I can go ahead and use the old space of one hundred aliens no longer being used, garbage that's collectable.  Yeah, if I have one hundred aliens on the screen and did mutation, I never need more memory than those, mutating those fields.
	If doing this functionally I need twice as much.  Never need more than twice of number of aliens that I have.
	Up to/twice but not more.
	-- so, yeah, that actually goes and, keeps track of things.
	Let's look at something else.
	I have list of aliens and want to look, say hey go ahead and remove aliens not hit by a bullet.  Okay?  So remove ones hit by bullet.  You have one hundred aliens an maybe 2 of them collide with both and I come back and have 98 aliens.
	When I think about memory being used.  Those 98 aliens are still exactly the same as before.  I'm keeping a reference to those.  I might be building up new cons shells, holds the spine of the list of aliens objects, but most of alien objects are being shared and not using twice the memory -- because I can, often share memory, and sharing memory is save because everything is immutable.  I'm not worried about this alien here is the same alien some other function has a hold of.  If I change this exposition is that going to confuse the other code someplace else far away in the code base.  No we'll not update that field.  If they want a different alien they can do whatever they want, get a new one.
	Okay.
	So -- there is extra time and memory used in the functional approach but good to note memory burden is not that much.  Often much less than a factor of 2.  If you have I list of aliens and bullet and bullet was not hitting any aliens, which is the case 90 percent percent of the frames, you might not use any new memory at all.
	So -- you'd be actually right at par with the mutating version.
	Okay.  
	So I think that's, good to know -- these 2 different, this is definitely a weakness functional programming, this is definitely a strengths.  I think people that advocate functional programming, this one totally outweighs the other one.  In particular I look at the time I spend writing and when I have bug in C program and use, drawing memory diagrams, using debugger, setting through, watching variables, and after 3 hours I get something working because one function was changing something way far away from some other function unrelated to some other function but had shared memory that was goofing things up.  Hard to reason about your programs and understand them because things are so spread out.  And so you know, in that 4 hours of programmer time, well, think of all the, if I had 4 extra CPU hours to run-on program, it doesn't matter how in efficient program is, when I have extra (Inaudible) -- you know, logic like that. 
Those are, -- consideration and I think why people who advocate functional programming that would be their main argument.  Easier to get correct code and that is so much better than code that runs somewhat faster.
	So, okay.  On the other hand might be cases where you're running a program and too slow.  Running web server, Amazon web server and need to be handling 5,000 HTPP requests better second and functional approach is not doing it.  That's E that might be a place where you back off, think harder and work that.
	Okay.
	I think, that would just, so these are some -- having done this homework, these are reflections that I have.  I don't know if you have them, think on, chew on, and -- hopefully some of things you come across, you'll think back a year later and mull them over and chew on them and decide what you like or dislike.
	Okay.
	Da-da-da.  So, the covered those topics.
	-- new topic.  I want to talk about.  -- I want to think about, think about, going to be writing a project in territory pret ter for our own language and think about the syntax we use for that and to get us in the mood for that, I want you to remember -- what is the syntax for calling a function -- not for defining a function -- for calling a function in Racket, and in Java.
	So in Racket, imagine Racket compiler thing, you get text file, get Racket source file and looking at substring of it, how do you know something is a function call, how can you tell?  What does it look like?  Yeah, exactly.  So open paren.  And then it's, go ahead and say, identifier.  And you think of this as grammar sort of like.  You know.  I don't want to put all of the grammar overhead into it but a function call would be open paren followed by some identifier followed by 0 or more inputs.
	Really, it's any, and then a close paren, each expression might be, can be any expression.
	Some examples are, square root of 16, ESPT 2 raised to the 3 plus of 37.
	So, each of these, so -- examples, yup, sure enough open paren, identifier, SQRT, and expression 126, we haven't talked about what expression are, we'll do more of that, 16 is an expression, and then closed paren, open per ran, identifier, one expression.  And this can be some whole other expression.
	So -- yeah.  So -- and actually if you look at this here, this expression is itself, go ahead and say pie, there we are, is another function call.  So function call is one type of expression.  And this one, does this match syntax for function call?  Does it start with open par ran?  Gentlemen, does it have identifier after that?  I'll say yes.  What is the identifier?  Is the little cross symbol.  Just another character, like SQRT is one identifier name, that little cross is another identifier name and bound to the addition function.  -- PI, bound to 3.14 and little close to addition function.
	Identifier, 2 expressions, turns out identifier are expressions like pie and -- so this little sub chunk itself was a function call -- and function calls are a pipe of expression so this whole thing was an expression.
	Okay.
	Yeah.  So for, Java, what does it look like?  It could be, I can have, identifier, followed by open paren, popped by, exprs, I cannot say 0 or more exprs.  We had whole homework on comma's it could be 0 things, 1 things, 2 things, so it would be comma, separated, exprs and this, couple of other rules we did in the homework.
	-- okay.
	So, yeah, that's, except that's not how you call a function in Java.  I think of substring, how do I call substring in Java?  I don't say substring open paren something comma something -- yeah.  So before the name, before the identifiers substring we need to have a bot dot and in front of dot another identifier.
	So this is the -- this identifier is your method name -- this identifier is the object that you're call ting on.
	Okay.  And by the way, this thing here is an expression.
	Now I want to -- I claim this is a little bit of a lie.  In Racket.  I claim the thing after the open paren does not just have to be identifier, we have seen, talked about some things -- so it could be identifier, so -- oops -- here is another example where, that was identifier.
	But, what's another example?  I'm going to say, do something similar and go ahead and yeah, add one.  -- pi.  Okay, I want something similar to add one of pi.  So, turns out defines are not calling a function.  They might define a function but they don't call a function.
	Yeah.  Is there a way I can add one to pi without putting identifier here.  Identifier add one I can put that there.  I can put the plus identifier and include the one later on.  But I want something a little more.  In fact, you know, I think I can even go ahead and, I'm going to go through and dotd stepper on this.  Step.  So, I made a little function called my add one.  Takes number and adds one to it.  Call my add one of 16 and look at stepper and see what happens.  What's the first thing that happens?  -- the green part, my add one, that identifier turns into, oh,  the thing that identifier was bound to.  And I claim this thing on the right-hand side that includes the purpose part is a valid function call.
	So first of all, when we said define this, really, what was the sin tack tix for?  For a while I was telling you we had 2 versions of define, one attach name to value and one made a function.
	And then I revealed I had been lying, there's only one type of define, the type of define that attaches a name to a value.
	This define here, my add one -- really, I'm, attaching a name to that value.  What value, what is the value of my add one?  -- hint, we barely solved in stepper, see if we can type it out.  Either in chat window shtions or type out the full value here, syntactic sugar for -- see if you remember, it involves lambda -- not quite what Steven has -- awful close, Steven is just missing 2 characters.
	Yeah, Steven had it except parentheses around that.
	We group together, we have a keyword and parameter list and then a body.  Sort of like this is a struct with 2 fields.  Right?  There's the body is one field and the argument list, parameter list is another field and this is like the constructor for it.  That's a weird way of thinking about it.  I don't know if that's helpful.
	Okay.
	Okay.  ra yeah.  So, here is way to do something that does not mention an identifier right after the open paren.  -- 
	This here, is this function open paren followed by this blue issue gray area, open paren followed by that, followed by 16.  That's valid expression.  What's my point?  -- going up here, what can be here, can be anything expression you want as long as it evaluates to a function.  It can be identifier, you back a function value, that's what little cross did.  Identifier, evaluating, bound to function value.
	Lambda, literal function value.  Sitting there in the code.  And we haven't seen the but can make functions, if you have function that return, function's answer, you can call it and get that same thing.  So -- do you want to see example of that?  Define -- so don't worry too much about this, this is kind of cool.  What does make add err do?  It takes in a number K, and returns what type of thing?  It returns a function.  A function that takes in -- N and returns N plus K, that's a number already.
	Okay.  What is make add err of 99?  That's a function, if I go ahead and take that function, copy this, open paren, put in some expression that evaluates, going to evaluate to a function and call that function on 3.
	Oh, -- interesting.  Let you stare at that for a second.
	This went ahead, with some expression itself.  Itself was a function call, recall that function, make add err, when we call make add err 99 we get function back, the thing after first open paren was expression that evaluated to sort of function.
	We took that function and Fed it 3.
	-- what function came back by the way?  A function that takes in in N and returns plus 99.  We got 3 plus 99.
	So -- okay.  Anyway, what's my point about this?  This can be any expression as long as, whatever it does, it evaluates to a function value.  Same way, when you call substring, those last 2 number that's you give, can be any expression but better evaluate to a number or else it's an error, function call, the first thing better evaluate to a function value or else it's an error.  Okay.
	So that's kind of, sort of board denies our picture, same thing happens here, not.
	Does not need to be identifier that comes before the method name.  In needs to be method name, something dot method name, in Java it has to be method name.  But this part does not need to be identifier, I'll show you an example.
	First I can do string 
	M Mississippi Mississippi -- where substring, identifier, open paren, some expression, some expression.
	And get answer back.  The thing before the dot does not need to be identifier, what else can I put there?  -- Virginia state.  Want to making sure I have enough letters there.
	The thing before, so I don't have identifier, I have literal string sitting there.  I can also, before the dot substring I can have some other expression as long as that expression evaluate to a string, I'd be okay.  I'll put in parentheses to make it clear, put in some other expression that evaluates to a string -- gosh, needs to be really long -- now that's too big for integers to hold, rats, need to make smaller indices here.
	There we are.
	Okay.  What came before the dot?  A whole expression that was a self another function call but returned a string.  So what's the actual in tax in Java, not identifier dot, this is method name, but this can be any expression -- okay.
	You happy with that?  -- so, you're light right often in code you put identifier dot method name but could be anything before that dot.  As long as any evaluate through the object.
	Not happy with that?  Zoned out?  Shell shocked?  -- no opinions?  Obvious?  Or -- interesting?  Still processing it?  The thing before the dot can be any object, anything that evaluates to an object.
	And by the way, you see this all of the time, you take -- where do dot to uppercase dot substring of 2 comma 3 plus 4 dot length.  This is not unusual Java code here, the idea of something dot something dot something dot something, really there's a bunch of parens going on there, this whole thing dot length.
	And if this whole thing, that was something dot substring.
	And that something dot substring was something dot to uppercase.
	Yeah, you use this all of the time.  Yeah.
	Quite common to have these things together dw good to know actual syntax in Java, similarly in Racket any expression.  The things that different, is that -- this doesn't have to be identifier, in Java this part does have to be identifier, the name of the method you're calling.  And that's probably part of static type of system enforcing that.  Okay.
	Is that the only syntax for calling a function in Java though?  I think there's another way to call a function in Java.
	And hint -- what function are we calling here?  -- 3 plus 4, that's calling addition function, right?  It's a different notation, call addition function, you don't call like you do substring.  You say, you give one input, and then the name of the function, little cross and then the second input.
	And that's called and operator in Java, what's an operator, operator is function but call it in a weird way, that's all.  You dpont place your arguments in parentheses after function name, you place arguments to either side of function with binary operator.  That could be another -- where OP is any of (Inaudible) that's another way to call a function.
	Is there another way to call a function in Java?  Now I'm going to remind you about -- when we went ahead and made class book and class DVD and stuff like that.  In Racket we made a struct and how did we call the instructor, we called make book, make hyphen book, how did we call it in Java, we had keyword new, followed by a class name, followed by open paren, followed by cop ma separated expression.
	Calling an instructor was slightly different syntax from up here.
	Yeah.  -- what else do we have?  That's a different way of calling a function in Java?  So new itself is an operate for, un naer prefix operator, keyword that comes before other things that make it do what it does.  It's more in the vein of this thing here.
	And in fact, see if I have -- here is a link, you can look at that -- these are all operators in Java, square brackets, round parentheses, minus, minus, not, type casting, instance of, some of these like, amp per sand and amp per sand, instance of, and plus, oops, binary plus -- are all, they are sort of same syntax, you have 2, expression followed by that one operator, whether plus or amp per sand, or amp per sand, followed by another expression.
	But, new, how do you use, special syntax just for calling constructors.
	In fact, the other table I was thinking of.
	-- this is a syntax for calling a function, what is this a syntax for?  Barely mentioned on the other page briefly.  Example would be INT of 3.4.
	that's a type cast, is that calling a function?  You bet it, taking function 3.4 and returns, giving you back a whole different thing with a whole different bit pattern that was closest to that.  In fact, there's even -- there's a function in Java that class double dot INT value, something like that, that's what's being called here double dot INT value.  You don't call it like this, or this, or this, you put parentheses around, around the name of the function and not around the input.  Oh, my goodness.
	What are other ways of calling a function?  Java, how about this?  Give an example -- data square brackets 4.  What is that?  In particular, if you have, an ID followed by square bracket followed by expression followed by square bracket, is that a function or looking up something in array -- this is looking up something in array, right?  Is that a function?  Well, you know one thing that I learned doing Racket is that, in Racket you have arrays and look up just like this, there's a function called array look up and give it 2 pieces of information, the name of the array, and what index you want to grab from.  And it's regular honest to God function.
	Square brackets, std function array look up and put one argument in front of square brackets and other argument between the square brackets.  And it's a whole, it's really just calling the function array look up, give me array, give me index, I'll give you back thing, that's a function.  Yeah.  -- oh, my goodness, so -- these are all, and what else?  -- give an example -- some object dot, how do we do a field look up in Racket, open paren, get a getter function like world hive pen aliens and give it a world object.
	Same syntax for function call, how do we do that in Java?  It is, identifier dot, identifier, this first one doesn't have to be identifier, any expression that evaluates to an object that has this thing as a field -- so dot is way of calling primitive getter function, in this bracket we saw, we got guilty in getter function and used it; however, we wanted.
	These are all, it looks like this, but it's, this doesn't have parens after it, okay.  So -- go ahead and take a break.  What is my point?  -- gosh, Java and most languages you learn there are a lot of things that you probably didn't think or realize these were all different functions.
	Never realized type casting is calls a conversion function.  Constructor is just another function.  Built in in fix plus, that's addition function you may have realized that.  Looking up something in array, probably didn't think of that as a function, but yeah, I give you 2 pieces of information, you give me back the answer -- that sounds like like a function to me.
	My point, Java, 1, 2, 3, 4, 5, 6 ways of calling a function in Racket these are all the same syntax.
	-- so -- why am I teaching you Racket?  One reason is, I don't want to bother teaching you a language with a whole bunch of in tax.  I like Racket because we get to doing stuff right away and not talking about syntax.  These are all these library funks Annie language you learn a lot of library funks.
	In Java I teach 120 and trying to get students to be fluent in all of these things and understand what they're doing, not easily done in 14 weeks of our course here at Radford.  There's too much going on.
	So -- okay.
	So, I'll leave you with that, and again -- now, the other thing I want you to think about, I don't want 20U be angry about me, thinking I shaft Java in bad light.  I think Java is easier, go good.  Go ahead and tell me why it's easier, but be aware, in 134 ways more complicated.  Grammar rules are more complicated for calling a function.  Depends what type of function you're trying to call.  Constructors call it a different way.  Built in arithmetic call it a different way, access field, call it a different way.  Go ahead and take a break and come back and finish week 10.
	Yeah -- 
	[Break Time] 
	[Break Time] 
	[Break Time].
	PROFESSOR:  Okay.  Yeah, one thing about gosh is this week 10?  End of this week is week 10, that's sort of the middle of semester?  Maybe a little after, I think now that finished this last homework processing lists, we'll have an exam coming up at some point, it won't be, early it could be out is Friday and in class section cheered and said not this week.
	I'll probably get it out early next week,@ be concurrent.  It will have homework stuff, be a little lighter and have that exam.  The exam will be, data definition, following the design recipe, and processing lists.  So not trees.
	And grammars.  So grammars, following the design recipe and including in particular design recipe for list of something.  So, and it could include, I'll give a design, data definition you have not seen before, maybe using made up words, goof law is either a SCHLUMBER or la la, or FRUFRU, if I gave you as data definition, what would you code look like?  Gave you as a data definition.
	If I gave you definition, I forget what I said, you should think to yourself, it's something or something, it would be a cond with 3 branches.
	So -- yeah, so again, that's just, the design recipe is there, go step-by-step, yeah and I think we're recording -- and, be sure you do that, you know how to do that.  Can do those steps in your sleep.  So, all of those steps are geared to help guide you through a problem.
	Yeah, I'll probably be, I mean, it will be one hour, in class -- to my other section, unless I make that take home.  I'll probably you like an in our map, probably 50 minutes, if you want to use 90 minutes time, should not we be the issue.
	Own your honor to be closed book.  So yeah.  So, we'll get details of that, be looking at, designer recipe, following examples of that, processing lists -- so -- 
	And again, that last homework a lot of it was processing lists, going from one alien list to list, draw one alien before, and how do we draw a list of aliens, so, similar, yeah, beginning sometime beginning next week or so, stay tuned for details.  But I'll probably give it November 9th to my other class.  For you guys, it will be -- maybe I'll give it more asynchronous -- so -- okay.  Stay tuned for that, and I'll put out a sample exam as well.
	We're talking about in Java things that have different syntax, you know, I said in the beginning there's why do we study languages and I think (inaudible), talking about natural languages but you don't really understand your own language until you speak another.  Similar here, I think we're getting a new, Java is your primary language, getting new insight how we think or conceive of it, there's a couple other things not quite functions but things that I think are interesting because, Racket used a function like syntax, using similar syntax to this.  Even though they're not functions.  
	In Java, there's, operator, right?  But, function in Racket, feels like a function, but not quite, because short circuiting.
	If statement in Java doesn't feel like functional ought.  Partly because I can have an if without else.
	Doesn't make sense in Racket where you have to have an answer, if that happens here is the answer, you have to give answer in all cases.  Which is what Java, (Inaudible) operator does.  -- there you always have to have both, the answer both ways, it composes, and build bigger expressions out of that, X gets and have, you can't say F gets followed by if statement.
	NOT, yes -- -- so -- so we have, that, other things that are not really functions but act like it, assigning -- to a, variable -- using the the, we have things like X gets 2 plus 3, semicolon, that's assignment statement.
	In Racket, that tends to look like, now we're not using full Racket and not allowed to assign (Inaudible) but they do have something called set bang, it's not calling a function at all, looks like same syntax, a little more uniform.  Assigning to a field, this should be little thing, things that aren't function calls, but kind of look like it in Racket.
	Assigning to it.  So let as well for binding.  Assigning to a field.  You know, we should go ahead and well, -- that can look like assigning to a field or assigning to a variable.  Right?  -- okay, maybe assigning to a field looks like that, assign to go field and assigning to variable is really significantly different things.
	Assigning to a local variable, nobody can't affect anybody else.  Assigned to a field can be seen somewhere else.  So there's, in fact there are fundamentally different enough, in Racket they have different things.  In Racket, it would be like set alien X of, an alien AL to be 17.
	Or, plus 2, 3.
	Something like that.  So -- should I call it OBY.  Where you write this, in, Java you say this up in Racket.
	So -- okay.
	And this is one where sort of, say I'd like, I really like Java syntax better are, and that's perfectly fine.  But know why you like it better and what advantages an disadvantage that's come with it are.  Okay.  And, of course, we saw, loops, loop construct looks nothing like a function call, we make that, Racket doesn't include loops we write them as real tail recursive functions.  Okay.  So -- those are some of the other things that, aren't function calls but in Racket still look like function calls, which I think is interesting.
	So -- certainly all of those, that made me, you know, think or whatever, sort of like, those are all just different syntaxes for calling a function and have to use the right thing for the right situation in Java, depending on what sort of function it is, okay.
	Yeah, da-da-da -- what do I want to mention next?  -- yeah.  Methods versus fields.
	Okay.  So -- methods and fields are entirely different things.
	And, in Java you declare and object and here you have certain fields an have certain methods on them.  And they're, very different.  But in Racket we saw, like this example down here, that you know, a function, there was a function that was different from the name attached to the function.
	You can talk about the function without talking about the name attached it.  If you have first class functions, which Java doesn't.  Although Java works hard to look like it does and does a good job looking like it.
	Yeah, so wait a minute.  If all, really in Racket we just have everything is identifier, and it can be bound to something that might happen to be a number, it might happen to be a string, it might happen to be a function.  Well, I want to illustrate, in Java script, the same thing -- so, in JavaScript is another language like Racket has high order functions, functions has values.
	I'm going to make set FOO to be the empty object.  And this is some website, so JavaScript interpreter, type in JavaScript and run it, not only inside browser, kind of nice.
	And here they have, this was from their site.  FOO dot max is the function, that does such and such.
	So -- I make an object, right now it has no fields and no methods at all.  Okay?  If I try to call the max method and pass it in array it's going to pale fail.  I run this and get type error, foo dot max is not a function, there is no method Cal you willd max.  Totally empty object.
	Here is what I can do, I can in JavaScript, first assign to a field and if that field did not exist I make a new field.  What am I assigning?  I can say foo dot size gets 92.  And that's a perfectly fine thing to say in JavaScript.  Okay?  Well, I can do this foo dot max gets all of this here.  Hey a function that takes in A and does this with it.  Does blah-blah-blah blah-blah-blah return N with it.  What's the key that corresponds to function, JavaScript they call it function, we had a similar keyword in Racket?  Not define -- this is, the define, assigning something to a field -- yeah.  Lambda, a function that takes in one piece of information call it A and returns that.  Lambda might be intimidating Greek letter sounding term, but you see this in JavaScript, this is an anonymous function, here we happen to give it a name. 
And in fact we happen to attach it to the field max of the obility foo.
	
	I'm going to run this here, yeah.
	And what happen snd we foo dot size was 92, foo dot max became this function, and if you care, doesn't matter, loops through, give a race and looks through things in array and keeps bing track of maximum so far when they came M.
	As it run it's prints out maximum so far, every iteration through.  I passed it, I called foo dot max of the array, 2, 34, 3, 5, 1, this here -- on the other side, but here is the answer 5, what's interesting about this?  I think, is max, so inside the object foo there was this field called max.  It was bound to a function.  Is this a method?  Or is this a field?  And the answer is both.  I mean, it's really a false dichotomy, Java says you're one or the other and different beasts, but once we have higher order of functions I may have some fields bound to numbers an other fields bound to functions.  No problem.  And I'm, sure what the difference between a method and field is, they're both just, method is the field that happens to be bound to the a function value.
	Yeah.
	So, that just to stretch your mind a bit.
	This comes part in parcel how high err order of functions.  So -- and by the way, separately, we're talking about type conversions before, and so, I'm going to look at, going to add one line here, bracket, bracket, is equal to curly bracket, curly bracket, I'm going to run this.  And why does foot dot max not print the answer?  -- let me -- here it printed 5.  I'm not sure what happened to that 5.  Anyway.  let me comment this out.
	Never mind about this example.  It turns out, I was trying this before and coming back and saying true.  Let me get rid of everything else.
	Okay.  Run this, it says false.  Is the empty, turns out bracket, bracket is empty array.
	Curly bracket curly bracket a object.  -- says false -- by the way I can swap that and say -- what about -- let me do without semicolon there.
	Just to make sure.  Okay.
	What about this?  Bracket, bracket, equal equal, square bracket, square bracket, that's suddenly a syntax error, this is JavaScript not PHP that, PHP has weird stuff but JavaScript does too.  This one is false, this one is syntax error, what's going on there?  Bracket bracket here, doesn't think of that as the empty object.  Thinking of that as a block of code, empty block the code and now it's really confused.
	Okay.  Anyway.  That's just a little side note.
	Thing I wanted to convey was -- the fact that, yeah, fields and methods are maybe not as different.  Now that we have high order functions maybe not as different as we thought.  And in fact in JavaScript you can take any object and attach a value to it, Willy nil ly, I have object foo, didn't have method called size before, I'll assign the field and now it has one.
	Assign to the field max, assign it a function and now it has a method called field or, I would say it has a, -- sorry, method called max.
	It mass has a field called max bound to a function, and call it like this.  But -- yeah, so JavaScript is weird like that.  He Kay.
	I want to end up with, saying, where are we going with remainder of semester, we talked about processing ancestor trees, and one reason we did that, we're going to be, for our last few, we'll have several more homework that's build on interpreter, not next but after that.  We'll make our own language and own expressions and own assignment statements and if statements an we'll go ahead and implement those and build parse tree for it and work with that parse tree.  That's why we needed to do trees like ancestor trees to parse back to trees we talked about.
	We'll makeup, you can implement this in Racket or Java or use a different language, that's okay, too.  The language, we will makeup our own language though.  I wanted you to think about now, I have a web page here -- da-da-da da -- my first question, what do we want our assignment statements to look like?  Okay?  Code the language will be your choice Racket or Java.  So -- I'm going to look here, and look at a, group of different languages and how they do assignment statements.
	Okay.  And we already saw, lisp like, let X be 2 plus 3 and fiing you're out X plus 9.  The scope of X is this pod here.
	And so we saw, let relative of let star, look like this -- okay.
	So makes a new variable, initialized it, and tells what the scope is.  -- there are other languages like ML that use, keyword end, let X and use equal sign, let X equal 2 plus 3 in X times nen and little end statement to end the scope of this new variable we just made.
	Okay.
	So -- in C shairp they are using clause, using and some sort of variable declaration, sometimes import and then they have code like that.  Yeah.
	JavaScript you go ahead and, declare VAR as keyword and initialize it and go ahead and use it.  Java, same thing, curly brackets to limit the scope.
	Has hell is language that's different, has hell is language that's different.  In new line here, they do it backwards, X times 9, except like Racket that has prefix notation, they don't use any parentheses, then they have new line, where X equals 2 plus 3.
	So they sort of do assignment, where a little where clause after the main body saying what it should be.  Those are all options.  nard to this equal sign here, you can have different things.
	Paschal and ADA use colon equals to to talk about assignment.  It's different than testing quality.  It's nice to use symbol that's not drilled into head since kindergarten for ee call it, I like using some other symbol.
	I like a left arrow is kind of for you guys -- it's kind of neat because it shows, hey, X arrow, X arrow 2 plus 3 and shows, tibing 2 plus 3 and send into variable X, so I like that as a thing.
	We're going to makeup our own language, you get to choose, we'll vovt on as a class what we want assignment statements to look like.
	And by the way, another thing about use thing arrow.  Combining arrow with HASKELL thing, not really combining with HASKELL, at all, but saying 2 plus 3 and left arrow 2 plus 3, I might say, would plus 3 right arrow X.  That's all the time students in javaone class, X gets 2 plus 3, they want to go in the other direction, or say X gets Y plus one, they want to take X and put into variable Y and add one or something like that.  Because they want to go left to right.  And if I look at X gets 2 plus 3, first we figure out 2 plus 3 and then put into X.
	Imagine 2 plus 3 right arrow X and body that uses that temporary variable here.  So -- do people have a -- any comments or preferences what they want assignment statements to look like in their language?  Do any of these strike you as particularly interesting or good?  By the way, you can use uni code characters, if you want to use ee mow gi, -- if it occurs as uni code.
	EMOGY.
	Think about it.  What do you want, an assignment statement to look like in your language, we may a well make it fun, easy to use, interesting -- so.
	This is actually from an old semester, put out with this, in line and on campus class to decide what syntax will be.
	I have it here -- -- example, language, we used while back -- here is the grammar for it.
	So maybe a little test.  Not a test, just a little exercise to help us remember grammars since they'll be on the exam.  Here is grammar for expr, use thing grammar, go ahead and give me several different expressions.
	-- number means any number, any numeric literal, so.
	You O I think you should all be looking saying I can make expressions out of this, and I want to see 10 examples, maybe 5 examples.
	Chris wins with a shortest one.
	Number -- so yeah, Steven, 9 plus 9.
	So why does 9 plus 9?  What sort of expr is it, looks like open paren, this one, -- it could be PLUS -- okay, open paren 9 close paren, yeah.  Chris racking up the short ones.
	Yeah, another one like 8 times, instead of plus.
	-- now I see ones that are more involved.
	I think we exhausted the super easy ones.
	So, Aaron going for the IF followed by expr, one is expr is 0 then etc... so, Aaron is close except -- what are you missing Aaron?  Semicolon at the very end, okay.
	But I like that.  Chris going for 8 plus open paren 9 minus, close Chris on that one, missing final expr, 9 minus 2, something like that.  You can certainly nest these.  Think about for all of these, what does tree look like, everything up until Chris's example were very shallow, one level deep or so, Chris is add extra level into it.  The second expr was not just number but whole another bin expr, yeah.  Let's go for, look for the most twisted one that you come up with.
	So Sean has one that's a deeper tree, all using bin expr -- expr.
	If, and open par ran 9 close paren, I like that.  You have if statement and paren expr here is 0 then, now use bin expr there and negative 42, probably missing like a times or another OP there, between necessary 42 and 5 minus 7.
	-- so that's even richer, more complicated.  Tree there.
	Yeah.  So I like all of those.  I'll give one more.
	-- I can do interactively here, -- so -- you can see it.
	Easiest way for me to type here -- so, bin OP, so is -- try making, Chris are you asking why between the negative 42 and 5 minus 7 you need something else?  Oh, okay.  And you know, making the tree for my any of these things, I think that's good self exercise to try things.
	-- a ha, if, and bin expr fold by keyword is 0, and bin expr else, inside else, what sort of expr do you have inside your else.  Yeah, not another if expr quite, technically, -- so Sean, yeah, something, is 0 then blah-blah-blah, else -- inside that else, what type of expr do you have?  It is an if statement into a paren expr, if statement by itself doesn't have par reasons around it.  The way you do it -- -- missing semicolon in that if.
	If 3 is 0 then 4 else blah-blah-blah, then you have parentheses around that sub if expression.  I like that also.  Okay.
	Yeah.  Things are looking good.
	And so I'll go ahead and give one more example, just for fun here.  If I try to come up with weird examples, what's the best way to get some sort of place for me to type -- make this small -- okay.  I'm going to say, make it a paren expr, and have -- throw in a bunch of parentheses for fun and bin expr, can be something plus, something -- that first something is going to be a -- if, if, 2 is 0 then -- and 4 else, 7 semicolon, plus, and this is going to be another if, -- if 3 is 0 then, now I'll have another if statement here -- if 0 is 0 then 0 else 0, semicolon, and actually I'll say, in the middle of blah-blah-blah plus, if, getting too deep, should have been more careful, plus if 3 is 0 then blah, I don't need parentheses around that blah, else 7.
	Okay.  Yeah.  So that's (Inaudible) swift answer.
	So you can nest these as deep as you like, most of your if statements were mostly top level except for Sean, top level, here what is the top level of the root of the tree of this whole big expression?  what sorlt of expr is it?  -- yeah, paren expr.  Follow that's open paren, and expr in inside that paren is another, and another, then we go down and bit bin expr, left-hand side is if, and then the right-hand side is also an if.
	Yeah.  So, making you think about making the tree for that.
	Is that evil?  Convoluted enough?  I'm not saying this is a good program.  Yeah.
	Of course it won't talk much longer, well no, take a little while.  But not twice as long as writing it out linearly.  In a tree, half the nodes are leaves and half are interior.  So if the leaves are all the stuff here, that's about half the work already.  And anyway.  Okay.
	So -- this is the language that we did, a few years ago, we'll do something different but similar in spirit.  We're going to have probably some way of parenthesizing thing, nice to have parens to group them together.  We need some sort of if statement and I don't want to get into Booleans, if you look at this statement, there are no Booleans involved.  Keep it as numbers, now you don't know what this language means, I'm giving you syntax for it.  Semantics is different.  You probably guess, I chose suggestive keywords, like if, then, plus, times, and you probably guess what I intended, but you don't really know what I intended.  So -- anyway, I'll leave you with thinking about that -- and, what sort of constructs we might want in our language, send me e-mail, -- saying here is how I want if statements, and maybe syntax looks different. 
Make sure it's easy to parse, one thing we'll need to do go from a string, your function, you'll be given say a 5 L with a program written in this language or expression in this language and you're going to need to go and turn that string into the parse tree.
	And I want to make sure it's not too hard to do that and we'll talk about how to do that over the next week and a half or so.  In particular, talk about recursive decent parsing.
	And try to put up flip videos, using a language things that slightly old variant, but the one we do will be a similar language structure.  So -- I'll make it a little different so people can't use previous year's solution, you have to understand it to be able to do anything.  Okay.  Go ahead and call it an evening, my voice is going, going, gone.
	I think I better take a shorter, -- yeah, so be looking for the exam, they'll be homework out, need to figure out when homework is due because you'll have the exam to think about, and thinking about this language -- send any ideas if you have certain things you want or don't want in our made-up language.  So Kay, see you next week -- just because I finished early this week doesn't mean I promise to finish early next week, but maybe we'll get lucky.
	So -- --