Knights, Pikemen, Archers and Multiple Dispatch
An Intro to Julia for Programmers
Tired of programming examples featuring bank accounts, employees and employers? Me too! Let me introduce you to some of the unique features of the Julia programming language by coding a battle between knights, pikemen and archers.
The goal is to give a sort of tour of the Julia programming language, focusing primarily on the aspects which make Julia a fun and powerful language.
Before we can walk we got to crawl, so let me begin with a simple introduction of the Julia REPL (read-evaluate-print-loop). Install Julia and start it up in a unix style shell:
$ julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.2.0 (2019-08-20)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> println("hello world")
hello world
String Concatenation and Interpolation
Let us do something a bit more interesting with our text strings. We will look at how variables can be incorporated with strings.
julia> engine = "RD-180";
julia>…