> For the complete documentation index, see [llms.txt](https://opfn.gitbook.io/pallas/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://opfn.gitbook.io/pallas/deeper/jets.md).

# Jets

{% hint style="warning" %}
TODO: More thorough explanation + examples.
{% endhint %}

You may notice that the language contains very few operations, and doing everything with just increment/decrement is not very practical.

In practice, runtime systems need to implement more operations natively. Multiplication of natural numbers, for example, is prohibitively expensive if implemented directly on top of the PLAN primitives.

To solve this, PLAN adopts the "Jets" concept from Urbit.

Jets work by choosing a specific function, and making that "special". This one, for example, is special:

```
toNat=(4 (0 499848736628 1 (0 (2 0 3) 1)))
toNat=<{499848736628 1 (0 (2 0 3) 1)}>
```

When the runtime runs a special function, instead of running the legal code as usual, it runs a special built-in routine. The optimized version needs to have exactly the same behavior as the unoptimized version. This is is similar to the concept of an "Intrinsic Function"

At first brush, this may seem like an over-complicated and roundabout way to add new primitives. But remember that the perfect-forward-compatibility guarantee means that we can never change the shape of data. And also remember that functions are not opaque objects. So these details cannot be hidden away, adding a new primitive in the normal way, would be a breaking change that requires all data be migrated to a new format.

In theory, this system creates perfect compatibility between implementations. If an implementation doesn't know about a special function, then it will still arrive at the same answer.

However, in practice, an extremely slow programs is not so different from a program that doesn't work at all. So, changing or removing a special function is, in practice, a breaking change. We solve this by just never doing that. The set of special functions is specified in another document.

Furthermore, *adding* new special functions can sometimes be a backward-compatibility breaking change. Specifically, if we add a new special function, and then write code that depends on that function being fast, then the resulting database will run very slowly on old implementations.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://opfn.gitbook.io/pallas/deeper/jets.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
