Part 1. Starting Racket
I am trying to attempt to enroll an MOOC which is How to Code, Simple Data on EDX. The university has given us an incubator project which is to make a software for language learning in mandarin.
The main problem is that some of my teammates do not have self confidence in their abilities despite that they have made a functioning computer system. Hopefully, this course will teach them how to think more abstract which they will need to make their own computer systems. Most of them have imposter syndrome which would be detrimental to their progress, and some of them still want to live like teenagers, which is understandable since being an adult is boring as hell. I can relate, I would also want my free days back also. But tough luck, the arrow of time always moves forward and obvoiusly when they want to go to Manila for their OJT, well we have to finish the requirements of the University in the Incubator
To entice my teammates to take the course, I will try to blog as I learn the MOOC, at least as an encouragement.
The language to use here is Racket, which is a lisp variant, descended from one of the earliest programming languages along with COBOL, It has all the features of all programming languages, you learn that, and also the provided design theory in the course, you learn them all.
According to the instructor, you must actually understand how the code works, not by just copying and pasting things without a care on what they represent. Hopefully, my advice would be heeded and they will be more confident of their Critical Thinking skills as they have presented with their capstone projects.
And yes, this has just become a Job, a major one at that. I can see why some would want to back out.
I voluntarily took the role of a project lead, and would look into some project management tools, I am either considering gitlab for Source Control and Orangescrum for development. As an obviously inexperienced Project Manager, this would be the first time I would really handle a team. The teams I have handled back then are different, group members would literally have no contribution whatsoever, their loss. Now, it is warranted that all would participate, my teammates would be envious of the lightweight lifestyle of the interns in manila, understandably since they would be inexperienced while the rest of us would be already being baptized in fire.
While you may not use racket/lisp in the industry, this course will teach you to think critically, which we really need to complete the project.
Dr Racket Basics
Install the IDE for Racket, called Dr Racket and when opened, it should select a language called beginning student language. This is the language that I will use in the course. For the introductory lesson, expressions are the topic.
Launch Dr. Racket, in most cases, there will be no language selected, you need to select a language.
To select a language, click the language menu and choose language
Select teaching languages and double click beginning student
At the lower left, it should show the highlighted yellow text
When opened, there are two windows, the top one is the Definitions area and the bottom one is the interaction area
Launch Dr. Racket, in most cases, there will be no language selected, you need to select a language.
To select a language, click the language menu and choose language
Select teaching languages and double click beginning student
At the lower left, it should show the highlighted yellow text
When opened, there are two windows, the top one is the Definitions area and the bottom one is the interaction area
- Definitions area - Source Code
- Interaction area - Inputs and Outputs
Now that we got this cleared, lets have a simple arithmetic
To add in racket we do this
(+ 3 4)
This evaluates to 7 after we run it.These are what's called in racket, Expressions. and in turn it produces a Value.
You still remember PEMDAS in Elementary math??? or maybe you hate math, then why did you take programming in the first place. Just joking, but math is pure logic and programming is just a form of abstract math if you look at it that way. There are inputs, processes and outputs.
Expressions can also be complicated, just like grade 1 math.
(+ 3 (* 2 3))
obviously * is multiplication, any grade 1 student can solve it. Racket works like this. It evaluates the parenthesis first, remember pemdas rule. Heres another example so that you would get it(/ 12 (* 2 3))
That is division.So to summarize, how to make expressions in racket to output some value?
(<primitive> <expression>...)
where expression can be any number of expressions. Note that some primitives have a limited number of expressions.
This is how to comment in racket, start the line with a semicolon, since we have no expressions present, it will not output
To get the square and square root of a number, do this
sqr returns the square of the number while sqrt returns the root. Arithmetic functions, sqr and sqrt are primitives.
The instructor has given an exercise at this point and I will solve them by using my critical thinking, but please try to solve on your own.
I will only solve the first question on the lectures so that you will also have an initiative to take the MOOC. Programming is about solving problems just like math but more abstract, can't do that? Quit programming.
Okay, Critical Thinking powers activate
- Alright, Question is read, to find the third side of a right triangle, you need the pythagorean theorem. The hypotenuse is missing.
- Remember that the parentheses is evaluated, but in what order
- I can also nest parenthesis like a math problem, this takes me back to my Grade 3 algebra
- Alright, I need to add the square of 2 given sides in the adjacent and the opposite
(+ (sqr 3) (sqr 4))
As seen here, I am adding the results of the square of 3 and 4, hey, this is just like elementary math but i will need to get the root of the sum of the squares like in the math symbol
(sqrt (+ (sqr 3) (sqr 4)))
By any convention, If i remember my trigonometry, this should be 5
drumroll please
This is just simple PEMDAS, but instead of mathematical symbols, its words.
Just like math, it requires a little thinking.
Little fun note before we go, what about roots of not perfect squares, this comes up.
the #i represents that it is an inexact number, it is infinite but computers have finite memory so it is estimated as closer to 1.41
this was the first episode of using racket to evaluate expressions, good day.
Mga Komento
Mag-post ng isang Komento