Files
metabuilder/mojo
johndoe6345789 255919254a chore(hooks): Consolidate hooks library to root /hooks directory
- Moved 104 production-ready hooks from frontends/nextjs and redux packages to root /hooks
- Removed duplicate hooks from frontends/nextjs/src/hooks directory
- Updated frontends/nextjs to import from @metabuilder/hooks instead of local hooks
- Added comprehensive documentation: EXPORT_GUIDE.md, FORM_VALIDATION_HOOKS.md, QUICK_REFERENCE.md
- Removed stale index.d.ts from hooks root (TypeScript auto-generates declarations)
- All 104 hooks now consolidated as single source of truth at root /hooks
- Package @metabuilder/hooks v2.0.0 ready for use across all MetaBuilder projects

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-01-23 19:59:13 +00:00
..

Mojo Examples

Example projects demonstrating Mojo - a new programming language that combines Python syntax with systems programming performance.

Why Mojo?

  • Python-like syntax - Familiar to Python developers
  • Strictly typed - Compile-time type checking
  • Systems performance - Comparable to C/C++/Rust
  • Python interop - Import and use Python libraries
  • SIMD & parallelism - First-class support for vectorization

Requirements

Project Structure

mojo/
├── src/
│   └── main.mojo          # Main entry point
├── examples/
│   ├── hello.mojo         # Hello world
│   ├── structs.mojo       # Struct definitions
│   ├── simd.mojo          # SIMD operations
│   ├── python_interop.mojo # Python integration
│   └── performance.mojo   # Performance comparison
└── mojoproject.toml       # Project configuration

Quick Start

# Run hello world
mojo examples/hello.mojo

# Build optimized binary
mojo build src/main.mojo -o main

# Run with Python interop
mojo examples/python_interop.mojo

Key Features Demonstrated

Strict Typing

fn add(x: Int, y: Int) -> Int:
    return x + y

Structs with Ownership

struct Point:
    var x: Float64
    var y: Float64

    fn __init__(inout self, x: Float64, y: Float64):
        self.x = x
        self.y = y

SIMD Operations

from math import sqrt

fn vector_magnitude[width: Int](v: SIMD[DType.float64, width]) -> Float64:
    return sqrt((v * v).reduce_add())

Python Interop

from python import Python

fn main() raises:
    let np = Python.import_module("numpy")
    let arr = np.array([1, 2, 3, 4, 5])
    print(arr.mean())

Resources