hello, world!

Originally written: July 21st, 2020
Last edited: January 20th, 2021

hello, world!

Throughout the years, I’ve worked with a few programming languages. While my expertise in them vary by a big margin – I can write enterprise software in python, but I’d have writing anything useful in Maple – I’ve decided to keep track of all the languages I’ve dabbled with.

To do so, I decided to write short hello world snippets in each language, and add anecdotes to each, if any.

TI-BASIC (2008 sept)

DISP "hello, world!"

Other than maybe some trigger programming in Starcraft map edtior, my first programming experience came with my TI-89 calculator in middle school.

I started because I was too lazy to type the entire quadratic formula every time, so I made it into a program. I wrote some other utility functions, downloaded Mario onto my calculator, but I don’t think I did much other else.

Java (2014 jan)

public class Main {
    public static void main(String[] args) {
        System.out.println("hello, world!");
    }
}

My first real programming experience came with java when I took my first computer science course in college.

I had fun writing in it. However, I became disheartened by CS when my professor told our class that confusion between zero-based indexing and one-based indexing caused once caused some spaceship to blow up. I can’t find any sources of this claim now, and I’m not even sure if this is true.

Nonetheless, this story made a mark to my 19-year idealist, romaniticist, purist self. I came deem to CS as “unbeautiful” because ultimately, it studied things created by mankind. During this time, I also participated in a hackathon using java, and did pretty well, taking second place. However, I spent more time reading documentation and tutorials on libraries’ API’s than solving algorithmic problems.

These two factors closed my heart to CS. While I still wrote programs here and there, I ended up not taking any other CS courses in college. Instead, I got a degree in math, mostly taking pure math courses.

Maple (2014 feb)

> "hello, world!";

I solved some linear programming in Maple. I don’t remember if I ever touched the software again after doing operations research (I don’t think so).

MATLAB (2015 feb)

disp("hello, world!")

I first learned MATLAB while doing chaos theory simulations.

I later came back to it while doing some machine learning.

Of all the languages I’ve ever used, it has the best syntax for linear algebra operations (unsurprisingly). Working in MATLAB and going to NumPy can be infuriating…

Bash (2015 june)

echo "hello, world!"

My first research stint exposed me to linux. We had to write numeric computing software to find counter-examples for our projects in graph theory and number theory, and then ssh to a high-performance server.

We got results for our graph theory project, but not for our number theory project. Writing this post, in fact, has motivated me to rewrite the computational software for our number theory project, now that I have more programming finesse. If I’m lucky, maybe I can get it to run on CUDA and actually get some answers?

SML (2015 aug)

print "hello, world!\n";

Don’t ask me questions about SML.

I maybe programmed in for three weeks until I decided to invest my time in other things (namely, algebra and linguistics).

R (2016 aug)

print("hello, world!")

My first foray into statistics came with linear modelling in R. I did a pretty fun project working with wifi data to optimize the library’s power usage.

Python (2016 sept)

print("hello, world!")

I have an anecdote about python that I like to tell people.

In May of 2019, I decided to learn python. I looked at online tutorials, studied its inbuilt data structures, its syntax, wrote some simple programs, etc. It reminded me of my java days. I learned how to use jupyter notebook (although I now it hate now), and worked on data science problems.

However, while browsing my laptop’s hard drive one day, I stumbled upon my old knot theory research I did between 2016-17. Turns out that my advisor and I had written the entire codebase for our research in python and SymPy. I wrote several chunks of the program, and got some results with it. However, after publishing our paper, I somehow managed to erase all memory of python. I not only failed to remember any of its syntax, but I removed my memory that I had even used it at all .

This incident surprises me to this day. How did I write so much python, and fail to remember that I had written in it at all? So much that when I “learned” python again, that it was completely all new?

C++ (2019 sept)

#include <iostream>

int main() {
  std::cout << "hello, world!\n";
  return 0;
}

Apparently, don’t use std::endl.

VHDL (2020 feb)

Unfortunately, I don’t think I can write a hello world statement with a hardware description language!

Please do correct me if I’m wrong…

Assembly (2020 mar)

.data
  hello: .asciiz “\nhello, world!\n”

.text
main:
  li $v0, 4
  la $a0, msg
  syscall

  li $v0, 10
  syscall

In MIPS.

I actually had a lot of fun learning assembly (contrary to many others’ experience). It enlightened me x1000 how programs work under the hood.

Haskell (2020 may)

main :: IO ()
main = putStrLn "hello, world!"

Even though I had dabbled with SML, Haskell was my first serious attempt at a functional programming language.

I learned a lot from it (still learning), but I do bemoan the lack of resources for less popular languages. While programming in python or C++, I can pretty much find answers to any of my questions by googling. For haskell, it may not be so straight forward. The lack of well-maintained, popular libraries also disappointed me ever so slightly. It’s comfortable to program in python because numpy, pandas, scikit-learn, etc. are the de-facto standard libraries for their purposes. They are actively maintained and developed, well-documented, and have a lot of resources. For haskell, I have half a dozen choices for a linear algebra library, and I can’t find an active smtp library with documentation or at least some examples.

Perhaps if I get very proficient in haskell and have the time I’ll develop some useful libraries.

JavaScript (2020 july)

As mentioned in another blog, web development is actually kind of fun. JavaScript also tends to be an easy language to pick up, especially with exposure to C-style syntax and working with dynamically typed languages.

console.log("hello, world!");

2021/2/19 edit:

After working for a while on a web project, I’ve come to… face the “intricacies” of JavaScript, for the better or for the worse.

I’ll probably save the rant for another day.

Coq (2020 Sep)

I’ve actually never written Hello World in Coq. Why? It’s just not very straightforward, and it’s not be meant that way. Consider this article: http://coq.io/getting_started.html#hello-world

Ocaml (2021 Jan)

I ended up in a situation where I needed to teach Ocaml without knowing it. Fortunately it wasn’t a difficult transition from using Haskell.

print_endline "hello, world!"

C (2021 Jan)

I’d dabbled with C previously, but I think it would do myself injustice to say I truly knew how to code in C. It was only really after I started linux kernel hacking that I got to start understanding the intricacies of C. I hate all the side-effects, but I appreciate the simplicity of C. All you need really is just the manual. You know everything that’s happening under the hood, it’s very explicit. Makes sense why people are a fan of the language (aside from practical usages such as systems programming and embedded programming).

#include <stdio.h>
int main(int argc, char **argv)
{
  printf("%s\n", "hello, world!");
}

Rust (2021 Feb)

Taking baby steps with this amazing language.

fn main() {
    println!("Hello world!");
}