Guides Intro to Mojo This guide is in the early stages, feedback welcomed on Githubopen in new window
Chapter Description 01: Setup Introduction and how to use the Mojo playground 02: Basic Types Get started with Mojo basic types and how to interact with Python
General Builtins Item Description Bool The primitive Bool scalar value used in Mojo BuiltinList The primitive ListLiteral class in Mojo BuiltinSlice Implements slice. Error Implements the Error class. FloatLiteral Floating point literal type. StringLiteral This type represents a string literal. String literals are all null-terminated for compatibility with C APIs, but this is subject to change. String literals store their length as an integer, and this does not include the null terminator. StringRef Represent a constant reference to a string, i.e. a sequence of characters and a length, which need not be null terminated. Tuple Tuple literal, consists of zero or more values separated by commas.
Decorators Item Description @always_inline Causes body of the function to be copied directly into the body of the calling function in the final binary @noncapturing Marks a closure as not capturing variables from the outer scope @parameter Causes the function or if statement to run at compile time @register_passable Indicates the values can be passed through registers @value Generates initialization, move and copy boilerplate
Standard Library Item Module Description Assert Assert Place constraints on functions that are checked at compile time, and check conditions only in debug builds Benchmark Benchmark Pass in a closure that returns None as a parameter to benchmark its speed in nanoseconds Buffer Buffer The buffer doesn't own the underlying memory, it's a view over data that is owned by another object NDBuffer Buffer A buffer that doesn't own the underlying memory, it allows you to represent an N-Dimensional shape both statically, and dynamically at runtime DTypePointer Pointer Store an address with a given DType, allowing you to allocate, load and modify data with convenient access to SIMD operations. Pointer Pointer
Store an address to any type, allowing you to allocate, load and modify single instances or arrays of the type on the heap
Random Random Provides functions for random numbers Sort Sort Sorts a DynamicVector[Int] inplace, in ascending order String String Mutable String with DynamicVector[Int8] as the underlying data type TargetInfo TargetInfo Functions related to determining host info such as OS, CPU, width etc. Time Time Measure elapsed time and make a thread sleep DynamicVector Vector Dynamically allocated vector InlinedFixedVector Vector Contains a statically known vector size, but can also grow dynamically at runtime UnsafeFixedVector Vector Can not be resized after initialization, but size can be runtime known
Benchmarks Benchmarking various conversions of Python to Mojo
Title Description Sudoku Solver Solving a Sudoku game as fast as possible