Monday, 4 February 2013

Week 3


I know... it’s a bit late for week 3's blog but I never had the time till now so here goes. 

Week 3 has been the most productive week for me so far because I was able to catch on quickly with this week's lessons and had a triumphant time with the activities.  We learned about definition, or in other words, defining identifiers for images, numbers, words, etc. I always find it fun to work with images because it gives me the freedom to use an image of my choice which gives me a little motivation boost to do the activities. Two of the many activities we had to do for this week were:

1) Calculate the sum of 149 divided by 7 with 83 times 15.
2) Append the first six characters of "sixty-five" to the first two characters of "twenty"

And I have to admit, after several failed attempts at doing this with no help what so ever, I felt like an absolute genius when I got it right!

Solution for #1 
> (+ (/ 149 7) (* 83 15))
>1266.285714

Solution for #2
> (define one "sixtyfive")
> (define two "twenty")
> (define first-six (substring sixtyfive 0 6))
sixtyfive: this variable is not defined
> (define first-six (substring one 0 6))
> (define first-two (substring two 0 2))
> (string-append first-six first-two)
"sixtyftw"

First, I was absolutely lost because I was so confused as to where the brackets and the math signs go but I found A 'Dr.Racket Manual' online which showed me just how to write those math functions.  For question number two, however, I did not know what function to use and was not able to find it on this online ’Dr.Racket Manual'. So, I felt especially smart that I came up with the idea of creating place holders or identifiers for each of the words that were to be used in the 'string append' function and ever more so when I later found out that this method wasn't even taught in class for 'string append'. Yes, there is a simpler and much easier way but still I figured it all out myself using only what was taught on the videos so I am going to keep up the pride.

Later that week we had a tutorial quiz on which a new function was created called 'sandwich' with its definitions and we had to figure out what that function would do in a certain case. Since I was familiar with this tactic (thanks to my ingenious moments with the definitions activity) I was able to seamlessly ace that quiz!   

No comments:

Post a Comment