Mojo Miji - A Guide to Mojo Programming Language from A Pythonista's Perspective
by Yuhao Zhu 朱宇浩
Compatible Mojo version
This Miji is compatible with Mojo v25.3 (2025-05-06) and is working towards compatibility with Mojo v25.4 (2025-06-18).
Table of Contents
- INTRODUCTION
- PART I: START WITH MOJO
- Install pixi and extension (Install package manager and VS Code extension)
- Initiate Mojo project (Initiate a Mojo project and install Mojo compiler)
- My first Mojo program (Hello, world!)
- PART II: MOVE INTO MOJO
- Convert Python code into Mojo (Four examples, Python becomes Mojo)
- Things that are in common (Similarities between Python and Mojo)
- Things are different (Differences between Python and Mojo)
- PART III: BASIC MOJO
- Variables (Declare and use variables in Mojo)
- Functions (Define and use functions in Mojo)
- Data types - basic (Fundamental building blocks of Mojo)
- Data type - string (
String
in Mojo, similar tostr
in Python) - Operators and assignment (Operators and assignment expressions)
- Control flows (Loops, conditionals, and some about iterables)
- Structs (Structs in Mojo, similar to classes in Python)
- PART IV: ADVANCED MOJO
- Data type - SIMD (The first-class
SIMD
type)
- Parameterization (Shift work from run time to compile time)
- Generic and traits (Move to generic programming with traits)
- Ownership (The ownership system in Mojo)
- References (The reference system in Mojo)
- Lifetime (The lifetime system in Mojo)
- Data type - SIMD (The first-class
- PART V: APPLY MOJO (Let's use Mojo to program something useful)
- Design of MatMojo library (Some preparation work for writing a matrix library)
- Make it work (Define and implement the basic functionalities)
- PART VI: EXTEND MOJO
- Arbitrary-precision numbers (A library for arbitrary-precision integers and decimals)
- Multi-dimensional arrays (A library for numerical computing and NDArray)
- PART VII: MISCELLANEOUS
- Glossary of Mojo terms (Find explanations of key terms and concepts)
- Tips and warnings (Do not fall into the pits I fell into)
- Useful resources and links (Online resources and links related to Mojo)
- Wishes for extra features (Some features I wish Mojo could have)
- About the author (A brief introduction of the author)