Jock Documentation
  • Introduction to Jock
  • Getting Started
  • Language Basics
  • Operators and Expressions
  • Functions
  • Control Flow
  • Data Structures
  • Classes and Objects
  • Compiler
  • Hoon Interface
  • Nock Interface
  • Language Reference
    • ASCII
  • Tutorial
Powered by GitBook
On this page
Export as PDF

Introduction to Jock

NextGetting Started

Last updated 24 days ago

Jock is a subject-oriented statically-typed functional programming language which compiles to Nock. It inherits many conventions from the Hoon language, and its reference parser and compiler are written in Hoon.

Jock is developed by Zorp Corp and is currently a developer preview, preparing for an alpha release.

Here are some short programs in Jock:

// Demonstrate a conditional statement.
let a: @ = 3;

if a == 3 {
  42
} else if a == 5 {
  17
} else {
  15
}
// Create a decrement function.
func dec(a:@) -> @ {
  // A crash will occur on input 0.
  a - 1
};

dec(43)
// Create a decrement function, the long way around.
func dec(a:@) -> @ {
  let b = 0;
  loop;
  if a == +(b) {
    b
  } else {
    b = +(b);
    recur
  }
};

dec(43)
// Demonstrate a loop.
let a: @ = 43;
let b: @ = 0;
loop;
if a == +(b) {
  b
} else {
  b = +(b);
  recur
}