> For the complete documentation index, see [llms.txt](https://docs.cheddar.vihan.org/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cheddar.vihan.org/docs/functions/defining.md).

# Defining

Cheddar has various types of functions, these include:

* Methods
* Named Functions
* Lambdas

Methods are declared as part of a class which are covered within a later chapter but named functions and lambdas are specified here.

## What is a Lambda?

While a named function's name may be obvious at what it does, this is not the case for lambda. Lambda is the greek letter $$\lambda$$, what a lambda *is* in programming is an **anonymous function**. Now this brings up the question:

> *What is as an "anonymous function" and why are they important?*

If you come from a C background, you may be customized to functions which are declared and must have a "name" (i.e. assigned to a variable). As you come to functional programming, this is not the case for a majority of functions. Functions tend to not have named and are often dynamically created.

So lets answer the first question. **An anonymous function is** a function without a name, or one not assigned to a variable. It can be used as a literal within expressions just like any other object or value, such as a number, or a string. **This is useful** because this allows you to quickly create a function to pass to another function as an argument.

This idea of using functions together is what functional programming branches off of. While this simplification of functional programming may of described the basis of it sufficiently, enough jargon may be used in this chapter to make the concepts confusing. For this reason, a glossary is provided which can be referenced inline.


---

# 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:

```
GET https://docs.cheddar.vihan.org/docs/functions/defining.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
