Wednesday January 24th
Type-Checking with Julia
Did some User-Defined Types with Julia
-
It was for the optional / Honors portion of the course. So far, only myself and one other person have submitted. Then again, I am a week ahead :D
-
I watched the lesson for this week about four times. I really, really, really wanted to understand the types of Julia, particularly how Complex User-Defined Parametrized Types work in Julia. This is the core of Julia’s power.
We Created a User-Defined Type with a specific type
Instantiation
- We then instantiated the type. Types are mutable
unless you say they are immutable, by replacing
type
withimmutable
. - I defined a new type called
MyCube
of typeT
.
Instances
- I then created two instances of the type
MyCube
This was challenging
- A bit new for me. Julia is tricky about external constructors and can throw a conversion type error if you don’t define it properly. This actually took a while for me.
- Here I am defining a volume-method as a value defined by multiplying each
field in type
MyCube
. ieh x w x l
.
- I then took this method and found the log
Overloading
- Then I overloaded the methods using the
Base +
function. This reminded me a lot of function template overloading in C++
Whew!
I’m skipping along
- I have one more general assignment to finish up for Week 3 and then I do Week 4 assignments. I’m starting Week 4 lessons today to get a head-start.
- From Sunday, I do my Nanodegree Assignments involving SQL and Python.
Written on January 24, 2018